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

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

[Mail_supervisor] Code refactoring for Piwigo 2.1 compliance

File size: 22.7 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__)).'/');
30
[4888]31global $user, $lang, $conf, $errors,$mails_données;
32global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ;
[4040]33// +-----------------------------------------------------------------------+
34// | Check Access and exit when user status is not ok                      |
35// +-----------------------------------------------------------------------+
[4132]36//check_status(ACCESS_ADMINISTRATOR);
[4020]37include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
[4220]38include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
[4020]39
[4041]40
[4040]41$my_base_url = get_admin_plugin_menu_link(__FILE__);
[4888]42
[4054]43 load_language('plugin.lang', MAIL_SUPERV_PATH);
[4888]44 //=========================================================
45 $sv_Week=explode(" ",l10n('Week %d'));
46if( !isset($lang['Week'])) $lang['Week'] =   $sv_Week[0];
[4065]47
[4132]48
[4888]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 
[4040]57        if (!isset($_GET['tab']))
58        $page['tab'] = 'mail_superv_admin';
59else
60  $page['tab'] = $_GET['tab'];
[4029]61
[5670]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/' ; 
[4059]68
[5670]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 
[4059]77
[5670]78$tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
79
[4059]80 
81
[4040]82$tabsheet = new tabsheet();
83$tabsheet->add('mail_superv_admin',
[4879]84               l10n('Sv_Tab_set'),
[4040]85               $my_base_url.'&amp;tab=mail_superv_admin');
[4132]86                           
[4040]87$tabsheet->add('mail_superv_test',
[4879]88               l10n('Sv_Tab_test'),
[4040]89               $my_base_url.'&amp;tab=mail_superv_test');
[4132]90                           
91$tabsheet->add( 'mail_black_liste',
[4879]92               l10n('Sv_blackliste'),
[4132]93                           $my_base_url.'&amp;tab=mail_black_liste');
94 
95                                                   
[5670]96$tabsheet->add('mail_superv_help',
97                $tabhelp,
[4040]98               $my_base_url.'&amp;tab=mail_superv_help');
[4132]99                           
100                           
[4040]101$tabsheet->select($page['tab']);
102$tabsheet->assign();
[4020]103
[4040]104$page['global'] = array();
105$error = array();
106
[4888]107
[4220]108include_once (MAIL_SUPERV_PATH.'include/constants.php'); 
[4206]109
[4888]110        if (!isset($infos_message))
111        {
112        $infos_message = "";
113        }
114if (!isset($erreur_message))
115        {
116        $erreur_message = "";
117        }
118
[4220]119if (isset($conf['mail_superv'])) {
120
121include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
[4361]122            global $pays,$region,$ville,$ip ;   
[4721]123
[4361]124               
[4715]125$mails_options = explode("," , $conf['mail_superv']); 
[4861]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
[4224]131               
[4861]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
[4888]135//================================================================================================             
[4224]136$mails_données = Get_Datas();
[4040]137
[4220]138
139}else {
140die ("mail");
141}
142
143
[4052]144$aff_nb=true;
[4051]145
146
[4888]147       
[4040]148// *************************************************************************
149// |                          Sélection de l'onglet                        |
150// *************************************************************************
151
152                $modif=false ;
[4888]153                /*
[4451]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        }
[4888]162$version = $versions['version'];
163*/
164$plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
165$version = $plugin['version'] ;
166 //=========================================================
167
[4861]168                if (!isset($ip)) {
169                       if (getenv("HTTP_CLIENT_IP"))
170                                            {    $ip=getenv("HTTP_CLIENT_IP");  }
171                                        else{   $ip=getenv("REMOTE_ADDR");      }
172                           }
[4040]173//================================================================================
174switch ($page['tab'])
175 {
[4132]176   
[4040]177// *************************************************************************
178//                         initialisation                                  |
179// *************************************************************************
180  case 'mail_superv_admin':
[4220]181       
182//=============================================================
183if ( isset($_POST['submit']) ) {
[4888]184 
185        if ( $_POST['submit'] == l10n('Sv_refresh')   ) {
[4059]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         }
[4879]198         $infos_message .=  l10n('Sv_refresh') .'<br />';
[4059]199     sauve_données();
[4888]200         $aff_nb = false ;
[4059]201 
[4220]202       
[4040]203        }
[4020]204
[4888]205        if ( $_POST['submit'] == l10n('Sv_raz')   ) {
[4220]206
[4020]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();
[4029]212       
[4020]213        $mails_données['reste'] = 0;
[4132]214        $mails_données['quarantaine']='false';
[4020]215       
[4029]216     sauve_données();
[4879]217         $infos_message .=  l10n('Sv_raz') .'<br />'; ;
[4220]218       
[4020]219        }
[4206]220
[4879]221 
[4888]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' ;     
[4020]227 
[4888]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']  ;
[4020]233
[4888]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();
[4180]242//=======================================================================================================
[4888]243                        $infos_message  =  l10n('Sv_save_config') . " : " . l10n('Sv_Datas') . "<br />" ;
244                        $erreur_message = "";
245                        $mails_données = Get_Datas() ;
246                        }
247       }
[4206]248       
[4156]249        $mails_données = Get_Datas();
[4888]250    vérif_mails_données();
251//===============================================================================
252 
[4029]253        $rest_mail= $mails_données['rest_mail'];       
254        $rest_spam= $mails_données['rest_spam'];       
255    $reste= $mails_données['reste'];   
256
[4888]257$quarantaine = ($mails_données['quarantaine'] == 'true') ? true : false ;       
[4132]258
[4020]259$template->assign(
260                                        array(
[4861]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"' : '' ,
[4156]264
[4020]265   
266        'nb_mails' => $mails_données['nb_mails'] ,
[4879]267        'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_données['date_mail'])."'" ,
[4020]268        'nb_mails_maxi' => $mails_données['nb_mails_maxi'] ,   
[4888]269        'nb_mails_periode' => "'". int_to_heure($mails_données['nb_mails_periode'])."'" ,       
[4029]270        'time_mails_reste' => "'".int_to_heure( $rest_mail )."'" ,     
[4020]271       
272        'nb_spams' => $mails_données['nb_spams'] ,
[4879]273        'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_données['date_spam'])."'" ,
[4020]274        'nb_spams_maxi' => $mails_données['nb_spams_maxi'] ,   
[4888]275         'nb_spams_periode' => "'".int_to_heure($mails_données['nb_spams_periode'])."'" ,
[4029]276         'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,       
[4020]277         
[4132]278         'quarantaine' => $quarantaine ,
[4879]279        'date_quarantaine' => "'".date(l10n('Sv_formatdate'),time()+$reste)."'" ,
[4888]280        'quarantaine_periode' => "'".int_to_heure($mails_données['quarantaine_periode'])."'" ,
[4029]281     'reste' => "'".int_to_heure($reste)."'",
[4020]282 
283    'message' => $mails_données['message'] ,
284        'header_text' => "'".$mails_données['header_text']."'" ,
[4029]285       
[4451]286    'PHPWG_VERSION' =>   PHPWG_VERSION ,
287         'version' =>    $version ,
[5670]288        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
289        'path_js' => $path_js
[4020]290                                                )
291                                );     
292
[4040]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));
[4054]315                }       else {
316                                $group_name="";         
[4040]317                }               
318//================================================
[5670]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*/ 
[4020]339
[5670]340if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
341else
342$titre=$conf['gallery_title'];
[4020]343
[5670]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    '' );
[4040]360       
[5670]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//=====================================================================================
[4040]385if ( isset($_POST['test_envoie']) ) {
[5670]386$mails_données['message_test'] = empty($_POST['MAIL_CONTENT']) ? '' : stripslashes($_POST['MAIL_CONTENT']);
[4040]387                $message=$mails_données['message_test'];
[5670]388//test_envoie($message,$group_name,$group_id);
[4040]389                sauve_données();
[5670]390 
[4040]391                $mails_données = Get_Datas() ;
[4054]392               
[4040]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//----------------------------------------------------------------     
[4132]405  while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
[4040]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 ,
[4451]425 'version' =>    $version ,
[5670]426                            'MAIL_CONTENT' => $mails_données['message_test'],
427                    'path_js' => $path_js
[4040]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');
[5670]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 
[4040]446   break;
447// *************************************************************************
[4132]448//              BLACK LISTE                                         |
449// *************************************************************************   
450     case 'mail_black_liste':
[4337]451                global $user_name,$mail_adresse,$ip ;
[4220]452                $aff_nb=false;
453 //------------------------------------------------------------------------------------
[4861]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] ;             
[4220]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]) ;
[4721]465
[4220]466  if (isset($_POST['ip_black']))   $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
467   
[4337]468                        $istype="";
[4721]469                 
470                 
[4220]471        if ( isset($_POST['submit']) )
[4156]472                {
[4337]473
474        if (clj_is_ip($ip_black)) $istype='IP';
[4721]475         elseif (clj_is_mail($ip_black))  $istype='MAIL';
476     else   $istype='LOGIN';
477         
[4879]478                        if (  $_POST['submit'] == l10n('Sv_Ajout') )
[4220]479                {
[4224]480                               $info_ip = 'Ajout' ;
[4220]481                   $ip_black = trim( $_POST['ip_black']) ;
[4224]482                               $infos_message .= $info_ip . '---->'. $ip_black ;   
[4220]483                        }
[4879]484                        if (  $_POST['submit'] == l10n('Sv_Valider') )
[4180]485                {
[4861]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" ;
[4190]490                                sauve_options();
[4879]491                            $infos_message .=  l10n('Sv_save_config') . '<br />';   
[4220]492                           
[4180]493                        }
[4220]494                }       
[4180]495
[4938]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
[4220]508include  (MAIL_SUPERV_PATH.'include/save_info.php');       
[4938]509$maxipage=(int) (       $nbip  / $params['per_page']) ;
[4220]510//=======================================================================================       
[4156]511        $f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
[4132]512        $champs_ip=array();
513        $champs_bl=array();
[4156]514        if (!empty($liste_ip))          $champs_ip=array_keys($liste_ip[0]);
515        if (!empty($liste_bl))      $champs_bl=array_keys($liste_bl[0]);
[4721]516           $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ; 
517           $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ; 
[4156]518     $template->assign(
[4132]519                                        array(
[4938]520                                        'start' => $params['start'],
521                                        'per_page' => $params['per_page'] ,
522                                'maxipage'  =>  $maxipage ,
[4156]523                                            'smile_bonjour' => $smile_bonjour ,
[4337]524                                                'img_logo' => $img_logo ,
[4132]525                                'champs_ip' => $champs_ip ,                                     
526                                                'liste_ip' => $liste_ip,
527                                                'champs_bl' =>  $champs_bl       ,     
528                                                'liste_bl' => $liste_bl ,
[5670]529                                //'conf_admin_layout' => $conf['admin_layout'] ,
[4337]530                                                'istype' => $istype ,
[4132]531                                                'ip_black' => $ip_black ,
[4220]532                                                'IS_SPAM' => test_spam(  $ip_black),
533                                                'ip_black_len' =>  strlen($ip_black)  ,
[4132]534                                                'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
[5670]535                            'path_js' => $path_js ,
[4132]536                                                'F_ACTION' => $f_action ,
[4180]537                                               
[4861]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"' : '' ,
[4220]542                                                'IP' =>  $ip ,                                         
[4180]543                                                'PAYS' =>  $pays  ,
544                                'VILLE' =>  $ville ,
545                                'REGION' =>  $region , 
[4451]546                                                 'version' =>    $version ,
[4132]547                                        )
548                                );                       
[4156]549         //===============================================================     
[4220]550               
551                                 
[4132]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// *************************************************************************
[4040]557//                      AIDE                                               |
558// *************************************************************************   
559     case 'mail_superv_help':
[4052]560
[4065]561 
[4052]562          $aff_nb=false;
563          $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ; 
564      $template->assign(
565                                        array(
566                                        'smile_bonjour' => $smile_bonjour ,
[4451]567                                         'version' =>    $version ,
[5670]568                                         'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
569                         'path_js' => $path_js
[4052]570                                        )
571                        );             
[4059]572        $aff_nb = false;
[4065]573        ;
[4040]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 //====================================================================
[4132]579  }
[4040]580//================================================================================
[4059]581
[5670]582           
[4059]583
[4045]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         
[4040]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                }
[4888]610
[4052]611                if ($aff_nb == true) {
[4040]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'];
[4052]614                }
[4059]615               
[4132]616
[4059]617                 
[4156]618                if  ($infos_message != "")  {
[4180]619                   array_push($page['infos'],  $infos_message);
[4888]620                   $infos_message="";
[4156]621                 }
[4888]622                 
[4156]623                if  ($erreur_message != "")  {
624       
625                  array_push($page['errors'], $erreur_message);
626                  $erreur_message="";
627       
[4052]628                 
[4156]629                 }               
[4040]630//========================================================================     
[4020]631?>
Note: See TracBrowser for help on using the repository browser.