Changeset 738 for trunk/Common/Form/Types
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- Location:
- trunk/Common/Form/Types
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Form/Types/Base.php
r606 r738 44 44 return(addslashes($Value)); 45 45 } 46 46 47 47 function OnFilterName($Item) 48 48 { 49 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 49 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 50 50 $SQL = '('.$Item['SQL'].') AS '; 51 51 else $SQL = ''; … … 55 55 function OnFilterNameQuery($Item) 56 56 { 57 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 57 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 58 58 $Output = '('.$Item['SQL'].') AS `'.$Item['Name'].'`, ('.$Item['SQL'].') AS `'.$Item['Name'].'_Filter`'; 59 59 else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`'; 60 60 return($Output); 61 61 } 62 62 63 63 function Validate($Item) 64 64 { 65 65 return(true); 66 66 } 67 67 68 68 function GetValidationFormat() 69 69 { 70 70 return(''); 71 71 } 72 72 } -
trunk/Common/Form/Types/Boolean.php
r548 r738 21 21 function OnLoad($Item) 22 22 { 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 24 24 else return(0); 25 25 } -
trunk/Common/Form/Types/Enumeration.php
r548 r738 18 18 $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']); 19 19 $Output = '<select name="'.$Item['Name'].'">'; 20 if(array_key_exists('Null', $Item) and $Item['Null']) 20 if(array_key_exists('Null', $Item) and $Item['Null']) 21 21 { 22 22 if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = ''; … … 37 37 return($_POST[$Item['Name']]); 38 38 } 39 39 40 40 function OnLoadDb($Item) 41 41 { -
trunk/Common/Form/Types/Hidden.php
r548 r738 10 10 $this->Hidden = true; 11 11 } 12 12 13 13 function OnView($Item) 14 14 { -
trunk/Common/Form/Types/IPv4Address.php
r606 r738 21 21 return($_POST[$Item['Name']]); 22 22 } 23 23 24 24 function Validate($Item) 25 25 { 26 27 26 if($Item['Null'] and ($Item['Value'] == '')) return(true); 27 return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4))); 28 28 } 29 29 30 30 function GetValidationFormat() 31 31 { 32 33 } 32 return('x.x.x.x kde x je hodnota 0..255'); 33 } 34 34 } -
trunk/Common/Form/Types/IPv6Address.php
r606 r738 21 21 return($_POST[$Item['Name']]); 22 22 } 23 23 24 24 function Validate($Item) 25 25 { 26 27 26 if($Item['Null'] and ($Item['Value'] == '')) return(true); 27 return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6))); 28 28 } 29 29 30 30 function GetValidationFormat() 31 31 { 32 32 return('xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f'); 33 33 } 34 34 } -
trunk/Common/Form/Types/Image.php
r631 r738 2 2 3 3 class TypeImage extends TypeString 4 { 4 { 5 5 function OnView($Item) 6 6 { 7 7 global $System; 8 8 9 9 return('<img src="'.$System->Link('/images/favicons/'.$Item['Value']).'"/> '.$Item['Value']); 10 10 } -
trunk/Common/Form/Types/Integer.php
r611 r738 23 23 return($_POST[$Item['Name']]); 24 24 } 25 25 26 26 function Validate($Item) 27 27 { 28 29 28 if($Item['Null'] and ($Item['Value'] == '')) return(true); 29 return(preg_match('/^\-*[0-9\.]+$/', $Item['Value'])); 30 30 } 31 31 32 32 function GetValidationFormat() 33 33 { 34 35 } 34 return('číselná hodnota'); 35 } 36 36 } -
trunk/Common/Form/Types/MacAddress.php
r683 r738 32 32 function Validate($Item) 33 33 { 34 35 34 if($Item['Null'] and ($Item['Value'] == '')) return(true); 35 return(preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value'])); 36 36 } 37 37 38 38 function GetValidationFormat() 39 39 { 40 40 return('XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F'); 41 41 } 42 42 } -
trunk/Common/Form/Types/Password.php
r548 r738 27 27 $Result = $_POST[$Item['Name']]; 28 28 /* 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 30 30 else 31 31 { … … 41 41 return($Result); 42 42 } 43 43 44 44 function OnSaveDb($Item) 45 45 { 46 if($Item['Value'] == '') return(''); 46 if($Item['Value'] == '') return(''); 47 47 else { 48 48 $PasswordHash = new PasswordHash(); … … 50 50 } 51 51 } 52 52 53 53 function OnLoadDb($Item) 54 54 { -
trunk/Common/Form/Types/RandomHash.php
r548 r738 10 10 $this->Hidden = true; 11 11 } 12 12 13 13 function OnView($Item) 14 14 {
Note:
See TracChangeset
for help on using the changeset viewer.