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;
if(strpos($newPage, "#") !== false)
{
// Extract the part after the hash symbol
$hashCode = substr($newPage, strpos($newPage, "#") + 1);
// Remove the hash from the new page name
$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)
$newPage .= "#$hashCode";
$redirectUrl .= "#$hashCode";
header("location: $redirectUrl");
exit();

View File

@ -185,7 +185,7 @@
"author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You really should include this one.",
"id": "page-view",
"lastupdate": 1471632699,
"lastupdate": 1471784271,
"optional": false
},
{

View File

@ -68,12 +68,16 @@ register_module([
$newPage = $pageindex->$page->redirect_target;
if(strpos($newPage, "#") !== false)
{
// Extract the part after the hash symbol
$hashCode = substr($newPage, strpos($newPage, "#") + 1);
// Remove the hash from the new page name
$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)
$newPage .= "#$hashCode";
$redirectUrl .= "#$hashCode";
header("location: $redirectUrl");
exit();