2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2009-11-12 21:44:15 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2013-05-13 12:09:55 +02:00
|
|
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
2009-11-12 21:44:15 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*/
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
if (!defined('e107_INIT')) { exit; }
|
2009-07-07 22:56:13 +00:00
|
|
|
global $pref, $eArrayStorage;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-10-02 21:10:34 +00:00
|
|
|
if ((USER == TRUE) && check_class(varset($pref['allow_theme_select'],FALSE)))
|
|
|
|
{
|
2009-07-07 22:56:13 +00:00
|
|
|
|
2008-10-02 21:10:34 +00:00
|
|
|
$allThemes = TRUE;
|
|
|
|
if (isset($pref['allowed_themes']))
|
|
|
|
{
|
|
|
|
$allThemes = FALSE;
|
|
|
|
$themeList = explode(',',$pref['allowed_themes']);
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
$handle = opendir(e_THEME);
|
2008-10-02 21:10:34 +00:00
|
|
|
while ($file = readdir($handle))
|
|
|
|
{
|
|
|
|
if ($file != "." && $file != ".." && $file != "templates" && $file != "" && $file != "CVS")
|
|
|
|
{
|
2013-05-13 12:09:55 +02:00
|
|
|
if (is_readable(e_THEME.$file."/theme.php") /*&& is_readable(e_THEME.$file."/style.css")*/ && ($allThemes || in_Array($file, $themeList)))
|
2008-10-02 21:10:34 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$themelist[] = $file;
|
|
|
|
$themecount[$file] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir($handle);
|
2008-10-02 21:10:34 +00:00
|
|
|
|
|
|
|
if (count($themelist))
|
|
|
|
{
|
|
|
|
$defaulttheme = $pref['sitetheme'];
|
|
|
|
$count = 0;
|
|
|
|
|
2013-05-13 12:09:55 +02:00
|
|
|
$totalct = $sql->select("user", "user_prefs", "user_prefs REGEXP('sitetheme') ");
|
2008-10-02 21:10:34 +00:00
|
|
|
|
2013-05-13 12:09:55 +02:00
|
|
|
while ($row = $sql->fetch())
|
2008-10-02 21:10:34 +00:00
|
|
|
{
|
2014-02-07 07:33:33 -08:00
|
|
|
$up = (substr($row['user_prefs'],0,5) == "array") ? e107::unserialize($row['user_prefs']) : unserialize($row['user_prefs']);
|
2009-07-07 22:56:13 +00:00
|
|
|
|
2008-10-02 21:10:34 +00:00
|
|
|
if (isset($themecount[$up['sitetheme']])) { $themecount[$up['sitetheme']]++; }
|
|
|
|
}
|
|
|
|
|
2013-05-13 12:09:55 +02:00
|
|
|
$defaultusers = $sql->count("user") - $totalct;
|
2008-10-02 21:10:34 +00:00
|
|
|
$themecount[$defaulttheme] += $defaultusers;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-10-02 21:10:34 +00:00
|
|
|
$text = "<form method='post' action='".e_SELF."'>
|
|
|
|
<div style='text-align:center'>
|
|
|
|
<select name='sitetheme' class='tbox' style='width: 95%;'>";
|
|
|
|
$counter = 0;
|
|
|
|
|
|
|
|
while (isset($themelist[$counter]) && $themelist[$counter])
|
|
|
|
{
|
|
|
|
$text .= "<option value='".$themelist[$counter]."' ";
|
|
|
|
if (($themelist[$counter] == USERTHEME) || (USERTHEME == FALSE && $themelist[$counter] == $defaulttheme))
|
|
|
|
{
|
|
|
|
$text .= "selected='selected'";
|
|
|
|
}
|
|
|
|
$text .= ">".($themelist[$counter] == $defaulttheme ? "[ ".$themelist[$counter]." ]" : $themelist[$counter]).' ('.LAN_UMENU_THEME_3.' '.$themecount[$themelist[$counter]].")</option>\n";
|
|
|
|
$counter++;
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-10-02 21:10:34 +00:00
|
|
|
$text .= "</select>
|
|
|
|
<br /><br />
|
2018-01-10 15:06:40 -08:00
|
|
|
<input class='btn btn-default btn-secondary button' type='submit' name='settheme' value='".LAN_UMENU_THEME_1."' />
|
2008-10-02 21:10:34 +00:00
|
|
|
</div></form>";
|
|
|
|
|
|
|
|
$ns->tablerender(LAN_UMENU_THEME_2, $text, 'usertheme');
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|