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

Fix forward slashes in search queries

This commit is contained in:
Starbeamrainbowlabs 2018-02-04 13:48:11 +00:00
parent 0dde3c824b
commit 0fb79ca68c
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 9 additions and 7 deletions

View file

@ -8,6 +8,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Display a more meaningful message to a logged in user if editing is disabled
- Fixed fetching the size of SVGs in some cases
- Fixed image captions in some cases (let me know if you still get warnings)
- Squashed warnings when you do a search with a forward slash (`/`) in your query
### Changed
- Disallow uploads if editing is disabled. Previously files could still be uploaded even if editing was disabled - unless `upload_enabled` was set to `false`.

View file

@ -4117,7 +4117,7 @@ class search
public static function tokenize($source)
{
$source = strtolower($source);
$source = str_replace([ '[', ']', '|', '{', '}' ], " ", $source);
$source = str_replace([ '[', ']', '|', '{', '}', '/' ], " ", $source);
return preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|(\p{P}+$))|\|/u", $source, -1, PREG_SPLIT_NO_EMPTY);
}
@ -7771,7 +7771,7 @@ register_module([
register_module([
"name" => "Parsedown",
"version" => "0.9.9",
"version" => "0.9.10",
"author" => "Emanuil Rusev & Starbeamrainbowlabs",
"description" => "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https://github.com/erusev/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.",
"id" => "parser-parsedown",
@ -8368,7 +8368,8 @@ class PeppermintParsedown extends ParsedownExtra
if($imageCaption)
{
$rawStyle = $result["element"]["attributes"]["style"] ?? "";
//$rawStyle = $result["element"]["attributes"]["style"] ?? "";
$rawStyle = $result["element"]["attributes"]["style"];
$containerStyle = preg_replace('/^.*float/', "float", $rawStyle);
$mediaStyle = preg_replace('/\s*float.*;/', "", $rawStyle);
$result["element"] = [

View file

@ -104,7 +104,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": 1511208633,
"lastupdate": 1517751847,
"optional": false
},
{
@ -262,11 +262,11 @@
},
{
"name": "Parsedown",
"version": "0.9.9",
"version": "0.9.10",
"author": "Emanuil Rusev & Starbeamrainbowlabs",
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.",
"id": "parser-parsedown",
"lastupdate": 1517750247,
"lastupdate": 1517750660,
"optional": false
}
]

View file

@ -528,7 +528,7 @@ class search
public static function tokenize($source)
{
$source = strtolower($source);
$source = str_replace([ '[', ']', '|', '{', '}' ], " ", $source);
$source = str_replace([ '[', ']', '|', '{', '}', '/' ], " ", $source);
return preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|(\p{P}+$))|\|/u", $source, -1, PREG_SPLIT_NO_EMPTY);
}