]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - index.php
Refactored new sections code to proper classes and added notice link to links in...
[quix0rs-gnu-social.git] / index.php
index 03c044415dc2f31e6178afded3236ec92efbad18..1b4fbf81baf8ceb5f3cc63241e7323ef554c9509 100644 (file)
--- a/index.php
+++ b/index.php
@@ -63,7 +63,19 @@ function handleError($error)
 
 function main()
 {
-    global $user, $action;
+    // quick check for fancy URL auto-detection support in installer.
+    if (isset($_SERVER['REDIRECT_URL']) && ('/check-fancy' === $_SERVER['REDIRECT_URL'])) {
+        die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs.");
+    }
+    global $user, $action, $config;
+
+    if (!_have_config()) {
+        $msg = sprintf(_("No configuration file found. Try running ".
+                         "the installation program first."));
+        $sac = new ServerErrorAction($msg);
+        $sac->showPage();
+        return;
+    }
 
     // For database errors
 
@@ -120,14 +132,14 @@ function main()
 
         // XXX: find somewhere for this little block to live
 
-        if (common_config('db', 'mirror') && $action_obj->isReadOnly()) {
+        if (common_config('db', 'mirror') && $action_obj->isReadOnly($args)) {
             if (is_array(common_config('db', 'mirror'))) {
                 // "load balancing", ha ha
-                $k = array_rand($config['db']['mirror']);
-
-                $mirror = $config['db']['mirror'][$k];
+                $arr = common_config('db', 'mirror');
+                $k = array_rand($arr);
+                $mirror = $arr[$k];
             } else {
-                $mirror = $config['db']['mirror'];
+                $mirror = common_config('db', 'mirror');
             }
             $config['db']['database'] = $mirror;
         }