get_tabs($user); return $tabArray[0]; } function query_user_has_roles($user_id) { $role = new Role(); return $role->check_user_role_count($user_id); } function get_user_allowed_modules($user_id) { $role = new Role(); $allowed = $role->query_user_allowed_modules($user_id); return $allowed; } function get_user_disallowed_modules($user_id, &$allowed) { $role = new Role(); $disallowed = $role->query_user_disallowed_modules($user_id, $allowed); return $disallowed; } // grabs client ip address and returns its value function query_client_ip() { global $_SERVER; $clientIP = false; if(!empty($GLOBALS['sugar_config']['ip_variable']) && !empty($_SERVER[$GLOBALS['sugar_config']['ip_variable']])){ $clientIP = $_SERVER[$GLOBALS['sugar_config']['ip_variable']]; }else if(isset($_SERVER['HTTP_CLIENT_IP'])) { $clientIP = $_SERVER['HTTP_CLIENT_IP']; } elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) { // check for internal ips by looking at the first octet foreach($matches[0] AS $ip) { if(!preg_match("#^(10|172\.16|192\.168)\.#", $ip)) { $clientIP = $ip; break; } } } elseif(isset($_SERVER['HTTP_FROM'])) { $clientIP = $_SERVER['HTTP_FROM']; } else { $clientIP = $_SERVER['REMOTE_ADDR']; } return $clientIP; } // sets value to key value function get_val_array($arr){ $new = array(); if(!empty($arr)){ foreach($arr as $key=>$val){ $new[$key] = $key; } } return $new; }