1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | // | This program is free software; you can redistribute it and/or modify | |
---|
10 | // | it under the terms of the GNU General Public License as published by | |
---|
11 | // | the Free Software Foundation | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | |
---|
24 | if ( !defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!');} |
---|
25 | |
---|
26 | if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
27 | if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' , dirname(__FILE__).'/'); |
---|
28 | |
---|
29 | global $user, $lang, $conf, $errors,$mails_donnees; |
---|
30 | global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ; |
---|
31 | // +-----------------------------------------------------------------------+ |
---|
32 | // | Check Access and exit when user status is not ok | |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | //check_status(ACCESS_ADMINISTRATOR); |
---|
35 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
36 | include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
37 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
38 | |
---|
39 | load_language('plugin.lang', MAIL_SUPERV_PATH); |
---|
40 | //========================================================= |
---|
41 | $sv_Week=explode(" ",l10n('Week %d')); |
---|
42 | if( !isset($lang['Week'])) $lang['Week'] = $sv_Week[0]; |
---|
43 | |
---|
44 | |
---|
45 | $lang['Sv_format_d'] = '+1 '.$lang['Week'].'<br /> |
---|
46 | +1 '.$lang['Day'].'<br /> |
---|
47 | +1 '.$lang['Hour'].'<br /> |
---|
48 | +1 '.$lang['Minute'].'<br /> |
---|
49 | +1 '.$lang['Second'].'<br />'; |
---|
50 | //============================================================== |
---|
51 | load_language('help/plugin.lang', MAIL_SUPERV_PATH); |
---|
52 | |
---|
53 | if (!isset($_GET['tab'])) |
---|
54 | $page['tab'] = 'mail_superv_admin'; |
---|
55 | else |
---|
56 | $page['tab'] = $_GET['tab']; |
---|
57 | |
---|
58 | if (file_exists ( 'admin/themes/clear/icon/help.png')) |
---|
59 | { |
---|
60 | //version 2.1 |
---|
61 | |
---|
62 | $icon_path = 'admin/themes/clear/icon/help.png'; |
---|
63 | $path_js= 'themes/default/js/' ; |
---|
64 | |
---|
65 | } |
---|
66 | else |
---|
67 | { |
---|
68 | // version 1.9 |
---|
69 | $path_js= "template-common/lib/"; |
---|
70 | $icon_path = "admin/template/goto/theme/clear/icon/help.png"; |
---|
71 | } |
---|
72 | |
---|
73 | $mail_supervisor = new mail_supervisor(); |
---|
74 | $tabhelp= ' <img src="'.PHPWG_ROOT_PATH. $icon_path .'" width=10px alt="(?)"> '; |
---|
75 | $tabsheet = new tabsheet(); |
---|
76 | $tabsheet->add('mail_superv_admin', |
---|
77 | l10n('Sv_Tab_set'), |
---|
78 | $my_base_url.'&tab=mail_superv_admin'); |
---|
79 | |
---|
80 | $tabsheet->add('mail_superv_test', |
---|
81 | l10n('Sv_Tab_test'), |
---|
82 | $my_base_url.'&tab=mail_superv_test'); |
---|
83 | |
---|
84 | $tabsheet->add( 'mail_black_liste', |
---|
85 | l10n('Sv_blackliste'), |
---|
86 | $my_base_url.'&tab=mail_black_liste'); |
---|
87 | |
---|
88 | |
---|
89 | $tabsheet->add('mail_superv_help', |
---|
90 | $tabhelp, |
---|
91 | $my_base_url.'&tab=mail_superv_help'); |
---|
92 | |
---|
93 | $tabsheet->select($page['tab']); |
---|
94 | $tabsheet->assign(); |
---|
95 | |
---|
96 | $page['global'] = array(); |
---|
97 | $error = array(); |
---|
98 | |
---|
99 | include_once (MAIL_SUPERV_PATH.'mail_super.inc.php'); |
---|
100 | include_once (MAIL_SUPERV_PATH.'include/constants.php'); |
---|
101 | |
---|
102 | if (!isset($infos_message)) { |
---|
103 | $infos_message = ""; |
---|
104 | } |
---|
105 | if (!isset($erreur_message)){ |
---|
106 | $erreur_message = ""; |
---|
107 | } |
---|
108 | |
---|
109 | if (isset($conf['mail_superv'])) { |
---|
110 | global $pays,$region,$ville,$ip ; |
---|
111 | include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); |
---|
112 | //================================================================================================ |
---|
113 | |
---|
114 | $mails_donnees = $mail_supervisor->Get_Datas(); |
---|
115 | }else { |
---|
116 | die ("mail"); |
---|
117 | } |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | $aff_nb=true; |
---|
122 | // ************************************************************************* |
---|
123 | // | Selection de l'onglet | |
---|
124 | // ************************************************************************* |
---|
125 | $modif=false ; |
---|
126 | $plugin = $mail_supervisor->Get_Version_plugins( MAIL_SUPERV_PATH); |
---|
127 | $version = $plugin['version'] ; |
---|
128 | //========================================================= |
---|
129 | if (!isset($ip)) { |
---|
130 | if (getenv("HTTP_CLIENT_IP")){ |
---|
131 | $ip=getenv("HTTP_CLIENT_IP"); |
---|
132 | } else{ |
---|
133 | $ip=getenv("REMOTE_ADDR"); |
---|
134 | } |
---|
135 | } |
---|
136 | |
---|
137 | //================================================================================ |
---|
138 | switch ($page['tab']) |
---|
139 | { |
---|
140 | |
---|
141 | // ************************************************************************* |
---|
142 | // initialisation | |
---|
143 | // ************************************************************************* |
---|
144 | case 'mail_superv_admin': |
---|
145 | |
---|
146 | //============================================================= |
---|
147 | if ( isset($_POST['submit']) ) { |
---|
148 | |
---|
149 | if ( $_POST['submit'] == l10n('Sv_refresh') ) { |
---|
150 | |
---|
151 | if ($mails_donnees['nb_mails'] == 0 ) |
---|
152 | $mails_donnees['date_mail'] = time(); |
---|
153 | |
---|
154 | if ($mails_donnees['nb_spams'] == 0 ) |
---|
155 | $mails_donnees['date_spam'] = time(); |
---|
156 | |
---|
157 | |
---|
158 | if ($mails_donnees['quarantaine'] == false) { |
---|
159 | $mails_donnees['reste'] = 0; |
---|
160 | $mails_donnees['date_quarantaine']=time(); |
---|
161 | } |
---|
162 | $infos_message .= l10n('Sv_refresh') .'<br />'; |
---|
163 | $mail_supervisor->sauve_donnees(); |
---|
164 | $aff_nb = false ; |
---|
165 | } |
---|
166 | |
---|
167 | if ( $_POST['submit'] == l10n('Sv_raz') ) { |
---|
168 | $mails_donnees['date_quarantaine']=time(); |
---|
169 | $mails_donnees['nb_mails'] = 0 ; |
---|
170 | $mails_donnees['nb_spams'] = 0 ; |
---|
171 | $mails_donnees['date_mail'] = time(); |
---|
172 | $mails_donnees['date_spam'] = time(); |
---|
173 | $mails_donnees['reste'] = 0; |
---|
174 | $mails_donnees['quarantaine']='false'; |
---|
175 | $mail_supervisor->sauve_donnees(); |
---|
176 | $infos_message .= l10n('Sv_raz') .'<br />'; |
---|
177 | } |
---|
178 | |
---|
179 | if ( $_POST['submit'] == l10n('Sv_Valider') ) { |
---|
180 | //=================================================================== |
---|
181 | $mails_options['check_mailto'] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ; |
---|
182 | $mails_options['check_header_carbon'] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ; |
---|
183 | $mails_options['check_send_webmaster'] = isset($_POST['check_send_webmaster']) ? $_POST['check_send_webmaster'] : 'off' ; |
---|
184 | $mails_options['no_ipaddress'] = isset($_POST['no_ipaddress']) ? $_POST['no_ipaddress'] : 'off' ; |
---|
185 | |
---|
186 | |
---|
187 | //donnees |
---|
188 | $mails_donnees['nb_mails_maxi'] = isset($_POST['nb_mails_maxi']) ? $_POST['nb_mails_maxi'] : $mails_donnees['nb_mails_maxi'] ; |
---|
189 | $mails_donnees['nb_mails_periode'] = isset($_POST['nb_mails_periode']) ? $_POST['nb_mails_periode'] : $mails_donnees['nb_mails_periode'] ; |
---|
190 | $mails_donnees['nb_spams_maxi'] = isset($_POST['nb_spams_maxi']) ? $_POST['nb_spams_maxi'] : $mails_donnees['nb_spams_maxi'] ; |
---|
191 | $mails_donnees['nb_spams_periode'] = isset($_POST['nb_spams_periode']) ? $_POST['nb_spams_periode'] : $mails_donnees['nb_spams_periode'] ; |
---|
192 | |
---|
193 | $mails_donnees['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] : $mails_donnees['quarantaine_periode'] ; |
---|
194 | |
---|
195 | $mails_donnees['message'] = isset($_POST['content']) ? $_POST['content'] : $mails_donnees['message'] ; |
---|
196 | $mails_donnees['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] : $mails_donnees['header_text'] ; |
---|
197 | //========================================================================= |
---|
198 | verif_mails_donnees(); |
---|
199 | $mail_supervisor->sauve_options(); |
---|
200 | $mail_supervisor->sauve_donnees(); |
---|
201 | //============================================================================== |
---|
202 | $infos_message = l10n('Sv_save_config') . " : " . l10n('Sv_Datas') . "<br />" ; |
---|
203 | $erreur_message = ""; |
---|
204 | |
---|
205 | } |
---|
206 | } |
---|
207 | $mails_donnees = $mail_supervisor->Get_Datas(); |
---|
208 | verif_mails_donnees(); |
---|
209 | //=============================================================================== |
---|
210 | $rest_mail= $mails_donnees['rest_mail']; |
---|
211 | $rest_spam= $mails_donnees['rest_spam']; |
---|
212 | $reste= $mails_donnees['reste']; |
---|
213 | $quarantaine = ($mails_donnees['quarantaine'] == 'true') ? true : false ; |
---|
214 | $template->assign( |
---|
215 | array( |
---|
216 | 'check_mailto' => ($mails_options['check_mailto'] == 'on') ? 'checked="checked"' : '' , |
---|
217 | 'check_header_carbons' => ($mails_options['check_header_carbon'] == 'on') ? 'checked="checked"' : '' , |
---|
218 | 'check_send_webmaster' => ($mails_options['check_send_webmaster'] == 'on') ? 'checked="checked"' : '' , |
---|
219 | 'no_ipaddress' => ($mails_options['no_ipaddress'] == 'on') ? 'checked="checked"' : '' , |
---|
220 | |
---|
221 | 'nb_mails' => $mails_donnees['nb_mails'] , |
---|
222 | 'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_mail'])."'" , |
---|
223 | 'nb_mails_maxi' => $mails_donnees['nb_mails_maxi'] , |
---|
224 | 'nb_mails_periode' => "'". int_to_heure($mails_donnees['nb_mails_periode'])."'" , |
---|
225 | 'time_mails_reste' => "'".int_to_heure( $rest_mail )."'" , |
---|
226 | |
---|
227 | 'nb_spams' => $mails_donnees['nb_spams'] , |
---|
228 | 'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_donnees['date_spam'])."'" , |
---|
229 | 'nb_spams_maxi' => $mails_donnees['nb_spams_maxi'] , |
---|
230 | 'nb_spams_periode' => "'".int_to_heure($mails_donnees['nb_spams_periode'])."'" , |
---|
231 | 'time_spams_reste' => "'".int_to_heure($rest_spam)."'" , |
---|
232 | |
---|
233 | 'quarantaine' => $quarantaine , |
---|
234 | 'date_quarantaine' => "'".date(l10n('Sv_formatdate'),time()+$reste)."'" , |
---|
235 | 'quarantaine_periode' => "'".int_to_heure($mails_donnees['quarantaine_periode'])."'" , |
---|
236 | 'reste' => "'".int_to_heure($reste)."'", |
---|
237 | |
---|
238 | 'message' => $mails_donnees['message'] , |
---|
239 | 'header_text' => "'".$mails_donnees['header_text']."'" , |
---|
240 | |
---|
241 | 'PHPWG_VERSION' => PHPWG_VERSION , |
---|
242 | 'version' => $version , |
---|
243 | 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , |
---|
244 | 'path_js' => $path_js, |
---|
245 | 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS, |
---|
246 | |
---|
247 | ) |
---|
248 | ); |
---|
249 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl'))); |
---|
250 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
251 | break; |
---|
252 | /************************************************************************* |
---|
253 | * TEST | |
---|
254 | *************************************************************************/ |
---|
255 | |
---|
256 | case 'mail_superv_test': |
---|
257 | load_language('plugin.lang', MAIL_SUPERV_PATH); |
---|
258 | $mails_donnees = $mail_supervisor->Get_Datas() ; |
---|
259 | $group_id = isset($_POST['group']) ? $_POST['group'] : '-1' ; |
---|
260 | |
---|
261 | if ($group_id >= 0) { |
---|
262 | $query = 'SELECT |
---|
263 | name |
---|
264 | FROM '.GROUPS_TABLE.' |
---|
265 | WHERE id = '.$group_id.' |
---|
266 | ;'; |
---|
267 | list($group_name) = pwg_db_fetch_row(pwg_query($query)); |
---|
268 | } else { |
---|
269 | $group_name=""; |
---|
270 | } |
---|
271 | |
---|
272 | //================================================ |
---|
273 | // info by email to an access granted group of category informations |
---|
274 | |
---|
275 | if (isset($_POST['Submit']) and !empty($_POST['group'])){ |
---|
276 | |
---|
277 | set_make_full_url(); |
---|
278 | $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']); |
---|
279 | $titre=empty($_POST['titre'])?$mails_donnees['titre']: stripslashes($_POST['titre']); |
---|
280 | $sujet=empty($_POST['sujet'])?$mails_donnees['sujet']: stripslashes($_POST['sujet']); |
---|
281 | |
---|
282 | if (function_exists('get_user_language_desc') ){ |
---|
283 | $message = get_user_language_desc($message); |
---|
284 | $sujet = get_user_language_desc($sujet); |
---|
285 | $titre = get_user_language_desc($titre); |
---|
286 | } |
---|
287 | |
---|
288 | $mails_donnees['message_test']= str_replace('"',"'",$message) ; |
---|
289 | $mails_donnees['titre']= str_replace('"',"'",$titre) ; |
---|
290 | $mails_donnees['sujet']= str_replace('"',"'",$sujet) ; |
---|
291 | |
---|
292 | if ( $_POST['Submit']!= l10n('Sv_refresh') ) { |
---|
293 | $mail_supervisor->sauve_donnees(); |
---|
294 | $modif=false ; |
---|
295 | } else{ |
---|
296 | $mails_donnees= $mail_supervisor->Get_Datas(); |
---|
297 | } |
---|
298 | |
---|
299 | |
---|
300 | if ( $_POST['Submit']==l10n('Sv_Valider') ) { |
---|
301 | $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ; |
---|
302 | $mail_supervisor->sauve_options(); |
---|
303 | $_POST['Submit']=""; |
---|
304 | }else if ( $_POST['Submit']==l10n('Sv_Envoyer') ) { |
---|
305 | /************************************************************* |
---|
306 | * send en email to user's group |
---|
307 | * |
---|
308 | * @param: |
---|
309 | * - group_id: mail are sent to group with this Id |
---|
310 | * - email_format: mail format |
---|
311 | * - keyargs_subject: mail subject on l10n_args format |
---|
312 | * - dirname: short name of directory including template |
---|
313 | * - tpl_shortname: short template name without extension |
---|
314 | * - assign_vars: array used to assign_vars to mail template |
---|
315 | * - language_selected: send mail only to user with this selected language |
---|
316 | * |
---|
317 | * @return boolean (Ok or not) |
---|
318 | ************************************************************/ |
---|
319 | pwg_mail_group( |
---|
320 | $_POST['group'], |
---|
321 | get_str_email_format(true), |
---|
322 | get_l10n_args('[%s] %s', array($conf['gallery_title'],$sujet) ), //sujet |
---|
323 | MAIL_SUPERV_PATH_ABS . 'admin/cat_group_info', // template |
---|
324 | array ( 'titre' => $titre, |
---|
325 | 'CPL_CONTENT' => $message, |
---|
326 | 'signature' => $user['username'] |
---|
327 | ), |
---|
328 | '' |
---|
329 | ); |
---|
330 | |
---|
331 | $mails_donnees['message_test']= str_replace('"',"'",$message) ; |
---|
332 | $mail_supervisor->sauve_donnees(); |
---|
333 | $mails_options['debug_mail'] = isset($_POST['debug_mail']) ? "on" : "off" ; |
---|
334 | $mail_supervisor->sauve_options(); |
---|
335 | $query = 'SELECT |
---|
336 | name |
---|
337 | FROM '.GROUPS_TABLE.' |
---|
338 | WHERE id = '.$_POST['group'].' |
---|
339 | ;'; |
---|
340 | list($group_name) = pwg_db_fetch_row(pwg_query($query)); |
---|
341 | |
---|
342 | array_push( |
---|
343 | $page['infos'], |
---|
344 | sprintf( l10n('An information email was sent to group "%s"'), |
---|
345 | $group_name ) |
---|
346 | ); |
---|
347 | $group_id =-1 ; |
---|
348 | } |
---|
349 | } |
---|
350 | |
---|
351 | //====================================================================================== |
---|
352 | $groups[-1] = '---------'; |
---|
353 | $query = ' SELECT id, name |
---|
354 | FROM '.GROUPS_TABLE.' |
---|
355 | ORDER BY name ASC |
---|
356 | ;'; |
---|
357 | |
---|
358 | $result = pwg_query($query); |
---|
359 | //---------------------------------------------------------------- |
---|
360 | while ($row = pwg_db_fetch_array($result,MYSQL_ASSOC)) { |
---|
361 | $groups[$row['id']] = $row['name']; } |
---|
362 | //--------------------------------------------------------------- |
---|
363 | if ( isset($_POST['Submit'])) $group_id=-1; |
---|
364 | $template->assign( |
---|
365 | 'Group', |
---|
366 | array( 'group_options'=> $groups, |
---|
367 | 'selected' => $group_id |
---|
368 | ) |
---|
369 | ); |
---|
370 | //================================================================= |
---|
371 | /* |
---|
372 | $List_dest=get_liste($group_id) ; |
---|
373 | //$destinataires= implode("<br />".$chk_cl,get_liste($group_id)); |
---|
374 | */ |
---|
375 | $destinataires=""; |
---|
376 | $List_dest = get_liste($group_id) ; |
---|
377 | foreach ($List_dest as $dest_id){ |
---|
378 | $destinataires .= $dest_id['username']. "<" . $dest_id['email'].'><br />'; |
---|
379 | } |
---|
380 | if( $destinataires !="" ) $infos_message .= " List :<hr>" . $destinataires . "<hr>" ; |
---|
381 | |
---|
382 | $mails_options['debug_mail'] = isset($mails_options['debug_mail']) ? $mails_options['debug_mail'] : "off" ; |
---|
383 | |
---|
384 | $template->assign( |
---|
385 | array( |
---|
386 | 'Groupe' => $groups, |
---|
387 | 'message_test' => $mails_donnees['message_test'] , |
---|
388 | 'liste' => get_liste($group_id) , |
---|
389 | 'debug_mail' => ($mails_options['debug_mail'] == 'on') ? 'checked="checked"' : '' , |
---|
390 | 'version' => $version , |
---|
391 | 'MAIL_CONTENT' => $mails_donnees['message_test'], |
---|
392 | 'path_js' => $path_js, |
---|
393 | 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS, |
---|
394 | 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , |
---|
395 | 'sujet' => $mails_donnees['sujet'], |
---|
396 | 'titre' => $mails_donnees['titre'] |
---|
397 | ) |
---|
398 | ); |
---|
399 | |
---|
400 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl'))); |
---|
401 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
402 | //========================================================================= |
---|
403 | $toolbar = 'Basic'; |
---|
404 | $width = '750px'; |
---|
405 | $height = '200px'; |
---|
406 | $areas = array(); |
---|
407 | $areas[]='MAIL_CONTENT'; |
---|
408 | if (!empty($areas)){ |
---|
409 | if (function_exists('set_fckeditor_instance')) |
---|
410 | set_fckeditor_instance($areas, $toolbar, $width, $height); |
---|
411 | } |
---|
412 | |
---|
413 | break; |
---|
414 | // ************************************************************************* |
---|
415 | // BLACK LISTE | |
---|
416 | // ************************************************************************* |
---|
417 | case 'mail_black_liste': |
---|
418 | global $user_name,$mail_adresse,$ip ; |
---|
419 | $aff_nb=false; |
---|
420 | //======================================================================================= |
---|
421 | $info_ip = (isset($info_ip)) ? $info_ip : '' ; |
---|
422 | $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ; |
---|
423 | $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ; |
---|
424 | $info_ip .= ":"; |
---|
425 | $val=explode(":",$info_ip); |
---|
426 | $info_ip = trim($val[0]) ; |
---|
427 | $ip_black = trim($val[1]) ; |
---|
428 | if (isset($_POST['ip_black'])) $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ; |
---|
429 | $istype=""; |
---|
430 | if ( isset($_POST['submit']) ){ |
---|
431 | if (clj_is_ip($ip_black)) $istype='IP'; |
---|
432 | else if (clj_is_mail($ip_black)) $istype='MAIL'; |
---|
433 | else $istype='LOGIN'; |
---|
434 | if ( $_POST['submit'] == l10n('Sv_Ajout') ) { |
---|
435 | $info_ip = 'Ajout' ; |
---|
436 | $ip_black = trim( $_POST['ip_black']) ; |
---|
437 | $infos_message .= $info_ip . '---->'. $ip_black ; |
---|
438 | } |
---|
439 | if ( $_POST['submit'] == l10n('Sv_Valider') ) { |
---|
440 | |
---|
441 | $mails_options['no_mail_list'] = isset($_POST['no_mail_list']) ? "on" : "off" ; |
---|
442 | $mails_options['no_connect'] = isset($_POST['no_connect']) ? "on" : "off" ; |
---|
443 | $mails_options['set_auto'] = isset($_POST['set_auto']) ? "on" : "off" ; |
---|
444 | $mails_options['set_id'] = isset($_POST['set_id']) ? "on" : "off" ; |
---|
445 | |
---|
446 | $mail_supervisor->sauve_options(); |
---|
447 | $infos_message .= l10n('Sv_save_config') . '<br />'; |
---|
448 | } |
---|
449 | } |
---|
450 | if (!isset($params)) $params=array(); |
---|
451 | if (!isset($params['per_page'])) $params['per_page'] = 20 ; |
---|
452 | if (!isset($params['start'])) $params['start'] = 0 ; |
---|
453 | |
---|
454 | if (isset($_POST['per_page'])) $params['per_page'] =$_POST['per_page']; |
---|
455 | if (isset($_POST['start'])) $params['start'] =$_POST['start']; |
---|
456 | if (isset($_POST['next'])) $params['start'] += 1; |
---|
457 | if (isset($_POST['prev'])) $params['start'] -= 1; |
---|
458 | $params['start']= ($params['start']>=0) ? $params['start'] : 0 ; |
---|
459 | //======================================================================================= |
---|
460 | include (MAIL_SUPERV_PATH.'include/save_info.php'); |
---|
461 | $maxipage=(int) ( $nbip / $params['per_page']) ; |
---|
462 | $f_action = $my_base_url.'&tab=mail_black_liste' ; |
---|
463 | $champs_ip=array(); |
---|
464 | $champs_bl=array(); |
---|
465 | if (!empty($liste_ip)) $champs_ip=array_keys($liste_ip[0]); |
---|
466 | if (!empty($liste_bl)) $champs_bl=array_keys($liste_bl[0]); |
---|
467 | $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ; |
---|
468 | $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ; |
---|
469 | $template->assign( |
---|
470 | array( |
---|
471 | 'start' => $params['start'], |
---|
472 | 'per_page' => $params['per_page'] , |
---|
473 | 'maxipage' => $maxipage , |
---|
474 | 'smile_bonjour' => $smile_bonjour , |
---|
475 | 'img_logo' => $img_logo , |
---|
476 | 'champs_ip' => $champs_ip , |
---|
477 | 'liste_ip' => $liste_ip, |
---|
478 | 'champs_bl' => $champs_bl , |
---|
479 | 'liste_bl' => $liste_bl , |
---|
480 | //'conf_admin_layout' => $conf['admin_layout'] , |
---|
481 | 'istype' => $istype , |
---|
482 | 'ip_black' => $ip_black , |
---|
483 | 'IS_SPAM' => test_spam( $ip_black), |
---|
484 | 'ip_black_len' => strlen($ip_black) , |
---|
485 | 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , |
---|
486 | 'path_js' => $path_js , |
---|
487 | 'F_ACTION' => $f_action , |
---|
488 | |
---|
489 | 'no_mail_list' => ($mails_options['no_mail_list'] == 'on') ? 'checked="checked"' : '' , |
---|
490 | 'no_connect' => ($mails_options['no_connect'] == 'on') ? 'checked="checked"' : '' , |
---|
491 | 'set_auto' => ($mails_options['set_auto'] == 'on') ? 'checked="checked"' : '' , |
---|
492 | 'set_id' => ($mails_options['set_id'] == 'on') ? 'checked="checked"' : '' , |
---|
493 | |
---|
494 | 'IP' => $ip , |
---|
495 | 'PAYS' => $pays , |
---|
496 | 'VILLE' => $ville , |
---|
497 | 'REGION' => $region , |
---|
498 | 'version' => $version , |
---|
499 | 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS |
---|
500 | |
---|
501 | ) |
---|
502 | ); |
---|
503 | //=============================================================== |
---|
504 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl'))); |
---|
505 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
506 | |
---|
507 | |
---|
508 | break; |
---|
509 | |
---|
510 | // ************************************************************************* |
---|
511 | // AIDE | |
---|
512 | // ************************************************************************* |
---|
513 | case 'mail_superv_help': |
---|
514 | |
---|
515 | |
---|
516 | $aff_nb=false; |
---|
517 | $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ; |
---|
518 | $template->assign( |
---|
519 | array( |
---|
520 | 'smile_bonjour' => $smile_bonjour , |
---|
521 | 'version' => $version , |
---|
522 | 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , |
---|
523 | 'path_js' => $path_js, |
---|
524 | 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS |
---|
525 | ) |
---|
526 | ); |
---|
527 | $aff_nb = false; |
---|
528 | ; |
---|
529 | |
---|
530 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_help.tpl'))); |
---|
531 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
532 | break; |
---|
533 | //==================================================================== |
---|
534 | } |
---|
535 | if ( $mails_donnees['reste'] < 0 ) { |
---|
536 | $mails_donnees['quarantaine'] =false ; |
---|
537 | $mails_donnees['date_quarantaine']= time() ; |
---|
538 | $mails_donnees['nb_spams'] = 0 ; |
---|
539 | $modif == true ; |
---|
540 | } |
---|
541 | |
---|
542 | |
---|
543 | $rest_mail = $mails_donnees['rest_mail'] ; |
---|
544 | if ($rest_mail <=0 || $mails_donnees['nb_mails'] ==0 ){ |
---|
545 | $mails_donnees['nb_mails'] =0 ; |
---|
546 | $mails_donnees['date_mail'] = time(); |
---|
547 | $modif = true ; |
---|
548 | } |
---|
549 | |
---|
550 | $rest_spam = $mails_donnees['rest_spam'] ; |
---|
551 | |
---|
552 | if ($rest_spam <=0 || $mails_donnees['nb_spams'] ==0 ){ |
---|
553 | $mails_donnees['nb_spams'] =0 ; |
---|
554 | $mails_donnees['date_spam'] = time(); |
---|
555 | $modif = true ; |
---|
556 | } |
---|
557 | //====================================================== |
---|
558 | if ( $modif == true ) { |
---|
559 | $mail_supervisor->sauve_donnees(); |
---|
560 | $modif = false ; |
---|
561 | } |
---|
562 | //====================================================== |
---|
563 | if ($aff_nb == true) { |
---|
564 | $infos_message .= 'Mails : '.$mails_donnees['nb_mails']. ' \\ ' . $mails_donnees['nb_mails_maxi']; |
---|
565 | $infos_message .= "\n".'Spams : '.$mails_donnees['nb_spams']. ' \\ ' . $mails_donnees['nb_spams_maxi']; |
---|
566 | } |
---|
567 | |
---|
568 | |
---|
569 | $mail_supervisor->affiche_message(); |
---|
570 | //======================================================================== |
---|
571 | ?> |
---|