Changeset 8917 for extensions/Mail_supervisor/main.inc.php
- Timestamp:
- Jan 26, 2011, 3:59:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Mail_supervisor/main.inc.php
r7050 r8917 2 2 /* 3 3 Plugin Name: Mail supervisor 4 Version: 1.4. 24 Version: 1.4.4 Beta 5 5 Description: Mail supervisor surveille l'envoie des mails. 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315 … … 16 16 17 17 global $conf ; 18 19 20 18 add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 1 , 6); 21 19 function clj_mail($result, $mailto, $subject, $content, $headers, $args) … … 23 21 global $conf, $user, $lang_info, $conf_mail,$mails_options,$mails_donnees , $template,$page ,$erreur_message,$infos_message, $lang; 24 22 // lecture config table ------------- 25 include_once (MAIL_SUPERV_PATH.'include/fonctions.php');23 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 26 24 load_language('plugin.lang', MAIL_SUPERV_PATH); 25 26 if (isset($_POST["Submit"]) ) 27 { 28 if ($_POST["Submit"] != l10n('Sv_Envoyer') ) return true ; 29 } 30 $message =""; 31 if (!isset($infos_message)) 32 { 33 $infos_message = ""; 34 } 35 if (!isset($erreur_message)) 36 { 37 $erreur_message = ''; 38 } 27 39 $mails_options = explode("," , $conf['mail_superv']); 28 40 //======== verification si envoie de mail ou blocage connexion ===================== … … 51 63 } 52 64 53 $message =""; 54 if (!isset($infos_message)) 55 { 56 $infos_message = ""; 57 } 58 if (!isset($erreur_message)) 59 { 60 $erreur_message = ''; 61 } 65 62 66 // lecture donnees ------------- 63 67 $mails_donnees = Get_Datas(); … … 96 100 if ($mailto<>"" ) $nb_destinataires +=1; 97 101 98 if (!empty($args['Bcc'])) { 99 $nb_destinataires += count($args['Bcc']); 100 } 101 if (!empty($args['Cc'])) { 102 $nb_destinataires += count($args['Cc']); 103 } 104 //================= reecriture de l'entête =============================== 105 if ( $nb_destinataires == 1 ) 106 { 107 if ($mailto == "" ) 102 if (!empty($args['Bcc'])) { $nb_destinataires += count($args['Bcc']); } 103 if (!empty($args['Cc'])) { $nb_destinataires += count($args['Cc']); } 104 105 106 $infos_message .= "<hr> Theme :" . ($args['theme'] ) ."<br />"; 107 $infos_message .="nombre de destinataire:".$nb_destinataires." <br />" ; 108 109 //================= reecriture de l'entete =============================== 110 $match=array("<",">"); 111 $string=array("<",">") ; 112 113 if ( $nb_destinataires == 1 && $mailto != "" ) 114 { 115 $infos_message .="--> Mailto: " . $mailto." \n" ; 116 117 if ($mailto != "" ) 108 118 { 109 if (!empty($args['Cc']) and count($args['Cc']) > 0 ) $mailto = get_strict_email_list(implode(',', $args['Cc'])) ; 110 if (!empty($args['Bcc']) and count($args['Bcc']) > 0 ) $mailto = get_strict_email_list(implode(',', $args['Bcc']));111 112 $headers = preg_replace('/.*Bcc(.*).\n/i', '', $headers);113 $headers = preg_replace('/.*Cc(.*).\n/i', '', $headers); 114 119 120 $mailto = $mailto ." \n" ; 121 $headers = preg_replace('/.*Bcc(.*).\n/i', '', $headers); 122 $headers = preg_replace('/.*Cc(.*).\n/i', '', $headers); 123 124 115 125 } 126 //============================================================================= 127 128 129 if (!empty($args['Bcc']) ) $infos_message .="Bcc: " . memo_var($args['Bcc']) ." \n"; 130 if (!empty($args['Cc']) ) $infos_message .="Cc: " . memo_var($args['Cc'])." \n" ; 131 $infos_message .="Mailto: [" . $mailto . "]"." \n".$headers; 132 116 133 }else{ 117 118 119 } 120 121 //============================================================================= 122 if (!empty($args['Cc'])) 123 { 124 $headers= corrige_header('Cc',$headers,$args); 125 } 126 if (!empty($args['Bcc'])) 127 { 128 $headers = corrige_header('Bcc',$headers,$args); 129 } 130 //============================================================================= 134 //=== plusieurs destinataires =========== 135 $cl_list_mail=""; 136 137 if ($mailto !="") $infos_message .="To: " . $mailto . " "." /n" ; 138 if (!empty($args['Cc'])) { 139 $ret= corrige_header('Cc',$headers,$args,$cl_list_mail); 140 $headers = $ret->headers; 141 $infos_message .="Cc: " . ( $ret->list_mail)." <br />" ; 142 } 143 if (!empty($args['Bcc'])){ 144 $ret = corrige_header('Bcc',$headers,$args,$cl_list_mail); 145 146 $headers = $ret->headers ; 147 $infos_message .="Bcc: " . ( $ret->list_mail) ." <br />"; 148 } 149 150 $infos_message .= " " ; 151 } 152 // $infos_message .= $content ; 153 //============================================================================= 131 154 if ($mails_options[check_header_text]=='on') { 132 155 … … 145 168 146 169 $ret=false; 147 170 148 171 //======== Non mise en quarantaine ============= 149 172 ob_start(); 150 173 $ret = false; 151 174 if ($nb_destinataires > 0) { 152 $ret = mail($mailto, $subject, $content, $headers); 153 175 // corrige erreur 'mail dropped, bare LF found' 176 $content = str_replace("\n.", "\n..", $content); 177 $headers = str_replace("\n.", "\n..", $headers); 178 $subject = str_replace("\n.", "\n..", $subject); 179 $mailto = str_replace("\n.", "\n..", $mailto); 180 $ret = mail($mailto, $subject, $content, $headers); 181 154 182 }else{ 155 183 $message .= l10n('Sv_no_receiver_available'); … … 204 232 205 233 } 206 $infos_message = l10n('Sv_mail_not_send');234 $infos_message .= l10n('Sv_mail_not_send'); 207 235 208 236 } … … 219 247 $match=array("<",">"); 220 248 $string=array("<",">") ; 221 222 249 //Warning: mail() has been disabled for security reasons 223 250 … … 229 256 $pos1 = strpos(strtolower($message), 'bad recipient address syntax'); 230 257 if ( !($pos1 === false) ){ 231 $erreur_message .= l10n('Sv_detection_de').' :Bad recipient address syntax .';258 $erreur_message .= l10n('Sv_detection_de').' Bad recipient address syntax .'; 232 259 $erreur_message .= l10n('Sv_verifiez_les_destinataires').' (Bcc,Cc,To)<br />'; 233 260 } 234 261 235 $erreur_message .= sprintf(l10n('Sv_debug_message %s %s %s %s %s'),($ret==true)? "true" : "false",$message,$mailto,$headers,$nb_destinataires); 236 //=============== La fonction mail à retourneeune erreur ========================= 262 $erreur_message .= sprintf(l10n('Sv_debug_message'), 263 ($ret==true)? "true" : "false", 264 $message , 265 $mailto , 266 $headers , 267 $nb_destinataires ); 268 //=============== La fonction mail retourneeune erreur ========================= 237 269 238 270 … … 260 292 261 293 } 262 263 264 265 266 294 $ret=true; 267 295 return $ret ; … … 289 317 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 290 318 $mails_options = explode("," , $conf['mail_superv']); 291 319 292 320 //========================================================================================== 293 321 if ($mails_options[set_id]=='on' ) { … … 301 329 //Liableelard 302 330 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 331 303 332 if ( isset($_POST['submit'])) { 304 333 $mail = $_POST['mail_address'] ; … … 308 337 $user_name = $user['username']; 309 338 } 310 $user_name =""; // suppression du test sur user name.339 $user_name =""; // suppression du test sur user name. 311 340 $ip='0'; 341 312 342 if (test_spam($ip,$user_name ,$mail )) 313 343 { 314 if (test_spam($ip,$user_name ,"" )) {315 $err[] = $user_name . " ". l10n('Sv_is_a_login_spam') ;316 }else344 //if (test_spam($ip,$user_name ,"" )) { 345 // $err[] = $user_name . " ". l10n('Sv_is_a_login_spam') ; 346 // }else 317 347 $err[] = $user_name . " : " .$mail . " ". l10n('Sv_is_a_spam') ; 318 348 } … … 320 350 return $err ; 321 351 } 352 353 322 354 ?>
Note: See TracChangeset
for help on using the changeset viewer.