Ignore:
Timestamp:
02/22/11 11:32:59 (9 years ago)
Author:
patdenice
Message:

Use ENGINE=MyISAM for table creation.
Compatibility with AMM.
Compatibility with $confrandom_index_redirect parameter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdditionalPages/additional_page.php

    r9323 r9345  
    22 
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     4 
     5function check_random_index_redirect() 
     6{ 
     7  global $conf; 
     8 
     9  if (!empty($conf['ap_random_index_redirect'])) 
     10  { 
     11    $random_index_redirect = array(); 
     12    foreach ($conf['ap_random_index_redirect'] as $random_url => $random_url_condition) 
     13    { 
     14      if (empty($random_url_condition) or eval($random_url_condition)) 
     15      { 
     16        $random_index_redirect[] = $random_url; 
     17      } 
     18    } 
     19    if (!empty($random_index_redirect)) 
     20    { 
     21      redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]); 
     22    } 
     23  } 
     24  return true; 
     25} 
    426 
    527global $template, $user; 
     
    3961  if ($user['level'] < $row['level']) 
    4062  { 
     63    if ($page['ap_homepage'] and check_random_index_redirect()) return; 
    4164    page_forbidden(l10n('You are not authorized to access the requested page')); 
    4265  } 
     
    4871    if (!in_array($user['status'], $authorized_users)) 
    4972    { 
    50       if ($page['ap_homepage']) return; 
     73      if ($page['ap_homepage'] and check_random_index_redirect()) return; 
    5174      page_forbidden(l10n('You are not authorized to access the requested page')); 
    5275    } 
     
    6487    if (empty($groups)) 
    6588    { 
    66       if ($page['ap_homepage']) return; 
     89      if ($page['ap_homepage'] and check_random_index_redirect()) return; 
    6790      page_forbidden(l10n('You are not authorized to access the requested page')); 
    6891    } 
Note: See TracChangeset for help on using the changeset viewer.