Ignore:
Timestamp:
Dec 8, 2013, 4:38:25 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Podpora pro ověřování zadaných dat pro IPv4, IPv6 a MAC adresu.
Location:
trunk/Common/Form/Types
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Types/Base.php

    r601 r605  
    6060    return($Output);
    6161  }
     62 
     63  function Validate($Item)
     64  {
     65        return(true);
     66  }
    6267}
  • trunk/Common/Form/Types/IPv4Address.php

    r548 r605  
    2121    return($_POST[$Item['Name']]);
    2222  }
     23 
     24  function Validate($Item)
     25  {
     26        if($Item['Null'] and ($Item['Value'] == '')) return(true);
     27        return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)));
     28  }
    2329}
  • trunk/Common/Form/Types/Type.php

    r574 r605  
    1919include(dirname(__FILE__).'/GPS.php');
    2020include(dirname(__FILE__).'/IPv4Address.php');
     21include(dirname(__FILE__).'/IPv6Address.php');
    2122include(dirname(__FILE__).'/Color.php');
    2223include(dirname(__FILE__).'/RandomHash.php');
     24include(dirname(__FILE__).'/MacAddress.php');
    2325
    2426class Type
     
    5254      'Color' => array('Name' => 'Color', 'Class' => 'Color', 'ParentType' => '', 'Parameters' => array()),
    5355      'RandomHash' => array('Name' => 'RandomHash', 'Class' => 'RandomHash', 'ParentType' => '', 'Parameters' => array()),
     56      'MacAddress' => array('Name' => 'MacAddress', 'Class' => 'MacAddress', 'ParentType' => '', 'Parameters' => array()),
     57      'IPv6Address' => array('Name' => 'IPv6Address', 'Class' => 'IPv6Address', 'ParentType' => '', 'Parameters' => array()),
    5458    );
    5559  }
Note: See TracChangeset for help on using the changeset viewer.