Changeset 1178
- Timestamp:
- Apr 15, 2006, 1:25:48 AM (19 years ago)
- Location:
- branches/branch-1_6
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_6/admin/include/functions_notification_by_mail.inc.php
r1157 r1178 339 339 * check_key list where action will be done 340 340 * 341 * @return check_key lis rtreated341 * @return check_key list treated 342 342 */ 343 343 function do_subscribe_unsubcribe_notification_by_mail($is_admin_request, $is_subscribe = false, $check_key_list = array()) … … 367 367 368 368 // Prepare message after change language 369 $msg_break_timeout = l10n('nbm_ nbm_break_timeout_send_mail');369 $msg_break_timeout = l10n('nbm_break_timeout_send_mail'); 370 370 371 371 // Begin nbm users environment … … 472 472 * check_key list where action will be done 473 473 * 474 * @return check_key lis rtreated474 * @return check_key list treated 475 475 */ 476 476 function unsubcribe_notification_by_mail($is_admin_request, $check_key_list = array()) … … 484 484 * check_key list where action will be done 485 485 * 486 * @return check_key lis rtreated486 * @return check_key list treated 487 487 */ 488 488 function subcribe_notification_by_mail($is_admin_request, $check_key_list = array()) -
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'], -
branches/branch-1_6/include/functions.inc.php
r1174 r1178 882 882 } 883 883 884 /**885 * Adaptation of _HTTPRequestToString (http://fr.php.net/urlencode)886 *887 *888 * @return array request to string889 */890 function http_request_to_string($arr_request, $var_name, $separator='&') {891 $ret = "";892 if (is_array($arr_request)) {893 foreach ($arr_request as $key => $value) {894 if (is_array($value)) {895 if ($var_name) {896 $ret .= http_request_to_string($value, "{$var_name}[{$key}]", $separator);897 } else {898 $ret .= http_request_to_string($value, "{$key}", $separator);899 }900 } else {901 if ($var_name) {902 $ret .= "{$var_name}[{$key}]=".urlencode($value)."&";903 } else {904 $ret .= "{$key}=".urlencode($value)."&";905 }906 }907 }908 }909 if (!$var_name) {910 $ret = substr($ret,0,-1);911 }912 return $ret;913 }914 915 /**916 * Post request HTTP on backgroung and redirec to selected url917 *918 * Note : once this function called, the execution doesn't go further919 * (presence of an exit() instruction.920 *921 * @param string $url_redirect922 * @param string $redirect_message923 * @param integer $redirect_refreh_time924 * @return void925 */926 function re_post_http($url_redirect, $redirect_message, $redirect_refreh_time)927 {928 global $conf;929 930 $data_post = http_request_to_string($_POST, '');931 932 $message_post = "POST ".$_SERVER['PHP_SELF'].html_entity_decode(get_query_string_diff(array()))." HTTP/1.1\r\n";933 934 /* foreach (array_flip(array_diff(array_flip(apache_request_headers()), array('Content-Type', 'Content-Length'))) as $header_name => $header_value)935 {936 $message_post .= $header_name.": ".$header_value."\r\n";937 }*/938 $message_post .= "Host: ".$_SERVER['HTTP_HOST']."\r\n";939 $message_post .= "Cookie: ".$conf['session_name']."=".$_COOKIE[$conf['session_name']]."\r\n";940 941 942 $message_post .= "Content-Type: application/x-www-form-urlencoded\r\n";943 $message_post .= "Content-Length: ".strlen($data_post)."\r\n";944 $message_post .= "\r\n";945 $message_post .= $data_post."\r\n";946 947 $fd = fsockopen($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']);948 fputs($fd, $message_post);949 fclose($fd);950 951 redirect($url_redirect, $redirect_message, $redirect_refreh_time);952 //exit(); done by redirect953 }954 955 884 ?> -
branches/branch-1_6/language/en_UK.iso-8859-1/admin.lang.php
r1173 r1178 254 254 $lang['metadata_iptc'] = 'IPTC'; 255 255 $lang['name'] = 'name'; 256 $lang['nbm_background_treatment_redirect'] = 'Execution time is out, treatment continue on background.'."\n".'Re-display on %d secondes...'; 256 $lang['nbm_background_treatment_redirect'] = 'Execution time is out, treatment must be continue [Estmated time: %d secondes].'; 257 $lang['nbm_repost_submit'] = 'Continue processing treatment'; 257 258 $lang['nbm_break_timeout_list_user'] = 'Prepared time for list of users to send mail is limited. Others users are not listed.'; 258 259 $lang['nbm_col_check_user_send_mail'] = 'To send ?'; … … 279 280 $lang['nbm_msg_n_mails_sent'] = '%d mails were sent.'; 280 281 $lang['nbm_msg_no_mail_to_send'] = '%d mails were not sent.'; 281 $lang['nbm_ nbm_break_timeout_send_mail'] = 'Time to send mail is limited. Others mails are skipped or sent on background.';282 $lang['nbm_break_timeout_send_mail'] = 'Time to send mail is limited. Others mails are skipped.'; 282 283 $lang['nbm_no_mail_to_send'] = 'No mail to send.'; 283 284 $lang['nbm_no_user_available_to_send_L1'] = 'No user are available in order to send mail.'; -
branches/branch-1_6/language/fr_FR.iso-8859-1/admin.lang.php
r1173 r1178 257 257 $lang['metadata_iptc'] = 'IPTC'; 258 258 $lang['name'] = 'nom'; 259 $lang['nbm_background_treatment_redirect'] = 'Le temps d\'éxécution étant dépassé, le traitement continue en arrière plan.'."\n".'Ré-affichage dans %d secondes...'; 259 $lang['nbm_background_treatment_redirect'] = 'Le temps d\'éxécution étant dépassé, le traitement doit continuer [Temps estimé: %d secondes].'; 260 $lang['nbm_repost_submit'] = 'Continuer le traitement en cours...'; 260 261 $lang['nbm_break_timeout_list_user'] = 'Le temps de préparation de la liste des utilisateurs pour l\'envoi est limité. Les autres utilisateurs ne sont pas listés.'; 261 262 $lang['nbm_col_check_user_send_mail'] = 'A envoyer ?'; … … 282 283 $lang['nbm_msg_n_mails_sent'] = '%s mails ont été envoyés.'; 283 284 $lang['nbm_msg_no_mail_to_send'] = '%s mails n\'ont pas été envoyés.'; 284 $lang['nbm_ nbm_break_timeout_send_mail'] = 'Le temps d\'envoi des mails est limité. Les autres envois de mail ont été ignorés ou vont être envoyés en arrière plan.';285 $lang['nbm_break_timeout_send_mail'] = 'Le temps d\'envoi des mails est limité. Les autres envois de mail ont été ignorés.'; 285 286 $lang['nbm_no_mail_to_send'] = 'Pas de mail à envoyer.'; 286 287 $lang['nbm_no_user_available_to_send_L1'] = 'Il n\'y a pas d\'utilisateur à notifier par mail.'; -
branches/branch-1_6/template/yoga/admin/notification_by_mail.tpl
r1116 r1178 17 17 18 18 <form method="post" name="notification_by_mail" id="notification_by_mail" action="{F_ACTION}"> 19 <!-- BEGIN repost --> 20 <fieldset> 21 <div class="errors"> 22 <p> 23 <input type="submit" value="{lang:nbm_repost_submit}" name="{REPOST_SUBMIT_NAME}" {TAG_INPUT_ENABLED}/> 24 </p> 25 </div> 26 </fieldset> 27 <!-- END repost --> 19 28 20 29 <!-- BEGIN param --> … … 63 72 {lang:nbm_no_user_available_to_send_L1}<br> 64 73 {lang:nbm_no_user_available_to_send_L2}<br> 74 <br> 65 75 </center> 66 76 <!-- END send_empty -->
Note: See TracChangeset
for help on using the changeset viewer.