mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
FIll in settings that aren't present in peppermint.json. Fixes #83.
This commit is contained in:
parent
99030913fe
commit
f7d8afd12f
3 changed files with 29 additions and 51 deletions
|
@ -170,6 +170,20 @@ if($settings === null)
|
||||||
exit("Error: Failed to decode the settings file! Does it contain a syntax error?");
|
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")
|
if($settings->css === "auto")
|
||||||
{
|
{
|
||||||
$settings->css = <<<THEMECSS
|
$settings->css = <<<THEMECSS
|
||||||
|
@ -287,31 +301,6 @@ footer { padding: 2rem; }
|
||||||
THEMECSS;
|
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)
|
|
||||||
*************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds an action to allow administrators to move pages.",
|
"description": "Adds an action to allow administrators to move pages.",
|
||||||
"id": "page-move",
|
"id": "page-move",
|
||||||
"lastupdate": 1480101990,
|
"lastupdate": 1480102277,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,20 @@ if($settings === null)
|
||||||
exit("Error: Failed to decode the settings file! Does it contain a syntax error?");
|
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")
|
if($settings->css === "auto")
|
||||||
{
|
{
|
||||||
$settings->css = <<<THEMECSS
|
$settings->css = <<<THEMECSS
|
||||||
|
@ -46,29 +60,4 @@ if($settings->css === "auto")
|
||||||
THEMECSS;
|
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)
|
|
||||||
*************/
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue