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

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

[extensions] mail_supervisor cleaning of the programs

File size: 25.0 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
121$aff_nb=true;
122// *************************************************************************
123// |                          Selection de l'onglet                        |
124// *************************************************************************
125  $modif=false ;
126  $plugin =  mail_supervisor::Get_Version_plugins( MAIL_SUPERV_PATH);
127  $version = $plugin['version'] ;
128 //=========================================================
129  if (!isset($ip)) {
130      if (getenv("HTTP_CLIENT_IP")){
131      $ip=getenv("HTTP_CLIENT_IP");
132    } else{
133      $ip=getenv("REMOTE_ADDR");
134    }
135  }
136
137//================================================================================
138switch ($page['tab'])
139 {
140
141// *************************************************************************
142//                         initialisation                                  |
143// *************************************************************************
144  case 'mail_superv_admin':
145
146//=============================================================
147if ( isset($_POST['submit']) ) {
148
149    if ( $_POST['submit'] == l10n('Sv_refresh')   ) {
150
151    if ($mails_donnees['nb_mails'] == 0 )
152        $mails_donnees['date_mail'] = time();
153
154    if ($mails_donnees['nb_spams'] == 0 )
155       $mails_donnees['date_spam'] = time();
156
157
158            if ($mails_donnees['quarantaine'] == false) { 
159              $mails_donnees['reste'] = 0;
160      $mails_donnees['date_quarantaine']=time();
161     }
162     $infos_message .=  l10n('Sv_refresh') .'<br />';
163             echo "156 super_admin.php ";
164     mail_supervisor::sauve_donnees();
165     $aff_nb = false ;
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    if ( $_POST['submit'] == l10n('Sv_Valider') ) { 
181  //===================================================================
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_send_webmaster'] = isset($_POST['check_send_webmaster']) ? $_POST['check_send_webmaster'] : 'off' ;
185      $mails_options['no_ipaddress'] = isset($_POST['no_ipaddress']) ? $_POST['no_ipaddress'] : 'off' ;
186
187
188      //donnees
189      $mails_donnees['nb_mails_maxi'] = isset($_POST['nb_mails_maxi']) ? $_POST['nb_mails_maxi'] :  $mails_donnees['nb_mails_maxi']  ;
190      $mails_donnees['nb_mails_periode'] = isset($_POST['nb_mails_periode']) ? $_POST['nb_mails_periode'] :  $mails_donnees['nb_mails_periode']  ;
191      $mails_donnees['nb_spams_maxi'] = isset($_POST['nb_spams_maxi']) ? $_POST['nb_spams_maxi'] :  $mails_donnees['nb_spams_maxi']  ;
192      $mails_donnees['nb_spams_periode'] = isset($_POST['nb_spams_periode']) ? $_POST['nb_spams_periode'] :  $mails_donnees['nb_spams_periode']  ;
193
194      $mails_donnees['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] :  $mails_donnees['quarantaine_periode']  ;
195
196      $mails_donnees['message'] = isset($_POST['content']) ? $_POST['content'] :  $mails_donnees['message']  ;
197      $mails_donnees['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] :  $mails_donnees['header_text']  ;
198      //=========================================================================
199      verif_mails_donnees();
200      mail_supervisor::sauve_options();
201      mail_supervisor::sauve_donnees();
202      //==============================================================================
203      $infos_message  =  l10n('Sv_save_config') . " : " . l10n('Sv_Datas') . "<br />" ;
204      $erreur_message = "";
205     
206    }
207 }
208    $mails_donnees = mail_supervisor::Get_Datas();
209 verif_mails_donnees();
210//===============================================================================
211 $rest_mail= $mails_donnees['rest_mail'];
212 $rest_spam= $mails_donnees['rest_spam'];
213 $reste= $mails_donnees['reste'];
214 $quarantaine = ($mails_donnees['quarantaine'] == 'true') ? true : false ;
215 $template->assign(
216                    array(
217                        'check_mailto' => ($mails_options['check_mailto'] == 'on') ? 'checked="checked"' : '' ,
218                        'check_header_carbons' => ($mails_options['check_header_carbon'] == 'on') ? 'checked="checked"' : '' ,
219                        'check_send_webmaster' => ($mails_options['check_send_webmaster'] == 'on') ? 'checked="checked"' : '' ,
220                        'no_ipaddress' => ($mails_options['no_ipaddress'] == 'on') ? 'checked="checked"' : '' ,
221
222                        'nb_mails' => $mails_donnees['nb_mails'] ,
223                        'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_mail'])."'" ,
224                        'nb_mails_maxi' => $mails_donnees['nb_mails_maxi'] ,
225                        'nb_mails_periode' => "'". int_to_heure($mails_donnees['nb_mails_periode'])."'" ,
226                        'time_mails_reste' => "'".int_to_heure( $rest_mail )."'" ,
227
228                        'nb_spams' => $mails_donnees['nb_spams'] ,
229                        'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_spam'])."'" ,
230                        'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] ,
231                        'nb_spams_periode' => "'".int_to_heure($mails_donnees['nb_spams_periode'])."'" ,
232                        'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,
233
234                        'quarantaine' => $quarantaine ,
235                        'date_quarantaine' => "'".date(l10n('Sv_formatdate'),time()+$reste)."'" ,
236                        'quarantaine_periode' => "'".int_to_heure($mails_donnees['quarantaine_periode'])."'" ,
237                        'reste' => "'".int_to_heure($reste)."'",
238
239                        'message' => $mails_donnees['message'] ,
240                        'header_text' => "'".$mails_donnees['header_text']."'" ,
241
242                        'PHPWG_VERSION' =>   PHPWG_VERSION ,
243                        'version' =>     $version ,
244                        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
245                        'path_js' => $path_js,
246                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
247
248                        )
249                );
250     $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl')));
251     $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
252 break;
253/*************************************************************************
254*                     TEST                                             |
255*************************************************************************/
256
257   case 'mail_superv_test':
258        load_language('plugin.lang', MAIL_SUPERV_PATH);
259        $mails_donnees = mail_supervisor::Get_Datas() ;
260        $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
261
262        if ($group_id >= 0) {
263            $query = 'SELECT
264                        name
265                        FROM '.GROUPS_TABLE.'
266                        WHERE id = '.$group_id.'
267                        ;';
268            list($group_name) = mysql_fetch_row(pwg_query($query));
269        }   else {
270                $group_name="";
271        }
272
273//================================================
274// info by email to an access granted group of category informations
275
276if (isset($_POST['Submit']) and !empty($_POST['group'])){
277
278  set_make_full_url();
279    $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
280    $titre=empty($_POST['titre'])?$mails_donnees['titre']: stripslashes($_POST['titre']);
281    $sujet=empty($_POST['sujet'])?$mails_donnees['sujet']: stripslashes($_POST['sujet']);
282
283 if (function_exists('get_user_language_desc') ){
284    $message = get_user_language_desc($message);
285    $sujet = get_user_language_desc($sujet);
286    $titre = get_user_language_desc($titre);
287  }
288
289  $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
290  $mails_donnees['titre']= str_replace('"',"'",$titre) ;   
291  $mails_donnees['sujet']= str_replace('"',"'",$sujet) ; 
292
293  if ( $_POST['Submit']!= l10n('Sv_refresh') ) {
294  mail_supervisor::sauve_donnees();
295      $modif=false ;
296      } else{   
297    $mails_donnees=mail_supervisor::Get_Datas();
298    }
299
300
301if ( $_POST['Submit']==l10n('Sv_Valider') ) {
302  $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ;
303  mail_supervisor::sauve_options();
304  $_POST['Submit']="";
305 }else if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
306     /*************************************************************
307     * send en email to user's group
308     *
309     * @param:
310     *   - group_id: mail are sent to group with this Id
311     *   - email_format: mail format
312     *   - keyargs_subject: mail subject on l10n_args format
313     *   - dirname: short name of directory including template
314     *   - tpl_shortname: short template name without extension
315     *   - assign_vars: array used to assign_vars to mail template
316     *   - language_selected: send mail only to user with this selected language
317     *
318     * @return boolean (Ok or not)
319     ************************************************************/
320    pwg_mail_group(
321            $_POST['group'],
322            get_str_email_format(true),
323            get_l10n_args('[%s] %s', array($conf['gallery_title'],$sujet) ), //sujet
324            MAIL_SUPERV_PATH_ABS . 'admin/cat_group_info',  // template
325            array    ( 'titre' => $titre,
326                       'CPL_CONTENT' => $message,
327                       'signature' => $user['username']
328                      ),
329            '' 
330              );
331
332    $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
333    mail_supervisor::sauve_donnees();
334    $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ;
335    mail_supervisor::sauve_options();
336    $query = 'SELECT
337            name
338            FROM '.GROUPS_TABLE.'
339            WHERE id = '.$_POST['group'].'
340            ;';
341        list($group_name) = mysql_fetch_row(pwg_query($query));
342
343          array_push(
344                    $page['infos'],
345                    sprintf( l10n('An information email was sent to group "%s"'),
346                            $group_name  )
347                    );
348                                $group_id =-1 ;
349  }
350}
351
352//======================================================================================
353  $groups[-1] = '---------';
354  $query = ' SELECT id, name
355            FROM '.GROUPS_TABLE.'
356            ORDER BY name ASC
357            ;';
358
359  $result = pwg_query($query);
360//----------------------------------------------------------------
361  while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {   
362  $groups[$row['id']] = $row['name'];  }
363 //---------------------------------------------------------------
364if ( isset($_POST['Submit'])) $group_id=-1;
365  $template->assign(
366        'Group',
367        array( 'group_options'=> $groups,
368                'selected' => $group_id
369            )
370        );
371//=================================================================
372/*   
373 $List_dest=get_liste($group_id) ;
374   //$destinataires= implode("<br />".$chk_cl,get_liste($group_id));
375*/
376  $destinataires="";
377$List_dest = get_liste($group_id) ;
378 foreach ($List_dest as $dest_id){
379  $destinataires .= $dest_id['username']. "&lt" . $dest_id['email'].'><br />';
380 }
381  if( $destinataires !="" ) $infos_message .= " List :<hr>" .  $destinataires . "<hr>" ;
382
383   $mails_options['debug_mail'] = isset($mails_options['debug_mail']) ? $mails_options['debug_mail'] : "off" ;
384
385  $template->assign(
386                    array(
387                        'Groupe'     => $groups,
388                        'message_test' => $mails_donnees['message_test'] ,
389                        'liste' =>  get_liste($group_id) ,
390                         'debug_mail' => ($mails_options['debug_mail'] == 'on') ? 'checked="checked"' : '' ,
391                        'version' =>   $version ,
392                        'MAIL_CONTENT' => $mails_donnees['message_test'],
393                        'path_js' => $path_js,
394                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
395                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
396                        'sujet' => $mails_donnees['sujet'],
397                        'titre' =>  $mails_donnees['titre']
398                        )
399                    );
400
401   $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
402   $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
403//=========================================================================
404        $toolbar = 'Basic';
405        $width = '750px';
406        $height = '200px';
407        $areas = array();
408        $areas[]='MAIL_CONTENT';
409        if (!empty($areas)){
410                if (function_exists('set_fckeditor_instance'))
411                    set_fckeditor_instance($areas, $toolbar, $width, $height);
412            }
413
414   break;
415// *************************************************************************
416//              BLACK LISTE                                         |
417// *************************************************************************
418 case 'mail_black_liste':
419  global $user_name,$mail_adresse,$ip ;
420  $aff_nb=false;
421  //=======================================================================================
422  $info_ip = (isset($info_ip)) ? $info_ip : '' ;
423  $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ;
424  $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ;
425  $info_ip .= ":";
426  $val=explode(":",$info_ip);
427  $info_ip = trim($val[0]) ;
428  $ip_black = trim($val[1]) ;
429  if (isset($_POST['ip_black']))   $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
430        $istype="";
431    if ( isset($_POST['submit']) ){
432     if (clj_is_ip($ip_black)) $istype='IP';
433     else if (clj_is_mail($ip_black))  $istype='MAIL';
434      else   $istype='LOGIN';
435    if (  $_POST['submit'] == l10n('Sv_Ajout') )    {
436      $info_ip = 'Ajout' ;
437      $ip_black = trim( $_POST['ip_black']) ;
438      $infos_message .= $info_ip . '---->'. $ip_black ;
439    }
440     if (  $_POST['submit'] == l10n('Sv_Valider') ) {
441
442     $mails_options['no_mail_list'] = isset($_POST['no_mail_list']) ? "on" : "off" ;
443     $mails_options['no_connect'] = isset($_POST['no_connect']) ? "on" : "off" ;
444     $mails_options['set_auto'] = isset($_POST['set_auto']) ? "on" : "off" ;
445     $mails_options['set_id'] = isset($_POST['set_id']) ? "on" : "off" ;   
446
447     mail_supervisor::sauve_options();
448     $infos_message .=  l10n('Sv_save_config') . '<br />';
449  }
450}
451if (!isset($params)) $params=array();
452if (!isset($params['per_page'])) $params['per_page'] = 20 ;
453if (!isset($params['start']))    $params['start'] = 0 ;
454
455if (isset($_POST['per_page'])) $params['per_page'] =$_POST['per_page'];
456if (isset($_POST['start'])) $params['start'] =$_POST['start'];
457if (isset($_POST['next'])) $params['start'] +=   1;
458if (isset($_POST['prev']))  $params['start'] -=   1;
459 $params['start']= ($params['start']>=0) ? $params['start'] : 0 ;
460//=======================================================================================
461 include  (MAIL_SUPERV_PATH.'include/save_info.php');
462  $maxipage=(int) ( $nbip  / $params['per_page']) ;
463    $f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
464    $champs_ip=array();
465    $champs_bl=array();
466    if (!empty($liste_ip))  $champs_ip=array_keys($liste_ip[0]);
467    if (!empty($liste_bl))  $champs_bl=array_keys($liste_bl[0]);
468       $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ;
469       $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ;
470     $template->assign(
471                    array(
472                        'start' => $params['start'],
473                        'per_page' => $params['per_page'] ,
474                        'maxipage'  =>  $maxipage ,
475                        'smile_bonjour' => $smile_bonjour ,
476                        'img_logo' => $img_logo ,
477                        'champs_ip' => $champs_ip ,
478                        'liste_ip' => $liste_ip,
479                        'champs_bl' =>  $champs_bl   ,
480                        'liste_bl' => $liste_bl ,
481                        //'conf_admin_layout' => $conf['admin_layout'] ,
482                        'istype' => $istype ,
483                        'ip_black' => $ip_black ,
484                        'IS_SPAM' => test_spam(  $ip_black),
485                        'ip_black_len' =>  strlen($ip_black)  ,
486                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
487                        'path_js' => $path_js ,
488                        'F_ACTION' => $f_action ,
489
490                        'no_mail_list' => ($mails_options['no_mail_list'] == 'on') ? 'checked="checked"' : '' ,
491                        'no_connect' => ($mails_options['no_connect'] == 'on') ? 'checked="checked"' : '' ,
492                        'set_auto' => ($mails_options['set_auto'] == 'on') ? 'checked="checked"' : '' ,
493                        'set_id' => ($mails_options['set_id'] == 'on') ? 'checked="checked"' : '' ,
494
495                        'IP' =>  $ip ,
496                        'PAYS' =>  $pays  ,
497                        'VILLE' =>  $ville ,
498                        'REGION' =>  $region ,
499                        'version' =>     $version ,
500                'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
501
502                    )
503                );
504     //===============================================================
505  $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl')));
506  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
507
508
509   break;
510
511// *************************************************************************
512//                      AIDE                                               |
513// *************************************************************************
514     case 'mail_superv_help':
515
516
517      $aff_nb=false;
518      $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ;
519      $template->assign(
520                    array(
521              'smile_bonjour' => $smile_bonjour ,
522              'version' =>   $version ,
523              'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
524              'path_js' => $path_js,
525              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
526                    )
527            );
528    $aff_nb = false;
529    ;
530
531        $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_help.tpl')));
532        $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
533   break;
534 //====================================================================
535  }
536    if  ( $mails_donnees['reste'] < 0 ) {
537        $mails_donnees['quarantaine'] =false ;
538        $mails_donnees['date_quarantaine']= time()  ;
539        $mails_donnees['nb_spams'] = 0 ;
540        $modif == true ;
541    }
542
543
544    $rest_mail =    $mails_donnees['rest_mail'] ;
545    if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){
546       $mails_donnees['nb_mails'] =0 ;
547       $mails_donnees['date_mail'] = time();
548       $modif = true ;
549    }
550
551    $rest_spam =    $mails_donnees['rest_spam'] ;
552
553    if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){
554       $mails_donnees['nb_spams'] =0 ;
555       $mails_donnees['date_spam'] = time();
556       $modif = true ;
557    }
558    //======================================================
559    if ( $modif == true )   {
560                mail_supervisor::sauve_donnees();
561                $modif = false ;
562        }
563   //======================================================
564        if ($aff_nb == true) {
565         $infos_message .= 'Mails    : '.$mails_donnees['nb_mails']. '  \\  ' . $mails_donnees['nb_mails_maxi'];
566         $infos_message .= "\n".'Spams : '.$mails_donnees['nb_spams']. '  \\  ' . $mails_donnees['nb_spams_maxi'];
567        }
568
569
570     mail_supervisor::affiche_message();
571//========================================================================
572?>
Note: See TracBrowser for help on using the repository browser.