Changeset 8917


Ignore:
Timestamp:
Jan 26, 2011, 3:59:23 PM (13 years ago)
Author:
cljosse
Message:

[Mail_Supervisor] compatibility with piwigo 2.2

Location:
extensions/Mail_supervisor
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/admin/mail_black_liste.tpl

    r6874 r8917  
    11{* $Id: mail_black_liste.tpl 3723 2009-08-07 04:53:38Z rvelices $ *}
    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"}
     2{html_head}
     3{if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
     4{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
    45
    56<script type="text/javascript">
     
    2627 <table>
    2728<td><input type="checkbox" name="no_mail_list" value="on" {$no_mail_list}  />&nbsp;&nbsp;{'Sv_no_mail_list'|translate}  </td>
    28 <td><input type="checkbox" name="no_connect" value="on" {$no_connect} />&nbsp;&nbsp;{'Sv_no_connect'|translate}</td>
    29 <td><input type="checkbox" name="set_auto" value="on" {$set_auto} />&nbsp;&nbsp;{'Sv_set_auto'|translate}</td>
     29<td><input type="checkbox" style="visibility:hidden" name="no_connect" value="off" {$no_connect} />&nbsp;&nbsp; </td>
     30<td><input type="checkbox" style="visibility:hidden" name="set_auto" value="off" {$set_auto} />&nbsp;&nbsp; </td>
    3031<td><input type="checkbox" name="set_id" value="on" {$set_id} />&nbsp;&nbsp;{'Sv_set_id'|translate}</td>
    3132<tr><p></p><td>
  • extensions/Mail_supervisor/admin/mail_superv_admin.php

    r7050 r8917  
    2828
    2929if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
     30if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' ,  dirname(__FILE__).'/');
    3031
    3132global $user, $lang, $conf, $errors,$mails_donnees;
     
    7778
    7879$tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
    79 
    80  
    81 
    8280$tabsheet = new tabsheet();
    8381$tabsheet->add('mail_superv_admin',
     
    9896               $my_base_url.'&amp;tab=mail_superv_help');
    9997                           
    100                            
    10198$tabsheet->select($page['tab']);
    10299$tabsheet->assign();
     
    133130                if (!isset($mails_options[check_header_carbon])) $mails_options[check_header_carbon] = 'off' ;  //1
    134131                if (!isset($mails_options[check_mailto])) $mails_options[check_mailto] = 'off' ;  //0
    135 //================================================================================================             
     132//================================================================================================     
     133$mails_options[set_auto] = 'off' ;
     134$mails_options[no_connect] = 'off' ;
     135       
    136136$mails_donnees = Get_Datas();
    137137
     
    144144$aff_nb=true;
    145145
    146 
    147        
    148146// *************************************************************************
    149147// |                          Selection de l'onglet                        |
     
    151149
    152150                $modif=false ;
    153                 /*
    154                 $sql="SELECT *
    155 FROM `".$prefixeTable."plugins`
    156 WHERE `id` LIKE 'Mail_supervisor'
    157 ";
    158  $result = @pwg_query($sql);
    159         if ($result) {
    160             $versions = mysql_fetch_array($result,MYSQL_ASSOC);
    161         }
    162 $version = $versions['version'];
    163 */
    164 $plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
    165 $version = $plugin['version'] ;
     151
     152        $plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
     153        $version = $plugin['version'] ;
    166154 //=========================================================
    167155
     
    219207        }
    220208
    221  
     209  //===================================================================
    222210        if ( $_POST['submit'] == l10n('Sv_Valider') ) 
    223211                {
     
    287275         'version' =>    $version ,
    288276        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
    289         'path_js' => $path_js
     277        'path_js' => $path_js,
     278    'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
     279     
    290280                                                )
    291281                                );     
    292282
    293283        $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');
     284 
     285
     286        $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    295287               
    296288 break;
     
    302294 
    303295   case 'mail_superv_test':
    304    
    305    $mails_donnees = 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));
     296                load_language('plugin.lang', MAIL_SUPERV_PATH);
     297                $mails_donnees = Get_Datas() ;
     298                $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
     299
     300                if ($group_id >= 0) {
     301                $query = 'SELECT
     302                                        name
     303                                                FROM '.GROUPS_TABLE.'
     304                                                WHERE id = '.$group_id.'
     305                                                ;';
     306                        list($group_name) = mysql_fetch_row(pwg_query($query));
    315307                }       else {
    316308                                $group_name="";         
    317309                }               
     310
    318311//================================================
    319312// info by email to an access granted group of category informations
    320 if (isset($_POST['submitEmail']) and !empty($_POST['group']))
     313
     314
     315if (isset($_POST['Submit']) and !empty($_POST['group']))
    321316{
    322317  set_make_full_url();
     318
    323319  /* TODO: if $category['representative_picture_id']
    324320    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 */
    339 
    340 if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
    341 else
    342 $titre=$conf['gallery_title'];
    343 
    344 $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
     321
     322
     323        if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
     324        else $titre=$conf['gallery_title'];
     325
     326        $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
    345327
    346328 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     '' );
    360        
    361 
    362 $mails_donnees['message_test']= str_replace('"',"'",$message) ;
    363  unset_make_full_url();
     329
     330 if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
     331         /*
     332         * send en email to user's group
     333         *
     334         * @param:
     335         *   - group_id: mail are sent to group with this Id
     336         *   - email_format: mail format
     337         *   - keyargs_subject: mail subject on l10n_args format
     338         *   - dirname: short name of directory including template
     339         *   - tpl_shortname: short template name without extension
     340         *   - assign_vars: array used to assign_vars to mail template
     341         *   - language_selected: send mail only to user with this selected language
     342         *
     343         * @return boolean (Ok or not)
     344        */   
     345        pwg_mail_group(
     346                $_POST['group'],
     347                get_str_email_format(true), 
     348                get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
     349                'cat_group_info',  // template
     350                array    ('CPL_CONTENT' => $message."\n\n".$user['username'] ),
     351                '' );
     352       
     353        $mails_donnees['message_test']= str_replace('"',"'",$message) ;
     354
     355        unset_make_full_url();
    364356        sauve_donnees();
    365 $mails_donnees = Get_Datas() ;
    366        
    367   $query = '
    368 SELECT
    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     );
     357        $mails_donnees = Get_Datas() ;
     358    $query = 'SELECT
     359                name
     360                        FROM '.GROUPS_TABLE.'
     361                        WHERE id = '.$_POST['group'].'
     362                        ;';
     363                list($group_name) = mysql_fetch_row(pwg_query($query));
     364                 
     365                  array_push(
     366                                        $page['infos'],
     367                                        sprintf( l10n('An information email was sent to group "%s"'),
     368                                                        $group_name  )
     369                                        );
     370                                                                $group_id =-1 ;
     371  }
    382372
    383  load_language('plugin.lang', MAIL_SUPERV_PATH);
    384 //=====================================================================================
    385 if ( isset($_POST['test_envoie']) ) {
    386 $mails_donnees['message_test'] = empty($_POST['MAIL_CONTENT']) ? '' : stripslashes($_POST['MAIL_CONTENT']);
    387                 $message=$mails_donnees['message_test'];
    388 //test_envoie($message,$group_name,$group_id);
    389                 sauve_donnees();
    390  
    391                 $mails_donnees = Get_Datas() ;
    392                
    393   }
    394 
     373
     374//======================================================================================
    395375  $groups[-1] = '---------';
    396 
    397   $query = '
    398     SELECT id, name
    399                 FROM '.GROUPS_TABLE.'
    400                 ORDER BY name ASC
    401                 ;';
     376  $query = ' SELECT id, name
     377                        FROM '.GROUPS_TABLE.'
     378                        ORDER BY name ASC
     379                        ;';
    402380
    403381  $result = pwg_query($query);
    404382//----------------------------------------------------------------     
    405383  while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
    406   {
    407     $groups[$row['id']] = $row['name'];
    408   }
     384  {    $groups[$row['id']] = $row['name'];  }
    409385 //---------------------------------------------------------------
    410 
     386if ( isset($_POST['Submit'])) $group_id=-1;
    411387  $template->assign(
    412388        'Group',
    413                 array(
    414                         'group_options'=> $groups,
    415                         'selected' => $group_id
     389                array( 'group_options'=> $groups,
     390                                'selected' => $group_id
    416391                        )
    417392                );
    418393//=================================================================
    419394$destinataires= implode("<br />",get_liste($group_id));
     395if( $destinataires !="" )
     396$infos_message .= " List :<hr>" .  $destinataires . "<hr>" ;
     397 
    420398  $template->assign(
    421399                                        array(
    422                                 'Groupe'     => $groups,
    423                         'message_test' => $mails_donnees['message_test'] ,
    424                                 'liste' => $destinataires ,
    425  'version' =>    $version ,
    426                             'MAIL_CONTENT' => $mails_donnees['message_test'],
    427                     'path_js' => $path_js
     400                                                'Groupe'     => $groups,
     401                                        'message_test' => $mails_donnees['message_test'] ,
     402                                                'liste' => $destinataires ,
     403                                                'version' =>     $version ,
     404                                                'MAIL_CONTENT' => $mails_donnees['message_test'],
     405                                                'path_js' => $path_js,
     406                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
     407                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
    428408                                                )
    429409                                );     
    430410                               
    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');
    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  
     411   $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
     412   $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
     413//=========================================================================             
     414                $toolbar = 'Basic';
     415                $width = '750px';
     416                $height = '200px';
     417                $areas = array();
     418                $areas[]='MAIL_CONTENT';
     419                if (!empty($areas)){
     420                                if (function_exists('set_fckeditor_instance'))
     421                                set_fckeditor_instance($areas, $toolbar, $width, $height);
     422                        }
     423                       
    446424   break;
    447425// *************************************************************************
     
    453431 //------------------------------------------------------------------------------------
    454432        $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] ;             
     433        $mails_options[no_connect] = 'off' ;//isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;
     434            $mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;             
    457435//=======================================================================================       
    458436    $info_ip = (isset($info_ip)) ? $info_ip : '' ;
     
    485463                {
    486464                                $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" ;
     465                        $mails_options[no_connect] ='off' ;// isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
     466                        $mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
    489467                                $mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ;
    490468                                sauve_options();
     
    518496     $template->assign(
    519497                                        array(
    520                                         'start' => $params['start'],
    521                                         'per_page' => $params['per_page'] ,
    522                                 'maxipage'  =>  $maxipage ,
    523                                             'smile_bonjour' => $smile_bonjour ,
    524                                                 'img_logo' => $img_logo ,
    525                                 'champs_ip' => $champs_ip ,                                     
    526                                                 'liste_ip' => $liste_ip,
    527                                                 'champs_bl' =>  $champs_bl       ,     
    528                                                 'liste_bl' => $liste_bl ,
    529                                 //'conf_admin_layout' => $conf['admin_layout'] ,
    530                                                 'istype' => $istype ,
    531                                                 'ip_black' => $ip_black ,
    532                                                 'IS_SPAM' => test_spam(  $ip_black),
    533                                                 'ip_black_len' =>  strlen($ip_black)  ,
    534                                                 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
    535                             'path_js' => $path_js ,
    536                                                 'F_ACTION' => $f_action ,
     498                        'start' => $params['start'],
     499                        'per_page' => $params['per_page'] ,
     500                        'maxipage'  =>  $maxipage ,
     501                        'smile_bonjour' => $smile_bonjour ,
     502                        'img_logo' => $img_logo ,
     503                        'champs_ip' => $champs_ip ,                                     
     504                        'liste_ip' => $liste_ip,
     505                        'champs_bl' =>  $champs_bl       ,     
     506                        'liste_bl' => $liste_bl ,
     507                        //'conf_admin_layout' => $conf['admin_layout'] ,
     508                        'istype' => $istype ,
     509                        'ip_black' => $ip_black ,
     510                        'IS_SPAM' => test_spam(  $ip_black),
     511                        'ip_black_len' =>  strlen($ip_black)  ,
     512                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
     513                        'path_js' => $path_js ,
     514                        'F_ACTION' => $f_action ,
    537515                                               
    538                                                 'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' ,
     516                        'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' ,
    539517                        '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"' : '' ,
    542                                                 'IP' =>  $ip ,                                         
    543                                                 'PAYS' =>  $pays  ,
    544                                 'VILLE' =>  $ville ,
    545                                 'REGION' =>  $region , 
    546                                                  'version' =>    $version ,
     518                        'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' ,
     519                        'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' ,
     520                        'IP' =>  $ip ,                                         
     521                        'PAYS' =>  $pays  ,
     522                        'VILLE' =>  $ville ,
     523                        'REGION' =>  $region , 
     524                        'version' =>     $version ,
     525                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
    547526                                        )
    548527                                );                       
     
    567546                                         'version' =>    $version ,
    568547                                         'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
    569                          'path_js' => $path_js
     548                         'path_js' => $path_js,
     549                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
    570550                                        )
    571551                        );             
  • extensions/Mail_supervisor/admin/mail_superv_admin.tpl

    r5670 r8917  
    1 {known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
    2 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
     1{html_head} {if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
     2{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
    33
    44<script type="text/javascript">
  • extensions/Mail_supervisor/admin/mail_superv_help.tpl

    r7050 r8917  
    1 {known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
    2 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
    3 
    4 {known_script id="my_script" src= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js"}
     1{html_head} {if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
     2{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
    53<div class="instructions" >
    64<h2>{'Sv_Tab_help'|translate}{'Sv_version'|translate}{$version}</h2>
  • extensions/Mail_supervisor/admin/mail_superv_test.tpl

    r6874 r8917  
    1 {known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
    2 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
    3 
     1{html_head} {if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
     2{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
    43<div class="titrePage">
    54        <h2>{'Sv_supervisor'|translate}{'Sv_version'|translate}{$version}</h2>
     
    2120        </select>
    2221      </td>
    23                  <td>
    24          {$liste}
    25          </td>
     22                  <td  >
     23                        {$liste}
     24             </td>
    2625    </tr>
    2726
     
    3635        </fieldset>
    3736      <p>
    38           <input class="submit" type="submit" name="raffraichir" value="{'Sv_refresh'|translate}" />
    39           <input class="submit" type="submit" name="test_envoie" value="{'Sv_Test'|translate}" />
    40         <input class="submit" type="submit" value="{'Submit'|@translate}" name="submitEmail" {$tag_input_enabled}/>
     37          <input class="submit" type="submit" name="Submit" value="{'Sv_refresh'|@translate}" {$tag_input_enabled} />
     38          <input class="submit" type="submit" name="Submit" id="Envoyer"  value="{'Sv_Envoyer'|@translate}" {$tag_input_enabled} />
     39       
    4140          </p>
    4241</fieldset>
  • extensions/Mail_supervisor/include/Scripts.js

    r5671 r8917  
    1 function blockToggleDisplay(headerId, contentId)
    2 {
     1function blockToggleDisplay(headerId, contentId){
    32        var revHeader = document.getElementById(headerId);
    43        var revContent = document.getElementById(contentId);
  • extensions/Mail_supervisor/include/fonctions.php

    r7050 r8917  
    2929if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    3030
    31     define ("check_mailto", 0); define ("check_header_carbon",1); define ("check_header_text",2);
    32     define ("no_mail_list", 3); define ("no_connect",4); define ("set_auto",5);
    33     define ("ip",6); define ("set_id",7);
     31    define ("check_mailto", 0);
     32        define ("check_header_carbon",1);
     33        define ("check_header_text",2);
     34    define ("no_mail_list", 3);
     35        define ("no_connect",4);        // empeche l'ip de se connecter au site.
     36        define ("set_auto",5);          // Test a l'ouverture et enregistrement
     37    define ("ip",6);                    // dernirre adresse IP
     38        define ("set_id",7);            // enregistrment nouvel
    3439 
    3540 
     
    288293//===============================================
    289294
    290 function corrige_header($Carbonne,$headers,$args)
     295function corrige_header($Carbonne,$headers,$args,$cl_list_mail)
    291296        {
    292297        global $mails_options,$conf_mail,$mailto,$infos_message;
     
    294299 if (!empty($args[$Carbonne]))
    295300         {
    296  
    297                 if ( count($args[$Carbonne]) > 0 )
     301                if ( count($args[$Carbonne]) > 0 )
    298302                {
    299                  if ($mails_options[check_header_carbon] == 'on') {
    300                         $list_mail  = str_replace(","," ,",get_strict_email_list(implode(',', $args[$Carbonne])))." \n" ;
    301                         $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$list_mail, $headers);
    302                  }
     303                        if ($mails_options[check_header_carbon] == 'on') {
     304                                        $cl_list_mail  =  str_replace(","," , ",get_strict_email_list(implode(',', $args[$Carbonne])))." \n" ;
     305                                        $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$cl_list_mail, $headers);
     306                                }
    303307                }
     308       
    304309        } else {
    305         // Raz Bcc, Cc dans headers
     310             // Raz Bcc, Cc dans headers
    306311                        $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', "" , $headers);
    307312        }
    308313               
    309                
    310 return $headers;
     314                $headers  = str_replace("\n.", "\n..",$headers );
     315        $ret->headers = $headers ;
     316        $ret->list_mail = $cl_list_mail ;
     317        return $ret;
    311318
    312319               
     
    433440                u.'.$conf['user_fields']['email'].' AS email,
    434441                ui.status,
    435                 ui.adviser,
    436442                ui.enabled_high,
    437443                ui.level
     
    765771//=======================================================================       
    766772
    767 if ($mails_options[set_auto] == 'on')
     773if ($mails_options[set_auto] == 'nonoui') // ne plus tester automatiquement .
    768774{
    769775 // $ip="94.102.63.13"; ' Spammeurs
     
    887893function test_spam($ip =0,$user_name ='', $mail_adresse = "")
    888894{
    889 $buffer="";
     895        $buffer="";
     896        global $page,$infos_message;
    890897
    891898// fretgpsolodens
    892 $src = "" ;// "http://www.stopforumspam.com/api?";
    893 $type=array();
    894 $result="";
     899        $src = "http://www.stopforumspam.com/api?";
     900        $type=array();
     901        $result="";
    895902if (strlen($ip)>3) {
    896903//==================  Verifie si l'IP est correct  ================================
    897904if (clj_is_ip($ip)){     
    898       
     905     
    899906} else { 
    900907//==================  Verifie si l'adresse mail est correcte  ================================
    901908      if( clj_is_mail($ip) ){ 
    902               $mail_adresse=$ip ;
     909                          $mail_adresse=$ip ;
    903910              $ip="";
    904911         }
     
    921928if ( strlen($mail_adresse) > 3)   $type[]="email=".$mail_adresse ;
    922929if ( strlen($ip) > 3)   $type[]="ip=".$ip ;
    923  
     930
    924931         foreach  ( $type as $fil )
    925932     {   
    926            $resultat="";
     933          $resultat="";
    927934           if (  clj_fetchRemote($src.$fil , $resultat,1))
    928935                  {
    929                   $result .= $resultat.'<br />'  ;
     936                    $result .= $resultat.'<br />'  ;
    930937                  }  else {
    931938                 
    932939                  }
     940                 
    933941      }
    934942
     
    960968function clj_is_mail($mail)
    961969{     
     970
     971 if(preg_match('/^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$/' ,$mail)) return true ;     
    962972  if(preg_match('/#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#/' ,$mail)) return true ;   
    963973}         
     
    967977{
    968978  // Try to retrieve data from local file?
     979 // http://www.stopforumspam.com/api?ip=95.211.1.39
     980
     981  if ($src=="") return ;
     982 
    969983  if (!url_is_remote($src))
    970984  {
     985 
    971986    $content = @file_get_contents($src);
    972987    if ($content !== false)
     
    980995    }
    981996  }
    982 
     997 
    983998  // After 3 redirections, return false
    984999  if ($step > 3) return false;
     
    10721087
    10731088  }
     1089
     1090
     1091
    10741092?>
  • extensions/Mail_supervisor/include/function_test_send.php

    r7050 r8917  
    226226}
    227227
     228
    228229?>
  • extensions/Mail_supervisor/language/fr_FR/plugin.lang.php

    r7050 r8917  
    11<?php
    22global $lang ;
    3 
    43//===================================================
    54if( !isset($lang['Minute'])) $lang['Minute'] =   l10n('Minute') ;
    65if( !isset($lang['Second'])) $lang['Second'] =   l10n('Seconde');
    7 
    86//=======================================================
    97$lang['Sv_Datas'] =  'Datas' ;
     
    2018$lang['Sv_Test'] = 'Test';
    2119
     20$lang['Sv_Envoyer'] = 'Envoyer';
    2221$lang['Sv_Valider'] = 'Valider';
    2322$lang['Sv_version'] = ' Version  :';
     
    5150$lang['Sv_message_to_send'] = 'Message a envoyer.';
    5251$lang['Sv_verifiez_les_destinataires']='Vérifiez les destinataires:';
    53 $lang['Sv_detection_de']='Détection de :';
    54 $lang['Sv_Tab_set'] ='Initialisation';
    55 $lang['Sv_Tab_test'] ='Test';
    56 $lang['Sv_Tab_help'] ='Aide';
     52$lang['Sv_detection_de'] = 'Détection de :' ;
     53$lang['Sv_Tab_set'] = 'Initialisation';
     54$lang['Sv_Tab_test'] = 'Test';
     55$lang['Sv_Tab_help'] = 'Aide';
    5756
    5857$lang['Sv_Howto'] = 'Gestion des parametres de surveillance d\' envoie des mails.';
     
    105104                                                        ' Le        %s <br />' ;
    106105                                       
    107 $lang['Sv_debug_message %s %s %s %s %s']=       '<br />---- La fonction mail à retourné [%s]  ------
    108                             -------- MESSAGE erreur : -------------
    109                            [ %s ]
    110                                         mailto:   "%s"
    111                     -------- HEADERS -----------------
    112                                         %s
    113                                         -------- Nombre de destinataires ----
    114                                         %s
    115                                         ';
    116 $lang['Sv_message_texte %s %s %s %s'] ='
     106$lang['Sv_debug_message']=      '
     107La fonction mail à retourné [%s] <br />
     108MESSAGE erreur : [ %s ] <br />
     109mailto:   [ %s ]  <br />
     110HEADERS:   [ %s ]  <br />
     111Nombre de destinataires [ %s ]<br />
     112';
     113
     114$lang['Sv_message_texte "%s" "%s" "%s" "%s"'] ='
    117115 %s
    118116         '. l10n('hello') .'  "%s"  ,
  • extensions/Mail_supervisor/main.inc.php

    r7050 r8917  
    22/*
    33Plugin Name: Mail supervisor
    4 Version: 1.4.2
     4Version: 1.4.4 Beta
    55Description: Mail supervisor surveille l'envoie des mails.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
     
    1616
    1717 global $conf ;
    18 
    19  
    2018add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 1 , 6);
    2119function clj_mail($result, $mailto, $subject, $content, $headers, $args)
     
    2321    global $conf, $user, $lang_info,  $conf_mail,$mails_options,$mails_donnees , $template,$page ,$erreur_message,$infos_message, $lang;
    2422        // lecture config table -------------
    25         include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
     23         include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
    2624     load_language('plugin.lang', MAIL_SUPERV_PATH);
     25         
     26         if (isset($_POST["Submit"]) )
     27         {
     28         if ($_POST["Submit"] != l10n('Sv_Envoyer') ) return true ;
     29         }
     30        $message ="";
     31        if (!isset($infos_message))
     32        {
     33        $infos_message = "";
     34        }
     35if (!isset($erreur_message))
     36        {
     37        $erreur_message = '';
     38        }       
    2739         $mails_options = explode("," , $conf['mail_superv']);
    2840//======== verification si envoie de mail ou blocage connexion =====================
     
    5163        }
    5264       
    53         $message ="";
    54         if (!isset($infos_message))
    55         {
    56         $infos_message = "";
    57         }
    58 if (!isset($erreur_message))
    59         {
    60         $erreur_message = '';
    61         }
     65
    6266        // lecture donnees       -------------
    6367    $mails_donnees = Get_Datas();
     
    96100 if ($mailto<>"" )            $nb_destinataires +=1;
    97101
    98                 if (!empty($args['Bcc']))  { 
    99                         $nb_destinataires += count($args['Bcc']);
    100                         }
    101                 if (!empty($args['Cc']))  {   
    102                         $nb_destinataires += count($args['Cc']);
    103                         }
    104    //================= reecriture de l'entête ===============================
    105 if ( $nb_destinataires  == 1 )
    106         {
    107                 if ($mailto == "" )
     102                if (!empty($args['Bcc'])) { $nb_destinataires += count($args['Bcc']);   }
     103                if (!empty($args['Cc']))  {     $nb_destinataires += count($args['Cc']);        }
     104
     105   
     106        $infos_message .= "<hr> Theme :" . ($args['theme'] ) ."<br />";
     107    $infos_message .="nombre de destinataire:".$nb_destinataires." <br />" ;
     108
     109   //================= reecriture de l'entete ===============================
     110    $match=array("<",">");
     111    $string=array("&lt;","&gt;") ;     
     112       
     113if ( $nb_destinataires  == 1 && $mailto != "" )
     114        {   
     115    $infos_message .="--> Mailto: " . $mailto." \n" ;
     116   
     117                if ($mailto != "" )
    108118                  {
    109                           if (!empty($args['Cc']) and count($args['Cc']) > 0 )  $mailto  = get_strict_email_list(implode(',', $args['Cc'])) ;
    110                           if (!empty($args['Bcc']) and count($args['Bcc']) > 0 ) $mailto  = get_strict_email_list(implode(',', $args['Bcc'])) ;
    111                          
    112                                 $headers = preg_replace('/.*Bcc(.*).\n/i', '', $headers);
    113                                 $headers = preg_replace('/.*Cc(.*).\n/i', '', $headers);
    114                                
     119
     120                 $mailto  = $mailto ." \n"  ;
     121                $headers =  preg_replace('/.*Bcc(.*).\n/i', '', $headers);
     122                                $headers =  preg_replace('/.*Cc(.*).\n/i', '', $headers);
     123               
     124                       
    115125                  }
     126     //=============================================================================
     127             
     128           
     129                if (!empty($args['Bcc']) ) $infos_message .="Bcc: " . memo_var($args['Bcc']) ." \n";
     130                if (!empty($args['Cc']) ) $infos_message .="Cc: " . memo_var($args['Cc'])." \n" ;
     131                $infos_message .="Mailto: [" . $mailto . "]"." \n".$headers;             
     132         
    116133        }else{
    117    
    118  
    119      }
    120 
    121 //=============================================================================         
    122 if (!empty($args['Cc']))
    123                         {
    124                          $headers= corrige_header('Cc',$headers,$args);
    125                         }
    126                 if (!empty($args['Bcc']))
    127                         {   
    128                                    $headers     = corrige_header('Bcc',$headers,$args);
    129                         }
    130 //=============================================================================                 
     134//=== plusieurs destinataires ===========
     135$cl_list_mail="";
     136
     137  if ($mailto !="") $infos_message .="To: " . $mailto . " "." /n" ;     
     138        if (!empty($args['Cc'])) {
     139        $ret= corrige_header('Cc',$headers,$args,$cl_list_mail);
     140          $headers = $ret->headers;
     141          $infos_message .="Cc: " .  ( $ret->list_mail)."  <br />" ;
     142        }
     143        if (!empty($args['Bcc'])){
     144           $ret = corrige_header('Bcc',$headers,$args,$cl_list_mail);
     145         
     146           $headers = $ret->headers ;
     147           $infos_message .="Bcc: " . ( $ret->list_mail) ."  <br />";
     148        }
     149     
     150        $infos_message .=  " " ;
     151}
     152// $infos_message .= $content ;
     153//=============================================================================
    131154if ($mails_options[check_header_text]=='on')   {
    132155
     
    145168 
    146169$ret=false;
    147        
     170
    148171            //======== Non mise en quarantaine =============
    149172                ob_start();
    150173                $ret = false;
    151174                 if ($nb_destinataires > 0) {
    152                    $ret = mail($mailto, $subject, $content, $headers);
    153 
     175                 // corrige erreur 'mail dropped, bare LF found'
     176                 $content = str_replace("\n.", "\n..", $content);
     177                 $headers = str_replace("\n.", "\n..", $headers);
     178                 $subject = str_replace("\n.", "\n..", $subject);
     179                 $mailto = str_replace("\n.", "\n..", $mailto);
     180             $ret = mail($mailto, $subject, $content, $headers);
     181       
    154182                        }else{
    155183                           $message .= l10n('Sv_no_receiver_available');
     
    204232
    205233                }
    206  $infos_message = l10n('Sv_mail_not_send');
     234 $infos_message .= l10n('Sv_mail_not_send');
    207235 
    208236 }                     
     
    219247    $match=array("<",">");
    220248    $string=array("&lt;","&gt;") ;       
    221 
    222249//Warning: mail() has been disabled for security reasons
    223250       
     
    229256                $pos1 = strpos(strtolower($message), 'bad recipient address syntax');
    230257                if (  !($pos1 === false) ){
    231                         $erreur_message .= l10n('Sv_detection_de').' : Bad recipient address syntax .';
     258                        $erreur_message .= l10n('Sv_detection_de').' Bad recipient address syntax .';
    232259                        $erreur_message .= l10n('Sv_verifiez_les_destinataires').' (Bcc,Cc,To)<br />';
    233260                        }       
    234261       
    235         $erreur_message .= sprintf(l10n('Sv_debug_message %s %s %s %s %s'),($ret==true)? "true" : "false",$message,$mailto,$headers,$nb_destinataires);
    236        //=============== La fonction mail à retourneeune erreur =========================               
     262        $erreur_message .= sprintf(l10n('Sv_debug_message'),
     263        ($ret==true)? "true" : "false",
     264        $message ,
     265        $mailto ,
     266        $headers ,
     267        $nb_destinataires );
     268       //=============== La fonction mail   retourneeune erreur =========================               
    237269
    238270                               
     
    260292
    261293                        }
    262  
    263  
    264 
    265  
    266294 $ret=true;
    267295 return $ret ;
     
    289317    include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
    290318        $mails_options = explode("," , $conf['mail_superv']);
    291          
     319
    292320//==========================================================================================
    293321if ($mails_options[set_id]=='on'  ) {
     
    301329//Liableelard
    302330include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
     331
    303332if ( isset($_POST['submit'])) {
    304333        $mail  =  $_POST['mail_address'] ;
     
    308337        $user_name = $user['username'];
    309338}
    310 $user_name =""; // suppression du test sur user name.
     339 $user_name =""; // suppression du test sur user name.
    311340 $ip='0';
     341 
    312342                if (test_spam($ip,$user_name ,$mail ))
    313343                 {
    314                  if (test_spam($ip,$user_name ,"" )) {
    315                   $err[] = $user_name . " ". l10n('Sv_is_a_login_spam')   ;
    316                 }else           
     344                 //if (test_spam($ip,$user_name ,"" )) {
     345                 // $err[] = $user_name . " ". l10n('Sv_is_a_login_spam')   ;
     346                // }else                 
    317347                    $err[] = $user_name . " : " .$mail . " ". l10n('Sv_is_a_spam')   ;
    318348                 }
     
    320350return $err ;
    321351}
     352
     353
    322354?>
Note: See TracChangeset for help on using the changeset viewer.