mod.php, pages.php: pass the context to the mod pages

This commit is contained in:
Zankaria 2024-08-15 17:05:43 +02:00 committed by Zankaria
parent cb71e00b50
commit 7ef2d42bb0
2 changed files with 80 additions and 77 deletions

View file

@ -148,9 +148,11 @@ 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 = array_slice($matches, 1);
$matches[0] = $ctx; // Replace the text captured by the full pattern with a reference to the context.
if (isset($matches['board'])) {
$board_match = $matches['board'];