/** * @param $request * @param $location * @param $action * @param $version * @param null $one_way * @return string */ public function __doRequest($request, $location, $action, $version, $one_way = null) { Configuration::$global_encoding = "UTF-8"; $soapRequest = array("soap:Envelope" => array("xmlns:soap" => self::NS_SOAP, "xmlns:xsi" => self::NS_XSI, "xmlns:xsd" => self::NS_XSD)); if ($this->useAuth) { $soapRequest["soap:Envelope"]["soap:Header"] = array("AuthHeader" => array("xmlns" => self::NS_MPREMOTE, "username" => array("nodeValue" => $this->username), "password" => array("nodeValue" => $this->password))); } else { $this->useAuth = true; } $action_value = array("xmlns" => self::NS_MPREMOTE); foreach ($this->parameters as $param) { $action_value[$param["name"]] = array("nodeValue" => $param["value"]); } $soapRequest["soap:Envelope"]["soap:Body"] = array($this->action => $action_value); $request = SimpleXML::encode($soapRequest); $this->real_last_request = $request; return parent::__doRequest($request, $location, $action, $version); }
/** * Méthode de désactivation systématique du mode de debug * @return void */ public static function deactivateDebug() { Configuration::$global_debug = false; $authHandler = Application::getInstance()->authenticationHandler; $authHandler::$permissions = array(); }
/** * ATTENTION AU NAME DE L'INPUT * ==> FORM[INPUTNAME] <== * * ATTENTION A LA TECHNIQUE DE RENVOIE D'INFORMATION !Méthode privée * * @return void */ public function upload_async() { $datas = null; $response = array("error" => ""); if (!isset($_POST["form_name"]) || empty($_POST["form_name"])) { $response["error"] = '$_POST["form_name"] require'; $this->response($response); } if (!isset($_POST["input_name"]) || empty($_POST["input_name"])) { $response["error"] = '$_POST["input_name"] require'; $this->response($response); } $file = $_FILES[$_POST["input_name"]]; if (!isset($file) || empty($file)) { $response["error"] = "Aucun fichier n'a été transmis"; } if (empty($response["error"])) { Configuration::$site_application = $_POST["application"]; $path_to_form = "includes/applications/" . $_POST["application"] . "/modules/"; if ($_POST["is_backoffice"]) { $path_to_form .= "back/"; } else { $path_to_form .= "front/"; } $form_name = $_POST["form_name"]; $path_to_form .= "forms/form." . $form_name . ".json"; if (!file_exists($path_to_form)) { $path_to_form = preg_replace("/_[0-9]+\\.json\$/", ".json", $path_to_form); } try { $datas = SimpleJSON::import($path_to_form); } catch (Exception $e) { $response["error"] = "Formulaire introuvable " . $path_to_form; $this->response($response); } if (!is_array($datas[$_POST["input_name"]])) { $response["error"] = "Champs ciblé introuvable"; $this->response($response); } $input = $datas[$_POST["input_name"]]; if ($input["tag"] != Form::TAG_UPLOAD && ($input["tag"] != "input" && $input["attributes"]["type"] != "file")) { $response["error"] = "Le champ ciblé n'est pas un input type 'file'"; $this->response($response); } $fileName = ""; if (isset($input["fileName"])) { $fileName = "file" . rand(0, 999999); } $folderName = Form::PATH_TO_UPLOAD_FOLDER; if (isset($input["folder"])) { $folderName .= $input["folder"]; } $upload = new Upload($file, $folderName, $fileName); if (isset($input["resize"]) && is_array($input["resize"])) { $upload->resizeImage($input["resize"][0], $input["resize"][1]); } if (!$upload->isMimeType($input["fileType"])) { $response["error"] = "Type de fichier non-autorisé (" . $input["fileType"] . ")"; $this->response($response); } try { $upload->send(); } catch (Exception $e) { $response["error"] = "Upload impossible"; $this->response($response); } if (isset($input["fileName"]) && !empty($input["fileName"])) { $fileName = preg_replace("/(\\{id\\})/", $upload->id_upload, $input["fileName"]); $upload->renameFile($fileName); } $response["path_upload"] = (Configuration::$site_application != "main" ? "../" : "") . $upload->pathFile; $response["id_upload"] = $upload->id_upload; } $this->response($response); }