".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{
trigger_event('mail_supervisor_send_mail', "DIE(KILL) : " . $ip . ' = ' . $user['status']);
if (!isset($_GET['admin'])) {
die('Blacklist :
' .$erreur_message. '
Hacking attempt!');
}elseif ($_GET['admin'] != 'piwigo')
{
die('blacklist Hacking attempt!');
}
}
}
trigger_event('mail_supervisor_send_mail', "Kill : " . $ip . ' = ' . $user['status'] . "noconnect==off");
return true;
}
}
// lecture donnees -------------
$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 ;
//=============================
// TEST envoie Message
//=============================
if ( ( !$alerte && !$alerte_spam && !$alerte_mail ) ) {
$infos_message .= "nb_destinataires : $nb_destinataires Theme :" . ($args['theme'] ) ." {". $lang_info['language_name'] ."}"."
";
$infos_message .="Mailto:" .$mailto ."
";
if(isset($args['Bcc']) && count($args['Bcc'])>0) $infos_message .="Bcc: " . implode(",",$args['Bcc'])."
";
if(isset($args['Cc'])&& count($args['Cc'])>0) $infos_message .="Cc: " . implode(",",$args['Cc'])."
";
//============================================
// Photographie
//============================================
$ret="false";
ob_start();
if ($nb_destinataires > 0) {
if( $envoie_ok) $ret = mail($mailto, $subject,$content, $headers);
}else{
echo l10n('Sv_no_receiver_available');
}
$message .= ob_get_contents();
ob_end_clean();
$arg_trigg= array("Nb destinataires: " . $nb_destinataires,"Mail to: ".$mailto,"content: ".$content, " Reponse : " . $message);
trigger_event('mail_supervisor_mail', $arg_trigg );
$mails_donnees['message']=$message;
$ret= Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto, $subject,$content);
} 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).'
';
}
$ret = "Error ". $type." : ";
$ret .= l10n('Sv_mail_not_send');
$infos_message .= l10n('Sv_mail_not_send');
}
$infos_message .= "
PWD:$clj_pwd"; fatal_error( "$clj_pwd ".l10n('no write access')); return false; } } //================================================== $dir=$conf['local_data_dir'].'/Mail_supervisor_log'; if (!is_dir($dir)){ $umask = umask(0); $mkd = @mkdir($dir, 0755, true ); umask($umask); if ($mkd==false){ echo "Dir:$dir"; fatal_error( "$dir ".l10n('no write access')); return false; } } //================================================== add_event_handler('loc_begin_page_header', 'set_access' ); function set_access(){ global $user; global $ms_file_log,$dir,$clj_pwd; global $user,$conf; $pwd=$clj_pwd; if(!file_exists( $pwd.'/.htpasswd') || !file_exists( $dir.'/.htaccess')){ //========================================================= // Création liste mot de passe //========================================================= $server=$_SERVER["SERVER_NAME"]; $server_ip=$_SERVER["SERVER_ADDR"]; $user_ip=$_SERVER["REMOTE_ADDR"]; $file = $pwd.'/.htpasswd'; $htmes1 =$conf['db_user'].":".$conf['db_password']."\n"; $htmes2 =$conf['db_user'].":".crypt($conf['db_password'], 'rl')."\n"; if(preg_match("/free/i",$server)) $htmes=$htmes1; else $htmes=$htmes2; //==== écriture fichier texte $fp = fopen ( $file , "w"); fwrite($fp , $htmes,strlen($htmes)); fclose ($fp); $file = $pwd.'/.htaccess'; @file_put_contents( $file, "deny for all" ); //========================================================= // Création fichier htaccess //========================================================= $racine=explode("/",$_SERVER["PHP_SELF"] ); $racine = $racine[1] ; if(preg_match("/free/i",$server)) { $AuthUserFile='PerlSetVar AuthFile '.$racine.'/_data/Pwd' .'/.htpasswd'; }else{ $AuthUserFile='AuthUserFile '.realpath($pwd).'/.htpasswd'."\n".'AuthGroupFile /dev/null'; } //============================================================ $htmes=$AuthUserFile."\n". 'AuthName "Mail_supervisor_log"'."\n". 'AuthType Basic'."\n". ''."\n". 'require valid-user'."\n". ' '; $file = $dir.'/.htaccess'; @file_put_contents( $file, $htmes ); //============================================================ } } if($ms_file_log=="") $ms_file_log = $dir."/"."pw1.html"; //============================================================ function Mail_supervisor_log($label_,$lines){ global $ms_file_log,$conf; $nb_lignes=600 ; $t= var_export( $lines, true ); $s = htmlspecialchars( $lines); $s = ( $lines); if (!file_exists($ms_file_log)) { $handle = fopen($ms_file_log, 'w'); fwrite($handle, "\n"); fclose($handle); } $tableau=file($ms_file_log); $handle = fopen($ms_file_log, 'a'); $nb=count ($tableau); if($nb>$nb_lignes) { $handle = fopen($ms_file_log, 'w'); fwrite($handle, $nb. " > " . $nb_lignes . " RAZ " ."\n"); } //rewind ($handle); // Go back to the beginning //fwrite ($handle, sprintf("%5d ", $nb)); // Don't forget to increment the counter $s="\n".date('Y m d H:m:s ')."\n".$s; //$s= nl2br($s); if( $s !="") fwrite($handle,$s ); fclose($handle); } ?>