From 1d02741910e961986c67216f98b97fce1c315312 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 13 Apr 2007 23:57:55 +0000 Subject: flat view small improvements (picture page on root category sorter urls and works in several cases) correction in permalinks admin (error was assignment in if instead of comparison) git-svn-id: http://piwigo.org/svn/branches/branch-1_7@1955 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/permalinks.php | 2 +- include/functions_url.inc.php | 4 ++++ include/section_init.inc.php | 13 ++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/admin/permalinks.php b/admin/permalinks.php index d5aa99463..f82f88fd7 100644 --- a/admin/permalinks.php +++ b/admin/permalinks.php @@ -137,7 +137,7 @@ while ( $row=mysql_fetch_assoc($result) ) $categories[] = $row; } -if ( !count($sort_by) or $sort_by[0]='name') +if ( !count($sort_by) or $sort_by[0]=='name') { usort($categories, 'global_rank_compare'); } diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 04e0b32d1..0d81ae6fc 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -246,6 +246,10 @@ function make_picture_url($params) default: $url .= $params['image_id']; } + if ( !isset($params['category'] ) ) + {// make urls shorter ... + unset( $params['flat'] ); + } $url .= make_section_in_url($params); $url = add_well_known_params_in_url($url, $params); return $url; diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 9b16f937b..f58de2151 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -140,6 +140,7 @@ if (0 === strpos(@$tokens[$next_token], 'categor')) { if ( strpos($tokens[$next_token], 'created-')!==0 and strpos($tokens[$next_token], 'posted-')!==0 + and strpos($tokens[$next_token], 'start-')!==0 and $tokens[$next_token] != 'flat') {// try a permalink $cat_id = get_cat_id_from_permalink($tokens[$next_token]); @@ -159,8 +160,16 @@ if (0 === strpos(@$tokens[$next_token], 'categor')) unset($cat_id); $next_token++; } + elseif ( script_basename()=='picture' ) + { //access a picture only by id, file or id-file without given section + $page['flat']=true; + } } } + elseif ( script_basename()=='picture' ) + { //access a picture only by id, file or id-file without given section + $page['flat']=true; + } } else if (0 === strpos(@$tokens[$next_token], 'tag')) { @@ -314,7 +323,8 @@ while (isset($tokens[$i])) } if ('categories' == $page['section'] and - 'flat' == $tokens[$i]) + 'flat' == $tokens[$i] and + !isset($page['chronology_field']) ) { // indicate a special list of images $page['flat'] = true; @@ -340,6 +350,7 @@ while (isset($tokens[$i])) } $page['chronology_date'] = $chronology_tokens; } + unset($page['flat']); } $i++; -- cgit v1.2.3