Get search redirector to check ucwords(pagename) too - fixes #160

This commit is contained in:
Starbeamrainbowlabs 2018-07-01 13:46:06 +01:00
parent 0e3104415a
commit cd2497cea4
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 16 additions and 1 deletions

View File

@ -16,6 +16,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- [Module API] Fix `full_url()` logic
- [Module API] Make `email_user()` correctly return email sending failures
- Squashed a warning in the search redirector
- The search redirector will now check both the specified page name and the page name in Title Case
## Changed
- Password hashing has been overhauled! A totally new-and-different system is being used now, so you'll need to rehash all your passwords.

View File

@ -402,7 +402,7 @@ if($settings->sessionprefix == "auto")
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "v0.17-dev";
$commit = "31d555f482dc6cf0416907f3ea1b11875765ccc7";
$commit = "0e3104415acdf339000212466bc7e978d48e3d50";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@ -9230,6 +9230,13 @@ foreach($remote_files as $remote_file_def) {
/// Final Consistency Measures ///
//////////////////////////////////
if(!isset($pageindex->{$env->page}) && isset($pageindex->{ucwords($env->page)})) {
http_response_code(307);
header("location: ?page=" . ucwords($env->page));
header("content-type: text/plain");
exit("$env->page doesn't exist on $settings->sitename, but " . ucwords($env->page) . " does. You should be redirected there automatically.");
}
// 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"]))
{

View File

@ -1771,6 +1771,13 @@ foreach($remote_files as $remote_file_def) {
/// Final Consistency Measures ///
//////////////////////////////////
if(!isset($pageindex->{$env->page}) && isset($pageindex->{ucwords($env->page)})) {
http_response_code(307);
header("location: ?page=" . ucwords($env->page));
header("content-type: text/plain");
exit("$env->page doesn't exist on $settings->sitename, but " . ucwords($env->page) . " does. You should be redirected there automatically.");
}
// 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"]))
{