mirror of
https://github.com/e107inc/e107.git
synced 2025-07-28 02:10:46 +02:00
save_pref('user') updated to store as array (like core prefs). should be backwards compatible - but expecting a few things to break.
Infopanel now stores customization settings in user-pref. Newspost table-listing customization now also saves in user-pref. Some admin icon array clean-up. user-theme saving doesn't work at time of testing. Rolled back class2 and problem existed before. (see note in class2.php line 1489)
This commit is contained in:
46
class2.php
46
class2.php
@@ -9,9 +9,9 @@
|
||||
* General purpose file
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
* $Revision: 1.95 $
|
||||
* $Date: 2009-05-26 20:17:57 $
|
||||
* $Author: e107steved $
|
||||
* $Revision: 1.96 $
|
||||
* $Date: 2009-07-04 13:36:14 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
//
|
||||
@@ -1323,8 +1323,10 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
||||
}
|
||||
else
|
||||
{
|
||||
$_user_pref = $tp -> toDB($user_pref);
|
||||
$tmp=addslashes(serialize($_user_pref));
|
||||
// $_user_pref = $tp -> toDB($user_pref);
|
||||
// $tmp=addslashes(serialize($_user_pref));
|
||||
$_user_pref = $tp->toDB($user_pref, true, true);
|
||||
$tmp = $eArrayStorage->WriteArray($_user_pref);
|
||||
$sql->db_Update('user', "user_prefs='$tmp' WHERE user_id=".intval($uid));
|
||||
return $tmp;
|
||||
}
|
||||
@@ -1383,7 +1385,7 @@ function init_session()
|
||||
# - return boolean
|
||||
# - scope public
|
||||
*/
|
||||
global $sql, $pref, $user_pref, $tp, $currentUser, $e107, $_E107;
|
||||
global $sql, $pref, $user_pref, $tp, $currentUser, $e107, $_E107, $eArrayStorage;
|
||||
|
||||
define('USERIP', $e107->getip());
|
||||
|
||||
@@ -1476,20 +1478,26 @@ function init_session()
|
||||
exit;
|
||||
}
|
||||
|
||||
$user_pref = ($result['user_prefs'] ? unserialize($result['user_prefs']) : '');
|
||||
|
||||
if (check_class(varset($pref['allow_theme_select'],FALSE)))
|
||||
{ // User can set own theme
|
||||
if (isset($_POST['settheme']))
|
||||
if($result['user_prefs'])
|
||||
{
|
||||
$user_pref = (substr($result['user_prefs'],0,5) == "array") ? $eArrayStorage->ReadArray($result['user_prefs']) : unserialize($result['user_prefs']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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']);
|
||||
save_prefs('user');
|
||||
}
|
||||
}
|
||||
elseif (isset($user_pref['sitetheme']))
|
||||
{ // User obviously no longer allowed his own theme - clear it
|
||||
unset($user_pref['sitetheme']);
|
||||
save_prefs('user');
|
||||
save_prefs('user');
|
||||
}
|
||||
}
|
||||
elseif (isset($user_pref['sitetheme']))
|
||||
{ // User obviously no longer allowed his own theme - clear it
|
||||
unset($user_pref['sitetheme']);
|
||||
save_prefs('user');
|
||||
}
|
||||
|
||||
|
||||
@@ -1520,7 +1528,7 @@ function init_session()
|
||||
}
|
||||
}
|
||||
|
||||
define('USERCLASS_LIST', class_list());
|
||||
define('USERCLASS_LIST', class_list());
|
||||
define('e_CLASS_REGEXP', '(^|,)('.str_replace(',', '|', USERCLASS_LIST).')(,|$)');
|
||||
define('e_NOBODY_REGEXP', '(^|,)'.e_UC_NOBODY.'(,|$)');
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2009-07-04 03:08:03 $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2009-07-04 13:36:15 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -223,6 +223,26 @@ function render_clean()
|
||||
|
||||
|
||||
$newarray = asortbyindex($array_functions, 1);
|
||||
$array_functions_assoc = convert_core_icons($newarray);
|
||||
|
||||
|
||||
|
||||
function convert_core_icons($newarray) // Put core button array in the same format as plugin button array.
|
||||
{
|
||||
foreach($newarray as $val)
|
||||
{
|
||||
$key = "e-".basename($val[0],".php");
|
||||
$val['icon'] = $val[5];
|
||||
$val['icon_32'] = $val[6];
|
||||
$val['title'] = $val[1];
|
||||
$val['link'] = $val[0];
|
||||
$val['caption'] = $val['2'];
|
||||
$val['perms'] = $val['4'];
|
||||
$array_functions_assoc[$key] = $val;
|
||||
}
|
||||
return $array_functions_assoc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php');
|
||||
@@ -335,21 +355,16 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
|
||||
if ($eplug_conffile)
|
||||
{
|
||||
$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
|
||||
if ($iconSize == E_16_PLUGMANAGER)
|
||||
{
|
||||
$plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='".e_PLUGIN.$eplug_icon_small."' alt='' />" : E_16_PLUGIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin_icon = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN;
|
||||
}
|
||||
$plugin_array[$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
|
||||
$plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='".e_PLUGIN.$eplug_icon_small."' alt='' />" : E_16_PLUGIN;
|
||||
$plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN;
|
||||
|
||||
$plugin_array['p-'.$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32);
|
||||
}
|
||||
unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small);
|
||||
}
|
||||
}
|
||||
|
||||
ksort($plugin_array, SORT_STRING);
|
||||
ksort($plugin_array, SORT_STRING); // To FIX, without changing the current key format, sort by 'title'
|
||||
|
||||
if($linkStyle == "array")
|
||||
{
|
||||
@@ -358,7 +373,8 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
|
||||
|
||||
foreach ($plugin_array as $plug_key => $plug_value)
|
||||
{
|
||||
$text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], $linkStyle);
|
||||
$the_icon = ($iconSize == E_16_PLUGMANAGER) ? $plug_value['icon'] : $plug_value['icon_32'];
|
||||
$text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $the_icon, $linkStyle);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/infopanel.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2009-07-04 03:08:03 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-07-04 13:36:15 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -24,6 +24,13 @@ $emessage = &eMessage::getInstance();
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$frm = new e_form(true); //enable inner tabindex counter
|
||||
|
||||
if(isset($_POST['submit-mye107']))
|
||||
{
|
||||
$user_pref['core-infopanel-mye107'] = $_POST['e-mye107'];
|
||||
save_prefs('user');
|
||||
}
|
||||
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<div class='admintabs' id='tab-container'>
|
||||
<ul class='e-tabs e-hideme' id='core-emote-tabs'>
|
||||
@@ -54,16 +61,16 @@ attribute 5 = category
|
||||
attribute 6 = 16 x 16 image
|
||||
attribute 7 = 32 x 32 image
|
||||
*/
|
||||
$buts = "";
|
||||
/* $buts = "";
|
||||
|
||||
while (list($key, $funcinfo) = each($newarray))
|
||||
while (list($key, $funcinfo) = each($array_functions_assoc))
|
||||
{
|
||||
$iconlist[] = array("title"=>$funcinfo[1],"icon"=>$funcinfo[5]); // , $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
|
||||
$iconlist[$key] = array("title"=>$funcinfo[1],"icon"=>$funcinfo[5]); // , $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
|
||||
$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
|
||||
}
|
||||
}*/
|
||||
|
||||
$iconlist = array_merge($array_functions_assoc,getPluginLinks(E_16_PLUGMANAGER, "array"));
|
||||
|
||||
$pluglist = getPluginLinks(E_16_PLUGMANAGER, "array");
|
||||
|
||||
$text .= "
|
||||
|
||||
@@ -80,7 +87,15 @@ attribute 7 = 32 x 32 image
|
||||
|
||||
<div class='left' style='padding:25px'>";
|
||||
|
||||
$text .= getPluginLinks(E_32_PLUGMANAGER, "div");
|
||||
// Rendering the saved configuration.
|
||||
|
||||
foreach($iconlist as $key=>$val)
|
||||
{
|
||||
if(in_array($key,$user_pref['core-infopanel-mye107']))
|
||||
{
|
||||
$text .= render_links($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
|
||||
}
|
||||
}
|
||||
|
||||
$text .="<div class='clear'> </div>
|
||||
</div>
|
||||
@@ -182,24 +197,24 @@ $text .= "
|
||||
// Customizer ------------------------------------------
|
||||
|
||||
$text .= "
|
||||
<form method='post' action='".e_SELF."'>
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||
<div id='core-infopanel_customize' class='adminedit' >
|
||||
<div style='border:1px solid silver;margin:10px'>
|
||||
<div class='main_caption bevel left'><b>Customize your Admin Panel</b></div>
|
||||
<div class='block-text'>";
|
||||
|
||||
foreach($iconlist as $key=>$icon)
|
||||
{
|
||||
$checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE;
|
||||
$checked = (in_array($key,$user_pref['core-infopanel-mye107'])) ? TRUE : FALSE;
|
||||
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>
|
||||
".$icon['icon'].$frm->checkbox('e-columns[]', $key, $checked). $icon['title']."</div>";
|
||||
".$icon['icon'].$frm->checkbox('e-mye107[]',$key, $checked). $icon['title']."</div>";
|
||||
}
|
||||
|
||||
foreach($pluglist as $key=>$icon)
|
||||
{
|
||||
$checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE;
|
||||
$checked = (in_array('p-'.$key,$user_pref['core-infopanel-mye107'])) ? TRUE : FALSE;
|
||||
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>
|
||||
".$icon['icon'].$frm->checkbox('e-columns[]', $key, $checked). $icon['title']."</div>";
|
||||
|
||||
".$icon['icon'].$frm->checkbox('e-mye107[]', $key, $checked). $icon['title']."</div>";
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +223,7 @@ $text .= "
|
||||
</div>";
|
||||
$text .= "<div id='button' class='buttons-bar center'>"; // has issues with the checkboxes.
|
||||
$text .= $frm->admin_button('submit-mye107','Save','Save');
|
||||
$text .= " (TO-DO)</div>
|
||||
$text .= "</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* News Administration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||
* $Revision: 1.41 $
|
||||
* $Date: 2009-07-03 06:48:43 $
|
||||
* $Revision: 1.42 $
|
||||
* $Date: 2009-07-04 13:36:15 $
|
||||
* $Author: e107coders $
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
@@ -580,14 +580,14 @@ class admin_newspost
|
||||
|
||||
function _observe_saveColumns()
|
||||
{
|
||||
global $pref,$admin_log;
|
||||
$pref['admin_news_columns'] = $_POST['e-columns'];
|
||||
save_prefs();
|
||||
global $user_pref,$admin_log;
|
||||
$user_pref['admin_news_columns'] = $_POST['e-columns'];
|
||||
save_prefs('user');
|
||||
}
|
||||
|
||||
function show_existing_items()
|
||||
{
|
||||
global $pref,$gen;
|
||||
global $user_pref,$gen;
|
||||
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$frm = new e_form(true); //enable inner tabindex counter
|
||||
@@ -597,6 +597,10 @@ class admin_newspost
|
||||
$sort_link = $sort_order == 'asc' ? 'desc' : 'asc'; // Effectively toggle setting for headings
|
||||
$amount = 10;//TODO - pref
|
||||
|
||||
if(!is_array($user_pref['admin_news_columns']))
|
||||
{
|
||||
$user_pref['admin_news_columns'] = array("news_id","news_title","news_author","news_render_type");
|
||||
}
|
||||
|
||||
|
||||
$field_columns = $this->_fields;
|
||||
@@ -659,9 +663,9 @@ class admin_newspost
|
||||
<fieldset id='core-newspost-list'>
|
||||
<legend class='e-hideme'>".NWSLAN_4."</legend>
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
<colgroup span='".$field_count."'>".$frm->colGroup($field_columns,"admin_news_columns")."</colgroup>
|
||||
<colgroup span='".$field_count."'>".$frm->colGroup($this->_fields,$user_pref['admin_news_columns'])."</colgroup>
|
||||
<thead>
|
||||
<tr>".$frm->thead($field_columns,"admin_news_columns")."</tr>
|
||||
<tr>".$frm->thead($this->_fields,$user_pref['admin_news_columns'])."</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
";
|
||||
@@ -679,17 +683,17 @@ class admin_newspost
|
||||
|
||||
// Below must be in the same order as the field_columns above.
|
||||
|
||||
$text .= (in_array("news_id",$pref['admin_news_columns'])) ? "<td class='center'>".$row['news_id']."</td>\n" : "";
|
||||
$text .= (in_array("news_title",$pref['admin_news_columns'])) ? "<td><a href='".$e107->url->getUrl('core:news', 'main', "action=item&value1={$row['news_id']}&value2={$row['news_category']}")."'>".($row['news_title'] ? $e107->tp->toHTML($row['news_title'], false,"TITLE") : "[".NWSLAN_42."]")."</a></td> \n" : "";
|
||||
$text .= (in_array("news_author",$pref['admin_news_columns'])) ? "<td>".$author['user_name']."</td>\n" : "";
|
||||
$text .= (in_array("news_datestamp",$pref['admin_news_columns'])) ? "<td>".$gen->convert_date($row['news_datestamp'],'short')." </td>\n" : "";
|
||||
$text .= (in_array("news_category",$pref['admin_news_columns'])) ? "<td>".$news_category[$row['news_category']]." </td>\n" : "";
|
||||
$text .= (in_array("news_class",$pref['admin_news_columns'])) ? "<td class='nowrap'>".r_userclass_name($row['news_class'])." </td>\n" : "";
|
||||
$text .= (in_array("news_render_type",$pref['admin_news_columns'])) ? "<td class='center nowrap'>".$ren_type[$row['news_render_type']]."</td>\n" : "";
|
||||
$text .= (in_array("news_thumbnail",$pref['admin_news_columns'])) ? "<td class='center nowrap'>".$thumbnail."</td>\n" : "";
|
||||
$text .= (in_array("news_sticky",$pref['admin_news_columns'])) ? "<td class='center'>".$sticky."</td>\n" : "";
|
||||
$text .= (in_array("news_allow_comments",$pref['admin_news_columns'])) ? "<td class='center'>".$comments."</td>\n" : "";
|
||||
$text .= (in_array("news_comment_total",$pref['admin_news_columns'])) ? "<td class='center'>".$row['news_comment_total']."</td>\n" : "";
|
||||
$text .= (in_array("news_id",$user_pref['admin_news_columns'])) ? "<td class='center'>".$row['news_id']."</td>\n" : "";
|
||||
$text .= (in_array("news_title",$user_pref['admin_news_columns'])) ? "<td><a href='".$e107->url->getUrl('core:news', 'main', "action=item&value1={$row['news_id']}&value2={$row['news_category']}")."'>".($row['news_title'] ? $e107->tp->toHTML($row['news_title'], false,"TITLE") : "[".NWSLAN_42."]")."</a></td> \n" : "";
|
||||
$text .= (in_array("news_author",$user_pref['admin_news_columns'])) ? "<td>".$author['user_name']."</td>\n" : "";
|
||||
$text .= (in_array("news_datestamp",$user_pref['admin_news_columns'])) ? "<td>".$gen->convert_date($row['news_datestamp'],'short')." </td>\n" : "";
|
||||
$text .= (in_array("news_category",$user_pref['admin_news_columns'])) ? "<td>".$news_category[$row['news_category']]." </td>\n" : "";
|
||||
$text .= (in_array("news_class",$user_pref['admin_news_columns'])) ? "<td class='nowrap'>".r_userclass_name($row['news_class'])." </td>\n" : "";
|
||||
$text .= (in_array("news_render_type",$user_pref['admin_news_columns'])) ? "<td class='center nowrap'>".$ren_type[$row['news_render_type']]."</td>\n" : "";
|
||||
$text .= (in_array("news_thumbnail",$user_pref['admin_news_columns'])) ? "<td class='center nowrap'>".$thumbnail."</td>\n" : "";
|
||||
$text .= (in_array("news_sticky",$user_pref['admin_news_columns'])) ? "<td class='center'>".$sticky."</td>\n" : "";
|
||||
$text .= (in_array("news_allow_comments",$user_pref['admin_news_columns'])) ? "<td class='center'>".$comments."</td>\n" : "";
|
||||
$text .= (in_array("news_comment_total",$user_pref['admin_news_columns'])) ? "<td class='center'>".$row['news_comment_total']."</td>\n" : "";
|
||||
|
||||
$text .= "
|
||||
<td class='center'>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.26 $
|
||||
* $Date: 2009-07-03 06:48:43 $
|
||||
* $Revision: 1.27 $
|
||||
* $Date: 2009-07-04 13:36:15 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@@ -597,10 +597,10 @@ class e_form
|
||||
|
||||
function colGroup($fieldarray,$columnPref='')
|
||||
{
|
||||
global $pref;
|
||||
|
||||
foreach($fieldarray as $key=>$val)
|
||||
{
|
||||
if(in_array($key,$pref[$columnPref]))
|
||||
if(in_array($key,$columnPref))
|
||||
{
|
||||
$text .= "\n<col style='width: ".$val['width']."'></col>";
|
||||
}
|
||||
@@ -610,16 +610,16 @@ class e_form
|
||||
|
||||
function thead($fieldarray,$columnPref='')
|
||||
{
|
||||
global $pref;
|
||||
|
||||
foreach($fieldarray as $key=>$val)
|
||||
{
|
||||
if(in_array($key,$pref[$columnPref]) || $key == "options")
|
||||
if(in_array($key,$columnPref) || $key == "options")
|
||||
{
|
||||
$cl = ($val['thclass']) ? "class='".$val['thclass']."'" : "";
|
||||
$text .= "\n\t<th id='$key' {$cl}>";
|
||||
$text .= ($val['url']) ? "<a href='".$val['url']."'>" : "";
|
||||
$text .= $val['title'];
|
||||
$text .= ($key == "options") ? $this->columnSelector($fieldarray,$pref[$columnPref]) : "";
|
||||
$text .= ($key == "options") ? $this->columnSelector($fieldarray,$columnPref) : "";
|
||||
|
||||
$text .= ($val['url']) ? "</a>" : "";
|
||||
$text .= "</th>";
|
||||
|
@@ -731,7 +731,7 @@ ul.plugin-navigation ul.plugin-navigation-sub a.link-active {font-weight: bold;}
|
||||
|
||||
/***** Admin Main Panel Buttons **/
|
||||
|
||||
.core-mainpanel-block { text-align:center; width:100px; float:left; height:48px; display:block }
|
||||
.core-mainpanel-block { text-align:center; width:100px; float:left; height:48px; display:block;margin:15px; }
|
||||
.core-mainpanel-link-text { font-weight:bold; text-decoration: none; padding:3px }
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user