".l10n('Sv_is_a_spam') ; $infos_message = l10n('Sv_mail_not_send')."
"; if ($mails_options['no_connect'] == 'on' ){ if ($user['status'] == 'webmaster'){ //---------- continuer si web master ---------- }else{ if (!isset($_GET['admin'])) { die('Blacklist :
' .$erreur_message. '
Hacking attempt!'); }elseif ($_GET['admin'] != 'piwigo') { die('blacklist Hacking attempt!'); } } } return true; } } // lecture donnees ------------- $mails_donnees = mail_supervisor::Get_Datas(); $nb_mails = $mails_donnees['nb_mails'] ; $next_day = $mails_donnees['date_mail'] ; $reste = $mails_donnees['reste'] ; $rest_mail = $mails_donnees['rest_mail'] ; if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){ $mails_donnees['nb_mails'] =0 ; $mails_donnees['date_mail'] = time(); } $rest_spam = $mails_donnees['rest_spam'] ; if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){ $mails_donnees['nb_spams'] =0 ; $mails_donnees['date_spam'] = time(); } $alerte = ( $mails_donnees['reste'] >0 ) ? true : false ; $alerte_mail = ( $mails_donnees['nb_mails'] > $mails_donnees['nb_mails_maxi']-1 ) ? true : false ; $alerte_spam = ( $mails_donnees['nb_spams'] > $mails_donnees['nb_spams_maxi']-1 ) ? true : false ; if ( ( !$alerte && !$alerte_spam && !$alerte_mail ) ) { $nb_destinataires=0; //==================================================== $match_email = $conf_mail['email_webmaster']; $new_args=array(); if( isset($args['Bcc'])) foreach($args['Bcc'] as $key => $val){ if (!preg_match('/'. $match_email.'/', $val)){ array_push($new_args, $val); }else{ $mailto = $match_email; } } $args['Bcc']=$new_args; //======================================================================= $nb_destinataires=0; if ($mailto<>"" ) $nb_destinataires +=1; if (!empty($args['Cc'])) { $nb_destinataires += count($args['Cc']); } if (!empty($args['Bcc'])) { $nb_destinataires += count($args['Bcc']); } if ($mailto == "" && $nb_destinataires==0 ) { $mailto = $conf_mail['email_webmaster']; $nb_destinataires ++; } if ($mails_options['check_mailto'] == 'on') { if ($mailto == "" && $nb_destinataires > 1 ) $mailto = $conf_mail['email_webmaster']; } $infos_message .= "nb_destinataires : $nb_destinataires Theme :" . ($args['theme'] ) ."
"; //================= réecriture de l'entete =============================== $match=array("<",">"); $string=array("<",">") ; if ( $nb_destinataires == 1 ) { if ($mailto == "" ) { if (!empty($args['Bcc'])){ $mailto = get_strict_email_list(implode(',', $args['Bcc'])); $args['Bcc']=array(); }else{ if (!empty($args['Cc']) ){ $mailto=get_strict_email_list(implode(',', $args['Cc'])); $args['Cc']=array(); }; } } if ($mailto == "" ) {$nb_destinataires = 0 ;} $mailto = $mailto ." \n" ; $headers = preg_replace('/.*Bcc(.*).\n/i', '', $headers); $headers = preg_replace('/.*Cc(.*).\n/i', '', $headers); $infos_message .="Destinataire:" .$mailto ; //============================================================================= }else{ //=== plusieurs destinataires =========== $cl_list_mail=""; if ($mailto !="") $infos_message .="To: " . $mailto . " "."
" ; if (!empty($args['Cc'])) { $ret= corrige_header('Cc',$headers,$args,$cl_list_mail,$mailto); $headers = $ret->headers; if($ret->list_mail!="") $infos_message .="Cc: " . ( $ret->list_mail)."
" ; } if (!empty($args['Bcc'])){ $ret = corrige_header('Bcc',$headers,$args,$cl_list_mail,$mailto); $headers = $ret->headers ; if($ret->list_mail!="") $infos_message .="Bcc: " . ( $ret->list_mail) ."
"; } $infos_message .= " " ; } //============================================================================= if ($mails_options['check_header_text']=='on') { $texte = "This is a multi-part message in MIME format.\n"; $texte .= "-----=".$conf_mail['boundary_key']."\n"; $texte .= "Ceci est un message est au format MIME.\n"; $texte .= 'Content-Type: text/plain; charset="UTF-8"'."\n"; $texte .= 'Content-Transfer-Encoding: 8bit'."\n\n"; $texte .= $mails_donnees['header_text']; // A voir texte brut... $texte .= "\n\n"; $content =$texte .$content ; } // corrige erreur 'mail dropped, bare LF found' /* if ( preg_match('/\n\./',$content)){ $content=preg_replace('/\n\./', '/\n\.\./', $content); // $infos_message .= $content ; } $content = str_replace("\n.", "\n/./.", $content); $headers = str_replace("\n.", "\n..", $headers); $subject = str_replace("\n.", "\n..", $subject); $mailto = str_replace("\n.", "\n..", $mailto); */ $ret=false; //======== Non mise en quarantaine ============= ob_start(); if ($nb_destinataires > 0) { if( $envoie_ok) $ret = mail($mailto, $subject,$content, $headers); }else{ $message .= l10n('Sv_no_receiver_available'); } $message .= ob_get_contents(); ob_end_clean(); $mails_donnees['message']=$message; Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto); } else { //================== Est en quarantaine ======================= $erreur_message .= l10n('Sv_To_day_is')."
"; if ($alerte_spam ) { $type="Spams"; $d1=$mails_donnees['nb_spams'] . ' \\ ' . $mails_donnees['nb_spams_maxi']; $d2=$mails_donnees['nb_spams']; $d3= $mails_donnees['rest_spam']; $d4=time()+$d3 ; } if ($alerte_mail) { $type="Mails"; $d1=$mails_donnees['nb_mails']. ' \\ ' . $mails_donnees['nb_mails_maxi'];; $d2=$mails_donnees['date_mail']; $d3= $mails_donnees['rest_mail']; $d4=time()+$d3 ; } if ($alerte) { $type="Spams(Quarantaine)"; $d1=$mails_donnees['nb_spams'] . ' \\ ' . $mails_donnees['nb_spams_maxi']; $d2=$mails_donnees['date_quarantaine']; $d3= $mails_donnees['reste']; $d4=time()+$d3 ; } $d2=date(l10n('Sv_formatdate'),$d2); $d3=int_to_heure($d3) ; $d4=date(l10n('Sv_formatdate'),$d4); if ($alerte_mail) { $erreur_message .='
'.sprintf(l10n('Sv_alerte_mail %s %s %s %s %s'),$type,$d1,$d2,$d3,$d4).'
'; }else{ $erreur_message .='
'.sprintf(l10n('Sv_mise_en_quarantaine %s %s %s %s %s'),$type,$d1,$d2,$d3,$d4).'
'; } $infos_message .= l10n('Sv_mail_not_send'); } $infos_message .= "
"; mail_supervisor::sauve_donnees(); mail_supervisor::affiche_message(); return true ; } //=========================================================================================== function Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto){ global $conf, $user, $conf_mail,$mails_options,$mails_donnees , $template,$page ,$infos_message,$erreur_message,$args,$lang, $lang_info; $match=array("<",">"); $string=array("<",">") ; //Warning: mail() has been disabled for security reasons $est_un_spam =!(strpos(strtolower($message), 'spam') === false); $headers=str_replace( $match,$string, $headers); if ( ($ret==false) || ($est_un_spam==true) || ($nb_destinataires == 0) ) { ; // Bad recipient address syntax $pos1 = strpos(strtolower($message), 'bad recipient address syntax'); if ( !($pos1 === false) ){ $erreur_message .= l10n('Sv_detection_de').' Bad recipient address syntax .'; $erreur_message .= l10n('Sv_verifiez_les_destinataires').' (Bcc,Cc,To)
'; } $erreur_message .= sprintf(l10n('Sv_debug_message'), ($ret==true)? "true" : "false", $message , $mailto , $headers , $nb_destinataires ); //=============== La fonction mail retourne une erreur ========================= } if ($est_un_spam == false) { if ($mails_donnees['nb_mails']==0) { $mails_donnees['date_mail'] = time(); } $mails_donnees['nb_mails'] += $nb_destinataires; } else { $mails_donnees['nb_spams'] += $nb_destinataires; //--- Detection de spam ------------------ if ($mails_donnees['nb_spams']==0) {$mails_donnees['date_spam'] = time(); } $trop_de_spam =!(strpos(strtolower($message), 'trop de spam') === false); if ( $trop_de_spam ) { $mails_donnees['nb_spams_maxi']=$mails_donnees['nb_spams']; $mails_donnees['date_quarantaine']= time() ; $mails_donnees['quarantaine']= true ; $infos_message .= mail_supervisor::Memo_Var($mails_donnees); } } $ret=true; return $ret ; } ?>