From 55b7acfe7bed00a98deba5cbe2e1c0268d35cb71 Mon Sep 17 00:00:00 2001 From: e107steved Date: Thu, 30 Apr 2009 20:10:10 +0000 Subject: [PATCH] Bug fixes to class tree calculation --- e107_handlers/userclass_class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index 82580e207..29b1e6ef3 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $ -| $Revision: 1.31 $ -| $Date: 2009-02-01 15:18:30 $ +| $Revision: 1.32 $ +| $Date: 2009-04-30 20:10:10 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -888,6 +888,7 @@ class user_class_admin extends user_class $this->topdown_tree($parent); return; } +// echo "Bottom up: {$parent}
"; if ($this->class_tree[$parent]['userclass_type'] == UC_TYPE_GROUP) { // echo "Bottom up - skip: {$parent}
"; @@ -911,9 +912,10 @@ class user_class_admin extends user_class // Returns an array function topdown_tree($our_class) { +// echo "Top down: {$our_class}, Children: ".implode(',',$this->class_tree[$our_class]['class_children'])."
"; $rights = array($our_class); // Accumulator always has rights to its own class - if ($this->class_tree[$cc] = UC_TYPE_GROUP) return $rights; // Stop rights accumulation at a group + if ($this->class_tree[$our_class]['userclass_type'] == UC_TYPE_GROUP) return array_merge($rights, explode(',',$this->class_tree[$our_class]['userclass_accum'])); // Stop rights accumulation at a group foreach ($this->class_tree[$our_class]['class_children'] as $cc) { @@ -921,10 +923,11 @@ class user_class_admin extends user_class } $rights = array_unique($rights); $imp_rights = implode(',',$rights); +// echo "Class: {$our_class} Rights: {$imp_rights}
"; if ($this->class_tree[$our_class]['userclass_accum'] != $imp_rights) { - $this->class_tree[$our_class]['userclass_accum'] = $imp_rights; - $this->class_tree[$our_class]['change_flag'] = 'UPDATE'; + $this->class_tree[$our_class]['userclass_accum'] = $imp_rights; + $this->class_tree[$our_class]['change_flag'] = 'UPDATE'; } return $rights; } @@ -1026,7 +1029,7 @@ class user_class_admin extends user_class { $name_line .= $this->class_tree[$listnum]['userclass_name']; } - if ($this->graph_debug) $name_line .= "[vis:".$this->class_tree[$listnum]['userclass_visibility'].", edit:".$this->class_tree[$listnum]['userclass_editclass']."] = ".$this->class_tree[$listnum]['userclass_accum']; + if ($this->graph_debug) $name_line .= "[vis:".$this->class_tree[$listnum]['userclass_visibility'].", edit:".$this->class_tree[$listnum]['userclass_editclass']."] = ".$this->class_tree[$listnum]['userclass_accum']." Children: ".implode(',',$this->class_tree[$listnum]['class_children']); // Next (commented out) line gives a 'conventional' link $ret .= "class icon".$name_line.""; // $ret .= "class icon".$this->class_tree[$listnum]['userclass_name']."";