From b6fc0fa5eb94301d5611b5385371aeda821da0fe Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 8 Feb 2007 01:31:05 +0000 Subject: - correct php warnings (section_init and mass_inserts) - flat category view url is now 'flat' instead of 'flat_cat' (it is nicer and shorter) - small html validation (double class attribute) - removed unnecessary class="" - changed 2 times hard coded index.php?recent_pics with make_index_url(...) git-svn-id: http://piwigo.org/svn/trunk@1789 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/section_init.inc.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'include/section_init.inc.php') diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 78ec73fa0..378fd539b 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -128,7 +128,7 @@ if (script_basename() == 'picture') // basename without file extention } } -if (0 === strpos($tokens[$next_token], 'categor')) +if (0 === strpos(@$tokens[$next_token], 'categor')) { $page['section'] = 'categories'; $next_token++; @@ -140,7 +140,7 @@ if (0 === strpos($tokens[$next_token], 'categor')) $next_token++; } } -else if (0 === strpos($tokens[$next_token], 'tag')) +else if (0 === strpos(@$tokens[$next_token], 'tag')) { $page['section'] = 'tags'; $page['tags'] = array(); @@ -201,32 +201,32 @@ SELECT name, url_name, id page_not_found('Requested tag does not exist', get_root_url().'tags.php' ); } } -else if (0 === strpos($tokens[$next_token], 'fav')) +else if (0 === strpos(@$tokens[$next_token], 'fav')) { $page['section'] = 'favorites'; $next_token++; } -else if ('most_visited' == $tokens[$next_token]) +else if ('most_visited' == @$tokens[$next_token]) { $page['section'] = 'most_visited'; $next_token++; } -else if ('best_rated' == $tokens[$next_token]) +else if ('best_rated' == @$tokens[$next_token]) { $page['section'] = 'best_rated'; $next_token++; } -else if ('recent_pics' == $tokens[$next_token]) +else if ('recent_pics' == @$tokens[$next_token]) { $page['section'] = 'recent_pics'; $next_token++; } -else if ('recent_cats' == $tokens[$next_token]) +else if ('recent_cats' == @$tokens[$next_token]) { $page['section'] = 'recent_cats'; $next_token++; } -else if ('search' == $tokens[$next_token]) +else if ('search' == @$tokens[$next_token]) { $page['section'] = 'search'; $next_token++; @@ -239,7 +239,7 @@ else if ('search' == $tokens[$next_token]) $page['search'] = $matches[1]; $next_token++; } -else if ('list' == $tokens[$next_token]) +else if ('list' == @$tokens[$next_token]) { $page['section'] = 'list'; $next_token++; @@ -268,7 +268,12 @@ else if ('list' == $tokens[$next_token]) } else { - if (!empty($conf['random_index_redirect'])) + $page['section'] = 'categories'; + if (script_basename() == 'picture') + {//access a picture only by id, file or id-file without given section + $page['flat_cat'] = true; + } + elseif (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) ) { $random_index_redirect = array(); foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition) @@ -278,15 +283,10 @@ else $random_index_redirect[] = $random_url; } } - } - - if (!empty($random_index_redirect)) - { - redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]); - } - else - { - $page['section'] = 'categories'; + if (!empty($random_index_redirect)) + { + redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]); + } } } @@ -300,7 +300,7 @@ while (isset($tokens[$i])) } if ('categories' == $page['section'] and - 'flat_cat' == $tokens[$i]) + 'flat' == $tokens[$i]) { // indicate a special list of images $page['flat_cat'] = true; -- cgit v1.2.3