Changeset 1788


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.

Location:
trunk
Files:
7 edited

Legend:

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

    r1786 r1788  
    212212// page.
    213213$conf['links'] = array();
     214
     215// random_index_redirect: list of 'internal' links to use when no section is defined on index.php.
     216// An example is the best than a long explanation :
     217//
     218//  for each link is associated a php condition
     219//  '' condition is equivalent to 'return true;'
     220//  $conf['random_index_redirect'] = array(
     221//    PHPWG_ROOT_PATH.'index.php?/best_rated' => 'return true;',
     222//    PHPWG_ROOT_PATH.'index.php?/recent_pics' => 'return $user[\'is_the_guest\'];',
     223//    PHPWG_ROOT_PATH.'random.php' => '',
     224//    PHPWG_ROOT_PATH.'index.php?/categories' => '',
     225//    );
     226$conf['random_index_redirect'] = array();
    214227
    215228// List of notes to display on all header page
  • trunk/include/functions_url.inc.php

    r1750 r1788  
    313313  if (!isset($params['section']))
    314314  {
    315     $params['section'] = 'categories';
     315    $params['section'] = 'none';
    316316  }
    317317
     
    399399      break;
    400400    }
     401    case 'none' :
     402    {
     403      break;
     404    }
    401405    default :
    402406    {
  • trunk/include/menubar.inc.php

    r1743 r1788  
    4444    'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
    4545    'F_IDENTIFY' => get_root_url().'identification.php',
    46     'U_HOME' => make_index_url(),
     46    'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
    4747    'U_REGISTER' => get_root_url().'register.php',
    4848    'U_LOST_PASSWORD' => get_root_url().'password.php',
  • 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
  • trunk/profile.php

    r1763 r1788  
    5454    $userdata );
    5555
    56   $template->assign_var('U_RETURN', make_index_url() );
     56  $template->assign_var('U_HOME', make_index_url() );
    5757
    5858  // +-----------------------------------------------------------------------+
  • trunk/template/yoga/menubar.tpl

    r1780 r1788  
    3030  <!-- END stop_filter -->
    3131<dl id="mbCategories">
    32   <dt><a href="{U_HOME}">{lang:Categories}</a></dt>
     32  <dt><a href="{U_CATEGORIES}">{lang:Categories}</a></dt>
    3333  <dd>
    3434    {MENU_CATEGORIES_CONTENT}
  • trunk/template/yoga/profile.tpl

    r1753 r1788  
    1313  <div class="titrePage">
    1414    <ul class="categoryActions">
    15       <li><a href="{U_RETURN}" title="{lang:return to homepage}"><img src="{themeconf:icon_dir}/home.png" class="button" alt="{lang:home}"/></a></li>
     15      <li><a href="{U_HOME}" title="{lang:return to homepage}"><img src="{themeconf:icon_dir}/home.png" class="button" alt="{lang:home}"/></a></li>
    1616    </ul>
    1717    <h2>{lang:Profile}</h2>
Note: See TracChangeset for help on using the changeset viewer.