]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - index.php
Add translator documentation.
[quix0rs-gnu-social.git] / index.php
index c8d4fbee9b0f30a6e44325b2a6508cef02a377f8..850208c9d1501a80337a7a8d568a85aa88100527 100644 (file)
--- a/index.php
+++ b/index.php
@@ -106,27 +106,26 @@ function handleError($error)
             $_cur = null;
 
             $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.'
+                // TRANS: Database error message.
+                _('The database for %1$s is not responding correctly, '.
+                  'so the site will not work properly. '.
+                  'The site admins probably know about the problem, '.
+                  'but you can contact them at %2$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();
         } else {
-            $msg = _(
-                'An important error occured, probably related to email setup. '.
-                'Check logfiles for more info..'
-            );
+            $sac = new ServerErrorAction($error->getMessage(), 500, $error);
+            $sac->showPage();
         }
 
-        $dac = new DBErrorAction($msg, 500);
-        $dac->showPage();
-
     } catch (Exception $e) {
+        // TRANS: Error message.
         echo _('An error occurred.');
     }
     exit(-1);
@@ -174,15 +173,24 @@ function setupRW()
 
     static $alwaysRW = array('session', 'remember_me');
 
-    // We ensure that these tables always are used
-    // on the master DB
+    $rwdb = $config['db']['database'];
+
+    if (Event::handle('StartReadWriteTables', array(&$alwaysRW, &$rwdb))) {
 
-    $config['db']['database_rw'] = $config['db']['database'];
-    $config['db']['ini_rw'] = INSTALLDIR.'/classes/statusnet.ini';
+        // We ensure that these tables always are used
+        // on the master DB
 
-    foreach ($alwaysRW as $table) {
-        $config['db']['table_'.$table] = 'rw';
+        $config['db']['database_rw'] = $rwdb;
+        $config['db']['ini_rw'] = INSTALLDIR.'/classes/statusnet.ini';
+
+        foreach ($alwaysRW as $table) {
+            $config['db']['table_'.$table] = 'rw';
+        }
+
+        Event::handle('EndReadWriteTables', array($alwaysRW, $rwdb));
     }
+
+    return;
 }
 
 function checkMirror($action_obj, $args)
@@ -250,9 +258,9 @@ function main()
 
     if (!_have_config()) {
         $msg = sprintf(
-            _(
-                "No configuration file found. Try running ".
-                "the installation program first."
+            // TRANS: Error message displayed when there is no StatusNet configuration file.
+            _("No configuration file found. Try running ".
+              "the installation program first."
             )
         );
         $sac = new ServerErrorAction($msg);
@@ -281,6 +289,7 @@ function main()
     $args = $r->map($path);
 
     if (!$args) {
+        // TRANS: Error message displayed when trying to access a non-existing page.
         $cac = new ClientErrorAction(_('Unknown page'), 404);
         $cac->showPage();
         return;
@@ -335,6 +344,7 @@ function main()
     $action_class = ucfirst($action).'Action';
 
     if (!class_exists($action_class)) {
+        // TRANS: Error message displayed when trying to perform an undefined action.
         $cac = new ClientErrorAction(_('Unknown action'), 404);
         $cac->showPage();
     } else {