Add selection to site edit to allow users to change site styles or not.

This commit is contained in:
Darko
2015-05-22 15:32:33 +02:00
parent 399537d114
commit f24df2027f
5 changed files with 30 additions and 13 deletions
+2
View File
@@ -0,0 +1,2 @@
INSERT INTO `site` (`setting`, `value`) VALUES ('userselstyle', '0');
UPDATE `tmux` SET `value` = '147' WHERE `setting` = 'sqlpatch';
@@ -113,13 +113,15 @@ class BasePage
$this->userdata["categoryexclusions"] = $this->users->getCategoryExclusion($this->users->currentUserId());
// Change the theme to user's selected theme if they selected one, else use the admin one.
if (isset($this->userdata['style']) && $this->userdata['style'] !== 'None') {
$this->smarty->setTemplateDir(
array(
'user_frontend' => NN_WWW . 'templates/' . $this->userdata['style'] . '/views/frontend',
'frontend' => NN_WWW . 'templates/default/views/frontend'
)
);
if ($this->site->userselstyle == 1) {
if (isset($this->userdata['style']) && $this->userdata['style'] !== 'None') {
$this->smarty->setTemplateDir(
array(
'user_frontend' => NN_WWW . 'templates/' . $this->userdata['style'] . '/views/frontend',
'frontend' => NN_WWW . 'templates/default/views/frontend'
)
);
}
}
//update lastlogin every 15 mins
+9 -6
View File
@@ -6,6 +6,8 @@ $category = new Category;
$sab = new SABnzbd($page);
$nzbGet = new NZBGet($page);
$users = new Users();
$s = new Sites();
$site = $s->get();
if (!$users->isLoggedIn())
$page->show403();
@@ -99,13 +101,14 @@ switch ($action) {
default:
break;
}
if ($site->userselstyle ==1) {
// Get the list of themes.
$themeList[] = 'None';
$themes = scandir(NN_WWW . '/templates');
foreach ($themes as $theme) {
if (strpos($theme, ".") === false && $theme[0] !== '_' && is_dir(NN_WWW . '/templates/' . $theme)) {
$themeList[] = $theme;
$themeList[] = 'None';
$themes = scandir(NN_WWW . '/templates');
foreach ($themes as $theme) {
if (strpos($theme, ".") === false && $theme[0] !== '_' && is_dir(NN_WWW . '/templates/' . $theme)) {
$themeList[] = $theme;
}
}
}
@@ -92,6 +92,14 @@
</td>
</tr>
<tr>
<td><label for="userselstyle">User selectable site theme</label>:</td>
<td>
{html_radios id="userselstyle" name='userselstyle' values=$yesno_ids output=$yesno_names selected=$fsite->userselstyle separator='<br />'}
<div class="hint">Should users be allowed to change their site theme or not..</div>
</td>
</tr>
<tr>
<td><label for="style">Dereferrer Link</label>:</td>
<td>
@@ -42,6 +42,7 @@
<fieldset>
<legend>Site Preferences</legend>
<table class="input">
{if $page->site->userselstyle == 1}
<tr>
<th>Site theme:</th>
<td>
@@ -49,6 +50,7 @@
<span class="help-block">Change the site theme, None will use the theme the administrator set.</span>
</td>
</tr>
{/if}
<tr>
<th>View Movie Page:</th>
<td>