diff options
author | Gitea <gitea@fake.local> | 2021-11-10 17:53:50 +0100 |
---|---|---|
committer | Gitea <gitea@fake.local> | 2021-11-10 17:53:50 +0100 |
commit | 8fabf77b2a7720a357c63817c07035a9908818a0 (patch) | |
tree | d689fcac1403e2473010fe80bc337599a78c21a4 /Neutron-trunk/api/admin/appearance.php | |
parent | 7b4af63a90a726b98a59b83e53f040a7a566a11d (diff) | |
download | electrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.gz electrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.bz2 electrode-8fabf77b2a7720a357c63817c07035a9908818a0.zip |
Update
Diffstat (limited to 'Neutron-trunk/api/admin/appearance.php')
-rw-r--r-- | Neutron-trunk/api/admin/appearance.php | 195 |
1 files changed, 0 insertions, 195 deletions
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 @@ -<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; -$num_samples = 2; - -if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/" && strpos($_COOKIE['_NEUTRON_ADMIN_TOKEN'], "/") === false) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { -if (isset($_POST['sitename'])) { - if (trim($_POST['sitename']) == "") { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenamenone"]); - } - if (strpos($_POST['sitename'], '<') !== false || strpos($_POST['sitename'], '>') !== 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 |