Changeset 9369 for extensions


Ignore:
Timestamp:
Feb 24, 2011, 4:45:43 PM (13 years ago)
Author:
patdenice
Message:

Plugins can add their own modules.

Location:
extensions/PWG_Stuffs
Files:
2 added
41 edited

Legend:

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

    r7855 r9369  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 global $template, $conf;
    6 
    7 include_once(STUFFS_PATH . 'include/functions.inc.php');
    8 include_once(STUFFS_PATH . 'admin/functions.inc.php');
    9 load_language('plugin.lang', STUFFS_PATH);
    10 
    11 if (!isset($_GET['type']) or !is_dir(STUFFS_PATH . 'modules/' . $_GET['type']))
     5if ($page['tab'] == 'add_module')
    126{
    13   die('Wrong parameters...');
    14 }
    15 else
    16 {
    17   $type = $_GET['type'];
     7  if (!isset($_GET['path']) or !isset($modules[$_GET['path']]))
     8  {
     9    die('Wrong module path.');
     10  }
     11  else
     12  {
     13    $module_path = $_GET['path'];
     14  }
    1815}
    1916
    20 // Cas particulier des News
    21 if ($type == 'News') include(STUFFS_PATH . 'modules/News/config.inc.php');
    22 
    23 // Enregistrement du module
     17// Save module
    2418if (isset($_POST['submit']) and !is_adviser())
    2519{
    26   include(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');
     20  include($module_path.'config.inc.php');
    2721  if (empty($page['errors']))
    2822  {
     
    3428    {
    3529      $module_name = $_POST['module_name'];
    36       $desc = (!empty($_POST['module_desc']) ? '"' . $_POST['module_desc'] . '"' : 'NULL');
    37       $groups = (!empty($_POST['groups']) ? '"' . implode(',', $_POST['groups']) . '"' : 'NULL');
    38       $users = (!empty($_POST['users']) ? '"' . implode(',', $_POST['users']) . '"' : 'NULL');
     30      $desc = !empty($_POST['module_desc']) ? '"' . $_POST['module_desc'] . '"' : 'NULL';
     31      $groups = !empty($_POST['groups']) ? '"' . implode(',', $_POST['groups']) . '"' : 'NULL';
     32      $users = !empty($_POST['users']) ? '"' . implode(',', $_POST['users']) . '"' : 'NULL';
    3933      $show_title = isset($_POST['show_title']) ? '"true"' : '"false"';
    4034      $on_home = isset($_POST['on_home'])  ? '"true"' : '"false"';
     
    4236      $on_picture = isset($_POST['on_picture'])  ? '"true"' : '"false"';
    4337
    44                         $sav_datas = (!empty($datas) ? '"' . addslashes(serialize($datas)) . '"' : 'NULL');
     38      $sav_datas = (!empty($datas) ? '"' . addslashes(serialize($datas)) . '"' : 'NULL');
    4539
    4640      if (isset($_GET['edit']))
    47       {                 
     41      {     
    4842        pwg_query('
    4943UPDATE ' . STUFFS_TABLE . '
    5044SET name ="' . $module_name . '",
    51                 descr=' . $desc . ',
    52                 type="' . $type . '",
    53                 datas=' . $sav_datas . ',
    54                 users=' . $users . ',
    55                 groups=' . $groups . ',
     45    descr=' . $desc . ',
     46    datas=' . $sav_datas . ',
     47    users=' . $users . ',
     48    groups=' . $groups . ',
    5649    show_title=' . $show_title .',
    5750    on_home=' . $on_home .',
     
    5952    on_picture='. $on_picture . '
    6053WHERE id = ' . $_GET['edit'] . ';');
     54        if (isset($_GET['redirect']))
     55        {
     56          redirect(urldecode($_GET['redirect']));
     57        }
    6158      }
    6259      else
     
    6966
    7067        $query = '
    71 INSERT INTO ' . STUFFS_TABLE . ' ( id, pos, name, descr, type, datas, users, groups, show_title, on_home, on_cats, on_picture, id_line, width )
     68INSERT INTO ' . STUFFS_TABLE . ' ( id, pos, name, descr, path, parent, datas, users, groups, show_title, on_home, on_cats, on_picture, id_line, width )
    7269VALUES (' . $next_element_id . ' ,
    73         ' . $pos . ',
    74         "' . $module_name . '",
    75         ' . $desc . ',
    76         "' . $type . '",
    77         ' . $sav_datas . ',
    78         ' . $users . ',
    79         ' . $groups . ',
     70  ' . $pos . ',
     71  "' . $module_name . '",
     72  ' . $desc . ',
     73  "' . $module_path . '",
     74  ' . (isset($modules[$module_path]['parent']) ? '"'.$modules[$module_path]['parent'].'"' : 'NULL') .',
     75  ' . $sav_datas . ',
     76  ' . $users . ',
     77  ' . $groups . ',
    8078  ' . $show_title . ',
    8179  ' . $on_home . ',
     
    8684        pwg_query($query);
    8785      }
    88 
    8986      redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php');
    9087    }
     
    9289}
    9390
    94 // Récupération des données du module
    95 if (isset($_GET['edit']))
    96 {
    97   $q = ('SELECT * FROM ' . STUFFS_TABLE . ' WHERE id = ' . $_GET['edit'] . ';');
    98   $module = mysql_fetch_array(pwg_query($q));
    99 
    100   $module['users'] = explode(',', $module['users']);
    101   $module['groups'] = explode(',', $module['groups']);
    102 
    103   $datas = (!empty($module['datas']) ? unserialize($module['datas']) : false);
    104 
    105   $template->assign(array(
    106     'STUFFS_TITLE' => l10n('stuffs_edit_mod') . ' <i>' . trigger_event('render_stuffs_name', $module['name']) . '</i>',
    107     'MODULE_NAME' => $module['name'],
    108     'DESC_VALUE' => (isset($module['descr']) ? $module['descr'] : ''),
    109     'show_title_CHECKED' => ($module['show_title'] == 'true' ? 'checked="checked"' : ''),
    110     'on_home_CHECKED' => ($module['on_home'] == 'true' ? 'checked="checked"' : ''),
    111     'on_cats_CHECKED' => ($module['on_cats'] == 'true' ? 'checked="checked"' : ''),
    112     'on_picture_CHECKED' => ($module['on_picture'] == 'true' ? 'checked="checked"' : '')));
    113 }
    114 else
     91// Default module data
     92if ($page['tab'] == 'add_module')
    11593{
    11694  $module['users'] = array('guest', 'generic', 'normal', 'admin', 'webmaster');
     
    11896  $template->assign(array(
    11997    'STUFFS_TITLE' => l10n('stuffs_add_mod'),
    120     'MODULE_NAME' => l10n('module_name_' . strtolower($type)),
     98    'MODULE_NAME' => $modules[$module_path]['name'],
    12199    'show_title_CHECKED' => 'checked="checked"',
    122100    'on_home_CHECKED' => 'checked="checked"'));
    123101}
    124102
    125 // Selection des utilisateurs
     103// Users perm
    126104$template->assign('user_perm', array(
    127105  'GUEST' => (in_array('guest', $module['users']) ? 'checked="checked"' : ''),
     
    131109  'WEBMASTER' => (in_array('webmaster', $module['users']) ? 'checked="checked"' : '')));
    132110
    133 // Selection des groupes
     111// Groups perm
    134112$groups = get_all_groups();
    135113if (!empty($groups))
     
    138116}
    139117
    140 // Configuration du module
    141 include_once(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');
     118// Module configuration
     119include_once($module_path.'config.inc.php');
    142120
    143121$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/add_module.tpl'));
  • extensions/PWG_Stuffs/admin/admin.php

    r3609 r9369  
    1414// |                            Tabsheet
    1515// +-----------------------------------------------------------------------+
    16 if (!isset($_GET['tab']))
    17     $page['tab'] = 'manage';
    18 else
    19     $page['tab'] = $_GET['tab'];
     16$page['tab'] = isset($_GET['tab']) ? $_GET['tab'] : 'manage';
    2017
    2118$tabsheet = new tabsheet();
    22 $tabsheet->add('manage',
    23                l10n('stuffs_mods_management'),
    24                $my_base_url.'&amp;tab=manage');
    25 $tabsheet->add('new',
    26                l10n('stuffs_add_mod'),
    27                $my_base_url.'&amp;tab=new');
     19$tabsheet->add('manage', l10n('stuffs_mods_management'), $my_base_url.'&amp;tab=manage');
     20if ($page['tab'] == 'add_module')
     21{
     22  $tabsheet->add('add_module', l10n('stuffs_add_mod'), $my_base_url.'&amp;tab=add_module&amp;path='.$_GET['path']);
     23}
     24else
     25{
     26  $tabsheet->add('new', l10n('stuffs_add_mod'), $my_base_url.'&amp;tab=new');
     27}
     28if ($page['tab'] == 'edit_module')
     29{
     30  $tabsheet->add('edit_module', l10n('stuffs_edit_mod'), $my_base_url.'&amp;tab=edit_module');
     31}
    2832$tabsheet->select($page['tab']);
    2933$tabsheet->assign();
    3034
    31 //Ajout d'un module
    32 if (isset($_POST['addModule']) and !is_adviser())
     35//Récupération des modules disponibles
     36add_event_handler('get_stuffs_modules', 'get_default_stuffs_modules');
     37$disp_modules = trigger_event('get_stuffs_modules', array());
     38uasort($disp_modules, 'name_compare');
     39
     40$modules = array();
     41foreach($disp_modules as $module)
    3342{
    34         if (!isset($_POST['module']))
     43  $module['path'] = PHPWG_ROOT_PATH.trim($module['path'], './').'/';
     44
     45  if (preg_match('#^'.preg_quote(PHPWG_PLUGINS_PATH).'([^/]*?)/#', $module['path'], $match) and $match[1] != 'PWG_Stuffs')
    3546  {
    36                 array_push($page['errors'], l10n('stuffs_error_no_mod_selected'));
    37         }
    38   else
    39   {
    40     redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadd_module.php&type=' . $_POST['module']);
    41         }
     47   $module['parent'] = $match[1];
     48  }
     49  $modules[$module['path']] = $module;
    4250}
    43 
    44 //Suppression d'un module
    45 if (isset($_GET['del']) and !is_adviser())
    46 {
    47         pwg_query('DELETE FROM ' . STUFFS_TABLE . ' WHERE id = ' . $_GET['del'] . ' LIMIT 1;');
    48   redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php');
    49 }
    50 
    51 //Récupération des modules disponibles
    52 $modules = get_stuffs_modules();
    5351
    5452// Include file
  • extensions/PWG_Stuffs/admin/functions.inc.php

    r6230 r9369  
    11<?php
    22
    3 function get_stuffs_modules()
     3function get_default_stuffs_modules($modules)
    44{
    5         $dir = opendir(STUFFS_PATH . 'modules/');
    6     while ($file = readdir($dir)) {
    7         if ($file != '.' and $file != '..' and $file != '.svn') {
    8             $path = STUFFS_PATH . 'modules/' . $file;
    9             if (is_dir($path) and !is_link($path)) {
    10                 $modules[$file] = array('type' => $file,
    11                     'name' => l10n('module_name_' . strtolower($file)),
    12                     'description' => l10n('module_desc_' . strtolower($file)));
    13             }
    14         }
     5  $dir = opendir(STUFFS_PATH . 'modules/');
     6  while ($file = readdir($dir))
     7  {
     8    if ($file != '.' and $file != '..' and $file != '.svn')
     9    {
     10      $path = STUFFS_PATH . 'modules/' . $file;
     11      if (is_dir($path) and !is_link($path))
     12      {
     13        array_push($modules, array(
     14          'path' => $path,
     15          'name' => l10n('module_name_' . strtolower($file)),
     16          'description' => l10n('module_desc_' . strtolower($file)),
     17          )
     18        );
     19      }
    1520    }
    16     closedir($dir);
    17     uasort($modules, 'name_compare');
    18     return $modules;
     21  }
     22  closedir($dir);
     23  return $modules;
    1924}
    2025
  • extensions/PWG_Stuffs/admin/manage.php

    r7855 r9369  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 // Enregistrement de l'ordre
     5global $pwg_loaded_plugins;
     6
     7// Delete module
     8if (isset($_GET['del']) and !is_adviser())
     9{
     10  pwg_query('DELETE FROM ' . STUFFS_TABLE . ' WHERE id = ' . $_GET['del'] . ' LIMIT 1;');
     11  redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php');
     12}
     13
     14// Save order
    615if (isset($_POST['submitOrder']) and !is_adviser())
    716{
     
    2736}
    2837
    29 // Affichage des modules et de leur position
    30 $q = 'SELECT id, name, descr, type, id_line, width, datas
     38// Display
     39$q = 'SELECT id, name, descr, path, parent, id_line, width, datas
    3140FROM ' . STUFFS_TABLE . '
    3241ORDER BY pos ASC;';
     
    3443$num = 0;
    3544$pos = 1;
    36 $cat_mod = array('name' => l10n('Categories'), 'type' => '-', 'description' => '');
    3745$id_line_options = array(
    3846    '' => '-',
     
    5058while ($module = mysql_fetch_assoc($result))
    5159{
    52         $module['name'] = $module['type'] != 'MainBlock' ? $module['name'] : l10n('stuffs_main_block');
     60  $module['name'] = !empty($module['path']) ? $module['name'] : l10n('stuffs_main_block');
    5361
    5462  $template->append('modules', array(
     
    5664    'NAME' => trigger_event('render_stuffs_name', $module['name']),
    5765    'DESC' => $module['descr'],
    58     'TYPE' => $module['type'],
    59     'TYPE_NAME' => (isset($modules[$module['type']]['name']) ? $modules[$module['type']]['name'] : ''),
     66    'PATH' => $module['path'],
     67    'TYPE_NAME' => (isset($modules[$module['path']]['name']) ? $modules[$module['path']]['name'] : ''),
    6068    'POS' => 10 * $pos++,
    6169    'ID_LINE_OPTIONS' => $id_line_options,
    6270    'ID_LINE_SELECTED' => $module['id_line'],
    63                 'WIDTH' => $module['width'],
    64                 'ID' => $module['id'],
    65     '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'],
     71    'WIDTH' => $module['width'],
     72    'ID' => $module['id'],
     73    'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&amp;tab=edit_module&amp;edit='.$module['id'],
    6674    'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&amp;del=' . $module['id'] : '',
    67   ));
     75    'MISSING' => (isset($module['parent']) and !isset($pwg_loaded_plugins[$module['parent']])),
     76    )
     77  );
    6878
    69   if ($module['type'] == 'MainBlock' and !empty($module['datas']))
     79  if (empty($module['path']) and !empty($module['datas']))
    7080  {
    7181    $datas = unserialize($module['datas']);
  • extensions/PWG_Stuffs/admin/new.php

    r3609 r9369  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
     5//Ajout d'un module
     6if (isset($_POST['addModule']) and !is_adviser())
     7{
     8  if (!isset($_POST['module']))
     9  {
     10    array_push($page['errors'], l10n('stuffs_error_no_mod_selected'));
     11  }
     12  else
     13  {
     14    redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&tab=add_module&path=' . urlencode($_POST['module']));
     15  }
     16}
     17
    518// Affichages des modules à ajouter
    619foreach($modules as $module)
    720{
    8         $template->append('add_module', array(
    9     'MODULE' => $module['type'],
     21  $template->append('add_module', array(
     22    'MODULE_PATH' => $module['path'],
    1023    'NAME' => $module['name'],
    11                 'DESC' => $module['description']));
     24    'DESC' => $module['description'],
     25    )
     26  );
    1227}
    1328
  • extensions/PWG_Stuffs/admin/template/manage.tpl

    r7855 r9369  
    5151
    5252    <li class="categoryLi virtual_cat" id="module_{$module.ID}">
    53       {if $module.TYPE != 'MainBlock'}
     53      {if !empty($module.PATH)}
    5454      <ul class="categoryActions">
    5555        <li class="stuffs_line">
     
    6363          <input type="text" size="2" maxlength="2" value="{$module.WIDTH}" name="width[{$module.ID}]" > %
    6464        </li>
     65        {if !$module.MISSING}
    6566        <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>
     67        {/if}
    6668        {if !empty($module.U_DELETE) }
    6769        <li><a href="{$module.U_DELETE}" title="{'stuffs_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'stuffs_delete'|@translate}" /></a></li>
     
    7274      <p>
    7375      <img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" alt="{'Drag to re-order'|@translate}" title="{'Drag to re-order'|@translate}"/>
    74       <strong>{if $module.TYPE == 'MainBlock'}<span class="MainBlock">{$module.NAME}</span>{else}<a href="{$module.U_EDIT}">{$module.NAME}</a>{/if}</strong>
    75       {if $module.TYPE != 'MainBlock'}&nbsp;-  &nbsp;{$module.TYPE_NAME}{/if}
     76      <strong>{if empty($module.PATH)}<span class="MainBlock">{$module.NAME}</span>{else}<a href="{$module.U_EDIT}">{$module.NAME}</a>{/if}</strong>
     77      {if !empty($module.TYPE_NAME)}&nbsp;-  &nbsp;{$module.TYPE_NAME}{/if}
    7678      </p>
    7779
    78       {if !empty($module.DESC)}
     80      {if $module.MISSING}
     81        <p style="margin-left: 30px;">{'stuffs_parent_plugin_is_missing'|@translate}</p>
     82      {elseif !empty($module.DESC)}
    7983        <p style="margin-left: 30px;"><i>{$module.DESC}</i></p>
    80       {elseif $module.TYPE == 'MainBlock'}
     84      {elseif empty($module.PATH)}
    8185        <p style="margin-left: 30px;"><input name="hidemb" type="checkbox" {if $HIDEMB}checked="checked"{/if}> &nbsp;{'Hide on home page'|@translate}</p>
    8286      {/if}
  • extensions/PWG_Stuffs/admin/template/new.tpl

    r3609 r9369  
    1111        {foreach from=$add_module item=module}
    1212        <tr>
    13                 <td><input type="radio" value="{$module.MODULE}" name="module"/>
     13                <td><input type="radio" value="{$module.MODULE_PATH}" name="module"/>
    1414                        <b>{$module.NAME}</b> : {$module.DESC}</td>
    1515        </tr>
  • extensions/PWG_Stuffs/include/class.inc.php

    r7855 r9369  
    77  var $user_groups = array();
    88  var $modules = array();
    9         var $blocks = array();
    10         var $pos = 'begin';
     9  var $blocks = array();
     10  var $pos = 'begin';
    1111
    1212  function stuffs()
     
    3636
    3737    $query = '
    38 SELECT id, name, type, datas, groups, show_title, id_line, width
     38SELECT id, name, path, parent, datas, groups, show_title, id_line, width
    3939FROM ' . STUFFS_TABLE . '
    4040WHERE users LIKE "%' . $user['status'] . '%"
     
    6868  function process_modules()
    6969  {
     70    global $pwg_loaded_plugins;
     71
    7072    foreach ($this->modules as $module)
    7173    {
    72       if ($module['type'] == 'MainBlock')
    73       {
    74                 $this->pos = 'end';
     74      if ($module['name'] == 'MainBlock')
     75      {
     76        $this->pos = 'end';
    7577        if (!empty($module['datas'])
    7678          and $datas = unserialize($module['datas'])
     
    7981          add_event_handler('loc_end_index', 'hide_main_block');
    8082        }
    81                 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;
    87         }
    88 
    89         $datas = (!empty($module['datas']) ? unserialize($module['datas']) : false);
     83        continue;
     84      }
     85      if (isset($module['parent']) and !isset($pwg_loaded_plugins[$module['parent']]))
     86      {
     87        continue;
     88      }
     89      if (!empty($module['groups']))
     90      {
     91        $authorized_groups = explode(',', $module['groups']);
     92        if (array_intersect($this->user_groups, $authorized_groups) == array()) continue;
     93      }
     94
     95      $datas = (!empty($module['datas']) ? unserialize($module['datas']) : false);
    9096      $block = array();
    9197
    92         if ((include(STUFFS_PATH . 'modules/' . $module['type'] . '/main.inc.php')) === false) continue;
    93 
    94       $block['ID'] = $module['id'];
    95       if ($module['show_title'] == 'true')
    96       {
    97         $block['TITLE'] = trigger_event('render_stuffs_name', $module['name']);
    98       }
    99       if (is_admin())
    100       {
    101         $block['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'];
    102       }
    103       $block['TEMPLATE'] = 'stuffs_'.strtolower($module['type']).'.tpl';
    104         $this->set_tpl_block($block, $module);
     98      include($module['path'].'main.inc.php');
     99
     100      if (!empty($block['TEMPLATE']))
     101      {
     102        $block['ID'] = $module['id'];
     103        if ($module['show_title'] == 'true')
     104        {
     105          $block['TITLE'] = trigger_event('render_stuffs_name', $module['name']);
     106        }
     107        if (is_admin())
     108        {
     109          $block['U_EDIT'] = PHPWG_ROOT_PATH.'admin.php?page=plugin&amp;section='.STUFFS_DIR.'%2Fadmin%2Fadmin.php&amp;tab=edit_module&amp;edit='.$module['id'].'&amp;redirect='.urlencode(urlencode($_SERVER['REQUEST_URI']));
     110        }
     111        $this->set_tpl_block($block, $module);
     112      }
    105113    }
    106114  }
    107115  /* Set template blocks  */
    108         function set_tpl_block($block, $module)
    109         {
    110                 if (!empty($module['id_line']))
     116  function set_tpl_block($block, $module)
     117  {
     118    if (!empty($module['id_line']))
    111119    {
    112120      $block['id_line'] = $module['id_line'];
     
    172180    $block['end_line'] = true;
    173181    $block['CLASS'] = 'middle_block';
    174         $this->blocks[$this->pos][] = $block;
    175         }
     182    $this->blocks[$this->pos][] = $block;
     183  }
    176184
    177185  static function prefilter_index_css($source, &$smarty)
  • extensions/PWG_Stuffs/include/functions.inc.php

    r7402 r9369  
    77  function get_user_language_desc($desc)
    88  {
    9         global $user;
     9    global $user;
    1010   
    11         $user_lang = substr($user['language'], 0, 2);
     11    $user_lang = substr($user['language'], 0, 2);
    1212
    13         if (!substr_count(strtolower($desc), '[lang=' . $user_lang . ']'))
    14         {
    15                 $user_lang = 'default';
     13    if (!substr_count(strtolower($desc), '[lang=' . $user_lang . ']'))
     14    {
     15      $user_lang = 'default';
    1616    }
    1717   
    1818    if (substr_count(strtolower($desc), '[lang=' . $user_lang . ']'))
    19         {
     19    {
    2020      // la balise avec la langue de l'utilisateur a été trouvée
    2121      $patterns[] = '#(^|\[/lang\])(.*?)(\[lang=(' . $user_lang . '|all)\]|$)#is';
  • extensions/PWG_Stuffs/include/stuffs.inc.php

    r5727 r9369  
    3030{
    3131  $template->assign('blocks', $stuffs->blocks['begin']);
    32   $template->concat($begin,     $template->parse('stuffs', true));
     32  $template->concat($begin,  $template->parse('stuffs', true));
    3333}
    3434if (!empty($stuffs->blocks['end']))
    3535{
    3636  $template->assign('blocks', $stuffs->blocks['end']);
    37   $template->concat($end,       $template->parse('stuffs', true));
     37  $template->concat($end,  $template->parse('stuffs', true));
    3838}
    3939
  • extensions/PWG_Stuffs/language/ar_SA/plugin.lang.php

    r8677 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'لم تختر اية موديول';
    4141$lang['stuffs_no_name'] = 'يجب ان تحدد اسم الموديول';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/language/cs_CZ/plugin.lang.php

    r7340 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Nevybrali jste žádný modul.';
    4141$lang['stuffs_no_name'] = 'Musíte zadat název modulu';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/language/de_DE/plugin.lang.php

    r7352 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Sie haben kein Modul ausgewählt.';
    4141$lang['stuffs_no_name'] = 'Sie müssen dem Modul einen Titel geben';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/en_UK/plugin.lang.php

    r7340 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'You didn\'t select any module.';
    4141$lang['stuffs_no_name'] = 'You must specify name module';
     42$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/es_ES/plugin.lang.php

    r7348 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Usted no seleccionó ningun módulo a añadir.';
    4141$lang['stuffs_no_name'] = 'Usted debe indicar por lo menos un nombre para el módulo';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9293
    9394//------------------------------------------------------------------------------
    94 //                                                      Module Piclenswall
     95//              Module Piclenswall
    9596//------------------------------------------------------------------------------
    9697
     
    108109
    109110//------------------------------------------------------------------------------
    110 //                                                      Module Most Visited
     111//              Module Most Visited
    111112//------------------------------------------------------------------------------
    112113
     
    125126
    126127//------------------------------------------------------------------------------
    127 //                                                      Module Best Rated
     128//              Module Best Rated
    128129//------------------------------------------------------------------------------
    129130
     
    132133
    133134//------------------------------------------------------------------------------
    134 //                                                      Module Recent
     135//              Module Recent
    135136//------------------------------------------------------------------------------
    136137
     
    139140
    140141//------------------------------------------------------------------------------
    141 //                                                      Module Random
     142//              Module Random
    142143//------------------------------------------------------------------------------
    143144
     
    146147
    147148//------------------------------------------------------------------------------
    148 //                                                      Module Citation
     149//              Module Citation
    149150//------------------------------------------------------------------------------
    150151
     
    155156
    156157//------------------------------------------------------------------------------
    157 //                                                      Module Featured Photos
     158//              Module Featured Photos
    158159//------------------------------------------------------------------------------
    159160
  • extensions/PWG_Stuffs/language/fr_FR/plugin.lang.php

    r7340 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Vous n\'avez pas sélectionné de module à ajouter.';
    4141$lang['stuffs_no_name'] = 'Vous devez indiquer un nom pour le module';
     42$lang['stuffs_parent_plugin_is_missing'] = 'LE PLUGIN PARENT N\'EST PLUS ACTIVÉ. Veuillez supprimer ce module ou réactiver le plugin parent.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/hr_HR/plugin.lang.php

    r7340 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Niste odabrali niti jedan modul.';
    4141$lang['stuffs_no_name'] = 'Morate navesti naziv modula';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/language/hu_HU/plugin.lang.php

    r7411 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Nincs modul kiválasztva.';
    4141$lang['stuffs_no_name'] = 'Meg kell adni a modul címét';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/it_IT/plugin.lang.php

    r7434 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Non avete selezionato un modulo da aggiungere.';
    4141$lang['stuffs_no_name'] = 'E\' necessario specificare il nome del modulo';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/ja_JP/plugin.lang.php

    r7340 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'あなたは、モジュールを選択していません。';
    4141$lang['stuffs_no_name'] = 'あなたは、モジュール名を指定する必要があります。';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/pl_PL/plugin.lang.php

    r7431 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Nie został wybrany żaden moduł.';
    4141$lang['stuffs_no_name'] = 'Musisz podać nazwę modułu';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/language/pt_PT/plugin.lang.php

    r9042 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Não seleccionou um módulo.';
    4141$lang['stuffs_no_name'] = 'Deverá especificar um nome para o módulo';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/language/ru_RU/plugin.lang.php

    r7452 r9369  
    4141$lang['stuffs_error_no_mod_selected'] = 'Вы не выбрали модуль для добавления.';
    4242$lang['stuffs_no_name'] = 'Пожалуйста, введите хотя бы одно имя для модуля.';
     43/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4344
    4445//------------------------------------------------------------------------------
    45 //                                                      Module LastComs
     46//              Module LastComs
    4647//------------------------------------------------------------------------------
    4748
     
    6667
    6768//------------------------------------------------------------------------------
    68 //                                                      Module Logon
     69//              Module Logon
    6970//------------------------------------------------------------------------------
    7071
     
    7677
    7778//------------------------------------------------------------------------------
    78 //                                                      Module Personal
     79//              Module Personal
    7980//------------------------------------------------------------------------------
    8081
     
    8687
    8788//------------------------------------------------------------------------------
    88 //                                                      Module Tags
     89//              Module Tags
    8990//------------------------------------------------------------------------------
    9091
     
    99100
    100101//------------------------------------------------------------------------------
    101 //                                                      Module Piclenswall
     102//              Module Piclenswall
    102103//------------------------------------------------------------------------------
    103104
     
    115116
    116117//------------------------------------------------------------------------------
    117 //                                                      Module Most Visited
     118//              Module Most Visited
    118119//------------------------------------------------------------------------------
    119120
     
    132133
    133134//------------------------------------------------------------------------------
    134 //                                                      Module Best Rated
     135//              Module Best Rated
    135136//------------------------------------------------------------------------------
    136137
     
    139140
    140141//------------------------------------------------------------------------------
    141 //                                                      Module Recent
     142//              Module Recent
    142143//------------------------------------------------------------------------------
    143144
     
    146147
    147148//------------------------------------------------------------------------------
    148 //                                                      Module Random
     149//              Module Random
    149150//------------------------------------------------------------------------------
    150151
     
    153154
    154155//------------------------------------------------------------------------------
    155 //                                                      Module Citation
     156//              Module Citation
    156157//------------------------------------------------------------------------------
    157158
     
    162163
    163164//------------------------------------------------------------------------------
    164 //                                                      Module Featured Photos
     165//              Module Featured Photos
    165166//------------------------------------------------------------------------------
    166167
  • extensions/PWG_Stuffs/language/sk_SK/plugin.lang.php

    r7340 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Neoznačili ste žiaden modul.';
    4141$lang['stuffs_no_name'] = 'Musíte určiť názov modulu';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/language/sv_SE/plugin.lang.php

    r7825 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Ingen kategori markerad.';
    4141$lang['stuffs_no_name'] = 'Specifiera namn på enheten';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
    44 //                                                      Module LastComs
     45//              Module LastComs
    4546//------------------------------------------------------------------------------
    4647
     
    6061
    6162//------------------------------------------------------------------------------
    62 //                                                      Module Logon
     63//              Module Logon
    6364//------------------------------------------------------------------------------
    6465
     
    7071
    7172//------------------------------------------------------------------------------
    72 //                                                      Module Personal
     73//              Module Personal
    7374//------------------------------------------------------------------------------
    7475
     
    8081
    8182//------------------------------------------------------------------------------
    82 //                                                      Module Tags
     83//              Module Tags
    8384//------------------------------------------------------------------------------
    8485
     
    9394
    9495//------------------------------------------------------------------------------
    95 //                                                      Module Piclenswall
     96//              Module Piclenswall
    9697//------------------------------------------------------------------------------
    9798
     
    109110
    110111//------------------------------------------------------------------------------
    111 //                                                      Module Most Visited
     112//              Module Most Visited
    112113//------------------------------------------------------------------------------
    113114
     
    126127
    127128//------------------------------------------------------------------------------
    128 //                                                      Module Best Rated
     129//              Module Best Rated
    129130//------------------------------------------------------------------------------
    130131
     
    133134
    134135//------------------------------------------------------------------------------
    135 //                                                      Module Recent
     136//              Module Recent
    136137//------------------------------------------------------------------------------
    137138
     
    140141
    141142//------------------------------------------------------------------------------
    142 //                                                      Module Random
     143//              Module Random
    143144//------------------------------------------------------------------------------
    144145
     
    147148
    148149//------------------------------------------------------------------------------
    149 //                                                      Module Citation
     150//              Module Citation
    150151//------------------------------------------------------------------------------
    151152
     
    156157
    157158//------------------------------------------------------------------------------
    158 //                                                      Module Featured Photos
     159//              Module Featured Photos
    159160//------------------------------------------------------------------------------
    160161
  • extensions/PWG_Stuffs/language/tr_TR/plugin.lang.php

    r9040 r9369  
    4040$lang['stuffs_error_no_mod_selected'] = 'Bir modül seçmediniz.';
    4141$lang['stuffs_no_name'] = 'Modül için bir isim belirtmelisiniz';
     42/*TODO*/$lang['stuffs_parent_plugin_is_missing'] = 'PARENT PLUGIN IS NOT ACTIVATED. You should remove this module or re-activate parent plugin.';
    4243
    4344//------------------------------------------------------------------------------
  • extensions/PWG_Stuffs/main.inc.php

    r7402 r9369  
    22/*
    33Plugin Name: PWG Stuffs
    4 Version: 2.0.q
     4Version: auto
    55Description: Insert modules on your gallery
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=190
     
    88Author URI: http://www.gauchon.com
    99*/
     10
     11define('STUFFS_VERSION', '2.1.m');
    1012
    1113if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     
    1618define('STUFFS_PATH' , PHPWG_PLUGINS_PATH . STUFFS_DIR . '/');
    1719define('STUFFS_TABLE' , $prefixeTable . 'stuffs');
     20
     21// Need upgrade?
     22if ($plugin['version'] != STUFFS_VERSION)
     23  include('admin/upgrade.inc.php');
    1824
    1925function stuffs_admin_menu($menu)
     
    2733function set_stuffs_on_index()
    2834{
    29         global $page;
     35  global $page;
    3036
    3137  if (isset($page['section']) and $page['section'] == 'categories')
    3238  {
    3339    include_once(STUFFS_PATH . 'include/stuffs.inc.php');
    34         }
     40  }
    3541}
    3642
    3743function set_stuffs_on_picture()
    3844{
    39         include_once(STUFFS_PATH . 'include/stuffs.inc.php');
     45  include_once(STUFFS_PATH . 'include/stuffs.inc.php');
    4046}
    4147
  • extensions/PWG_Stuffs/maintain.inc.php

    r3609 r9369  
    1717`descr` varchar(255) default NULL,
    1818`type` varchar(255) NOT NULL,
     19`path` varchar(255) default NULL,
    1920`datas` longtext default NULL,
    2021`users` varchar(255) default NULL,
     
    3334    pwg_query($q);
    3435 
    35     $q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `descr`, `type`, `datas`, `users`, `groups`, `show_title`, `on_home`, `on_cats`, `on_picture`, `id_line`, `width`)
    36 VALUES (0, 1, 'MainBlock', NULL, 'MainBlock', NULL, 'guest,generic,normal,admin,webmaster', NULL, 'true', 'true', 'true', 'true', NULL, NULL);";
     36    $q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `descr`, `type`, `path`, `datas`, `users`, `groups`, `show_title`, `on_home`, `on_cats`, `on_picture`, `id_line`, `width`)
     37VALUES (0, 1, 'MainBlock', NULL, 'MainBlock', NULL, NULL, 'guest,generic,normal,admin,webmaster', NULL, 'true', 'true', 'true', 'true', NULL, NULL);";
    3738    pwg_query($q);
    3839  }
    3940}
    4041
    41 function plugin_activate()
     42function plugin_activate($id, $version)
    4243{
    43   global $prefixeTable;
     44  global $plugins, $prefixeTable;
    4445
    4546  // Check if upgrade is needed
    46   $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'stuffs;';
    47   $result = array_from_query($query, 'Field');
    48   if ($result[5] == 'params')
     47  if ($version != $plugins->fs_plugins[$id]['version'])
    4948  {
    50     upgrade_stuffs_from_17();
     49    define('STUFFS_VERSION', $plugins->fs_plugins[$id]['version']);
     50    include('admin/upgrade.inc.php');
    5151  }
    5252}
     
    5656    global $prefixeTable;
    5757
    58         $q = 'DROP TABLE ' . $prefixeTable . 'stuffs;';
     58  $q = 'DROP TABLE ' . $prefixeTable . 'stuffs;';
    5959    pwg_query($q);
    6060}
    6161
    62 function upgrade_stuffs_from_17()
    63 {
    64   global $prefixeTable, $conf;
    65 
    66   $query = 'ALTER TABLE ' . $prefixeTable . 'stuffs
    67 MODIFY COLUMN name TEXT CHARACTER SET utf8 NOT NULL,
    68 MODIFY COLUMN descr VARCHAR(255) CHARACTER SET utf8 default NULL,
    69 MODIFY COLUMN type VARCHAR(255) CHARACTER SET utf8 NOT NULL,
    70 MODIFY COLUMN params VARCHAR(255) CHARACTER SET utf8 default NULL,
    71 MODIFY COLUMN datas LONGTEXT CHARACTER SET utf8 default NULL,
    72 MODIFY COLUMN users VARCHAR(255) CHARACTER SET utf8 default NULL,
    73 MODIFY COLUMN groups VARCHAR(255) CHARACTER SET utf8 default NULL,
    74 DEFAULT CHARACTER SET utf8,
    75 ADD show_title ENUM(\'true\',\'false\') NOT NULL,
    76 ADD on_home ENUM(\'true\',\'false\') NOT NULL,
    77 ADD on_cats ENUM(\'true\',\'false\') NOT NULL,
    78 ADD on_picture ENUM(\'true\',\'false\') NOT NULL,
    79 ADD id_line VARCHAR(1) default NULL,
    80 ADD width SMALLINT(9) default NULL,
    81 ADD INDEX (on_home),
    82 ADD INDEX (on_cats),
    83 ADD INDEX (on_picture);';
    84 
    85   pwg_query($query);
    86  
    87   $query = 'SELECT id, name, type, params, datas FROM ' . $prefixeTable . 'stuffs;';
    88   $result = pwg_query($query);
    89  
    90   $modules = array();
    91   while ($row = mysql_fetch_assoc($result))
    92   {
    93     if ($row['name'] != 'MainBlock')
    94     {
    95       $array = array();
    96       foreach (explode('///', $row['name']) as $name)
    97       {
    98         $a = explode(':', $name);
    99         array_push($array, '[lang='.substr($a[0],0,2).']'.$a[1].'[/lang]');
    100       }
    101       $new_name = implode("\r\n", $array);
    102     }
    103     else
    104     {
    105       $new_name = 'MainBlock';
    106     }
    107 
    108     if ($row['type'] == 'LastComs')
    109     {
    110       $datas = unserialize($row['datas']);
    111       $row['datas'] = serialize(array($datas[0], $datas[1], $datas[6], $datas[2], $datas[3]));
    112     }
    113  
    114     $params = explode(',', $row['params']);
    115     $params[4] = !empty($params[4]) ? '"'.$params[4].'"' : 'NULL';
    116     $params[5] = !empty($params[5]) ? $params[5] : 'NULL';
    117 
    118     $query = 'UPDATE ' . $prefixeTable . 'stuffs
    119 SET
    120   name = "'. $new_name . '",
    121   datas = "' . addslashes($row['datas']) . '",
    122   show_title = "'. ($params[0] ? 'true' : 'false') .'",
    123   on_home = "'. ($params[1] ? 'true' : 'false') .'",
    124   on_cats = "'. ($params[2] ? 'true' : 'false') .'",
    125   on_picture = "'. ($params[3] ? 'true' : 'false') .'",
    126   id_line = '. $params[4] .',
    127   width = '. $params[5] .'
    128 WHERE id = '.$row['id'].';';
    129 
    130     pwg_query($query);
    131   }
    132 
    133   $query = 'ALTER TABLE ' . $prefixeTable . 'stuffs DROP params;';
    134   pwg_query($query);
    135 
    136   if (isset($conf['Stuffs']))
    137   {
    138           $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="Stuffs" LIMIT 1;';
    139     pwg_query($q);
    140   }
    141 }
    142 
    143 
    14462?>
  • extensions/PWG_Stuffs/modules/BestRated/main.inc.php

    r3609 r9369  
    155155
    156156  $block['CONTENT'] = $template->parse('pwgs_best_rated', true);
     157  $block['TEMPLATE'] = 'stuffs_bestrated.tpl';
    157158}
    158159else
  • extensions/PWG_Stuffs/modules/Citation/main.inc.php

    r3694 r9369  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3
    34global $user;
    45
    56if ((isset($datas['quote_lang'][$user['language']])) and
    6     ("" != $datas['quote_lang'][$user['language']])) {
     7  ("" != $datas['quote_lang'][$user['language']]))
     8{
    79  $block['CONTENT'] = $datas['quote_lang'][$user['language']];
    8 } else {
    9   return false;
     10  $block['TEMPLATE'] = 'stuffs_citation.tpl';
    1011}
    1112?>
  • extensions/PWG_Stuffs/modules/FeaturedPhotos/main.inc.php

    r4981 r9369  
    136136
    137137  $block['CONTENT'] = $template->parse('pwgs_feat', true);
    138 }
    139 else
    140 {
    141   return false;
     138  $block['TEMPLATE'] = 'stuffs_featuredphotos.tpl';
    142139}
    143140
  • extensions/PWG_Stuffs/modules/LastComs/main.inc.php

    r4540 r9369  
    179179    array_push($block['comments'], $tpl_comment);
    180180  }
    181 }
    182 else
    183 {
    184   return false;
     181  $block['TEMPLATE'] = 'stuffs_lastcoms.tpl';
    185182}
    186183
  • extensions/PWG_Stuffs/modules/Logon/config.inc.php

    r3609 r9369  
    1010// Enregistrement de la configuration
    1111if (isset($_POST['submit']) and !is_adviser()) {
    12         if (!isset($_POST['remove_menubar_block'])) $_POST['remove_menubar_block']  = '0';
     12  if (!isset($_POST['remove_menubar_block'])) $_POST['remove_menubar_block']  = '0';
    1313    $datas = array($_POST['remove_menubar_block']);
    1414}
  • extensions/PWG_Stuffs/modules/Logon/main.inc.php

    r3609 r9369  
    22
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4 if (!is_a_guest()) return false;
     4
     5if (!is_a_guest()) return;
    56
    67global $conf;
     
    3031}
    3132
     33$block['TEMPLATE'] = 'stuffs_logon.tpl';
     34
    3235?>
  • extensions/PWG_Stuffs/modules/MostVisited/main.inc.php

    r3609 r9369  
    160160
    161161  $block['CONTENT'] = $template->parse('pwgs_most_visited', true);
    162 }
    163 else
    164 {
    165   return false;
     162  $block['TEMPLATE'] = 'stuffs_mostvisited.tpl';
    166163}
    167164
  • extensions/PWG_Stuffs/modules/Personal/config.inc.php

    r3609 r9369  
    77// Enregistrement de la configuration
    88if (isset($_POST['submit']) and !is_adviser()) {
    9         $datas = array(stripslashes($_POST['personal_content']));
     9  $datas = array(stripslashes($_POST['personal_content']));
    1010}
    1111
  • extensions/PWG_Stuffs/modules/Personal/main.inc.php

    r3609 r9369  
    1515}
    1616
     17$block['TEMPLATE'] = 'stuffs_personal.tpl';
     18
    1719?>
  • extensions/PWG_Stuffs/modules/Random/main.inc.php

    r3609 r9369  
    154154
    155155  $block['CONTENT'] = $template->parse('pwgs_random', true);
    156 }
    157 else
    158 {
    159   return false;
     156  $block['TEMPLATE'] = 'stuffs_random.tpl';
    160157}
    161158
  • extensions/PWG_Stuffs/modules/Recent/main.inc.php

    r8625 r9369  
    150150
    151151  $block['CONTENT'] = $template->parse('pwgs_recent', true);
    152 }
    153 else
    154 {
    155   return false;
     152  $block['TEMPLATE'] = 'stuffs_recent.tpl';
    156153}
    157154
  • extensions/PWG_Stuffs/modules/Tags/main.inc.php

    r3609 r9369  
    148148}
    149149
     150$block['TEMPLATE'] = 'stuffs_tags.tpl';
     151
    150152?>
  • extensions/PWG_Stuffs/modules/piclenswall/main.inc.php

    r8813 r9369  
    2121  else
    2222  {
    23         // remplacement naviagation ne doit pas etre active et mis en place sur la page...
    24                 if (!@$obj->my_config['piclens_wall_nav'] or !@in_array($page['category']['id'], $obj->my_config['piclens_wall_cat_nav_replace']))
    25                 {                               
    26                         if (@$obj->my_config['piclens_wall_specif'] == 'common') // pas de specificites 3DWall : utilisation des parametres piclens
     23  // remplacement naviagation ne doit pas etre active et mis en place sur la page...
     24    if (!@$obj->my_config['piclens_wall_nav'] or !@in_array($page['category']['id'], $obj->my_config['piclens_wall_cat_nav_replace']))
     25    {       
     26      if (@$obj->my_config['piclens_wall_specif'] == 'common') // pas de specificites 3DWall : utilisation des parametres piclens
    2727      {
    28                                 $rssfeed = $obj->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/category/'.(empty($page['category']['permalink']) ? $page['category']['id'] : $page['category']['permalink']);
     28        $rssfeed = $obj->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/category/'.(empty($page['category']['permalink']) ? $page['category']['id'] : $page['category']['permalink']);
    2929      }
    30                         elseif (@in_array($page['category']['id'], $obj->my_config['piclens_wall_categories']))
    31                         {
    32                                 //  categorie pour laquelle le mur est parametre.
    33                                 $rssfeed = $obj->root_site_piclens.PICLENS_PATH.'piclenswall-rss.php?/category/'.(empty($page['category']['permalink']) ? $page['category']['id'] : $page['category']['permalink']);
    34                         }
    35                 }
     30      elseif (@in_array($page['category']['id'], $obj->my_config['piclens_wall_categories']))
     31      {
     32        //  categorie pour laquelle le mur est parametre.
     33        $rssfeed = $obj->root_site_piclens.PICLENS_PATH.'piclenswall-rss.php?/category/'.(empty($page['category']['permalink']) ? $page['category']['id'] : $page['category']['permalink']);
     34      }
     35    }
    3636  }
    3737  $block['RSSFEED'] = $rssfeed;
     
    7777
    7878    if (isset($obj->my_config['piclens_wall_tutorial']) and !empty($obj->my_config['piclens_wall_tutorial']))
    79         $block['tutorial'] = (empty($obj->my_config['piclens_wall_tutorialtime']) ? "4500" : @$obj->my_config['piclens_wall_tutorialtime']).','.@$obj->my_config['piclens_wall_tutorial'];             
     79        $block['tutorial'] = (empty($obj->my_config['piclens_wall_tutorialtime']) ? "4500" : @$obj->my_config['piclens_wall_tutorialtime']).','.@$obj->my_config['piclens_wall_tutorial'];   
    8080
    8181
    82         if (isset($obj->my_config['piclens_wall_customButtonURL']) and !empty($obj->my_config['piclens_wall_customButtonURL']))
     82  if (isset($obj->my_config['piclens_wall_customButtonURL']) and !empty($obj->my_config['piclens_wall_customButtonURL']))
    8383        $block['customButton'] = @$obj->my_config['piclens_wall_customButtonURL'].(empty($obj->my_config['piclens_wall_customButtonTARGET']) ? ','.PICLENS_PATH : ','.@$obj->my_config['piclens_wall_customButtonTARGET']);
    8484
     
    8686        $block['icons'] = @$obj->my_config['piclens_wall_icons'];
    8787    if (isset($obj->my_config['piclens_wall_linkCSS']) and !empty($obj->my_config['piclens_wall_linkCSS']))
    88         $block['icons'] = @$obj->my_config['piclens_wall_linkCSS']; 
     88        $block['icons'] = @$obj->my_config['piclens_wall_linkCSS'];
    8989
    90  
     90  $block['TEMPLATE'] = 'stuffs_piclenswall.tpl';
    9191}
    92 else
    93 {
    94   return false;
    95 }
    96        
     92
    9793?>
Note: See TracChangeset for help on using the changeset viewer.