From 4c93418f85285e85ccb02214e5bf98cf22079ac7 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 3 Oct 2015 12:26:46 +0100 Subject: [PATCH] Add untested redirect front end --- modules/page-view.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/page-view.php b/modules/page-view.php index 23130bf..a8f02a4 100644 --- a/modules/page-view.php +++ b/modules/page-view.php @@ -28,6 +28,21 @@ register_module([ exit(page_renderer::render_main("$env->page - 404 - $settings->sitename", "

$env->page does not exist.

Since editing is currently disabled on this wiki, you may not create this page. If you feel that this page should exist, try contacting this wiki's Administrator.

")); } } + + // Perform a redirect if the requested page is a redirect page + if(isset($pageindex->$page->redirect) && + $pageindex->$page->redirect === true && + ( // Make sure that the redirect GET paramter isn'tset to 'no' + isset($_GET["redirect"]) && + $_GET["redirect"] !== "no" + )) + { + // Todo send an explanatory page along with the redirect + http_response_code(307); + header("location: ?action=view&page=" . $pageindex->$page->redirect_target . "&redirected_from=$env->page"); + exit(); + } + $title = "$env->page - $settings->sitename"; if(isset($pageindex->$page->protect) && $pageindex->$page->protect === true) $title = $settings->protectedpagechar . $title;