X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=644812bd55ac1c8b1549fd4446189266f3c121af;hb=2df11894651f26b668aaf0bfd9eb7430691ffecd;hp=b8d9c7c69dad2ceaf8ffbb61e24bdb0bf8b8ca44;hpb=87c59fe8734479046c8433f74787f615484b3df7;p=quix0rs-gnu-social.git diff --git a/index.php b/index.php index b8d9c7c69d..644812bd55 100644 --- a/index.php +++ b/index.php @@ -15,9 +15,21 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * + * * @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/ */ @@ -37,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) { @@ -60,7 +83,7 @@ function handleError($error) common_log(LOG_ERR, $line); } } - if ($error instanceof DB_DataObject_Error + if ($error instanceof DB_DataObject_Error || $error instanceof DB_Error ) { $msg = sprintf( @@ -213,8 +236,8 @@ function main() // If the site is private, and they're not on one of the "public" // parts of the site, redirect to login - if (!$user && common_config('site', 'private') - && !isLoginAction($action) + if (!$user && common_config('site', 'private') + && !isLoginAction($action) && !preg_match('/rss$/', $action) ) { common_redirect(common_local_url('login'));