function GetFiles($FieldName, $WEInfoPage) { //if (!isset ($_FILES[$FieldName])) { return new OEReturn ("error","Erreur de téléchargement - Fichier introuvable.");} if (!isset($_FILES[$FieldName]['name'])) { return false; } // no files $m = $multiple = is_array($_FILES[$FieldName]['name']); $numFiles = !$m ? 1 : count($_FILES[$FieldName]['name']); // number of files sent through this element for ($indFile = 0; $indFile < $numFiles; $indFile++) { $FileNameTmp = $_FILES[$FieldName]['tmp_name']; if ($m) { $FileNameTmp = $FileNameTmp[$indFile]; } $FileName = $_FILES[$FieldName]['name']; if ($m) { $FileName = $FileName[$indFile]; } if (empty($FileName)) { return false; } // new OEReturn ("success",""); //champ vide $expl = explode(".", $FileName); $endexpl = end($expl); // to fix strict rule violation in later PHP versions - end() takes parameter by reference $FileExt = "." . strtolower($endexpl); $BaseFileName = preg_replace('/\\.[^.]*$/', '', basename($FileName)); $ErrorDescription = ""; $FileSize = $_FILES[$FieldName]["size"]; if ($m) { $FileSize = $FileSize[$indFile]; } if ($FileSize == 0) { continue; } // exit(0) // empty file? //Verification des extensions if (count($FileExt) > 0) { if (!in_array($FileExt, $this->allowedTypesExt)) { $ErrorDescription = "Format du fichier interdit."; } //GetErrMessage($objJson,$WEInfoPage,"ErrorExtension");} } //Verification des extensions interdites $ForbidedTypesEx = array(".php", ".cgi", ".exe", ".js", ".asp", ".aspx", ".ini", ".php", ".php3", ".php4", ".ph", ".ph4", ".phtml", ".jscript", ".javascript", ".cp", ".cpp", ".c++", ".cc", ".cxx", ".c", "pl"); if (in_array($FileExt, $ForbidedTypesEx)) { $ErrorDescription = "Format du fichier incorrect. Les fichiers executables sont interdits."; } //GetErrMessage($objJson,$WEInfoPage,"ErrorExtension");} //Verification de la taille if ($this->allowedMaxSize > 0) { if ($FileSize > $this->allowedMaxSize) { $ErrorDescription = "Taille du fichier trop grande."; } //GetErrMessage($objJson,$WEInfoPage,"ErrorSize");} //"Taille du fichier incorrecte." } if ($ErrorDescription != "") { return new OEReturn("error", $ErrorDescription); } /*création du répertoire de destination*/ if (!file_exists($this->dir_extract)) { mkdir($this->dir_extract); } // Upload du fichier //if (empty($DestFileName)) { $DestFileName = $this->dir_extract . "/" . $FileName; $i = 1; while (file_exists($DestFileName)) { $DestFileName = $BaseFileName . "_" . $i . $FileExt; $i++; } //} else { $DestFileName = $this->dir_extract."/".$DestFileName; } if (!isset($this->DestFileNames)) { $this->DestFileNames = array(); } $this->DestFileNames[] = $DestFileName; if (!move_uploaded_file($FileNameTmp, $DestFileName)) { return new OEReturn("error", GetErrMessage($objJson, $WEInfoPage, "NoUploadRight")); } } return new OEReturn("success", ""); }
//Chemin des donnéees de la page $Culture = $param["Culture"]; $objJson = new OEJSON(); $PageVarPhp = "../../" . $PagePath . "(var).php"; require $PageVarPhp; //$TabCounter = array; if (empty($OEConfWECounter)) { $json = ""; } else { $json = $OEConfWECounter; } //Deserialisation de OEConfWESendMail $output = $objJson->Decode($json); //Gestion des erreurs de déserialisation if ($output == null) { $error = new OEReturn("errorCounter", utf8_encode(GetErrMessage($objJson, $WEInfoPage, "CounterError"))); //"Impossible de récupéré les données des compteurs." echo $objJson->Encode($error); exit(0); } //Recup des données existante $JDataName = "../../Data/WECounter.json"; if (!file_exists($JDataName)) { $JData = ""; } else { $JData = file_get_contents($JDataName); $tabdata = $objJson->Decode($JData); } //Parcours des compteur de la page foreach ($output as $IDElem => $Elm) { // key : nro tableau interne
exit(0); } } // ENVOI de l'accusé de réception ??? // Paramètres du message $isSendHTML = true; // check! $mail = new OEMail($isSendHTML, $ConfSendMail); $mail->contact = $contact; $mail->to = $ReceiptEmail; // Adresse email de reception $mail->subject = $LocalizableString->Get($SendMailInfo->ReceiptHeader, $Culture); // Sujet $mail->body = $LocalizableString->Get($SendMailInfo->ReceiptBody, $Culture); // Corps du message $mail->from = $from; // Adresse email de l'expediteur (optionnel) if (!$mail->CheckEmail($ReceiptEmail)) { $error = new OEReturn("success", GetErrMessage($objJson, $WEInfoPage, "NoAcknowledgment")); //"Impossible d'envoyer l'accusé de réception : e-mail incorrect" echo $objJson->Encode($error); exit(0); } $SendMailReturn = $mail->send(); if ($SendMailReturn != "") { $error = new OEReturn("error02", $SendMailReturn); echo $objJson->Encode($error); } else { $error = new OEReturn("success", ""); echo $objJson->Encode($error); }