source: extensions/Mail_supervisor/admin/mail_superv_admin.php @ 11516

Last change on this file since 11516 was 10822, checked in by cljosse, 13 years ago

[extensions] mail_supervisor add option debug_mail,

File size: 24.3 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24if ( !defined('PHPWG_ROOT_PATH')) {  die('Hacking attempt!');}
25
26if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
27if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' ,  dirname(__FILE__).'/');
28
29global $user, $lang, $conf, $errors,$mails_donnees;
30global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ;
31// +-----------------------------------------------------------------------+
32// | Check Access and exit when user status is not ok                      |
33// +-----------------------------------------------------------------------+
34//check_status(ACCESS_ADMINISTRATOR);
35include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
36include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
37$my_base_url = get_admin_plugin_menu_link(__FILE__);
38
39 load_language('plugin.lang', MAIL_SUPERV_PATH);
40 //=========================================================
41 $sv_Week=explode(" ",l10n('Week %d'));
42if( !isset($lang['Week'])) $lang['Week'] =   $sv_Week[0];
43
44
45$lang['Sv_format_d'] = '+1 '.$lang['Week'].'<br />
46  +1 '.$lang['Day'].'<br />
47  +1 '.$lang['Hour'].'<br />
48  +1 '.$lang['Minute'].'<br />
49  +1 '.$lang['Second'].'<br />';
50 //==============================================================
51 load_language('help/plugin.lang', MAIL_SUPERV_PATH);
52
53    if (!isset($_GET['tab']))
54    $page['tab'] = 'mail_superv_admin';
55else
56  $page['tab'] = $_GET['tab'];
57
58if (file_exists ( 'admin/themes/clear/icon/help.png'))
59{
60//version 2.1
61
62   $icon_path = 'themes/default/icon/help.png';
63   $path_js=  'themes/default/js/' ;
64
65 }
66 else
67 {
68// version 1.9
69  $path_js=  "template-common/lib/";
70  $icon_path =  "admin/template/goto/theme/clear/icon/help.png";
71}
72
73
74$tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
75$tabsheet = new tabsheet();
76$tabsheet->add('mail_superv_admin',
77               l10n('Sv_Tab_set'),
78               $my_base_url.'&amp;tab=mail_superv_admin');
79
80$tabsheet->add('mail_superv_test',
81               l10n('Sv_Tab_test'),
82               $my_base_url.'&amp;tab=mail_superv_test');
83
84$tabsheet->add( 'mail_black_liste',
85               l10n('Sv_blackliste'),
86               $my_base_url.'&amp;tab=mail_black_liste');
87
88
89$tabsheet->add('mail_superv_help',
90                $tabhelp,
91               $my_base_url.'&amp;tab=mail_superv_help');
92
93$tabsheet->select($page['tab']);
94$tabsheet->assign();
95
96$page['global'] = array();
97$error = array();
98
99include_once (MAIL_SUPERV_PATH.'mail_super.inc.php');
100include_once (MAIL_SUPERV_PATH.'include/constants.php');
101
102  if (!isset($infos_message))   {
103      $infos_message = "";
104  }
105  if (!isset($erreur_message)){
106      $erreur_message = "";
107  }
108
109if (isset($conf['mail_superv'])) {
110   global $pays,$region,$ville,$ip ;
111    include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
112//================================================================================================
113
114   $mails_donnees = mail_supervisor::Get_Datas();
115}else {
116    die ("mail");
117}
118
119
120$aff_nb=true;
121// *************************************************************************
122// |                          Selection de l'onglet                        |
123// *************************************************************************
124  $modif=false ;
125  $plugin =  mail_supervisor::Get_Version_plugins( MAIL_SUPERV_PATH);
126  $version = $plugin['version'] ;
127 //=========================================================
128  if (!isset($ip)) {
129      if (getenv("HTTP_CLIENT_IP")){
130      $ip=getenv("HTTP_CLIENT_IP");
131    } else{
132      $ip=getenv("REMOTE_ADDR");
133    }
134  }
135
136//================================================================================
137switch ($page['tab'])
138 {
139
140// *************************************************************************
141//                         initialisation                                  |
142// *************************************************************************
143  case 'mail_superv_admin':
144
145//=============================================================
146if ( isset($_POST['submit']) ) {
147
148    if ( $_POST['submit'] == l10n('Sv_refresh')   ) {
149
150    if ($mails_donnees['nb_mails'] == 0 )
151        $mails_donnees['date_mail'] = time();
152
153    if ($mails_donnees['nb_spams'] == 0 )
154       $mails_donnees['date_spam'] = time();
155
156
157    if ($mails_donnees['quarantaine'] == false)
158    { $mails_donnees['reste'] = 0;
159      $mails_donnees['date_quarantaine']=time();
160     }
161     $infos_message .=  l10n('Sv_refresh') .'<br />';
162     mail_supervisor::sauve_donnees();
163     $aff_nb = false ;
164
165
166    }
167
168    if ( $_POST['submit'] == l10n('Sv_raz')   ) {
169      $mails_donnees['date_quarantaine']=time();
170      $mails_donnees['nb_mails'] = 0  ;
171      $mails_donnees['nb_spams'] = 0  ;
172      $mails_donnees['date_mail'] = time();
173      $mails_donnees['date_spam'] = time();
174      $mails_donnees['reste'] = 0;
175      $mails_donnees['quarantaine']='false';
176      mail_supervisor::sauve_donnees();
177      $infos_message .=  l10n('Sv_raz') .'<br />';
178    }
179
180  //===================================================================
181    if ( $_POST['submit'] == l10n('Sv_Valider') ) {
182      $mails_options['check_mailto'] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ;
183      $mails_options['check_header_carbon'] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ;
184      $mails_options['check_header_text'] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ;
185
186      //donnees
187      $mails_donnees['nb_mails_maxi'] = isset($_POST['nb_mails_maxi']) ? $_POST['nb_mails_maxi'] :  $mails_donnees['nb_mails_maxi']  ;
188      $mails_donnees['nb_mails_periode'] = isset($_POST['nb_mails_periode']) ? $_POST['nb_mails_periode'] :  $mails_donnees['nb_mails_periode']  ;
189      $mails_donnees['nb_spams_maxi'] = isset($_POST['nb_spams_maxi']) ? $_POST['nb_spams_maxi'] :  $mails_donnees['nb_spams_maxi']  ;
190      $mails_donnees['nb_spams_periode'] = isset($_POST['nb_spams_periode']) ? $_POST['nb_spams_periode'] :  $mails_donnees['nb_spams_periode']  ;
191
192      $mails_donnees['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] :  $mails_donnees['quarantaine_periode']  ;
193
194      $mails_donnees['message'] = isset($_POST['content']) ? $_POST['content'] :  $mails_donnees['message']  ;
195      $mails_donnees['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] :  $mails_donnees['header_text']  ;
196      //=======================================================================================================
197      verif_mails_donnees();
198      mail_supervisor::sauve_options();
199      mail_supervisor::sauve_donnees();
200      //==============================================================================
201      $infos_message  =  l10n('Sv_save_config') . " : " . l10n('Sv_Datas') . "<br />" ;
202      $erreur_message = "";
203      $mails_donnees = mail_supervisor::Get_Datas() ;
204    }
205 }
206    $mails_donnees = mail_supervisor::Get_Datas();
207 verif_mails_donnees();
208//===============================================================================
209 $rest_mail= $mails_donnees['rest_mail'];
210 $rest_spam= $mails_donnees['rest_spam'];
211 $reste= $mails_donnees['reste'];
212 $quarantaine = ($mails_donnees['quarantaine'] == 'true') ? true : false ;
213 $template->assign(
214                    array(
215                        'check_mailto' => ($mails_options['check_mailto'] == 'on') ? 'checked="checked"' : '' ,
216                        'check_header_carbons' => ($mails_options['check_header_carbon'] == 'on') ? 'checked="checked"' : '' ,
217                        'check_header_text' => ($mails_options['check_header_text'] == 'on') ? 'checked="checked"' : '' ,
218
219
220                        'nb_mails' => $mails_donnees['nb_mails'] ,
221                        'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_mail'])."'" ,
222                        'nb_mails_maxi' => $mails_donnees['nb_mails_maxi'] ,
223                        'nb_mails_periode' => "'". int_to_heure($mails_donnees['nb_mails_periode'])."'" ,
224                        'time_mails_reste' => "'".int_to_heure( $rest_mail )."'" ,
225
226                        'nb_spams' => $mails_donnees['nb_spams'] ,
227                        'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_spam'])."'" ,
228                        'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] ,
229                        'nb_spams_periode' => "'".int_to_heure($mails_donnees['nb_spams_periode'])."'" ,
230                        'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,
231
232                        'quarantaine' => $quarantaine ,
233                        'date_quarantaine' => "'".date(l10n('Sv_formatdate'),time()+$reste)."'" ,
234                        'quarantaine_periode' => "'".int_to_heure($mails_donnees['quarantaine_periode'])."'" ,
235                        'reste' => "'".int_to_heure($reste)."'",
236
237                        'message' => $mails_donnees['message'] ,
238                        'header_text' => "'".$mails_donnees['header_text']."'" ,
239
240                        'PHPWG_VERSION' =>   PHPWG_VERSION ,
241                        'version' =>     $version ,
242                        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
243                        'path_js' => $path_js,
244                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
245
246                        )
247                );
248     $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl')));
249     $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
250 break;
251  // *************************************************************************
252//                        TEST                                             |
253// *************************************************************************
254
255   case 'mail_superv_test':
256        load_language('plugin.lang', MAIL_SUPERV_PATH);
257        $mails_donnees = mail_supervisor::Get_Datas() ;
258        $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
259
260        if ($group_id >= 0) {
261            $query = 'SELECT
262                        name
263                        FROM '.GROUPS_TABLE.'
264                        WHERE id = '.$group_id.'
265                        ;';
266            list($group_name) = mysql_fetch_row(pwg_query($query));
267        }   else {
268                $group_name="";
269        }
270
271//================================================
272// info by email to an access granted group of category informations
273
274
275if (isset($_POST['Submit']) and !empty($_POST['group']))
276{
277  set_make_full_url();
278
279  /* TODO: if $category['representative_picture_id']
280    is empty find child representative_picture_id */
281
282
283    if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
284    else $titre=$conf['gallery_title'];
285
286    $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
287
288 if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message);
289
290if ( $_POST['Submit']==l10n('Sv_Valider') ) {
291  $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
292  mail_supervisor::sauve_donnees();
293  $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ;
294  mail_supervisor::sauve_options();
295  $_POST['Submit']="";
296 }else if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
297     /*
298     * send en email to user's group
299     *
300     * @param:
301     *   - group_id: mail are sent to group with this Id
302     *   - email_format: mail format
303     *   - keyargs_subject: mail subject on l10n_args format
304     *   - dirname: short name of directory including template
305     *   - tpl_shortname: short template name without extension
306     *   - assign_vars: array used to assign_vars to mail template
307     *   - language_selected: send mail only to user with this selected language
308     *
309     * @return boolean (Ok or not)
310    */
311    pwg_mail_group(
312            $_POST['group'],
313            get_str_email_format(true),
314            get_l10n_args('[%s] %s', array($conf['gallery_title'],'Test Mail_supervisor') ), //sujet
315            MAIL_SUPERV_PATH_ABS . 'admin/cat_group_info',  // template
316            array    ( 'titre' => 'Mail_supervisor',
317                       'CPL_CONTENT' => $message,
318                       'signature' => $user['username']
319                      ),
320            '' 
321              );
322
323    $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
324    mail_supervisor::sauve_donnees();
325    $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ;
326    mail_supervisor::sauve_options();
327    $query = 'SELECT
328            name
329            FROM '.GROUPS_TABLE.'
330            WHERE id = '.$_POST['group'].'
331            ;';
332        list($group_name) = mysql_fetch_row(pwg_query($query));
333
334          array_push(
335                    $page['infos'],
336                    sprintf( l10n('An information email was sent to group "%s"'),
337                            $group_name  )
338                    );
339                                $group_id =-1 ;
340  }
341}
342
343//======================================================================================
344  $groups[-1] = '---------';
345  $query = ' SELECT id, name
346            FROM '.GROUPS_TABLE.'
347            ORDER BY name ASC
348            ;';
349
350  $result = pwg_query($query);
351//----------------------------------------------------------------
352  while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
353  {    $groups[$row['id']] = $row['name'];  }
354 //---------------------------------------------------------------
355if ( isset($_POST['Submit'])) $group_id=-1;
356  $template->assign(
357        'Group',
358        array( 'group_options'=> $groups,
359                'selected' => $group_id
360            )
361        );
362//=================================================================
363/*   
364 $List_dest=get_liste($group_id) ;
365   //$destinataires= implode("<br />".$chk_cl,get_liste($group_id));
366*/
367  $destinataires="";
368$List_dest = get_liste($group_id) ;
369 foreach ($List_dest as $dest_id){
370  $destinataires .= $dest_id['username']. "&lt" . $dest_id['email'].'><br />';
371 }
372  if( $destinataires !="" ) $infos_message .= " List :<hr>" .  $destinataires . "<hr>" ;
373
374   $mails_options['debug_mail'] = isset($mails_options['debug_mail']) ? $mails_options['debug_mail'] : "off" ;
375
376  $template->assign(
377                    array(
378                        'Groupe'     => $groups,
379                        'message_test' => $mails_donnees['message_test'] ,
380                        'liste' =>  get_liste($group_id) ,
381                         'debug_mail' => ($mails_options['debug_mail'] == 'on') ? 'checked="checked"' : '' ,
382                        'version' =>   $version ,
383                        'MAIL_CONTENT' => $mails_donnees['message_test'],
384                        'path_js' => $path_js,
385                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
386                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
387                        )
388                    );
389
390   $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
391   $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
392//=========================================================================
393        $toolbar = 'Basic';
394        $width = '750px';
395        $height = '200px';
396        $areas = array();
397        $areas[]='MAIL_CONTENT';
398        if (!empty($areas)){
399                if (function_exists('set_fckeditor_instance'))
400                    set_fckeditor_instance($areas, $toolbar, $width, $height);
401            }
402
403   break;
404// *************************************************************************
405//              BLACK LISTE                                         |
406// *************************************************************************
407 case 'mail_black_liste':
408  global $user_name,$mail_adresse,$ip ;
409  $aff_nb=false;
410  //=======================================================================================
411  $info_ip = (isset($info_ip)) ? $info_ip : '' ;
412  $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ;
413  $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ;
414  $info_ip .= ":";
415  $val=explode(":",$info_ip);
416  $info_ip = trim($val[0]) ;
417  $ip_black = trim($val[1]) ;
418  if (isset($_POST['ip_black']))   $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
419        $istype="";
420    if ( isset($_POST['submit']) ){
421     if (clj_is_ip($ip_black)) $istype='IP';
422     else if (clj_is_mail($ip_black))  $istype='MAIL';
423      else   $istype='LOGIN';
424    if (  $_POST['submit'] == l10n('Sv_Ajout') )    {
425      $info_ip = 'Ajout' ;
426      $ip_black = trim( $_POST['ip_black']) ;
427      $infos_message .= $info_ip . '---->'. $ip_black ;
428    }
429     if (  $_POST['submit'] == l10n('Sv_Valider') ) {
430
431     $mails_options['no_mail_list'] = isset($_POST['no_mail_list']) ? "on" : "off" ;
432     $mails_options['no_connect'] = isset($_POST['no_connect']) ? "on" : "off" ;
433     $mails_options['set_auto'] = isset($_POST['set_auto']) ? "on" : "off" ;
434     $mails_options['set_id'] = isset($_POST['set_id']) ? "on" : "off" ;   
435
436     mail_supervisor::sauve_options();
437     $infos_message .=  l10n('Sv_save_config') . '<br />';
438  }
439}
440if (!isset($params)) $params=array();
441if (!isset($params['per_page'])) $params['per_page'] = 20 ;
442if (!isset($params['start']))    $params['start'] = 0 ;
443
444if (isset($_POST['per_page'])) $params['per_page'] =$_POST['per_page'];
445if (isset($_POST['start'])) $params['start'] =$_POST['start'];
446if (isset($_POST['next'])) $params['start'] +=   1;
447if (isset($_POST['prev']))  $params['start'] -=   1;
448 $params['start']= ($params['start']>=0) ? $params['start'] : 0 ;
449//=======================================================================================
450 include  (MAIL_SUPERV_PATH.'include/save_info.php');
451  $maxipage=(int) ( $nbip  / $params['per_page']) ;
452    $f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
453    $champs_ip=array();
454    $champs_bl=array();
455    if (!empty($liste_ip))  $champs_ip=array_keys($liste_ip[0]);
456    if (!empty($liste_bl))  $champs_bl=array_keys($liste_bl[0]);
457       $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ;
458       $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ;
459     $template->assign(
460                    array(
461                        'start' => $params['start'],
462                        'per_page' => $params['per_page'] ,
463                        'maxipage'  =>  $maxipage ,
464                        'smile_bonjour' => $smile_bonjour ,
465                        'img_logo' => $img_logo ,
466                        'champs_ip' => $champs_ip ,
467                        'liste_ip' => $liste_ip,
468                        'champs_bl' =>  $champs_bl   ,
469                        'liste_bl' => $liste_bl ,
470                        //'conf_admin_layout' => $conf['admin_layout'] ,
471                        'istype' => $istype ,
472                        'ip_black' => $ip_black ,
473                        'IS_SPAM' => test_spam(  $ip_black),
474                        'ip_black_len' =>  strlen($ip_black)  ,
475                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
476                        'path_js' => $path_js ,
477                        'F_ACTION' => $f_action ,
478
479                        'no_mail_list' => ($mails_options['no_mail_list'] == 'on') ? 'checked="checked"' : '' ,
480                        'no_connect' => ($mails_options['no_connect'] == 'on') ? 'checked="checked"' : '' ,
481                        'set_auto' => ($mails_options['set_auto'] == 'on') ? 'checked="checked"' : '' ,
482                        'set_id' => ($mails_options['set_id'] == 'on') ? 'checked="checked"' : '' ,
483                        'IP' =>  $ip ,
484                        'PAYS' =>  $pays  ,
485                        'VILLE' =>  $ville ,
486                        'REGION' =>  $region ,
487                        'version' =>     $version ,
488                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
489
490                    )
491                );
492     //===============================================================
493  $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl')));
494  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
495
496
497   break;
498
499// *************************************************************************
500//                      AIDE                                               |
501// *************************************************************************
502     case 'mail_superv_help':
503
504
505      $aff_nb=false;
506      $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ;
507      $template->assign(
508                    array(
509              'smile_bonjour' => $smile_bonjour ,
510              'version' =>   $version ,
511              'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
512              'path_js' => $path_js,
513              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
514                    )
515            );
516    $aff_nb = false;
517    ;
518
519        $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_help.tpl')));
520        $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
521   break;
522 //====================================================================
523  }
524//================================================================================
525
526
527
528    if  ( $mails_donnees['reste'] < 0 ) {
529        $mails_donnees['quarantaine'] =false ;
530        $mails_donnees['date_quarantaine']= time()  ;
531        $mails_donnees['nb_spams'] = 0 ;
532        $modif == true ;
533    }
534
535
536    $rest_mail =    $mails_donnees['rest_mail'] ;
537    if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){
538       $mails_donnees['nb_mails'] =0 ;
539       $mails_donnees['date_mail'] = time();
540       $modif = true ;
541    }
542
543    $rest_spam =    $mails_donnees['rest_spam'] ;
544
545    if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){
546       $mails_donnees['nb_spams'] =0 ;
547       $mails_donnees['date_spam'] = time();
548       $modif = true ;
549    }
550    if ( $modif == true )   {
551                mail_supervisor::sauve_donnees();
552                $modif = false ;
553        }
554
555        if ($aff_nb == true) {
556         $infos_message .= 'Mails    : '.$mails_donnees['nb_mails']. '  \\  ' . $mails_donnees['nb_mails_maxi'];
557         $infos_message .= "\n".'Spams : '.$mails_donnees['nb_spams']. '  \\  ' . $mails_donnees['nb_spams_maxi'];
558        }
559
560
561     mail_supervisor::affiche_message();
562//========================================================================
563?>
Note: See TracBrowser for help on using the repository browser.