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