Changeset 3987 for extensions/free_mail/main.inc.php
- Timestamp:
- Oct 7, 2009, 5:57:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/free_mail/main.inc.php
r3981 r3987 2 2 /* 3 3 Plugin Name: Free Mail 4 Version: 1.0. 64 Version: 1.0.7 5 5 Description: Plugin modifie l entete des mails en cas de SPAM 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=309 … … 14 14 include_once (Free_Mail_PATH.'include/constants.php'); 15 15 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 56 17 57 18 add_event_handler('send_mail', 'clj_send_mail',1 , 6); … … 61 22 global $conf, $user, $lang_info, $conf_mail; 62 23 24 $conf_free = explode("," , $conf['free_mail']); 25 26 if ( isset($conf['free_mail_173']) ) $conf_free = explode("," , $conf['free_mail_173']) ; 27 28 63 29 $infos=Get_données(); 64 30 65 $nb env = $infos->nbenv;31 $nb_mails = $infos->nb_mails ; 66 32 $next_day = $infos->next_day ; 67 33 $reste = $infos->reste ; … … 69 35 $admins = $infos->admins ; 70 36 71 $ret=" Attente de déblocage SPAMS" ;37 $ret=" false" ; 72 38 73 39 … … 76 42 if (!isset( $mailto)){ echo 'erreur maito absent'; exit(); } 77 43 if (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 // 93 46 //$mailto=""; 47 if ($conf_free[0]=='on') 48 { 49 $mailto=$conf_mail['email_webmaster']; 50 } 51 if ($conf_free[1]=='on') 52 { 94 53 if (!empty($args['Cc'])) 95 54 { … … 100 59 $headers = corrige_headers('Bcc',$headers); 101 60 } 102 103 /* 104 echo '<pre> 105 ------------------------------------------------------------------- 106 headers 107 '; 108 print_r($headers) ; 109 echo '</pre>' ; 110 */ 61 } 62 111 63 } 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 114 79 $ret=false; 115 80 if ( $reste <=0 ) { … … 122 87 ob_end_clean(); 123 88 //Trop de spam 124 $pos = strpos( $message, 'spam');89 $pos = strpos(strtolower($message), 'spam'); 125 90 $query = ' 126 91 UPDATE '.FREE_MAIL_TABLE.' … … 130 95 131 96 if ($pos === false) { 132 if ($nb env==0) {133 $date env=time();97 if ($nb_mails==0) { 98 $date_mail=time(); 134 99 $query = ' 135 100 UPDATE '.FREE_MAIL_TABLE.' 136 SET date env="'. $dateenv.'"101 SET date_mail="'. $date_mail.'" 137 102 ;'; 138 103 pwg_query($query); … … 141 106 $query = ' 142 107 UPDATE '.FREE_MAIL_TABLE.' 143 SET date_ check="'. $next_day .'"108 SET date_quarantaine="'. $next_day .'" 144 109 ;'; 145 110 pwg_query($query); 146 111 147 $nb env+= 1;112 $nb_mails += 1; 148 113 $query = ' 149 114 UPDATE '.FREE_MAIL_TABLE.' 150 SET nb env="'. $nbenv.'"115 SET nb_mails="'. $nb_mails.'" 151 116 ;'; 152 117 pwg_query($query); … … 162 127 ---- La fonction mail à retournée [false] ------ 163 128 '; 164 165 166 129 echo 'mailto: '.$mailto.' 167 130 '; 131 echo '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 '; 133 echo 'conf_free[1]='.$conf_free[1].' Modifie le format des headers (Bcc,Cc) ; essayer de passer la variable à "on" si "off" 134 '; 135 echo 'conf_free[2]='.$conf_free[2].' Envoie une partie texte dans le header(spam) ; essayer de passer la variable à "on" si "off" 136 '; 137 echo "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 "; 168 142 echo ' 169 143 -------- MESSAGE ----------------- … … 194 168 $query = ' 195 169 UPDATE '.FREE_MAIL_TABLE.' 196 SET date_ check="'. $next_day.'"170 SET date_quarantaine="'. $next_day.'" 197 171 ;'; 198 172 pwg_query($query); … … 279 253 $table=$nb[FREE_MAIL_TABLE]; 280 254 //================================================================================ 281 if (!in_array( "nb env",$table)) {282 $query = "ALTER TABLE `".FREE_MAIL_TABLE."` ADD `nb env` 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' "; 283 257 pwg_query($query); } 284 if (!in_array( "date env",$table)) {285 $query = "ALTER TABLE `".FREE_MAIL_TABLE."` ADD `date env` 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' "; 286 260 pwg_query($query); } 287 261 if (!in_array( "quarantaine",$table)) { … … 300 274 { 301 275 $next_day = time() ; 302 $date_ check='';276 $date_quarantaine=''; 303 277 $q = ' 304 INSERT INTO '.FREE_MAIL_TABLE.' (id,nb env, date_check,dateenv, quarantaine,message)278 INSERT INTO '.FREE_MAIL_TABLE.' (id,nb_mails, date_quarantaine,date_mail, quarantaine,message) 305 279 VALUES (1,0,"'. $next_day.'","'. $next_day.'" ,false,".") 306 280 ;'; … … 316 290 // limite 2000 par semaine. 317 291 318 $infos->nb env = $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 ; 322 296 323 297 $infos->quarantaine = $data['quarantaine'];
Note: See TracChangeset
for help on using the changeset viewer.