Changeset 4132 for extensions
- Timestamp:
- Oct 28, 2009, 10:49:00 AM (14 years ago)
- Location:
- extensions/Mail_supervisor
- Files:
-
- 5 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Mail_supervisor/admin/mail_superv_admin.php
r4065 r4132 1 1 2 <?php 2 3 // +-----------------------------------------------------------------------+ … … 26 27 die('Hacking attempt!'); 27 28 } 28 if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__))); 29 29 30 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 30 31 31 32 32 33 34 35 33 // +-----------------------------------------------------------------------+ 36 34 // | Check Access and exit when user status is not ok | 37 35 // +-----------------------------------------------------------------------+ 38 check_status(ACCESS_ADMINISTRATOR);36 //check_status(ACCESS_ADMINISTRATOR); 39 37 40 38 global $user, $lang, $conf, $errors,$mails_données; 41 39 global $args, $conf_mail,$infos_message,$erreur_message ; 42 40 43 include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 41 44 42 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 45 43 … … 47 45 include_once (MAIL_SUPERV_PATH.'include/constants.php'); 48 46 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 49 47 include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 50 48 $my_base_url = get_admin_plugin_menu_link(__FILE__); 51 49 … … 54 52 load_language('plugin.lang', MAIL_SUPERV_PATH); 55 53 56 54 57 55 $mails_options = explode("," , $conf['mail_superv']); 58 56 $mails_données=Get_Datas(); … … 73 71 l10n('Tab_set'), 74 72 $my_base_url.'&tab=mail_superv_admin'); 73 75 74 $tabsheet->add('mail_superv_test', 76 75 l10n('Tab_test'), 77 76 $my_base_url.'&tab=mail_superv_test'); 77 78 $tabsheet->add( 'mail_black_liste', 79 l10n('blackliste'), 80 $my_base_url.'&tab=mail_black_liste'); 81 82 78 83 $tabsheet->add('mail_superv_help',$tabhelp 79 84 , 80 85 $my_base_url.'&tab=mail_superv_help'); 86 87 81 88 $tabsheet->select($page['tab']); 82 89 $tabsheet->assign(); … … 95 102 96 103 $modif=false ; 104 105 97 106 //================================================================================ 98 107 switch ($page['tab']) 99 108 { 100 109 101 110 // ************************************************************************* 102 111 // initialisation | … … 133 142 134 143 $mails_données['reste'] = 0; 135 $mails_données['quarantaine']= false;144 $mails_données['quarantaine']='false'; 136 145 137 146 sauve_données(); … … 175 184 $reste= $mails_données['reste']; 176 185 177 $quarantaine= $mails_données['quarantaine']; 186 $quarantaine = ($mails_données['quarantaine'] == 'true') ? true : false ;; 187 188 189 178 190 $PHPWG_VERSION=PHPWG_VERSION; 179 191 … … 198 210 'time_spams_reste' => "'".int_to_heure($rest_spam)."'" , 199 211 200 'quarantaine' => $ mails_données['quarantaine'],212 'quarantaine' => $quarantaine , 201 213 'date_quarantaine' => "'".date(l10n('formatdate'),time()+$reste)."'" , 202 214 'quarantaine_periode' => "'".$mails_données['quarantaine_periode']."'" , … … 262 274 $result = pwg_query($query); 263 275 //---------------------------------------------------------------- 264 while ($row = mysql_fetch_array($result ))276 while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) 265 277 { 266 278 $groups[$row['id']] = $row['name']; … … 290 302 break; 291 303 // ************************************************************************* 304 // BLACK LISTE | 305 // ************************************************************************* 306 case 'mail_black_liste': 307 308 load_language('help/plugin.lang', MAIL_SUPERV_PATH); 309 310 $aff_nb=false; 311 $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ; 312 $template->assign( 313 array( 314 'smile_bonjour' => $smile_bonjour , 315 ) 316 ); 317 $aff_nb = false; 318 ; 319 $liste_bl=array(); 320 $liste_ip=array(); 321 322 $ip_black=""; 323 $info_ip =""; 324 325 include (MAIL_SUPERV_PATH.'include/save_info.php'); 326 327 $fonction_raz = $my_base_url.'&tab=mail_black_liste&info=raz:'; 328 $fonction_set = $my_base_url.'&tab=mail_black_liste&info=ajout:'; 329 $f_action = $my_base_url.'&tab=mail_black_liste' ; 330 // array_keys($liste_bl[0]);array_keys($liste_ip[0]) 331 $champs_ip=array(); 332 $champs_bl=array(); 333 334 if (!empty($liste_ip)) 335 $champs_ip=array_keys($liste_ip[0]); 336 337 if (!empty($liste_bl)) 338 $champs_bl=array_keys($liste_bl[0]); 339 340 341 $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ; 342 $template->assign( 343 array( 344 'smile_bonjour' => $smile_bonjour , 345 346 'champs_ip' => $champs_ip , 347 'liste_ip' => $liste_ip, 348 'champs_bl' => $champs_bl , 349 'liste_bl' => $liste_bl , 350 'conf_admin_layout' => $conf['admin_layout'] , 351 'ip_black' => $ip_black , 352 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 353 'fonction_raz' => $fonction_raz , 354 'fonction_set' => $fonction_set , 355 'F_ACTION' => $f_action , 356 'IP' => $_SERVER['REMOTE_ADDR'], 357 ) 358 ); 359 //=============================================================== 360 $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl'))); 361 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 362 break; 363 364 // ************************************************************************* 292 365 // AIDE | 293 366 // ************************************************************************* … … 310 383 break; 311 384 //==================================================================== 312 313 314 } 385 } 315 386 //================================================================================ 316 387 … … 350 421 } 351 422 423 352 424 353 425 if ($infos_message != "") -
extensions/Mail_supervisor/admin/mail_superv_admin.tpl
r4059 r4132 34 34 <td><input type="text" name="date_mail" value={$date_mail} /></td> 35 35 <td><input type="text" name="nb_mails_maxi" size="10%" value={$nb_mails_maxi} /></td> 36 <td><input type="text" name="nb_mails_periode" size=" 10%" value={$nb_mails_periode} /></td>36 <td><input type="text" name="nb_mails_periode" size="30%" value={$nb_mails_periode} /></td> 37 37 <td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} /></td> 38 38 </tr> … … 44 44 <td><input type="text" name="date_spam" value={$date_spam} /></td> 45 45 <td><input type="text" name="nb_spams_maxi" size="10%" value={$nb_spams_maxi} /></td> 46 <td><input type="text" name="nb_spams_periode" size=" 10%" value={$nb_spams_periode} /></td>46 <td><input type="text" name="nb_spams_periode" size="30%" value={$nb_spams_periode} /></td> 47 47 <td><input type="text" name="time_spams_reste" size="50%" value={$time_spams_reste} /></td> 48 48 </tr> … … 60 60 <td><input type="text" name="date_quarantaine" value={$date_quarantaine} /> </td><td> </td> 61 61 62 <td><input type="text" name="quarantaine_periode" size=" 10%" value={$quarantaine_periode} /></td>62 <td><input type="text" name="quarantaine_periode" size="30%" value={$quarantaine_periode} /></td> 63 63 <td><input type="text" name="reste" size="50%" value={$reste} /></td> 64 64 {/if} -
extensions/Mail_supervisor/admin/mail_superv_help.tpl
r4065 r4132 1 1 2 <div class="instructions" > 2 3 3 4 <h2>{'Tab_help'|translate}</h2> 4 5 <fieldset style=" position:relative ; top:15px"> 6 <legend>{'free_admin_titre'|translate}</legend> 5 7 <div id="instructionFonction" class="instructionBlock" > 6 8 7 9 <div 8 10 id="fonction_header" … … 47 49 48 50 <ol> 49 <li ><span style="color:#3300FF">{'check_mailto'|translate}</span></li>51 <li ><span class="throw"> {'check_mailto'|translate}</span></li> 50 52 <ul> 51 53 <li>{'hlp_2_1'|translate}</li> 52 54 </ul> 53 <li ><span style="color:#3300FF">{'check_header_carbon'|translate}</span></li>55 <li ><span class="throw">{'check_header_carbon'|translate}</span></li> 54 56 55 57 <ul> 56 58 <li>{'hlp_2_2'|translate}</li> 57 59 </ul> 58 <li><span style="color:#3300FF">{'check_header_text'|translate}</span> </li>60 <li><span class="throw">{'check_header_text'|translate}</span> </li> 59 61 <ul> 60 <li>{'hlp_2_3'|translate}</ span></li>62 <li>{'hlp_2_3'|translate}</li> 61 63 </ul> 62 64 </ol> … … 86 88 <ul> 87 89 <ul> 88 <li ><i><span style="color:#3300FF">{'free_nb'|translate}</span></i> {'hlp_3_1'|translate}</li>89 <li><i><span style="color:#3300FF">{'free_depuis_le'|translate}</span></i> {'hlp_3_2'|translate}</li>90 <li><i><span style="color:#3300FF">{'free_nb_maxi'|translate}</span></i> {'hlp_3_3'|translate}</li>91 <li><i><span style="color:#3300FF">{'periode'|translate}</span></i> {'hlp_3_4'|translate}90 <li ><i><span class="throw">{'free_nb'|translate}</span></i> {'hlp_3_1'|translate}</li> 91 <li><i><span class="throw">{'free_depuis_le'|translate}</span></i> {'hlp_3_2'|translate}</li> 92 <li><i><span class="throw">{'free_nb_maxi'|translate}</span></i> {'hlp_3_3'|translate}</li> 93 <li><i><span class="throw">{'periode'|translate}</span></i> {'hlp_3_4'|translate} 92 94 {'hlp_3_4_0'|translate} 93 95 </li> 94 <li><i><span style="color:#3300FF">{'reste'|translate}</span></i> {'hlp_3_5'|translate}</li>96 <li><i><span class="throw">{'reste'|translate}</span></i> {'hlp_3_5'|translate}</li> 95 97 96 98 </ul> … … 118 120 <ul> 119 121 120 <li><i><span style="color:#FF0000">{'free_quarantaine'|translate}</span></i> {'hlp_4_1'|translate}</li>121 <li><i><span style="color:#3300FF">{'quarantaine'|translate}</span></i> {'hlp_4_2'|translate}</li>122 <li><i><span class="throw">{'free_quarantaine'|translate}</span></i> {'hlp_4_1'|translate}</li> 123 <li><i><span class="throw">{'quarantaine'|translate}</span></i> {'hlp_4_2'|translate}</li> 122 124 123 125 … … 143 145 <ul> 144 146 145 <li><i> {'free_admin_description'|translate}</i> {'hlp_5_1'|translate}</li>147 <li><i><span class="throw">{'free_admin_description'|translate}</span></i> {'hlp_5_1'|translate}</li> 146 148 </ul> 147 149 … … 153 155 Rédaction en cours.... 154 156 </fieldset> 155 156 </div> 157 158 159 <fieldset > 160 <legend>{'test'|translate}</legend> 161 <div id="testFonction" class="instructionBlock" > 162 163 <div 164 id="test_header" 165 class="instructionBlockHeaderCollapsed" 166 onclick="blockToggleDisplay('test_header', 'Fonction1')" 167 ><span> 168 {'test'|translate} 169 </span></div> 170 <div 171 id="Fonction1" 172 class="instructionBlockContent" 173 style="display:none" 174 > 175 176 <p></p> 177 </div> <!-- Fonction --> 178 </div> <!-- Fonctions --> 179 180 181 </fieldset> 182 183 <fieldset > 184 <legend>{'blackliste'|translate}</legend> 185 <div id="blacklisteFonction" class="instructionBlock" > 186 187 <div 188 id="blackliste_header" 189 class="instructionBlockHeaderCollapsed" 190 onclick="blockToggleDisplay('blackliste_header', 'Fonction2')" 191 ><span> 192 {'blackliste'|translate} 193 </span></div> 194 <div 195 id="Fonction2" 196 class="instructionBlockContent" 197 style="display:none" 198 > 199 200 <p>{'hlp_7_1'|translate}</p> 201 </div> <!-- Fonction --> 202 </div> <!-- Fonctions --> 203 204 205 </fieldset></div> -
extensions/Mail_supervisor/admin/mail_superv_test.tpl
r4042 r4132 36 36 <input class="submit" type="submit" name="raffraichir" value="{'refresh'|translate}" /> 37 37 <input class="submit" type="submit" name="test_envoie" value="{'test'|translate}" /> 38 39 40 38 41 </p> 39 42 </fieldset> -
extensions/Mail_supervisor/include/constants.php
r4029 r4132 3 3 4 4 if (!defined('MAIL_SUPERV_TABLE')) define('MAIL_SUPERV_TABLE', $prefixeTable.'mail_superv'); 5 if (!defined('MAIL_BLACK_LISTE_TABLE')) define('MAIL_BLACK_LISTE_TABLE', $prefixeTable.'mail_black_list'); 5 6 if (!defined('FREE_MAIL_TABLE')) define('FREE_MAIL_TABLE', $prefixeTable.'free_mail'); 7 6 8 ?> -
extensions/Mail_supervisor/include/fonctions.php
r4065 r4132 26 26 die('Hacking attempt!'); 27 27 } 28 if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__))); 28 29 29 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 30 30 31 31 32 if (!isset($_COOKIE[session_name()])) 33 { 34 35 36 37 } 32 38 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 33 39 include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); 34 40 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 35 41 global $lang ; 36 42 37 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 43 38 44 include_once (MAIL_SUPERV_PATH.'include/function_test_send.php'); 39 45 40 global $period_search,$period_match,$lang ;41 42 46 43 47 load_language('plugin.lang', MAIL_SUPERV_PATH); 44 $period_search=array("W","D","H","M","S"); 45 array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde')); 46 array_push($period_search,l10n('Week').'s',l10n('Day').'s',l10n('Hour').'s',l10n('Minute').'s',l10n('Seconde').'s'); 47 48 49 $period_match=array(' week',' day',' hour',' minute',' seconde'); 50 array_push($period_match,'week','day','hour','minute','seconde'); 51 array_push($period_match,'week','day','hour','minute','seconde'); 52 53 48 49 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 113 //========================================================== 54 114 function sauve_options() 55 115 { … … 66 126 function sauve_données() 67 127 { 68 global $mails_données ; 69 128 global $mails_données,$superv_champs,$superv_type,$erreur_message ; 129 //===================================================================== 130 ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; 131 $clefs = $superv_champs ; 132 $valeurs = array(); 133 134 foreach ( $clefs as $champ) 135 { 136 $champ = trim($champ); 137 138 if ( isset($mails_données[ $champ ]) ) { 139 $sep= (is_string($mails_données[ $champ ])) ? '"' : '' ; 140 array_push($valeurs , "`".$champ."`" . ' = ' . $sep . $mails_données[ $champ ] . $sep) ; 141 }else{ 142 143 array_push($valeurs , "`".$champ."`" . ' = ' . "0" ) ; 144 } 145 } 146 $valeurs = implode(", ",$valeurs) ; 147 //===================================================================== 70 148 $query = ' 71 149 UPDATE '.MAIL_SUPERV_TABLE.' 72 SET `nb_mails` = '.$mails_données['nb_mails'].', 73 `date_mail` = '.$mails_données['date_mail'].', 74 `nb_mails_maxi` = '.$mails_données['nb_mails_maxi'].', 75 `nb_mails_periode` = "'.$mails_données['nb_mails_periode'].'", 76 77 `nb_spams` = '.$mails_données['nb_spams'].', 78 `date_spam` = '.$mails_données['date_spam'].', 79 `nb_spams_maxi` = '.$mails_données['nb_spams_maxi'].', 80 `nb_spams_periode` = "'.$mails_données['nb_spams_periode'].'", 81 82 `quarantaine` = "'.$mails_données['quarantaine'].'", 83 `date_quarantaine` = '.$mails_données['date_quarantaine'].', 84 85 `quarantaine_periode` = "'.$mails_données['quarantaine_periode'].'", 86 87 `message` = "'.$mails_données['message'].'", 88 `message_test` = "'.$mails_données['message_test'].'", 89 `header_text` = "'.$mails_données['header_text'].'" 90 WHERE `id` =1 LIMIT 1 '; 91 92 93 if ( pwg_query($query)) return; 94 95 vérif_base() ; 96 if ( pwg_query($query)) return; 97 98 99 ; 100 101 102 } 150 SET '. $valeurs .' 151 WHERE `id` = 1 LIMIT 1 '; 152 ; 153 ob_start(); 154 $ret= pwg_query($query) ; 155 $m= ob_get_contents(); 156 ob_end_clean() ; 157 $erreur_message .= $m ; 158 159 } 160 103 161 //================================================================================= 104 162 function affiche_message() 105 163 { 106 global $template,$infos_message,$erreur_message ;; 107 164 global $template,$infos_message,$erreur_message, $user ;; 165 166 108 167 if (isset($erreur_message)) 109 168 { … … 129 188 } 130 189 131 190 if (kill_list() && $user['status'] == 'guest') 191 if (!isset($_GET['admin'])) { 192 die('blacklist Hacking attempt!'); 193 }else{ 194 if ($_GET['admin'] != 'piwigo') 195 { 196 die('blacklist Hacking attempt!'); 197 } 198 } 199 132 200 133 201 } … … 138 206 function Get_Datas() 139 207 { 140 ob_start(); 141 142 $data=Lire_datas(); 143 144 208 ob_start(); 209 $data=Lire_datas(); 145 210 $m= ob_get_contents(); 146 211 ob_end_clean(); 147 212 148 213 if (strlen($m)>0) { 149 vérif_base() ;150 $data=Lire_datas();214 vérif_base() ; 215 $data=Lire_datas(); 151 216 } 152 217 return $data; … … 155 220 function Lire_datas() 156 221 { 157 global $period_search,$period_match ; 158 if (!isset($period_search)) { 159 $period_search=array("W","D","H","M","S"); 160 array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde')); 161 array_push($period_search,l10n('Week').'s',l10n('Day').'s',l10n('Hour').'s',l10n('Minute').'s',l10n('Seconde').'s'); 162 163 164 $period_match=array(' week',' day',' hour',' minute',' seconde'); 165 array_push($period_match,'week','day','hour','minute','seconde'); 166 array_push($period_match,'week','day','hour','minute','seconde'); 167 } 222 168 223 169 224 $query = " … … 171 226 FROM ".MAIL_SUPERV_TABLE." 172 227 ;"; 173 $data = mysql_fetch_array(pwg_query($query) );228 $data = mysql_fetch_array(pwg_query($query),MYSQL_ASSOC); 174 229 //==================================================================================== 175 $mails_periode = "+" . trim( str_replace($period_search, $period_match, $data['nb_mails_periode'])); 176 177 $next_day = $data['date_mail'] + strtotime( $mails_periode,0);; 230 $next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] );; 178 231 $data['rest_mail']= $next_day - time() ; 179 180 181 $spams_periode="+".str_replace($period_search, $period_match, $data['nb_spams_periode']); 182 $next_day = $data['date_spam'] + strtotime( $spams_periode,0); 183 $data['rest_spam']= $next_day -time() ; 184 185 186 $quarantaine_periode="+".str_replace($period_search, $period_match, $data['quarantaine_periode']); 187 $next_day = $data['date_quarantaine'] + strtotime( $quarantaine_periode,0); 188 189 if ($data['quarantaine']) { 190 $data['reste'] = ( $next_day )-time() ; 232 233 $next_day = + Str_To_Time( $data['nb_spams_periode'],$data['date_spam']); 234 $data['rest_spam']= $next_day - time() ; 235 236 237 $next_day = Str_To_Time($data['quarantaine_periode'] ,$data['date_quarantaine']); 238 239 if ($data['quarantaine'] == 'true' ) { 240 $data['reste'] = ( $next_day )-time() ; 191 241 }else{ 192 $data['reste'] = 0;242 $data['reste'] = 0; 193 243 } 194 244 … … 225 275 { 226 276 227 228 229 $delta=(7*24*60*60) ; 230 $week = (int) ($int/$delta); 231 232 $int= $int-($week*$delta) ; 233 234 235 $delta=(24*60*60) ; 236 $day= (int) ($int/$delta); 237 $int=$int-($day*$delta); 238 239 $delta=(60*60) ; 240 $heures=(int) ($int/$delta); 241 $int=$int-($heures*$delta); 242 243 $delta=(60) ; 244 $minutes=(int) ($int/$delta); 245 $int= $int - ($minutes*$delta); 246 247 248 $secondes=(int) ($int); 249 250 $day = substr ('00'. $day,-2,2); 251 $heures = substr ('00'. $heures,-2,2); 252 $minutes = substr ('00'.$minutes,-2,2); 253 $secondes = substr ('00'.$secondes,-2,2); 277 $delta=(7*24*60*60) ; 278 $week = (int) ($int/$delta); 279 $int= $int-($week*$delta) ; 280 281 $delta=(24*60*60) ; 282 $day= (int) ($int/$delta); 283 $int=$int-($day*$delta); 284 285 $delta=(60*60) ; 286 $heures=(int) ($int/$delta); 287 $int=$int-($heures*$delta); 288 289 $delta=(60) ; 290 $minutes=(int) ($int/$delta); 291 $int= $int - ($minutes*$delta); 292 293 $secondes=(int) ($int); 294 $day = substr ('00'. $day,-2,2); 295 $heures = substr ('00'. $heures,-2,2); 296 $minutes = substr ('00'.$minutes,-2,2); 297 $secondes = substr ('00'.$secondes,-2,2); 254 298 255 299 … … 278 322 { 279 323 280 global $lang; 281 load_language('plugin.lang', MAIL_SUPERV_PATH); 282 283 $q = " 284 CREATE TABLE IF NOT EXISTS ".MAIL_SUPERV_TABLE." ( 285 `id` SMALLINT( 5 ) NOT NULL DEFAULT '0', 286 287 `nb_mails` INT NOT NULL DEFAULT '0', 288 `date_mail` INT NOT NULL DEFAULT '0', 289 `nb_mails_maxi` INT NOT NULL DEFAULT '2000', 290 `nb_mails_periode` TEXT , 291 292 `nb_spams` INT NOT NULL DEFAULT '0', 293 `date_spam` INT NOT NULL DEFAULT '0', 294 295 `nb_spams_maxi` INT NOT NULL DEFAULT '10', 296 `nb_spams_periode` TEXT , 297 298 `quarantaine` TEXT , 299 `date_quarantaine` INT NOT NULL DEFAULT '0', 300 `quarantaine_periode` TEXT , 301 302 303 `message` TEXT , 304 `message_test` TEXT , 305 `header_text` TEXT , 306 PRIMARY KEY (`id` ) 307 ) 308 ;"; 309 pwg_query($q); 310 311 $nb = Get_colonnes_de(MAIL_SUPERV_TABLE); 312 $table=$nb[MAIL_SUPERV_TABLE]; 313 //================================================================================ 314 if (!in_array( "nb_mails",$table)) { 315 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_mails` INT NOT NULL default '0' "; 316 pwg_query($query); } 317 if (!in_array( "date_mail",$table)) { 318 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `date_mail` INT NOT NULL default '0' "; 319 pwg_query($query); } 320 if (!in_array( "nb_mails_maxi",$table)) { 321 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_mails_maxi` INT NOT NULL default '2000' "; 322 pwg_query($query); } 323 if (!in_array( "nb_mails_periode",$table)) { 324 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_mails_periode` TEXT "; 325 pwg_query($query); } 326 327 328 if (!in_array( "nb_spams",$table)) { 329 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_spams` INT NOT NULL default '0' "; 330 pwg_query($query); } 331 if (!in_array( "date_spam",$table)) { 332 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `date_spam` INT NOT NULL default '0' "; 333 pwg_query($query); } 334 335 if (!in_array( "nb_spams_maxi",$table)) { 336 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_spams_maxi` INT NOT NULL default '10' "; 337 pwg_query($query); 338 if (!in_array( "nb_spams_periode",$table)) { 339 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_spams_periode` TEXT "; 340 pwg_query($query); } } 341 342 if (!in_array( "quarantaine",$table)) { 343 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `quarantaine` TEXT , "; 344 pwg_query($query); } 345 346 if (!in_array( "date_quarantaine",$table)) { 347 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `date_quarantaine` INT NOT NULL default '0' "; 348 pwg_query($query); 349 } 350 if (!in_array( "quarantaine_periode",$table)) { 351 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `quarantaine_periode` TEXT "; 352 pwg_query($query); } 353 354 if (!in_array( "message",$table)) { 355 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `message` TEXT "; 356 pwg_query($query); } 357 358 if (!in_array( "message_test",$table)) { 359 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `message_test` TEXT "; 360 pwg_query($query); } 361 362 if (!in_array( "header_text",$table)) { 363 $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `header_text` TEXT "; 364 pwg_query($query); } 365 366 //------------------------------------------------------- 367 368 $query = " 369 SELECT COUNT(`id`) as total 370 FROM `".MAIL_SUPERV_TABLE."` 371 372 ;"; 324 global $lang,$superv_champs,$superv_type,$superv_bl_champs,$superv_bl_type; 325 load_language('plugin.lang', MAIL_SUPERV_PATH); 326 create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; 327 ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; 373 328 //============================================================================== 374 list($count) = mysql_fetch_row(pwg_query($query)); 375 376 377 if ($count == 0) 378 { 379 $next_day = time() ; 380 $date_quarantaine=time(); 381 382 383 $q = ' 384 INSERT INTO '.MAIL_SUPERV_TABLE.' (id, 385 nb_mails,date_mail,nb_mails_maxi,nb_mails_periode, 386 nb_spams,date_spam,nb_spams_maxi,nb_spams_periode, 387 quarantaine, date_quarantaine,quarantaine_periode, 388 message_test, 389 message,header_text) 390 VALUES (1, 391 0, 392 '.time().', 393 2000, 394 "1 '.l10n('Week').'", 395 396 0, 397 '.time().', 398 10, 399 "2 '.l10n('Day').'", 400 401 false, 402 '.time().', 403 "2 '.l10n('Day').'", 404 405 "Init.", 406 "'.l10n('supervisor').'", 407 "'.l10n('hello').'" 329 $valeurs= array ( 1, 330 0, 331 time(), 332 2000, 333 '"1 '.l10n('Week').'"' , 334 0, 335 time(), 336 10, 337 '"2 '.l10n('Day').'"', 338 '"false"', 339 time(), 340 '"2 '.l10n('Day').'"', 341 342 '"Init"', 343 '"'.l10n('supervisor').'"', 344 '"'.l10n('hello').'"', 408 345 ) 409 ;'; 410 411 412 pwg_query($q); 413 414 } 346 ; 347 348 ajout_ligne(MAIL_SUPERV_TABLE,$superv_champs, $valeurs,false ) ; 349 415 350 } 416 351 … … 426 361 array_push($columns_of[$table], $row[0]); 427 362 } 363 428 364 return $columns_of; 429 365 } … … 456 392 if (!empty($datas)) 457 393 { 458 while ($group = mysql_fetch_array($datas ))394 while ($group = mysql_fetch_array($datas,MYSQL_ASSOC)) 459 395 { 460 396 … … 469 405 470 406 } 407 //================================================================================= 408 409 function create_table($nom_table,$champs,$types) //MAIL_SUPERV_TABLE 410 { 411 /* $nb = Get_colonnes_de($nom_table); 412 $table=$nb[$nom_table]; */ 413 $data = $types ; 414 $i=0; 415 $valeurs=array(); 416 417 418 419 foreach ( $champs as $champ) 420 { 421 $champ = trim($champ); 422 array_push($valeurs , " `".$champ."`" . ' ' . $data[ $i] ) ; 423 424 $i +=1; 425 } 426 if ( count($valeurs) == 0) return ; 427 $valeurs=implode(", ",$valeurs) ; 428 //=============================================================================== 429 $query = "CREATE TABLE IF NOT EXISTS `" . $nom_table . "` (". $valeurs . " , PRIMARY KEY (`id` ) ) ;"; 430 if ( pwg_query($query) ) return ; 431 die($query); 432 433 } 434 function ajust_table($nom_table,$champs,$types) //MAIL_SUPERV_TABLE 435 { 436 437 $nb = Get_colonnes_de($nom_table); 438 $table=$nb[$nom_table]; 439 $data = $types ; 440 $i=0; 441 $valeurs=array(); 442 443 444 foreach ( $champs as $champ) 445 { 446 $champ = trim($champ); 447 if (!in_array( $champ,$table)) { 448 array_push($valeurs , " ADD `".$champ."`" . ' ' . $data[ $i] ) ; 449 } 450 $i +=1; 451 452 } 453 if ( count($valeurs) == 0) return ; 454 455 $valeurs=implode(", ",$valeurs) ; 456 //=============================================================================== 457 458 $query = "ALTER TABLE `" . $nom_table . "` ". $valeurs ; 459 if ( pwg_query($query)) return ; 460 461 die($query); 462 463 464 } 465 466 function ajout_ligne($nom_table,$champs,$valeurs,$force) 467 { 468 469 470 471 if (!$force) { 472 $query = " 473 SELECT COUNT(`id`) as total 474 FROM `".$nom_table."` 475 ;"; 476 //============================================================================== 477 list($count) = mysql_fetch_row(pwg_query($query)); 478 479 }else{ 480 481 $count = 0 ; 482 } 483 484 if ($count == 0) 485 { 486 $n_champs=implode(",",$champs); 487 $n_valeurs=implode(",",$valeurs); 488 489 490 491 $query = " 492 INSERT INTO `".$nom_table."` (". $n_champs.") 493 VALUES ( ". $n_valeurs .")"; 494 495 if (pwg_query($query)) return ; 496 die($query); 497 498 } 499 } 500 //===================================================================== 501 502 function Str_To_Time( $ajout,$init_date) 503 { 504 //======================================================== 505 506 $a_ajouter=$ajout ; 507 508 $period_search=array("W","D","H","M","S"); 509 array_push($period_search,l10n('Week').'s',l10n('Day').'s',l10n('Hour').'s',l10n('Minute').'s',l10n('Seconde').'s'); 510 array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde')); 511 512 513 514 $period_match = array(' week ',' day ',' hour ',' minute ',' seconde '); 515 array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde '); 516 array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde '); 517 518 519 520 $a_ajouter = "+ " . str_replace($period_search, $period_match, $a_ajouter) ; 521 522 523 524 $a_ajouter=trimUltime($a_ajouter); 525 $v1 = array('- ','+ ','week','day','hour','minute','seconde',' -',' +',' '); 526 $v2 = array('-','+', (7*24*60*60) , (24*60*60), (60*60), 60,1,'|-','|+',"*" ); 527 $new_valeur = str_replace($v1,$v2,$a_ajouter) ; 528 $new_valeur = str_replace('++','+',$new_valeur ) ; 529 530 $new_valeur = explode( "|",$new_valeur ); 531 $p = $init_date ; 532 533 //$new_valeur = $a_ajouter + $init_date ; 534 foreach($new_valeur as $nv) 535 { 536 $p += matheval($nv) ; 537 538 } 539 return $p ; 540 541 } 542 //===================================================================================== 543 function matheval($equation) 544 { 545 $equation = preg_replace("/[^0-9+\-.*\/()%]/","",$equation); 546 547 $equation = preg_replace("/([+-])([0-9]{1})(%)/","*(1\$1.0\$2)",$equation); 548 549 $equation = preg_replace("/([+-])([0-9]+)(%)/","*(1\$1.\$2)",$equation); 550 551 $equation = preg_replace("/([0-9]+)(%)/",".\$1",$equation); 552 553 if ( $equation == "" ) 554 { 555 $return = 0; 556 } 557 else 558 { 559 560 eval("\$return=" . $equation . ";" ); 561 } 562 return $return; 563 } 564 565 //====================================================================================== 566 function trimUltime($chaine){ 567 $chaine = trim($chaine); 568 $chaine = str_replace("\t", " ", $chaine); 569 $chaine = eregi_replace("[ ]+", " ", $chaine); 570 return $chaine; 571 } 572 573 574 function kill_list() 575 { 576 577 578 //==================== TEST black_liste ============================================ 579 $query = " 580 SELECT *,COUNT(`id`) as total 581 FROM `".MAIL_BLACK_LISTE_TABLE."` 582 WHERE ip='".$_SERVER['REMOTE_ADDR']."' 583 ;"; 584 //============================================================================== 585 $row = mysql_fetch_row(pwg_query($query)); 586 if (count($row) > 0) 587 { 588 589 $nb = ($row[7])+1; 590 $pays = isset($_POST['pays']) ? $_POST['pays'] : $pays="" ; 591 $ville = (isset($_POST['ville'])) ? $_POST['ville']: $ville="" ; 592 $region = isset($_POST['region']) ? $_POST['region'] : $region="" ; 593 594 $query =" 595 UPDATE " . MAIL_BLACK_LISTE_TABLE . " 596 SET "; 597 if (isset($_POST['pays'])) 598 $query .= " 599 `pays` = '". $pays ."', 600 `region` = '" . $region ."', 601 `ville` = '" . $ville . "', 602 "; 603 $query .= " 604 `nb` = " . $nb . " 605 WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ; 606 "; 607 pwg_query($query ); 608 //================================================================================ 609 610 } 611 return (count($row) > 0) ; 612 } 471 613 472 614 ?> -
extensions/Mail_supervisor/include/function_test_send.php
r4054 r4132 26 26 die('Hacking attempt!'); 27 27 } 28 if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__))); 29 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 28 29 30 30 31 31 function test_envoie($message,$group_name,$group_id) -
extensions/Mail_supervisor/language/fr_FR/help/plugin.lang.php
r4065 r4132 46 46 47 47 $lang['hlp_5_1']='Dernier message renvoyé par la fonction mail().'; 48 49 48 //===================================================================== 49 50 51 //====================================================================== 52 53 54 $lang['hlp_7_1']='Ce module permet de créer une liste noire contenant les adresses IP indésirables. 55 Les adresse IP mémorisées dans la liste noire seront blocquées lors de leur tentative de connexions au site. 56 Les jockers (*) pour remplacer un groupe d\'adresse sont autorisés. 57 Exemple : 94.102.63.* 58 Exclusion de toutes les adresses IP de 94.102.63.0 à 94.102.63.255 59 Exemple : 94.102.*.13 60 Exclusion de toutes les adresses IP de 94.102.0.13 à 94.102.255.13 61 62 63 '; 50 64 ?> -
extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
r4065 r4132 16 16 $lang['nbm_no_mail_to_send'] = 'Pas de mail à envoyer.'; 17 17 */ 18 $lang['IP_adress'] = 'Votre adresse IP'; 19 $lang['liste_ip']="Liste des IP (historique)"; 20 $lang['black_liste']="Liste noire des IP"; 21 $lang['blackliste']="Liste noire"; 22 18 23 $lang['state'] = 'Etat'; 19 24 $lang['refresh'] = 'Rafraîchir'; -
extensions/Mail_supervisor/main.inc.php
r4059 r4132 259 259 } 260 260 261 262 261 263 262 … … 280 279 //add_event_handler('loc_end_page_tail', 'affiche_message'); 281 280 add_event_handler('loc_after_page_header', 'affiche_message'); 282 283 281 ?> -
extensions/Mail_supervisor/maintain.inc.php
r4059 r4132 25 25 die('Hacking attempt!'); 26 26 } 27 28 29 if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__)));30 27 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 31 32 28 include_once (MAIL_SUPERV_PATH.'include/constants.php'); 33 34 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 35 29 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 30 36 31 function plugin_install() 37 32 { 38 33 34 35 global $superv_bl_champs,$superv_bl_type ; 36 39 37 // efface free mail 40 38 $q = ' 41 39 SELECT count(`id`) as total FROM `'.PLUGINS_TABLE.'` WHERE `id` LIKE "free_mail" ;'; 42 $plugs = mysql_fetch_array(pwg_query($q) );40 $plugs = mysql_fetch_array(pwg_query($q),MYSQL_ASSOC); 43 41 $nb= $plugs['total']; 44 42 45 43 if (count($nb)>=1) { 46 /*$q = '47 UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE `id` LIKE "free_mail"';48 pwg_query($q);49 pwg_query( $q );*/44 /* $q = ' 45 UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE `id` LIKE "free_mail"'; 46 pwg_query($q); 47 pwg_query( $q );*/ 50 48 $q = ' 51 49 DELETE FROM '.PLUGINS_TABLE.' … … 78 76 $q = ' 79 77 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 80 VALUES ("mail_superv","o n,on,off ,off,off","Parametres du plugin Mail superviseur")78 VALUES ("mail_superv","off,off,off ,off,off","Parametres du plugin Mail superviseur") 81 79 ;'; 82 80 pwg_query($q); 81 83 82 84 85 vérif_base(); 83 84 vérif_base(); 85 create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; 86 86 87 87 } … … 102 102 103 103 pwg_query($q); 104 105 106 107 $q = 'DROP TABLE'.MAIL_SUPERV_TABLE.';';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 108 pwg_query( $q ); 109 } 109 110 110 111 111 112 } … … 113 114 function plugin_activate() 114 115 { 116 115 117 116 118 }
Note: See TracChangeset
for help on using the changeset viewer.