X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=577b491ed05b677dc9480d27fd04cdafe4a7fa21;hb=717758563038e802976fbd5fcdede45804b82c51;hp=d5174c2b7e40254b18c8a2ec9226e3a3575787e2;hpb=0190785b73b52e2c6069c31542f578f812a5e0ab;p=quix0rs-gnu-social.git diff --git a/index.php b/index.php index d5174c2b7e..577b491ed0 100644 --- a/index.php +++ b/index.php @@ -18,18 +18,19 @@ * * @category StatusNet * @package StatusNet + * @author Brenda Wallace + * @author Christopher Vollick + * @author CiaranG + * @author Craig Andrews + * @author Evan Prodromou + * @author Gina Haeussge + * @author Jeffery To + * @author Mike Cochrane + * @author Robin Millette + * @author Sarven Capadisli + * @author Tom Adams + * * @license GNU Affero General Public License http://www.gnu.org/licenses/ - * @author Brenda Wallace - * @author Christopher Vollick - * @author CiaranG - * @author Craig Andrews - * @author Evan Prodromou - * @author Gina Haeussge - * @author Jeffery To - * @author Mike Cochrane - * @author Robin Millette - * @author Sarven Capadisli - * @author Tom Adams */ define('INSTALLDIR', dirname(__FILE__)); @@ -48,12 +49,23 @@ function getPath($req) ) { return $req['p']; } else if (array_key_exists('PATH_INFO', $_SERVER)) { - return $_SERVER['PATH_INFO']; + $path = $_SERVER['PATH_INFO']; + $script = $_SERVER['SCRIPT_NAME']; + if (substr($path, 0, mb_strlen($script)) == $script) { + return substr($path, mb_strlen($script)); + } else { + return $path; + } } else { return null; } } +/** + * logs and then displays error messages + * + * @return void + */ function handleError($error) { if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { @@ -131,7 +143,7 @@ function checkMirror($action_obj, $args) function isLoginAction($action) { - static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register'); + static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register', 'publicxrds'); $login = null; @@ -227,6 +239,7 @@ function main() if (!$user && common_config('site', 'private') && !isLoginAction($action) && !preg_match('/rss$/', $action) + && !preg_match('/^Api/', $action) ) { common_redirect(common_local_url('login')); return;