Changeset 4163 for extensions/event_cats/include/evntcats_funcs.inc.php
- Timestamp:
- Oct 31, 2009, 11:50:34 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/include/evntcats_funcs.inc.php
r4157 r4163 157 157 158 158 /* 159 * ec_end ()160 * Process repetitive task when error in database modifying fu cntions.159 * ec_end1() 160 * Process repetitive task when error in database modifying functions. 161 161 * 162 162 * @param … … 166 166 * false as this function is used when there is a problem 167 167 */ 168 function ec_end ($pst, $msg) {168 function ec_end1($pst, $msg) { 169 169 global $page; 170 170 $page['errors'][] = … … 172 172 '$_POST[\''.$pst.'\'] = '. 173 173 $_POST[$pst] 174 ; 175 return false; 176 } 177 178 /* 179 * ec_end2() 180 * Process repetitive task when error in database modifying functions. 181 * 182 * @param 183 * $msg : message 184 * $num : number precising the point where the error occurred 185 * @return 186 * false as this function is used when there is a problem 187 */ 188 function ec_end2($msg, $num) { 189 global $page; 190 $page['errors'][] = 191 l10n($msg).' ('.$num.') '. 192 'MySQL error '.mysql_errno().', "'.mysql_error().'"' 174 193 ; 175 194 return false; … … 414 433 global $page, $ec_lists; 415 434 435 /* 436 437 ( 438 [ec_act1] => create 439 [ec_entry_sel] => -1 440 [ec_sel_code] => new 441 [ec_in_up_auto_code_length] => 10 442 [ec_in_up_code] => 94q0V1067D 443 [ec_sel_user] => new 444 [ec_in_up_usr_txt] => san_gimi 445 [ec_in_up_psd_txt] => 7Mv8QxZV 446 [ec_in_up_newgroup] => on 447 [ec_in_up_grp_txt] => EC_san_gimi 448 [ec_input_action] => cat 449 [ec_in_up_cat] => 6 450 [ec_in_up_img] => 451 ) 452 453 */ 416 454 /* foreach ($ec_lists['ec_table'] as $ec_entry) { 417 455 if ($_POST['ec_in_up_code'] == $ec_entry['code']) 418 return ec_end('ec_in_up_code', 'ec_bad_argument2'); 419 } 456 return ec_end1('ec_in_up_code', 'ec_bad_argument2'); 457 } 458 if ($t1 = (in_array($_POST['ec_in_up_usr_txt'], $ec_lists['user_ids']))) 459 $ec_user_id = $_POST['ec_in_up_usr_txt']; 420 460 if ($_POST['ec_sel_user'] == 'new') { 421 if (in_array( 422 $_POST['ec_in_up_usr_txt'], 423 $ec_lists['user_ids'] 424 )) return ec_end('ec_in_up_usr_txt', 'ec_bad_argument3'); 461 if ($t1) return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument3'); 425 462 else { // New user account creation 426 463 $page['errors'] = register_user( 427 464 $_POST['ec_in_up_usr_txt'], $_POST['ec_in_up_psd_txt'], '', false 428 465 ); 429 } 466 if ( 467 count($page['errors']) != 0 or 468 !($ec_user_id = get_userid($_POST['ec_in_up_usr_txt'])) or 469 !pwg_query(" 470 UPDATE `".USER_INFOS_TABLE."` 471 SET `status` = 'generic' 472 WHERE `user_id` = ".$ec_user_id."; 473 ") 474 ) { 475 array_unshift($page['errors'], l10n('ec_user_create_pb')); 476 return false; 477 } 478 if ( 479 isset($_POST['ec_in_up_newgroup']) and 480 isset($_POST['ec_in_up_grp_txt']) and 481 $_POST['ec_in_up_grp_txt'] != '' 482 ) { // New group creation, and association with user_id at the same time 483 if ( 484 !($t = mysql_fetch_row(pwg_query(" 485 SELECT `id` 486 FROM `".GROUPS_TABLE."` 487 WHERE `name` = '".$_POST['ec_in_up_grp_txt']."'; 488 "))) 489 ) { 490 if ( 491 !pwg_query(" 492 INSERT INTO `".GROUPS_TABLE."` (`name`, `is_default`) 493 VALUES ('".$_POST['ec_in_up_grp_txt']."', 'false'); 494 ") 495 ) return ec_end2('ec_group_create_pb', '1'); 496 if ( 497 !($t = mysql_fetch_row(pwg_query(" 498 SELECT `id` 499 FROM `".GROUPS_TABLE."` 500 WHERE `name` = '".$_POST['ec_in_up_grp_txt']."'; 501 "))) 502 ) return ec_end2('ec_group_create_pb', '2'); 503 } 504 if ( 505 !(pwg_query(" 506 INSERT INTO `".USER_GROUP_TABLE."` (`user_id `, `group_id`) 507 VALUES ('".$ec_user_id."', '".$t['id']."'); 508 ")) 509 ) return ec_end2('ec_group_create_pb', '3'); 510 } 511 } 512 } 513 else { 514 if ($t1) { 515 if (ereg('^[a-zA-Z0-9_-]{4,32}$',$_POST['ec_in_up_code'])) { 516 if 517 } 518 else return ec_end1('ec_in_up_code', 'ec_bad_argument7'); 519 } 520 else return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument6'); 430 521 } 431 522 */ … … 455 546 if (array_key_exists($_POST['ec_in_up_aps'],$ec_lists['add_pages'])) { 456 547 $arg2 = $_POST['ec_in_up_aps']; } 457 else return ec_end ('ec_in_up_aps', 'ec_bad_argument1');548 else return ec_end1('ec_in_up_aps', 'ec_bad_argument4'); 458 549 case 'home': 459 550 break; … … 466 557 ec_image_exists($_POST['ec_in_up_cat'], $_POST['ec_in_up_img']) 467 558 ) $arg2 = $_POST['ec_in_up_img']; 468 else return ec_end ('ec_in_up_img', 'ec_bad_argument1');559 else return ec_end1('ec_in_up_img', 'ec_bad_argument4'); 469 560 } 470 561 $arg1 = $_POST['ec_in_up_cat']; 471 562 } 472 else return ec_end ('ec_in_up_cat', 'ec_bad_argument1');563 else return ec_end1('ec_in_up_cat', 'ec_bad_argument4'); 473 564 break; 474 default: return ec_end ('ec_input_action', 'ec_bad_argument1');565 default: return ec_end1('ec_input_action', 'ec_bad_argument1'); 475 566 } 476 567 if (pwg_query(" … … 504 595 } 505 596 } 506 else return ec_end('ec_entry_sel', 'ec_bad_argument1'); 507 $page['errors'][] = '?!'; 508 return false; 597 else return ec_end1('ec_entry_sel', 'ec_bad_argument5'); 509 598 } 510 599 … … 572 661 } 573 662 } 574 else ec_end ('ec_entry_sel', 'ec_bad_argument1');663 else ec_end1('ec_entry_sel', 'ec_bad_argument1'); 575 664 } 576 665
Note: See TracChangeset
for help on using the changeset viewer.