summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-02-11 19:56:59 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-02-11 19:56:59 +0000
commit87f243917d5e58478a32a58e9d6b3364a8e02912 (patch)
treefe24ea7d988e80e307ed7fdd5a87fca3bab937ce /index.php
parent21f6c911611fe9debfae9a4c123e91294bc877e3 (diff)
parentab37f84b5a2850e8f10b78a1a3781edb0981b7ca (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Diffstat (limited to 'index.php')
-rw-r--r--index.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/index.php b/index.php
index 717b17361..4db0e7555 100644
--- a/index.php
+++ b/index.php
@@ -25,7 +25,8 @@ require_once INSTALLDIR . '/lib/common.php';
$user = null;
$action = null;
-function getPath($req) {
+function getPath($req)
+{
if (common_config('site', 'fancy')) {
return $req['p'];
} else if ($_SERVER['PATH_INFO']) {
@@ -35,10 +36,30 @@ function getPath($req) {
}
}
-function main() {
+function handleError($error)
+{
+ common_log(LOG_ERR, "PEAR error: " . $error->getMessage());
+ $msg = sprintf(_('The database for %s isn\'t responding correctly, '.
+ 'so the site won\'t work properly. '.
+ 'The site admins probably know about the problem, '.
+ 'but you can contact them at %s to make sure. '.
+ 'Otherwise, wait a few minutes and try again.'),
+ common_config('site', 'name'),
+ common_config('site', 'email'));
+
+ $dac = new DBErrorAction($msg, 500);
+ $dac->showPage();
+ exit(-1);
+}
+function main()
+{
global $user, $action;
+ // For database errors
+
+ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleError');
+
// XXX: we need a little more structure in this script
// get and cache current user