private static function __domain() { if (!is_array(self::$_parts)) { $config = cmsms()->GetConfig(); self::$_parts = parse_url($config['root_url']); } if (!isset(self::$_parts['host']) || self::$_parts['host'] == '') { self::$_parts['host'] = $config['root_url']; } return self::$_parts['host']; }
$lang = array(); #Check to see if there is already a language in use... if (isset($_POST["default_cms_lang"])) { $current_language = $_POST["default_cms_lang"]; if ($current_language == '') { cms_cookies::erase("cms_language"); } else { if (isset($_POST["change_cms_lang"])) { cms_cookies::set("cms_language", $_POST["change_cms_lang"]); } } } else { if (isset($_SESSION['login_cms_language'])) { debug_buffer('Setting language to: ' . $_SESSION['login_cms_language']); $current_language = $_SESSION['login_cms_language']; cms_cookies::set('cms_language', $_SESSION['login_cms_language']); unset($_SESSION['login_cms_language']); } else { if (isset($_COOKIE["cms_language"])) { $current_language = $_COOKIE["cms_language"]; } } } #First load the english one so that we have strings to fall back on $base_lang = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR; @(include $base_lang . 'en_US.php'); #Now load the real file if ($current_language != 'en_US') { $file = $base_lang . 'ext' . DIRECTORY_SEPARATOR . $current_language . '.php'; if (!is_file($file)) { $file = $base_lang . $current_language . '.php';
$error = lang('nofieldgiven', array(lang('password'))); $changepwhash = $_REQUEST['changepwhash']; } } } } } } if (isset($_SESSION['logout_user_now'])) { debug_buffer("Logging out. Cleaning cookies and session variables."); unset($_SESSION['logout_user_now']); unset($_SESSION['cms_admin_user_id']); unset($_SESSION[CMS_USER_KEY]); cms_cookies::erase('cms_admin_user_id'); cms_cookies::erase('cms_passhash'); cms_cookies::erase(CMS_SECURE_PARAM_NAME); } else { if (isset($_SESSION['redirect_url'])) { $_SESSION["t_redirect_url"] = $_SESSION["redirect_url"]; $no_redirect = true; $is_logged_in = check_login($no_redirect); $_SESSION["redirect_url"] = $_SESSION["t_redirect_url"]; unset($_SESSION["t_redirect_url"]); if (true == $is_logged_in) { $userid = get_userid(); $homepage = get_preference($userid, 'homepage' . 'index.php'); $homepage = str_replace('&', '&', $homepage); $tmp = explode('?', $homepage); if (!file_exists($tmp[0])) { $tmp[0] = 'index.php'; }
// HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); // Language shizzle header("Content-Type: {$content_type}; charset={$charset}"); } if (!isset($_SESSION[CMS_USER_KEY])) { if (isset($_COOKIE[CMS_SECURE_PARAM_NAME])) { $_SESSION[CMS_USER_KEY] = $_COOKIE[CMS_SECURE_PARAM_NAME]; } else { // maybe change this algorithm. $key = substr(str_shuffle(md5($dirname . time() . session_id())), -8); $_SESSION[CMS_USER_KEY] = $key; cms_cookies::set(CMS_SECURE_PARAM_NAME, $key); } } } # Create the global $gCms = cmsms(); #Grab the current configuration $config = $gCms->GetConfig(); #Set the timezone if ($config['timezone'] != '') { @date_default_timezone_set(trim($config['timezone'])); } #Attempt to override the php memory limit if (isset($config['php_memory_limit']) && !empty($config['php_memory_limit'])) { ini_set('memory_limit', trim($config['php_memory_limit'])); }
/** * Regenerates the user session information from a userid. This is basically used * so that if the session expires, but the cookie still remains (site is left along * for 20+ minutes with no interaction), the user won't have to relogin to regenerate * the details. * * @internal * @access private * @since 0.5 * @param integer The admin user id * @return void */ function generate_user_object($userid) { $gCms = cmsms(); $config = $gCms->GetConfig(); $userops =& $gCms->GetUserOperations(); $oneuser =& $userops->LoadUserByID($userid); if ($oneuser) { $_SESSION['cms_admin_user_id'] = $userid; $_SESSION['cms_admin_username'] = $oneuser->username; cms_cookies::set('cms_admin_user_id', $oneuser->id); cms_cookies::set('cms_passhash', md5(md5($config['root_path'] . '--' . $oneuser->password))); } }
public static function get_device_capabilities() { $mod = \cms_utils::get_module(MOD_CGSMARTIMAGE); if ($mod->GetPreference('responsive')) { $cookie_enc = cms_cookies::get(cgsi_utils::get_responsive_cookiename()); if ($cookie_enc) { $data = json_decode($cookie_enc, TRUE); return $data; } } }
/** * Regenerates the user session information from a userid. This is basically used * so that if the session expires, but the cookie still remains (site is left along * for 20+ minutes with no interaction), the user won't have to relogin to regenerate * the details. * * @internal * @access private * @since 0.5 * @param integer The admin user id * @return void */ function generate_user_object($userid) { $gCms = cmsms(); $config = $gCms->GetConfig(); $userops = $gCms->GetUserOperations(); $oneuser = $userops->LoadUserByID($userid); if ($oneuser) { $_SESSION['cms_admin_user_id'] = $userid; $_SESSION['cms_admin_username'] = $oneuser->username; cms_cookies::set('cms_admin_user_id', $oneuser->id); $tmp = array(md5(__FILE__), $oneuser->password, cms_utils::get_real_ip(), $_SERVER['HTTP_USER_AGENT']); $tmp = md5(serialize($tmp)); cms_cookies::set('cms_passhash', $tmp); } }