57 $this->Pred =
get_package(
'security::security_validator::predicates' ,
'last' , __FILE__ );
58 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
59 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
60 $this->SupportedDataTypes =
get_package(
'security::supported_data_types' ,
'last' , __FILE__ );
102 private function validate_default( $Data , $Name , $Predicates , $j )
107 if( strpos( $Predicates[ $j ] ,
'value_' ) === 0 )
109 return( $o->exec_value( $Data , $Name , $Predicates , $j ) );
111 if( strpos( $Predicates[ $j ] ,
'min_' ) === 0 )
113 return( $o->exec_min( $Data , $Name , $Predicates , $j ) );
115 if( strpos( $Predicates[ $j ] ,
'max_' ) === 0 )
117 return( $o->exec_max( $Data , $Name , $Predicates , $j ) );
119 if( strpos( $Predicates[ $j ] ,
'same_as_' ) === 0 )
121 return( $o->exec_same_as( $Data , $Name , $Predicates , $j ) );
123 return( $o->exec_simple( $Data , $Name , $Predicates , $j ) );
125 catch( Exception $e )
165 private function handle_data_predicates( $Data , $Name , $Predicates , $j )
169 switch( $Predicates[ $j ] )
171 case(
'email' ):
return( $this->Pred->validate_email( $Data , $Name , $Predicates ) );
172 case(
'float' ):
return( $this->Pred->validate_float( $Data , $Name , $Predicates ) );
173 case(
'integer' ):
return( $this->Pred->validate_integer( $Data , $Name , $Predicates ) );
174 case(
'raw' ):
return( $this->Pred->validate_string( $Data , $Name , $Predicates ) );
175 case(
'string' ):
return( $this->Pred->validate_string( $Data , $Name , $Predicates ) );
176 case(
'command' ):
return( $this->Pred->validate_command( $Data , $Name , $Predicates ) );
180 catch( Exception $e )
220 private function handle_extra_predicates( $Data , $Name , $Predicates , $j )
224 $p = $Predicates[ $j ];
228 return( $this->Pred->validate_set( $Data , $Name , $Predicates ) );
230 elseif( $p ==
'not_set' )
232 return( $this->Pred->validate_not_set( $Data , $Name , $Predicates ) );
234 elseif( $p ==
'not_filled' )
236 return( $this->Pred->validate_not_filled( $Data , $Name , $Predicates ) );
238 elseif( $p ==
'allow_not_set')
245 catch( Exception $e )
281 private function handle_predicates( $Data , $Name , $Predicates )
285 $c = count( $Predicates );
287 for( $j = 0 ; $j < $c ; $j++ )
289 if( ( $Result = $this->handle_data_predicates( $Data , $Name , $Predicates , $j ) ) !== 0 )
292 elseif( ( $Result = $this->handle_extra_predicates( $Data , $Name , $Predicates , $j ) ) !== 0 )
295 elseif( $this->validate_default( $Data , $Name , $Predicates , $j ) ===
false )
299 if( $Result ===
false )
307 catch( Exception $e )
343 $this->Pred->ErrorMessage =
false;
344 $ParsingScript = str_replace(
'#' ,
';' , $ParsingScript );
345 $Script = explode(
';' , $ParsingScript );
347 foreach( $Script as $s )
349 $s = explode(
':' , $s );
351 $Predicates = explode(
',' , $s[ 1 ] );
352 if( $this->handle_predicates( $Data , $Name , $Predicates ) ===
false )
360 catch( Exception $e )
394 catch( Exception $e )
422 return( $this->Pred->ErrorMessage );
424 catch( Exception $e )