Esempio n. 1
0
 $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';
/**
 * 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)));
    }
}
Esempio n. 3
0
        // 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']));
}
Esempio n. 4
0
/**
 * 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);
    }
}