X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Ffile_prefs.php;h=e4128326f0cac98a183061acd01421b56800cf90;hb=42f0f34b09b1bc35d17572de33aec119bbd665b7;hp=86fda6224e4e3214b0f8d73401551003c4aa9c60;hpb=c4f324859fb1df21649807b6e0792453927c8e36;p=squirrelmail.git diff --git a/functions/file_prefs.php b/functions/file_prefs.php index 86fda622..e4128326 100644 --- a/functions/file_prefs.php +++ b/functions/file_prefs.php @@ -3,15 +3,16 @@ /** * file_prefs.php * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 1999-2004 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This contains functions for manipulating user preferences in files * * $Id$ + * @package squirrelmail */ -/* include this for error messages */ +/** include this for error messages */ include_once(SM_PATH . 'functions/display_messages.php'); /** @@ -119,7 +120,7 @@ function savePrefValues($data_dir, $username) { } foreach ($prefs_cache as $Key => $Value) { if (isset($Value)) { - if ( @fwrite($file, $Key . '=' . $Value . "\n") === FALSE ) { + if ( sq_fwrite($file, $Key . '=' . $Value . "\n") === FALSE ) { logout_error( sprintf( _("Preference file, %s, could not be written. Contact your system administrator to resolve this issue.") , $filename . '.tmp') ); exit; } @@ -131,7 +132,7 @@ function savePrefValues($data_dir, $username) { exit; } @unlink($filename . '.tmp'); - chmod($filename, 0600); + @chmod($filename, 0600); sqsession_register($prefs_cache , 'prefs_cache'); } @@ -182,7 +183,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)) { @@ -223,7 +227,7 @@ function setSig($data_dir, $username, $number, $value) { logout_error( sprintf( _("Signature file, %s, could not be opened. Contact your system administrator to resolve this issue."), $filename . '.tmp') ); exit; } - if ( @fwrite($file, $value) === FALSE ) { + if ( sq_fwrite($file, $value) === FALSE ) { logout_error( sprintf( _("Signature file, %s, could not be written. Contact your system administrator to resolve this issue.") , $filename . '.tmp')); exit; } @@ -233,7 +237,7 @@ function setSig($data_dir, $username, $number, $value) { exit; } @unlink($filename . '.tmp'); - chmod($filename, 0600); + @chmod($filename, 0600); }