Changeset 7855


Ignore:
Timestamp:
Nov 23, 2010, 3:59:11 PM (10 years ago)
Author:
patdenice
Message:

Rollback to r7452

Location:
extensions/PWG_Stuffs
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/PWG_Stuffs/admin/add_module.php

    r7540 r7855  
    99load_language('plugin.lang', STUFFS_PATH);
    1010
    11 if (!isset($_GET['type']) or ($_GET['type'] != 'MainBlock' and !is_dir(STUFFS_PATH . 'modules/' . $_GET['type'])))
     11if (!isset($_GET['type']) or !is_dir(STUFFS_PATH . 'modules/' . $_GET['type']))
    1212{
    1313  die('Wrong parameters...');
     
    2424if (isset($_POST['submit']) and !is_adviser())
    2525{
    26   @include(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');
     26  include(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');
    2727  if (empty($page['errors']))
    2828  {
    29     if ($type == 'MainBlock')
    30     {
    31       $_POST['module_name'] = 'MainBlock';
    32       $_POST['show_title'] = true;
    33       $_POST['on_home'] = true;
    34       $_POST['on_cats'] = true;
    35       $_POST['on_picture'] = true;
    36     }
    3729    if (empty($_POST['module_name']))
    3830    {
     
    113105  $template->assign(array(
    114106    'STUFFS_TITLE' => l10n('stuffs_edit_mod') . ' <i>' . trigger_event('render_stuffs_name', $module['name']) . '</i>',
    115     'MODULE_ID' => $_GET['edit'],
    116107    'MODULE_NAME' => $module['name'],
    117108    'DESC_VALUE' => (isset($module['descr']) ? $module['descr'] : ''),
     
    148139
    149140// Configuration du module
    150 @include_once(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');
     141include_once(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');
    151142
    152143$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/add_module.tpl'));
  • extensions/PWG_Stuffs/admin/manage.php

    r7540 r7855  
    1919  }
    2020
     21    pwg_query('
     22UPDATE ' . STUFFS_TABLE . '
     23SET datas = "'.addslashes(serialize(array('hide' => isset($_POST['hidemb'])))).'"
     24WHERE id=0;');
     25
    2126  array_push($page['infos'], l10n('stuffs_order_saved'));
    2227}
    2328
    2429// Affichage des modules et de leur position
    25 $q = 'SELECT id, name, descr, type, id_line, width
     30$q = 'SELECT id, name, descr, type, id_line, width, datas
    2631FROM ' . STUFFS_TABLE . '
    2732ORDER BY pos ASC;';
     
    5964                'ID' => $module['id'],
    6065    'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadd_module.php&amp;type=' . $module['type'] . '&amp;edit=' . $module['id'],
    61     'U_DELETE' => !is_adviser() and $module['id'] != 0 ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&amp;del=' . $module['id'] : '',
     66    'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&amp;del=' . $module['id'] : '',
    6267  ));
     68
     69  if ($module['type'] == 'MainBlock' and !empty($module['datas']))
     70  {
     71    $datas = unserialize($module['datas']);
     72    $template->assign('HIDEMB', $datas['hide']);
     73  }
    6374}
    6475
  • extensions/PWG_Stuffs/admin/template/add_module.tpl

    r7540 r7855  
    1111<fieldset>
    1212        <legend>{'stuffs_module_config'|@translate}</legend>
    13   {if $MODULE_ID == 0}<p>{'This module can be hidden only on homepage'|@translate}</p>{/if}
    1413        <table>
    1514
    1615                <tr><td colspan="3"><br></td></tr>
    1716
    18     {if $MODULE_ID != 0}
    1917                <tr>
    2018                        <td><b>{'stuffs_module_title'|@translate}&nbsp;&nbsp;</b></td>
     
    3230                        <td colspan="2">{'stuffs_only_for_admin'|@translate}</td>
    3331                </tr>
    34     {/if}
    3532
    3633                <tr><td colspan="3"><br></td></tr>
     
    6461</fieldset>
    6562
    66 {if $MODULE_ID != 0}
    6763<fieldset>
    6864        <legend>{'stuffs_visual_config'|@translate}</legend>
     
    8581                <tr><td colspan="2"><br></td></tr>
    8682        </table>
     83
     84
    8785</fieldset>
    8886
     
    9189        {$MODULE_OPTIONS}
    9290</fieldset>
    93 {/if}
    9491<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/></p>
    9592</form>
  • extensions/PWG_Stuffs/admin/template/manage.tpl

    r7540 r7855  
    5151
    5252    <li class="categoryLi virtual_cat" id="module_{$module.ID}">
     53      {if $module.TYPE != 'MainBlock'}
    5354      <ul class="categoryActions">
    54         {if $module.TYPE != 'MainBlock'}
    5555        <li class="stuffs_line">
    5656          {'stuffs_id_ligne'|@translate}&nbsp;
     
    6363          <input type="text" size="2" maxlength="2" value="{$module.WIDTH}" name="width[{$module.ID}]" > %
    6464        </li>
    65         {/if}
    6665        <li><a href="{$module.U_EDIT}" title="{'stuffs_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'stuffs_edit'|@translate}"/></a></li>
    6766        {if !empty($module.U_DELETE) }
     
    6968        {/if}
    7069      </ul>
     70      {/if}
    7171
    7272      <p>
     
    7878      {if !empty($module.DESC)}
    7979        <p style="margin-left: 30px;"><i>{$module.DESC}</i></p>
     80      {elseif $module.TYPE == 'MainBlock'}
     81        <p style="margin-left: 30px;"><input name="hidemb" type="checkbox" {if $HIDEMB}checked="checked"{/if}> &nbsp;{'Hide on home page'|@translate}</p>
    8082      {/if}
    8183
  • extensions/PWG_Stuffs/include/class.inc.php

    r7541 r7855  
    3636
    3737    $query = '
    38 SELECT id, name, type, datas, users, groups, show_title, id_line, width
     38SELECT id, name, type, datas, groups, show_title, id_line, width
    3939FROM ' . STUFFS_TABLE . '
    40 WHERE id = 0 OR (
    41   users LIKE "%' . $user['status'] . '%"
     40WHERE users LIKE "%' . $user['status'] . '%"
    4241';
    4342
     
    5554    else return;
    5655
    57     $query .= ')
     56    $query .= '
    5857ORDER BY pos ASC;';
    5958
     
    7170    foreach ($this->modules as $module)
    7271    {
    73         if (!empty($module['groups']))
    74       {
    75                 $authorized_groups = explode(',', $module['groups']);
    76                 if (array_intersect($this->user_groups, $authorized_groups) == array()) continue;
    77         }
    78 
    7972      if ($module['type'] == 'MainBlock')
    8073      {
    81         global $user;
    82         if (strpos($module['users'], $user['status']) === false)
     74                $this->pos = 'end';
     75        if (!empty($module['datas'])
     76          and $datas = unserialize($module['datas'])
     77          and $datas['hide'])
    8378        {
    8479          add_event_handler('loc_end_index', 'hide_main_block');
    8580        }
    86         $this->pos = 'end';
    8781                continue;
     82        }
     83        if (!empty($module['groups']))
     84      {
     85                $authorized_groups = explode(',', $module['groups']);
     86                if (array_intersect($this->user_groups, $authorized_groups) == array()) continue;
    8887        }
    8988
Note: See TracChangeset for help on using the changeset viewer.