From: kink Date: Thu, 1 Jul 2004 11:54:24 +0000 (+0000) Subject: In stead of just crashing, give a proper error when PEAR DB functions could X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c9fcea568afbd85d0dc2978fb8e35ce8f50e56d7;p=squirrelmail.git In stead of just crashing, give a proper error when PEAR DB functions could not be included. Also, from now on I will add a vim comment to the foot of each file I commit to make sure everyone that edits the file with vim will automatically use the correct 4-spaces-indentation. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7713 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/ChangeLog b/ChangeLog index eb7b6c42..5a1f8eef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,7 @@ Version 1.5.1 -- CVS - Fixed XSS vulnerability in content-type display in the attachment area of read_body.php discovered by Roman Medina. - Get alternating row colors of addressbook in sync with mailbox list. + - Give proper error when PEAR DB not found. Version 1.5.0 -------------------- diff --git a/functions/abook_database.php b/functions/abook_database.php index 94a9180e..f7b79a38 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -33,7 +33,13 @@ */ /** Needs the DB functions */ -require_once('DB.php'); +if (!include_once('DB.php')) { + // same error also in db_prefs.php + require_once(SM_PATH . 'functions/display_messages.php'); + $error = _("Could not include PEAR database functions required for the database backend.") . "
\n"; + $error .= _("Please contact your system administrator and report this error."); + error_box($error, $color); +} /** * Undocumented class - stores the addressbook in a sql database @@ -345,4 +351,6 @@ class abook_database extends addressbook_backend { } } /* End of class abook_database */ + +// vim: et ts=4 ?> diff --git a/functions/db_prefs.php b/functions/db_prefs.php index e9493aea..981177b8 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -36,8 +36,14 @@ define('SMDB_MYSQL', 1); /** PostgreSQL */ define('SMDB_PGSQL', 2); -require_once('DB.php'); require_once(SM_PATH . 'config/config.php'); +if (!include_once('DB.php')) { + // same error also in abook_database.php + require_once(SM_PATH . 'functions/display_messages.php'); + $error = _("Could not include PEAR database functions required for the database backend.") . "
\n"; + $error .= _("Please contact your system administrator and report this error."); + error_box($error, $color); +} global $prefs_are_cached, $prefs_cache; @@ -385,4 +391,5 @@ function getSig($data_dir, $username, $number) { return getPref($data_dir, $username, $key); } -?> \ No newline at end of file +// vim: et ts=4 +?>