src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
protected function ValidateWriteReviewData($aUserData)
    {
        $bDataValid = false;
        $oMsgManager = TCMSMessageManager::GetInstance();
        if (is_array($aUserData)) {
            $bDataValid = true;
            $sCaptcha = '';
            if ($this->NeedCaptcha()) {
                if (array_key_exists('captcha', $aUserData)) {
                    $sCaptcha = trim($aUserData['captcha']);
                }
                if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) {
                    $bDataValid = false;
                    $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA');
                }
            }
            $aRequiredFields = $this->GetRequiredFields();
            foreach ($aRequiredFields as $sFieldName) {
                $sVal = '';
                if (array_key_exists($sFieldName, $aUserData)) {
                    $sVal = trim($aUserData[$sFieldName]);
                }
                if (empty($sVal)) {
                    $bDataValid = false;
                    $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING');
                }
            }

            if ($this->InsertOfReviewLocked()) {
                $bDataValid = false;
                $oMsgManager->AddMessage(MTPkgShopArticleReview::MSG_CONSUMER_NAME, 'ERROR-REVIEW-IS-LOCKED');
            }
        }

        return $bDataValid;
    }
protected function ValidateWriteReviewData($aUserData)
    {
        $bDataValid = false;
        $oMsgManager = TCMSMessageManager::GetInstance();
        if (is_array($aUserData)) {
            $bDataValid = true;
            $sCaptcha = '';
            if ($this->NeedCaptcha()) {
                if (array_key_exists('captcha', $aUserData)) {
                    $sCaptcha = trim($aUserData['captcha']);
                }
                if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) {
                    $bDataValid = false;
                    $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA');
                }
            }
            $aRequiredFields = $this->GetRequiredFields();
            foreach ($aRequiredFields as $sFieldName) {
                $sVal = '';
                if (array_key_exists($sFieldName, $aUserData)) {
                    $sVal = trim($aUserData[$sFieldName]);
                }
                if (empty($sVal)) {
                    $bDataValid = false;
                    $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING');
                }
            }

            if ($this->InsertOfReviewLocked()) {
                $bDataValid = false;
                $oMsgManager->AddMessage(MTPkgShopArticleReview::MSG_CONSUMER_NAME, 'ERROR-REVIEW-IS-LOCKED');
            }
        }

        return $bDataValid;
    }
protected function ValidateWriteReviewData ( $ aUserData ) { $ bDataValid = false ; $ oMsgManager = TCMSMessageManager :: GetInstance ( ) ; if ( is_array ( $ aUserData ) ) { $ bDataValid = true ; $ sCaptcha = '' ; if ( $ this -> NeedCaptcha ( ) ) { if ( array_key_exists ( 'captcha' , $ aUserData ) ) { $ sCaptcha = trim ( $ aUserData [ 'captcha' ] ) ; } if ( empty ( $ sCaptcha ) || $ sCaptcha != $ this -> GetCaptchaValue ( ) ) { $ bDataValid = false ; $ oMsgManager -> AddMessage ( TdbShopArticleReview :: MSG_CONSUMER_BASE_NAME . '-captcha' , 'INPUT-ERROR-INVALID-CAPTCHA' ) ; } } $ aRequiredFields = $ this -> GetRequiredFields ( ) ; foreach ( $ aRequiredFields as $ sFieldName ) { $ sVal = '' ; if ( array_key_exists ( $ sFieldName , $ aUserData ) ) { $ sVal = trim ( $ aUserData [ $ sFieldName ] ) ; } if ( empty ( $ sVal ) ) { $ bDataValid = false ; $ oMsgManager -> AddMessage ( TdbShopArticleReview :: MSG_CONSUMER_BASE_NAME . '-' . $ sFieldName , 'ERROR-USER-REQUIRED-FIELD-MISSING' ) ; } } if ( $ this -> InsertOfReviewLocked ( ) ) { $ bDataValid = false ; $ oMsgManager -> AddMessage ( MTPkgShopArticleReview :: MSG_CONSUMER_NAME , 'ERROR-REVIEW-IS-LOCKED' ) ; } } return $ bDataValid ; }
Validates given review data to write a new review.

@param array $aUserData

@return bool
Validates given review data to write a new review .