Changeset 1178 for branches/branch-1_6/admin/notification_by_mail.php
- Timestamp:
- Apr 15, 2006, 1:25:48 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_6/admin/notification_by_mail.php
r1161 r1178 51 51 // +-----------------------------------------------------------------------+ 52 52 $base_url = get_root_url().'admin.php'; 53 $must_repost = false; 53 54 54 55 // +-----------------------------------------------------------------------+ … … 57 58 58 59 /* 59 * Do background treatmetnin order to finish to send mails60 * Do timeout treatment in order to finish to send mails 60 61 * 61 62 * @param $post_keyname: key of check_key post array 62 * @param check_key_treated: array of check_key treated63 * @param check_key_treated: array of check_key treated 63 64 * @return none 64 65 */ 65 function do_ background_treatment($post_keyname, $check_key_treated = array())66 { 67 global $env_nbm, $base_url ;66 function do_timeout_treatment($post_keyname, $check_key_treated = array()) 67 { 68 global $env_nbm, $base_url, $page, $must_repost; 68 69 69 70 if ($env_nbm['is_sendmail_timeout']) … … 79 80 else 80 81 { 81 $time_refresh = 10;82 $time_refresh = 0; 82 83 } 83 84 $_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated); 84 re_post_http($base_url.get_query_string_diff(array()), sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh) , $time_refresh); 85 86 $must_repost = true; 87 array_push($page['errors'], sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh)); 85 88 } 86 89 } … … 117 120 { 118 121 global $conf, $page, $env_nbm; 119 120 // Treatment of simulate post121 if (isset($_POST['insert_new_user_nbm']))122 {123 $check_key_treated = do_subscribe_unsubcribe_notification_by_mail124 (125 true,126 $conf['nbm_default_value_user_enabled'],127 $_POST['insert_new_user_nbm']128 );129 do_background_treatment('insert_new_user_nbm', $check_key_treated);130 }131 122 132 123 // Set null mail_address empty … … 197 188 if ($env_nbm['is_sendmail_timeout']) 198 189 { 199 if ($conf['nbm_default_value_user_enabled']) 200 { 201 // Simulate Post 202 $_POST['insert_new_user_nbm'] = $check_key_list; 203 do_background_treatment('insert_new_user_nbm', $check_key_treated); 190 $quoted_check_key_list = quote_check_key_list(array_diff($check_key_list, $check_key_treated)); 191 if (count($quoted_check_key_list) != 0 ) 192 { 193 $query = 'delete from '.USER_MAIL_NOTIFICATION_TABLE.' where check_key in ('.implode(",", $quoted_check_key_list).');'; 194 $result = pwg_query($query); 195 196 redirect($base_url.get_query_string_diff(array())); 204 197 } 205 198 } … … 231 224 $data_users = get_user_notifications('send', $check_key_list); 232 225 226 // List all if it's define on options or on timeout 227 $is_list_all_without_test = ($env_nbm['is_sendmail_timeout'] or $conf['nbm_list_all_enabled_users_to_send']); 228 233 229 // Check if exist news to list user or send mails 234 if (( $conf['nbm_list_all_enabled_users_to_send']== false) or ($is_action_send))230 if ((!$is_list_all_without_test == false) or ($is_action_send)) 235 231 { 236 232 if (count($data_users) > 0) … … 241 237 if ($is_action_send) 242 238 { 243 $msg_break_timeout = l10n('nbm_ nbm_break_timeout_send_mail');239 $msg_break_timeout = l10n('nbm_break_timeout_send_mail'); 244 240 } 245 241 else … … 461 457 { 462 458 $check_key_treated = unsubcribe_notification_by_mail(true, $_POST['cat_true']); 463 do_ background_treatment('cat_true', $check_key_treated);459 do_timeout_treatment('cat_true', $check_key_treated); 464 460 } 465 461 else … … 467 463 { 468 464 $check_key_treated = subcribe_notification_by_mail(true, $_POST['cat_false']); 469 do_ background_treatment('cat_false', $check_key_treated);465 do_timeout_treatment('cat_false', $check_key_treated); 470 466 } 471 467 break; … … 477 473 { 478 474 $check_key_treated = do_action_send_mail_notification('send', $_POST['send_selection'], $_POST['send_customize_mail_content']); 479 do_ background_treatment('send_selection', $check_key_treated);475 do_timeout_treatment('send_selection', $check_key_treated); 480 476 } 481 477 } … … 518 514 } 519 515 516 if ($must_repost) 517 { 518 // Get name of submit button 519 $repost_submit_name = ''; 520 if (isset($_POST['falsify'])) 521 { 522 $repost_submit_name = 'falsify'; 523 } 524 elseif (isset($_POST['trueify'])) 525 { 526 $repost_submit_name = 'trueify'; 527 } 528 elseif (isset($_POST['send_submit'])) 529 { 530 $repost_submit_name = 'send_submit'; 531 } 532 533 $template->assign_block_vars 534 ( 535 'repost', 536 array 537 ( 538 'REPOST_SUBMIT_NAME' => $repost_submit_name 539 ) 540 ); 541 } 542 520 543 switch ($page['mode']) 521 544 { … … 590 613 'CHECKED' => ( // not check if not selected, on init select<all 591 614 isset($_POST['send_selection']) and // not init 592 !in_array($nbm_user['check_key'], 615 !in_array($nbm_user['check_key'], $_POST['send_selection']) // not selected 593 616 ) ? '' : 'checked="checked"', 594 617 'USERNAME'=> $nbm_user['username'],
Note: See TracChangeset
for help on using the changeset viewer.