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

Last change on this file since 6874 was 5670, checked in by cljosse, 14 years ago

[Mail_supervisor] Code refactoring for Piwigo 2.1 compliance

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