X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/6f67c60627918b9ef956914c63cb7290b7e2de13..f8cfc76a8f02504af15ae89ac6f4896f072ff0a8:/login/index.php diff --git a/login/index.php b/login/index.php index 897346d..f94984b 100644 --- a/login/index.php +++ b/login/index.php @@ -1,4 +1,5 @@ api) return; $message = NULL; if (isset($_POST['mail'])) { @@ -36,47 +37,38 @@ elseif (isset($_GET['logout'])) { } if (!$User or !$User->login) { - $Article->title = 'Inloggen'; + $Page->title = 'Inloggen'; if (isset($_REQUEST['goto'])) { - if (empty($message)) http_response_code(403); - $target = ltrim($_REQUEST['goto'], '/'); - $target = new ArchiveArticle("$target.html"); - - if ($Page = $target->handler and $target->handler == 'melding') { - $caller = $Article; - $Article = $target; - $Args = $target->path; - ob_start(); - include "./{$target->handler}/index.php"; - ob_end_clean(); - $Article = $caller; + if (empty($message) + and !preg_match('(^WhatsApp/)', $_SERVER['HTTP_USER_AGENT'])) { + http_response_code(403); } + $target = ltrim($_REQUEST['goto'], '/'); + $target = new ArchiveArticle(file_exists("$target/index.html") ? "$target/index.html" : "$target.html"); + $target->index; # run forbidden handler to determine metadata if ($target->title) { - $Article->title .= ' voor ' . $target->title; - } - if ($target->image) { - $Article->image = $target->image; + $Page->title .= ' voor ' . $target->title; } + $Page->image = $target->image; + $Page->teaser = $target->teaser; } ob_start(); require_once 'login/form.inc.php'; - $Article->raw = ob_get_clean(); - $Place['warn'] = $message; + $Page->raw = ob_get_clean(); + $Page->place['warn'] = $message; return TRUE; } if (isset($_REQUEST['goto'])) { $target = ltrim($_REQUEST['goto'], '/'); - header("Location: /$target"); - http_response_code(302); - exit; + abort("/$target", '303 Return'); } -if (isset($Article->raw)) { - print $Article->raw; +if (isset($Page->raw)) { + print $Page->raw; } -if (empty($Args) and $User->admin) { +if (empty($Page->path) and $User->admin) { include_once 'login/admin.html'; }