public function checkVars()
    {
        $http = eZHTTPTool::instance();
        $user = eZUser::currentUser();
        $isAnon = $user->isAnonymous();
        $status = true;

        foreach ( $this->fields as $field => $fieldSetup )
        {  
            $fieldPostName = $fieldSetup[self::VARNAME];
            $this->setFieldValue( $field, $fieldPostName );
            if( !$this->isVariableRequired( $field ) )
            {
                continue;
            }
            else
            {
                $fieldRequired = $fieldSetup[self::REQUIRED] == 'true' ? true : false;
                $fieldExists = $http->hasPostVariable( $fieldPostName );

                if ( $fieldRequired && !$fieldExists )
                {
                    $status = false;
                    $this->validationMessage[$field] = ezpI18n::tr( 'ezcomments/comment/add',
                                                               '%1 is missing.',
                                                               null,
                                                               array( $field ) );
                    continue;
                }
                else if ( $fieldExists )
                {
                    $val = $http->postVariable( $fieldPostName );
                    // only check the empty value when the field is required. In other cases, still validate field if it has value
                    if ( $fieldRequired && empty( $val ) )
                    {
                        $status = false;
                        $this->validationMessage[$field] = ezpI18n::tr( 'ezcomments/comment/add',
                                                                   'The field [%1] is empty.',
                                                                   null,
                                                                   array( $field ) );
                        continue;
                    }
                    else
                    {
                        $validationResult = $this->validateField( $field, $val );
                        if ( $validationResult !== true )
                        {
                            $status = false;
                            $this->validationMessage[$field] = $validationResult;
                            continue;
                        }
                    }
                }
            }
        }
        $this->validationStatus = $status;
        return $status;
    }
public function checkVars()
    {
        $http = eZHTTPTool::instance();
        $user = eZUser::currentUser();
        $isAnon = $user->isAnonymous();
        $status = true;

        foreach ( $this->fields as $field => $fieldSetup )
        {  
            $fieldPostName = $fieldSetup[self::VARNAME];
            $this->setFieldValue( $field, $fieldPostName );
            if( !$this->isVariableRequired( $field ) )
            {
                continue;
            }
            else
            {
                $fieldRequired = $fieldSetup[self::REQUIRED] == 'true' ? true : false;
                $fieldExists = $http->hasPostVariable( $fieldPostName );

                if ( $fieldRequired && !$fieldExists )
                {
                    $status = false;
                    $this->validationMessage[$field] = ezpI18n::tr( 'ezcomments/comment/add',
                                                               '%1 is missing.',
                                                               null,
                                                               array( $field ) );
                    continue;
                }
                else if ( $fieldExists )
                {
                    $val = $http->postVariable( $fieldPostName );
                    // only check the empty value when the field is required. In other cases, still validate field if it has value
                    if ( $fieldRequired && empty( $val ) )
                    {
                        $status = false;
                        $this->validationMessage[$field] = ezpI18n::tr( 'ezcomments/comment/add',
                                                                   'The field [%1] is empty.',
                                                                   null,
                                                                   array( $field ) );
                        continue;
                    }
                    else
                    {
                        $validationResult = $this->validateField( $field, $val );
                        if ( $validationResult !== true )
                        {
                            $status = false;
                            $this->validationMessage[$field] = $validationResult;
                            continue;
                        }
                    }
                }
            }
        }
        $this->validationStatus = $status;
        return $status;
    }
public function checkVars ( ) { $ http = eZHTTPTool :: instance ( ) ; $ user = eZUser :: currentUser ( ) ; $ isAnon = $ user -> isAnonymous ( ) ; $ status = true ; foreach ( $ this -> fields as $ field => $ fieldSetup ) { $ fieldPostName = $ fieldSetup [ self :: VARNAME ] ; $ this -> setFieldValue ( $ field , $ fieldPostName ) ; if ( ! $ this -> isVariableRequired ( $ field ) ) { continue ; } else { $ fieldRequired = $ fieldSetup [ self :: REQUIRED ] == 'true' ? true : false ; $ fieldExists = $ http -> hasPostVariable ( $ fieldPostName ) ; if ( $ fieldRequired && ! $ fieldExists ) { $ status = false ; $ this -> validationMessage [ $ field ] = ezpI18n :: tr ( 'ezcomments/comment/add' , '%1 is missing.' , null , array ( $ field ) ) ; continue ; } else if ( $ fieldExists ) { $ val = $ http -> postVariable ( $ fieldPostName ) ; // only check the empty value when the field is required. In other cases, still validate field if it has value if ( $ fieldRequired && empty ( $ val ) ) { $ status = false ; $ this -> validationMessage [ $ field ] = ezpI18n :: tr ( 'ezcomments/comment/add' , 'The field [%1] is empty.' , null , array ( $ field ) ) ; continue ; } else { $ validationResult = $ this -> validateField ( $ field , $ val ) ; if ( $ validationResult !== true ) { $ status = false ; $ this -> validationMessage [ $ field ] = $ validationResult ; continue ; } } } } } $ this -> validationStatus = $ status ; return $ status ; }
check variable from client
check variable from client