Changeset 3987 for extensions/free_mail


Ignore:
Timestamp:
Oct 7, 2009, 5:57:23 PM (15 years ago)
Author:
cljosse
Message:

Create Release for 1.7.3 and 2.04

Location:
extensions/free_mail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/free_mail/main.inc.php

    r3981 r3987  
    22/*
    33Plugin Name: Free Mail
    4 Version: 1.0.6
     4Version: 1.0.7
    55Description: Plugin modifie l entete des mails en cas de SPAM
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=309
     
    1414include_once (Free_Mail_PATH.'include/constants.php');
    1515
    16 /*
    17  add_event_handler('send_mail_headers','clj_send_mail_headers' ) ;
    18 function clj_send_mail_headers($headers)
    19 {
    20 echo '<pre>';
    21 print_r($headers) ;
    22 echo '</pre>' ;
    23 }
    24 
    25 add_event_handler('send_mail_to', 'clj_send_mail_to');
    26 function clj_send_mail_to($mailto)
    27 {
    28 echo '<pre>';
    29 //print_r($mailto) ;
    30 echo '</pre>' ;
    31 }
    32 
    33 add_event_handler('send_mail_content', 'clj_send_mail_content');
    34 function clj_send_mail_content($content)
    35 {
    36 echo '<pre>';
    37 //print_r($content) ;
    38 echo '</pre>' ;
    39 }
    40 
    41 */
    42 //  trigger_event('send_mail_to', get_strict_email_list($to)),
    43 // add_event_handler('send_mail_to', 'clj_send_mail_to');
    44 /*function clj_send_mail_to($mailto)
    45 {
    46 
    47 $to=get_strict_email_list($mailto);
    48 echo '<pre>';
    49  print_r($mailto) ;
    50  print_r( $to);
    51 echo '</pre>' ;
    52 
    53  
    54 }
    55 EVENT_HANDLER_PRIORITY_NEUTRAL  */
     16
    5617 
    5718add_event_handler('send_mail', 'clj_send_mail',1 , 6);
     
    6122    global $conf, $user, $lang_info,  $conf_mail;
    6223       
     24        $conf_free = explode("," , $conf['free_mail']);
     25       
     26        if ( isset($conf['free_mail_173']) )  $conf_free = explode("," , $conf['free_mail_173'])  ;
     27
     28       
    6329        $infos=Get_données();
    6430       
    65 $nbenv    =     $infos->nbenv ;
     31$nb_mails         =     $infos->nb_mails ;
    6632$next_day  =  $infos->next_day ;
    6733$reste =    $infos->reste ;
     
    6935$admins = $infos->admins   ;   
    7036         
    71 $ret="Attente de déblocage SPAMS " ;
     37$ret=" false" ;
    7238 
    7339 
     
    7642if (!isset( $mailto)){ echo 'erreur maito absent'; exit(); }
    7743if (empty( $mailto))  { 
    78  /*
    79 echo '<pre>
    80 -------------------------------------------------------------------
    81 CONF_MAIL
    82 ';
    83  print_r($conf_mail) ;
    84  echo '<pre>
    85 -------------------------------------------------------------------
    86 ARGS
    87 ';
    88  print_r($args) ;
    89 echo '</pre>' ;
    90 */
    91  
    92 //$mailto=$conf_mail['email_webmaster'];
     44 
     45//
    9346 //$mailto="";
     47 if ($conf_free[0]=='on')
     48 {
     49   $mailto=$conf_mail['email_webmaster'];
     50 }
     51  if ($conf_free[1]=='on')
     52 {
    9453                if (!empty($args['Cc']))
    9554                {
     
    10059                $headers        = corrige_headers('Bcc',$headers);
    10160                }
    102 
    103  /*
    104    echo '<pre>
    105 -------------------------------------------------------------------
    106 headers
    107 ';
    108  print_r($headers) ;
    109 echo '</pre>' ;
    110   */
     61}
     62
    11163 }
    112  
    113  
     64 if ($conf_free[2]=='on')
     65 {
     66        $texte = "This is a multi-part message in MIME format.\n";
     67       
     68        $texte .= "-----=".$conf_mail['boundary_key']."\n";
     69        $texte .= "Ceci est un message est au format MIME.\n";
     70        $texte .= 'Content-Type: text/plain; charset="UTF-8"'."\n";
     71        $texte .= 'Content-Transfer-Encoding: 8bit'."\n\n"; 
     72        $texte .= $args['content']; // A voir texte brut...
     73           
     74                $texte .= "\n\n";
     75       
     76                $content =$texte .$content ;
     77}
     78               
    11479                $ret=false;
    11580 if (  $reste <=0 ) {
     
    12287   ob_end_clean();
    12388//Trop de spam
    124 $pos = strpos($message, 'spam');
     89$pos = strpos(strtolower($message), 'spam');
    12590        $query = '
    12691        UPDATE '.FREE_MAIL_TABLE.'
     
    13095         
    13196if ($pos === false) {
    132      if ($nbenv==0) {
    133          $dateenv=time();
     97     if ($nb_mails==0) {
     98         $date_mail=time();
    13499                $query = '
    135100        UPDATE '.FREE_MAIL_TABLE.'
    136         SET dateenv="'. $dateenv.'"
     101        SET date_mail="'. $date_mail.'"
    137102      ;';
    138103      pwg_query($query);
     
    141106                $query = '
    142107        UPDATE '.FREE_MAIL_TABLE.'
    143         SET date_check="'.  $next_day .'"
     108        SET date_quarantaine="'.  $next_day .'"
    144109      ;';
    145110      pwg_query($query);
    146111         
    147            $nbenv += 1;
     112           $nb_mails += 1;
    148113       $query = '
    149114        UPDATE '.FREE_MAIL_TABLE.'
    150         SET nbenv="'. $nbenv.'"
     115        SET nb_mails="'. $nb_mails.'"
    151116      ;';
    152117      pwg_query($query);
     
    162127                ---- La fonction mail à retournée [false]  ------
    163128                ';
    164  
    165 
    166129echo            'mailto:   '.$mailto.'
    167130';
     131echo 'conf_free[0]='.$conf_free[0].' Envoie du mail vers le webmaster par le header(To)   ; essayer de passer la variable à "on" si "off"
     132';
     133echo 'conf_free[1]='.$conf_free[1].' Modifie le format des headers (Bcc,Cc)               ; essayer de passer la variable à "on" si "off"
     134';
     135echo 'conf_free[2]='.$conf_free[2].' Envoie une partie texte dans le header(spam)         ; essayer de passer la variable à "on" si "off"
     136';
     137echo "pour modifier la variable 'conf_free' modifier le fichier  include/config_local.inc.php.
     138 En ajoutant la variable:
     139 conf['free_mail_173'] = off,on,on ;
     140 
     141";
    168142                echo '
    169143                -------- MESSAGE -----------------
     
    194168       $query = '
    195169        UPDATE '.FREE_MAIL_TABLE.'
    196         SET date_check="'. $next_day.'"
     170        SET date_quarantaine="'. $next_day.'"
    197171      ;';
    198172      pwg_query($query);
     
    279253        $table=$nb[FREE_MAIL_TABLE];     
    280254//================================================================================     
    281     if (!in_array( "nbenv",$table)) {   
    282                 $query = "ALTER TABLE `".FREE_MAIL_TABLE."` ADD `nbenv` smallint(5) NOT NULL default '0' ";
     255    if (!in_array( "nb_mails",$table)) {       
     256                $query = "ALTER TABLE `".FREE_MAIL_TABLE."` ADD `nb_mails` INT NOT NULL default '0' ";
    283257                           pwg_query($query);            } 
    284         if (!in_array( "dateenv",$table)) {     
    285           $query = "ALTER TABLE `".FREE_MAIL_TABLE."` ADD `dateenv` INT NOT NULL default '0' ";
     258        if (!in_array( "date_mail",$table)) {   
     259          $query = "ALTER TABLE `".FREE_MAIL_TABLE."` ADD `date_mail` INT NOT NULL default '0' ";
    286260                           pwg_query($query);            } 
    287261                if (!in_array( "quarantaine",$table)) {
     
    300274  {
    301275         $next_day = time()  ;
    302          $date_check='';
     276         $date_quarantaine='';
    303277           $q = '
    304     INSERT INTO '.FREE_MAIL_TABLE.' (id,nbenv, date_check,dateenv, quarantaine,message)
     278    INSERT INTO '.FREE_MAIL_TABLE.' (id,nb_mails, date_quarantaine,date_mail, quarantaine,message)
    305279    VALUES (1,0,"'. $next_day.'","'. $next_day.'" ,false,".")
    306280         ;';
     
    316290        // limite 2000 par semaine.
    317291
    318         $infos->nbenv    = $data['nbenv'];
    319     $infos->next_day = $data['date_check'];
    320        
    321     $infos->reste =(float) ( $data['date_check'] - time())/3600 ;
     292        $infos->nb_mails    = $data['nb_mails'];
     293    $infos->next_day = $data['date_quarantaine'];
     294       
     295    $infos->reste =(float) ( $data['date_quarantaine'] - time())/3600 ;
    322296       
    323297        $infos->quarantaine = $data['quarantaine'];
  • extensions/free_mail/maintain.inc.php

    r3943 r3987  
    1010  $q = '
    1111    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
    12     VALUES ("free_mail","true;false;false;-1;-1;-1;false;false;;-1;;;false;;","Parametres du plugin free mail")
     12    VALUES ("free_mail","off,on,off","Parametres du plugin free mail")
    1313  ;';
    1414  pwg_query($q);
     
    2020
    2121`id` SMALLINT( 5 ) NOT NULL DEFAULT '0',
    22 `dateenv` INT NOT NULL DEFAULT '0',
    23 `nbenv` INT NOT NULL DEFAULT '0',
    24 `date_check` INT NOT NULL DEFAULT '0',
     22`date_mail` INT NOT NULL DEFAULT '0',
     23`nb_mails` INT NOT NULL DEFAULT '0',
     24`date_quarantaine` INT NOT NULL DEFAULT '0',
    2525`quarantaine` BOOL NOT NULL ,
    2626`message` TEXT NOT NULL ,
Note: See TracChangeset for help on using the changeset viewer.