Ignore:
Timestamp:
Apr 16, 2011, 3:53:31 PM (13 years ago)
Author:
cljosse
Message:

[extensions] mail_supervisor fix bug in design

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/admin/mail_superv_admin.php

    r10385 r10419  
    4747  +1 '.$lang['Hour'].'<br />
    4848  +1 '.$lang['Minute'].'<br />
    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';
     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';
    5555else
    5656  $page['tab'] = $_GET['tab'];
    5757
    58 if (file_exists ( 'admin/themes/clear/icon/help.png')) 
     58if (file_exists ( 'admin/themes/clear/icon/help.png'))
    5959{
    6060//version 2.1
    61  
     61
    6262   $icon_path = 'themes/default/icon/help.png';
    63    $path_js=  'themes/default/js/' ; 
     63   $path_js=  'themes/default/js/' ;
    6464
    6565 }
     
    6767 {
    6868// version 1.9
    69   $path_js=  "template-common/lib/"; 
     69  $path_js=  "template-common/lib/";
    7070  $icon_path =  "admin/template/goto/theme/clear/icon/help.png";
    7171}
    72  
     72
    7373
    7474$tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
     
    7777               l10n('Sv_Tab_set'),
    7878               $my_base_url.'&amp;tab=mail_superv_admin');
    79                            
     79
    8080$tabsheet->add('mail_superv_test',
    8181               l10n('Sv_Tab_test'),
    8282               $my_base_url.'&amp;tab=mail_superv_test');
    83                            
     83
    8484$tabsheet->add( 'mail_black_liste',
    8585               l10n('Sv_blackliste'),
    86                            $my_base_url.'&amp;tab=mail_black_liste');
    87  
    88                                                    
     86               $my_base_url.'&amp;tab=mail_black_liste');
     87
     88
    8989$tabsheet->add('mail_superv_help',
    9090                $tabhelp,
    9191               $my_base_url.'&amp;tab=mail_superv_help');
    92                            
     92
    9393$tabsheet->select($page['tab']);
    9494$tabsheet->assign();
     
    9797$error = array();
    9898
    99 include_once (MAIL_SUPERV_PATH.'mail_super.inc.php'); 
    100 include_once (MAIL_SUPERV_PATH.'include/constants.php'); 
    101 
    102   if (!isset($infos_message))   {
     99include_once (MAIL_SUPERV_PATH.'mail_super.inc.php');
     100include_once (MAIL_SUPERV_PATH.'include/constants.php');
     101
     102  if (!isset($infos_message))   {
    103103      $infos_message = "";
    104104  }
     
    108108
    109109if (isset($conf['mail_superv'])) {
    110    global $pays,$region,$ville,$ip ;   
    111     include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
    112 //================================================================================================     
     110   global $pays,$region,$ville,$ip ;
     111    include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
     112//================================================================================================
    113113
    114114   $mails_donnees = mail_supervisor::Get_Datas();
     
    127127 //=========================================================
    128128  if (!isset($ip)) {
    129           if (getenv("HTTP_CLIENT_IP")){   
    130       $ip=getenv("HTTP_CLIENT_IP");     
    131     } else{   
    132       $ip=getenv("REMOTE_ADDR");       
    133     }
    134   }
    135                
     129      if (getenv("HTTP_CLIENT_IP")){
     130      $ip=getenv("HTTP_CLIENT_IP");
     131    } else{
     132      $ip=getenv("REMOTE_ADDR");
     133    }
     134  }
     135
    136136//================================================================================
    137137switch ($page['tab'])
    138138 {
    139    
     139
    140140// *************************************************************************
    141141//                         initialisation                                  |
    142142// *************************************************************************
    143143  case 'mail_superv_admin':
    144        
     144
    145145//=============================================================
    146146if ( isset($_POST['submit']) ) {
    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 />';
     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 />';
    162162     mail_supervisor::sauve_donnees();
    163          $aff_nb = false ;
    164  
    165        
    166         }
    167 
    168         if ( $_POST['submit'] == l10n('Sv_raz')   ) {
    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';
     163     $aff_nb = false ;
     164
     165
     166    }
     167
     168    if ( $_POST['submit'] == l10n('Sv_raz')   ) {
     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';
    176176    mail_supervisor::sauve_donnees();
    177          $infos_message .=  l10n('Sv_raz') .'<br />';   
    178         }
     177     $infos_message .=  l10n('Sv_raz') .'<br />';
     178    }
    179179
    180180  //===================================================================
    181         if ( $_POST['submit'] == l10n('Sv_Valider') ) {
    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' ;     
    185  
    186     //donnees 
     181    if ( $_POST['submit'] == l10n('Sv_Valider') ) {
     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' ;
     185
     186    //donnees
    187187    $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']  ; 
     188    $mails_donnees['nb_mails_periode'] = isset($_POST['nb_mails_periode']) ? $_POST['nb_mails_periode'] :  $mails_donnees['nb_mails_periode']  ;
    189189    $mails_donnees['nb_spams_maxi'] = isset($_POST['nb_spams_maxi']) ? $_POST['nb_spams_maxi'] :  $mails_donnees['nb_spams_maxi']  ;
    190190    $mails_donnees['nb_spams_periode'] = isset($_POST['nb_spams_periode']) ? $_POST['nb_spams_periode'] :  $mails_donnees['nb_spams_periode']  ;
    191191
    192192    $mails_donnees['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] :  $mails_donnees['quarantaine_periode']  ;
    193  
     193
    194194    $mails_donnees['message'] = isset($_POST['content']) ? $_POST['content'] :  $mails_donnees['message']  ;
    195195    $mails_donnees['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] :  $mails_donnees['header_text']  ;
     
    203203    $mails_donnees = mail_supervisor::Get_Datas() ;
    204204  }
    205  }     
    206         $mails_donnees = mail_supervisor::Get_Datas();
     205 }
     206    $mails_donnees = mail_supervisor::Get_Datas();
    207207 verif_mails_donnees();
    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 ;     
     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 ;
    213213 $template->assign(
    214                                         array(
     214                    array(
    215215                        'check_mailto' => ($mails_options['check_mailto'] == 'on') ? 'checked="checked"' : '' ,
    216216                        'check_header_carbons' => ($mails_options['check_header_carbon'] == 'on') ? 'checked="checked"' : '' ,
    217217                        'check_header_text' => ($mails_options['check_header_text'] == 'on') ? 'checked="checked"' : '' ,
    218218
    219    
     219
    220220                        'nb_mails' => $mails_donnees['nb_mails'] ,
    221221                        'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_mail'])."'" ,
    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        
     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
    226226                        'nb_spams' => $mails_donnees['nb_spams'] ,
    227227                        'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_spam'])."'" ,
    228                         'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] ,   
     228                        'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] ,
    229229                        'nb_spams_periode' => "'".int_to_heure($mails_donnees['nb_spams_periode'])."'" ,
    230                         'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,       
    231          
     230                        'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,
     231
    232232                        'quarantaine' => $quarantaine ,
    233233                        'date_quarantaine' => "'".date(l10n('Sv_formatdate'),time()+$reste)."'" ,
    234234                        'quarantaine_periode' => "'".int_to_heure($mails_donnees['quarantaine_periode'])."'" ,
    235235                        'reste' => "'".int_to_heure($reste)."'",
    236  
     236
    237237                        'message' => $mails_donnees['message'] ,
    238238                        'header_text' => "'".$mails_donnees['header_text']."'" ,
    239        
    240                         'PHPWG_VERSION' =>      PHPWG_VERSION ,
    241                         'version' =>    $version ,
     239
     240                        'PHPWG_VERSION' =>  PHPWG_VERSION ,
     241                        'version' =>    $version ,
    242242                        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
    243243                        'path_js' => $path_js,
    244244                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    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; 
     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;
    251251  // *************************************************************************
    252252//                        TEST                                             |
    253253// *************************************************************************
    254  
     254
    255255   case 'mail_superv_test':
    256                 load_language('plugin.lang', MAIL_SUPERV_PATH);
    257                 $mails_donnees = mail_supervisor::Get_Datas() ;
    258                 $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
    259 
    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                 }               
     256        load_language('plugin.lang', MAIL_SUPERV_PATH);
     257        $mails_donnees = mail_supervisor::Get_Datas() ;
     258        $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
     259
     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        }
    270270
    271271//================================================
     
    277277  set_make_full_url();
    278278
    279   /* TODO: if $category['representative_picture_id'] 
     279  /* TODO: if $category['representative_picture_id']
    280280    is empty find child representative_picture_id */
    281281
    282282
    283         if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
    284         else $titre=$conf['gallery_title'];
    285 
    286         $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
     283    if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
     284    else $titre=$conf['gallery_title'];
     285
     286    $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
    287287
    288288 if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message);
    289289
    290290 if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
    291         /*
    292         * send en email to user's group
    293         *
    294         * @param:
    295         *   - group_id: mail are sent to group with this Id
    296         *   - email_format: mail format
    297         *   - keyargs_subject: mail subject on l10n_args format
    298         *   - dirname: short name of directory including template
    299         *   - tpl_shortname: short template name without extension
    300         *   - assign_vars: array used to assign_vars to mail template
    301         *   - language_selected: send mail only to user with this selected language
    302         *
    303         * @return boolean (Ok or not)
    304         */   
    305         pwg_mail_group(
    306                 $_POST['group'],
    307                 get_str_email_format(true), 
    308                 get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
    309                 'cat_group_info',  // template
    310                 array    ('CPL_CONTENT' => $message."\n\n".$user['username'] ),
    311                 '' );
    312        
    313         $mails_donnees['message_test']= str_replace('"',"'",$message) ;
    314 
    315         unset_make_full_url();
    316         mail_supervisor::sauve_donnees();
    317         $mails_donnees = mail_supervisor::Get_Datas() ;
     291    /*
     292    * send en email to user's group
     293    *
     294    * @param:
     295    *   - group_id: mail are sent to group with this Id
     296    *   - email_format: mail format
     297    *   - keyargs_subject: mail subject on l10n_args format
     298    *   - dirname: short name of directory including template
     299    *   - tpl_shortname: short template name without extension
     300    *   - assign_vars: array used to assign_vars to mail template
     301    *   - language_selected: send mail only to user with this selected language
     302    *
     303    * @return boolean (Ok or not)
     304    */
     305    pwg_mail_group(
     306            $_POST['group'],
     307            get_str_email_format(true),
     308            get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
     309            'cat_group_info',  // template
     310            array    ('CPL_CONTENT' => $message."\n\n".$user['username'] ),
     311            '' );
     312
     313    $mails_donnees['message_test']= str_replace('"',"'",$message) ;
     314
     315    unset_make_full_url();
     316    mail_supervisor::sauve_donnees();
     317    $mails_donnees = mail_supervisor::Get_Datas() ;
    318318    $query = 'SELECT
    319                 name
    320                         FROM '.GROUPS_TABLE.'
    321                         WHERE id = '.$_POST['group'].'
    322                         ;';
    323                 list($group_name) = mysql_fetch_row(pwg_query($query));
    324                  
    325                   array_push(
    326                                         $page['infos'],
    327                                         sprintf( l10n('An information email was sent to group "%s"'),
    328                                                         $group_name  )
    329                                         );
    330                                                                 $group_id =-1 ;
    331   }
    332 } 
     319            name
     320            FROM '.GROUPS_TABLE.'
     321            WHERE id = '.$_POST['group'].'
     322            ;';
     323        list($group_name) = mysql_fetch_row(pwg_query($query));
     324
     325          array_push(
     326                    $page['infos'],
     327                    sprintf( l10n('An information email was sent to group "%s"'),
     328                            $group_name  )
     329                    );
     330                                $group_id =-1 ;
     331  }
     332}
    333333
    334334//======================================================================================
    335335  $groups[-1] = '---------';
    336336  $query = ' SELECT id, name
    337                         FROM '.GROUPS_TABLE.'
    338                         ORDER BY name ASC
    339                         ;';
     337            FROM '.GROUPS_TABLE.'
     338            ORDER BY name ASC
     339            ;';
    340340
    341341  $result = pwg_query($query);
    342 //----------------------------------------------------------------     
     342//----------------------------------------------------------------
    343343  while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
    344344  {    $groups[$row['id']] = $row['name'];  }
    345  //--------------------------------------------------------------- 
     345 //---------------------------------------------------------------
    346346if ( isset($_POST['Submit'])) $group_id=-1;
    347347  $template->assign(
    348         'Group',
    349                 array( 'group_options'=> $groups,
    350                                 'selected' => $group_id
    351                         )
    352                 );
     348        'Group',
     349        array( 'group_options'=> $groups,
     350                'selected' => $group_id
     351            )
     352        );
    353353//=================================================================
    354354$destinataires= implode("<br />",get_liste($group_id));
    355355if( $destinataires !="" )
    356356$infos_message .= " List :<hr>" .  $destinataires . "<hr>" ;
    357  
     357
    358358  $template->assign(
    359                                         array(
     359                    array(
    360360              'Groupe'     => $groups,
    361361              'message_test' => $mails_donnees['message_test'] ,
    362362              'liste' => $destinataires ,
    363               'version' =>      $version ,
     363              'version' =>  $version ,
    364364              'MAIL_CONTENT' => $mails_donnees['message_test'],
    365365              'path_js' => $path_js,
    366366              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    367367              'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
    368                                                 )
    369                                 );     
    370                                
     368                        )
     369                );
     370
    371371   $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
    372372   $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    373 //=========================================================================             
    374                 $toolbar = 'Basic';
    375                 $width = '750px';
    376                 $height = '200px';
    377                 $areas = array();
    378                 $areas[]='MAIL_CONTENT';
    379                 if (!empty($areas)){
    380                                 if (function_exists('set_fckeditor_instance'))
    381                                 set_fckeditor_instance($areas, $toolbar, $width, $height);
    382                         }
    383                        
     373//=========================================================================
     374        $toolbar = 'Basic';
     375        $width = '750px';
     376        $height = '200px';
     377        $areas = array();
     378        $areas[]='MAIL_CONTENT';
     379        if (!empty($areas)){
     380                if (function_exists('set_fckeditor_instance'))
     381                    set_fckeditor_instance($areas, $toolbar, $width, $height);
     382            }
     383
    384384   break;
    385385// *************************************************************************
    386386//              BLACK LISTE                                         |
    387 // *************************************************************************   
    388  case 'mail_black_liste': 
     387// *************************************************************************
     388 case 'mail_black_liste':
    389389  global $user_name,$mail_adresse,$ip ;
    390390  $aff_nb=false;
    391   //=======================================================================================     
     391  //=======================================================================================
    392392  $info_ip = (isset($info_ip)) ? $info_ip : '' ;
    393393  $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ;
     
    398398  $ip_black = trim($val[1]) ;
    399399  if (isset($_POST['ip_black']))   $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
    400                 $istype="";
    401         if ( isset($_POST['submit']) ){
    402         if (clj_is_ip($ip_black)) $istype='IP';
    403         else if (clj_is_mail($ip_black))  $istype='MAIL';
    404       else   $istype='LOGIN';   
    405     if (  $_POST['submit'] == l10n('Sv_Ajout') )        {
     400        $istype="";
     401    if ( isset($_POST['submit']) ){
     402    if (clj_is_ip($ip_black)) $istype='IP';
     403    else if (clj_is_mail($ip_black))  $istype='MAIL';
     404      else   $istype='LOGIN';
     405    if (  $_POST['submit'] == l10n('Sv_Ajout') )    {
    406406      $info_ip = 'Ajout' ;
    407407      $ip_black = trim( $_POST['ip_black']) ;
    408       $infos_message .= $info_ip . '---->'. $ip_black ;   
    409     }
    410          if (  $_POST['submit'] == l10n('Sv_Valider') ) {
    411    
     408      $infos_message .= $info_ip . '---->'. $ip_black ;
     409    }
     410     if (  $_POST['submit'] == l10n('Sv_Valider') ) {
     411
    412412     $mails_options['no_mail_list'] = isset($_POST['no_mail_list']) ? "on" : "off" ;
    413413     $mails_options['no_connect'] = isset($_POST['no_connect']) ? "on" : "off" ;
     
    415415     $mails_options['set_id'] = isset($_POST['set_id']) ? "on" : "off" ;
    416416     mail_supervisor::sauve_options();
    417      $infos_message .=  l10n('Sv_save_config') . '<br />'; 
     417     $infos_message .=  l10n('Sv_save_config') . '<br />';
    418418  }
    419419}
    420420if (!isset($params)) $params=array();
    421421if (!isset($params['per_page'])) $params['per_page'] = 20 ;
    422 if (!isset($params['start']))    $params['start'] = 0 ;
     422if (!isset($params['start']))    $params['start'] = 0 ;
    423423
    424424if (isset($_POST['per_page'])) $params['per_page'] =$_POST['per_page'];
     
    427427if (isset($_POST['prev']))  $params['start'] -=   1;
    428428 $params['start']= ($params['start']>=0) ? $params['start'] : 0 ;
    429 //=======================================================================================       
    430  include  (MAIL_SUPERV_PATH.'include/save_info.php');     
    431   $maxipage=(int) (     $nbip  / $params['per_page']) ;
    432         $f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
    433         $champs_ip=array();
    434         $champs_bl=array();
    435         if (!empty($liste_ip))  $champs_ip=array_keys($liste_ip[0]);
    436         if (!empty($liste_bl))  $champs_bl=array_keys($liste_bl[0]);
    437            $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ;
    438            $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ;
     429//=======================================================================================
     430 include  (MAIL_SUPERV_PATH.'include/save_info.php');
     431  $maxipage=(int) ( $nbip  / $params['per_page']) ;
     432    $f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
     433    $champs_ip=array();
     434    $champs_bl=array();
     435    if (!empty($liste_ip))  $champs_ip=array_keys($liste_ip[0]);
     436    if (!empty($liste_bl))  $champs_bl=array_keys($liste_bl[0]);
     437       $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ;
     438       $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ;
    439439     $template->assign(
    440                                         array(
     440                    array(
    441441                        'start' => $params['start'],
    442442                        'per_page' => $params['per_page'] ,
     
    444444                        'smile_bonjour' => $smile_bonjour ,
    445445                        'img_logo' => $img_logo ,
    446                         'champs_ip' => $champs_ip ,                                     
     446                        'champs_ip' => $champs_ip ,
    447447                        'liste_ip' => $liste_ip,
    448                         'champs_bl' =>  $champs_bl       ,     
     448                        'champs_bl' =>  $champs_bl   ,
    449449                        'liste_bl' => $liste_bl ,
    450450                        //'conf_admin_layout' => $conf['admin_layout'] ,
     
    456456                        'path_js' => $path_js ,
    457457                        'F_ACTION' => $f_action ,
    458                                                
     458
    459459                        'no_mail_list' => ($mails_options['no_mail_list'] == 'on') ? 'checked="checked"' : '' ,
    460460                        'no_connect' => ($mails_options['no_connect'] == 'on') ? 'checked="checked"' : '' ,
    461461                        'set_auto' => ($mails_options['set_auto'] == 'on') ? 'checked="checked"' : '' ,
    462462                        'set_id' => ($mails_options['set_id'] == 'on') ? 'checked="checked"' : '' ,
    463                         'IP' =>  $ip ,                                         
     463                        'IP' =>  $ip ,
    464464                        'PAYS' =>  $pays  ,
    465465                        'VILLE' =>  $ville ,
    466                         'REGION' =>  $region , 
    467                         'version' =>    $version ,
     466                        'REGION' =>  $region ,
     467                        'version' =>    $version ,
    468468                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    469                      
    470                                         )
    471                                 );                       
    472          //===============================================================                                       
     469
     470                    )
     471                );
     472     //===============================================================
    473473  $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl')));
    474474  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    475      
    476 
    477    break; 
     475
     476
     477   break;
    478478
    479479// *************************************************************************
    480480//                      AIDE                                               |
    481 // *************************************************************************   
     481// *************************************************************************
    482482     case 'mail_superv_help':
    483483
    484  
    485           $aff_nb=false;
    486           $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ;
     484
     485      $aff_nb=false;
     486      $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ;
    487487      $template->assign(
    488                                         array(
     488                    array(
    489489              'smile_bonjour' => $smile_bonjour ,
    490               'version' =>      $version ,
     490              'version' =>  $version ,
    491491              'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
    492492              'path_js' => $path_js,
    493493              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
    494                                         )
    495                         );             
    496         $aff_nb = false;
    497         ;
    498          
    499                 $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_help.tpl')));
    500                 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    501    break; 
     494                    )
     495            );
     496    $aff_nb = false;
     497    ;
     498
     499        $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_help.tpl')));
     500        $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
     501   break;
    502502 //====================================================================
    503503  }
    504504//================================================================================
    505505
    506            
    507 
    508         if  ( $mails_donnees['reste'] < 0 ) {
    509             $mails_donnees['quarantaine'] =false ;
    510             $mails_donnees['date_quarantaine']= time()  ;       
    511                 $mails_donnees['nb_spams'] = 0 ;
    512             $modif == true ;
    513         }
    514          
    515          
    516         $rest_mail =    $mails_donnees['rest_mail'] ;
    517         if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){
    518            $mails_donnees['nb_mails'] =0 ;
    519            $mails_donnees['date_mail'] = time();
    520            $modif = true ;
    521         }
    522        
    523         $rest_spam =    $mails_donnees['rest_spam'] ;
    524 
    525         if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){
    526            $mails_donnees['nb_spams'] =0 ;
    527            $mails_donnees['date_spam'] = time();
    528            $modif = true ;
    529         }
    530         if ( $modif == true )   {
    531                                 mail_supervisor::sauve_donnees();
    532                                 $modif = false ;
    533                 }
    534 
    535                 if ($aff_nb == true) {
    536                 $infos_message .= 'Mails    : '.$mails_donnees['nb_mails']. '  \\  ' . $mails_donnees['nb_mails_maxi'];
    537                 $infos_message .= "\n".'Spams : '.$mails_donnees['nb_spams']. '  \\  ' . $mails_donnees['nb_spams_maxi'];
    538                 }
    539 
    540 
    541         mail_supervisor::affiche_message();
    542 //========================================================================     
     506
     507
     508    if  ( $mails_donnees['reste'] < 0 ) {
     509        $mails_donnees['quarantaine'] =false ;
     510        $mails_donnees['date_quarantaine']= time()  ;
     511        $mails_donnees['nb_spams'] = 0 ;
     512        $modif == true ;
     513    }
     514
     515
     516    $rest_mail =    $mails_donnees['rest_mail'] ;
     517    if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){
     518       $mails_donnees['nb_mails'] =0 ;
     519       $mails_donnees['date_mail'] = time();
     520       $modif = true ;
     521    }
     522
     523    $rest_spam =    $mails_donnees['rest_spam'] ;
     524
     525    if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){
     526       $mails_donnees['nb_spams'] =0 ;
     527       $mails_donnees['date_spam'] = time();
     528       $modif = true ;
     529    }
     530    if ( $modif == true )   {
     531                mail_supervisor::sauve_donnees();
     532                $modif = false ;
     533        }
     534
     535        if ($aff_nb == true) {
     536        $infos_message .= 'Mails    : '.$mails_donnees['nb_mails']. '  \\  ' . $mails_donnees['nb_mails_maxi'];
     537        $infos_message .= "\n".'Spams : '.$mails_donnees['nb_spams']. '  \\  ' . $mails_donnees['nb_spams_maxi'];
     538        }
     539
     540
     541    mail_supervisor::affiche_message();
     542//========================================================================
    543543?>
Note: See TracChangeset for help on using the changeset viewer.