/** * Processes the template and assigns common variables automatically. * * @access private */ function processTemplate() { global $HTTP_SERVER_VARS; // determine the correct CSS file to use if (ereg('MSIE ([0-9].[0-9]{1,2})', @$HTTP_SERVER_VARS["HTTP_USER_AGENT"], $log_version)) { $user_agent = 'ie'; } else { $user_agent = 'other'; } $this->assign("user_agent", $user_agent); // create the list of projects $usr_id = Auth::getUserID(); if ($usr_id != '') { $prj_id = Auth::getCurrentProject(); if (!empty($prj_id)) { $role_id = User::getRoleByUser($usr_id, $prj_id); $this->assign("current_project", $prj_id); $this->assign("current_project_name", Auth::getCurrentProjectName()); $has_customer_integration = Customer::hasCustomerIntegration($prj_id); $this->assign("has_customer_integration", $has_customer_integration); if ($has_customer_integration) { $this->assign("customer_backend_name", Customer::getBackendImplementationName($prj_id)); } if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { $this->assign("show_admin_link", true); } if ($role_id > 0) { $this->assign("current_role", (int) $role_id); $this->assign("current_role_name", User::getRole($role_id)); } } $info = User::getNameEmail($usr_id); $this->assign("active_projects", Project::getAssocList($usr_id)); $this->assign("current_full_name", $info["usr_full_name"]); $this->assign("current_email", $info["usr_email"]); $this->assign("current_user_id", $usr_id); $this->assign("is_current_user_clocked_in", User::isClockedIn($usr_id)); $this->assign("roles", User::getAssocRoleIDs()); } $this->assign("app_setup", Setup::load()); $this->assign("app_setup_path", APP_SETUP_PATH); $this->assign("app_setup_file", APP_SETUP_FILE); $this->assign("application_version", APP_VERSION); $this->assign("application_title", APP_NAME); $this->assign("app_base_url", APP_BASE_URL); $this->assign("rel_url", APP_RELATIVE_URL); $this->assign("lang", APP_CURRENT_LANG); $this->assign("SID", SID); // now for the browser detection stuff Net_UserAgent_Detect::detect(); $this->assign("browser", Net_UserAgent_Detect::_getStaticProperty('browser')); $this->assign("os", Net_UserAgent_Detect::_getStaticProperty('os')); // this is only used by the textarea resize script $js_script_name = str_replace('/', '_', str_replace('.php', '', $HTTP_SERVER_VARS['PHP_SELF'])); $this->assign("js_script_name", $js_script_name); $this->assign("total_queries", $GLOBALS['TOTAL_QUERIES']); $this->assign(array("cell_color" => APP_CELL_COLOR, "light_color" => APP_LIGHT_COLOR, "middle_color" => APP_MIDDLE_COLOR, "dark_color" => APP_DARK_COLOR, "cycle" => APP_CYCLE_COLORS, "internal_color" => APP_INTERNAL_COLOR)); }
/** * Return the user agent string that is being worked on * * @access public * @return string user agent */ function getUserAgent() { Net_UserAgent_Detect::detect(); $userAgent =& Net_UserAgent_Detect::_getStaticProperty('userAgent'); return $userAgent; }
/** * @return array */ private function detectClient() { require_once dirname(dirname(__FILE__)) . '/libraries/pear_net_useragent_detect.php'; Net_UserAgent_Detect::detect(); if (P4A_FORCE_HANDHELD_RENDERING) { $this->browser = self::BROWSER_HANDHELD; } elseif (Net_UserAgent_Detect::isIE()) { $this->browser = self::BROWSER_IE; } elseif (Net_UserAgent_Detect::isBrowser('gecko')) { $this->browser = self::BROWSER_GECKO; } elseif (Net_UserAgent_Detect::isBrowser('safari')) { $this->browser = self::BROWSER_SAFARI; } elseif (Net_UserAgent_Detect::isBrowser('opera')) { $this->browser = self::BROWSER_OPERA; } else { $this->browser = self::BROWSER_HANDHELD; } foreach (Net_UserAgent_Detect::_getStaticProperty('os') as $os => $detected) { if ($detected) { if (preg_match("/^win.*\$/", $os)) { $this->browser_os = self::BROWSER_WINDOWS; } elseif (preg_match("/^mac.*\$/", $os)) { $this->browser_os = self::BROWSER_MAC; } break; } } return Net_UserAgent_Detect::_getStaticProperty('browser'); }