From 286f2b72f0afccbffd8eab5e46ccc1cffb444cd1 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 12 Oct 2016 21:39:04 +0100 Subject: [PATCH] Start work on gui by creating module & setting things up. --- modules/feature-guiconfig.php | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 modules/feature-guiconfig.php diff --git a/modules/feature-guiconfig.php b/modules/feature-guiconfig.php new file mode 100644 index 0000000..7795928 --- /dev/null +++ b/modules/feature-guiconfig.php @@ -0,0 +1,55 @@ + "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, $guiConfig; + + $content = ""; + + foreach($guiConfig as $configKey => $configData) + { + $reverse = false; + $inputControl = ""; + $label = ""; + switch($configData->type) + { + case "text": + $inputControl = ""; + break; + case "textarea": + $inputControl = ""; + } + + $content .= !$reverse ? "$inputControl\n$label\n" : "$label\n$inputControl\n"; + } + + exit(file_get_contents("$env->storage_prefix$env->page.md")); + exit(); + }); + + 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.

"); + } +]); + +?>