Bugfix: Another (successful this time) attempt to rid ourselves of blank tags

This commit is contained in:
Starbeamrainbowlabs 2015-11-01 14:31:51 +00:00
parent 1c58a64134
commit 9046d72e7c
3 changed files with 19 additions and 21 deletions

View File

@ -2360,11 +2360,15 @@ register_module([
if($settings->clean_raw_html) if($settings->clean_raw_html)
$pagedata = htmlentities($pagedata, ENT_QUOTES); $pagedata = htmlentities($pagedata, ENT_QUOTES);
// Read in the new page tags // Read in the new page tags, so long as there are actually some tags to read in
$page_tags = explode(",", $_POST["tags"]); $page_tags = [];
// Trim off all the whitespace if(strlen(trim($_POST["tags"])) > 0)
foreach($page_tags as &$tag) {
$tag = trim($tag); $page_tags = explode(",", $_POST["tags"]);
// Trim off all the whitespace
foreach($page_tags as &$tag)
$tag = trim($tag);
}
// Update the inverted search index // Update the inverted search index
@ -2372,11 +2376,6 @@ register_module([
$oldindex = search::index(file_get_contents("$env->page.md")); $oldindex = search::index(file_get_contents("$env->page.md"));
$newindex = search::index($pagedata); $newindex = search::index($pagedata);
echo("old: ");
var_dump($oldindex);
echo("new: ");
var_dump($newindex);
// Compare the indexes of the old and new content // Compare the indexes of the old and new content
$additions = []; $additions = [];
$removals = []; $removals = [];

View File

@ -86,7 +86,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.", "description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id": "page-edit", "id": "page-edit",
"lastupdate": 1446387938, "lastupdate": 1446388267,
"optional": false "optional": false
}, },
{ {

View File

@ -126,11 +126,15 @@ register_module([
if($settings->clean_raw_html) if($settings->clean_raw_html)
$pagedata = htmlentities($pagedata, ENT_QUOTES); $pagedata = htmlentities($pagedata, ENT_QUOTES);
// Read in the new page tags // Read in the new page tags, so long as there are actually some tags to read in
$page_tags = explode(",", $_POST["tags"]); $page_tags = [];
// Trim off all the whitespace if(strlen(trim($_POST["tags"])) > 0)
foreach($page_tags as &$tag) {
$tag = trim($tag); $page_tags = explode(",", $_POST["tags"]);
// Trim off all the whitespace
foreach($page_tags as &$tag)
$tag = trim($tag);
}
// Update the inverted search index // Update the inverted search index
@ -138,11 +142,6 @@ register_module([
$oldindex = search::index(file_get_contents("$env->page.md")); $oldindex = search::index(file_get_contents("$env->page.md"));
$newindex = search::index($pagedata); $newindex = search::index($pagedata);
echo("old: ");
var_dump($oldindex);
echo("new: ");
var_dump($newindex);
// Compare the indexes of the old and new content // Compare the indexes of the old and new content
$additions = []; $additions = [];
$removals = []; $removals = [];