Changeset 4220
- Timestamp:
- Nov 6, 2009, 1:52:37 PM (14 years ago)
- Location:
- extensions/Mail_supervisor
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Mail_supervisor/admin/mail_black_liste.tpl
r4206 r4220 7 7 </div> 8 8 <form action='' method="post" name="form_black"> 9 10 9 <fieldset> 11 10 <legend >{'options'|translate}</legend> 12 11 <table> 13 14 <td><input type="checkbox" name="NO_MAIL_LIST" value="on" {$NO_MAIL_LIST} /> {'no_mail_list'|translate} </td> 15 <td><input type="checkbox" name="NO_CONNECT" value="on" {$NO_CONNECT} /> {'no_connect'|translate}</td> 16 <td><input type="checkbox" name="SET_AUTO" value="on" {$SET_AUTO} /> {'set_auto'|translate}</td> 17 18 <tr><td> 12 <td><input type="checkbox" name="no_mail_list" value="on" {$no_mail_list} /> {'no_mail_list'|translate} </td> 13 <td><input type="checkbox" name="no_connect" value="on" {$no_connect} /> {'no_connect'|translate}</td> 14 <td><input type="checkbox" name="set_auto" value="on" {$set_auto} /> {'set_auto'|translate}</td> 15 <tr><p></p><td> 19 16 <input class="submit" type="submit" name="submit" value={'Valider'|translate} /></td></tr> 20 17 </table> … … 22 19 23 20 <input name="info1" type="hidden" /> 24 <input name="ip_black" type="hidden" class="items" value="{$ip_black}" />25 26 27 21 <fieldset > 28 22 <legend>{'black_liste'|translate}</legend> 29 23 <table> 30 31 32 24 <div> 33 <input name="ip_black_test" id = "ip_black_test" type="text" value="{$ip_black_test}" /> <input type="submit" name="info" value="{'Test'|translate}" /> 25 <input name="ip_black" id = "ip_black_test" type="text" value="{$ip_black}" 26 /> 27 <input type="submit" name="submit" value="{'Test'|translate}" /> 34 28 { if $ip_black_len > 0} 35 29 {if $IS_SPAM == true } … … 38 32 <label class="erreur"> {'not_a_spam'|@translate} </label> 39 33 {/if} 34 <input type="submit" name="submit" value="{'Ajout'|translate}" /> 35 <input type="image" name="submit" class='row1' 36 src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plug_activate.png" 37 alt="{'ajout'|@translate}" 38 onclick = " 39 if (confirm( document.getElementById('btn_ajout{$ip_black}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}')) 40 form_black.info1.value='ajout:{$ip_black}' 41 " 42 id="btn_ajout{$ip_black}" 43 title="{'ajout'|@translate} {$ip_black}" /> 40 44 { else } 41 {'valider'|@translate}45 {'valider'|@translate} 42 46 {/if} 43 47 44 48 45 <input type="image" class='row1' 46 src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plug_activate.png" 47 alt="{'ajout'|@translate}" 48 onclick = " 49 if (confirm( document.getElementById('btn_ajout{$ip_black_test}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}')) 50 form_black.info1.value='ajout:{$ip_black_test}' 51 " 52 id="btn_ajout{$ip_black_test}" 53 title="{'ajout'|@translate} {$ip_black_test}" /> 49 50 51 54 52 </div> 55 53 </table> … … 97 95 <legend>{'liste_ip'|translate}</legend> 98 96 <p class="Style1"> 99 {'IP_adress'|translate} : {$IP}100 {'pays'|translate} : {$PAYS}97 {'IP_adress'|translate} : {$IP} 98 {'pays'|translate} : {$PAYS} 101 99 {'ville'|translate} : {$VILLE} 102 {'region'|translate} : {$REGION} 103 104 105 {$pays} 106 107 </p> 100 {'region'|translate} : {$REGION} 101 </p> 108 102 109 103 <table class="table2"> -
extensions/Mail_supervisor/admin/mail_superv_admin.php
r4206 r4220 34 34 // +-----------------------------------------------------------------------+ 35 35 //check_status(ACCESS_ADMINISTRATOR); 36 37 global $user, $lang, $conf, $errors,$mails_données;38 global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ;39 40 41 36 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 42 43 44 include_once (MAIL_SUPERV_PATH.'include/constants.php');45 include_once (MAIL_SUPERV_PATH.'include/fonctions.php');46 37 include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 38 39 47 40 $my_base_url = get_admin_plugin_menu_link(__FILE__); 48 49 50 51 41 load_language('plugin.lang', MAIL_SUPERV_PATH); 52 42 … … 88 78 $error = array(); 89 79 90 80 global $user, $lang, $conf, $errors,$mails_données; 81 global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ; 82 include_once (MAIL_SUPERV_PATH.'include/constants.php'); 83 84 if (isset($conf['mail_superv'])) { 85 86 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 91 87 $mails_options = explode("," , $conf['mail_superv']); 92 93 88 $mails_données=Get_Datas(); 94 vérif_base(); 89 90 91 }else { 92 die ("mail"); 93 } 94 95 95 96 96 $aff_nb=true; … … 112 112 // ************************************************************************* 113 113 case 'mail_superv_admin': 114 114 115 115 //============================================================= 116 if ( isset($_POST['refresh']) ) { 116 if ( isset($_POST['submit']) ) { 117 if ( $_POST['submit'] == l10n('refresh') ) { 118 117 119 118 120 if ($mails_données['nb_mails'] == 0 ) … … 127 129 $mails_données['date_quarantaine']=time(); 128 130 } 131 $infos_message .= l10n('refresh') .'<br />'; 129 132 sauve_données(); 130 $erreur_message .="<DIV > <input name='' type='checkbox' value='' /> </DIV>" ;131 133 $aff_nb = false ; 132 134 135 133 136 } 134 137 135 if ( isset($_POST['raz']) ) { 138 if ( $_POST['submit'] == l10n('raz') ) { 139 136 140 $mails_données['date_quarantaine']=time(); 137 141 $mails_données['nb_mails'] = 0 ; … … 144 148 145 149 sauve_données(); 146 $infos_message .= l10n('save_config') ; 150 $infos_message .= l10n('raz') .'<br />'; ; 151 147 152 } 148 153 149 if ( isset($_POST['submit']) )154 if ( $_POST['submit'] == l10n('Valider') ) 150 155 { 151 //Options152 153 156 154 157 $mails_options[0] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ; … … 169 172 sauve_données(); 170 173 //======================================================================================================= 171 $infos_message .= l10n('save_config') ;174 $infos_message .= l10n('save_config') . " : " . l10n('Datas') . "<br />" ; 172 175 } 173 176 } 174 177 175 178 $mails_données = Get_Datas(); … … 300 303 case 'mail_black_liste': 301 304 load_language('help/plugin.lang', MAIL_SUPERV_PATH); 302 Global $pays,$region,$ville ; 303 304 kill_list(); 305 global $pays,$region,$ville ; 306 $aff_nb=false; 307 //------------------------------------------------------------------------------------ 308 $pays = (isset($_POST['pays'])) ? $_POST['pays'] : $pays ; 309 $ville = (isset($_POST['ville'])) ? $_POST['ville']: $ville ; 310 $region = isset($_POST['region']) ? $_POST['region'] : $region ; 311 $ip = ($mails_options[6] == '') ? $_SERVER['REMOTE_ADDR'] : $mails_options[6] ; 305 312 306 $aff_nb=false; 307 $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ; 308 $template->assign( 309 array( 310 'smile_bonjour' => $smile_bonjour , 311 ) 312 ); 313 $aff_nb = false; 314 $liste_bl=array(); 315 $liste_ip=array(); 316 317 $ip_black=""; 318 $info_ip =""; 319 320 321 include (MAIL_SUPERV_PATH.'include/save_info.php'); 322 $ip_black_test = (isset($_POST['ip_black_test'])) ? $_POST['ip_black_test'] : $ip_black ; 323 $mails_options[3] = isset($_POST['NO_MAIL_LIST']) ? $_POST['NO_MAIL_LIST'] : $mails_options[3] ; 324 $mails_options[4] = isset($_POST['NO_CONNECT']) ? $_POST['NO_CONNECT'] : $mails_options[4] ; 325 $mails_options[5] = isset($_POST['NO_CONNECT']) ? $_POST['NO_CONNECT'] : $mails_options[5] ; 326 327 if ( isset($_POST['submit']) ) 313 $mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[3] ; 314 $mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[4] ; 315 $mails_options[5] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[5] ; 316 317 //======================================================================================= 318 $info_ip = (isset($info_ip)) ? $info_ip : '' ; 319 $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ; 320 $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ; 321 $info_ip .= ":"; 322 323 $val=explode(":",$info_ip); 324 $info_ip = trim($val[0]) ; 325 $ip_black = trim($val[1]) ; 326 327 if (isset($_POST['ip_black'])) $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ; 328 329 330 331 if ( isset($_POST['submit']) ) 328 332 { 333 334 if ( $_POST['submit'] == l10n('Ajout') ) 335 { 336 $info_ip = trim( $_POST['submit']) ; 337 $ip_black = trim( $_POST['ip_black']) ; 338 $infos_message .= l10n('ajout'). '---->'. $ip_black ; 339 } 329 340 if ( $_POST['submit'] == l10n('Valider') ) 330 341 { 331 $mails_options[3] = isset($_POST['NO_MAIL_LIST']) ? $_POST['NO_MAIL_LIST'] : "off" ; 332 $mails_options[4] = isset($_POST['NO_CONNECT']) ? $_POST['NO_CONNECT'] : "off" ; 333 $mails_options[5] = isset($_POST['SET_AUTO']) ? $_POST['SET_AUTO'] : "off" ; 334 342 $mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ; 343 $mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ; 344 $mails_options[5] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ; 335 345 sauve_options(); 336 $infos_message .= l10n('save_config');337 unset ($_POST['submit']);346 $infos_message .= l10n('save_config') . '<br />'; 347 338 348 } 339 340 } 341 342 343 349 } 350 351 include (MAIL_SUPERV_PATH.'include/save_info.php'); 352 353 //======================================================================================= 344 354 $f_action = $my_base_url.'&tab=mail_black_liste' ; 345 355 $champs_ip=array(); … … 357 367 'conf_admin_layout' => $conf['admin_layout'] , 358 368 'ip_black' => $ip_black , 359 'IS_SPAM' => test_spam( $ip_black_test ), 360 'ip_black_test' => (isset($_POST['ip_black_test']) ) ? $_POST['ip_black_test'] : $ip_black , 369 'IS_SPAM' => test_spam( $ip_black), 370 'ip_black_len' => strlen($ip_black) , 371 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 372 373 'F_ACTION' => $f_action , 361 374 362 'ip_black_len' => strlen($ip_black_test) , 363 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 364 365 'F_ACTION' => $f_action , 366 367 375 'no_mail_list' => ($mails_options[3] == 'on') ? 'checked="checked"' : '' , 376 'no_connect' => ($mails_options[4] == 'on') ? 'checked="checked"' : '' , 377 'set_auto' => ($mails_options[5] == 'on') ? 'checked="checked"' : '' , 368 378 369 'NO_MAIL_LIST' => $mails_options[3] == 'on' ? 'checked="checked"' : '' , 370 'NO_CONNECT' => $mails_options[4] == 'on' ? 'checked="checked"' : '' , 371 'SET_AUTO' => $mails_options[5] == 'on' ? 'checked="checked"' : '' , 372 'IP' => $_SERVER['REMOTE_ADDR'], 379 'IP' => $ip , 373 380 'PAYS' => $pays , 374 381 'VILLE' => $ville , … … 378 385 ); 379 386 //=============================================================== 380 387 388 381 389 $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl'))); 382 390 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); -
extensions/Mail_supervisor/admin/mail_superv_admin.tpl
r4156 r4220 9 9 <fieldset> 10 10 <legend>{'options'|translate}</legend> 11 11 12 12 <table> 13 13 <tr><td><input type="checkbox" name="check_mailto" value="on" {$check_mailto} /> {'check_mailto'|translate}</td><td><input type="checkbox" name="check_header_carbon" value="on" {$check_header_carbons} /> {'check_header_carbon'|translate}</td> … … 31 31 <tr> 32 32 33 <td><input type="text" name="nb_mails" size='10%' value={$nb_mails} /></td>33 <td><input type="text" name="nb_mails" size='10%' value={$nb_mails} readonly="true" class="row2" /></td> 34 34 <td>{'free_mails'|translate}</td> 35 <td><input type="text" name="date_mail" value={$date_mail} /></td>35 <td><input type="text" name="date_mail" value={$date_mail} readonly="true" class="row2" /></td> 36 36 <td><input type="text" name="nb_mails_maxi" size="10%" value={$nb_mails_maxi} /></td> 37 37 <td><input type="text" name="nb_mails_periode" size="30%" value={$nb_mails_periode} /></td> 38 <td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} /></td>38 <td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} readonly="true" class="row2" /></td> 39 39 </tr> 40 40 41 41 <tr> 42 <td><input type="text" name="nb_spams" size='10%' value={$nb_spams} /></td>42 <td><input type="text" name="nb_spams" size='10%' value={$nb_spams} readonly="true" class="row2" /></td> 43 43 <td>{'free_spams'|translate}</td> 44 44 45 <td><input type="text" name="date_spam" value={$date_spam} /></td>45 <td><input type="text" name="date_spam" value={$date_spam}readonly="true" class="row2" /></td> 46 46 <td><input type="text" name="nb_spams_maxi" size="10%" value={$nb_spams_maxi} /></td> 47 47 <td><input type="text" name="nb_spams_periode" size="30%" value={$nb_spams_periode} /></td> 48 <td><input type="text" name="time_spams_reste" size="50%" value={$time_spams_reste} /></td>48 <td><input type="text" name="time_spams_reste" size="50%" value={$time_spams_reste} readonly="true" class="row2" /></td> 49 49 </tr> 50 50 </table> … … 83 83 </table> 84 84 </fieldset> 85 <p><input class="submit" type="submit" name="submit" value="{'Submit'|translate}" />86 <input class="submit" type="submit" name=" raz" value="{'raz'|translate}" />87 <input class="submit" type="submit" name=" raffraichir" value="{'refresh'|translate}" />85 <p><input class="submit" type="submit" name="submit" value="{'Submit'|translate}" /> 86 <input class="submit" type="submit" name="submit" value="{'raz'|translate}" /> 87 <input class="submit" type="submit" name="submit" value="{'refresh'|translate}" /> 88 88 </p> 89 89 </fieldset> -
extensions/Mail_supervisor/include/fonctions.php
r4206 r4220 49 49 50 50 global $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ; 51 $superv_champs = array( 52 "id", 53 "nb_mails", 54 "date_mail", 55 "nb_mails_maxi", 56 "nb_mails_periode", 57 "nb_spams", 58 "date_spam", 59 "nb_spams_maxi", 60 "nb_spams_periode", 61 "quarantaine", 62 "date_quarantaine", 63 "quarantaine_periode", 64 "message", 65 "message_test", 66 "header_text", 67 68 ); 69 70 $superv_type = array( 71 " SMALLINT( 5 ) NOT NULL DEFAULT '0'" , 72 "INT NOT NULL DEFAULT '0'" , 73 "INT NOT NULL DEFAULT '0'" , 74 "INT NOT NULL DEFAULT '2000'", 75 "TEXT" , 76 "INT NOT NULL DEFAULT '0'", 77 "INT NOT NULL DEFAULT '0'", 78 "INT NOT NULL DEFAULT '10'", 79 "TEXT" , 80 "TEXT" , 81 "INT NOT NULL DEFAULT '0'", 82 "TEXT" , 83 "TEXT" , 84 "TEXT" , 85 "TEXT" , 86 87 ); 88 89 90 $superv_bl_champs = array( 91 "id", 92 "ip", 93 "pays", 94 "region", 95 "ville", 96 "adresse", 97 "fai", 98 "nb" 99 ); 100 101 $superv_bl_type = array( 102 " smallint(5) UNSIGNED NOT NULL auto_increment ", 103 "TEXT" , 104 "TEXT" , 105 "TEXT" , 106 "TEXT" , 107 "TEXT" , 108 "TEXT" , 109 " smallint(5) UNSIGNED " 110 ); 111 112 vérif_base() ; 113 51 114 52 //========================================================== 115 53 function sauve_options() … … 136 74 global $mails_données,$superv_champs,$superv_type,$erreur_message ; 137 75 //===================================================================== 138 ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ;139 76 $clefs = $superv_champs ; 140 77 $valeurs = array(); … … 176 113 $mails_options = explode("," , $conf['mail_superv']); 177 114 178 179 if ( !isset($_POST['submit']) ) { 115 if ( count($_POST)==5 || count($_POST)==0 ) { 116 117 180 118 if (kill_list()) 181 119 { … … 227 165 function Get_geo() 228 166 { 229 Global $pays,$region,$ville , $erreur_message;167 global $pays,$region,$ville , $erreur_message; 230 168 if (!isset($_POST['submit'])) 231 169 { … … 263 201 function Get_Datas() 264 202 { 265 ob_start(); 266 $data=Lire_datas(); 267 $m= ob_get_contents(); 268 ob_end_clean(); 269 270 if (strlen($m)>0) { 271 vérif_base() ; 272 $data=Lire_datas(); 273 } 274 return $data; 275 } 276 277 function Lire_datas() 278 { 279 280 281 $query = " 282 SELECT * 203 global $superv_champs ; 204 $champs = implode(",",$superv_champs ); 205 $query = "SELECT ".$champs." 283 206 FROM ".MAIL_SUPERV_TABLE." 284 207 ;"; 285 $data = mysql_fetch_array(pwg_query($query),MYSQL_ASSOC); 208 $result = @pwg_query($query); 209 210 if (!$result) { 211 vérif_base(); 212 $result = @pwg_query($query); 213 } 214 215 216 $data = mysql_fetch_array($result,MYSQL_ASSOC); 286 217 //==================================================================================== 287 218 $next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] );; … … 383 314 global $lang,$superv_champs,$superv_type,$superv_bl_champs,$superv_bl_type; 384 315 load_language('plugin.lang', MAIL_SUPERV_PATH); 385 386 create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; 387 316 //============================================================================== 317 create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; 318 ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; 319 //============================================================================== 320 create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; 388 321 ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; 389 322 //============================================================================== … … 409 342 ajout_ligne(MAIL_SUPERV_TABLE,$superv_champs, $valeurs,false ) ; 410 343 411 create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; 412 ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; 413 } 414 415 344 345 } 346 347 //========================================= 416 348 function Get_colonnes_de($table) 417 349 { 418 $columns_of = array();419 350 $query = 'DESC '.$table.';'; 420 351 $result = mysql_query($query); 421 $columns_of [$table]= array();352 $columns_of= array(); 422 353 while ($row = mysql_fetch_row($result)) 423 354 { 424 array_push($columns_of [$table], $row[0]);355 array_push($columns_of, $row[0]); 425 356 } 426 357 … … 495 426 function ajust_table($nom_table,$champs,$types) //MAIL_SUPERV_TABLE 496 427 { 497 return ; 498 create_table($nom_table,$champs,$types) ; 499 500 501 $table = mysql_fetch_array(pwg_query('SELECT * FROM '.$nom_table),MYSQL_ASSOC); 502 503 $result = mysql_query('SELECT * FROM '.$nom_table); 504 505 $row = mysql_fetch_row($result) ; 506 echo $nom_table . " " . memo_var($row) . count($row) ; 507 508 if (count($row)> 1) return ; 509 510 511 $nb = Get_colonnes_de($nom_table); 512 $table=$nb[$nom_table]; 513 $data = $types ; 514 $i=0; 515 $valeurs=array(); 516 517 428 global $infos_message ; 429 $colonnes = Get_colonnes_de($nom_table); 430 $data = $types ; 431 $i=0; 432 $valeurs=array(); 518 433 foreach ( $champs as $champ) 519 434 { 520 435 $champ = trim($champ); 521 if (!in_array( $champ,$ table)) {436 if (!in_array( $champ,$colonnes)) { 522 437 array_push($valeurs , " ADD `".$champ."`" . ' ' . $data[ $i] ) ; 523 438 } … … 525 440 526 441 } 442 //============================================================================= 527 443 if ( count($valeurs) == 0) return ; 528 444 529 $valeurs=implode(", ",$valeurs) ; 445 $infos_message .= "AJUSTE TABLE : ". $nom_table . "<BR />" . "NB (col) : ". count($colonnes) . memo_var($valeurs) . "<BR />" ; 446 447 $valeurs=implode(", ",$valeurs) ; 530 448 //=============================================================================== 531 532 449 $query = "ALTER TABLE `" . $nom_table . "` ". $valeurs ; 533 450 if ( pwg_query($query)) return ; 534 535 451 die($query); 536 537 538 } 539 452 } 453 //============================================================================== 540 454 function ajout_ligne($nom_table,$champs,$valeurs,$force) 541 455 { 542 456 if (!$force) { 543 457 $query = " 544 SELECT COUNT(`id`) as total458 SELECT `id` , COUNT(`id`) as total 545 459 FROM `".$nom_table."` 546 460 ;"; 547 //============================================================================== 548 list($count) = mysql_fetch_row(pwg_query($query)); 461 list($count) = mysql_fetch_row(pwg_query($query)); 462 463 549 464 }else{ 550 465 … … 655 570 { 656 571 //==================== TEST black_liste ============================================ 657 Global $pays,$region,$ville,$erreur_message,$infos_message,$conf; 572 global $pays,$region,$ville,$ip ; 573 global $erreur_message,$infos_message,$conf; 658 574 global $conf, $user, $page; 659 575 global $mails_options ; 660 576 global $superv_bl_champs,$superv_bl_type ; 661 662 663 if (count($mails_options) < 6 ) return false ; 664 665 $ip = $_SERVER['REMOTE_ADDR'] ; 666 667 668 577 global $nb ; 578 579 580 581 if (count($mails_options) < 7 ) return false ; 582 583 $ip = $_SERVER['REMOTE_ADDR'] ; 669 584 if ( !isset($_POST['pays'])) { 670 671 585 if ( !isset($_POST['ip_black_test'])) { Get_Geo(); } 672 673 586 return ; 674 } else{ 675 $pays = isset($_POST['pays']) ? $_POST['pays'] : $pays="" ; 676 $ville = (isset($_POST['ville'])) ? $_POST['ville']: $ville="" ; 677 $region = isset($_POST['region']) ? $_POST['region'] : $region="" ; 678 679 } 680 681 682 587 } else { 588 $pays = (isset($_POST['pays'])) ? $_POST['pays'] : "" ; 589 $ville = (isset($_POST['ville'])) ? $_POST['ville'] : "" ; 590 $region = ( isset($_POST['region'])) ? $_POST['region'] : "" ; 591 } 592 593 $champs=implode(',',$superv_bl_champs); 683 594 $query = " 684 SELECT *,COUNT(`id`) as total595 SELECT ".$champs.",COUNT(`id`) as total 685 596 FROM `".MAIL_BLACK_LISTE_TABLE."` 686 597 WHERE `ip` LIKE '".$ip."' 687 598 ;"; 688 $datas = mysql_fetch_array(pwg_query($query),MYSQL_ASSOC); 599 $result = @pwg_query($query); 600 601 if (!$result) { 602 vérif_base(); 603 $result = @pwg_query($query); 604 } 605 $datas = mysql_fetch_array($result,MYSQL_ASSOC); 606 689 607 $nb = $datas['total']; 690 608 if ($mails_options[5] == 'on') … … 693 611 if (test_spam($ip)) 694 612 { 695 696 613 $valeurs=array( 'NULL', 697 614 "'".$ip."'", … … 703 620 1 704 621 ); 705 ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,true) ;622 ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,true) ; 706 623 $erreur_message .= $ip.$mails_options[6] . ' -----> ' . l10n('black_list') ; 707 624 return true ; -
extensions/Mail_supervisor/include/save_info.php
r4190 r4220 7 7 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 8 8 9 //include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );10 include_once (MAIL_SUPERV_PATH.'include/constants.php');11 include_once (MAIL_SUPERV_PATH.'include/fonctions.php');12 9 13 $info_ip = (isset($info_ip)) ? $info_ip : '' ; 14 $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ; 15 $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ; 16 $info_ip .= ":"; 17 18 $val=explode(":",$info_ip); 19 $info_ip = trim($val[0]) ; 20 $ip_black = trim($val[1]) ; 21 22 if (isset($_POST['ip_black'])) 23 $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ; 24 global $n ; 10 25 11 26 Global $pays,$region,$ville ; 27 28 switch ($info_ip) 12 13 switch (strtolower($info_ip)) 29 14 { 30 15 31 case 'ajout': 32 $n +=1; 33 //echo " |$n] ". (( isset($_POST['info']) ) ? " POST :".$_POST['info'] : "" ).(( isset($_POST['info1']) ) ? " POST 1 :".$_POST['info1'] : "" )."|"; 16 case 'ajout' : 34 17 18 35 19 if (!($ip_black == '')) { 36 create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;37 ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;38 39 20 $query = " 40 SELECT COUNT(`id`) as total21 SELECT `ip` 41 22 FROM `".MAIL_BLACK_LISTE_TABLE."` 42 23 WHERE ip = '".$ip_black."' 43 24 ;"; 44 45 46 25 //============================================================================== 47 26 list($count) = mysql_fetch_row(pwg_query($query)); 48 27 //============================================================================== 49 50 28 $valeurs=array( 'NULL', 51 29 "'".$ip_black."'", … … 76 54 } 77 55 //================ Liste Black liste ================= 78 create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;79 80 56 $query = " 81 57 SELECT *, COUNT(`ip`) as total , `ip` as blacklist, `ip` as U_DELETE 82 83 58 FROM ".MAIL_BLACK_LISTE_TABLE." 84 59 GROUP by ip … … 121 96 122 97 123 124 125 126 127 128 98 ?> -
extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
r4190 r4220 18 18 $lang['set_black_list'] = 'Mise sur la liste noire'; 19 19 $lang['is_a_spam'] = 'Spammeur détecté!.'; 20 $lang[' cde_ajout'] = 'cliquer sur l\'icône =>';21 $lang['valider'] = ' (Pour vérifier si l\'adresse introduite est suceptible d\' être un Spammer.)';20 $lang['Ajout'] = 'Ajouter à la liste noire.'; 21 $lang['valider'] = ' '; 22 22 $lang['IP_adress'] = 'Votre adresse IP'; 23 23 $lang['liste_ip']="Liste des IP (historique)"; -
extensions/Mail_supervisor/main.inc.php
r4206 r4220 14 14 15 15 /* EVENT_HANDLER_PRIORITY_NEUTRAL */ 16 17 18 19 global $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ; 20 $superv_champs = array( 21 "id", 22 "nb_mails", 23 "date_mail", 24 "nb_mails_maxi", 25 "nb_mails_periode", 26 "nb_spams", 27 "date_spam", 28 "nb_spams_maxi", 29 "nb_spams_periode", 30 "quarantaine", 31 "date_quarantaine", 32 "quarantaine_periode", 33 "message", 34 "message_test", 35 "header_text", 36 37 ); 38 39 $superv_type = array( 40 " SMALLINT( 5 ) NOT NULL DEFAULT '0'" , 41 "INT NOT NULL DEFAULT '0'" , 42 "INT NOT NULL DEFAULT '0'" , 43 "INT NOT NULL DEFAULT '2000'", 44 "TEXT" , 45 "INT NOT NULL DEFAULT '0'", 46 "INT NOT NULL DEFAULT '0'", 47 "INT NOT NULL DEFAULT '10'", 48 "TEXT" , 49 "TEXT" , 50 "INT NOT NULL DEFAULT '0'", 51 "TEXT" , 52 "TEXT" , 53 "TEXT" , 54 "TEXT" , 55 56 ); 57 58 59 $superv_bl_champs = array( 60 "id", 61 "ip", 62 "pays", 63 "region", 64 "ville", 65 "adresse", 66 "fai", 67 "nb" 68 ); 69 70 $superv_bl_type = array( 71 " smallint(5) UNSIGNED NOT NULL auto_increment ", 72 "TEXT" , 73 "TEXT" , 74 "TEXT" , 75 "TEXT" , 76 "TEXT" , 77 "TEXT" , 78 " smallint(5) UNSIGNED " 79 ); 16 80 17 81 -
extensions/Mail_supervisor/maintain.inc.php
r4206 r4220 27 27 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 28 28 include_once (MAIL_SUPERV_PATH.'include/constants.php'); 29 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 29 30 31 global $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ; 32 $superv_champs = array( 33 "id", 34 "nb_mails", 35 "date_mail", 36 "nb_mails_maxi", 37 "nb_mails_periode", 38 "nb_spams", 39 "date_spam", 40 "nb_spams_maxi", 41 "nb_spams_periode", 42 "quarantaine", 43 "date_quarantaine", 44 "quarantaine_periode", 45 "message", 46 "message_test", 47 "header_text", 48 49 ); 50 51 $superv_type = array( 52 " SMALLINT( 5 ) NOT NULL DEFAULT '0'" , 53 "INT NOT NULL DEFAULT '0'" , 54 "INT NOT NULL DEFAULT '0'" , 55 "INT NOT NULL DEFAULT '2000'", 56 "TEXT" , 57 "INT NOT NULL DEFAULT '0'", 58 "INT NOT NULL DEFAULT '0'", 59 "INT NOT NULL DEFAULT '10'", 60 "TEXT" , 61 "TEXT" , 62 "INT NOT NULL DEFAULT '0'", 63 "TEXT" , 64 "TEXT" , 65 "TEXT" , 66 "TEXT" , 67 68 ); 69 30 70 71 $superv_bl_champs = array( 72 "id", 73 "ip", 74 "pays", 75 "region", 76 "ville", 77 "adresse", 78 "fai", 79 "nb" 80 ); 81 82 $superv_bl_type = array( 83 " smallint(5) UNSIGNED NOT NULL auto_increment ", 84 "TEXT" , 85 "TEXT" , 86 "TEXT" , 87 "TEXT" , 88 "TEXT" , 89 "TEXT" , 90 " smallint(5) UNSIGNED " 91 ); 92 93 31 94 function plugin_install() 32 95 { 33 34 35 global $superv_bl_champs,$superv_bl_type ; 36 37 // efface free mail 38 $q = ' 39 SELECT count(`id`) as total FROM `'.PLUGINS_TABLE.'` WHERE `id` LIKE "free_mail" ;'; 40 $plugs = mysql_fetch_array(pwg_query($q),MYSQL_ASSOC); 41 $nb= $plugs['total']; 42 43 if (count($nb)>=1) { 44 /* $q = ' 45 UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE `id` LIKE "free_mail"'; 46 pwg_query($q); 47 pwg_query( $q );*/ 48 $q = ' 49 DELETE FROM '.PLUGINS_TABLE.' 50 WHERE `id` LIKE "free_mail" 51 ;'; 52 pwg_query($q); 53 $q = 'DROP TABLE IF EXISTS '.FREE_MAIL_TABLE.';'; 54 55 pwg_query( $q ); 56 $q = ' 57 DELETE FROM '.CONFIG_TABLE.' 58 WHERE param="free_mail" 59 ;'; 60 pwg_query($q); 61 62 63 64 } 65 66 67 68 pwg_query( $q ); 69 $q = ' 70 DELETE FROM '.CONFIG_TABLE.' 71 WHERE param="mail_superv" 72 ;'; 73 pwg_query($q); 74 75 76 $q = ' 96 global $conf ; 97 if ( !isset($conf['mail_superv']) ) 98 { 99 plugin_uninstall() ; 100 $query = ' 77 101 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 78 102 VALUES ("mail_superv","off,off,off,off,off,off,127.0.0.1","Parametres du plugin Mail superviseur") 79 ;'; 80 pwg_query($q); 81 82 83 84 vérif_base(); 85 create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; 103 ;'; 104 pwg_query($query); 105 //================================================================== 106 107 } 86 108 87 109 } … … 91 113 function plugin_uninstall() 92 114 { 93 global $conf;94 115 95 if (isset($conf['mail_superv'])) 96 { 97 98 $q = ' 116 $query = ' 99 117 DELETE FROM '.CONFIG_TABLE.' 100 118 WHERE param="mail_superv" 101 119 ;'; 102 103 pwg_query($q); 104 105 $q = 'DROP TABLE IF EXISTS '.MAIL_BLACK_LISTE_TABLE.';'; 106 pwg_query( $q ); 107 $q = 'DROP TABLE IF EXISTS '.MAIL_SUPERV_TABLE.';'; 108 pwg_query( $q ); 120 pwg_query($query); 121 $query = 'DROP TABLE IF EXISTS '.MAIL_BLACK_LISTE_TABLE.';'; 122 pwg_query( $query ); 123 $query = 'DROP TABLE IF EXISTS '.MAIL_SUPERV_TABLE.';'; 124 pwg_query( $query); 109 125 110 }111 126 112 127 } … … 114 129 function plugin_activate() 115 130 { 116 131 132 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 133 vérif_base() ; 117 134 118 135 }
Note: See TracChangeset
for help on using the changeset viewer.