diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-02-08 01:17:07 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-02-08 01:17:07 +0000 |
commit | 0e78db47de2041912447dd5bbbfafb7684e7480f (patch) | |
tree | afb3fe9de5bdbbe5c0ce624f8ce60e65c6ef57c3 /include | |
parent | 687a7ca122b56264c63830112ca43ea7db2c3c7b (diff) |
- remake of Remote sites and Synchronize:
- synchronization for remote and local sites are done by the same code
- remote sites can update metadata now (not before) - bug 279
- fixes bug 82: has_high column
- improve feature 280: user sort by filename
- fix path to template mimetypes icons
- bug 284: session cookie lifetime, deletion on logout and corrected issue
when db upgrades were missing
git-svn-id: http://piwigo.org/svn/trunk@1029 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/common.inc.php | 1 | ||||
-rw-r--r-- | include/functions.inc.php | 14 | ||||
-rw-r--r-- | include/functions_category.inc.php | 11 | ||||
-rw-r--r-- | include/functions_session.inc.php | 20 |
4 files changed, 40 insertions, 6 deletions
diff --git a/include/common.inc.php b/include/common.inc.php index 6e8bbf697..83e1bf30d 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -147,6 +147,7 @@ SELECT id // which upgrades need to be applied? if (count(array_diff($existing, $applied)) > 0) { + ob_start();// buffer output so that cookies work echo '<p>' .'Some database upgrades are missing, ' diff --git a/include/functions.inc.php b/include/functions.inc.php index d49317d22..49f1b44bd 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -974,6 +974,20 @@ SELECT '.$conf['user_fields']['email'].' } /** + * returns the $str in current language if possible or $str enclosed + * in special chars + */ +function get_lang($str) +{ + global $lang; + if ( isset($lang[$str]) ) + { + return $lang[$str]; + } + return '@@'.$str.'@@'; +} + +/** * which upgrades are available ? * * @return array diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 370ab48e6..9e0e16a1d 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -321,13 +321,14 @@ SELECT galleries_url // returns an array of image orders available for users/visitors function get_category_preferred_image_orders() { - global $lang, $conf; + global $conf; return array( array('Default', '', true), - array($lang['best_rated_cat'], 'average_rate DESC', $conf['rate']), - array($lang['most_visited_cat'], 'hit DESC', true), - array($lang['Creation date'], 'date_creation DESC', true), - array($lang['Availability date'], 'date_available DESC', true) + array(get_lang('best_rated_cat'), 'average_rate DESC', $conf['rate']), + array(get_lang('most_visited_cat'), 'hit DESC', true), + array(get_lang('Creation date'), 'date_creation DESC', true), + array(get_lang('Availability date'), 'date_available DESC', true), + array(get_lang('File name'), 'file ASC', true) ); } diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index 4ec814a5f..03a6dd155 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -69,7 +69,25 @@ if (isset($conf['session_save_handler']) ini_set('session.use_only_cookies', $conf['session_use_only_cookies']); ini_set('session.use_trans_sid', intval($conf['session_use_trans_sid'])); ini_set('session.name', $conf['session_name']); - ini_set('session.cookie_path', dirname($_SERVER['PHP_SELF'])); + ini_set('session.cookie_path', cookie_path() ); +} + +// cookie_path returns the path to use for the PhpWebGallery cookie. +// If PhpWebGallery is installed on : +// http://domain.org/meeting/gallery/category.php +// cookie_path will return : "/meeting/gallery" +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']; + } + else + { + $scr = $_SERVER['PHP_SELF']; + } + return substr($scr,0,strrpos( $scr,'/')); } /** |