Changeset 4418 for extensions/event_cats/include
- Timestamp:
- Dec 3, 2009, 10:01:37 PM (14 years ago)
- Location:
- extensions/event_cats/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/include/ec_conf.inc.php
r4333 r4418 79 79 'unknown_code_ap_id' // the id of the Additional Page which must be used 80 80 => '0', // in case of usage of an unknow code, several vals. 81 // 82 'comment_display' // the way the comment is displayed in "entries" 83 => '0', // tab : 0, as tooltip ; 1, on a line under code 81 84 ); 82 85 … … 89 92 '16', '20', '24', '25', '30', '32'), 90 93 'unknown_code' => array('0', '1', '2'), 91 'unknown_code_ap_id' => array() 94 'unknown_code_ap_id' => array(), 95 'comment_display' => array('0', '1') 92 96 ); 93 97 -
extensions/event_cats/include/evntcats_admin_funcs.inc.php
r4333 r4418 97 97 // This function assumes that the validity of the different indexes of 98 98 // $_POST it uses, have already been checked. 99 100 // Check if a category id has been posted, and if yes if this category is 101 // private. 102 /* $cat_assoc_needed = ( 103 ); */ 104 105 // Check if an add. p. id has been posted, and if yes if this add. p. is 106 // private. 107 /* $ap_assoc_needed = ( 108 ); */ 99 109 100 110 // User creation, as generic … … 161 171 $_POST['login'], $_POST['groupname'] 162 172 ); 173 174 // If a category id has been posted, the newly created group must be 175 // allowed to navigate in this category 176 177 /* 178 179 if (isset($_POST['ec_in_up_cat'])) { 180 if (mysql_num_rows(pwg_query(" 181 SELECT `id` 182 FROM `".CATEGORIES_TABLE."` 183 WHERE `id` = '".$_POST['ec_in_up_cat']."'; 184 ")) == 0) return ec_end1('ec_in_up_cat', 'Category doesn\'t exist : '); 185 else { 186 187 $query = ' 188 SELECT id 189 FROM '.CATEGORIES_TABLE.' 190 WHERE id IN ('.implode(',', get_uppercat_ids(array($page['cat']))).') 191 AND status = \'private\' 192 ;'; 193 $private_uppercats = array_from_query($query, 'id'); 194 195 // We must not reinsert already existing lines in group_access table 196 $granteds = array(); 197 foreach ($private_uppercats as $cat_id) 198 { 199 $granteds[$cat_id] = array(); 200 } 201 202 $query = ' 203 SELECT group_id, cat_id 204 FROM '.GROUP_ACCESS_TABLE.' 205 WHERE cat_id IN ('.implode(',', $private_uppercats).') 206 AND group_id IN ('.implode(',', $_POST['grant_groups']).') 207 ;'; 208 $result = pwg_query($query); 209 while ($row = mysql_fetch_array($result)) 210 { 211 array_push($granteds[$row['cat_id']], $row['group_id']); 212 } 213 214 $inserts = array(); 215 216 foreach ($private_uppercats as $cat_id) 217 { 218 $group_ids = array_diff($_POST['grant_groups'], $granteds[$cat_id]); 219 foreach ($group_ids as $group_id) 220 { 221 array_push($inserts, array('group_id' => $group_id, 222 'cat_id' => $cat_id)); 223 } 224 } 225 226 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts); 227 228 229 } 230 } 231 232 */ 233 234 // If an add. p. id has been posted, the newly created group must be 235 // allowed to navigate in this additional page 236 } 237 else { 238 // If a category id has been posted, the newly created user must be 239 // allowed to navigate in this category 240 241 // If an add. p. id has been posted, the newly created user must be 242 // allowed to navigate in this additional page => not possible to 243 // allow individually => must give a warning message 244 163 245 } 164 246 return $ec_user_id; … … 191 273 $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['id'] = 192 274 $ec_entry['id']; 275 $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['comment'] = 276 $ec_entry['comment']; 193 277 $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['user_id'] = 194 278 $ec_entry['user_id']; … … 198 282 $ec_lists['duplicable_codes']['ids'][$ec_id] = 199 283 $ec_lists['duplicable_codes']['codes'][$ec_code]['id']; 284 $ec_lists['duplicable_codes']['comment'][$ec_id] = 285 $ec_lists['duplicable_codes']['codes'][$ec_code]['comment']; 200 286 } 201 287 … … 235 321 $action = 'ec_ok'; 236 322 $del_other = false; 323 $comment = ''; 237 324 switch ($_POST['ec_act1']) { 238 325 239 // This "switch" commandis a little bit tricky... it has been a pain to326 // This "switch" statement is a little bit tricky... it has been a pain to 240 327 // debug, and I wish to nobody to have to modify it :-\ ! 241 328 // Its principle is that it manages checks for four occurrences of … … 321 408 $arg1 = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['arg1']; 322 409 $arg2 = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['arg2']; 410 $comment = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['comment']; 323 411 if (empty($arg1)) $arg1 = 'NULL'; 324 412 if (empty($arg2)) $arg2 = 'NULL'; … … 385 473 return ec_end1('ec_in_up_forced', 'Bad argument : '); 386 474 475 // Preparation of $comment 476 $comment = (isset($_POST['ec_in_up_comment'])) ? 477 $_POST['ec_in_up_comment'] : $comment; 478 387 479 // User and eventually group creation, if needed 388 480 if ($_POST['ec_act1'] != 'duplicate_entry_submit') … … 405 497 AND `arg2` ".$arg2p." 406 498 AND `forced` = '".$forced."' 499 AND `comment` = '".$comment."' 407 500 "))) !== false) { // print("<pre>$arg1 $arg2<br>$q</pre>"); 408 501 $page['errors'][] = sprintf(l10n('ec_entry_already_exists'), $t1[0]); … … 440 533 'arg2p' => $arg2p, 441 534 'forced' => $forced, 535 'comment' => $comment, 442 536 ); 443 537 … … 451 545 `user_id`, 452 546 `action`, 453 `arg1`, `arg2`, `forced` 547 `arg1`, `arg2`, `forced`, `comment` 454 548 ) 455 549 VALUES ( … … 457 551 ".$ec_user_id.", 458 552 '".$action."', 459 ".$arg1.", ".$arg2.", '".$forced."' 553 ".$arg1.", ".$arg2.", '".$forced."', '".$comment."' 460 554 ); 461 555 ") === false … … 487 581 `arg1` = ".$arg1.", 488 582 `arg2` = ".$arg2.", 489 `forced` = '".$forced."' 583 `forced` = '".$forced."', 584 `comment` = '".$comment."' 490 585 WHERE `id` = '".$_POST['ec_entry_sel']."' 491 586 ") === false
Note: See TracChangeset
for help on using the changeset viewer.