} return null; } $dataBlogListFile = 'admin/data/autocms-blog.json'; if (file_exists($dataBlogListFile)) { $jsonBlog = json_decode(file_get_contents($dataBlogListFile), true); $baseCall = explode('/', $_SERVER['REQUEST_URI']); if (!isset($_GET['blog']) && $jsonBlog['post-page'] == $baseCall[1]) { make404(); } // if request is a post, make sure file exists if (isset($_GET['blog']) && !file_exists($_SERVER['DOCUMENT_ROOT'] . '/admin/data/blog/blog-' . getPostID(strtolower($_GET['blog'])) . '.json')) { make404(); } if (isset($_GET['blog']) && !isset($jsonBlog['posts'][getPostID(strtolower($_GET['blog']))]['published'])) { make404(); } } function make404() { header("HTTP/1.0 404 Not Found"); if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/error.php')) { include_once 'error.php'; } else { print "<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL was not found on this server..</p></body></html>"; } die; } // get data function get($file, $key, $count = null, $secondary = null) {
echo "<br><a href={$_SERVER['HTTP_REFERER']}>Back</a>"; commonFooter(); } $function = strtolower($_GET['function']); if (strlen($function) < 3) { make404($lang); exit; } $file = find_manual_page($lang, $function); if (is_array($file)) { if (sizeof($file) < 2) { $file = strtolower($file[0]); if (strpos($file, "pt_br")) { $file = str_replace("pt_br", "pt_BR", $file); } header("Location: http://{$_SERVER['HTTP_HOST']}{$file}"); exit; } multi_choice($file, $lang); exit; } elseif ($file && !is_array($file)) { $file = strtolower($file); if (strpos($file, "pt_br")) { $file = str_replace("pt_br", "pt_BR", $file); } header("Location: http://{$_SERVER['HTTP_HOST']}{$file}"); exit; } else { make404($lang); exit; }