Changeset 11807
- Timestamp:
- Jul 21, 2011, 5:57:36 PM (13 years ago)
- Location:
- extensions/Mail_supervisor
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Mail_supervisor/admin/mail_black_liste.tpl
r10419 r11807 23 23 <input name="info1" type="hidden" /> 24 24 <fieldset > 25 <legend>{'Sv_ black_liste'|translate}</legend>25 <legend>{'Sv_set_black_liste'|translate}</legend> 26 26 <table> 27 27 <td><input name="ip_black" id = "ip_black_test" type="text" value="{$ip_black}" /> -
extensions/Mail_supervisor/admin/mail_superv_admin.php
r10822 r11807 118 118 119 119 120 120 121 $aff_nb=true; 121 122 // ************************************************************************* … … 155 156 156 157 157 if ($mails_donnees['quarantaine'] == false)158 {$mails_donnees['reste'] = 0;158 if ($mails_donnees['quarantaine'] == false) { 159 $mails_donnees['reste'] = 0; 159 160 $mails_donnees['date_quarantaine']=time(); 160 161 } 161 162 $infos_message .= l10n('Sv_refresh') .'<br />'; 163 echo "156 super_admin.php "; 162 164 mail_supervisor::sauve_donnees(); 163 165 $aff_nb = false ; 164 165 166 } 167 168 if ( $_POST['submit'] == l10n('Sv_raz') ) { 166 } 167 168 if ( $_POST['submit'] == l10n('Sv_raz') ) { 169 169 $mails_donnees['date_quarantaine']=time(); 170 170 $mails_donnees['nb_mails'] = 0 ; … … 178 178 } 179 179 180 if ( $_POST['submit'] == l10n('Sv_Valider') ) { 180 181 //=================================================================== 181 if ( $_POST['submit'] == l10n('Sv_Valider') ) {182 182 $mails_options['check_mailto'] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ; 183 183 $mails_options['check_header_carbon'] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ; 184 184 $mails_options['check_header_text'] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ; 185 $mails_options['no_ipaddress'] = isset($_POST['no_ipaddress']) ? $_POST['no_ipaddress'] : 'off' ; 186 185 187 186 188 //donnees … … 194 196 $mails_donnees['message'] = isset($_POST['content']) ? $_POST['content'] : $mails_donnees['message'] ; 195 197 $mails_donnees['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] : $mails_donnees['header_text'] ; 196 //========================================================================= ==============================198 //========================================================================= 197 199 verif_mails_donnees(); 198 200 mail_supervisor::sauve_options(); … … 216 218 'check_header_carbons' => ($mails_options['check_header_carbon'] == 'on') ? 'checked="checked"' : '' , 217 219 'check_header_text' => ($mails_options['check_header_text'] == 'on') ? 'checked="checked"' : '' , 218 220 'no_ipaddress' => ($mails_options['no_ipaddress'] == 'on') ? 'checked="checked"' : '' , 219 221 220 222 'nb_mails' => $mails_donnees['nb_mails'] , … … 249 251 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 250 252 break; 251 //*************************************************************************252 //TEST |253 // ************************************************************************* 253 /************************************************************************* 254 * TEST | 255 *************************************************************************/ 254 256 255 257 case 'mail_superv_test': … … 272 274 // info by email to an access granted group of category informations 273 275 274 275 if (isset($_POST['Submit']) and !empty($_POST['group'])) 276 { 276 if (isset($_POST['Submit']) and !empty($_POST['group'])){ 277 277 278 set_make_full_url(); 278 279 /* TODO: if $category['representative_picture_id']280 is empty find child representative_picture_id */281 282 283 if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);284 else $titre=$conf['gallery_title'];285 286 279 $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']); 287 288 if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message); 280 $titre=empty($_POST['titre'])?$mails_donnees['titre']: stripslashes($_POST['titre']); 281 $sujet=empty($_POST['sujet'])?$mails_donnees['sujet']: stripslashes($_POST['sujet']); 282 283 if (function_exists('get_user_language_desc') ){ 284 $message = get_user_language_desc($message); 285 $sujet = get_user_language_desc($sujet); 286 $titre = get_user_language_desc($titre); 287 } 288 289 $mails_donnees['message_test']= str_replace('"',"'",$message) ; 290 $mails_donnees['titre']= str_replace('"',"'",$titre) ; 291 $mails_donnees['sujet']= str_replace('"',"'",$sujet) ; 292 293 if ( $_POST['Submit']!= l10n('Sv_refresh') ) { 294 mail_supervisor::sauve_donnees(); 295 $modif=false ; 296 } else{ 297 $mails_donnees=mail_supervisor::Get_Datas(); 298 } 299 289 300 290 301 if ( $_POST['Submit']==l10n('Sv_Valider') ) { 291 $mails_donnees['message_test']= str_replace('"',"'",$message) ;292 mail_supervisor::sauve_donnees();293 302 $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ; 294 303 mail_supervisor::sauve_options(); 295 304 $_POST['Submit']=""; 296 305 }else if ( $_POST['Submit']==l10n('Sv_Envoyer') ) { 297 /* 306 /************************************************************* 298 307 * send en email to user's group 299 308 * … … 308 317 * 309 318 * @return boolean (Ok or not) 310 */319 ************************************************************/ 311 320 pwg_mail_group( 312 321 $_POST['group'], 313 322 get_str_email_format(true), 314 get_l10n_args('[%s] %s', array($conf['gallery_title'], 'Test Mail_supervisor') ), //sujet323 get_l10n_args('[%s] %s', array($conf['gallery_title'],$sujet) ), //sujet 315 324 MAIL_SUPERV_PATH_ABS . 'admin/cat_group_info', // template 316 array ( 'titre' => 'Mail_supervisor',325 array ( 'titre' => $titre, 317 326 'CPL_CONTENT' => $message, 318 327 'signature' => $user['username'] … … 350 359 $result = pwg_query($query); 351 360 //---------------------------------------------------------------- 352 while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) 353 {$groups[$row['id']] = $row['name']; }361 while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { 362 $groups[$row['id']] = $row['name']; } 354 363 //--------------------------------------------------------------- 355 364 if ( isset($_POST['Submit'])) $group_id=-1; … … 385 394 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS, 386 395 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 396 'sujet' => $mails_donnees['sujet'], 397 'titre' => $mails_donnees['titre'] 387 398 ) 388 399 ); … … 486 497 'REGION' => $region , 487 498 'version' => $version , 488 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,499 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS 489 500 490 501 ) … … 522 533 //==================================================================== 523 534 } 524 //================================================================================525 526 527 528 535 if ( $mails_donnees['reste'] < 0 ) { 529 536 $mails_donnees['quarantaine'] =false ; … … 548 555 $modif = true ; 549 556 } 557 //====================================================== 550 558 if ( $modif == true ) { 551 559 mail_supervisor::sauve_donnees(); 552 560 $modif = false ; 553 561 } 554 562 //====================================================== 555 563 if ($aff_nb == true) { 556 564 $infos_message .= 'Mails : '.$mails_donnees['nb_mails']. ' \\ ' . $mails_donnees['nb_mails_maxi']; -
extensions/Mail_supervisor/admin/mail_superv_admin.tpl
r10419 r11807 14 14 15 15 <table> 16 <tr><td><input type="checkbox" name="check_mailto" value="on" {$check_mailto} /> {'Sv_check_mailto'|translate}</td><td><input type="checkbox" name="check_header_carbon" value="on" {$check_header_carbons} /> {'Sv_check_header_carbon'|translate}</td> 17 { if $PHPWG_VERSION <= '2.0.4' } 18 <td><input type="checkbox" name="check_header_text" value="on" {$check_header_text} /> 16 <tr> 17 <td><input type="checkbox" name="check_mailto" value="on" {$check_mailto} /> {'Sv_check_mailto'|translate}</td> 18 <td><input type="checkbox" name="check_header_carbon" value="on" {$check_header_carbons} /> {'Sv_check_header_carbon'|translate}</td> 19 <td><input type="checkbox" name="no_ipaddress" value="on" {$no_ipaddress} /> {'Sv_no_ipaddress'|translate}</td> 20 { if $PHPWG_VERSION <= '2.0.4' } 21 <td><input type="checkbox" name="check_header_text" value="off" {$check_header_text} /> 19 22 {'Sv_check_header_text'|translate}</td> 20 23 <td><input type="text" name="header_text" value={$header_text} /></td> -
extensions/Mail_supervisor/admin/mail_superv_test.tpl
r10822 r11807 24 24 <td > 25 25 {if not empty($liste)} 26 27 26 {foreach from=$liste item=group name=group_loop } 28 29 27 {$group.username}<{$group.email}><br /> 30 28 {/foreach} … … 35 33 <table> 36 34 <tr> 37 <td><strong>{'Sv_mail_content'|@translate}</strong></td> 38 <td> 35 <td style="width:30%"> 36 <span>{'subject'|@translate} </span> <input type="text" name="sujet" value="{$sujet}" size="60" ></input> </td> 37 <td style="width:30%"> 38 <span>{'title'|@translate}</span> <input type="text" name="titre" value="{$titre}" size="60"></input> </td> 39 </tr> 40 </table> 41 <table> 42 <tr><td><strong>{'Sv_mail_content'|@translate}</strong></td><td> 39 43 <textarea name="MAIL_CONTENT" id="MAIL_CONTENT" class="description">{$MAIL_CONTENT}</textarea> 40 44 </td> -
extensions/Mail_supervisor/include/Scripts.js
r10816 r11807 2 2 var revHeader = document.getElementById(headerId); 3 3 var revContent = document.getElementById(contentId); 4 4 if (revContent==null ) return; 5 5 if (revContent.style.display == 'none') { 6 6 revContent.style.display = 'block'; -
extensions/Mail_supervisor/include/constants.php
r10419 r11807 22 22 "message_test", 23 23 "header_text", 24 "sujet", 25 "titre" 24 26 ); 25 27 … … 40 42 "TEXT" , 41 43 "TEXT" , 42 44 "TEXT" , 45 "TEXT" 43 46 ); 44 47 -
extensions/Mail_supervisor/include/fonctions.php
r10816 r11807 118 118 '"'.l10n('Sv_supervisor').'"', 119 119 '"'.l10n('hello').'"', 120 '"Test Mail_supervisor"', 121 '"Information"' 120 122 ); 121 123 ajout_ligne(mail_superv_TABLE,$superv_champs, $valeurs,false ) ; 122 124 } 123 //=================================================================================124 125 126 125 //========================================= 127 126 function Get_colonnes_de($table) … … 137 136 return $columns_of; 138 137 } 139 138 //========================================= 140 139 function get_liste($group_id){ 141 140 global $conf ; … … 196 195 197 196 } 198 function ajust_table($nom_table,$champs,$types) //mail_superv_TABLE 199 { 197 //=========================================================== 198 function ajust_table($nom_table,$champs,$types){ //mail_superv_TABLE 200 199 global $infos_message ; 201 200 $colonnes = Get_colonnes_de($nom_table); … … 203 202 $i=0; 204 203 $valeurs=array(); 205 foreach ( $champs as $champ) 206 { 204 foreach ( $champs as $champ) { 207 205 $champ = trim($champ); 208 206 if (!in_array( $champ,$colonnes)) { … … 238 236 $count = 0 ; 239 237 } 240 241 if ($count == 0) 242 { 238 $data=array(); 239 240 $query = " SELECT * FROM `".$nom_table."` ;"; 241 $datas = pwg_query($query); 242 if (!empty($datas)) { 243 while ($row = mysql_fetch_array($datas,MYSQL_ASSOC)){ 244 array_push($data,$row); 245 } 246 } 247 $count= count($data); 248 if ($count == 0) { 243 249 $n_champs=implode(",",$champs); 244 250 $n_valeurs=implode(",",$valeurs); … … 248 254 249 255 if (pwg_query($query)) return ; 250 die($query); 251 252 } 256 die("fonction.php 256".$query); 257 258 } 259 253 260 } 254 261 //===================================================================== … … 487 494 pwg_query($query ); 488 495 } 489 $erreur_message .= $pays . $ip ." <br />User Name :".$user['username']."<br />User Mail :".$user['email'] . ' -----> ' . l10n('Sv_ black_liste') ;496 $erreur_message .= $pays . $ip ." <br />User Name :".$user['username']."<br />User Mail :".$user['email'] . ' -----> ' . l10n('Sv_set_black_liste') ; 490 497 // die($nb." ".$ip." ".$user['username']." ".$user['email']); 491 498 -
extensions/Mail_supervisor/language/en_UK/plugin.lang.php
r10822 r11807 1 1 <?php 2 2 global $lang ; 3 $lang['Sv_no_ipaddress']="rename local ip adresse to localhost"; 4 $lang['subject']="Subject"; 3 5 //=================================================== 4 6 if( !isset($lang['Minute'])) $lang['Minute'] = l10n('Minute') ; … … 39 41 $lang['Sv_IP_adress'] = 'Your IP address'; 40 42 $lang['Sv_liste_ip']="IP list (history)"; 41 $lang['Sv_ black_liste']="IP blacklisting";43 $lang['Sv_set_black_liste']="IP blacklisting"; 42 44 $lang['Sv_blackliste']="Blacklisting"; 43 45 … … 63 65 $lang['Sv_check_mailto'] = 'If the "To" field in the mail heading is empty, send a copy to the Webmaster.'; 64 66 $lang['Sv_check_header_carbon'] = 'Change the Bcc, Cc in the header'; 65 $lang['Sv_check_header_text'] = ' Add a "text" block in the mail header.';67 $lang['Sv_check_header_text'] = 'Format text.'; 66 68 67 69 $lang['Sv_admin'] = 'Exclude administrator from mailings.'; … … 116 118 $lang['Sv_debug_message']= '<div style="border: 1px solid red; color: green;"> 117 119 '.$ms_f1.' :<div style="background-color:white;color: black;"> %s </div> 118 '.$ms_f2.' :<div style="background-color:white; color: black;"> %s </div>120 '.$ms_f2.' :<div style="background-color:white; color: black;"> %s </div> 119 121 '.$ms_f3.' :<div style="background-color:white; color: black;"> %s </div> 120 122 '.$ms_f4.' :<div style="background-color:white; color: black;"> %s </div> -
extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
r10822 r11807 1 1 <?php 2 2 global $lang ; 3 $lang['Sv_no_ipaddress']="renomme Ip local en localhost"; 4 $lang['subject']="Sujet"; 3 5 //=================================================== 4 6 if( !isset($lang['Minute'])) $lang['Minute'] = l10n('Minute') ; … … 42 44 $lang['Sv_IP_adress'] = 'Votre adresse IP'; 43 45 $lang['Sv_liste_ip']="Liste des IP (historique)"; 44 $lang['Sv_ black_liste']="Liste noire des IP";46 $lang['Sv_set_black_liste']="Liste noire des IP"; 45 47 $lang['Sv_blackliste']="Liste noire"; 46 48 … … 66 68 $lang['Sv_check_mailto'] = 'Si le champ "To" dans l\'entête est vide, envoyer une copie vers le WebMaster.'; 67 69 $lang['Sv_check_header_carbon'] = 'Modifier le code Bcc , Ccc dans le header'; 68 $lang['Sv_check_header_text'] = ' Ajouter un bloc "texte" dans l\'entête du mail.';70 $lang['Sv_check_header_text'] = 'Envoie en format texte.'; 69 71 70 72 $lang['Sv_admin'] = 'Exclure l\'administrateur des envoies.'; … … 118 120 $lang['Sv_debug_message']= '<div style="border: 1px solid red; color: green;"> 119 121 '.$ms_f1.' :<div style="background-color:white;color: black;"> %s </div> 120 '.$ms_f2.' :<div style="background-color:white; color: black;"> %s </div>122 '.$ms_f2.' :<div style="background-color:white; color: black;"> %s </div> 121 123 '.$ms_f3.' :<div style="background-color:white; color: black;"> %s </div> 122 124 '.$ms_f4.' :<div style="background-color:white; color: black;"> %s </div> -
extensions/Mail_supervisor/mail_super.inc.php
r10822 r11807 39 39 */ 40 40 static public function init() { 41 global $template,$version,$icon_path ;41 global $template,$version,$icon_path,$page; 42 42 $action_spam = pwg_get_session_var('action_spam') ; 43 43 $theme="default"; … … 230 230 } 231 231 //========================================================== 232 function Get_Options( $parametres,$str_index){233 global $conf ,$mails_options;232 function Get_Options(&$parametres,$str_index){ 233 global $conf ; 234 234 $mails_options= $conf[$str_index]; 235 235 if(isset($mails_options)) … … 238 238 else{ 239 239 $parametres=explode(",",$mails_options); 240 240 } 241 //====== par defaut ======================= 242 $new_val=false; 241 243 $def_para->check_mailto="on"; 242 244 $def_para->check_header_carbon="on"; 243 $def_para->check_header_text="on"; 245 $def_para->check_header_text="off"; 246 $def_para->no_ipaddress="off"; // interdiction adresse ip 247 244 248 $def_para->no_mail_list="on"; 245 249 $def_para->no_connect="on"; // empeche l'ip de se connecter au site. 246 250 $def_para->set_auto="on"; // Test a l'ouverture et enregistrement 247 $def_para->ip="127.0.0.1"; // derni èrre adresse IP251 $def_para->ip="127.0.0.1"; // derniére adresse IP 248 252 $def_para->set_id="on"; // enregistrment nouvel 249 253 $def_para->debug_mail="off"; // debogage 250 $i=0;251 254 foreach ($def_para as $key => $value) { 252 $value=$parametres[$i];253 unset( $parametres[$i]);254 $parametres[$key]= $value ;255 $i++;255 if(isset($parametres[$key])){ 256 $value=$parametres[$key]; 257 } else { 258 $new_val=true; 256 259 } 257 } 258 return mail_supervisor::Set_Options($parametres,$str_index); 260 $new_val= isset($_POST[$key]) && $new_val ; 261 unset( $parametres[$key]) ; 262 $parametres[$key]= (isset($_POST[$key]))? "on" : $value ; 263 } 264 265 if($new_val){ 266 sauve_options(); 267 } 268 return $parametres ; 259 269 } 260 270 //========================================================== … … 269 279 //========================================================== 270 280 function sauve_options(){ 271 global $options,$infos_message,$conf,$mails_options ;272 $infos_message .=l10n("save_config")."<br>";273 $mails_parametres=mail_supervisor::Set_Options($mails_options,"mail_superv");281 global $options,$infos_message,$conf,$mails_options ; 282 $infos_message .=l10n("save_config")."<br>"; 283 $mails_parametres=mail_supervisor::Set_Options($mails_options,"mail_superv"); 274 284 275 285 if ( isset($mails_parametres) ) … … 284 294 } 285 295 286 //================================================================================= 296 /**************************************** 297 * sauve_donnees() 298 ****************************************/ 287 299 function sauve_donnees(){ 288 300 global $mails_donnees,$superv_champs,$superv_type,$erreur_message ; … … 291 303 $valeurs = array(); 292 304 foreach ( $clefs as $champ){ 293 $champ = trim($champ); 305 $champ = trim($champ); 306 if($champ !="id") 294 307 if ( isset($mails_donnees[ $champ ]) ) { 295 308 $sep= (is_string($mails_donnees[ $champ ])) ? '"' : '' ; … … 299 312 } 300 313 } 314 301 315 $valeurs = implode(", ",$valeurs) ; 302 316 //===================================================================== … … 307 321 ; 308 322 ob_start(); 309 $ret= pwg_query($query) ; 310 $m= ob_get_contents(); 323 $ret= pwg_query($query) ; 324 $m= ob_get_contents(); 325 if($m!="") $m="Mail_super.inc.php sauve_donnees() l:323<br />".$m; 311 326 ob_end_clean() ; 312 327 $erreur_message .= $m ; … … 315 330 function Get_Datas(){ 316 331 global $superv_champs ; 332 verif_base(); 317 333 $champs = implode(",",$superv_champs ); 318 334 $query = "SELECT ".$champs." … … 320 336 ;"; 321 337 $result = @pwg_query($query); 338 322 339 if (!$result) { 323 340 verif_base(); -
extensions/Mail_supervisor/main.inc.php
r10822 r11807 22 22 add_event_handler('get_admin_plugin_menu_links', array(&$mail_supervisor,'admin_menu') ); 23 23 24 $mails_options = mail_supervisor::Get_Options($mails_options,"mail_superv"); 24 mail_supervisor::Get_Options($mails_options,"mail_superv"); 25 25 26 /* EVENT_HANDLER_PRIORITY_NEUTRAL */ 26 27 // … … 28 29 include_once (PHPWG_ROOT_PATH.'include/functions_mail.inc.php' ); 29 30 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 30 //===============loc_begin_index====loc_begin_page_header==========loc_after_page_header============================================================= 31 //===============loc_begin_index 32 //==== loc_begin_page_header 33 //========== loc_after_page_header 31 34 add_event_handler('loc_after_page_header', array(&$mail_supervisor,'init') ); 32 35 add_event_handler('loc_begin_page_tail', array(&$mail_supervisor,'affiche_message') ); 33 36 37 include_once(MAIL_SUPERV_PATH.'mail_send.inc.php'); 38 $clj = new clj(); 39 40 add_event_handler('send_mail',array(&$clj,'send_mail'),EVENT_HANDLER_PRIORITY_NEUTRAL - 1, 6); 41 add_event_handler('send_mail_to',array(&$clj,'send_mail_to') ); 42 add_event_handler('send_mail_subject',array(&$clj,'send_mail_subject') ); 43 add_event_handler('send_mail_content',array(&$clj,'send_mail_content') ); 44 add_event_handler('send_mail_headers',array(&$clj,'send_mail_headers'),EVENT_HANDLER_PRIORITY_NEUTRAL,6 ); 45 34 46 //========================================================================================== 35 add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 10, 6); 36 function clj_mail($result, $mailto, $subject, $content, $headers, $args) { 47 //add_event_handler('send_mail', 'clj_send_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 10, 6); 48 49 function clj_send_mail($result, $mailto, $subject, $content, $headers, $args) { 37 50 global $conf, $user, $lang_info; 38 51 global $conf_mail,$mails_options,$mails_donnees ; … … 40 53 global $errors; 41 54 // lecture config table ------------- 55 56 42 57 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 43 58 load_language('plugin.lang', MAIL_SUPERV_PATH); … … 173 188 } 174 189 175 $pattern = '/(http:\/\/)([0-9].*)([0-9]\/)/'; 176 //---- si adresse avec ip , certaine boite aux lettres traite ces messages en spam (orange+windowsmail) 177 if(preg_match($pattern, $content)){ 178 // remplace 192.168.1.25 par rien ?? 179 $replacement = '${1}'; 180 $content = preg_replace( $pattern, $replacement, $content ); 181 } 182 183 $content= preg_replace('#(?<!\r)\n#si', "\r\n", $content); //drop LF barre 184 190 //====================================================== 191 // si adresse avec ip , certaine boite aux lettres traite ces messages 192 // en spam (orange+windowsmail) 193 //====================================================== 194 if ( $mails_options['no_ipaddress'] == 'on' ){ 195 $pattern ="/(http:\/\/)(((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}))/" ; 196 if(preg_match($pattern, $content)){ 197 $replacement = "http://localhost"; 198 $content = preg_replace( $pattern, $replacement, $content ); 199 } 200 } 201 //====================================================== 202 // drop LF barre 203 //====================================================== 204 $pattern="/xxxxx/"; 205 if( preg_match($pattern, $mailto) || preg_match($pattern, $headers) ){ 206 $pattern="---="; 207 $pattern ="/" . preg_quote($pattern, '/')."/" ; 208 209 // site legtux ; adresse @lextux OK 210 // $content=$content // Ok legtux 211 // $content= preg_replace('#(?<!\r)\n#si', "\n", $content); // Ok legtux 212 213 $pattern ="#(?<!\r)\n#si" ; 214 if( preg_match($pattern, $content) ){ 215 $infos_message .= $pattern. " <br />"; 216 } 217 218 $content= preg_replace('#(?<!\r)\n#si', "\r\n", $content); // 219 $content = str_replace("\n.", "\n..", $content); 220 221 $message = "<h2>local</h2> "; 222 $nheaders = 'From: cl_josse@orange.fr' . "\r\n" . 223 'Reply-To: cl_josse@orange.fr' . "\r\n" . 224 'X-Mailer: PHP/' . phpversion(); 225 226 227 mail("cl_josse@hotmail.fr", $subject, "Test1 ".$message); 228 mail("cl_josse@hotmail.fr", $subject,"TEST 2 ". $message,$nheaders); 229 230 return true ; 231 232 233 234 235 if( preg_match($pattern, $content) ){ 236 $infos_message .= "OK". " <br />"; 237 } 238 239 }else{ 240 $pattern="/hotmail/"; 241 if( preg_match($pattern, $mailto) || preg_match($pattern, $headers) ){ 242 // 243 }else{ 244 $pattern="/free.fr|club/"; 245 if( preg_match($pattern, $mailto) || preg_match($pattern, $headers) ){ 246 $content= preg_replace('#(?<!\r)\n#si', "\r\n", $content); //drop LF barre 247 }else{ 248 249 } 250 } 251 } 252 253 //===================================================================== 185 254 if (!preg_match('/'. $conf_mail['boundary_key'] .'/', $headers)){ 186 255 $erreur_message .= "<br />ERREUR manque : boundary_key dans le headers <br />"; 187 256 $infos_message = l10n('Sv_mail_not_send'); 188 257 $envoie_ok= false ; 189 } 190 $ret=false; 258 return false ; 259 260 } 261 //===================================================================== 262 $ret="false"; 191 263 ob_start(); 192 264 //======== Non mise en quarantaine ============= … … 195 267 196 268 if ($nb_destinataires > 0) { 197 if( $envoie_ok) $ret = mail($mailto, $subject,$content, $headers); 269 if( $envoie_ok) { 270 $ret = mail($mailto, $subject,$content, $headers); 271 } 198 272 }else{ 199 273 $message .= l10n('Sv_no_receiver_available'); … … 204 278 trigger_event('mail_supervisor_mail', $arg_trigg ); 205 279 $mails_donnees['message']=$message; 206 Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto, $subject,$content);280 $ret= Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto, $subject,$content); 207 281 } else { 208 282 //================== Est en quarantaine ======================= 283 209 284 $erreur_message .= l10n('Sv_To_day_is')."<br />"; 210 285 if ($alerte_spam ) { … … 237 312 $erreur_message .='<br />'.sprintf(l10n('Sv_mise_en_quarantaine %s %s %s %s %s'),$type,$d1,$d2,$d3,$d4).'<br />'; 238 313 } 314 $ret = "Error ". $type." : "; 315 $ret .= l10n('Sv_mail_not_send'); 316 239 317 $infos_message .= l10n('Sv_mail_not_send'); 240 318 } … … 244 322 mail_supervisor::affiche_message(); 245 323 246 return true ;324 return $ret ;// 247 325 } 248 326 //=========================================================================================== … … 255 333 $est_un_spam =!(strpos(strtolower($message), 'spam') === false); 256 334 if ( ($ret==false) || ($est_un_spam==true) || ($nb_destinataires == 0) ) { 335 //=============== La fonction mail retourne une erreur ========================= 336 $ret="Error"; 257 337 // Bad recipient address syntax 258 338 $pos1 = strpos(strtolower($message), 'bad recipient address syntax'); … … 261 341 $erreur_message .= l10n('Sv_verifiez_les_destinataires').' (Bcc,Cc,To)<br />'; 262 342 } 263 264 $erreur_message .=sprintf(l10n('Sv_debug_message'), 343 $erreur_message .=$ret . " : <br />".sprintf(l10n('Sv_debug_message'), 265 344 ($ret==true)? "true" : "false", 266 345 htmlspecialchars($message) , … … 272 351 273 352 Mail_supervisor_log($mailto,$erreur_message) ; 274 //=============== La fonction mail retourne une erreur =========================275 }else{276 353 354 }else{ 277 355 if( isset($mails_options['debug_mail']) && $mails_options['debug_mail']=="on") { 278 $erreur_message .="DEBUG : <br />" .sprintf(l10n('Sv_debug_message'),279 "DEBUG",356 $infos_message .="DEBUG : <br />" .sprintf(l10n('Sv_debug_message'), 357 ($ret==true)? "true" : "false", 280 358 htmlspecialchars( $message) , 281 359 htmlspecialchars( $mailto) , … … 285 363 $nb_destinataires ); 286 364 287 Mail_supervisor_log($mailto,$erreur_message) ;288 } 289 } 290 365 Mail_supervisor_log($mailto,$infos_message) ; 366 } 367 } 368 //================================================================= 291 369 292 370 … … 295 373 $mails_donnees['nb_mails'] += $nb_destinataires; 296 374 } else { 375 $ret="Error spam"; 297 376 $mails_donnees['nb_spams'] += $nb_destinataires; 298 377 //--- Detection de spam ------------------ … … 308 387 } 309 388 } 310 $ret=true;311 389 return $ret ; 312 390 } … … 361 439 362 440 /* 363 * 441 * sends an email, using Piwigo specific informations 364 442 * 365 443 * @param: 366 * 444 * - to: receiver(s) of the mail (list separated by comma). 367 445 * - args: function params of mail function: 368 446 * o from: sender [default value webmaster email] … … 377 455 * @return boolean (Ok or not) 378 456 */ 379 function cl_pwg_mail( $args = array()) 380 { 381 global $conf, $conf_mail, $lang_info, $page; 382 global $erreur_message ; 383 if (!isset($conf_mail)) { 457 function cl_pwg_mail($to, $args = array()){ 458 global $conf, $conf_mail, $lang_info, $page; 459 if (empty($to) and empty($args['Cc']) and empty($args['Bcc'])) { 460 return true; 461 } 462 if (!isset($conf_mail)) { 384 463 $conf_mail = get_mail_configuration(); 385 464 } 386 if (empty($args['email_format'])) 465 if (empty($args['email_format'])) { 387 466 $args['email_format'] = $conf_mail['default_email_format']; 388 467 } 389 468 // Compute root_path in order have complete path 390 set_make_full_url(); 391 if (!isset($args['content'])) { 469 set_make_full_url(); 470 if (empty($args['from'])) { 471 $args['from'] = $conf_mail['formated_email_webmaster']; 472 } else { 473 $args['from'] = format_email('', $args['from']); 474 } 475 if (empty($args['subject'])) { 476 $args['subject'] = 'Piwigo'; 477 } 478 // Spring cleaning 479 $cvt_subject = trim(preg_replace('#[\n\r]+#s', '', $args['subject'])); 480 // Ascii convertion 481 $cvt_subject = encode_mime_header($cvt_subject); 482 483 if (!isset($args['content'])) { 392 484 $args['content'] = ''; 393 485 } 486 394 487 if (empty($args['content_format'])) { 395 $args['content_format'] = 'text/plain'; } 488 $args['content_format'] = 'text/plain'; 489 } 490 491 if ($conf_mail['send_bcc_mail_webmaster']) { 492 $args['Bcc'][] = $conf_mail['formated_email_webmaster']; 493 } 494 396 495 if (empty($args['theme'])) { 397 496 $args['theme'] = get_default_theme(); 398 497 } 498 499 $headers = 'From: '.$args['from']."\n"; 500 $headers.= 'Reply-To: '.$args['from']."\n"; 501 502 if (!empty($args['Cc'])) { 503 $headers.= 'Cc: '.implode(',', $args['Cc'])."\n"; 504 } 505 506 if (!empty($args['Bcc'])) { 507 $headers.= 'Bcc: '.implode(',', $args['Bcc'])."\n"; 508 } 509 510 $headers.= 'Content-Type: multipart/alternative;'."\n"; 511 $headers.= ' boundary="---='.$conf_mail['boundary_key'].'";'."\n"; 512 $headers.= ' reply-type=original'."\n"; 513 $headers.= 'MIME-Version: 1.0'."\n"; 514 $headers.= 'X-Mailer: Piwigo Mailer'."\n"; 399 515 400 516 // List on content-type … … 403 519 $content_type_list[] = $conf_mail['alternative_email_format']; 404 520 } 521 405 522 $content = ''; 406 foreach (array_unique($content_type_list) as $content_type) 407 {523 524 foreach (array_unique($content_type_list) as $content_type) { 408 525 // key compose of indexes witch allow ti cache mail data 409 526 $cache_key = $content_type.'-'.$lang_info['code'].'-'.$args['theme']; 410 unset($conf_mail[$cache_key]); 411 if (!isset($conf_mail[$cache_key])) {412 if (!isset($conf_mail[$cache_key]['theme'])) {527 528 if (!isset($conf_mail[$cache_key])) { 529 if (!isset($conf_mail[$cache_key]['theme'])) { 413 530 $conf_mail[$cache_key]['theme'] = get_mail_template($content_type, $args['theme']); 414 531 } 532 415 533 $conf_mail[$cache_key]['theme']->set_filename('mail_header', 'header.tpl'); 416 534 $conf_mail[$cache_key]['theme']->set_filename('mail_footer', 'footer.tpl'); 535 417 536 $conf_mail[$cache_key]['theme']->assign( 418 537 array( … … 434 553 )); 435 554 436 if ($content_type == 'text/html'){ 437 if ($conf_mail[$cache_key]['theme']->smarty->template_exists('global-mail-css.tpl')){ 555 if ($content_type == 'text/html') { 556 if ($conf_mail[$cache_key]['theme']->smarty->template_exists('global-mail-css.tpl')) 557 { 438 558 $conf_mail[$cache_key]['theme']->set_filename('css', 'global-mail-css.tpl'); 439 559 $conf_mail[$cache_key]['theme']->assign_var_from_handle('GLOBAL_MAIL_CSS', 'css'); … … 441 561 442 562 $file = PHPWG_ROOT_PATH.'themes/'.$args['theme'].'/mail-css.tpl'; 443 if (is_file($file)) {563 if (is_file($file)) { 444 564 $conf_mail[$cache_key]['theme']->set_filename('css', realpath($file)); 445 565 $conf_mail[$cache_key]['theme']->assign_var_from_handle('MAIL_CSS', 'css'); 446 566 } 447 } 567 } 448 568 449 569 // what are displayed on the header of each mail ? … … 457 577 458 578 // Header 459 $content.= $conf_mail[$cache_key]['header']; 460 // Content 461 if (($args['content_format'] == 'text/plain') and ($content_type == 'text/html')){ 579 $content.= $conf_mail[$cache_key]['header']; 580 581 // Content 582 if (($args['content_format'] == 'text/plain') and ($content_type == 'text/html')) { 462 583 $content.= '<p>'. 463 584 nl2br( … … 466 587 htmlspecialchars($args['content']))). 467 588 '</p>'; 468 } else if (($args['content_format'] == 'text/html') and ($content_type == 'text/plain')) { 589 } 590 else if (($args['content_format'] == 'text/html') and ($content_type == 'text/plain')) 591 { 469 592 // convert html text to plain text 470 593 $content.= strip_tags($args['content']); 471 } else{594 } else { 472 595 $content.= $args['content']; 473 596 } 474 597 475 // Footer 476 $content.= $conf_mail[$cache_key]['footer']."\n\n"; 477 478 // Close boundary 479 $content.= "\n\n".'-----='.$conf_mail['boundary_key'].'--'."\n\n"; 480 } 598 // Footer 599 $content.= $conf_mail[$cache_key]['footer']; 600 601 // Close boundary 602 $content.= "\n".'-----='.$conf_mail['boundary_key'].'--'."\n"; 603 } 604 605 //~ // Close boundary 606 //~ $content.= "\n".'-----='.$conf_mail['boundary_key'].'--'."\n"; 607 481 608 // Undo Compute root_path in order have complete path 482 unset_make_full_url(); 483 484 485 486 return $content; 487 609 unset_make_full_url(); 610 611 return 612 trigger_event('send_mail', 613 false, /* Result */ 614 trigger_event('send_mail_to', get_strict_email_list($to)), 615 trigger_event('send_mail_subject', $cvt_subject), 616 trigger_event('send_mail_content', $content), 617 trigger_event('send_mail_headers', $headers), 618 $args 619 ); 488 620 } 489 621 622 490 623 ?> -
extensions/Mail_supervisor/maintain.inc.php
r10822 r11807 31 31 $my_para['check_mailto']="on"; 32 32 $my_para['check_header_carbon']="on"; 33 $my_para['check_header_text']="on"; 33 $my_para['check_header_text']="off"; 34 $my_para['no_ipaddress']="off"; // interdiction adresse ip 35 34 36 $my_para['no_mail_list']="on"; 35 37 $my_para['no_connect']="off"; // empeche l'ip de se connecter au site. 36 38 $my_para['set_auto']="on"; // Test a l'ouverture et enregistrement 37 $my_para['ip']="127.0.0.1"; // derni èrre adresse IP39 $my_para['ip']="127.0.0.1"; // derniere adresse IP 38 40 $my_para['set_id']="on"; // enregistrment nouvel 39 41 $my_para['debug_mail']="off"; // debogage
Note: See TracChangeset
for help on using the changeset viewer.