"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 // Perhaps this could be a setting instead? We'd need to update the settings logic a bit $firstrun_complete = file_exists("._peppermint_installed"); /** * @api {get} ?action=firstrun Display the firstrun page * @apiName FirstRun * @apiGroup Settings * @apiPermission Anonymous * */ /* * ███████ ██ ██████ ███████ ████████ ██████ ██ ██ ███ ██ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ * █████ ██ ██████ ███████ ██ ██████ ██ ██ ██ ██ ██ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ██ ██ ██ ██ ███████ ██ ██ ██ ██████ ██ ████ */ add_action("firstrun", function() use($firstrun_complete) { global $settings; if($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!
")); } // TODO: Check the environment here first // - Make sure peppermint.json isn't accessible // - Check for required modules? // TODO: Add a button to skip the firstrun wizard & do your own manual setup $result = "Welcome to Pepperminty Wiki.
Fill out the below form to get your wiki up and running!
"; }); add_action("firstrun-complete", function() { global $version, $commit; if($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!
")); } // $_POST: username, password, password-again, wiki-name, data-dir if(empty($_POST["username"])) { http_response_code(422); exit(page_renderer::render_main("Missing information - Error - Pepperminty Wiki", "Oops! Looks like you forgot to enter a username. Try going back in your browser and filling one in.
")); } if(empty($_POST["password"]) || empty($_POST["password-again"])) { http_response_code(422); 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(empty($_POST["wiki-name"])) { http_response_code(422); 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(422); 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).