X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fdb_prefs.php;h=26c2ac2ef94a36bf87e08659f482b4e1fb986ab7;hb=aa201211dd345d2f21be5bbb02c074d6853d7846;hp=f116c83762f41fbfef8455fe1db6dea5cc9552ed;hpb=202bcbcc2b67c7c153db1b09b608b62beeba0496;p=squirrelmail.git diff --git a/functions/db_prefs.php b/functions/db_prefs.php index f116c837..26c2ac2e 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -39,16 +39,11 @@ define('SMDB_MYSQL', 1); /** PostgreSQL */ define('SMDB_PGSQL', 2); - -if (!include_once('DB.php')) { - // same error also in abook_database.php - $error = _("Could not include PEAR database functions required for the database backend.") . "
\n"; - $error .= sprintf(_("Is PEAR installed, and is the include path set correctly to find %s?"), - 'DB.php') . "
\n"; - $error .= _("Please contact your system administrator and report this error."); - error_box($error, $color); - exit; -} +/** + * don't display errors (no code execution in functions/*.php). + * will handle error in dbPrefs class. + */ +@include_once('DB.php'); global $prefs_are_cached, $prefs_cache; @@ -167,6 +162,16 @@ class dbPrefs { global $prefs_user_field, $prefs_key_field, $prefs_val_field; global $prefs_user_size, $prefs_key_size, $prefs_val_size; + /* test if Pear DB class is available and freak out if it is not */ + if (! class_exists('DB')) { + // same error also in abook_database.php + $this->error = _("Could not include PEAR database functions required for the database backend.") . "
\n"; + $this->error .= sprintf(_("Is PEAR installed, and is the include path set correctly to find %s?"), + 'DB.php') . "
\n"; + $this->error .= _("Please contact your system administrator and report this error."); + return false; + } + if(isset($this->dbh)) { return true; } @@ -538,4 +543,3 @@ function getSig($data_dir, $username, $number) { } // vim: et ts=4 -?> \ No newline at end of file