mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Add random_page_exclude_redirects setting - fixes #159
This commit is contained in:
parent
31d555f482
commit
0e3104415a
5 changed files with 143 additions and 132 deletions
|
@ -6,6 +6,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
### Added
|
||||
- [Module API] Added `save_settings()` convenience method
|
||||
- [Rest API] Add `user-add` and `set-password` moderator actions
|
||||
- Added `random_page_exclude_redirects` setting that prevents the `random` action from returning redirect pages.
|
||||
|
||||
### Fixed
|
||||
- Updated the search system to transliterate characters to better support searching pages that are written in other languages.
|
||||
|
|
|
@ -32,6 +32,7 @@ $guiConfig = <<<'GUICONFIG'
|
|||
"show_subpages": { "type": "checkbox", "description": "Whether to show a list of subpages at the bottom of the page.", "default": true},
|
||||
"subpages_display_depth": { "type": "text", "description": "The depth to which we should display when listing subpages at the bottom the page.", "default": 3},
|
||||
"random_page_exclude": { "type": "text", "description": "The pages names matching this regular expression won't be chosen when a random page is being picked to send you to by the random action.", "default": "/^Files\\/.*$/i" },
|
||||
"random_page_exclude_redirects": { "type": "checkbox", "description": "Causes the random action to avoid sending the user to a redirect page.", "default": true },
|
||||
"footer_message": { "type": "textarea", "description": "A message that will appear at the bottom of every page. May contain HTML.", "default": "All content is under <a href='?page=License' target='_blank'>this license</a>. Please make sure that you read and understand the license, especially if you are thinking about copying some (or all) of this site's content, as it may restrict you from doing so." },
|
||||
"editing_message": { "type": "textarea", "description": "A message that will appear just before the submit button on the editing page. May contain HTML.", "default": "<a href='?action=help#20-parser-default' target='_blank'>Formatting help</a> (<a href='https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet' target='_blank'>Markdown Cheatsheet</a>)<br />\nBy submitting your edit or uploading your file, you are agreeing to release your changes under <a href='?action=view&page=License' target='_blank'>this license</a>. Also note that if you don't want your work to be edited by other users of this site, please don't submit it here!" },
|
||||
"admindisplaychar": { "type": "text", "description": "The string that is prepended before an admin's name on the nav bar. Defaults to a diamond shape (◆).", "default": "◆" },
|
||||
|
@ -401,7 +402,7 @@ if($settings->sessionprefix == "auto")
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
/** The version of Pepperminty Wiki currently running. */
|
||||
$version = "v0.17-dev";
|
||||
$commit = "20e3596f4e264475a7a70ec2d48540ee4128f54d";
|
||||
$commit = "31d555f482dc6cf0416907f3ea1b11875765ccc7";
|
||||
/// Environment ///
|
||||
/** Holds information about the current request environment. */
|
||||
$env = new stdClass();
|
||||
|
@ -2250,7 +2251,7 @@ register_module([
|
|||
|
||||
register_module([
|
||||
"name" => "Random Page",
|
||||
"version" => "0.2",
|
||||
"version" => "0.3",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds an action called 'random' that redirects you to a random page.",
|
||||
"id" => "action-random",
|
||||
|
@ -2274,7 +2275,11 @@ register_module([
|
|||
|
||||
// Filter out pages we shouldn't send the user to
|
||||
$pageNames = array_values(array_filter($pageNames, function($pagename) {
|
||||
global $settings;
|
||||
global $settings, $pageindex;
|
||||
if($settings->random_page_exclude_redirects &&
|
||||
isset($pageindex->$pagename->redirect) &&
|
||||
$pageindex->$pagename->redirect === true)
|
||||
return false;
|
||||
return preg_match($settings->random_page_exclude, $pagename) === 0 ? true : false;
|
||||
}));
|
||||
|
||||
|
@ -3644,7 +3649,7 @@ register_module([
|
|||
|
||||
register_module([
|
||||
"name" => "Search",
|
||||
"version" => "0.6.2",
|
||||
"version" => "0.7",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
|
||||
"id" => "feature-search",
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
},
|
||||
{
|
||||
"name": "Random Page",
|
||||
"version": "0.2",
|
||||
"version": "0.3",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds an action called 'random' that redirects you to a random page.",
|
||||
"id": "action-random",
|
||||
"lastupdate": 1518648324,
|
||||
"lastupdate": 1530448215,
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
|
@ -100,11 +100,11 @@
|
|||
},
|
||||
{
|
||||
"name": "Search",
|
||||
"version": "0.6.2",
|
||||
"version": "0.7",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
|
||||
"id": "feature-search",
|
||||
"lastupdate": 1530355411,
|
||||
"lastupdate": 1530443634,
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Random Page",
|
||||
"version" => "0.2",
|
||||
"version" => "0.3",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds an action called 'random' that redirects you to a random page.",
|
||||
"id" => "action-random",
|
||||
|
@ -25,7 +25,11 @@ register_module([
|
|||
|
||||
// Filter out pages we shouldn't send the user to
|
||||
$pageNames = array_values(array_filter($pageNames, function($pagename) {
|
||||
global $settings;
|
||||
global $settings, $pageindex;
|
||||
if($settings->random_page_exclude_redirects &&
|
||||
isset($pageindex->$pagename->redirect) &&
|
||||
$pageindex->$pagename->redirect === true)
|
||||
return false;
|
||||
return preg_match($settings->random_page_exclude, $pagename) === 0 ? true : false;
|
||||
}));
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"show_subpages": { "type": "checkbox", "description": "Whether to show a list of subpages at the bottom of the page.", "default": true},
|
||||
"subpages_display_depth": { "type": "text", "description": "The depth to which we should display when listing subpages at the bottom the page.", "default": 3},
|
||||
"random_page_exclude": { "type": "text", "description": "The pages names matching this regular expression won't be chosen when a random page is being picked to send you to by the random action.", "default": "/^Files\\/.*$/i" },
|
||||
"random_page_exclude_redirects": { "type": "checkbox", "description": "Causes the random action to avoid sending the user to a redirect page.", "default": true },
|
||||
"footer_message": { "type": "textarea", "description": "A message that will appear at the bottom of every page. May contain HTML.", "default": "All content is under <a href='?page=License' target='_blank'>this license</a>. Please make sure that you read and understand the license, especially if you are thinking about copying some (or all) of this site's content, as it may restrict you from doing so." },
|
||||
"editing_message": { "type": "textarea", "description": "A message that will appear just before the submit button on the editing page. May contain HTML.", "default": "<a href='?action=help#20-parser-default' target='_blank'>Formatting help</a> (<a href='https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet' target='_blank'>Markdown Cheatsheet</a>)<br />\nBy submitting your edit or uploading your file, you are agreeing to release your changes under <a href='?action=view&page=License' target='_blank'>this license</a>. Also note that if you don't want your work to be edited by other users of this site, please don't submit it here!" },
|
||||
"admindisplaychar": { "type": "text", "description": "The string that is prepended before an admin's name on the nav bar. Defaults to a diamond shape (◆).", "default": "◆" },
|
||||
|
|
Loading…
Reference in a new issue