summaryrefslogtreecommitdiff
path: root/mod.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-02 20:52:58 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-02 20:52:58 -0400
commit4fce9b63aee89c04ea0d833992e72ab75585f630 (patch)
treeb49f3e673e3f8dd8b0bbd8da7f690f581b4ec83b /mod.php
parent9e7fbf927c67797269062a3b5f827a92ac822e12 (diff)
Major config.php cleanup and a few minor misc fixes.
Diffstat (limited to 'mod.php')
-rw-r--r--mod.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/mod.php b/mod.php
index cd4d17d4..ee05c349 100644
--- a/mod.php
+++ b/mod.php
@@ -109,7 +109,7 @@ $new_pages = array();
foreach ($pages as $key => $callback) {
if (is_string($callback) && preg_match('/^secure /', $callback))
$key .= '(/(?P<token>[a-f0-9]{8}))?';
- $key = str_replace('\%b', $config['board_regex'], $key);
+ $key = str_replace('\%b', '?P<board>' . sprintf(substr($config['board_path'], 0, -1), $config['board_regex']), $key);
$new_pages[@$key[0] == '!' ? $key : '!^' . $key . '(?:&[^&=]+=[^&]*)*$!u'] = $callback;
}
$pages = $new_pages;
@@ -118,6 +118,15 @@ foreach ($pages as $uri => $handler) {
if (preg_match($uri, $query, $matches)) {
$matches = array_slice($matches, 1);
+ if (isset($matches['board'])) {
+ $board_match = $matches['board'];
+ unset($matches['board']);
+ $key = array_search($board_match, $matches);
+ if (preg_match('/^' . sprintf(substr($config['board_path'], 0, -1), '(' . $config['board_regex'] . ')') . '$/u', $matches[$key], $board_match)) {
+ $matches[$key] = $board_match[1];
+ }
+ }
+
if (is_string($handler) && preg_match('/^secure(_POST)? /', $handler, $m)) {
$secure_post_only = isset($m[1]);
if (!$secure_post_only || $_SERVER['REQUEST_METHOD'] == 'POST') {