From 8fabf77b2a7720a357c63817c07035a9908818a0 Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 10 Nov 2021 17:53:50 +0100 Subject: Update --- Neutron-trunk/api/admin/appearance.php | 195 --------------------------------- 1 file changed, 195 deletions(-) delete mode 100644 Neutron-trunk/api/admin/appearance.php (limited to 'Neutron-trunk/api/admin/appearance.php') diff --git a/Neutron-trunk/api/admin/appearance.php b/Neutron-trunk/api/admin/appearance.php deleted file mode 100644 index ec0eece..0000000 --- a/Neutron-trunk/api/admin/appearance.php +++ /dev/null @@ -1,195 +0,0 @@ - -') !== false || strpos($_POST['sitename'], '{') !== false || strpos($_POST['sitename'], '}') !== false || strpos($_POST['sitename'], '@') !== false || strpos($_POST['sitename'], '#') !== false || strpos($_POST['sitename'], '|') !== false) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenameinvalid"]); - } - if (strlen($_POST['sitename']) > 75) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenamelong"]); - } -} else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenamerecv"]); -} - -if (isset($_POST['alwaysmenu'])) { - (string)$am = $_POST['alwaysmenu']; -} else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["awmnone"]); -} - -if (isset($_POST['oldrenderer'])) { - (string)$or = $_POST['oldrenderer']; -} else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["olrnone"]); -} - -if (isset($_POST['showpages'])) { - (integer)$sp = $_POST['showpages']; -} else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["swpnone"]); -} - -if ($am == "true") { - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu", ""); - } -} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu")) { - unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu"); - } -} -// var_dump($or);require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit(); -if ($or == "true") { - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer", ""); - } -} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer")) { - unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer"); - } -} - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagesInMenuBar", $sp); - -if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); -} else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); -} - -if (isset($_FILES['icon'])) { - if ($_FILES['icon']['error'] == 1) { - $maxsize = ini_get('upload_max_filesize'); - if ($maxsize > 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['icon']['error'] == 2) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileform"]); - } - if ($_FILES['icon']['error'] == 3) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileincomplete"]); - } - if ($_FILES['icon']['error'] == 4) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotfound"]); - } - if ($_FILES['icon']['error'] == 6) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotempdir"]); - } - if ($_FILES['icon']['error'] == 7) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filewriterror"]); - } - if ($_FILES['icon']['error'] == 8) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileint"]); - } - if ($_FILES['icon']['type'] != "image/png" && $_FILES['icon']['type'] != "image/jpeg" && $_FILES['icon']['type'] != "image/gif") { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filemime2"]); - } - if ($_FILES['icon']['error'] == 0) { - imagepng(imagecreatefromstring(file_get_contents($_FILES['icon']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png"); - if ($_FILES['icon']['type'] == "image/png") { - copy($_FILES['icon']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png"); - } else { - copy($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png", $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png"); - } - require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/favicon.php"; - unlink($_FILES['icon']['tmp_name']); - } -} - -if (isset($_FILES['banner'])) { - if ($_FILES['banner']['error'] == 1) { - $maxsize = ini_get('upload_max_filesize'); - if ($maxsize > 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['banner']['error'] == 2) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileform"]); - } - if ($_FILES['banner']['error'] == 3) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileincomplete"]); - } - if ($_FILES['banner']['error'] == 4) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotfound"]); - } - if ($_FILES['banner']['error'] == 6) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotempdir"]); - } - if ($_FILES['banner']['error'] == 7) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filewriterror"]); - } - if ($_FILES['banner']['error'] == 8) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileint"]); - } - if ($_FILES['banner']['type'] != "image/png" && $_FILES['banner']['type'] != "image/jpeg" && $_FILES['banner']['type'] != "image/gif") { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filemime2"]); - } - if ($_FILES['banner']['error'] == 0) { - imagejpeg(imagecreatefromstring(file_get_contents($_FILES['banner']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg"); - $img = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg"); - $width = imagesx($img); - $height = imagesy($img); - $x_step = intval($width/$num_samples); - $y_step = intval($height/$num_samples); - $total_lum = 0; - $sample_no = 1; - for ($x=0; $x<$width; $x+=$x_step) { - for ($y=0; $y<$height; $y+=$y_step) { - $rgb = imagecolorat($img, $x, $y); - $r = ($rgb >> 16) & 0xFF; - $g = ($rgb >> 8) & 0xFF; - $b = $rgb & 0xFF; - $lum = ($r+$r+$b+$g+$g+$g)/6; - $total_lum += $lum; - $sample_no++; - } - } - $avg_lum = $total_lum / $sample_no; - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/banner.mtd", ($avg_lum / 255) * 100); - unlink($_FILES['banner']['tmp_name']); - } -} - -$sitename = str_replace('>', '>', $_POST['sitename']); -$sitename = str_replace('<', '<', $sitename); -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename", $sitename); -require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; -echo("ok"); -} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } -} -} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } -} \ No newline at end of file -- cgit