Happy New Year
[squirrelmail.git] / functions / file_prefs.php
index fb4f706d7586f7d2d0f6bb345dda81435b392b55..0869a0dc22687a909c638e9910e63f8b26c59857 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This contains functions for manipulating user preferences in files
  *
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2018 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -109,14 +109,17 @@ function cachePrefValues($data_dir, $username) {
 function getPref($data_dir, $username, $pref_name, $default = '') {
     global $prefs_cache;
 
-    $result = do_hook('get_pref_override', $temp=array(&$username, &$pref_name));
-    if (!$result) {
+    $temp = array(&$username, &$pref_name);
+    $result = do_hook('get_pref_override', $temp);
+    if (is_null($result)) {
         cachePrefValues($data_dir, $username);
         if (isset($prefs_cache[$pref_name])) {
             $result = $prefs_cache[$pref_name];
         } else {
-            $result = do_hook('get_pref', $temp=array(&$username, &$pref_name));
-            if (!$result) {
+//FIXME: is there a justification for having two prefs hooks so close?  who uses them?
+            $temp = array(&$username, &$pref_name);
+            $result = do_hook('get_pref', $temp);
+            if (is_null($result)) {
                 $result = $default;
             }
         }
@@ -255,14 +258,14 @@ function checkForPrefs($data_dir, $username, $filename = '') {
             ( is_readable($default_pref) && !@copy($default_pref, $filename) ) ||
             !@touch($filename)
         ) {
-            $uid = 'httpd';
+            $uid = 'that the web server is running as';
             if (function_exists('posix_getuid')){
                 $user_data = posix_getpwuid(posix_getuid());
                 $uid = $user_data['name'];
             }
             $errTitle = _("Could not create initial preference file!");
             $errString = $errTitle . "\n" .
-                       sprintf( _("%s should be writable by user %s."), $data_dir, $uid ) . "\n" .
+                       sprintf( _("%s should be writable by the user %s."), $data_dir, $uid ) . "\n" .
                        _("Please contact your system administrator and report this error.") ;
             logout_error( $errString, $errTitle );
             exit;