Changeset 1420 in ExiteCMS for trunk/includes/user_functions.php
- Timestamp:
- 05/30/08 21:41:54 (4 years ago)
- File:
-
- 1 edited
-
trunk/includes/user_functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/user_functions.php
r1401 r1420 250 250 } 251 251 252 // Check if user is assigned to the specified user group252 // Check if the current user is assigned to the specified user group 253 253 function checkgroup($group) { 254 254 if (iSUPERADMIN && ($group != "100")) { return true; } … … 262 262 return false; 263 263 } 264 } 265 266 // Check if a user is assigned to the specified user group 267 function checkusergroup($user_id, $group_id) { 268 global $db_prefix; 269 270 // every user is a member 271 if ($group_id == "101") { return true; } 272 // get the group rights from the user record 273 $result = dbquery("SELECT user_groups, user_level FROM ".$db_prefix."users WHERE user_id = '".$user_id."'"); 274 if ($data = dbarray($result)) { 275 // check if the requested group matches a user level 276 if ($group_id == $data['user_level']) { return true; } 277 // if group memberships are defined, get the users own group memberships into an array 278 if (!empty($data['user_groups'])) { 279 $groups = explode(".", substr($data['user_groups'], 1)); 280 foreach ($groups as $group) { 281 // check if this groups has subgroups. If so, add them to the array 282 getsubgroups($group); 283 } 284 // now that we have all groups, check for a match 285 foreach ($groups as $group) { 286 if ($group == $group_id) { return true; } 287 } 288 } 289 } 290 // user not found or no group match 291 return false; 264 292 } 265 293
Note: See TracChangeset
for help on using the changeset viewer.
