mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 07:30:10 +01:00
post.php, mod.php: pass the context to check_login
This commit is contained in:
parent
e6133ef00f
commit
f4ff39c876
7
mod.php
7
mod.php
@ -11,7 +11,10 @@ if ($config['debug']) {
|
|||||||
|
|
||||||
require_once 'inc/mod/pages.php';
|
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']) : '';
|
$query = isset($_SERVER['QUERY_STRING']) ? rawurldecode($_SERVER['QUERY_STRING']) : '';
|
||||||
|
|
||||||
@ -136,8 +139,6 @@ foreach ($pages as $key => $callback) {
|
|||||||
}
|
}
|
||||||
$pages = $new_pages;
|
$pages = $new_pages;
|
||||||
|
|
||||||
$ctx = Vichan\build_context($config);
|
|
||||||
|
|
||||||
foreach ($pages as $uri => $handler) {
|
foreach ($pages as $uri => $handler) {
|
||||||
if (preg_match($uri, $query, $matches)) {
|
if (preg_match($uri, $query, $matches)) {
|
||||||
$matches[0] = $ctx; // Replace the text captured by the full pattern with a reference to the context.
|
$matches[0] = $ctx; // Replace the text captured by the full pattern with a reference to the context.
|
||||||
|
2
post.php
2
post.php
@ -694,7 +694,7 @@ if (isset($_POST['delete'])) {
|
|||||||
|
|
||||||
|
|
||||||
if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) {
|
if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) {
|
||||||
check_login(false);
|
check_login($context, false);
|
||||||
if (!$mod) {
|
if (!$mod) {
|
||||||
// Liar. You're not a mod.
|
// Liar. You're not a mod.
|
||||||
error($config['error']['notamod']);
|
error($config['error']['notamod']);
|
||||||
|
Loading…
Reference in New Issue
Block a user