Changeset 9345


Ignore:
Timestamp:
Feb 22, 2011, 11:32:59 AM (9 years ago)
Author:
patdenice
Message:

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

Location:
extensions/AdditionalPages
Files:
5 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    }
  • extensions/AdditionalPages/admin/config.inc.php

    r9323 r9345  
    7474
    7575// Parametrage du template
    76 $template->assign('ap_conf', $conf['AP']);
     76$template->assign(array(
     77  'ap_conf' => $conf['AP'],
     78  'SHOW_MENU' => (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] > 0),
     79  'AMM_INSTALLED' => defined('AMM_PATH'),
     80  )
     81);
    7782
    78 if (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] == abs($mb_conf['mbAdditionalPages']))
     83if (defined('AMM_PATH'))
    7984{
    80   $template->assign('SHOW_MENU', true);
     85  load_language('plugin.lang', AMM_PATH);
     86  $template->assign('AMM_URI', get_admin_plugin_menu_link(AMM_PATH.'admin/plugin_admin.php'));
    8187}
    8288
  • extensions/AdditionalPages/admin/template/config.tpl

    r9310 r9345  
    6969    </li>
    7070
     71    {if !$AMM_INSTALLED}
    7172    <li>
    7273      <label>
    7374        <span class="property">{'ap_show_menu'|@translate}</span>
    74         <input type="checkbox" name="show_menu" id="show_menu" value="on" {if isset($SHOW_MENU)}checked="checked"{/if}/>
     75        <input type="checkbox" name="show_menu" id="show_menu" value="on" {if $SHOW_MENU}checked="checked"{/if}/>
    7576      </label>
    7677    </li>
     78    {/if}
    7779
    78     <li id="menu_name" {if !isset($SHOW_MENU)}style="display:none;{/if}">
     80    <li id="menu_name" {if !$AMM_INSTALLED and !$SHOW_MENU}style="display:none;{/if}">
    7981      <span class="property">{'ap_menu_name'|@translate} :
    8082        <select name="lang_desc_select" style="margin-left:30px;">
     
    8890      </span>
    8991    </li>
     92
     93    {if $AMM_INSTALLED}
     94    <li style="margin-top:40px;">
     95      <span class="property"><a href="{$AMM_URI}">{'g002_setmenu_nfo'|@translate}</a></span>
     96    </li>
     97    {/if}
    9098  </ul>
    9199</fieldset>
  • extensions/AdditionalPages/main.inc.php

    r9323 r9345  
    2222if (!isset($conf['AP']['level_perm']))
    2323  include(AP_PATH.'admin/upgrade.inc.php');
     24
     25// Unset $conf['random_index_redirect'] if homepage is defined
     26if (!empty($conf['random_index_redirect']) and !is_null($conf['AP']['homepage']))
     27{
     28  $conf['ap_random_index_redirect'] = $conf['random_index_redirect'];
     29  $conf['random_index_redirect'] = array();
     30}
    2431
    2532// Admin menu
  • extensions/AdditionalPages/maintain.inc.php

    r9323 r9345  
    2323INDEX (pos) ,
    2424INDEX (lang))
    25 DEFAULT CHARACTER SET utf8;';
    26     pwg_query($query);
     25DEFAULT CHARACTER SET utf8';
     26    if ('mysql' == $conf['dblayer'])
     27    {
     28      $query .= ' ENGINE=MYISAM';
     29    }
     30    pwg_query($query.';');
    2731  }
    2832
Note: See TracChangeset for help on using the changeset viewer.