Changeset 4329 for extensions/event_cats/admin/evntcats_admin.php
- Timestamp:
- Nov 20, 2009, 10:56:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/evntcats_admin.php
r4282 r4329 38 38 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 39 39 40 global $template, $conf, $lang, $prefixeTable, $ec_conf, $page, $ec_debug, 41 $ec_lists, // array of following arrays : 42 // $ec_lists['ec_table'] : 43 // Event Cats table, in function of each entry id 44 // $ec_lists['ec_codes'] : // Used ? 45 // array of useful data, in function of entries codes 46 // $ec_lists['add_pages'] : 47 // array of Add. Pages names in function of their id 48 // $ec_lists['categories'] : 49 // array of category names in function of their id 50 // $ec_lists['user_ids'] : 51 // array of usernames in function of their id 52 $ec_ap_ok; // whether Additional Pages is installed and activated 40 global $template, $conf, $lang, $prefixeTable, 41 $ec_conf, $page, $ec_debug, $ec_lists; 53 42 54 43 load_language('plugin.lang', EVNTCATS_PATH); … … 88 77 build_ec_lists(); // in evntcats_main_funcs.php 89 78 90 // If no entry exist, default pageis 'autolog_new'.79 // If no entry exist, default tab is 'autolog_new'. 91 80 $page['tab'] = (!($ec_exist_entries = (mysql_num_rows(pwg_query(" 92 81 SELECT * FROM `".EVNTCATS_TABLE."` … … 94 83 ")) != 0))) ? 'autolog_new' : 'autolog_entries'; 95 84 96 $ec_exist_duplic = ((mysql_num_rows(pwg_query(" 97 SELECT * FROM `".EVNTCATS_TABLE."` 98 WHERE `code` IS NULL 99 AND `arg1` IS NOT NULL 100 AND `arg2` IS NOT NULL ; 101 ")) != 0) or 102 (read_ec_conf('duplic_gen') != 0) or 103 (read_ec_conf('duplic_type') != 0) 104 ); 105 106 // If no entry exist, but some duplication management entries exist, default tab is 'duplication'. 107 if (!$ec_exist_entries and $ec_exist_duplic) $page['tab'] = 'duplication'; 108 109 110 /* 111 112 if (isset($_POST[''])) { 113 } 114 115 116 if (isset($_POST['ec_duplic_conf_submit'])) { 117 } 118 119 if (isset($_POST['deny_groups_submit'])) { 120 } 121 122 if (isset($_POST['grant_groups_submit'])) { 123 } 124 125 if (isset($_POST['deny_types_submit'])) { 126 } 127 128 if (isset($_POST['grant_types_submit'])) { 129 } 130 131 if (isset($_POST['deny_users_submit'])) { 132 } 133 134 if (isset($_POST['grant_users_submit'])) { 135 } 136 137 138 139 140 */ 141 142 143 144 145 146 if (isset($_POST['ec_act1'])) { 85 // If no entry exist, but some duplication management entries exist, default 86 // tab is 'duplication'. 87 if (!$ec_exist_entries and read_ec_conf('dup_allow') == '2') $page['tab'] = 'duplication'; 88 89 // If a modification of duplication management has been posted, default tab 90 // is 'duplication'. 91 if ( 92 count($_POST) > 0 and 93 count(array_intersect(array( 94 'ec_duplic_conf_submit', 95 'deny_groups_submit', 96 'grant_groups_submit', 97 'deny_types_submit', 98 'grant_types_submit', 99 'deny_users_submit', 100 'grant_users_submit', 101 ), 102 array_keys($_POST))) > 0 103 ) $page['tab'] = 'duplication'; 104 105 if (isset($_POST['ec_conf_submit'])) { 106 if (isset($_POST['ec_dup_conf'])) 107 if (!change_ec_conf('dup_allow', $_POST['ec_dup_conf'])) 108 ec_end2(7); 109 if (isset($_POST['ec_dup_disp'])) 110 if (!change_ec_conf('duplic_display', $_POST['ec_dup_disp'])) 111 ec_end2(8); 112 if (isset($_POST['ec_unknown'])) 113 if (!change_ec_conf('unknown_code', $_POST['ec_unknown'])) 114 ec_end2(9); 115 if (isset($_POST['ec_in_up_aps'])) 116 if (!change_ec_conf('unknown_code_ap_id', $_POST['ec_in_up_aps'])) 117 ec_end2(10); 118 $page['tab'] = 'config'; 119 $page['infos'][] = l10n('ec_config_saved'); 120 } 121 elseif (isset($_POST['ec_duplic_conf_submit'])) { 122 if (isset($_POST['ec_dup_conf'])) { 123 if ( 124 read_ec_conf('dup_allow') == '2' and 125 $_POST['ec_dup_conf'] != '2' 126 ) $page['tab'] = 'config'; 127 if (!change_ec_conf('dup_allow', $_POST['ec_dup_conf'])) 128 ec_end2(5); 129 } 130 if (isset($_POST['ec_dup_disp'])) 131 if (!change_ec_conf('duplic_display', $_POST['ec_dup_disp'])) 132 ec_end2(6); 133 $page['infos'][] = l10n('ec_config_saved'); 134 } 135 elseif ( 136 isset($_POST['deny_groups_submit']) and 137 isset($_POST['deny_groups']) and 138 count($_POST['deny_groups']) > 0 139 ) { 140 if (pwg_query(" 141 DELETE 142 FROM `".EVNTCATS_TABLE."` 143 WHERE `arg1` = 1 144 AND `arg2` IN (".implode(',', $_POST['deny_groups'])."); 145 ") === false) ec_end2(1); 146 else $page['infos'][] = l10n('ec_config_saved'); 147 } 148 elseif ( 149 isset($_POST['grant_groups_submit']) and 150 isset($_POST['grant_groups']) and 151 count($_POST['grant_groups']) > 0 152 ) { 153 $inserts = array(); 154 foreach ($_POST['grant_groups'] as $v) $inserts[] = array( 155 'arg1' => 1, 156 'arg2' => intval($v) 157 ); 158 mass_inserts(EVNTCATS_TABLE, array('arg1', 'arg2'), $inserts); 159 $page['infos'][] = l10n('ec_config_saved'); 160 } 161 elseif ( 162 isset($_POST['deny_types_submit']) and ( 163 isset($_POST['deny_types']) and 164 count($_POST['deny_types']) > 0 or 165 isset($_POST['deny_generic']) 166 ) 167 ) { 168 $c = ($no_previous = (count($t = mysql_fetch_row(pwg_query(" 169 SELECT `arg2` 170 FROM `".EVNTCATS_TABLE."` 171 WHERE `code` IS NULL 172 AND `arg1` = 3 173 AND `arg2` IS NOT NULL 174 LIMIT 1; 175 "))) == 0)) ? 0 : intval($t[0]); 176 if (isset($_POST['deny_types'])) 177 foreach ($_POST['deny_types'] as $v) $c = $c & ~$v; 178 if (isset($_POST['deny_generic'])) $c = $c & 7; 179 $q = ($no_previous) ? " 180 INSERT INTO `".EVNTCATS_TABLE."` 181 (`arg1`, `arg2`) 182 VALUES (3, $c); 183 " : " 184 UPDATE `".EVNTCATS_TABLE."` 185 SET `arg2` = $c 186 WHERE `arg1` = 3 187 LIMIT 1 ; 188 "; 189 if (pwg_query($q) === false) ec_end2(3); 190 else $page['infos'][] = l10n('ec_config_saved'); 191 } 192 elseif ( 193 isset($_POST['grant_types_submit']) and ( 194 isset($_POST['grant_types']) and 195 count($_POST['grant_types']) > 0 or 196 isset($_POST['grant_generic']) 197 ) 198 ) { 199 $c = ($no_previous = (count($t = mysql_fetch_row(pwg_query(" 200 SELECT `arg2` 201 FROM `".EVNTCATS_TABLE."` 202 WHERE `code` IS NULL 203 AND `arg1` = 3 204 AND `arg2` IS NOT NULL 205 LIMIT 1; 206 "))) == 0)) ? 0 : intval($t[0]); 207 if (isset($_POST['grant_types'])) 208 foreach ($_POST['grant_types'] as $v) $c = $c | $v; 209 if (isset($_POST['grant_generic'])) $c = $c | 8; 210 $q = ($no_previous) ? " 211 INSERT INTO `".EVNTCATS_TABLE."` 212 (`arg1`, `arg2`) 213 VALUES (3, $c); 214 " : " 215 UPDATE `".EVNTCATS_TABLE."` 216 SET `arg2` = $c 217 WHERE `arg1` = 3 218 LIMIT 1 ; 219 "; 220 if (pwg_query($q) === false) ec_end2(4); 221 else $page['infos'][] = l10n('ec_config_saved'); 222 } 223 elseif ( 224 isset($_POST['deny_users_submit']) and 225 isset($_POST['deny_users']) and 226 count($_POST['deny_users']) > 0 227 ) { 228 if (pwg_query(" 229 DELETE 230 FROM `".EVNTCATS_TABLE."` 231 WHERE `arg1` = 2 232 AND `arg2` IN (".implode(',', $_POST['deny_users'])."); 233 ") === false) ec_end2(2); 234 else $page['infos'][] = l10n('ec_config_saved'); 235 } 236 elseif ( 237 isset($_POST['grant_users_submit']) and 238 isset($_POST['grant_users']) and 239 count($_POST['grant_users']) > 0 240 ) { 241 $inserts = array(); 242 foreach ($_POST['grant_users'] as $v) $inserts[] = array( 243 'arg1' => 2, 244 'arg2' => intval($v) 245 ); 246 mass_inserts(EVNTCATS_TABLE, array('arg1', 'arg2'), $inserts); 247 $page['infos'][] = l10n('ec_config_saved'); 248 } 249 elseif (isset($_POST['ec_act1'])) { 147 250 if ( 148 251 $_POST['ec_act1'] == 'disable' and … … 180 283 build_ec_table(); 181 284 } 182 else ec_end1('ec_entry_sel', ' ec_bad_argument1');285 else ec_end1('ec_entry_sel', 'Bad argument : '); 183 286 } 184 287 else if ($_POST['ec_act1'] == 'toggle_forced') … … 193 296 break; 194 297 case 'duplication': 195 if ( $ec_exist_duplic) $page['tab'] = $_GET['tab'];298 if (read_ec_conf('dup_allow') == '2') $page['tab'] = $_GET['tab']; 196 299 break; 197 300 case 'autolog_new': … … 211 314 ")) != 0); 212 315 213 $ec_exist_duplic = ((mysql_num_rows(pwg_query(" 214 SELECT * FROM `".EVNTCATS_TABLE."` 215 WHERE `code` IS NULL 216 AND `arg1` IS NOT NULL 217 AND `arg2` IS NOT NULL ; 218 ")) != 0) or 219 (read_ec_conf('duplic_gen') != 0) or 220 (read_ec_conf('duplic_type') != 0) 221 ); 316 if ( 317 $page['tab'] == 'duplication' and 318 read_ec_conf('dup_allow') != '2' 319 ) $page['tab'] = 'config'; 222 320 223 321 $tabsheet = new tabsheet(); … … 233 331 l10n('ec_tab_autoid_new'), 234 332 $my_base_url.'&tab=autolog_new'); 235 if ( $ec_exist_duplic) $tabsheet->add('duplication',333 if (read_ec_conf('dup_allow') == '2') $tabsheet->add('duplication', 236 334 l10n('ec_tab_duplication'), 237 335 $my_base_url.'&tab=duplication');
Note: See TracChangeset
for help on using the changeset viewer.