1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-26 05:32:59 +00:00

Fix bug in new redirect code

This commit is contained in:
Starbeamrainbowlabs 2016-08-21 14:10:40 +01:00
parent 040344d2c3
commit 320c871495
3 changed files with 13 additions and 5 deletions

View file

@ -4692,12 +4692,16 @@ register_module([
$newPage = $pageindex->$page->redirect_target; $newPage = $pageindex->$page->redirect_target;
if(strpos($newPage, "#") !== false) if(strpos($newPage, "#") !== false)
{ {
// Extract the part after the hash symbol
$hashCode = substr($newPage, strpos($newPage, "#") + 1); $hashCode = substr($newPage, strpos($newPage, "#") + 1);
// Remove the hash from the new page name
$newPage = substr($newPage, 0, strpos($newPage, "#")); $newPage = substr($newPage, 0, strpos($newPage, "#"));
} }
$newPage .= "&page=" . $pageindex->$page->redirect_target; $redirectUrl .= "&page=$newPage";
if(!empty($pageindex->$newPage->redirect))
$redirectUrl .= "&redirect=no";
if(strlen($hashCode) > 0) if(strlen($hashCode) > 0)
$newPage .= "#$hashCode"; $redirectUrl .= "#$hashCode";
header("location: $redirectUrl"); header("location: $redirectUrl");
exit(); exit();

View file

@ -185,7 +185,7 @@
"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",
"lastupdate": 1471632699, "lastupdate": 1471784271,
"optional": false "optional": false
}, },
{ {

View file

@ -68,12 +68,16 @@ register_module([
$newPage = $pageindex->$page->redirect_target; $newPage = $pageindex->$page->redirect_target;
if(strpos($newPage, "#") !== false) if(strpos($newPage, "#") !== false)
{ {
// Extract the part after the hash symbol
$hashCode = substr($newPage, strpos($newPage, "#") + 1); $hashCode = substr($newPage, strpos($newPage, "#") + 1);
// Remove the hash from the new page name
$newPage = substr($newPage, 0, strpos($newPage, "#")); $newPage = substr($newPage, 0, strpos($newPage, "#"));
} }
$newPage .= "&page=" . $pageindex->$page->redirect_target; $redirectUrl .= "&page=$newPage";
if(!empty($pageindex->$newPage->redirect))
$redirectUrl .= "&redirect=no";
if(strlen($hashCode) > 0) if(strlen($hashCode) > 0)
$newPage .= "#$hashCode"; $redirectUrl .= "#$hashCode";
header("location: $redirectUrl"); header("location: $redirectUrl");
exit(); exit();