aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-02-08 22:04:36 +0000
committerrub <rub@piwigo.org>2007-02-08 22:04:36 +0000
commit5b038de71715c8ec006abffe9d23c4172b71d0ba (patch)
tree8ca826e68a35ea386b3831cf30a0fb1eb9632efe /include/section_init.inc.php
parent1f53608976250806d9a37f93e386f53a84aedbbc (diff)
Issue 0000639: Force selected page on index.php
Continue the Radu idea, restrict more use of random list Issue 0000598: NBM: Add new informations Add css on mail Use user template for mail (on next commit, best control) Comment mass_inserts because don't with MySQL 4.1.9 git-svn-id: http://piwigo.org/svn/trunk@1792 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/section_init.inc.php')
-rw-r--r--include/section_init.inc.php37
1 files changed, 24 insertions, 13 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 378fd539b..869bb34b8 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -269,23 +269,34 @@ else if ('list' == @$tokens[$next_token])
else
{
$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]) )
+
+ switch (script_basename())
{
- $random_index_redirect = array();
- foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition)
+ case 'picture':
{
- if (empty($random_url_condition) or eval($random_url_condition))
- {
- $random_index_redirect[] = $random_url;
- }
+ //access a picture only by id, file or id-file without given section
+ $page['flat_cat'] = true;
+ break;
}
- if (!empty($random_index_redirect))
+ case 'index':
{
- redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
+ // No section defined, go to selected url
+ if (!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)
+ {
+ if (empty($random_url_condition) or eval($random_url_condition))
+ {
+ $random_index_redirect[] = $random_url;
+ }
+ }
+ if (!empty($random_index_redirect))
+ {
+ redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
+ }
+ }
+ break;
}
}
}