"Page deleter", "version" => "0.4", "author" => "Starbeamrainbowlabs", "description" => "Adds an action to allow administrators to delete pages.", "id" => "page-delete", "code" => function() { add_action("delete", function() { global $pageindex, $settings, $page, $isadmin; if(!$settings->editing) { exit(renderpage("Deleting $page - error", "
You tried to delete $page, but editing is disabled on this wiki.
If you wish to delete this page, please re-enable editing on this wiki first.
Nothing has been changed.
")); } if(!$isadmin) { exit(renderpage("Deleting $page - error", "You tried to delete $page, but you are not an admin so you don't have permission to do that.
You should try logging in as an admin.
")); } if(!isset($_GET["delete"]) or $_GET["delete"] !== "yes") { exit(renderpage("Deleting $page", "You are about to delete $page. You can't undo this!
Click here to go back.")); } unset($pageindex->$page); //delete the page from the page index file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT)); //save the new page index unlink("./$page.md"); //delete the page from the disk exit(renderpage("Deleting $page - $settings->sitename", "
$page has been deleted. Go back to the main page.
")); }); } ]); ?>