function getgroupname($group_id, $return_desc = FALSE) { global $locale, $groups_cache; if ($group_id == "0") { return $locale['user0']; } elseif ($group_id == "101") { return $locale['user1']; exit; } elseif ($group_id == "102") { return $locale['user2']; exit; } elseif ($group_id == "103") { return $locale['user3']; exit; } else { if (!$groups_cache) { cache_groups(); } if (is_array($groups_cache) && count($groups_cache)) { foreach ($groups_cache as $group) { if ($group_id == $group['group_id']) { return $return_desc ? $group['group_description'] ? $group['group_description'] : '-' : $group['group_name']; exit; } } } } return $locale['user_na']; }
private function renderAdminOptions() { global $locale, $aidlink, $userdata; $groups_cache = cache_groups(); $user_groups_opts = ""; if (iADMIN && checkrights("UG") && isset($_GET['lookup']) && $_GET['lookup'] != $userdata['user_id']) { if (isset($_POST['add_to_group']) && (isset($_POST['user_group']) && isnum($_POST['user_group']))) { if (!preg_match("(^\\.{$_POST['user_group']}\$|\\.{$_POST['user_group']}\\.|\\.{$_POST['user_group']}\$)", $this->userData['user_groups'])) { $result = dbquery("UPDATE " . DB_USERS . " SET user_groups='" . $this->userData['user_groups'] . "." . $_POST['user_group'] . "' WHERE user_id='" . $_GET['lookup'] . "'"); } if (isset($_GET['step']) && $_GET['step'] == "view") { redirect(ADMIN . "members.php" . $aidlink . "&step=view&user_id=" . $this->userData['user_id']); } else { redirect(BASEDIR . "profile.php?lookup=" . $_GET['lookup']); } } } $html = ""; $html .= "<div class='row'>\n"; $html .= "<div class='col-xs-12 col-sm-3'>\n"; $html .= form_para($locale['u058'], "admin_options"); $html .= "</div>\n<div class='col-xs-12 col-sm-9 p-l-5'>\n"; $html .= "<div class='well'>\n"; $html .= "<div class='btn-group m-l-10 m-b-20'>\n<!--profile_admin_options-->\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&step=edit&user_id=" . $this->userData['user_id'] . "'>" . $locale['u069'] . "</a>\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&action=1&user_id=" . $this->userData['user_id'] . "'>" . $locale['u070'] . "</a>\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&action=3&user_id=" . $this->userData['user_id'] . "'>" . $locale['u071'] . "</a>\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&step=delete&status=0&user_id=" . $this->userData['user_id'] . "' onclick=\"return confirm('" . $locale['u073'] . "');\">" . $locale['u072'] . "</a>\n"; $html .= "</div>\n"; if (count($groups_cache) > 0) { foreach ($groups_cache as $group) { if (!preg_match("(^{$group['group_id']}|\\.{$group['group_id']}\\.|\\.{$group['group_id']}\$)", $this->userData['user_groups'])) { $user_groups_opts[$group['group_id']] = $group['group_name']; //"<option value='".$group['group_id']."'>".$group['group_name']."</option>\n"; } } if (iADMIN && checkrights("UG") && $user_groups_opts) { $submit_link = FUSION_SELF . "?lookup=" . $this->userData['user_id']; if (isset($_GET['step']) && $_GET['step'] == "view") { $submit_link = ADMIN . "members.php" . $aidlink . "&step=view&user_id=" . $this->userData['user_id'] . "&lookup=" . $this->userData['user_id']; } $html .= openform("admin_form", "post", $submit_link, array("class" => "p-l-10")); $html .= form_select("user_group", $locale['u061'], "", array("options" => $user_groups_opts, "inline" => TRUE, "class" => "m-b-10")); $html .= form_button("add_to_group", $locale['u059'], $locale['u059']); $html .= closeform(); } } $html .= "</div>\n</div>\n</div>\n"; return $html; }
private function renderAdminOptions() { global $locale, $groups_cache, $aidlink; if (!$groups_cache) { cache_groups(); } $user_groups_opts = ""; $this->html .= "<div style='margin:5px'></div>\n"; $this->html .= "<form name='admin_form' method='post' action='" . FUSION_SELF . "?lookup=" . $this->userData['user_id'] . "'>\n"; $this->html .= "<table cellpadding='0' cellspacing='0' class='table table-responsive profile tbl-border center'>\n<tr>\n"; $this->html .= "<td class='tbl2' colspan='2'><strong>" . $locale['u058'] . "</strong></td>\n"; $this->html .= "</tr>\n<tr>\n"; $this->html .= "<td class='tbl1'><!--profile_admin_options-->\n"; $this->html .= "<a href='" . ADMIN . "members.php" . $aidlink . "&step=edit&user_id=" . $this->userData['user_id'] . "'>" . $locale['u069'] . "</a> ::\n"; $this->html .= "<a href='" . ADMIN . "members.php" . $aidlink . "&action=1&user_id=" . $this->userData['user_id'] . "'>" . $locale['u070'] . "</a> ::\n"; $this->html .= "<a href='" . ADMIN . "members.php" . $aidlink . "&action=3&user_id=" . $this->userData['user_id'] . "'>" . $locale['u071'] . "</a> ::\n"; $this->html .= "<a href='" . ADMIN . "members.php" . $aidlink . "&step=delete&status=0&user_id=" . $this->userData['user_id'] . "' onclick=\"return confirm('" . $locale['u073'] . "');\">" . $locale['u072'] . "</a>\n"; $this->html .= "</td>\n"; if (count($groups_cache) > 0) { foreach ($groups_cache as $group) { if (!preg_match("(^{$group['group_id']}|\\.{$group['group_id']}\\.|\\.{$group['group_id']}\$)", $this->userData['user_groups'])) { $user_groups_opts .= "<option value='" . $group['group_id'] . "'>" . $group['group_name'] . "</option>\n"; } } if (iADMIN && checkrights("UG") && $user_groups_opts) { $this->html .= "<td align='right' class='tbl1'>" . $locale['u061'] . ":\n"; $this->html .= "<select name='user_group' class='textbox' style='width:100px'>\n" . $user_groups_opts . "</select>\n"; $this->html .= "<input type='submit' name='add_to_group' value='" . $locale['u059'] . "' class='button' onclick=\"return confirm('" . $locale['u060'] . "');\" />\n"; $this->html .= "</td>\n"; } } $this->html .= "</tr>\n</table>\n</form>\n"; }
/** * Get the name of the access level or user group * @global array $locale * @param int $group_id * @param boolean $return_desc If TRUE, group_description will be returned instead of group_name * @return array */ function getgroupname($group_id, $return_desc = FALSE) { global $locale; $specials = array(0 => 'user0', -101 => 'user1', -102 => 'user2', -103 => 'user3'); if (isset($specials[$group_id])) { return $locale[$specials[$group_id]]; } $groups_cache = cache_groups(); foreach ($groups_cache as $group) { if ($group_id == $group['group_id']) { return $return_desc ? $group['group_description'] ?: '-' : $group['group_name']; } } return $locale['user_na']; }
function getgroupname($group_id, $return_desc = false) { global $locale, $groups_cache; if ($group_id == nGUEST) { return $locale['user0']; } elseif ($group_id == nMEMBER) { return $locale['user1']; exit; } elseif ($group_id == nMODERATOR) { return $locale['userf1']; exit; } elseif ($group_id == nADMIN) { return $locale['user2']; exit; } elseif ($group_id == nSUPERADMIN) { return $locale['user3']; exit; } elseif ($group_id == nONLYGUEST) { return $locale['user4']; exit; } else { if (!$groups_cache) { cache_groups(); } if (is_array($groups_cache) && count($groups_cache)) { foreach ($groups_cache as $group) { if ($group_id == $group['group_id']) { return $return_desc ? $group['group_description'] ? $group['group_description'] : '-' : $group['group_name']; exit; } } } } return "N/A"; }
function cache_device_groups($device) { // Return no conditions if the device is ignored or disabled. if ($device['ignore'] == 1 || $device['disabled'] == 1) { return array(); } $groups = cache_groups(); foreach ($groups['assoc'] as $assoc_key => $assoc) { if (match_device($device, $assoc['device_attribs'])) { $assoc['group_id']; $groups['group'][$assoc['group_id']]['assoc'][$assoc_key] = $groups['assoc'][$assoc_key]; $groups_new['group'][$assoc['group_id']] = $groups['group'][$assoc['group_id']]; } else { unset($groups['assoc'][$assoc_key]); } } return $groups_new; }