Changeset 9383 for extensions/PWG_Stuffs/admin/add_module.inc.php
- Timestamp:
- Feb 26, 2011, 4:28:24 PM (13 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/PWG_Stuffs/admin/add_module.inc.php
r9369 r9383 30 30 $desc = !empty($_POST['module_desc']) ? '"' . $_POST['module_desc'] . '"' : 'NULL'; 31 31 $groups = !empty($_POST['groups']) ? '"' . implode(',', $_POST['groups']) . '"' : 'NULL'; 32 $users = !empty($_POST['users']) ? '"' . implode(',', $_POST['users']) . '"' : 'NULL'; 32 $users = 'NULL'; 33 if ($conf['Stuffs']['user_perm']) 34 { 35 $users = !empty($_POST['users']) ? '"' . implode(',', $_POST['users']) . '"' : '""'; 36 } 33 37 $show_title = isset($_POST['show_title']) ? '"true"' : '"false"'; 34 38 $on_home = isset($_POST['on_home']) ? '"true"' : '"false"'; 39 $on_root = isset($_POST['on_root']) ? '"true"' : '"false"'; 35 40 $on_cats = isset($_POST['on_cats']) ? '"true"' : '"false"'; 36 41 $on_picture = isset($_POST['on_picture']) ? '"true"' : '"false"'; … … 49 54 show_title=' . $show_title .', 50 55 on_home=' . $on_home .', 56 on_root=' . $on_root .', 51 57 on_cats=' . $on_cats . ', 52 58 on_picture='. $on_picture . ' … … 66 72 67 73 $query = ' 68 INSERT INTO ' . STUFFS_TABLE . ' ( id, pos, name, descr, path, parent, datas, users, groups, show_title, on_home, on_ cats, on_picture, id_line, width )74 INSERT INTO ' . STUFFS_TABLE . ' ( id, pos, name, descr, path, parent, datas, users, groups, show_title, on_home, on_root, on_cats, on_picture, id_line, width ) 69 75 VALUES (' . $next_element_id . ' , 70 76 ' . $pos . ', … … 78 84 ' . $show_title . ', 79 85 ' . $on_home . ', 86 ' . $on_root . ', 80 87 ' . $on_cats . ', 81 88 ' . $on_picture . ', … … 94 101 $module['users'] = array('guest', 'generic', 'normal', 'admin', 'webmaster'); 95 102 $module['groups'] = array(); 103 96 104 $template->assign(array( 97 105 'STUFFS_TITLE' => l10n('stuffs_add_mod'), 98 106 'MODULE_NAME' => $modules[$module_path]['name'], 99 'show_title_CHECKED' => 'checked="checked"', 100 'on_home_CHECKED' => 'checked="checked"')); 107 'show_title_CHECKED' => true, 108 ) 109 ); 110 111 $template->assign('selected_options', array( 112 'on_home' => true, 113 'on_root' => true, 114 'on_cats' => false, 115 'on_picture' => false, 116 ) 117 ); 101 118 } 102 119 103 120 // Users perm 104 $template->assign('user_perm', array( 105 'GUEST' => (in_array('guest', $module['users']) ? 'checked="checked"' : ''), 106 'GENERIC' => (in_array('generic', $module['users']) ? 'checked="checked"' : ''), 107 'NORMAL' => (in_array('normal', $module['users']) ? 'checked="checked"' : ''), 108 'ADMIN' => (in_array('admin', $module['users']) ? 'checked="checked"' : ''), 109 'WEBMASTER' => (in_array('webmaster', $module['users']) ? 'checked="checked"' : ''))); 121 if ($conf['Stuffs']['user_perm']) 122 { 123 $users_id = array('guest', 'generic', 'normal', 'admin', 'webmaster'); 124 $users = array(); 125 foreach ($users_id as $id) 126 { 127 $users[$id] = l10n('user_status_'.$id); 128 } 129 $template->assign(array( 130 'users' => $users, 131 'selected_users' => isset($module['users']) ? $module['users'] : $users_id, 132 ) 133 ); 134 } 110 135 111 136 // Groups perm 112 $groups = get_all_groups(); 113 if (!empty($groups)) 137 if ($conf['Stuffs']['group_perm']) 114 138 { 115 $template->assign('group_perm', array('GROUPSELECTION' => get_html_groups_selection($groups, 'groups', $module['groups']))); 139 $query = 'SELECT id, name FROM '.GROUPS_TABLE.' ORDER BY name ASC;'; 140 $result = pwg_query($query); 141 $groups = array(); 142 while ($row = pwg_db_fetch_assoc($result)) 143 { 144 $groups[$row['id']] = $row['name']; 145 } 146 $template->assign(array( 147 'groups' => $groups, 148 'selected_groups' => isset($module['groups']) ? $module['groups'] : array(), 149 ) 150 ); 116 151 } 152 153 // Level perm 154 if ($conf['Stuffs']['level_perm']) 155 { 156 foreach ($conf['available_permission_levels'] as $level) 157 { 158 $level_options[$level] = l10n(sprintf('Level %d', $level)); 159 } 160 $template->assign(array( 161 'level_perm' => $level_options, 162 'level_selected' => isset($module['level']) ? $module['level'] : 0, 163 ) 164 ); 165 } 166 167 // Display options 168 $template->assign('display_options', array( 169 'on_home' => true, 170 'on_root' => true, 171 'on_cats' => true, 172 'on_picture' => true, 173 ) 174 ); 117 175 118 176 // Module configuration
Note: See TracChangeset
for help on using the changeset viewer.