"Settings GUI", "version" => "0.1", "author" => "Starbeamrainbowlabs", "description" => "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.", "id" => "feature-guiconfig", "code" => function() { global $settings; /** * @api {get} ?action=configure Change the global wiki settings * @apiName ConfigureSettings * @apiGroup Utility * @apiPermission Moderator */ /* * ██████ ██████ ███ ██ ███████ ██ ██████ ██ ██ ██████ ███████ * ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ██ ██ ██ ██ ██ ██ █████ ██ ██ ███ ██ ██ ██████ █████ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ██████ ██████ ██ ████ ██ ██ ██████ ██████ ██ ██ ███████ */ add_action("configure", function() { global $settings, $env, $guiConfig; if(!$env->is_admin) { $errorMessage = "

You don't have permission to change the site settings.

\n"; if(!$env->is_logged_in) $errorMessage .= "

You could try logging in.

"; else $errorMessage .= "

You could try logging out and then logging in again..

"; exit(page_renderer::render_main("Error - $settings->sitename", $errorMessage)); } $content = "

Master Control Panel

"; $content .= "

This page lets you configure the site settings. Please be careful - you can break things easily on this page if you're not careful!

"; foreach($guiConfig as $configKey => $configData) { // Don't display the site secret~! // Apparently it got lost in translation, but I'll be re-adding // it again at some point I'm sure - so support for it is // included here. if($configKey == "sitesecret") continue; $reverse = false; $inputControl = ""; $label = ""; switch($configData->type) { case "url": case "email": case "number": case "text": $inputControl = ""; break; case "textarea": $inputControl = ""; break; case "checkbox": $reverse = true; $inputControl = "$configKey ? " checked" : "") . " />"; break; default: $label = ""; $inputControl = "

Sorry! The $configKey setting isn't editable yet through the gui. Please try editing peppermint.json for the time being.

"; break; } $content .= "
\n\t"; $content .= $reverse ? "$inputControl\n\t$label" : "$label\n\t$inputControl"; $content .= "\n
\n"; } exit(page_renderer::render_main("Master Control Panel - $settings->sitename", $content)); }); add_help_section("800-raw-page-content", "Viewing Raw Page Content", "

Although you can use the edit page to view a page's source, you can also ask $settings->sitename to send you the raw page source and nothing else. This feature is intented for those who want to automate their interaction with $settings->sitename.

To use this feature, navigate to the page for which you want to see the source, and then alter the action parameter in the url's query string to be raw. If the action parameter doesn't exist, add it. Note that when used on an file's page this action will return the source of the description and not the file itself.

"); } ]); ?>