Ignore:
Timestamp:
Feb 8, 2007, 12:08:04 AM (17 years ago)
Author:
rub
Message:

Issue 0000639: Force selected page on index.php

When page index.php is called without defined section, redirect to a page selected by random on a user list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/section_init.inc.php

    r1722 r1788  
    5252//   );
    5353
    54 $page['section'] = 'categories';
    55 
    5654// some ISPs set PATH_INFO to empty string or to SCRIPT_FILENAME while in the
    5755// default apache implementation it is not set
     
    268266  }
    269267  $next_token++;
     268}
     269else
     270{
     271  if (!empty($conf['random_index_redirect']))
     272  {
     273    $random_index_redirect = array();
     274    foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition)
     275    {
     276      if (empty($random_url_condition) or eval($random_url_condition))
     277      {
     278        $random_index_redirect[] = $random_url;
     279      }
     280    }
     281  }
     282
     283  if (!empty($random_index_redirect))
     284  {
     285    redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
     286  }
     287  else
     288  {
     289    $page['section'] = 'categories';
     290  }
    270291}
    271292
Note: See TracChangeset for help on using the changeset viewer.