diff --git a/mod.php b/mod.php index 474210cd..c9e891ee 100644 --- a/mod.php +++ b/mod.php @@ -11,7 +11,10 @@ if ($config['debug']) { require_once 'inc/mod/pages.php'; -check_login(true); + +$ctx = Vichan\build_context($config); + +check_login($ctx, true); $query = isset($_SERVER['QUERY_STRING']) ? rawurldecode($_SERVER['QUERY_STRING']) : ''; @@ -136,8 +139,6 @@ foreach ($pages as $key => $callback) { } $pages = $new_pages; -$ctx = Vichan\build_context($config); - foreach ($pages as $uri => $handler) { if (preg_match($uri, $query, $matches)) { $matches[0] = $ctx; // Replace the text captured by the full pattern with a reference to the context. diff --git a/post.php b/post.php index 6f29f50c..b20fdfc9 100644 --- a/post.php +++ b/post.php @@ -694,7 +694,7 @@ if (isset($_POST['delete'])) { if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) { - check_login(false); + check_login($context, false); if (!$mod) { // Liar. You're not a mod. error($config['error']['notamod']);