Exemple #1
0
 function checkDataPhp(&$objects)
 {
     global $javconfig;
     $result = true;
     $isShowCaptcha = 0;
     $is_enable_captcha = $javconfig['plugin']->get('is_enable_captcha', 0);
     $is_enable_captcha_user = $javconfig['plugin']->get('is_enable_captcha_user', 0);
     $currentUserInfo = JFactory::getUser();
     if (($currentUserInfo->guest && $is_enable_captcha || !$currentUserInfo->guest && $is_enable_captcha_user) && $currentUserInfo->get('aid') < 2) {
         $isShowCaptcha = 1;
     }
     $helper = new JAVoiceHelpers();
     if ($isShowCaptcha) {
         $captcha = JRequest::getVar('captcha', '');
         if (!$this->validatecaptchaaddnew($captcha)) {
             $object = new stdClass();
             $object->id = '#err_invalidjavTextCaptcha';
             $object->attr = 'html';
             $object->content = JText::_("YOUR_CAPTCHA_IS_INVALID");
             $objects[] = $object;
             $result = FALSE;
         } else {
             $object = new stdClass();
             $object->id = '#err_javTextCaptcha';
             $object->attr = 'html';
             $object->content = "";
             $objects[] = $object;
         }
     }
     $user = JFactory::getUser();
     if ($user->id == 0) {
         $name = JRequest::getVar('guest_name', '');
         $email = JRequest::getVar('guest_email', '');
         if ($name == '' || $email == '') {
             $object = new stdClass();
             $object->id = '#jav_profile_msg';
             $object->attr = 'html';
             $object->content = JText::_("PLEASE_ENTER_NAME_AND_EMAIL");
             $objects[] = $object;
             $result = FALSE;
         } elseif (!$helper->validate_email($email)) {
             $object = new stdClass();
             $object->id = '#jav_profile_msg';
             $object->attr = 'html';
             $object->content = JText::_("YOUR_EMAIL_ISNT_VALID");
             $objects[] = $object;
             $result = FALSE;
         } else {
             $object = new stdClass();
             $object->id = '#jav_profile_msg';
             $object->attr = 'html';
             $object->content = "";
             $objects[] = $object;
         }
     }
     if (!$result) {
         $object = new stdClass();
         $object->id = 'jav_error_checkphp';
         $object->attr = 'html';
         $object->content = 1;
         $objects[] = $object;
         $helper = new JAVoiceHelpers();
         echo $helper->parse_JSON_new($objects);
         exit;
     }
 }