mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
Add reset to internal default theme button, but there's some weirdness going on.
This commit is contained in:
parent
6213a6e715
commit
cc5f7561b0
3 changed files with 25 additions and 6 deletions
|
@ -85,7 +85,7 @@
|
|||
"version": "0.1.6",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.",
|
||||
"lastupdate": 1569768162,
|
||||
"lastupdate": 1571530165,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
@ -155,7 +155,7 @@
|
|||
"version": "0.3",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds a theme gallery page and optional automatic theme updates. Contacts a remote server, where IP addresses are stored in automatic server logs for security and attack mitigation purposes.",
|
||||
"lastupdate": 1570464845,
|
||||
"lastupdate": 1571530718,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
@ -267,7 +267,7 @@
|
|||
"version": "0.9.4",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds a pair of actions (login and checklogin) that allow users to login. You need this one if you want your users to be able to login.",
|
||||
"lastupdate": 1557573174,
|
||||
"lastupdate": 1570468766,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
|
|
@ -39,7 +39,7 @@ register_module([
|
|||
if(module_exists("feature-user-table"))
|
||||
$content .= "<p><em>Looking to manage $settings->sitename's users? Try the <a href='?action=user-table'>user table</a> instead!</p>\n";
|
||||
if(module_exists("feature-theme-gallery"))
|
||||
$content .= "<p><em>Want to change $settings->sitename's theme? Try the <a href='?action=theme-gallery'>theme gallery</a>! ($settings->sitename will make a HTTP request to fetch the theme gallery from a remote location)</em></p>";
|
||||
$content .= "<p><em>Want to change $settings->sitename's theme? Try the <a href='?action=theme-gallery'>theme gallery</a>!</em></p>";
|
||||
$content .= "<p>You're currently running Pepperminty Wiki $version+" . substr($commit, 0, 7) . ".</p>\n";
|
||||
$content .= "<h2>Actions</h2>";
|
||||
|
||||
|
|
|
@ -68,8 +68,10 @@ register_module([
|
|||
return $sorter->compare($a->name, $b->name);
|
||||
});
|
||||
|
||||
$content = "<h1>Theme Gallery</h1>
|
||||
|
||||
|
||||
$content = "<h1>Theme Gallery</h1>
|
||||
<p>$settings->sitename is currently using ".(strlen($settings->css_theme_autoupdate_url) > 0 ? "an external" : "the internal")." theme".(strlen($settings->css_theme_autoupdate_url) > 0 ? " (<a href='?action=theme-gallery-select&theme-selector=default-internal'>reset to the internal default theme</a>)" : "").".</p>
|
||||
<form method='get' action='index.php'>
|
||||
<input type='hidden' name='action' value='theme-gallery-select' />
|
||||
<div class='grid-large theme-list'>\n";
|
||||
|
@ -92,8 +94,16 @@ register_module([
|
|||
|
||||
});
|
||||
|
||||
/**
|
||||
* @api {get} ?action=theme-gallery-select&theme-selector=theme-id Set the site theme
|
||||
* @apiName ThemeGallerySelect
|
||||
* @apiGroup Utility
|
||||
* @apiPermission Moderator
|
||||
*
|
||||
* @apiParam {string} theme-selector The id of the theme to switch into, or 'default-internal' to switch back to the internal theme.
|
||||
*/
|
||||
add_action("theme-gallery-select", function() {
|
||||
global $env, $settings;
|
||||
global $env, $settings, $guiConfig;
|
||||
|
||||
if(!$env->is_admin) {
|
||||
$errorMessage = "<p>You don't have permission to change $settings->sitename's theme.</p>\n";
|
||||
|
@ -109,6 +119,15 @@ register_module([
|
|||
exit(page_renderer::render_main("No theme selected - Error - $settings->sitename", "<p>Oops! Looks like you didn't select a theme. Try <a href='?action=theme-gallery'>going back</a> and selecting one.</p>"));
|
||||
}
|
||||
|
||||
if($_GET["theme-selector"] === "default-internal") {
|
||||
$settings->css_theme_gallery_selected_id = $guiConfig->css_theme_gallery_selected_id->default;
|
||||
$settings->css_theme_gallery_selected_id = $guiConfig->css_theme_gallery_selected_id->default;
|
||||
$settings->css = $guiConfig->css->default;
|
||||
|
||||
exit(page_renderer::render_main("Theme reset - Theme Gallery - $settings->sitename", "<p>$settings->sitename's theme has been reset to the internal theme.</p>
|
||||
<p>Go to the <a href='?action=$settings->defaultaction'>homepage</a>.</p>"));
|
||||
}
|
||||
|
||||
// Set the new theme's id
|
||||
$settings->css_theme_gallery_selected_id = $_GET["theme-selector"];
|
||||
$gallery_urls = explode(" ", $settings->css_theme_gallery_index_url);
|
||||
|
|
Loading…
Reference in a new issue