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

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

[Mail_Supervisor] compatibility with piwigo 2.2

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