aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/include/functions_notification_by_mail.inc.php8
-rw-r--r--admin/notification_by_mail.php79
-rw-r--r--include/functions.inc.php71
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php5
-rw-r--r--language/fr_FR.iso-8859-1/admin.lang.php5
-rw-r--r--template/yoga/admin/notification_by_mail.tpl10
6 files changed, 71 insertions, 107 deletions
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index bfaaf8cb0..52fcba269 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -338,7 +338,7 @@ function get_mail_content_subscribe_unsubcribe($nbm_user)
* is_subscribe define if action=subscribe or unsubscribe
* check_key list where action will be done
*
- * @return check_key lisr treated
+ * @return check_key list treated
*/
function do_subscribe_unsubcribe_notification_by_mail($is_admin_request, $is_subscribe = false, $check_key_list = array())
{
@@ -366,7 +366,7 @@ function do_subscribe_unsubcribe_notification_by_mail($is_admin_request, $is_sub
$data_users = get_user_notifications('subscribe', $check_key_list, !$is_subscribe);
// Prepare message after change language
- $msg_break_timeout = l10n('nbm_nbm_break_timeout_send_mail');
+ $msg_break_timeout = l10n('nbm_break_timeout_send_mail');
// Begin nbm users environment
begin_users_env_nbm(true);
@@ -471,7 +471,7 @@ function do_subscribe_unsubcribe_notification_by_mail($is_admin_request, $is_sub
*
* check_key list where action will be done
*
- * @return check_key lisr treated
+ * @return check_key list treated
*/
function unsubcribe_notification_by_mail($is_admin_request, $check_key_list = array())
{
@@ -483,7 +483,7 @@ function unsubcribe_notification_by_mail($is_admin_request, $check_key_list = ar
*
* check_key list where action will be done
*
- * @return check_key lisr treated
+ * @return check_key list treated
*/
function subcribe_notification_by_mail($is_admin_request, $check_key_list = array())
{
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index 95e939bed..a8e0c62d7 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -50,21 +50,22 @@ check_status(ACCESS_ADMINISTRATOR);
// | Initialization |
// +-----------------------------------------------------------------------+
$base_url = get_root_url().'admin.php';
+$must_repost = false;
// +-----------------------------------------------------------------------+
// | functions |
// +-----------------------------------------------------------------------+
/*
- * Do background treatmetn in order to finish to send mails
+ * Do timeout treatment in order to finish to send mails
*
* @param $post_keyname: key of check_key post array
- * @param check_key_treated:array of check_key treated
+ * @param check_key_treated: array of check_key treated
* @return none
*/
-function do_background_treatment($post_keyname, $check_key_treated = array())
+function do_timeout_treatment($post_keyname, $check_key_treated = array())
{
- global $env_nbm, $base_url;
+ global $env_nbm, $base_url, $page, $must_repost;
if ($env_nbm['is_sendmail_timeout'])
{
@@ -78,10 +79,12 @@ function do_background_treatment($post_keyname, $check_key_treated = array())
}
else
{
- $time_refresh = 10;
+ $time_refresh = 0;
}
$_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated);
- re_post_http($base_url.get_query_string_diff(array()), sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh) , $time_refresh);
+
+ $must_repost = true;
+ array_push($page['errors'], sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh));
}
}
@@ -117,18 +120,6 @@ function insert_new_data_user_mail_notification()
{
global $conf, $page, $env_nbm;
- // Treatment of simulate post
- if (isset($_POST['insert_new_user_nbm']))
- {
- $check_key_treated = do_subscribe_unsubcribe_notification_by_mail
- (
- true,
- $conf['nbm_default_value_user_enabled'],
- $_POST['insert_new_user_nbm']
- );
- do_background_treatment('insert_new_user_nbm', $check_key_treated);
- }
-
// Set null mail_address empty
$query = '
update
@@ -196,11 +187,13 @@ order by
// On timeout simulate like tabsheet send
if ($env_nbm['is_sendmail_timeout'])
{
- if ($conf['nbm_default_value_user_enabled'])
+ $quoted_check_key_list = quote_check_key_list(array_diff($check_key_list, $check_key_treated));
+ if (count($quoted_check_key_list) != 0 )
{
- // Simulate Post
- $_POST['insert_new_user_nbm'] = $check_key_list;
- do_background_treatment('insert_new_user_nbm', $check_key_treated);
+ $query = 'delete from '.USER_MAIL_NOTIFICATION_TABLE.' where check_key in ('.implode(",", $quoted_check_key_list).');';
+ $result = pwg_query($query);
+
+ redirect($base_url.get_query_string_diff(array()));
}
}
}
@@ -230,8 +223,11 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
// disabled and null mail_address are not selected in the list
$data_users = get_user_notifications('send', $check_key_list);
+ // List all if it's define on options or on timeout
+ $is_list_all_without_test = ($env_nbm['is_sendmail_timeout'] or $conf['nbm_list_all_enabled_users_to_send']);
+
// Check if exist news to list user or send mails
- if (($conf['nbm_list_all_enabled_users_to_send'] == false) or ($is_action_send))
+ if ((!$is_list_all_without_test == false) or ($is_action_send))
{
if (count($data_users) > 0)
{
@@ -240,7 +236,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
// Prepare message after change language
if ($is_action_send)
{
- $msg_break_timeout = l10n('nbm_nbm_break_timeout_send_mail');
+ $msg_break_timeout = l10n('nbm_break_timeout_send_mail');
}
else
{
@@ -460,13 +456,13 @@ where
if (isset($_POST['falsify']) and isset($_POST['cat_true']))
{
$check_key_treated = unsubcribe_notification_by_mail(true, $_POST['cat_true']);
- do_background_treatment('cat_true', $check_key_treated);
+ do_timeout_treatment('cat_true', $check_key_treated);
}
else
if (isset($_POST['trueify']) and isset($_POST['cat_false']))
{
$check_key_treated = subcribe_notification_by_mail(true, $_POST['cat_false']);
- do_background_treatment('cat_false', $check_key_treated);
+ do_timeout_treatment('cat_false', $check_key_treated);
}
break;
}
@@ -476,7 +472,7 @@ where
if (isset($_POST['send_submit']) and isset($_POST['send_selection']) and isset($_POST['send_customize_mail_content']))
{
$check_key_treated = do_action_send_mail_notification('send', $_POST['send_selection'], $_POST['send_customize_mail_content']);
- do_background_treatment('send_selection', $check_key_treated);
+ do_timeout_treatment('send_selection', $check_key_treated);
}
}
}
@@ -517,6 +513,33 @@ if (is_autorize_status(ACCESS_WEBMASTER))
);
}
+if ($must_repost)
+{
+ // Get name of submit button
+ $repost_submit_name = '';
+ if (isset($_POST['falsify']))
+ {
+ $repost_submit_name = 'falsify';
+ }
+ elseif (isset($_POST['trueify']))
+ {
+ $repost_submit_name = 'trueify';
+ }
+ elseif (isset($_POST['send_submit']))
+ {
+ $repost_submit_name = 'send_submit';
+ }
+
+ $template->assign_block_vars
+ (
+ 'repost',
+ array
+ (
+ 'REPOST_SUBMIT_NAME' => $repost_submit_name
+ )
+ );
+}
+
switch ($page['mode'])
{
case 'param' :
@@ -589,7 +612,7 @@ switch ($page['mode'])
'ID' => $nbm_user['check_key'],
'CHECKED' => ( // not check if not selected, on init select<all
isset($_POST['send_selection']) and // not init
- !in_array($nbm_user['check_key'], $_POST['send_selection']) // not selected
+ !in_array($nbm_user['check_key'], $_POST['send_selection']) // not selected
) ? '' : 'checked="checked"',
'USERNAME'=> $nbm_user['username'],
'EMAIL' => $nbm_user['mail_address'],
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 496ad2690..35b1e7935 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -881,75 +881,4 @@ function get_available_upgrade_ids()
return $available_upgrade_ids;
}
-/**
- * Adaptation of _HTTPRequestToString (http://fr.php.net/urlencode)
- *
- *
- * @return array request to string
- */
-function http_request_to_string($arr_request, $var_name, $separator='&') {
- $ret = "";
- if (is_array($arr_request)) {
- foreach ($arr_request as $key => $value) {
- if (is_array($value)) {
- if ($var_name) {
- $ret .= http_request_to_string($value, "{$var_name}[{$key}]", $separator);
- } else {
- $ret .= http_request_to_string($value, "{$key}", $separator);
- }
- } else {
- if ($var_name) {
- $ret .= "{$var_name}[{$key}]=".urlencode($value)."&";
- } else {
- $ret .= "{$key}=".urlencode($value)."&";
- }
- }
- }
- }
- if (!$var_name) {
- $ret = substr($ret,0,-1);
- }
- return $ret;
-}
-
-/**
- * Post request HTTP on backgroung and redirec to selected url
- *
- * Note : once this function called, the execution doesn't go further
- * (presence of an exit() instruction.
- *
- * @param string $url_redirect
- * @param string $redirect_message
- * @param integer $redirect_refreh_time
- * @return void
- */
-function re_post_http($url_redirect, $redirect_message, $redirect_refreh_time)
-{
- global $conf;
-
- $data_post = http_request_to_string($_POST, '');
-
- $message_post = "POST ".$_SERVER['PHP_SELF'].html_entity_decode(get_query_string_diff(array()))." HTTP/1.1\r\n";
-
-/* foreach (array_flip(array_diff(array_flip(apache_request_headers()), array('Content-Type', 'Content-Length'))) as $header_name => $header_value)
- {
- $message_post .= $header_name.": ".$header_value."\r\n";
- }*/
- $message_post .= "Host: ".$_SERVER['HTTP_HOST']."\r\n";
- $message_post .= "Cookie: ".$conf['session_name']."=".$_COOKIE[$conf['session_name']]."\r\n";
-
-
- $message_post .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $message_post .= "Content-Length: ".strlen($data_post)."\r\n";
- $message_post .= "\r\n";
- $message_post .= $data_post."\r\n";
-
- $fd = fsockopen($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']);
- fputs($fd, $message_post);
- fclose($fd);
-
- redirect($url_redirect, $redirect_message, $redirect_refreh_time);
- //exit(); done by redirect
-}
-
?>
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index 82a3ecfe7..ee934ac40 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -253,7 +253,8 @@ $lang['metadata_basic'] = 'basic';
$lang['metadata_exif'] = 'EXIF';
$lang['metadata_iptc'] = 'IPTC';
$lang['name'] = 'name';
-$lang['nbm_background_treatment_redirect'] = 'Execution time is out, treatment continue on background.'."\n".'Re-display on %d secondes...';
+$lang['nbm_background_treatment_redirect'] = 'Execution time is out, treatment must be continue [Estmated time: %d secondes].';
+$lang['nbm_repost_submit'] = 'Continue processing treatment';
$lang['nbm_break_timeout_list_user'] = 'Prepared time for list of users to send mail is limited. Others users are not listed.';
$lang['nbm_col_check_user_send_mail'] = 'To send ?';
$lang['nbm_col_last_send'] = 'Last send';
@@ -278,7 +279,7 @@ $lang['nbm_msg_error_sending_email_to'] = 'Error when sending email to %s [%s].'
$lang['nbm_msg_mail_sent_to'] = 'Mail sent to %s [%s].';
$lang['nbm_msg_n_mails_sent'] = '%d mails were sent.';
$lang['nbm_msg_no_mail_to_send'] = '%d mails were not sent.';
-$lang['nbm_nbm_break_timeout_send_mail'] = 'Time to send mail is limited. Others mails are skipped or sent on background.';
+$lang['nbm_break_timeout_send_mail'] = 'Time to send mail is limited. Others mails are skipped.';
$lang['nbm_no_mail_to_send'] = 'No mail to send.';
$lang['nbm_no_user_available_to_send_L1'] = 'No user are available in order to send mail.';
$lang['nbm_no_user_available_to_send_L2'] = 'A user is available, if there are new elements to notify';
diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php
index 0f0a2a00c..6dff5ba9d 100644
--- a/language/fr_FR.iso-8859-1/admin.lang.php
+++ b/language/fr_FR.iso-8859-1/admin.lang.php
@@ -256,7 +256,8 @@ $lang['metadata_basic'] = 'basique';
$lang['metadata_exif'] = 'EXIF';
$lang['metadata_iptc'] = 'IPTC';
$lang['name'] = 'nom';
-$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...';
+$lang['nbm_background_treatment_redirect'] = 'Le temps d\'éxécution étant dépassé, le traitement doit continuer [Temps estimé: %d secondes].';
+$lang['nbm_repost_submit'] = 'Continuer le traitement en cours...';
$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.';
$lang['nbm_col_check_user_send_mail'] = 'A envoyer ?';
$lang['nbm_col_last_send'] = 'Dernier envoi';
@@ -281,7 +282,7 @@ $lang['nbm_msg_error_sending_email_to'] = 'Erreur lors de l\'envoi du mail à %s
$lang['nbm_msg_mail_sent_to'] = 'Mail envoyé à %s [%s].';
$lang['nbm_msg_n_mails_sent'] = '%s mails ont été envoyés.';
$lang['nbm_msg_no_mail_to_send'] = '%s mails n\'ont pas été envoyés.';
-$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.';
+$lang['nbm_break_timeout_send_mail'] = 'Le temps d\'envoi des mails est limité. Les autres envois de mail ont été ignorés.';
$lang['nbm_no_mail_to_send'] = 'Pas de mail à envoyer.';
$lang['nbm_no_user_available_to_send_L1'] = 'Il n\'y a pas d\'utilisateur à notifier par mail.';
$lang['nbm_no_user_available_to_send_L2'] = 'Un utilisateur est à notifier si de nouveaux éléments sont disponibles pour cet utilisateur.';
diff --git a/template/yoga/admin/notification_by_mail.tpl b/template/yoga/admin/notification_by_mail.tpl
index 5809e9ec8..dcd45a5b0 100644
--- a/template/yoga/admin/notification_by_mail.tpl
+++ b/template/yoga/admin/notification_by_mail.tpl
@@ -16,6 +16,15 @@
</div>
<form method="post" name="notification_by_mail" id="notification_by_mail" action="{F_ACTION}">
+ <!-- BEGIN repost -->
+ <fieldset>
+ <div class="errors">
+ <p>
+ <input type="submit" value="{lang:nbm_repost_submit}" name="{REPOST_SUBMIT_NAME}" {TAG_INPUT_ENABLED}/>
+ </p>
+ </div>
+ </fieldset>
+ <!-- END repost -->
<!-- BEGIN param -->
<fieldset>
@@ -62,6 +71,7 @@
<center>
{lang:nbm_no_user_available_to_send_L1}<br>
{lang:nbm_no_user_available_to_send_L2}<br>
+ <br>
</center>
<!-- END send_empty -->
<!-- BEGIN send_data -->