redirect: fix redirect logic

This commit is contained in:
Starbeamrainbowlabs 2020-07-12 14:45:56 +01:00
parent 36e8fe2a17
commit 0f23ce3fd1
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Redirect pages", "name" => "Redirect pages",
"version" => "0.3.1", "version" => "0.3.2",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Adds support for redirect pages. Uses the same syntax that Mediawiki does.", "description" => "Adds support for redirect pages. Uses the same syntax that Mediawiki does.",
"id" => "feature-redirect", "id" => "feature-redirect",

View File

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Page viewer", "name" => "Page viewer",
"version" => "0.16.9", "version" => "0.16.10",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Allows you to view pages. You really should include this one.", "description" => "Allows you to view pages. You really should include this one.",
"id" => "page-view", "id" => "page-view",
@ -57,14 +57,16 @@ register_module([
// Perform a redirect if the requested page is a redirect page // Perform a redirect if the requested page is a redirect page
if(isset($pageindex->$page->redirect) && if(isset($pageindex->$page->redirect) &&
$pageindex->$page->redirect === true && // If this is a redirect page..... $pageindex->$page->redirect === true) // If this is a redirect page.....
(isset($pageindex->$page->redirect_absolute) &&
$pageindex->$page->redirect_absolute == true && // ...and it's absolute....
$settings->redirect_absolute_enable === true)) // ...and absolute reedirects are enabled
{ {
$send_redirect = true; $send_redirect = true;
if(isset($_GET["redirect"]) && $_GET["redirect"] == "no") if(isset($_GET["redirect"]) && $_GET["redirect"] == "no")
$send_redirect = false; $send_redirect = false;
if((isset($pageindex->$page->redirect_absolute) &&
$pageindex->$page->redirect_absolute == true && // ...and it's absolute....
$settings->redirect_absolute_enable === false)) // ...and absolute reedirects are enabled
$send_redirect = false;
if($send_redirect) { if($send_redirect) {
// TODO: Send an explanatory page along with the redirect // TODO: Send an explanatory page along with the redirect