mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
userclass bug fixes
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $
|
||||||
| $Revision: 1.9 $
|
| $Revision: 1.10 $
|
||||||
| $Date: 2008-01-19 21:01:59 $
|
| $Date: 2008-02-16 12:03:26 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -27,8 +27,8 @@ $e_sub_cat = 'userclass';
|
|||||||
//define('UC_DEBUG_OPTS',FALSE);
|
//define('UC_DEBUG_OPTS',FALSE);
|
||||||
require_once("auth.php");
|
require_once("auth.php");
|
||||||
require_once(e_HANDLER."userclass_class.php"); // Modified class handler
|
require_once(e_HANDLER."userclass_class.php"); // Modified class handler
|
||||||
$uclass = new e_userclass; // Class management functions - legacy stuff from 0.7
|
$uclass = new e_userclass; // Class management functions - legacy stuff from 0.7
|
||||||
$e_userclass = new user_class_admin; // Admin functions - should just obliterate any previous object created in class2.php
|
$e_userclass = new user_class_admin; // Admin functions - should just obliterate any previous object created in class2.php
|
||||||
|
|
||||||
|
|
||||||
$message = '';
|
$message = '';
|
||||||
@@ -348,7 +348,7 @@ switch ($action)
|
|||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3'>".UCSLAN_35."</td>
|
<td class='forumheader3'>".UCSLAN_35."</td>
|
||||||
<td class='forumheader3'>";
|
<td class='forumheader3'>";
|
||||||
$text .= "<select name='userclass_parent' class='tbox'>".$e_userclass->vetted_tree('userclass_parent',array($e_userclass,'select'), $userclass_parent,"main,admin,classes,matchclass,public,member").'</select>';
|
$text .= "<select name='userclass_parent' class='tbox'>".$e_userclass->vetted_tree('userclass_parent',array($e_userclass,'select'), $userclass_parent,"main,admin,classes,matchclass,member").'</select>';
|
||||||
// .r_userclass("userclass_parent", $userclass_parent, "off", "admin,classes,matchclass,public,member").
|
// .r_userclass("userclass_parent", $userclass_parent, "off", "admin,classes,matchclass,public,member").
|
||||||
$text .= "</td>
|
$text .= "</td>
|
||||||
<td class='forumheader3'>".UCSLAN_36."</td>
|
<td class='forumheader3'>".UCSLAN_36."</td>
|
||||||
@@ -824,11 +824,11 @@ if(isset($_POST['class_members_edit']))
|
|||||||
$ns->tablerender('Multiple Select box with nested items', $text);
|
$ns->tablerender('Multiple Select box with nested items', $text);
|
||||||
|
|
||||||
$checked_class_list = implode(',',$_POST['classes_select']);
|
$checked_class_list = implode(',',$_POST['classes_select']);
|
||||||
$text = "<table width='95%'><tr><td style='text-align:left'>";
|
$text = "<table style='".ADMIN_WIDTH."'><tr><td style='text-align:left'>";
|
||||||
$text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), $checked_class_list);
|
$text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), $checked_class_list);
|
||||||
$text .= "Classes: ".$checked_class_list;
|
$text .= "Classes: ".$checked_class_list;
|
||||||
$text .= "</td><td style='text-align:left'>";
|
$text .= "</td><td style='text-align:left'>";
|
||||||
$text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), $e_userclass->normalise_classes($checked_class_list));
|
$text .= $e_userclass->vetted_tree('normalised_classes_select',array($e_userclass,'checkbox'), $e_userclass->normalise_classes($checked_class_list));
|
||||||
$text .= "Normalised Classes: ".$e_userclass->normalise_classes($checked_class_list);
|
$text .= "Normalised Classes: ".$e_userclass->normalise_classes($checked_class_list);
|
||||||
$text .= "</td></tr></table>";
|
$text .= "</td></tr></table>";
|
||||||
$ns->tablerender('Nested checkboxes, showing the effect of the normalise() routine', $text);
|
$ns->tablerender('Nested checkboxes, showing the effect of the normalise() routine', $text);
|
||||||
@@ -841,11 +841,10 @@ if(isset($_POST['class_members_edit']))
|
|||||||
$ns->tablerender('Click on the button - the settings above should be remembered, and the $_POST values displayed', $text);
|
$ns->tablerender('Click on the button - the settings above should be remembered, and the $_POST values displayed', $text);
|
||||||
break; // End of 'debug'
|
break; // End of 'debug'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // End - switch ($action)
|
} // End - switch ($action)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Log event to admin log
|
// Log event to admin log
|
||||||
function userclass2_adminlog($msg_num='00', $woffle='')
|
function userclass2_adminlog($msg_num='00', $woffle='')
|
||||||
{
|
{
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $
|
||||||
| $Revision: 1.11 $
|
| $Revision: 1.12 $
|
||||||
| $Date: 2008-01-13 17:47:27 $
|
| $Date: 2008-02-16 12:03:27 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -48,12 +48,11 @@ define('UC_ICON_DIR',e_IMAGE.'generic/'); // Directory for the icons used in th
|
|||||||
|
|
||||||
class user_class
|
class user_class
|
||||||
{
|
{
|
||||||
var $class_tree; // Simple array, filled with current tree. Additional field class_children is an array of child user classes (by ID)
|
var $class_tree; // Simple array, filled with current tree. Additional field class_children is an array of child user classes (by ID)
|
||||||
var $class_parents; // Array of class IDs of 'parent' (i.e. top level) classes
|
var $class_parents; // Array of class IDs of 'parent' (i.e. top level) classes
|
||||||
|
|
||||||
var $fixed_classes = array(); // The 'predefined' classes of 0.7
|
var $fixed_classes = array(); // The 'predefined' classes of 0.7
|
||||||
// List of 'core' user classes and the related constants
|
var $text_class_link = array(); // List of 'core' user classes and the related constants
|
||||||
var $text_class_link = array();
|
|
||||||
|
|
||||||
var $sql_r; // We'll use our own DB to avoid interactions
|
var $sql_r; // We'll use our own DB to avoid interactions
|
||||||
|
|
||||||
@@ -73,11 +72,10 @@ class user_class
|
|||||||
e_UC_READONLY => UC_LAN_4
|
e_UC_READONLY => UC_LAN_4
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER,
|
$this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER,
|
||||||
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'readonly' => e_UC_READONLY);
|
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'readonly' => e_UC_READONLY);
|
||||||
|
|
||||||
$this->read_tree(TRUE); // Initialise the classes on entry
|
$this->read_tree(TRUE); // Initialise the classes on entry
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,9 +120,9 @@ class user_class
|
|||||||
// Finally, add in any fixed classes that aren't already defined
|
// Finally, add in any fixed classes that aren't already defined
|
||||||
foreach ($this->fixed_classes as $c => $d)
|
foreach ($this->fixed_classes as $c => $d)
|
||||||
{
|
{
|
||||||
if (!isset($this->class_tree[$c]))
|
if (!isset($this->class_tree[$c]) && ($c != e_UC_PUBLIC))
|
||||||
{
|
{
|
||||||
$this->class_tree[$c]['userclass_parent'] = 0;
|
$this->class_tree[$c]['userclass_parent'] = ($c == e_UC_MEMBER) ? e_UC_PUBLIC : e_UC_MEMBER;
|
||||||
$this->class_tree[$c]['userclass_id'] = $c;
|
$this->class_tree[$c]['userclass_id'] = $c;
|
||||||
$this->class_tree[$c]['userclass_name'] = $d;
|
$this->class_tree[$c]['userclass_name'] = $d;
|
||||||
$this->class_tree[$c]['userclass_description'] = 'Fixed class';
|
$this->class_tree[$c]['userclass_description'] = 'Fixed class';
|
||||||
@@ -288,7 +286,8 @@ class user_class
|
|||||||
// Do the 'fixed' classes next
|
// Do the 'fixed' classes next
|
||||||
foreach ($this->text_class_link as $k => $v)
|
foreach ($this->text_class_link as $k => $v)
|
||||||
{
|
{
|
||||||
if (isset($opt_arr[$k]) || isset($opt_arr['force']))
|
// if (isset($opt_arr[$k]) || isset($opt_arr['force']))
|
||||||
|
if (isset($opt_arr[$k]))
|
||||||
{
|
{
|
||||||
$ret[$v] = $just_ids ? '1' : $this->fixed_classes[$v];
|
$ret[$v] = $just_ids ? '1' : $this->fixed_classes[$v];
|
||||||
}
|
}
|
||||||
@@ -442,7 +441,7 @@ class user_class
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$prefix = ' '.str_repeat('--',$nest_level).'>';
|
$prefix = ' '.str_repeat('--',$nest_level-1).'>';
|
||||||
$style = '';
|
$style = '';
|
||||||
}
|
}
|
||||||
return "<option value='{$classnum}'{$sel}{$style}>".$prefix.$this->class_tree[$classnum]['userclass_name']."</option>\n";
|
return "<option value='{$classnum}'{$sel}{$style}>".$prefix.$this->class_tree[$classnum]['userclass_name']."</option>\n";
|
||||||
@@ -672,8 +671,7 @@ class user_class_admin extends user_class
|
|||||||
'userclass_icon' => "varchar(250) NOT NULL default ''"
|
'userclass_icon' => "varchar(250) NOT NULL default ''"
|
||||||
); // Note - 'userclass_id' intentionally not in this list
|
); // Note - 'userclass_id' intentionally not in this list
|
||||||
|
|
||||||
var $fixed_list = array(e_UC_MAINADMIN, e_UC_MEMBER, e_UC_ADMIN, e_UC_ADMINMOD, e_UC_MODS, e_UC_READONLY); // Classes which can't be deleted
|
// var $fixed_list = array(e_UC_MAINADMIN, e_UC_MEMBER, e_UC_ADMIN, e_UC_ADMINMOD, e_UC_MODS, e_UC_READONLY); // Classes which can't be deleted
|
||||||
// var $fixed_list = array(e_UC_MAINADMIN, e_UC_MEMBER, e_UC_ADMIN, e_UC_ADMINMOD, e_UC_MODS, e_UC_USERS, e_UC_READONLY); // Classes which can't be deleted
|
|
||||||
|
|
||||||
// Icons to use for graphical tree display
|
// Icons to use for graphical tree display
|
||||||
// First index - no children, children
|
// First index - no children, children
|
||||||
@@ -931,7 +929,8 @@ class user_class_admin extends user_class
|
|||||||
|
|
||||||
function delete_class($class_id)
|
function delete_class($class_id)
|
||||||
{
|
{
|
||||||
if (in_array($class_id, $this->fixed_list)) return FALSE; // Some classes can't be deleted
|
// if (in_array($class_id, $this->fixed_list)) return FALSE; // Some classes can't be deleted
|
||||||
|
if (isset($this->fixed_classes[$class_id])) return FALSE; // Some classes can't be deleted
|
||||||
if (!isset($this->class_tree[$class_id])) return FALSE;
|
if (!isset($this->class_tree[$class_id])) return FALSE;
|
||||||
if (count($this->class_tree[$class_id]['class_children'])) return FALSE; // Can't delete class with descendants
|
if (count($this->class_tree[$class_id]['class_children'])) return FALSE; // Can't delete class with descendants
|
||||||
foreach ($this->class_tree as $c)
|
foreach ($this->class_tree as $c)
|
||||||
|
Reference in New Issue
Block a user