From 0971ce48d217b7cc8081ae70c4b041ab23fdf29c Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 22 Mar 2006 01:01:47 +0000 Subject: URL rewriting: capable of fully working with urls without ? URL rewriting: works with image file instead of image id (change make_picture_url to generate urls with file name instead of image id) URL rewriting: completely works with category/best_rated and picture/best_rated/534 (change 'category.php?' to 'category' in make_index_url and 'picture.php?' to 'picture' in make_picture_url to see it) fix: picture category display in upper bar fix: function rate_picture variables and use of the new user type fix: caddie icon appears now on category page fix: admin element_set sql query was using storage_category_id column (column has moved to #image_categories) fix: replaced some old $_GET[xxx] with $page[xxx] fix: pictures have metadata url (use ? parameter - might change later) git-svn-id: http://piwigo.org/svn/trunk@1092 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_session.inc.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'include/functions_session.inc.php') diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index 9e1e3f152..482c76376 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -81,11 +81,26 @@ function cookie_path() if ( isset($_SERVER['REDIRECT_URL']) ) { // mod_rewrite is activated for upper level directories. we must set the // cookie to the path shown in the browser otherwise it will be discarded. - $scr = $_SERVER['REDIRECT_URL']; + if ( isset($_SERVER['PATH_INFO']) ) + { + $idx = strpos( $_SERVER['REDIRECT_URL'], $_SERVER['PATH_INFO'] ); + if ($idx !== false) + { + $scr = substr($_SERVER['REDIRECT_URL'], 0, $idx); + } + else + {//this should never happen + $scr='//'; + } + } + else + { + $scr = $_SERVER['REDIRECT_URL']; + } } else { - $scr = $_SERVER['PHP_SELF']; + $scr = $_SERVER['SCRIPT_NAME']; } return substr($scr,0,strrpos( $scr,'/')); } -- cgit v1.2.3