2014-12-26 11:14:29 +00:00
|
|
|
<?php
|
2014-12-26 11:06:37 +00:00
|
|
|
/*
|
|
|
|
* Pepperminty Wiki
|
|
|
|
* ================
|
2016-04-03 17:11:34 +00:00
|
|
|
* Inspired by Minty Wiki by am2064
|
2014-12-26 11:06:37 +00:00
|
|
|
* Link: https://github.com/am2064/Minty-Wiki
|
2016-05-29 19:34:34 +00:00
|
|
|
*
|
2014-12-26 11:06:37 +00:00
|
|
|
* Credits:
|
2014-12-26 18:14:38 +00:00
|
|
|
* Code by @Starbeamrainbowlabs
|
2016-03-12 18:55:47 +00:00
|
|
|
* Parsedown - by erusev and others on github from http://parsedown.org/
|
2016-04-03 17:01:12 +00:00
|
|
|
* Mathematical Expression rendering
|
|
|
|
* Code: @con-f-use <https://github.com/con-f-use>
|
|
|
|
* Rendering: MathJax (https://www.mathjax.org/)
|
2015-01-05 18:53:44 +00:00
|
|
|
* Bug reports:
|
2015-07-14 15:11:59 +00:00
|
|
|
* #2 - Incorrect closing tag - nibreh <https://github.com/nibreh/>
|
|
|
|
* #8 - Rogue <datalist /> tag - nibreh <https://github.com/nibreh/>
|
2014-12-26 11:06:37 +00:00
|
|
|
*/
|
2016-06-22 08:13:32 +00:00
|
|
|
$guiConfig = <<<'GUICONFIG'
|
2016-06-12 20:06:27 +00:00
|
|
|
{guiconfig}
|
|
|
|
GUICONFIG;
|
2016-06-22 08:13:32 +00:00
|
|
|
|
2016-06-12 20:06:27 +00:00
|
|
|
$guiConfig = json_decode($guiConfig);
|
2015-04-09 14:13:07 +00:00
|
|
|
$settings = new stdClass();
|
2016-06-12 20:06:27 +00:00
|
|
|
if(!file_exists("peppermint.json"))
|
|
|
|
{
|
|
|
|
// Copy the default settings over to the main settings array
|
|
|
|
foreach ($guiConfig as $key => $value)
|
2016-06-13 05:41:50 +00:00
|
|
|
$settings->$key = $value->default;
|
2016-06-12 20:06:27 +00:00
|
|
|
// Generate a random secret
|
2016-06-22 08:13:32 +00:00
|
|
|
$settings->secret = bin2hex(openssl_random_pseudo_bytes(16));
|
2016-06-12 20:06:27 +00:00
|
|
|
file_put_contents("peppermint.json", json_encode($settings, JSON_PRETTY_PRINT));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
$settings = json_decode(file_get_contents("peppermint.json"));
|
|
|
|
|
2016-09-19 09:28:32 +00:00
|
|
|
if($settings === null)
|
|
|
|
{
|
|
|
|
header("content-type: text/plain");
|
|
|
|
exit("Error: Failed to decode the settings file! Does it contain a syntax error?");
|
|
|
|
}
|
|
|
|
|
2016-06-12 20:06:27 +00:00
|
|
|
if($settings->css === "auto")
|
|
|
|
{
|
|
|
|
$settings->css = <<<THEMECSS
|
2016-06-22 08:13:32 +00:00
|
|
|
{default-css}
|
|
|
|
THEMECSS;
|
2016-06-12 20:06:27 +00:00
|
|
|
}
|
2015-05-26 09:52:55 +00:00
|
|
|
|
2016-01-23 11:27:44 +00:00
|
|
|
/*** Notes ***
|
2014-12-26 11:06:37 +00:00
|
|
|
Actions:
|
|
|
|
view - view a page
|
2014-12-28 10:16:28 +00:00
|
|
|
page - page name
|
2014-12-26 11:06:37 +00:00
|
|
|
printable=[yes/no] - make output printable
|
|
|
|
edit - open editor for page
|
2014-12-28 10:16:28 +00:00
|
|
|
page - page name
|
2014-12-26 11:06:37 +00:00
|
|
|
save - save edits to page
|
2014-12-28 10:16:28 +00:00
|
|
|
page - page name
|
2014-12-26 11:06:37 +00:00
|
|
|
list - list pages
|
2015-03-14 18:38:32 +00:00
|
|
|
category - the category to list [optional] [unimplemented]
|
2014-12-26 11:06:37 +00:00
|
|
|
login - login to the site
|
|
|
|
logout - logout
|
|
|
|
checklogin - check login credentials and set cookie
|
|
|
|
hash - hash a string with sha256
|
|
|
|
string - string to hash
|
|
|
|
help - get help
|
2015-03-14 18:38:32 +00:00
|
|
|
update - update the wiki
|
|
|
|
do - set to `true` to actually update the wiki
|
|
|
|
secret - set to the value of the site's secret
|
2014-12-26 11:06:37 +00:00
|
|
|
credits - view the credits
|
2014-12-28 10:16:28 +00:00
|
|
|
delete - delete a page
|
|
|
|
page - page name
|
|
|
|
delete=yes - actually do the deletion (otherwise we display a prompt)
|
2016-01-23 11:27:44 +00:00
|
|
|
*************/
|
2014-12-26 11:14:29 +00:00
|
|
|
?>
|