1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Bugfix: Squash warning in the search redirector

This commit is contained in:
Starbeamrainbowlabs 2018-06-30 11:19:17 +01:00
parent cdee30c286
commit 1b3bc1cee7
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -1536,15 +1536,8 @@ $env->action = strtolower($_GET["action"]);
////////////////////////////////////// //////////////////////////////////////
///// Extra consistency measures ///// ///// Extra consistency measures /////
////////////////////////////////////// //////////////////////////////////////
// Redirect to the search page if there isn't a page with the requested name
if(!isset($pageindex->{$env->page}) and isset($_GET["search-redirect"])) // CHANGED: The search redirector has now been moved to below the module registration system, as it was causing a warning here
{
http_response_code(307);
$url = "?action=search&query=" . rawurlencode($env->page);
header("location: $url");
exit(page_renderer::render("Non existent page - $settings->sitename", "<p>There isn't a page on $settings->sitename with that name. However, you could <a href='$url'>search for this page name</a> in other pages.</p>
<p>Alternatively, you could <a href='?action=edit&page=" . rawurlencode($env->page) . "&create=true'>create this page</a>.</p>"));
}
// Redirect the user to the login page if: // Redirect the user to the login page if:
// - A login is required to view this wiki // - A login is required to view this wiki
@ -1774,6 +1767,23 @@ foreach($remote_files as $remote_file_def) {
file_put_contents($remote_file_def["local_filename"], fopen($remote_file_def["remote_url"], "rb")); file_put_contents($remote_file_def["local_filename"], fopen($remote_file_def["remote_url"], "rb"));
} }
//////////////////////////////////
/// Final Consistency Measures ///
//////////////////////////////////
// Redirect to the search page if there isn't a page with the requested name
if(!isset($pageindex->{$env->page}) and isset($_GET["search-redirect"]))
{
http_response_code(307);
$url = "?action=search&query=" . rawurlencode($env->page);
header("location: $url");
exit(page_renderer::render_minimal("Non existent page - $settings->sitename", "<p>There isn't a page on $settings->sitename with that name. However, you could <a href='$url'>search for this page name</a> in other pages.</p>
<p>Alternatively, you could <a href='?action=edit&page=" . rawurlencode($env->page) . "&create=true'>create this page</a>.</p>"));
}
//////////////////////////////////
// Perform the appropriate action // Perform the appropriate action
$action_name = $env->action; $action_name = $env->action;
if(isset($actions->$action_name)) if(isset($actions->$action_name))