From 529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 24 Aug 2021 15:38:16 +0200 Subject: Update --- Neutron-trunk/api/admin/galery_publish_photo.php | 120 +++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 Neutron-trunk/api/admin/galery_publish_photo.php (limited to 'Neutron-trunk/api/admin/galery_publish_photo.php') diff --git a/Neutron-trunk/api/admin/galery_publish_photo.php b/Neutron-trunk/api/admin/galery_publish_photo.php new file mode 100644 index 0000000..a4c9628 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_publish_photo.php @@ -0,0 +1,120 @@ + + 1000) { + if ($maxsize > 1000000) { + $maxsizestr = round($maxsize / 1000000, 2) . " " . $lang["sizes"]["mib"]; + } else { + $maxsizestr = round($maxsize / 1000, 2) . " " . $lang["sizes"]["kib"]; + } + } else { + $maxsizestr = $maxsize . " " . $lang["sizes"]["bytes"]; + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filesize"] . " ({$maxsizestr})"); + } + if ($_FILES['file']['error'] == 2) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileform"]); + } + if ($_FILES['file']['error'] == 3) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileincomplete"]); + } + if ($_FILES['file']['error'] == 4) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotfound"]); + } + if ($_FILES['file']['error'] == 6) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotempdir"]); + } + if ($_FILES['file']['error'] == 7) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filewriteerror"]); + } + if ($_FILES['file']['error'] == 8) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileint"]); + } + if ($_FILES['file']['type'] != "image/png" && $_FILES['file']['type'] != "image/jpeg" && $_FILES['file']['type'] != "image/gif") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($file["api"]["filemime"] . " " . strtoupper(str_ireplace("image/", "", $_FILES['file']['type'])) . "."); + } + if ($_FILES['file']['error'] == 0) { + // if (/*!*//* <-- Fonction de test, décommentez le "!" pour forcer l'affichage de ce message */file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $uuid)) { + // echo("Vous êtes tombé sur une erreur très rare, bravo à vous !\n\nPrenez rapidement ce message en capture d'écran et transmettez le aux développeurs de Neutron.\n\nVous pouvez leur donner cette adresse de galerie Neutron comme preuve :\nmpcms-gallery://" . $uuid . "@"); + // if (isset($_SERVER['HTTP_HOST'])) { + // echo($_SERVER['HTTP_HOST']); + // } else { + // if (isset($_SERVER['SERVER_NAME'])) { + // echo($_SERVER['SERVER_NAME']); + // } else { + // echo("unknown"); + // } + // } + // echo("\n\nVotre site doit être publiquement accessible et vous ne devez pas avoir modifié Neutron pour que votre trouvaille soit référencée."); + // exit; + // } + imagejpeg(imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/" . $uuid . ".jpg"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $uuid, "/resources/upload/" . $uuid . ".jpg" . "|" . $_POST['category']); + unlink($_FILES['file']['tmp_name']); + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/picdb.json")) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/picdb.json", "{\"" . $_POST['category'] . "\":[\"" . $uuid . "\"]}"); + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); + } +} \ No newline at end of file -- cgit