mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Fix for user-theme menu.
This commit is contained in:
parent
c5c7af80e9
commit
9edec709e8
40
class2.php
40
class2.php
@ -9,9 +9,9 @@
|
||||
* General purpose file
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
* $Revision: 1.101 $
|
||||
* $Date: 2009-07-07 21:39:18 $
|
||||
* $Author: e107steved $
|
||||
* $Revision: 1.102 $
|
||||
* $Date: 2009-07-07 22:56:10 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
//
|
||||
@ -930,16 +930,17 @@ define('TIMEOFFSET', $e_deltaTime);
|
||||
if(!defined("THEME_LAYOUT"))
|
||||
{
|
||||
$def = ""; // no custom pages found yet.
|
||||
$cusPagePref = (is_array($user_pref['sitetheme_custompages'])) ? $user_pref['sitetheme_custompages'] : $pref['sitetheme_custompages'];
|
||||
|
||||
if(is_array($pref['sitetheme_custompages'])) // check if we match a page in layout custompages.
|
||||
if(is_array($cusPagePref)) // check if we match a page in layout custompages.
|
||||
{
|
||||
foreach($pref['sitetheme_custompages'] as $layout=>$cusPageArray)
|
||||
foreach($cusPagePref as $lyout=>$cusPageArray)
|
||||
{
|
||||
foreach($cusPageArray as $kpage)
|
||||
{
|
||||
if ($kpage && (strstr(e_SELF, $kpage) || strstr(e_SELF."?".e_QUERY,$kpage)))
|
||||
{
|
||||
$def = ($layout) ? $layout : "no_array";
|
||||
$def = ($lyout) ? $lyout : "no_array";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -952,9 +953,11 @@ if(!defined("THEME_LAYOUT"))
|
||||
}
|
||||
else // default layout.
|
||||
{
|
||||
define("THEME_LAYOUT",varset($pref['sitetheme_deflayout'])); // default layout.
|
||||
$deflayout = (!isset($user_pref['sitetheme_deflayout'])) ? varset($pref['sitetheme_deflayout']) : $user_pref['sitetheme_deflayout'];
|
||||
define("THEME_LAYOUT",$deflayout); // default layout.
|
||||
}
|
||||
unset($def);
|
||||
unset($def,$lyout,$cusPagePref);
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -1516,19 +1519,32 @@ function init_session()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (check_class(varset($pref['allow_theme_select'],FALSE))) // This check doesn't work, because it relies on the definitions for USER, ADMIN, USERCLASS_LIST etc that haven't been defined yet..
|
||||
{ // User can set own theme
|
||||
if (isset($_POST['settheme']))
|
||||
{
|
||||
$user_pref['sitetheme'] = ($pref['sitetheme'] == $_POST['sitetheme'] ? "" : $_POST['sitetheme']);
|
||||
if($pref['sitetheme'] != $_POST['sitetheme'])
|
||||
{
|
||||
require_once(e_HANDLER."theme_handler.php");
|
||||
$utheme = new themeHandler;
|
||||
$ut = $utheme->themeArray[$_POST['sitetheme']];
|
||||
|
||||
$user_pref['sitetheme'] = $_POST['sitetheme'];
|
||||
$user_pref['sitetheme_custompages'] = $ut['custompages'];
|
||||
$user_pref['sitetheme_deflayout'] = $utheme->findDefault($_POST['sitetheme']);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($user_pref['sitetheme'],$user_pref['sitetheme_custompages'],$user_pref['sitetheme_deflayout']);
|
||||
}
|
||||
|
||||
save_prefs('user');
|
||||
unset($ut);
|
||||
}
|
||||
}
|
||||
elseif (isset($user_pref['sitetheme']))
|
||||
{ // User obviously no longer allowed his own theme - clear it
|
||||
unset($user_pref['sitetheme']);
|
||||
unset($user_pref['sitetheme'],$user_pref['sitetheme_custompages'],$user_pref['sitetheme_deflayout']);
|
||||
save_prefs('user');
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/menus.php,v $
|
||||
| $Revision: 1.18 $
|
||||
| $Date: 2009-07-07 16:04:42 $
|
||||
| $Revision: 1.19 $
|
||||
| $Date: 2009-07-07 22:56:11 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -247,20 +247,18 @@ if(isset($_POST['menuUsePreset']) && $_POST['curLayout'])
|
||||
{
|
||||
$row=$sql->db_Fetch();
|
||||
|
||||
if(!$sql->db_Update('menus', "menu_order='{$val['menu_order']}', menu_location = ".$val['menu_location'].", menu_class= ".$val['menu_class']." WHERE menu_name='".$val['menu_name']."' AND menu_layout = '$layout' LIMIT 1 ",TRUE))
|
||||
if(!$sql->db_Update('menus', "menu_order='{$val['menu_order']}', menu_location = ".$val['menu_location'].", menu_class= ".$val['menu_class']." WHERE menu_name='".$val['menu_name']."' AND menu_layout = '$layout' LIMIT 1 "))
|
||||
{
|
||||
$qry = "
|
||||
INSERT into #menus
|
||||
(`menu_name`, `menu_location`, `menu_order`, `menu_pages`,`menu_class`, `menu_path`, `menu_layout`)
|
||||
VALUES ('{$val['menu_name']}', {$val['menu_location']}, {$val['menu_order']}, '', '{$val['menu_class']}', '{$row['menu_path']}', '{$layout}')
|
||||
";
|
||||
$sql->db_Select_gen($qry,TRUE);
|
||||
$sql->db_Select_gen($qry);
|
||||
$admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,'');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $
|
||||
| $Revision: 1.25 $
|
||||
| $Date: 2009-07-07 16:04:45 $
|
||||
| $Revision: 1.26 $
|
||||
| $Date: 2009-07-07 22:56:12 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -726,7 +726,6 @@ class themeHandler{
|
||||
|
||||
function findDefault($theme)
|
||||
{
|
||||
|
||||
if(varset($_POST['layout_default']))
|
||||
{
|
||||
return $_POST['layout_default'];
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/user_menu/config.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-10-02 21:10:02 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-07-07 22:56:13 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
$eplug_admin = TRUE;
|
||||
@ -78,15 +78,21 @@ if (isset($pref['allowed_themes']))
|
||||
$themeeditclass = varset($pref['allow_theme_select'],e_UC_NOBODY);
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."' name='menu_conf_form'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder' >
|
||||
<colgroup>
|
||||
<form method='post' action='".e_SELF."' id='menu_conf_form'>
|
||||
<fieldset id='core-user_menu-usertheme'>
|
||||
<legend class='e-hideme'>".LAN_UMENU_THEME_6."</legend>
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
|
||||
<colgroup span='2'>
|
||||
<col style='width: 50%' />
|
||||
<col style='width: 50%' />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan='2' class='forumheader2'>".LAN_UMENU_THEME_4."</td>
|
||||
</tr>";
|
||||
<th colspan='2' class='forumheader2'>".LAN_UMENU_THEME_4."</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
|
||||
foreach ($themeOptions as $th)
|
||||
{
|
||||
@ -108,11 +114,20 @@ $text .= "
|
||||
<tr>
|
||||
<td colspan='2' class='forumheader' style='text-align:center'><input class='button' type='submit' name='update_theme' value='".LAN_UMENU_THEME_5."' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>";
|
||||
";
|
||||
$ns->tablerender(LAN_UMENU_THEME_6, $text);
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
function headerjs()
|
||||
{
|
||||
return "<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -11,16 +11,18 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/user_menu/usertheme_menu.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-10-02 21:10:02 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-07-07 22:56:13 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
global $pref, $eArrayStorage;
|
||||
|
||||
if ((USER == TRUE) && check_class(varset($pref['allow_theme_select'],FALSE)))
|
||||
{
|
||||
|
||||
$allThemes = TRUE;
|
||||
if (isset($pref['allowed_themes']))
|
||||
{
|
||||
@ -50,7 +52,8 @@ if ((USER == TRUE) && check_class(varset($pref['allow_theme_select'],FALSE)))
|
||||
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
$up = unserialize($row['user_prefs']);
|
||||
$up = (substr($row['user_prefs'],0,5) == "array") ? $eArrayStorage->ReadArray($row['user_prefs']) : unserialize($row['user_prefs']);
|
||||
|
||||
if (isset($themecount[$up['sitetheme']])) { $themecount[$up['sitetheme']]++; }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user