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/rename_page.php | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Neutron-trunk/api/admin/rename_page.php (limited to 'Neutron-trunk/api/admin/rename_page.php') diff --git a/Neutron-trunk/api/admin/rename_page.php b/Neutron-trunk/api/admin/rename_page.php new file mode 100644 index 0000000..4091940 --- /dev/null +++ b/Neutron-trunk/api/admin/rename_page.php @@ -0,0 +1,75 @@ + +', '>', $newname); + $newname = str_replace('<', '<', $newname); + if (trim($newname) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameempty"]); + } + $newslug = preg_replace("/[^0-9a-zA-Z ]/m", "", $newname ); + $newslug = str_replace(" ", "-", $newslug); + $newslug = strtolower($newslug); + if ($newslug == "api" || $newslug == "cms-special" || $newslug == "galery" || $newslug == "vendor" || $newslug == "cms-unrelated" || $newslug == "data" || $newslug == "resources" || $newslug == "widgets" || $newslug == "-htaccess" || $newslug == "index" || $newslug == "index-php") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameinternal"]); + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $newslug)) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameexists"]); + } + if (strlen($newslug) > 70) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnamelong"]); + } + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $newslug, file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $oldslug)); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $newslug, file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $oldslug)); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/" . $newslug); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $newslug . "/index.php", ''); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $newslug . "/pagename", $newname); + unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $oldslug . "/index.php"); + unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $oldslug . "/pagename"); + rmdir($_SERVER['DOCUMENT_ROOT'] . "/" . $oldslug); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $oldslug); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $oldslug); + require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php"; + require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnamenone"]); + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnotfound"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnone"]); +} \ No newline at end of file -- cgit