"; } function get_slug($p) { $p = strip_tags($p); preg_match_all('/([a-z0-9A-Z-_]+)/', $p, $matches); $matches = array_map('strtolower', $matches[0]); $slug = implode('-', $matches); return $slug; } function is_loggedin() { global $c; return $c['loggedin']; } function edit_tags() { global $hook; if (!is_loggedin() && !isset($_REQUEST['login'])) return; foreach ($hook['admin-head'] as $o) { echo "\t" . $o . "\n"; } } function content($id, $content) { global $d; echo (is_loggedin()) ? "" . $content . "" : $content; } function menu($stags, $etags) { global $c, $hostname; $mlist = explode('
', $c['menu']); for ($i = 0; $i < count($mlist); $i++) { $page = get_slug($mlist[$i]); if (!$page) continue; echo $stags . " href='" . strchr($hostname, '?', TRUE) . $page . "'>" . str_replace('-', ' ', $page) . " " . $etags . " \n"; } } function login_form() { global $c, $msg; $msg = ''; if (isset($_POST['sub'])) login(); $c['content'] = "
Password $msg

Change password

Type your old password above and your new one below.
New Password
"; } function login() { global $c, $msg; if (md5($_POST['password']) <> $c['password']) { $msg = "Wrong Password"; return; } if ($_POST['new']) { save_password($_POST['new']); $msg = 'Password changed'; return; } $_SESSION['l'] = $c['password']; header('Location: ./'); exit; } function save_password($p) { $file = @fopen('files/password', 'w'); if (!$file) { echo "Error opening password. Set correct permissions (644) to the password file."; exit; } fwrite($file, md5($p)); fclose($file); return md5($p); } function settings() { global $c, $d; echo "

↕ Settings ↕

Theme 
Navigation (hint: add your page below and click here to refresh)
" . $c['menu'] . "
"; foreach (array('title', 'description', 'keywords', 'copyright') as $key) { echo "
" . $c[$key] . "
"; } echo "
"; }