Changeset 7855
- Timestamp:
- Nov 23, 2010, 3:59:11 PM (13 years ago)
- Location:
- extensions/PWG_Stuffs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PWG_Stuffs/admin/add_module.php
r7540 r7855 9 9 load_language('plugin.lang', STUFFS_PATH); 10 10 11 if (!isset($_GET['type']) or ($_GET['type'] != 'MainBlock' and !is_dir(STUFFS_PATH . 'modules/' . $_GET['type'])))11 if (!isset($_GET['type']) or !is_dir(STUFFS_PATH . 'modules/' . $_GET['type'])) 12 12 { 13 13 die('Wrong parameters...'); … … 24 24 if (isset($_POST['submit']) and !is_adviser()) 25 25 { 26 @include(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');26 include(STUFFS_PATH . 'modules/' . $type . '/config.inc.php'); 27 27 if (empty($page['errors'])) 28 28 { 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 }37 29 if (empty($_POST['module_name'])) 38 30 { … … 113 105 $template->assign(array( 114 106 'STUFFS_TITLE' => l10n('stuffs_edit_mod') . ' <i>' . trigger_event('render_stuffs_name', $module['name']) . '</i>', 115 'MODULE_ID' => $_GET['edit'],116 107 'MODULE_NAME' => $module['name'], 117 108 'DESC_VALUE' => (isset($module['descr']) ? $module['descr'] : ''), … … 148 139 149 140 // Configuration du module 150 @include_once(STUFFS_PATH . 'modules/' . $type . '/config.inc.php');141 include_once(STUFFS_PATH . 'modules/' . $type . '/config.inc.php'); 151 142 152 143 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/add_module.tpl')); -
extensions/PWG_Stuffs/admin/manage.php
r7540 r7855 19 19 } 20 20 21 pwg_query(' 22 UPDATE ' . STUFFS_TABLE . ' 23 SET datas = "'.addslashes(serialize(array('hide' => isset($_POST['hidemb'])))).'" 24 WHERE id=0;'); 25 21 26 array_push($page['infos'], l10n('stuffs_order_saved')); 22 27 } 23 28 24 29 // 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 26 31 FROM ' . STUFFS_TABLE . ' 27 32 ORDER BY pos ASC;'; … … 59 64 'ID' => $module['id'], 60 65 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadd_module.php&type=' . $module['type'] . '&edit=' . $module['id'], 61 'U_DELETE' => !is_adviser() and $module['id'] != 0? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&del=' . $module['id'] : '',66 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&del=' . $module['id'] : '', 62 67 )); 68 69 if ($module['type'] == 'MainBlock' and !empty($module['datas'])) 70 { 71 $datas = unserialize($module['datas']); 72 $template->assign('HIDEMB', $datas['hide']); 73 } 63 74 } 64 75 -
extensions/PWG_Stuffs/admin/template/add_module.tpl
r7540 r7855 11 11 <fieldset> 12 12 <legend>{'stuffs_module_config'|@translate}</legend> 13 {if $MODULE_ID == 0}<p>{'This module can be hidden only on homepage'|@translate}</p>{/if}14 13 <table> 15 14 16 15 <tr><td colspan="3"><br></td></tr> 17 16 18 {if $MODULE_ID != 0}19 17 <tr> 20 18 <td><b>{'stuffs_module_title'|@translate} </b></td> … … 32 30 <td colspan="2">{'stuffs_only_for_admin'|@translate}</td> 33 31 </tr> 34 {/if}35 32 36 33 <tr><td colspan="3"><br></td></tr> … … 64 61 </fieldset> 65 62 66 {if $MODULE_ID != 0}67 63 <fieldset> 68 64 <legend>{'stuffs_visual_config'|@translate}</legend> … … 85 81 <tr><td colspan="2"><br></td></tr> 86 82 </table> 83 84 87 85 </fieldset> 88 86 … … 91 89 {$MODULE_OPTIONS} 92 90 </fieldset> 93 {/if}94 91 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/></p> 95 92 </form> -
extensions/PWG_Stuffs/admin/template/manage.tpl
r7540 r7855 51 51 52 52 <li class="categoryLi virtual_cat" id="module_{$module.ID}"> 53 {if $module.TYPE != 'MainBlock'} 53 54 <ul class="categoryActions"> 54 {if $module.TYPE != 'MainBlock'}55 55 <li class="stuffs_line"> 56 56 {'stuffs_id_ligne'|@translate} … … 63 63 <input type="text" size="2" maxlength="2" value="{$module.WIDTH}" name="width[{$module.ID}]" > % 64 64 </li> 65 {/if}66 65 <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 66 {if !empty($module.U_DELETE) } … … 69 68 {/if} 70 69 </ul> 70 {/if} 71 71 72 72 <p> … … 78 78 {if !empty($module.DESC)} 79 79 <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}> {'Hide on home page'|@translate}</p> 80 82 {/if} 81 83 -
extensions/PWG_Stuffs/include/class.inc.php
r7541 r7855 36 36 37 37 $query = ' 38 SELECT id, name, type, datas, users,groups, show_title, id_line, width38 SELECT id, name, type, datas, groups, show_title, id_line, width 39 39 FROM ' . STUFFS_TABLE . ' 40 WHERE id = 0 OR ( 41 users LIKE "%' . $user['status'] . '%" 40 WHERE users LIKE "%' . $user['status'] . '%" 42 41 '; 43 42 … … 55 54 else return; 56 55 57 $query .= ' )56 $query .= ' 58 57 ORDER BY pos ASC;'; 59 58 … … 71 70 foreach ($this->modules as $module) 72 71 { 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 79 72 if ($module['type'] == 'MainBlock') 80 73 { 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']) 83 78 { 84 79 add_event_handler('loc_end_index', 'hide_main_block'); 85 80 } 86 $this->pos = 'end';87 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; 88 87 } 89 88
Note: See TracChangeset
for help on using the changeset viewer.