removed $session from glabal because it was messing up the comp_in_new
[squirrelmail.git] / include / load_prefs.php
index afc711a5e5d907303dfbec017cc36043fc25cf38..7e097a3a0e0277153906d9c63d734706f887bdae 100644 (file)
@@ -18,7 +18,7 @@ require_once(SM_PATH . 'functions/prefs.php');
 require_once(SM_PATH . 'functions/plugin.php');
 require_once(SM_PATH . 'functions/constants.php');
 
-$username = ( !isset($username) ? '' : $username );
+$username = ( !isset($_SESSION['username']) ? '' : $_SESSION['username'] );
 
 $custom_css = getPref($data_dir, $username, 'custom_css', 'none' );
 
@@ -27,6 +27,10 @@ $color = ( !isset($color) ? array() : $color );
 
 $chosen_theme = getPref($data_dir, $username, 'chosen_theme');
 $found_theme = false;
+
+/* need to adjust $chosen_theme path with SM_PATH */
+$chosen_theme = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme);
+
 for ($i = 0; $i < count($theme); ++$i){
     if ($theme[$i]['PATH'] == $chosen_theme) {
         $found_theme = true;
@@ -63,8 +67,9 @@ if (isset($chosen_theme) && $found_theme && (file_exists($chosen_theme))) {
     }
 }
 
+
 if (!defined('download_php')) { 
-    session_register('theme_css'); 
+    sqsession_register($theme_css, 'theme_css'); 
 }
 
 $use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);