1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Tidy up (mostly comments)

This commit is contained in:
SteveD
2013-01-01 10:39:30 +00:00
parent 6f2ad44d0a
commit 6b6512b06b

View File

@@ -2,7 +2,7 @@
/*
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
@@ -386,7 +386,7 @@ class user_class
matchclass - if 'classes' is set, this option will only show the classes that the user is a member of
blank - puts an empty option at the top of select dropdowns
filter - only show those classes where member is in a class permitted to view them - e.g. as the new 'visible to' field - added for 0.8
filter - only show those classes where member is in a class permitted to view them - e.g. as the new 'visible to' field - added for 2.0
force - show all classes (subject to the other options, including matchclass) - added for 2.0
all - alias for 'force'
@@ -960,7 +960,7 @@ class user_class
$ret = array();
$classList = str_replace(' ','', $classList); // clean up white spaces
if ($includeAncestors) $classList = $this->get_all_user_classes($classList);
$class_regex = "(^|,)(".str_replace(",", "|", $classList).")(,|$)";
$class_regex = '(^|,)('.str_replace(',', '|', $classList).')(,|$)';
$qry = "SELECT user_id,{$fieldList} FROM `#user` WHERE user_class REGEXP '{$class_regex}' ORDER BY '{$orderBy}'";
if ($this->sql_r->db_Select_gen($qry))
{
@@ -974,33 +974,39 @@ class user_class
}
//========================================================================
// Functions from previous userclass_class handler
//========================================================================
// Implemented for backwards compatibility/convenience.
// ************** DEPRECATED - use new class-based functions
// Refer to the corresponding class-based functions for full details
/*
With $optlist you can now specify which classes are shown in the dropdown.
All or none can be included, separated by comma (or whatever).
Valid options are:
public
guest
nobody
member
readonly
admin
main - main admin
classes - shows all classes
matchclass - if 'classes' is set, this option will only show the classes that the user is a member of
filter - only show those classes where member is in a class permitted to view them - i.e. as the new 'visible to' field
force - show all classes (subject to the other options, including matchclass)
$mode = 'off' turns off listing of admin/main admin classes unless enabled in $optlist (can probably be deprecated - barely used)
/**========================================================================
* Functions from previous userclass_class handler
* ========================================================================
* Implemented for backwards compatibility/convenience.
* ************** DEPRECATED - use new class-based functions **************
*
* Functionality should be sufficiently similar to the original functions to not notice (and will
* be more consistent with the preferred class-based functions).
*
* Refer to the corresponding class-based functions for full details
*
* Consistent interface:
*
* @param string $fieldname - name to use for the element
* @param mixed $curval - current value of field - as CSV if multiple values
* @param string $mode = (off|admin...) - affects display -
* @param string $optlist - comma-separated list which specifies the classes to be shown:
* public
* guest
* nobody
* member
* readonly
* admin
* main - main admin
* classes - shows all classes
* matchclass - if 'classes' is set, this option will only show the classes that the user is a member of
*
* filter - only show those classes where member is in a class permitted to view them - i.e. as the new 'visible to' field
* force - show all classes (subject to the other options, including matchclass)
*
* $mode = 'off' turns off listing of admin/main admin classes unless enabled in $optlist (can probably be deprecated - barely used)
*
*/
@@ -1432,7 +1438,7 @@ class user_class_admin extends user_class
{
if (!isset($this->class_tree[$i])) return $i;
}
// Big system!! Assign a class in the 0.8-only block above 255
// Big system!! Assign a class in the 2.0-only block above 255
for ($i = e_UC_SPECIAL_END+1; ($i < 32767); $i++)
{
if (!isset($this->class_tree[$i])) return $i;
@@ -1476,7 +1482,7 @@ class user_class_admin extends user_class
/**
* Save class data after editing
* TODO: use new array function
*
* @param array $classrec - class data
* @return boolean TRUE on success, FALSE on failure
*
@@ -1590,7 +1596,7 @@ class user_class_admin extends user_class
/**
* Delete a class, and all users who are members of that class.
* Delete a class, and update class membership for all users who are members of that class.
* @param integer $classID > 0
* @return boolean TRUE on success, FALSE on error
*/
@@ -1600,7 +1606,7 @@ class user_class_admin extends user_class
{
if ($this->sql_r->db_Select('user', 'user_id, user_class', "user_class REGEXP '(^|,){$classID}(,|$)'"))
{
$sql2 = new db;
$sql2 = e107::getDb('sql2');
while ($row = $this->sql_r->db_Fetch())
{
$newClass = self::ucRemove($classID, $row['user_class']);