From 3ec364a47fc7fa5061df72a84123c7ded037a3a4 Mon Sep 17 00:00:00 2001 From: kink Date: Tue, 6 May 2008 14:58:49 +0000 Subject: [PATCH] Allow database based preferences to read in default settings from the default_pref file next to hardcoding them into the DB class, thanks Thierry Godefroy. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13093 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 4 +++- functions/db_prefs.php | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4a0ead58..b28d8877 100644 --- a/ChangeLog +++ b/ChangeLog @@ -244,7 +244,9 @@ Version 1.5.2 - SVN - Added "Secured Configuration" mode. - Added edit list, checkbox, radio group, multiple-select folder list and multiple-select string list option widget types. - + - Allow database based preferences to read in default settings from the + default_pref file next to hardcoding them into the DB class, thanks + Thierry Godefroy. Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/functions/db_prefs.php b/functions/db_prefs.php index 9756fc88..d7860697 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -164,6 +164,27 @@ class dbPrefs { + /** + * initialize the default preferences array. + * + */ + function dbPrefs() { + // Try and read the default preferences file. + $default_pref = SM_PATH . 'config/default_pref'; + if (@file_exists($default_pref)) { + if ($file = @fopen($default_pref, 'r')) { + while (!feof($file)) { + $pref = fgets($file, 1024); + $i = strpos($pref, '='); + if ($i > 0) { + $this->default[trim(substr($pref, 0, $i))] = trim(substr($pref, $i + 1)); + } + } + fclose($file); + } + } + } + /** * initialize DB connection object * -- 2.25.1