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
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
[11807]120
[4052]121$aff_nb=true;
[4040]122// *************************************************************************
[7050]123// |                          Selection de l'onglet                        |
[4040]124// *************************************************************************
[9702]125  $modif=false ;
126  $plugin =  mail_supervisor::Get_Version_plugins( MAIL_SUPERV_PATH);
127  $version = $plugin['version'] ;
[4888]128 //=========================================================
[9702]129  if (!isset($ip)) {
[10419]130      if (getenv("HTTP_CLIENT_IP")){
131      $ip=getenv("HTTP_CLIENT_IP");
132    } else{
133      $ip=getenv("REMOTE_ADDR");
[9702]134    }
135  }
[10419]136
[4040]137//================================================================================
138switch ($page['tab'])
139 {
[10419]140
[4040]141// *************************************************************************
142//                         initialisation                                  |
143// *************************************************************************
144  case 'mail_superv_admin':
[10419]145
[4220]146//=============================================================
147if ( isset($_POST['submit']) ) {
[10419]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
[11807]158            if ($mails_donnees['quarantaine'] == false) { 
159              $mails_donnees['reste'] = 0;
[10419]160      $mails_donnees['date_quarantaine']=time();
161     }
162     $infos_message .=  l10n('Sv_refresh') .'<br />';
[11807]163             echo "156 super_admin.php ";
[9702]164     mail_supervisor::sauve_donnees();
[10419]165     $aff_nb = false ;
166    }
167
[11807]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
[11807]180    if ( $_POST['submit'] == l10n('Sv_Valider') ) { 
[8917]181  //===================================================================
[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' ;
[11835]184      $mails_options['check_send_webmaster'] = isset($_POST['check_send_webmaster']) ? $_POST['check_send_webmaster'] : 'off' ;
[11807]185      $mails_options['no_ipaddress'] = isset($_POST['no_ipaddress']) ? $_POST['no_ipaddress'] : 'off' ;
[10419]186
[11807]187
[10822]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']  ;
[4020]193
[10822]194      $mails_donnees['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] :  $mails_donnees['quarantaine_periode']  ;
[10419]195
[10822]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']  ;
[11807]198      //=========================================================================
[10822]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 = "";
[11835]205     
[10822]206    }
[10419]207 }
208    $mails_donnees = mail_supervisor::Get_Datas();
[9702]209 verif_mails_donnees();
[10419]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 ;
[9702]215 $template->assign(
[10419]216                    array(
[9702]217                        'check_mailto' => ($mails_options['check_mailto'] == 'on') ? 'checked="checked"' : '' ,
218                        'check_header_carbons' => ($mails_options['check_header_carbon'] == 'on') ? 'checked="checked"' : '' ,
[11835]219                        'check_send_webmaster' => ($mails_options['check_send_webmaster'] == 'on') ? 'checked="checked"' : '' ,
[11807]220                        'no_ipaddress' => ($mails_options['no_ipaddress'] == 'on') ? 'checked="checked"' : '' ,
[4156]221
[9702]222                        'nb_mails' => $mails_donnees['nb_mails'] ,
223                        'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_mail'])."'" ,
[10419]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
[9702]228                        'nb_spams' => $mails_donnees['nb_spams'] ,
229                        'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_spam'])."'" ,
[10419]230                        'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] ,
[9702]231                        'nb_spams_periode' => "'".int_to_heure($mails_donnees['nb_spams_periode'])."'" ,
[10419]232                        'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,
233
[9702]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)."'",
[10419]238
[9702]239                        'message' => $mails_donnees['message'] ,
240                        'header_text' => "'".$mails_donnees['header_text']."'" ,
[10419]241
242                        'PHPWG_VERSION' =>   PHPWG_VERSION ,
243                        'version' =>     $version ,
[9702]244                        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
245                        'path_js' => $path_js,
246                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
[10419]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;
[11807]253/*************************************************************************
254*                     TEST                                             |
255*************************************************************************/
[10419]256
[4040]257   case 'mail_superv_test':
[10419]258        load_language('plugin.lang', MAIL_SUPERV_PATH);
259        $mails_donnees = mail_supervisor::Get_Datas() ;
260        $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
[8917]261
[10419]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        }
[8917]272
[4040]273//================================================
[5670]274// info by email to an access granted group of category informations
[8917]275
[11807]276if (isset($_POST['Submit']) and !empty($_POST['group'])){
[8917]277
[5670]278  set_make_full_url();
[11807]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']);
[8917]282
[11807]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  }
[4020]288
[11807]289  $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
290  $mails_donnees['titre']= str_replace('"',"'",$titre) ;   
291  $mails_donnees['sujet']= str_replace('"',"'",$sujet) ; 
[4020]292
[11807]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    }
[5670]299
[8917]300
[10822]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']="";
[10816]305 }else if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
[11807]306     /*************************************************************
[10419]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)
[11807]319     ************************************************************/
[10419]320    pwg_mail_group(
321            $_POST['group'],
322            get_str_email_format(true),
[11807]323            get_l10n_args('[%s] %s', array($conf['gallery_title'],$sujet) ), //sujet
[10816]324            MAIL_SUPERV_PATH_ABS . 'admin/cat_group_info',  // template
[11807]325            array    ( 'titre' => $titre,
[10816]326                       'CPL_CONTENT' => $message,
327                       'signature' => $user['username']
328                      ),
329            '' 
330              );
[5670]331
[10822]332    $mails_donnees['message_test']= str_replace('"',"'",$message) ;     
[10419]333    mail_supervisor::sauve_donnees();
[10822]334    $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ;
335    mail_supervisor::sauve_options();
[8917]336    $query = 'SELECT
[10419]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 ;
[8917]349  }
[10419]350}
[4040]351
[8917]352//======================================================================================
[4040]353  $groups[-1] = '---------';
[8917]354  $query = ' SELECT id, name
[10419]355            FROM '.GROUPS_TABLE.'
356            ORDER BY name ASC
357            ;';
[4040]358
359  $result = pwg_query($query);
[10419]360//----------------------------------------------------------------
[11807]361  while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {   
362  $groups[$row['id']] = $row['name'];  }
[10419]363 //---------------------------------------------------------------
[8917]364if ( isset($_POST['Submit'])) $group_id=-1;
[4040]365  $template->assign(
[10419]366        'Group',
367        array( 'group_options'=> $groups,
368                'selected' => $group_id
369            )
370        );
[4040]371//=================================================================
[10816]372/*   
373 $List_dest=get_liste($group_id) ;
374   //$destinataires= implode("<br />".$chk_cl,get_liste($group_id));
[10822]375*/
[10816]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
[10822]383   $mails_options['debug_mail'] = isset($mails_options['debug_mail']) ? $mails_options['debug_mail'] : "off" ;
384
[4040]385  $template->assign(
[10419]386                    array(
[10816]387                        'Groupe'     => $groups,
388                        'message_test' => $mails_donnees['message_test'] ,
389                        'liste' =>  get_liste($group_id) ,
[10822]390                         'debug_mail' => ($mails_options['debug_mail'] == 'on') ? 'checked="checked"' : '' ,
[10816]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 ,
[11807]396                        'sujet' => $mails_donnees['sujet'],
397                        'titre' =>  $mails_donnees['titre']
[10419]398                        )
[10816]399                    );
[10419]400
[8917]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');
[10419]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
[4040]414   break;
415// *************************************************************************
[4132]416//              BLACK LISTE                                         |
[10419]417// *************************************************************************
418 case 'mail_black_liste':
[9702]419  global $user_name,$mail_adresse,$ip ;
420  $aff_nb=false;
[10419]421  //=======================================================================================
[9702]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]) ;
[4220]429  if (isset($_POST['ip_black']))   $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
[10419]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') )    {
[9702]436      $info_ip = 'Ajout' ;
437      $ip_black = trim( $_POST['ip_black']) ;
[10419]438      $infos_message .= $info_ip . '---->'. $ip_black ;
[9702]439    }
[10419]440     if (  $_POST['submit'] == l10n('Sv_Valider') ) {
441
[9702]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" ;
[10822]445     $mails_options['set_id'] = isset($_POST['set_id']) ? "on" : "off" ;   
446
[9702]447     mail_supervisor::sauve_options();
[10419]448     $infos_message .=  l10n('Sv_save_config') . '<br />';
[9702]449  }
450}
[4938]451if (!isset($params)) $params=array();
452if (!isset($params['per_page'])) $params['per_page'] = 20 ;
[10419]453if (!isset($params['start']))    $params['start'] = 0 ;
[4938]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;
[9702]459 $params['start']= ($params['start']>=0) ? $params['start'] : 0 ;
[10419]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" ;
[4156]470     $template->assign(
[10419]471                    array(
[8917]472                        'start' => $params['start'],
473                        'per_page' => $params['per_page'] ,
474                        'maxipage'  =>  $maxipage ,
475                        'smile_bonjour' => $smile_bonjour ,
476                        'img_logo' => $img_logo ,
[10419]477                        'champs_ip' => $champs_ip ,
[8917]478                        'liste_ip' => $liste_ip,
[10419]479                        'champs_bl' =>  $champs_bl   ,
[8917]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 ,
[10419]489
[9702]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"' : '' ,
[11835]494
[10419]495                        'IP' =>  $ip ,
[8917]496                        'PAYS' =>  $pays  ,
497                        'VILLE' =>  $ville ,
[10419]498                        'REGION' =>  $region ,
499                        'version' =>     $version ,
[11807]500                'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
[10419]501
502                    )
503                );
504     //===============================================================
[9702]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
[4132]508
[10419]509   break;
510
[4132]511// *************************************************************************
[4040]512//                      AIDE                                               |
[10419]513// *************************************************************************
[4040]514     case 'mail_superv_help':
[4052]515
[10419]516
517      $aff_nb=false;
518      $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ;
[4052]519      $template->assign(
[10419]520                    array(
[10385]521              'smile_bonjour' => $smile_bonjour ,
[10419]522              'version' =>   $version ,
[10385]523              'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
524              'path_js' => $path_js,
525              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
[10419]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;
[4040]534 //====================================================================
[4132]535  }
[10419]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    }
[4888]542
[4132]543
[10419]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    }
[9702]550
[10419]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    }
[11807]558    //======================================================
[10419]559    if ( $modif == true )   {
560                mail_supervisor::sauve_donnees();
561                $modif = false ;
562        }
[11807]563   //======================================================
[10419]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//========================================================================
[4020]572?>
Note: See TracBrowser for help on using the repository browser.