Changeset 4888 for extensions/Mail_supervisor/include
- Timestamp:
- Feb 15, 2010, 3:51:00 PM (14 years ago)
- Location:
- extensions/Mail_supervisor/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Mail_supervisor/include/constants.php
r4879 r4888 8 8 9 9 10 global $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ; 11 12 13 $superv_champs = array( 14 "id", 15 "nb_mails", 16 "date_mail", 17 "nb_mails_maxi", 18 "nb_mails_periode", 19 "nb_spams", 20 "date_spam", 21 "nb_spams_maxi", 22 "nb_spams_periode", 23 "quarantaine", 24 "date_quarantaine", 25 "quarantaine_periode", 26 "message", 27 "message_test", 28 "header_text", 29 30 ); 31 32 $superv_type = array( 33 " SMALLINT( 5 ) NOT NULL DEFAULT '0'" , 34 "INT NOT NULL DEFAULT '0'" , 35 "INT NOT NULL DEFAULT '0'" , 36 "INT NOT NULL DEFAULT '2000'", 37 "TEXT" , 38 "INT NOT NULL DEFAULT '0'", 39 "INT NOT NULL DEFAULT '0'", 40 "INT NOT NULL DEFAULT '10'", 41 "TEXT" , 42 "TEXT" , 43 "INT NOT NULL DEFAULT '0'", 44 "TEXT" , 45 "TEXT" , 46 "TEXT" , 47 "TEXT" , 48 49 ); 50 51 52 $superv_bl_champs = array( 53 "id", 54 "ip", 55 "pays", 56 "region", 57 "ville", 58 "adresse", 59 "fai", 60 "nb" 61 ); 62 63 $superv_bl_type = array( 64 " smallint(5) UNSIGNED NOT NULL auto_increment ", 65 "TEXT" , 66 "TEXT" , 67 "TEXT" , 68 "TEXT" , 69 "TEXT" , 70 "TEXT" , 71 " smallint(5) UNSIGNED " 72 ); 73 10 74 ?> -
extensions/Mail_supervisor/include/fonctions.php
r4880 r4888 157 157 if ($erreur_message <> "") 158 158 { 159 $erreur_message =str_replace("\n",'<br />',$erreur_message) ;159 $erreur_message = str_replace("\n",'<br />',$erreur_message) ; 160 160 $template->assign('errors',$erreur_message); 161 $erreur_message ="";161 $erreur_message = ""; 162 162 } 163 163 } … … 169 169 if ($infos_message <> "") 170 170 { 171 $infos_message =str_replace("\n",'<br />',$infos_message) ;171 $infos_message = str_replace("\n",'<br />',$infos_message) ; 172 172 $template->assign('infos',$infos_message); 173 $infos_message ="";173 $infos_message = ""; 174 174 } 175 175 } … … 262 262 $data = mysql_fetch_array($result,MYSQL_ASSOC); 263 263 //==================================================================================== 264 265 $next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] );; 266 $data['rest_mail']= $next_day - time() ; 264 265 $next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] ); 266 $next_day = ($next_day >0) ? $next_day : (604800 + time()) ; 267 $data['rest_mail'] = $next_day - time() ; 267 268 268 269 $next_day = Str_To_Time( $data['nb_spams_periode'],$data['date_spam']); 269 $data['rest_spam']= $next_day - time() ; 270 $next_day = ($next_day >0) ? $next_day : (172800 + time()) ; 271 $data['rest_spam'] = $next_day - time() ; 270 272 271 273 272 274 $next_day = Str_To_Time($data['quarantaine_periode'] ,$data['date_quarantaine']); 275 $next_day = ($next_day >0) ? $next_day : (172800 + time()) ; 273 276 274 277 if ($data['quarantaine'] == 'true' ) { … … 309 312 function int_to_heure($int) 310 313 { 314 global $lang,$mails_données ; 315 316 $v0=Date_to_numeric(l10n('Day') ); 317 318 311 319 312 320 $delta=(7*24*60*60) ; … … 331 339 $minutes = substr ('00'.$minutes,-2,2); 332 340 $secondes = substr ('00'.$secondes,-2,2); 333 334 335 if ($week > 0 ) 336 { 337 return $week. " " .l10n('Sv_Week'). " " . $day . " " .l10n('Sv_Day'). "s ". $heures . " ". l10n('Sv_Hour'). "s " . $minutes. " " .l10n('Sv_Minute'). "s ". $secondes." " .l10n('Sv_Seconde')."s"; 338 } 339 return $day . " " .l10n('Sv_Day'). "s ". $heures . " ". l10n('Sv_Hour'). "s " . $minutes. " " .l10n('Sv_Minute'). "s ". $secondes." " .l10n('Sv_Seconde')."s"; 341 342 $retour=""; 343 $Week=explode(" ",l10n('Week %d')); 344 $Week= ($Week[0]); 345 346 if ($week > 0 ) $retour .= "+" . $week ." " . $Week ; 347 if ($day > 0) $retour .= "+" . $day ." " .l10n('Day'); 348 if ($heures > 0) $retour .= "+" . $heures." " .l10n('Hour'); 349 if ($minutes > 0) $retour .= "+" . $minutes." " .l10n('Minute'); 350 if ($secondes > 0) $retour .= "+" . $secondes." " .l10n('Second'); 351 $retour=str_replace("+0","+",$retour); 352 //================================================================================================ 353 354 355 return $retour; 340 356 341 357 } … … 372 388 time(), 373 389 2000, 374 '" 1 '.l10n('Sv_Week').'"' ,390 '"604800"' , 375 391 0, 376 392 time(), 377 393 10, 378 '" 2 '.l10n('Sv_Day').'"',394 '"172800"', 379 395 '"false"', 380 396 time(), 381 '"2 '.l10n('Sv_Day').'"', 382 383 '"Init"', 397 '"172800"', 398 '"Init"', 384 399 '"'.l10n('Sv_supervisor').'"', 385 '"'.l10n(' Sv_hello').'"',400 '"'.l10n('hello').'"', 386 401 ) 387 402 ; … … 528 543 } 529 544 //===================================================================== 530 531 function Str_To_Time( $ajout,$init_date) 532 { 533 //======================================================== 534 global $erreur_message,$infos_message; 535 536 537 $a_ajouter = strtolower($ajout) ; 538 if (strlen($a_ajouter) <4) $a_ajouter=$a_ajouter." " ; 539 $period_search=array("s ","j ","h ","m ","s "); 540 array_push($period_search,"w ","d ","h ","m ","s "); 541 array_push($period_search,l10n('Sv_Week').'s',l10n('Sv_Day').'s',l10n('Sv_Hour').'s',l10n('Sv_Minute').'s',l10n('Sv_Seconde').'s'); 542 array_push($period_search,l10n('Sv_Week'),l10n('Sv_Day'),l10n('Sv_Hour'),l10n('Sv_Minute'),l10n('Sv_Seconde')); 543 544 $period_match = array(' week ',' day ',' hour ',' minute ',' seconde '); 545 array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde '); 546 array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde '); 547 array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde '); 548 549 550 551 $a_ajouter = "+ " . str_replace($period_search, $period_match, $a_ajouter) ; 545 function vérif_mails_données() 546 { 547 global $mails_données,$infos_message,$erreur_message,$page; 548 549 if (!is_numeric($mails_données['nb_mails_periode'])) 550 { 551 $periode = Str_To_Time( $mails_données['nb_mails_periode'],0); 552 $mails_données['nb_mails_periode']= ($periode > 0) ? $periode : '604800' ; 553 } 554 555 if (!is_numeric($mails_données['nb_spams_periode'])) 556 { 557 558 $periode=Str_To_Time( $mails_données['nb_spams_periode'],0); 559 $mails_données['nb_spams_periode']= ($periode > 0) ? $periode : '172800' ; ; 560 } 561 if (!is_numeric($mails_données['quarantaine_periode'])) 562 { 563 $periode=Str_To_Time( $mails_données['quarantaine_periode'],0); 564 $mails_données['quarantaine_periode']= ($periode > 0) ? $periode : '172800' ; 565 } 566 567 if ($infos_message != "") { 568 array_push($page['infos'], $infos_message); 569 $infos_message=""; 570 } 571 572 if ($erreur_message != "") { 573 array_push($page['errors'], $erreur_message); 574 $erreur_message =""; 575 } 576 577 } 578 //======================================================================= 579 function Date_to_numeric( $Valeurs ) 580 { 581 global $lang,$erreur_message,$infos_message; 582 583 $a_ajouter = $Valeurs ; 584 585 586 if (!isset($lang['Sv_second'])) { 587 $Week=explode(" ",l10n('Week %d')); 588 $Week= ($Week[0]); 589 590 $lang['Sv_week'] = $Week; 591 $lang['Sv_day'] = l10n('Day') ; 592 $lang['Sv_hour'] = l10n('Hour') ; 593 $lang['Sv_minute'] = l10n('Minute') ; 594 $lang['Sv_second'] = l10n('Second'); 595 596 $lang['Sv_'. $lang['Sv_week']] = 'week'; 597 $lang['Sv_'. $lang['Sv_day']] = 'day'; 598 $lang['Sv_'. $lang['Sv_hour']] = 'hour'; 599 $lang['Sv_'. $lang['Sv_minute']] = 'minute'; 600 $lang['Sv_'. $lang['Sv_second']] = 'second'; 601 602 } 603 //--- traduction --> anglais --- 604 605 //========= suppression numéric et symbole ========== 606 $new_valeur =( preg_replace("/[0-9+\-.*\/()%]/"," ",$a_ajouter)); 607 $nv = trim( sup_double_espace($new_valeur)) ; 608 609 610 611 $conv['week']= (7*24*60*60); 612 $conv['day']= (24*60*60); 613 $conv['hour']= (60*60) ; 614 $conv['minute']= 60 ; 615 $conv['second']= 1; 616 617 $nv = explode(" ", $nv ); 618 619 foreach($nv as $nv1) 620 { 621 if (!isset($lang['Sv_'. $nv1]) ) { 622 //==== au cas pluriel === 623 624 $nv0 = substr($nv1, 0,-1) ; 625 $a_ajouter= str_replace( $nv1,$nv0, $a_ajouter); 626 $nv1 = $nv0 ; 627 628 } 629 630 if (!isset($lang['Sv_'. $nv1]) ) { 631 $erreur_message .= $nv1. " ".l10n('not_found')."<br />"; 632 // die($erreur_message); 633 634 }else { 635 ob_start(); 636 $match = $conv[strtolower($lang['Sv_'. $nv1])] ; 637 $a_ajouter = str_replace($nv1," ". $match ." ",$a_ajouter) ; 638 $erreur_message .= ob_get_contents(); 639 ob_end_clean(); 640 } 641 642 } 643 644 $a_ajouter = "+ " . $a_ajouter ; 552 645 $a_ajouter=sup_double_espace($a_ajouter); 553 554 $v1 = array('- ','+ ','week','day','hour','minute','seconde',' -',' +',' '); 555 $v2 = array('-','+', (7*24*60*60) , (24*60*60), (60*60), 60,1,'|-','|+',"*" ); 556 646 $v1 = array('- ','+ ',' -', ' +', ' '); 647 $v2 = array('-' ,'+' ,'|-', '|+', "*"); 557 648 558 649 $new_valeur = str_replace($v1,$v2,$a_ajouter) ; 559 650 $new_valeur = str_replace('++','+',$new_valeur ) ; 560 561 $new_valeur = explode( "|",$new_valeur ); 651 652 return $new_valeur; 653 } 654 //===================================================================== 655 function Str_To_Time( $ajout,$init_date) 656 { 657 //======================================================== 658 global $erreur_message,$infos_message,$user; 659 global $lang; 660 661 $ajout=ucwords ($ajout); 662 663 664 if (is_numeric($ajout)) 665 $valeur= $ajout ; 666 else 667 { 668 $valeur= Date_to_numeric( $ajout) ; 669 670 } 671 672 $new_valeur = explode( "|", $valeur ); 673 562 674 $p = $init_date ; 563 675 $n0=0; 676 $erreur = false; 677 564 678 //$new_valeur = $a_ajouter + $init_date ; 565 679 foreach($new_valeur as $nv) … … 570 684 }else { 571 685 $erreur_message .= "[" . $ajout . "] --> " . l10n('Sv_syntax_error') . " : " . $nv ."<br />"; 686 $erreur = true; 572 687 } 573 688 574 689 575 690 } 576 577 return $p;691 if ($erreur) $p = -1000 ; 692 return intval($p) ; 578 693 579 694 } … … 908 1023 } 909 1024 910 1025 function Get_Version_plugins($dir) 1026 { 1027 $path = $dir; 1028 $plg_data = implode( '', file($path.'main.inc.php') ); 1029 if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) ) 1030 { 1031 $plugin['name'] = trim( $val[1] ); 1032 } 1033 if (preg_match("|Version: (.*)|", $plg_data, $val)) 1034 { 1035 $plugin['version'] = trim($val[1]); 1036 } 1037 if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) ) 1038 { 1039 $plugin['uri'] = trim($val[1]); 1040 } 1041 if ($desc = load_language('description.txt', $path.'/', array('return' => true))) 1042 { 1043 $plugin['description'] = trim($desc); 1044 } 1045 elseif ( preg_match("|Description: (.*)|", $plg_data, $val) ) 1046 { 1047 $plugin['description'] = trim($val[1]); 1048 } 1049 if ( preg_match("|Author: (.*)|", $plg_data, $val) ) 1050 { 1051 $plugin['author'] = trim($val[1]); 1052 } 1053 if ( preg_match("|Author URI: (.*)|", $plg_data, $val) ) 1054 { 1055 $plugin['author uri'] = trim($val[1]); 1056 } 1057 if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid=')) 1058 { 1059 list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']); 1060 if (is_numeric($extension)) $plugin['extension'] = $extension; 1061 } 1062 // IMPORTANT SECURITY ! 1063 $plugin = array_map('htmlspecialchars', $plugin); 1064 1065 return $plugin ; 1066 1067 } 911 1068 ?> -
extensions/Mail_supervisor/include/function_test_send.php
r4879 r4888 102 102 { 103 103 if ($group_name<>'') { 104 $infos_message .= '<br />'. sprintf( l10n(' Sv_An information email was sent to group "%s"'), $group_name ).'<br />';104 $infos_message .= '<br />'. sprintf( l10n('An information email was sent to group "%s"'), $group_name ).'<br />'; 105 105 } 106 106 if ($mailto <> '') { -
extensions/Mail_supervisor/include/save_info.php
r4229 r4888 1 1 <?php 2 3 4 2 //======================================================================================= 5 6 7 3 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 8 9 10 11 12 4 13 5 switch (strtolower($info_ip))
Note: See TracChangeset
for help on using the changeset viewer.