Changeset 10385


Ignore:
Timestamp:
Apr 15, 2011, 4:09:41 PM (13 years ago)
Author:
cljosse
Message:

[extensions] mail_supervisor fix bug format_email

Location:
extensions/Mail_supervisor
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/admin/clear/theme.css

    r10179 r10385  
    1 .Style1 {
    2   color: #6699CC;
    3 }
    4 .items {
    5   font-style: italic;
    6 }
    7 .row2 {
    8   font-style: italic;
    9   border: 0;
    10 }
    11 .row1 {
    12   font-style: italic;
    13   border: 0;
    14 }
    15 .info {
    16   color: #5599FF;
    17 }
    181.bug {
    19   background-image: url(../smilies/mouche.gif);
     2  background-image: url('../../smilies/mouche.gif');
    203  background-repeat: no-repeat;
    214  width: 100px;
    225  height: 75px;
    23 }
    24 .frame_ {
    25   height: 40px;
    26 }
    27 
    28 .erreur {
    29   color: #FF0000;
    306}
    317.instructions {
  • extensions/Mail_supervisor/admin/default/theme.css

    r10179 r10385  
    1 /* Bloc expand-collapse instructions */
    2 .instructionBlock
    3 {
     1.bug {
     2  background-image: url('../../smilies/mouche.gif');
     3  background-repeat: no-repeat;
     4  width: 100px;
     5  height: 75px;
     6}
     7/* Bloc expand-collapse instructions */
     8.instructionBlock{
    49  border: 1px solid #666;
    510  margin: 5px;
    611  overflow: hidden;
    712}
    8 
    9 .instructionBlockHeaderCollapsed, .instructionBlockHeaderExpanded
    10 {
     13.instructionBlockHeaderCollapsed, .instructionBlockHeaderExpanded{
    1114  background-color:#111;
    1215  background-position:15px center;
     
    1922  text-align: left;
    2023}
    21 
    22 .instructionBlockHeaderCollapsed span, .instructionBlockHeaderExpanded span
    23 {
     24.instructionBlockHeaderCollapsed span, .instructionBlockHeaderExpanded span{
    2425  border-bottom: none;
    2526}
     
    3132 background-image: url('./clear/icon/collapse.gif'));
    3233}
    33 .instructionBlockContent
    34 {
     34.instructionBlockContent{
    3535  padding:0 15px 15px;
    3636}
  • extensions/Mail_supervisor/admin/header_2_1.tpl

    r10179 r10385  
    1 {html_head}
    2 {known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js" }
    3 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js" }
     1{known_script id="jquery" src = $ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=0}
     2{known_script id="jquery.cluetip" src = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
     3{known_script id="jquery.ui" src= $ROOT_URL|@cat:"themes/default/js/ui/minified/ui.core.min.js"}
    44{known_script id="mail_script" src= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js"}
     5{html_head}
    56<link rel="stylesheet" type="text/css" href="{$MAIL_SUPERV_PATH}admin/{$theme}/theme.css" />
    6 
    77{/html_head}
    88<input id="action_spam" name="action_spam" type="hidden" value="{$action_spam}" />
  • extensions/Mail_supervisor/admin/header_2_2.tpl

    r10179 r10385  
    1 {combine_script id="jquery" path= $ROOT_URL|@cat:$path_js|@cat:"jquery.min.js" }
    2 {combine_script id="jquery.cluetip" path=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.js" require="jquery"}
     1{combine_script id="jquery" path= "themes/default/js/jquery.min.js" }
     2{combine_script id="jquery.cluetip" path= "themes/default/js/plugins/jquery.cluetip.js" require="jquery"}
    33{combine_script id="my_script" path= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js" }
    4 
    5 <input id="action_spam" name="action_spam" type="hidden" value="{$action_spam}" />
     4{if $theme=='default'}{combine_css path= $MAIL_SUPERV_PATH|@cat:'admin/clear/theme.css'}{/if}
    65{if $theme=='clear'}{combine_css path= $MAIL_SUPERV_PATH|@cat:'admin/clear/theme.css'}{/if}
    76{if $theme=='roma'}{combine_css path= $MAIL_SUPERV_PATH|@cat:'admin/roma/theme.css'}{/if}
    8 {if $theme=='default'}{combine_css path= $MAIL_SUPERV_PATH|@cat:'admin/clear/theme.css'}{/if}
     7{html_head}
    98
     9{/html_head}
  • extensions/Mail_supervisor/admin/mail_superv_admin.php

    r10155 r10385  
    358358  $template->assign(
    359359                                        array(
    360                                                 'Groupe'     => $groups,
    361                                         'message_test' => $mails_donnees['message_test'] ,
    362                                                 'liste' => $destinataires ,
    363                                                 'version' =>     $version ,
    364                                                 'MAIL_CONTENT' => $mails_donnees['message_test'],
    365                                                 'path_js' => $path_js,
    366                         'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    367                         'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
     360              'Groupe'     => $groups,
     361              'message_test' => $mails_donnees['message_test'] ,
     362              'liste' => $destinataires ,
     363              'version' =>       $version ,
     364              'MAIL_CONTENT' => $mails_donnees['message_test'],
     365              'path_js' => $path_js,
     366              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
     367              'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
    368368                                                )
    369369                                );     
     
    433433        $champs_ip=array();
    434434        $champs_bl=array();
    435         if (!empty($liste_ip))          $champs_ip=array_keys($liste_ip[0]);
     435        if (!empty($liste_ip))  $champs_ip=array_keys($liste_ip[0]);
    436436        if (!empty($liste_bl))  $champs_bl=array_keys($liste_bl[0]);
    437437           $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ;
     
    467467                        'version' =>     $version ,
    468468                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    469                                 'path_js' => $path_js,
     469                     
    470470                                        )
    471471                                );                       
     
    487487      $template->assign(
    488488                                        array(
    489                                         'smile_bonjour' => $smile_bonjour ,
    490                                         'version' =>    $version ,
    491                                         'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
    492                          'path_js' => $path_js,
    493                         'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
     489              'smile_bonjour' => $smile_bonjour ,
     490              'version' =>       $version ,
     491              'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
     492              'path_js' => $path_js,
     493              'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
    494494                                        )
    495495                        );             
  • extensions/Mail_supervisor/admin/roma/theme.css

    r10179 r10385  
    1 /* Bloc expand-collapse instructions */
    2 .instructionBlock
    3 {
     1.bug {
     2  background-image: url('../../smilies/mouche.gif');
     3  background-repeat: no-repeat;
     4  width: 100px;
     5  height: 75px;
     6}
     7/* Bloc expand-collapse instructions */
     8.instructionBlock{
    49  border: 1px solid #666;
    510  margin: 5px;
    611  overflow: hidden;
    712}
    8 
    9 .instructionBlockHeaderCollapsed, .instructionBlockHeaderExpanded
    10 {
     13.instructionBlockHeaderCollapsed, .instructionBlockHeaderExpanded{
    1114  background-color:#111;
    1215  background-position:15px center;
     
    1922  text-align: left;
    2023}
    21 
    22 .instructionBlockHeaderCollapsed span, .instructionBlockHeaderExpanded span
    23 {
    24   border-bottom: none;
     24.instructionBlockHeaderCollapsed span, .instructionBlockHeaderExpanded span{ 
     25border-bottom: none;
    2526}
    2627
     
    2829  background-image: url(expand.gif);
    2930}
    30 
    31 .instructionBlockHeaderExpanded
    32 {
     31.instructionBlockHeaderExpanded{
    3332  background-image: url(collapse.gif) ;
    3433}
    3534
    36 .instructionBlockContent
    37 {
     35.instructionBlockContent{
    3836  padding:0 15px 15px;
    3937}
  • extensions/Mail_supervisor/include/fonctions.php

    r9702 r10385  
    2525if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    2626
     27
    2728global  $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ;
    2829// if (!isset($_COOKIE[session_name()])){}
     
    3132global $template ;
    3233//===============================================
    33 function corrige_header($Carbonne,$headers,$args,$cl_list_mail)
    34         {
    35         global $mails_options,$conf_mail,$mailto,$infos_message;
    36 
    37  if (!empty($args[$Carbonne]))
    38          {
    39                 if ( count($args[$Carbonne]) > 0 )
    40                 {
    41                         if ($mails_options['check_header_carbon'] == 'on') {
    42                                         $cl_list_mail  =  str_replace(","," , ",get_strict_email_list(implode(',', $args[$Carbonne])))." \n"  ;
    43                                         $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$cl_list_mail, $headers);
    44                                 }
    45                 }
    46        
    47         } else {
    48              // Raz Bcc, Cc dans headers
    49                         $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', "" , $headers);
    50         }
    51                
    52                 $headers  = str_replace("\n.", "\n..",$headers );
    53         $ret->headers = $headers ;
    54         $ret->list_mail = $cl_list_mail ;
    55         return $ret;
    56 
    57                
    58         }
     34function corrige_header($Carbonne,$headers,$args,$cl_list_mail,$mailto="")      {
     35  global $mails_options,$conf_mail,$infos_message;
     36  if (!empty($args[$Carbonne]) && count($args[$Carbonne]) > 0 ){
     37    $cl_list_mail  =  str_replace(","," , ",get_strict_email_list(implode(',', $args[$Carbonne])))." \n"  ; 
     38    $cl_liste_dest = implode(', ', $args[$Carbonne])." \n";
     39    if ($mails_options['check_header_carbon'] == 'on') {   
     40        $headers = preg_replace('/.*'.$Carbonne.':(.*).\n/i', $Carbonne.': '.  $cl_list_mail, $headers);         
     41    } 
     42    $ret->list_mail = $cl_list_mail ;         
     43  } else {
     44    // Raz Bcc, Cc dans headers
     45    $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', "" , $headers);
     46    $ret->list_mail = "" ;
     47  }
     48  $ret->headers = $headers ;
     49  return $ret;         
     50}
    5951       
    60 function int_to_heure($int)
    61 {
    62 global $lang,$mails_donnees ;
    63 
    64 $v0=Date_to_numeric(l10n('Day') );
     52function int_to_heure($int){
     53  global $lang,$mails_donnees ;
     54  $v0=Date_to_numeric(l10n('Day') );
    6555
    6656
     
    8878        $secondes = substr ('00'.$secondes,-2,2);
    8979       
    90 $retour="";
    91 $Week=explode(" ",l10n('Week %d'));
    92 $Week= ($Week[0]);
    93 
    94 if ($week > 0 ) $retour .= "+" . $week ." " . $Week ;
    95 if ($day  > 0) $retour .= "+" . $day ." " .l10n('Day');
    96 if ($heures > 0) $retour .= "+" . $heures." " .l10n('Hour');
    97 if ($minutes > 0) $retour .= "+" . $minutes." " .l10n('Minute');
    98 if ($secondes > 0) $retour .= "+" . $secondes." " .l10n('Second');
    99 $retour=str_replace("+0","+",$retour);
    100 //================================================================================================   
    101 return $retour;
     80  $retour="";
     81  $Week=explode(" ",l10n('Week %d'));
     82  $Week= ($Week[0]);
     83
     84  if ($week > 0 ) $retour .= "+" . $week ." " . $Week ;
     85  if ($day  > 0) $retour .= "+" . $day ." " .l10n('Day');
     86  if ($heures > 0) $retour .= "+" . $heures." " .l10n('Hour');
     87  if ($minutes > 0) $retour .= "+" . $minutes." " .l10n('Minute');
     88  if ($secondes > 0) $retour .= "+" . $secondes." " .l10n('Second');
     89  $retour=str_replace("+0","+",$retour);
     90  //================================================================================================   
     91  return $retour;
    10292}         
    10393
     
    148138}
    149139
    150 function get_liste($group_id)
    151 {
     140function get_liste($group_id){
    152141global $conf ;
    153142  $query = '
     
    168157 
    169158  if (!empty($datas)) {
    170     while ($group = mysql_fetch_array($datas,MYSQL_ASSOC))
    171     {   
    172       if (!empty($group['email']))
    173       {         array_push($groups, format_email($group['username'], $group['email'] ));
     159    while ($group = mysql_fetch_array($datas,MYSQL_ASSOC)){     
     160      if (!empty($group['email'])){ 
     161         array_push($groups, format_email($group['username'], $group['email'] ));
    174162      }
    175163    }
     
    259247}
    260248//=====================================================================
    261 function verif_mails_donnees()
    262 {
    263 global $mails_donnees,$infos_message,$erreur_message,$page;
     249function verif_mails_donnees(){
     250  global $mails_donnees,$infos_message,$erreur_message,$page;
    264251
    265252if (!is_numeric($mails_donnees['nb_mails_periode'])){
     
    286273}
    287274//=======================================================================
    288 function Date_to_numeric( $Valeurs )
    289 {
     275function Date_to_numeric( $Valeurs ){
    290276global $lang,$erreur_message,$infos_message;
    291277
     
    294280
    295281if (!isset($lang['Sv_second'])) {
    296 $Week=explode(" ",l10n('Week %d'));
    297 $Week= ($Week[0]);
    298 
    299 $lang['Sv_week'] = $Week;
    300 $lang['Sv_day'] =   l10n('Day')  ;
    301 $lang['Sv_hour'] =   l10n('Hour')  ;
    302 $lang['Sv_minute'] =   l10n('Minute') ;
    303 $lang['Sv_second'] =   l10n('Second');
    304 
    305 $lang['Sv_'. $lang['Sv_week']] = 'week';
    306 $lang['Sv_'. $lang['Sv_day']] = 'day';
    307 $lang['Sv_'. $lang['Sv_hour']] = 'hour';
    308 $lang['Sv_'. $lang['Sv_minute']] = 'minute';
    309 $lang['Sv_'. $lang['Sv_second']] = 'second';
     282  $Week=explode(" ",l10n('Week %d'));
     283  $Week= ($Week[0]);
     284
     285  $lang['Sv_week'] = $Week;
     286  $lang['Sv_day'] =   l10n('Day')  ;
     287  $lang['Sv_hour'] =   l10n('Hour')  ;
     288  $lang['Sv_minute'] =   l10n('Minute') ;
     289  $lang['Sv_second'] =   l10n('Second');
     290
     291  $lang['Sv_'. $lang['Sv_week']] = 'week';
     292  $lang['Sv_'. $lang['Sv_day']] = 'day';
     293  $lang['Sv_'. $lang['Sv_hour']] = 'hour';
     294  $lang['Sv_'. $lang['Sv_minute']] = 'minute';
     295  $lang['Sv_'. $lang['Sv_second']] = 'second';
    310296
    311297}
     
    326312  $nv = explode(" ", $nv );
    327313 
    328   foreach($nv as $nv1)
    329   {
    330   if (!isset($lang['Sv_'. $nv1]) ) {
    331   //==== au cas pluriel ===
    332  
    333    $nv0 =  substr($nv1, 0,-1) ;   
    334   $a_ajouter= str_replace( $nv1,$nv0,   $a_ajouter);
    335   $nv1 = $nv0 ;
    336    
     314  foreach($nv as $nv1){
     315    if (!isset($lang['Sv_'. $nv1]) ) {
     316    //==== au cas pluriel === 
     317      $nv0 =  substr($nv1, 0,-1) ;   
     318      $a_ajouter= str_replace( $nv1,$nv0,   $a_ajouter);
     319      $nv1 = $nv0 ;     
     320    } 
     321    if (!isset($lang['Sv_'. $nv1]) ) {
     322      $erreur_message .= $nv1. " ".l10n('not_found')."<br />"; 
     323          //  die($erreur_message);       
     324    }else {
     325      ob_start(); 
     326      $match = $conv[strtolower($lang['Sv_'. $nv1])] ;
     327      $a_ajouter = str_replace($nv1," ". $match  ." ",$a_ajouter) ;
     328      $erreur_message .= ob_get_contents();
     329      ob_end_clean();
     330          }               
    337331  }
    338  
    339   if (!isset($lang['Sv_'. $nv1]) ) {
    340     $erreur_message .= $nv1. " ".l10n('not_found')."<br />"; 
    341         //  die($erreur_message);
    342          
    343   }else {
    344     ob_start(); 
    345          $match = $conv[strtolower($lang['Sv_'. $nv1])] ;
    346          $a_ajouter = str_replace($nv1," ". $match  ." ",$a_ajouter) ;
    347                  $erreur_message .= ob_get_contents();
    348     ob_end_clean();
    349         }       
    350          
    351   }
    352 
    353 $a_ajouter = "+ " .   $a_ajouter ;
    354 $a_ajouter=sup_double_espace($a_ajouter);
    355 $v1 = array('- ','+ ',' -', ' +', ' ');
    356 $v2 = array('-' ,'+' ,'|-', '|+', "*");
    357 
    358 $new_valeur =  str_replace($v1,$v2,$a_ajouter) ;
    359 $new_valeur =  str_replace('++','+',$new_valeur ) ;
     332
     333  $a_ajouter = "+ " .   $a_ajouter ;
     334  $a_ajouter=sup_double_espace($a_ajouter);
     335  $v1 = array('- ','+ ',' -', ' +', ' ');
     336  $v2 = array('-' ,'+' ,'|-', '|+', "*");
     337
     338  $new_valeur =  str_replace($v1,$v2,$a_ajouter) ;
     339  $new_valeur =  str_replace('++','+',$new_valeur ) ;
    360340                       
    361 return   $new_valeur;
     341  return   $new_valeur;
    362342}
    363343//=====================================================================
     
    571551}
    572552//=====================================================================================
    573 function test_spam($ip =0,$user_name ='', $mail_adresse = "")
    574 {
     553function test_spam($ip =0,$user_name ='', $mail_adresse = ""){
    575554 $buffer="";
    576555 global $page,$infos_message;
     
    616595}
    617596//==================================================================
    618 function lire_fichier_distant($fichier)
    619 {
    620  $buffer="";
    621         $handle =  @fopen($fichier,"r");
    622         if ($handle) {
    623                        while (!feof($handle)) {
    624                        $buffer .= fgets($handle, 4096);
    625                                   }   
    626                                    fclose($handle);
    627                                 }
     597function lire_fichier_distant($fichier){
     598  $buffer="";
     599  $handle =  @fopen($fichier,"r");
     600  if ($handle) {
     601    while (!feof($handle)) {
     602        $buffer .= fgets($handle, 4096);
     603                  }   
     604                          fclose($handle);
     605          }
    628606                                 
    629         return  $buffer ;
     607  return  $buffer ;
    630608
    631609}
    632610//================================================
    633 function clj_is_ip($ip)
    634 {
     611function clj_is_ip($ip){
    635612if (preg_match("/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9])\.){1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9])\.){2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/",$ip))    return true ;
    636613                 
  • extensions/Mail_supervisor/language/fr_FR/help/plugin.lang.php

    r10094 r10385  
    99$lang['Sv_Fonctionality']='Fonctionnalites';
    1010
    11 $lang['Sv_Oversees_management_emails']='Supervise la gestion des mails et bloque l\' envoie des mails lors de la mise en quarantaine'; 
     11$lang['Sv_oversees_management_emails']='Supervise la gestion des mails et bloque l\' envoie des mails lors de la mise en quarantaine'; 
    1212$lang['Sv_hlp_1_1']='Compte le nombre de mails envoyes par le site.';
    1313$lang['Sv_hlp_1_2']='Detecte les differents messages d\'alertes generes par la fonction mail[]';
  • extensions/Mail_supervisor/mail_super.inc.php

    r10179 r10385  
    2020// | USA.                                                                  |
    2121// +-----------------------------------------------------------------------+
    22 if (!defined('MAIL_SUPERV_PATH'))
    23 define('MAIL_SUPERV_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    24 if (!defined('ROOT_URL'))
    25 define(  'ROOT_URL',  get_root_url().'/' );
    26 $MAIL_SUPERV_PATH_ABS=str_replace('\\','/',dirname(__FILE__) );
    27 if (!defined('MAIL_SUPERV_PATH_ABS'))
    28 define('MAIL_SUPERV_PATH_ABS',   $MAIL_SUPERV_PATH_ABS."/");
    2922
    3023class mail_supervisor {
     
    4639 */
    4740 static public function init() {
    48   global  $template,$version,$path_js,$icon_path;
    49 
    50  $theme="default";
    51 
     41  global  $template,$version,$icon_path;   
     42  $action_spam = pwg_get_session_var('action_spam') ;
     43  $theme="default";
     44  $themeconf=$template->get_template_vars('themeconf');
     45  $theme=$themeconf['id'];
     46  if (file_exists ( 'admin/themes/clear/icon/help.png')) $icon_path = 'themes/default/icon/help.png';
     47  else  $icon_path =  "admin/template/goto/theme/clear/icon/help.png";
    5248  if (PHPWG_VERSION < 2.2 ) {
    5349    $file =MAIL_SUPERV_PATH_ABS.'admin/header_2_1.tpl' ;
    54     if (PHPWG_VERSION < 2.0 ) $path_js =  "template-common/lib/";
    55     else $path_js=  'themes/default/js/' ;
    56     $themeconf=$template->get_template_vars('themeconf');
    57     $theme=$themeconf['id'];
    58    
     50 
    5951  } else {
    60      $themeconf=$template->get_template_vars('themeconf');
    61     $theme=$themeconf['id'];
    62     $file =MAIL_SUPERV_PATH_ABS.'admin/header_2_2.tpl' ;
    63     $path_js=  'themes/default/js/' ;
     52    $file = MAIL_SUPERV_PATH_ABS.'admin/header_2_2.tpl' ;
     53   
    6454  }
    6555  if(isset($_GET['action_spam']) and $_GET['action_spam']=="no"){
    66     $action_spam = pwg_get_session_var('action_spam') ;
    6756    pwg_set_session_var('action_spam', "false");
    6857    unset ($_SESSION['pwg_'.'action_spam']);
    6958  }
    70  
    71 
     59  $action_spam=pwg_get_session_var('action_spam');
    7260  $template->set_filenames(array('mail_superv_init'=> $file ));
    73   if (file_exists ( 'admin/themes/clear/icon/help.png')) $icon_path = 'themes/default/icon/help.png';
    74   else  $icon_path =  "admin/template/goto/theme/clear/icon/help.png";
    75   $template->assign(
    76       array('theme' => $theme,'version' => $version,
    77       'PHPWG_VERSION' =>     PHPWG_VERSION ,
    78       'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
    79       'path_js' => $path_js,
    80       'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    81       'action_spam' => pwg_get_session_var('action_spam')
    82       )
    83   );
     61  $MAIL_SUPERV_PATH=str_replace(PHPWG_ROOT_PATH,"",MAIL_SUPERV_PATH) ;
     62  $profile=array('theme' => $theme,
     63            'PHPWG_VERSION' => PHPWG_VERSION ,
     64            'MAIL_SUPERV_PATH' => $MAIL_SUPERV_PATH  ,             
     65            'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS           
     66          );
     67
     68  $template->assign( $profile );
     69  $template->append('footer_elements', '<input id="action_spam" name="action_spam" type="hidden" value="'.$action_spam.'" />');
    8470  $template->parse( 'mail_superv_init', false);
    85 
    8671  return ;//
    8772}// function init
     
    190175    ob_start();
    191176    echo '<pre>';
     177    if(count($variables)>1){
    192178    foreach($variables as $key => $line){
    193179      echo  $key . " =>  " . $line ;
    194180      echo "<br />";
    195181    }       
     182    }else{
     183        echo "<i>".$variables."</i><br />";
     184    }
     185
    196186    $m= ob_get_contents();
    197187    ob_end_clean();
  • extensions/Mail_supervisor/main.inc.php

    r9702 r10385  
    1111if (!defined('mail_superv_DIR')) define('mail_superv_DIR' , basename(dirname(__FILE__)));
    1212if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    13 $MAIL_SUPERV_PATH_ABS=str_replace('\\','/',dirname(__FILE__) );
     13
     14$MAIL_SUPERV_PATH_ABS = str_replace('\\','/',dirname(__FILE__) );
    1415if (!defined('MAIL_SUPERV_PATH_ABS')) define(  'MAIL_SUPERV_PATH_ABS',   $MAIL_SUPERV_PATH_ABS."/");
     16
    1517global $conf,$mails_options ;
    1618include_once (MAIL_SUPERV_PATH.'include/constants.php');
    1719include_once(MAIL_SUPERV_PATH.'mail_super.inc.php');
     20
    1821$mail_supervisor = new mail_supervisor();
    1922add_event_handler('get_admin_plugin_menu_links', array(&$mail_supervisor,'admin_menu')  );
     
    2326//
    2427//
     28include_once (PHPWG_ROOT_PATH.'include/functions_mail.inc.php' );
    2529include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
    2630//===============loc_begin_index==============loc_after_page_header=============================================================
    27 add_event_handler('loc_after_page_header',  array(&$mail_supervisor,'init')  );
     31add_event_handler('loc_begin_page_header',  array(&$mail_supervisor,'init')  );
    2832add_event_handler('loc_begin_page_tail',  array(&$mail_supervisor,'affiche_message')  );
    2933
     
    3135add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 10, 6);
    3236function clj_mail($result, $mailto, $subject, $content, $headers, $args) {
    33     global $conf, $user, $lang_info; 
    34     global $conf_mail,$mails_options,$mails_donnees ;
    35     global  $template,$page ,$erreur_message,$infos_message, $lang;
    36     global $errors;
    37  
    38         // lecture config table -------------
    39           include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
    40    load_language('plugin.lang', MAIL_SUPERV_PATH);
    41          if (isset($_POST["Submit"]) ) {
    42             if ($_POST["Submit"] != l10n('Sv_Envoyer') ) return true ;
    43          } 
    44    // remove_event_handler('send_mail', 'pwg_send_mail');
    45      
    46            $message ="";
    47     if (!isset($infos_message)) {       $infos_message = "";    }
    48     if (!isset($erreur_message))        {       $erreur_message = '';   }       
     37  global $conf, $user, $lang_info; 
     38  global $conf_mail,$mails_options,$mails_donnees ;
     39  global  $template,$page ,$erreur_message,$infos_message, $lang;
     40  global $errors;
     41  // lecture config table -------------
     42  include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
     43  load_language('plugin.lang', MAIL_SUPERV_PATH);
     44  if (isset($_POST["Submit"]) ) {
     45    if ($_POST["Submit"] != l10n('Sv_Envoyer') ) return true ;
     46  } 
     47  // remove_event_handler('send_mail', 'pwg_send_mail');     
     48        $message ="";
     49  if (!isset($infos_message))   {       $infos_message = "";    }
     50  if (!isset($erreur_message))  {       $erreur_message = '';   }         
    4951   
    50    // $mails_options = explode("," , $conf['mail_superv']);
    51     $envoie_ok=true ;
    52 //======== verification si envoie de mail ou blocage connexion =====================
    53 
    54         if ($mails_options['no_mail_list']=='on' || $mails_options['no_connect'] == 'on' )      {
     52  // $mails_options = explode("," , $conf['mail_superv']);
     53  $envoie_ok=true ;
     54  //======== verification si envoie de mail ou blocage connexion =====================
     55
     56  if ($mails_options['no_mail_list']=='on' || $mails_options['no_connect'] == 'on' )    {
    5557                if (kill_list()) {
    5658      $nb_destinataires=0; ;
     
    5860      $erreur_message .= "<BR />".l10n('Sv_is_a_spam') ;
    5961      $infos_message = l10n('Sv_mail_not_send')."<BR />";
    60                    if ($mails_options['no_connect'] == 'on' ){
    61                    if ($user['status'] == 'webmaster'  )                { 
    62                           //---------- continuer si web master ----------
    63 
    64                           }else{
    65                                   if (!isset($_GET['admin'])) {
    66                                                  die('Blacklist : <br />' .$erreur_message. '<br /> Hacking attempt!');
    67                                        }elseif   ($_GET['admin'] != 'piwigo')
    68                                                {
    69                                                  die('blacklist Hacking attempt!');
    70                                         }
    71                      
    72                           }
    73                          
    74                         }
    75 
     62      if ($mails_options['no_connect'] == 'on' ){
     63              if ($user['status'] == 'webmaster'){ 
     64              //---------- continuer si web master ----------
     65              }else{
     66                      if (!isset($_GET['admin'])) {
     67                                      die('Blacklist : <br />' .$erreur_message. '<br /> Hacking attempt!');
     68                                        }elseif   ($_GET['admin'] != 'piwigo')
     69                                                {
     70                                      die('blacklist Hacking attempt!');
     71                      }             
     72              }                         
     73      }
    7674         return true;
    7775                }
    7876        }
    79         // lecture donnees       -------------
    80  $mails_donnees = mail_supervisor::Get_Datas();
    81  
    82         $nb_mails         =     $mails_donnees['nb_mails'] ;
    83         $next_day  =  $mails_donnees['date_mail'] ;
    84        
    85         $reste =    $mails_donnees['reste'] ;
    86        
    87        
    88         $rest_mail =    $mails_donnees['rest_mail'] ;
     77  // lecture donnees       -------------
     78  $mails_donnees = mail_supervisor::Get_Datas();
     79  $nb_mails       =     $mails_donnees['nb_mails'] ;
     80  $next_day  =  $mails_donnees['date_mail'] ;   
     81  $reste =    $mails_donnees['reste'] ;         
     82        $rest_mail =    $mails_donnees['rest_mail'] ; 
    8983        if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){
    9084           $mails_donnees['nb_mails'] =0 ;
    9185           $mails_donnees['date_mail'] = time();
    92         }
    93        
     86        }       
    9487        $rest_spam =    $mails_donnees['rest_spam'] ;
    9588        if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){
    9689           $mails_donnees['nb_spams'] =0 ;
    9790           $mails_donnees['date_spam'] = time();
    98         }
    99        
    100         $alerte =   ( $mails_donnees['reste'] >0 ) ? true : false ;
    101        
     91        }       
     92        $alerte =   ( $mails_donnees['reste'] >0 ) ? true : false ;     
    10293        $alerte_mail =    ( $mails_donnees['nb_mails'] >   $mails_donnees['nb_mails_maxi']-1 ) ? true : false ;
    103         $alerte_spam =    (  $mails_donnees['nb_spams'] >   $mails_donnees['nb_spams_maxi']-1 ) ? true : false ;
    104        
    105  
    106     if ( ( !$alerte  && !$alerte_spam  && !$alerte_mail ) ) {           
    107             $nb_destinataires=0;
    108                     if ($mails_options['check_mailto'] == 'on') {
    109                             if ($mailto == "" ) $mailto = $conf_mail['email_webmaster'];
    110                     }   
    111             if ($mailto<>"" )            $nb_destinataires +=1;
    112                     if (!empty($args['Bcc'])) { $nb_destinataires += count($args['Bcc']);       }
    113                     if (!empty($args['Cc']))  { $nb_destinataires += count($args['Cc']);        }
    114 
    115    
    116                 $infos_message .= "<hr> Theme :" . ($args['theme'] ) ."<br />";
    117             $infos_message .="nombre de destinataire:".$nb_destinataires." <br />" ;
    118 
    119            //================= reecriture de l'entete ===============================
    120             $match=array("<",">");
    121             $string=array("&lt;","&gt;") ;     
    122        
    123             if ( $nb_destinataires  == 1 && $mailto != "" )
    124                     {   
    125                     $infos_message .="--> Mailto: " . $mailto." \n" ;
    126    
    127                             if ($mailto != "" )
    128                                 {
    129 
    130                             $mailto  = $mailto ." \n"   ;
    131                             $headers =  preg_replace('/.*Bcc(.*).\n/i', '', $headers);
    132                                             $headers =  preg_replace('/.*Cc(.*).\n/i', '', $headers);
    133                
    134                        
    135                                 }
    136                     //=============================================================================
     94        $alerte_spam =    ( $mails_donnees['nb_spams'] >   $mails_donnees['nb_spams_maxi']-1 ) ? true : false ;
     95
     96  if ( ( !$alerte  && !$alerte_spam  && !$alerte_mail ) ) {             
     97    $nb_destinataires=0; 
     98  //====================================================
     99    $match_email = $conf_mail['email_webmaster'];     
     100    $new_args=array();
     101    foreach($args['Bcc'] as $key => $val){
     102      if (!preg_match('/'. $match_email.'/', $val)){
     103          array_push($new_args, $val);
     104      }else{
     105                $mailto = $match_email;
     106      }
     107    }
     108    $args['Bcc']=$new_args;
     109     //=======================================================================
     110     $nb_destinataires=0;
     111    if ($mailto<>"" ) $nb_destinataires +=1;           
     112                if (!empty($args['Cc']))  {     
     113        $nb_destinataires += count($args['Cc']);
     114       
     115    } 
     116                if (!empty($args['Bcc']))  {   
     117        $nb_destinataires += count($args['Bcc']);       
     118    } 
     119    if ($mailto == "" && $nb_destinataires==0 ) {
     120      $mailto = $conf_mail['email_webmaster'];
     121      $nb_destinataires ++;
     122    }
     123
     124                if ($mails_options['check_mailto'] == 'on') {
     125                        if ($mailto == "" && $nb_destinataires > 1 )    $mailto = $conf_mail['email_webmaster'];
     126                }   
     127
     128        $infos_message .= "nb_destinataires : $nb_destinataires Theme :" . ($args['theme'] ) ."<br />";
     129    //================= réecriture de l'entete ===============================
     130    $match=array("<",">");
     131    $string=array("&lt;","&gt;") ;                     
     132    if ( $nb_destinataires  == 1 ) {   
     133      if ($mailto == "" ) {     
     134        if (!empty($args['Bcc'])){
     135          $mailto = get_strict_email_list(implode(',', $args['Bcc']));
     136          $args['Bcc']=array();
     137        }else{   
     138          if (!empty($args['Cc']) ){  $mailto=get_strict_email_list(implode(',', $args['Cc']));
     139           $args['Cc']=array();
     140          };
     141        }
     142      }
     143      if ($mailto == "" ) {$nb_destinataires  = 0 ;}
     144      $mailto  = $mailto ." \n"   ;
     145      $headers =  preg_replace('/.*Bcc(.*).\n/i', '', $headers);
     146      $headers =  preg_replace('/.*Cc(.*).\n/i', '', $headers);
     147      $infos_message .="Destinataire:" .$mailto ;
     148      //=============================================================================
     149       
     150    }else{
     151          //=== plusieurs destinataires ===========
     152      $cl_list_mail="";
     153      if ($mailto !="") $infos_message .="To: " . $mailto . " "."<br />" ;     
     154      if (!empty($args['Cc'])) {
     155        $ret= corrige_header('Cc',$headers,$args,$cl_list_mail,$mailto);
     156        $headers = $ret->headers;
     157        if($ret->list_mail!="") $infos_message .="Cc: " .  ( $ret->list_mail)."  <br />" ;
    137158             
    138            
    139                             if (!empty($args['Bcc']) ) $infos_message .="Bcc: " . mail_supervisor::Memo_Var($args['Bcc']) ." \n";
    140                             if (!empty($args['Cc']) ) $infos_message .="Cc: " . mail_supervisor::Memo_Var($args['Cc'])." \n" ;
    141                             $infos_message .="Mailto: [" . $mailto . "]"." \n".$headers;             
    142          
    143                     }else{
    144                     //=== plusieurs destinataires ===========
    145                     $cl_list_mail="";
    146 
    147                     if ($mailto !="") $infos_message .="To: " . $mailto . " "." /n" ;     
    148                     if (!empty($args['Cc'])) {
    149                     $ret= corrige_header('Cc',$headers,$args,$cl_list_mail);
    150                         $headers = $ret->headers;
    151                         $infos_message .="Cc: " .  ( $ret->list_mail)."  <br />" ;
    152                     }
    153                     if (!empty($args['Bcc'])){
    154                         $ret    = corrige_header('Bcc',$headers,$args,$cl_list_mail);
    155          
    156                         $headers = $ret->headers ;
    157                         $infos_message .="Bcc: " . ( $ret->list_mail) ."  <br />";
    158                     }
     159      }
     160      if (!empty($args['Bcc'])){
     161          $ret  = corrige_header('Bcc',$headers,$args,$cl_list_mail,$mailto); 
     162          $headers = $ret->headers ;
     163          if($ret->list_mail!="") $infos_message .="Bcc: " . ( $ret->list_mail) ."  <br />";
     164           
     165       }     
     166             $infos_message .=  " " ;
     167    }
     168     
    159169     
    160                     $infos_message .=  " " ;
    161             }
    162             // $infos_message .= $content ;
    163170            //=============================================================================
    164171            if ($mails_options['check_header_text']=='on')   {
     
    171178              $texte .= "\n\n";         
    172179              $content =$texte .$content ;
    173             }
    174  
    175             $ret=false;
    176                 //======== Non mise en quarantaine =============
     180            }   
     181            // corrige erreur 'mail dropped, bare LF found'
     182          /*   if ( preg_match('/\n\./',$content)){
     183             $content=preg_replace('/\n\./', '/\n\.\./', $content);
     184
     185   //   $infos_message .= $content ;
     186             }
     187             $content = str_replace("\n.", "\n/./.", $content);
     188             $headers = str_replace("\n.", "\n..", $headers);
     189            $subject = str_replace("\n.", "\n..", $subject);
     190             $mailto = str_replace("\n.", "\n..", $mailto);
     191       */
     192             
     193            $ret=false;
     194                //======== Non mise en quarantaine ============= 
     195         
     196         
    177197                    ob_start();
    178                     $ret = false;
    179                       if ($nb_destinataires > 0) {
    180                          // corrige erreur 'mail dropped, bare LF found'
    181                          $content = str_replace("\n.", "\n..", $content);
    182                          $headers = str_replace("\n.", "\n..", $headers);
    183                          $subject = str_replace("\n.", "\n..", $subject);
    184                          $mailto = str_replace("\n.", "\n..", $mailto);
    185                 if( $envoie_ok)  $ret = mail($mailto, $subject, $content, $headers);
    186        
    187                           }else{
    188                                $message .= l10n('Sv_no_receiver_available');
    189                           }
    190                             $message .= ob_get_contents();
    191                 ob_end_clean();
    192                             $mails_donnees['message']=$message;
    193                             Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto);
     198                      if ($nb_destinataires > 0) {   
     199
     200            if( $envoie_ok)  $ret = mail($mailto, $subject,$content, $headers);
     201           
     202          }else{
     203            $message .= l10n('Sv_no_receiver_available');
     204          }
     205        $message .= ob_get_contents();
     206        ob_end_clean();
     207        $mails_donnees['message']=$message;     
     208        Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto);
    194209            } else {
    195210                    //================== Est en quarantaine =======================     
     
    225240            }
    226241            $infos_message .= l10n('Sv_mail_not_send');
    227             }                   
     242            }           
     243           $infos_message .= "<hr>";   
    228244    mail_supervisor::sauve_donnees();
    229245    mail_supervisor::affiche_message();
Note: See TracChangeset for help on using the changeset viewer.