mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-12 01:50:48 +01:00
Bug fix: Error when using anonymous functions for mod pages
This commit is contained in:
parent
9b0c31daa6
commit
230b5de16e
4
mod.php
4
mod.php
@ -103,7 +103,7 @@ if (isset($config['mod']['custom_pages'])) {
|
||||
|
||||
$new_pages = array();
|
||||
foreach ($pages as $key => $callback) {
|
||||
if (preg_match('/^secure /', $callback))
|
||||
if (is_string($callback) && preg_match('/^secure /', $callback))
|
||||
$key .= '(/(?P<token>[a-f0-9]{8}))?';
|
||||
$new_pages[@$key[0] == '!' ? $key : '!^' . $key . '(?:&[^&=]+=[^&]*)*$!'] = $callback;
|
||||
}
|
||||
@ -113,7 +113,7 @@ foreach ($pages as $uri => $handler) {
|
||||
if (preg_match($uri, $query, $matches)) {
|
||||
$matches = array_slice($matches, 1);
|
||||
|
||||
if (preg_match('/^secure(_POST)? /', $handler, $m)) {
|
||||
if (is_string($handler) && preg_match('/^secure(_POST)? /', $handler, $m)) {
|
||||
$secure_post_only = isset($m[1]);
|
||||
if (!$secure_post_only || $_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$token = isset($matches['token']) ? $matches['token'] : (isset($_POST['token']) ? $_POST['token'] : false);
|
||||
|
Loading…
Reference in New Issue
Block a user