Changeset 4333 for extensions/event_cats/admin
- Timestamp:
- Nov 21, 2009, 6:59:31 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/evntcats_admin.php
r4329 r4333 77 77 build_ec_lists(); // in evntcats_main_funcs.php 78 78 79 $dup_types_exist = false; 80 $dup_entries_exist = false; 81 $ec_exist_entries = false; 82 function check_DB() { 83 global $dup_types_exist, $dup_entries_exist, $ec_exist_entries, $ec_lists; 84 85 $dup_types_exist = build_dup_groups(); // build_dup_groups() returns 86 // true if an entry exists for duplication management for types 87 88 // both arrays below are built when executing build_dup_groups() function 89 $dup_entries_exist = ( 90 $dup_types_exist or 91 count($ec_lists['groups_granted_ids']) > 0 or 92 count($ec_lists['users_granted_direct_ids']) > 0 93 ); 94 95 $ec_exist_entries = (mysql_num_rows(pwg_query(" 96 SELECT * FROM `".EVNTCATS_TABLE."` 97 WHERE `code` IS NOT NULL ; 98 ")) != 0); 99 } 100 101 check_DB(); 102 79 103 // If no entry exist, default tab is 'autolog_new'. 80 $page['tab'] = (!($ec_exist_entries = (mysql_num_rows(pwg_query(" 81 SELECT * FROM `".EVNTCATS_TABLE."` 82 WHERE `code` IS NOT NULL ; 83 ")) != 0))) ? 'autolog_new' : 'autolog_entries'; 84 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'; 104 $page['tab'] = (!$ec_exist_entries) ? 'autolog_new' : 'autolog_entries'; 105 106 // If no entry exist, but some duplication management entries exist, and 107 // duplication setting is "managed per groups", default tab is 'duplication' 108 if ( 109 !$ec_exist_entries and 110 read_ec_conf('dup_allow') == '2' and 111 $dup_entries_exist 112 ) $page['tab'] = 'duplication'; 88 113 89 114 // If a modification of duplication management has been posted, default tab … … 166 191 ) 167 192 ) { 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]); 193 $c = $ec_lists['types_granted']; 176 194 if (isset($_POST['deny_types'])) 177 195 foreach ($_POST['deny_types'] as $v) $c = $c & ~$v; 178 196 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 " : " 197 $q = ($dup_types_exist) ? " 184 198 UPDATE `".EVNTCATS_TABLE."` 185 199 SET `arg2` = $c 186 200 WHERE `arg1` = 3 187 201 LIMIT 1 ; 202 " : " 203 INSERT INTO `".EVNTCATS_TABLE."` 204 (`arg1`, `arg2`) 205 VALUES (3, $c); 188 206 "; 189 207 if (pwg_query($q) === false) ec_end2(3); … … 197 215 ) 198 216 ) { 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]); 217 $c = $ec_lists['types_granted']; 207 218 if (isset($_POST['grant_types'])) 208 219 foreach ($_POST['grant_types'] as $v) $c = $c | $v; 209 220 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 " : " 221 $q = ($dup_types_exist) ? " 215 222 UPDATE `".EVNTCATS_TABLE."` 216 223 SET `arg2` = $c 217 224 WHERE `arg1` = 3 218 225 LIMIT 1 ; 226 " : " 227 INSERT INTO `".EVNTCATS_TABLE."` 228 (`arg1`, `arg2`) 229 VALUES (3, $c); 219 230 "; 220 231 if (pwg_query($q) === false) ec_end2(4); … … 309 320 // +-----------------------------------------------------------------------+ 310 321 311 $ec_exist_entries = (mysql_num_rows(pwg_query(" 312 SELECT * FROM `".EVNTCATS_TABLE."` 313 WHERE `code` IS NOT NULL 314 ")) != 0); 315 322 check_DB(); 323 316 324 if ( 317 325 $page['tab'] == 'duplication' and
Note: See TracChangeset
for help on using the changeset viewer.