$AllowedSize = $ElemConf->{$FormLinksElemenID}->AllowedSize * 1024 * 1024;
     }
     $Upload = new OEUploadFile($allowedTypesExt, $AllowedSize, "../../" . $OESiteUploadDirectory);
     $uploadFieldName = isset($ElemConf->{$FormLinksElemenID}->InputName) ? $ElemConf->{$FormLinksElemenID}->InputName : $FormLinksElement->ID;
     $rep = $Upload->GetFiles($uploadFieldName, $WEInfoPage);
     if ($rep && $rep->State == "error") {
         $error = new OEReturn("error02", utf8_encode($title . " : " . $rep->ErrorDescription . " (att. er.)"));
         echo $objJson->Encode($error);
         exit(0);
     }
     if (!empty($Upload->DestFileNames)) {
         $Attachment = array_merge($Attachment, $Upload->DestFileNames);
     }
     break;
 case 'WECaptcha':
     if (WECaptchaCheck($val, $FormLinksElement->ID, $OEVersion) == false) {
         $ErrorText = GetErrMessage($objJson, $WEInfoPage, "CaptchaError");
         //"Captcha incorrect!";
         //Gestion des erreurs de déserialisation
         if ($OEConfWECaptcha != null && (isset($LocalizableString) && isset($WECaptchaInfo->TextError))) {
             // DD blocked error "non-object" (shouldn't be necessary now, but keep just in case)
             $WECaptchaInfo = $OutputWECaptcha->{$FormLinksElemenID};
             $ErrorText = $LocalizableString->Get($WECaptchaInfo->TextError, $Culture);
         }
         $error = new OEReturn("", $ErrorText);
         echo $objJson->Encode($error);
         exit(0);
     }
     break;
 default:
     $Body .= $title . " " . $val . "<br />";
示例#2
0
 public static function IsCaptchaOk($dynJSONData = null, $enteredCode = null, $captchaElID = '', $oeCaptchaVersion = '')
 {
     //!!keep updated in sync with Captcha functionality
     if (!function_exists('WECaptchaCheck')) {
         global $dir_OEDynUtilsphp;
         require_once dirname(dirname($dir_OEDynUtilsphp)) . 'openElement.php';
     }
     if (!function_exists('WECaptchaCheck')) {
         return true;
     }
     // failed to find function, consider ok
     if (!$captchaElID) {
         global $OEConfWECaptcha;
         if (!isset($OEConfWECaptcha) || empty($OEConfWECaptcha)) {
             return true;
         }
         // can't auto-find captcha
         $pos1 = strpos($OEConfWECaptcha, '"');
         $pos2 = strpos($OEConfWECaptcha, '"', $pos1 + 1);
         if ($pos1 < 0 || $pos2 < $pos1) {
             return true;
         }
         // not expected json string
         $captchaElID = substr($OEConfWECaptcha, $pos1 + 1, $pos2 - $pos1 - 1);
         if (strlen($captchaElID) < 2) {
             return true;
         }
         // can't auto-find captcha
     }
     if ($enteredCode === null) {
         if (!isset($_POST[$captchaElID])) {
             return true;
         }
         // can't auto-find entered code in POST data
         $enteredCode = $_POST[$captchaElID];
     }
     if (!$enteredCode) {
         return false;
     }
     // user didn't enter captcha code
     if (!$oeCaptchaVersion) {
         /*
         			if (!$dynJSONData) {
         				global $OEConfDynamic; if (!isset($OEConfDynamic)) return true;
         				$dynJSONData = self::decodeJSON($OEConfDynamic);
         			}
         			if (!isset($dynJSONData['OEVersion'])) return true; // version unknown
         			$oeCaptchaVersion = $dynJSONData['OEVersion'];*/
         if (!isset($_SESSION['OEVersion'])) {
             return true;
         }
         // no captcha initialized
         $oeCaptchaVersion = $_SESSION['OEVersion'];
         // see WECaptcha.php
     }
     //echo "WECaptchaCheck: $enteredCode, $captchaElID, $oeCaptchaVersion<br/>";
     return WECaptchaCheck($enteredCode, $captchaElID, $oeCaptchaVersion);
 }