ultimix
custom_validations_1_0_0 Class Reference

Public Member Functions

 __construct ()
 custom_validation_login_exists ($Pair)
 custom_validation_login_does_not_exist ($Pair)
 custom_validation_page_exists ($Pair)
 custom_validation_page_does_not_exist ($Pair)
 custom_validation_captcha ($Pair)
 custom_validation ($ValidationScript, $Options)

Data Fields

 $Messages = false
 $Security = false
 $UserAlgorithms = false

Detailed Description

Class with custom validations.

Author
Dodonov A.A.

Definition at line 26 of file custom_validations.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 56 of file custom_validations.php.

{
try
{
$this->Messages = get_package( 'page::messages' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->UserAlgorithms = get_package( 'user::user_algorithms' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

custom_validation (   $ValidationScript,
  $Options 
)

Custom validations.

Parameters
$ValidationScript- Validation script.
$Options- Execution options.
Returns
True if the validation was passed, false otherwise.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 347 of file custom_validations.php.

{
try
{
$ValidationScript = explode( ";" , $ValidationScript );
foreach( $ValidationScript as $vs )
{
$Pair = explode( ':' , $vs );
if( $this->validations( $Pair ) === false )
{
return( false );
}
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
custom_validation_captcha (   $Pair)

Custom validation.

Parameters
$Pair- Validation script.
Returns
True if the validation was passed, false otherwise.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 256 of file custom_validations.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$Captcha = get_package( 'captcha' , 'last' , __FILE__ );
$Result = $Captcha->validate_captcha( $Security->get_p( 'captcha' , 'command' , rand() ) , $Options );
if( $Result === false )
{
$this->Messages->add_error_message( 'captcha_error' );
}
return( $Result );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
custom_validation_login_does_not_exist (   $Pair)

Custom validation.

Parameters
$Pair- Validation script.
Returns
True if the validation was passed, false otherwise.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 133 of file custom_validations.php.

{
try
{
$Result = $this->UserAlgorithms->user_exists( $this->Security->get_gp( $Pair[ 1 ] , 'string' ) );
if( $Result !== false )
{
$this->Messages->add_error_message( 'user_already_exists' );
}
return( $Result );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
custom_validation_login_exists (   $Pair)

Custom validation.

Parameters
$Pair- Validation script.
Returns
True if the validation was passed, false otherwise.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 92 of file custom_validations.php.

{
try
{
$Result = $this->UserAlgorithms->user_exists( $this->Security->get_gp( $Pair[ 1 ] , 'string' ) );
if( $Result === false )
{
$this->Messages->add_error_message( 'user_does_not_exist' );
}
return( $Result );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
custom_validation_page_does_not_exist (   $Pair)

Custom validation.

Parameters
$Pair- Validation script.
Returns
True if the validation was passed, false otherwise.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 215 of file custom_validations.php.

{
try
{
$PageAccess = get_package( 'page::page_access' , 'last' , __FILE__ );
if( $PageAccess->get_page_description( $this->Security->get_gp( $Pair[ 1 ] , 'string' ) ) === false )
{
return( false );
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
custom_validation_page_exists (   $Pair)

Custom validation.

Parameters
$Pair- Validation script.
Returns
True if the validation was passed, false otherwise.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 174 of file custom_validations.php.

{
try
{
$PageAccess = get_package( 'page::page_access' , 'last' , __FILE__ );
if( $PageAccess->get_page_description( $this->Security->get_gp( $Pair[ 1 ] , 'string' ) ) !== false )
{
return( true );
}
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$Messages = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file custom_validations.php.

$Security = false

Definition at line 39 of file custom_validations.php.

$UserAlgorithms = false

Definition at line 40 of file custom_validations.php.


The documentation for this class was generated from the following file: