Select Git revision
install.bat
index.phtml 7.81 KiB
<?php
require_once("class/vitis_lib/VitisError.class.inc");
require_once("class/vmlib/cryptUtil.inc");
require_once("conf/properties.inc");
require_once("vmlib/logUtil.inc");
require_once("vmlib/Email.class.inc");
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); // For CORS
header('Access-Control-Allow-Headers: Content-Type, Token');
}
if (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
$sMethod = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'];
} else {
$sMethod = $_SERVER['REQUEST_METHOD'];
}
$_PUTDATA = null;
$paramJson2 = null;
$params = file_get_contents('php://input');
$oJson = $params;
if (is_object(json_decode($oJson))) {
$paramJson2 = get_object_vars(json_decode($oJson));
}
$boundary = substr($params, 0, strpos($params, "\r\n"));
// Fetch each part
if (!empty($boundary)) {
$parts = array_slice(explode($boundary, $params), 1);
foreach ($parts as $part) {
// If this is the last part, break
if ($part == "--\r\n")
break;
// Separate content from headers
$part = ltrim($part, "\r\n");
list($raw_headers, $body) = explode("\r\n\r\n", $part, 2);
// Parse the headers list
$raw_headers = explode("\r\n", $raw_headers);
$headers = array();
foreach ($raw_headers as $header) {
list($name, $value) = explode(':', $header, 2);
$headers[strtolower($name)] = ltrim($value, ' ');
}
// Parse the Content-Disposition to get the field name, etc.
if (isset($headers['content-disposition'])) {
$filename = null;
preg_match(
'/^(.+); *name="([^"]+)"(; *filename="([^"]+)")?/', $headers['content-disposition'], $matches
);
list(, $type, $name) = $matches;
isset($matches[4]) and $filename = $matches[4];
// handle your fields here
// Ce champ est un fichier ()?
if (!empty($filename)) {
// Internet Explorer passe le chemin complet vers le fichier.
$aFilenamePathInfo = pathinfo($filename);
$filename = $aFilenamePathInfo['filename'] . '.' . $aFilenamePathInfo['extension'];
//
$_PUTDATA[$name . "_file"] = substr($body, 0, strlen($body) - 2);
$_PUTDATA[$name . "_name"] = $filename;
} else
$_PUTDATA[$name] = substr($body, 0, strlen($body) - 2);
/*
switch ($name) {
// this is a file upload
case 'userfile':