From f4ff39c876d6e57d1a457a7afc34a6572c63b1f0 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Tue, 1 Oct 2024 22:15:03 +0200 Subject: [PATCH] post.php, mod.php: pass the context to check_login --- mod.php | 7 ++++--- post.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) 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']);