off-by-one: when strlen == trim_at, we also don't want to print ...
[squirrelmail.git] / functions / file_prefs.php
index ed2face7dc678f2d44b1917eca37d4c77dddc780..5ed99124d85beb1d3cdb3d68d27c78a30f7d0f0b 100644 (file)
@@ -132,6 +132,7 @@ function savePrefValues($data_dir, $username) {
     }
     @unlink($filename . '.tmp');
     chmod($filename, 0600);
+    sqsession_register($prefs_cache , 'prefs_cache');
 }
 
 /**
@@ -181,7 +182,10 @@ function checkForPrefs($data_dir, $username, $filename = '') {
     /* Then, check if the file exists. */
     if (!@file_exists($filename) ) {
         /* First, check the $data_dir for the default preference file. */
-        $default_pref = $data_dir . '/default_pref';
+        if(substr($data_dir,-1) != '/') {
+            $data_dir .= '/';
+        }
+        $default_pref = $data_dir . 'default_pref';
 
         /* If it is not there, check the internal data directory. */
         if (!@file_exists($default_pref)) {