"First run wizard", "version" => "0.1", "author" => "Starbeamrainbowlabs", "description" => "Displays a special page to aid in setting up a new wiki for the first time.", "id" => "feature-firstrun", "code" => function() { // TODO: Remove this line once it's ready return true; // Stop this module from actually being executed - it's not ready yet! // TODO: Figure out how to detect pre-existing wikis here /** * @api {get} ?action=firstrun Display the firstrun page * @apiName FirstRun * @apiGroup Settings * @apiPermission Anonymous * */ /* * ███████ ██ ██████ ███████ ████████ ██████ ██ ██ ███ ██ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ * █████ ██ ██████ ███████ ██ ██████ ██ ██ ██ ██ ██ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ██ ██ ██ ██ ███████ ██ ██ ██ ██████ ██ ████ */ add_action("firstrun", function() { global $settings; if($settings->firstrun_complete) { http_response_code(400); exit(page_renderer::render_main("Setup complete - Error - $settings->sitename", "
Oops! Looks like $settings->sitename is already setup and ready to go! Go to the " . htmlentities($settings->defaultpage)." to get started!
")); } if(!module_exists("page-login")) { http_response_code(503); exit(page_renderer::render_main("Build error - Pepperminty Wiki", "The page-login
wasn't included in this build of Pepperminty Wiki, so the first-run installation wizard will not work correctly.
You can still complete the setup manually, however! Once done, set firstrun_complete
in peppermint.json to true
.
Welcome to Pepperminty Wiki.
Fill out the below form to get your wiki up and running!
"; exit(page_renderer::render_main("Welcome! - Pepperminty Wiki", $result)); }); add_action("firstrun-complete", function() { global $version, $commit, $settings; if($settings->firstrun_complete) { http_response_code(400); exit(page_renderer::render_main("Setup complete - Error - $settings->sitename", "Oops! Looks like $settings->sitename is already setup and ready to go! Go to the " . htmlentities($settings->defaultpage)." to get started!
")); } if($_POST["secret"] !== $settings->secret) { http_response_code(401); exit(page_renderer::render_main("Incorrect secret - Pepperminty Wiki", "Oops! That secret was incorrect. Open peppermint.json
that is automatically written to the directory alongside the index.php
that you uploaded to your web server and copy the value of the secret
property into the wiki secret box on the previous page, taking care to avoid copying the quotation marks.
Oops! Looks like you forgot to enter a username. Try going back in your browser and filling one in.
")); } if(empty($_POST["email-address"])) { http_response_code(400); exit(page_renderer::render_main("Missing information - Error - Pepperminty Wiki", "Oops! Looks like you forgot to enter an email address. Try going back in your browser and filling one in.
")); } if(!filter_var($_POST["email-address"], FILTER_VALIDATE_EMAIL)) { http_response_code(400); exit(page_renderer::render_main("Invalid email address - Error - Pepperminty Wiki", "Oops! Looks like that email address isn't valid. Try going back in your browser and correcting it.
")); } if(empty($_POST["password"]) || empty($_POST["password-again"])) { http_response_code(400); exit(page_renderer::render_main("Missing information - Error - Pepperminty Wiki", "Oops! Looks like you forgot to enter a password. Try going back in your browser and filling one in.
")); } if($_POST["password"] !== $_POST["password-again"]) { http_response_code(422); exit(page_renderer::render_main("Password mismatch - Error - Pepperminty Wiki", "Oops! Looks like the passwords you entered aren't the same. Try going back in your browser and entering it again.
")); } if(empty($_POST["wiki-name"])) { http_response_code(400); exit(page_renderer::render_main("Missing information - Error - Pepperminty Wiki", "Oops! Looks like you forgot to enter a name for your wiki. Try going back in your browser and filling one in.
")); } if(empty($_POST["data-dir"])) { http_response_code(400); exit(page_renderer::render_main("Missing information - Error - Pepperminty Wiki", "Oops! Looks like you forgot to enter a directory on the server to store the wiki's data in. Try going back in your browser and filling one in. Relative paths are ok - the default is .
(i.e. the current directory).
Oops! Pepperminty Wiki was unable to save your settings back to disk. This can happen if Pepperminty Wiki does not have write permissions on it's own directory and the files contained within (except index.php
of course).
Try contacting your server owner and ask them to correct it. If you are the server owner, you may need to run sudo chown -R WEBSERVER_USERNAME:WEBSERVER_USERNAME PATH/TO/WIKI/DIRECTORY
, replacing the bits in UPPERCASE.
Congratulations! You've completed the Pepperminty Wiki setup.
Click here to start using $settings->sitename, your new wiki!
")); }); } ]);