1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

Switch over another stray path in the core to the new system

This commit is contained in:
Starbeamrainbowlabs 2015-11-12 10:01:21 +00:00
parent 414eb58850
commit 9c1b5faf28
4 changed files with 11 additions and 11 deletions

View file

@ -540,11 +540,11 @@ function get_subpages($pageindex, $pagename)
*/
function check_subpage_parents($pagename)
{
global $pageindex;
global $pageindex, $paths;
// Save the new pageindex and return if there aren't any more parent pages to check
if(strpos($pagename, "/") === false)
{
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
return;
}
@ -1232,7 +1232,7 @@ register_module([
{
// They check out ok, toggle the page's protection.
$page = $env->page;
if(!isset($pageindex->$page->protect))
{
$pageindex->$page->protect = true;
@ -1245,10 +1245,10 @@ register_module([
{
$pageindex->$page->protect = true;
}
// Save the pageindex
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
$state = ($pageindex->$page->protect ? "enabled" : "disabled");
$title = "Page protection $state.";
exit(page_renderer::render_main($title, "<p>Page protection for $env->page has been $state.</p><p><a href='?action=$settings->defaultaction&page=$env->page'>Go back</a>."));

View file

@ -202,11 +202,11 @@ function get_subpages($pageindex, $pagename)
*/
function check_subpage_parents($pagename)
{
global $pageindex;
global $pageindex, $paths;
// Save the new pageindex and return if there aren't any more parent pages to check
if(strpos($pagename, "/") === false)
{
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
return;
}

View file

@ -14,7 +14,7 @@
"author": "Starbeamrainbowlabs",
"description": "Exposes Pepperminty Wiki's new page protection mechanism and makes the protect button in the 'More...' menu on the top bar work.",
"id": "action-protect",
"lastupdate": 1447322278,
"lastupdate": 1447322382,
"optional": false
},
{

View file

@ -14,7 +14,7 @@ register_module([
{
// They check out ok, toggle the page's protection.
$page = $env->page;
if(!isset($pageindex->$page->protect))
{
$pageindex->$page->protect = true;
@ -27,10 +27,10 @@ register_module([
{
$pageindex->$page->protect = true;
}
// Save the pageindex
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
$state = ($pageindex->$page->protect ? "enabled" : "disabled");
$title = "Page protection $state.";
exit(page_renderer::render_main($title, "<p>Page protection for $env->page has been $state.</p><p><a href='?action=$settings->defaultaction&page=$env->page'>Go back</a>."));