mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
Bugfix: Page protection: undefined property defaultaction
This commit is contained in:
parent
6eea1700d6
commit
41d18dc539
4 changed files with 8 additions and 6 deletions
|
@ -1225,7 +1225,7 @@ register_module([
|
||||||
"id" => "action-protect",
|
"id" => "action-protect",
|
||||||
"code" => function() {
|
"code" => function() {
|
||||||
add_action("protect", function() {
|
add_action("protect", function() {
|
||||||
global $env, $pageindex, $paths;
|
global $env, $pageindex, $paths, $settings;
|
||||||
|
|
||||||
// Make sure that the user is logged in as an admin / mod.
|
// Make sure that the user is logged in as an admin / mod.
|
||||||
if($env->is_admin)
|
if($env->is_admin)
|
||||||
|
@ -1257,7 +1257,7 @@ register_module([
|
||||||
|
|
||||||
$state = ($pageindex->$page->protect ? "enabled" : "disabled");
|
$state = ($pageindex->$page->protect ? "enabled" : "disabled");
|
||||||
$title = "Page protection $state.";
|
$title = "Page protection $state.";
|
||||||
exit(page_renderer::render_main($title, "<p>Page protection for $env->page has been $state.</p><p><a href='?action=$env->defaultaction&page=$env->page'>Go back</a>."));
|
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>."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2352,6 +2352,7 @@ register_module([
|
||||||
}
|
}
|
||||||
// Delete the page from the page index
|
// Delete the page from the page index
|
||||||
unset($pageindex->$page);
|
unset($pageindex->$page);
|
||||||
|
|
||||||
// Save the new page index
|
// Save the new page index
|
||||||
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
|
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"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.",
|
"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",
|
"id": "action-protect",
|
||||||
"lastupdate": 1447053764,
|
"lastupdate": 1447320482,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds an action to allow administrators to delete pages.",
|
"description": "Adds an action to allow administrators to delete pages.",
|
||||||
"id": "page-delete",
|
"id": "page-delete",
|
||||||
"lastupdate": 1447269808,
|
"lastupdate": 1447269891,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ register_module([
|
||||||
"id" => "action-protect",
|
"id" => "action-protect",
|
||||||
"code" => function() {
|
"code" => function() {
|
||||||
add_action("protect", function() {
|
add_action("protect", function() {
|
||||||
global $env, $pageindex, $paths;
|
global $env, $pageindex, $paths, $settings;
|
||||||
|
|
||||||
// Make sure that the user is logged in as an admin / mod.
|
// Make sure that the user is logged in as an admin / mod.
|
||||||
if($env->is_admin)
|
if($env->is_admin)
|
||||||
|
@ -39,7 +39,7 @@ register_module([
|
||||||
|
|
||||||
$state = ($pageindex->$page->protect ? "enabled" : "disabled");
|
$state = ($pageindex->$page->protect ? "enabled" : "disabled");
|
||||||
$title = "Page protection $state.";
|
$title = "Page protection $state.";
|
||||||
exit(page_renderer::render_main($title, "<p>Page protection for $env->page has been $state.</p><p><a href='?action=$env->defaultaction&page=$env->page'>Go back</a>."));
|
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>."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@ register_module([
|
||||||
}
|
}
|
||||||
// Delete the page from the page index
|
// Delete the page from the page index
|
||||||
unset($pageindex->$page);
|
unset($pageindex->$page);
|
||||||
|
|
||||||
// Save the new page index
|
// Save the new page index
|
||||||
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
|
file_put_contents($paths->pageindex, json_encode($pageindex, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue