1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

FIll in settings that aren't present in peppermint.json. Fixes #83.

This commit is contained in:
Starbeamrainbowlabs 2016-12-06 19:17:11 +00:00
parent 99030913fe
commit f7d8afd12f
3 changed files with 29 additions and 51 deletions

View file

@ -170,6 +170,20 @@ if($settings === null)
exit("Error: Failed to decode the settings file! Does it contain a syntax error?");
}
// Fill in any missing properties
$settingsUpgraded = false;
foreach($guiConfig as $key => $propertyData)
{
if(!isset($settings->$key))
{
$settings->$key = $propertyData->default;
$settingsUpgraded = true;
}
}
if($settingsUpgraded)
file_put_contents("peppermint.json", json_encode($settings, JSON_PRETTY_PRINT));
// Insert the default CSS if requested
if($settings->css === "auto")
{
$settings->css = <<<THEMECSS
@ -287,31 +301,6 @@ footer { padding: 2rem; }
THEMECSS;
}
/*** Notes ***
Actions:
view - view a page
page - page name
printable=[yes/no] - make output printable
edit - open editor for page
page - page name
save - save edits to page
page - page name
list - list pages
category - the category to list [optional] [unimplemented]
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
update - update the wiki
do - set to `true` to actually update the wiki
secret - set to the value of the site's secret
credits - view the credits
delete - delete a page
page - page name
delete=yes - actually do the deletion (otherwise we display a prompt)
*************/

View file

@ -176,7 +176,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds an action to allow administrators to move pages.",
"id": "page-move",
"lastupdate": 1480101990,
"lastupdate": 1480102277,
"optional": false
},
{

View file

@ -39,6 +39,20 @@ if($settings === null)
exit("Error: Failed to decode the settings file! Does it contain a syntax error?");
}
// Fill in any missing properties
$settingsUpgraded = false;
foreach($guiConfig as $key => $propertyData)
{
if(!isset($settings->$key))
{
$settings->$key = $propertyData->default;
$settingsUpgraded = true;
}
}
if($settingsUpgraded)
file_put_contents("peppermint.json", json_encode($settings, JSON_PRETTY_PRINT));
// Insert the default CSS if requested
if($settings->css === "auto")
{
$settings->css = <<<THEMECSS
@ -46,29 +60,4 @@ if($settings->css === "auto")
THEMECSS;
}
/*** Notes ***
Actions:
view - view a page
page - page name
printable=[yes/no] - make output printable
edit - open editor for page
page - page name
save - save edits to page
page - page name
list - list pages
category - the category to list [optional] [unimplemented]
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
update - update the wiki
do - set to `true` to actually update the wiki
secret - set to the value of the site's secret
credits - view the credits
delete - delete a page
page - page name
delete=yes - actually do the deletion (otherwise we display a prompt)
*************/
?>