X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=index.php;h=e24bde9179fd884a220b05f26f170a06914b07b5;hb=3f44f94c3c3f0c3d46f5025854431f0d2825bb6c;hp=b180e2b653b285f2c54585d83d7558e170f7e74d;hpb=2e221f5718c783cdb6b85d53570115e3d63c42ff;p=quix0rs-gnu-social.git diff --git a/index.php b/index.php index b180e2b653..e24bde9179 100644 --- a/index.php +++ b/index.php @@ -27,12 +27,13 @@ $action = null; function getPath($req) { - if (common_config('site', 'fancy')) { + if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER)) + && array_key_exists('p', $req)) { return $req['p']; - } else if ($_SERVER['PATH_INFO']) { + } else if (array_key_exists('PATH_INFO', $_SERVER)) { return $_SERVER['PATH_INFO']; } else { - return $req['p']; + return null; } } @@ -42,7 +43,11 @@ function handleError($error) return; } - common_log(LOG_ERR, "PEAR error: " . $error->getMessage()); + $logmsg = "PEAR error: " . $error->getMessage(); + if(common_config('site', 'logdebug')) { + $logmsg .= " : ". $error->getDebugInfo(); + } + common_log(LOG_ERR, $logmsg); $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, '. @@ -58,7 +63,15 @@ function handleError($error) function main() { - global $user, $action; + 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 @@ -115,14 +128,14 @@ function main() // XXX: find somewhere for this little block to live - if ($config['db']['mirror'] && $action_obj->isReadOnly()) { - if (is_array($config['db']['mirror'])) { + 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; }