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
RevLine 
[4020]1<?php
[4029]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
[9702]24if ( !defined('PHPWG_ROOT_PATH')) {  die('Hacking attempt!');}
[4132]25
[4041]26if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
[8917]27if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' ,  dirname(__FILE__).'/');
[4041]28
[7050]29global $user, $lang, $conf, $errors,$mails_donnees;
[4888]30global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ;
[4040]31// +-----------------------------------------------------------------------+
32// | Check Access and exit when user status is not ok                      |
33// +-----------------------------------------------------------------------+
[4132]34//check_status(ACCESS_ADMINISTRATOR);
[4020]35include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
[4220]36include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
[4040]37$my_base_url = get_admin_plugin_menu_link(__FILE__);
[4888]38
[4054]39 load_language('plugin.lang', MAIL_SUPERV_PATH);
[4888]40 //=========================================================
41 $sv_Week=explode(" ",l10n('Week %d'));
42if( !isset($lang['Week'])) $lang['Week'] =   $sv_Week[0];
[4065]43
[4132]44
[4888]45$lang['Sv_format_d'] = '+1 '.$lang['Week'].'<br />
46  +1 '.$lang['Day'].'<br />
47  +1 '.$lang['Hour'].'<br />
48  +1 '.$lang['Minute'].'<br />
[10419]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';
[4040]55else
56  $page['tab'] = $_GET['tab'];
[4029]57
[10419]58if (file_exists ( 'admin/themes/clear/icon/help.png'))
[5670]59{
60//version 2.1
[10419]61
[5670]62   $icon_path = 'themes/default/icon/help.png';
[10419]63   $path_js=  'themes/default/js/' ;
[4059]64
[5670]65 }
66 else
67 {
68// version 1.9
[10419]69  $path_js=  "template-common/lib/";
[5670]70  $icon_path =  "admin/template/goto/theme/clear/icon/help.png";
71}
[4059]72
[10419]73
[5670]74$tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
[4040]75$tabsheet = new tabsheet();
76$tabsheet->add('mail_superv_admin',
[4879]77               l10n('Sv_Tab_set'),
[4040]78               $my_base_url.'&amp;tab=mail_superv_admin');
[10419]79
[4040]80$tabsheet->add('mail_superv_test',
[4879]81               l10n('Sv_Tab_test'),
[4040]82               $my_base_url.'&amp;tab=mail_superv_test');
[10419]83
[4132]84$tabsheet->add( 'mail_black_liste',
[4879]85               l10n('Sv_blackliste'),
[10419]86               $my_base_url.'&amp;tab=mail_black_liste');
87
88
[5670]89$tabsheet->add('mail_superv_help',
90                $tabhelp,
[4040]91               $my_base_url.'&amp;tab=mail_superv_help');
[10419]92
[4040]93$tabsheet->select($page['tab']);
94$tabsheet->assign();
[4020]95
[4040]96$page['global'] = array();
97$error = array();
98
[10419]99include_once (MAIL_SUPERV_PATH.'mail_super.inc.php');
100include_once (MAIL_SUPERV_PATH.'include/constants.php');
[4206]101
[10419]102  if (!isset($infos_message))   {
[9702]103      $infos_message = "";
104  }
105  if (!isset($erreur_message)){
106      $erreur_message = "";
107  }
[4888]108
[4220]109if (isset($conf['mail_superv'])) {
[10419]110   global $pays,$region,$ville,$ip ;
111    include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
112//================================================================================================
[4040]113
[9702]114   $mails_donnees = mail_supervisor::Get_Datas();
[4220]115}else {
[9702]116    die ("mail");
[4220]117}
118
119
[4052]120$aff_nb=true;
[4040]121// *************************************************************************
[7050]122// |                          Selection de l'onglet                        |
[4040]123// *************************************************************************
[9702]124  $modif=false ;
125  $plugin =  mail_supervisor::Get_Version_plugins( MAIL_SUPERV_PATH);
126  $version = $plugin['version'] ;
[4888]127 //=========================================================
[9702]128  if (!isset($ip)) {
[10419]129      if (getenv("HTTP_CLIENT_IP")){
130      $ip=getenv("HTTP_CLIENT_IP");
131    } else{
132      $ip=getenv("REMOTE_ADDR");
[9702]133    }
134  }
[10419]135
[4040]136//================================================================================
137switch ($page['tab'])
138 {
[10419]139
[4040]140// *************************************************************************
141//                         initialisation                                  |
142// *************************************************************************
143  case 'mail_superv_admin':
[10419]144
[4220]145//=============================================================
146if ( isset($_POST['submit']) ) {
[10419]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 />';
[9702]162     mail_supervisor::sauve_donnees();
[10419]163     $aff_nb = false ;
[4020]164
[10419]165
166    }
167
168    if ( $_POST['submit'] == l10n('Sv_raz')   ) {
[10822]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 />';
[10419]178    }
[4206]179
[8917]180  //===================================================================
[10419]181    if ( $_POST['submit'] == l10n('Sv_Valider') ) {
[10822]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' ;
[10419]185
[10822]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']  ;
[4020]191
[10822]192      $mails_donnees['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] :  $mails_donnees['quarantaine_periode']  ;
[10419]193
[10822]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    }
[10419]205 }
206    $mails_donnees = mail_supervisor::Get_Datas();
[9702]207 verif_mails_donnees();
[10419]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 ;
[9702]213 $template->assign(
[10419]214                    array(
[9702]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"' : '' ,
[4156]218
[10419]219
[9702]220                        'nb_mails' => $mails_donnees['nb_mails'] ,
221                        'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_mail'])."'" ,
[10419]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
[9702]226                        'nb_spams' => $mails_donnees['nb_spams'] ,
227                        'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_spam'])."'" ,
[10419]228                        'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] ,
[9702]229                        'nb_spams_periode' => "'".int_to_heure($mails_donnees['nb_spams_periode'])."'" ,
[10419]230                        'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,
231
[9702]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)."'",
[10419]236
[9702]237                        'message' => $mails_donnees['message'] ,
238                        'header_text' => "'".$mails_donnees['header_text']."'" ,
[10419]239
240                        'PHPWG_VERSION' =>   PHPWG_VERSION ,
241                        'version' =>     $version ,
[9702]242                        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
243                        'path_js' => $path_js,
244                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
[10419]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;
[9702]251  // *************************************************************************
[4040]252//                        TEST                                             |
253// *************************************************************************
[10419]254
[4040]255   case 'mail_superv_test':
[10419]256        load_language('plugin.lang', MAIL_SUPERV_PATH);
257        $mails_donnees = mail_supervisor::Get_Datas() ;
258        $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
[8917]259
[10419]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        }
[8917]270
[4040]271//================================================
[5670]272// info by email to an access granted group of category informations
[8917]273
274
275if (isset($_POST['Submit']) and !empty($_POST['group']))
[5670]276{
277  set_make_full_url();
[8917]278
[10419]279  /* TODO: if $category['representative_picture_id']
[5670]280    is empty find child representative_picture_id */
[4020]281
282
[10419]283    if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
284    else $titre=$conf['gallery_title'];
[5670]285
[10419]286    $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
[8917]287
[5670]288 if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message);
[10822]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']="";
[10816]296 }else if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
[10419]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),
[10816]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              );
[5670]322
[10822]323    $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
[10419]324    mail_supervisor::sauve_donnees();
[10822]325    $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ;
326    mail_supervisor::sauve_options();
[8917]327    $query = 'SELECT
[10419]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 ;
[8917]340  }
[10419]341}
[4040]342
[8917]343//======================================================================================
[4040]344  $groups[-1] = '---------';
[8917]345  $query = ' SELECT id, name
[10419]346            FROM '.GROUPS_TABLE.'
347            ORDER BY name ASC
348            ;';
[4040]349
350  $result = pwg_query($query);
[10419]351//----------------------------------------------------------------
[4132]352  while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
[8917]353  {    $groups[$row['id']] = $row['name'];  }
[10419]354 //---------------------------------------------------------------
[8917]355if ( isset($_POST['Submit'])) $group_id=-1;
[4040]356  $template->assign(
[10419]357        'Group',
358        array( 'group_options'=> $groups,
359                'selected' => $group_id
360            )
361        );
[4040]362//=================================================================
[10816]363/*   
364 $List_dest=get_liste($group_id) ;
365   //$destinataires= implode("<br />".$chk_cl,get_liste($group_id));
[10822]366*/
[10816]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
[10822]374   $mails_options['debug_mail'] = isset($mails_options['debug_mail']) ? $mails_options['debug_mail'] : "off" ;
375
[4040]376  $template->assign(
[10419]377                    array(
[10816]378                        'Groupe'     => $groups,
379                        'message_test' => $mails_donnees['message_test'] ,
380                        'liste' =>  get_liste($group_id) ,
[10822]381                         'debug_mail' => ($mails_options['debug_mail'] == 'on') ? 'checked="checked"' : '' ,
[10816]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 ,
[10419]387                        )
[10816]388                    );
[10419]389
[8917]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');
[10419]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
[4040]403   break;
404// *************************************************************************
[4132]405//              BLACK LISTE                                         |
[10419]406// *************************************************************************
407 case 'mail_black_liste':
[9702]408  global $user_name,$mail_adresse,$ip ;
409  $aff_nb=false;
[10419]410  //=======================================================================================
[9702]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]) ;
[4220]418  if (isset($_POST['ip_black']))   $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
[10419]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') )    {
[9702]425      $info_ip = 'Ajout' ;
426      $ip_black = trim( $_POST['ip_black']) ;
[10419]427      $infos_message .= $info_ip . '---->'. $ip_black ;
[9702]428    }
[10419]429     if (  $_POST['submit'] == l10n('Sv_Valider') ) {
430
[9702]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" ;
[10822]434     $mails_options['set_id'] = isset($_POST['set_id']) ? "on" : "off" ;   
435
[9702]436     mail_supervisor::sauve_options();
[10419]437     $infos_message .=  l10n('Sv_save_config') . '<br />';
[9702]438  }
439}
[4938]440if (!isset($params)) $params=array();
441if (!isset($params['per_page'])) $params['per_page'] = 20 ;
[10419]442if (!isset($params['start']))    $params['start'] = 0 ;
[4938]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;
[9702]448 $params['start']= ($params['start']>=0) ? $params['start'] : 0 ;
[10419]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" ;
[4156]459     $template->assign(
[10419]460                    array(
[8917]461                        'start' => $params['start'],
462                        'per_page' => $params['per_page'] ,
463                        'maxipage'  =>  $maxipage ,
464                        'smile_bonjour' => $smile_bonjour ,
465                        'img_logo' => $img_logo ,
[10419]466                        'champs_ip' => $champs_ip ,
[8917]467                        'liste_ip' => $liste_ip,
[10419]468                        'champs_bl' =>  $champs_bl   ,
[8917]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 ,
[10419]478
[9702]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"' : '' ,
[10419]483                        'IP' =>  $ip ,
[8917]484                        'PAYS' =>  $pays  ,
485                        'VILLE' =>  $ville ,
[10419]486                        'REGION' =>  $region ,
487                        'version' =>     $version ,
[8917]488                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
[10419]489
490                    )
491                );
492     //===============================================================
[9702]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
[4132]496
[10419]497   break;
498
[4132]499// *************************************************************************
[4040]500//                      AIDE                                               |
[10419]501// *************************************************************************
[4040]502     case 'mail_superv_help':
[4052]503
[10419]504
505      $aff_nb=false;
506      $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ;
[4052]507      $template->assign(
[10419]508                    array(
[10385]509              'smile_bonjour' => $smile_bonjour ,
[10419]510              'version' =>   $version ,
[10385]511              'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
512              'path_js' => $path_js,
513              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
[10419]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;
[4040]522 //====================================================================
[4132]523  }
[4040]524//================================================================================
[4059]525
526
[4040]527
[10419]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    }
[4888]534
[4132]535
[10419]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    }
[9702]542
[10419]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//========================================================================
[4020]563?>
Note: See TracBrowser for help on using the repository browser.