[4020] | 1 | <?php |
---|
[4029] | 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 | } |
---|
[4132] | 28 | |
---|
[4041] | 29 | if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
| 30 | |
---|
[4888] | 31 | global $user, $lang, $conf, $errors,$mails_données; |
---|
| 32 | global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ; |
---|
[4040] | 33 | // +-----------------------------------------------------------------------+ |
---|
| 34 | // | Check Access and exit when user status is not ok | |
---|
| 35 | // +-----------------------------------------------------------------------+ |
---|
[4132] | 36 | //check_status(ACCESS_ADMINISTRATOR); |
---|
[4020] | 37 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
[4220] | 38 | include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
[4020] | 39 | |
---|
[4041] | 40 | |
---|
[4040] | 41 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
[4888] | 42 | |
---|
[4054] | 43 | load_language('plugin.lang', MAIL_SUPERV_PATH); |
---|
[4888] | 44 | //========================================================= |
---|
| 45 | $sv_Week=explode(" ",l10n('Week %d')); |
---|
| 46 | if( !isset($lang['Week'])) $lang['Week'] = $sv_Week[0]; |
---|
[4065] | 47 | |
---|
[4132] | 48 | |
---|
[4888] | 49 | $lang['Sv_format_d'] = '+1 '.$lang['Week'].'<br /> |
---|
| 50 | +1 '.$lang['Day'].'<br /> |
---|
| 51 | +1 '.$lang['Hour'].'<br /> |
---|
| 52 | +1 '.$lang['Minute'].'<br /> |
---|
| 53 | +1 '.$lang['Second'].'<br />'; |
---|
| 54 | //============================================================== |
---|
| 55 | load_language('help/plugin.lang', MAIL_SUPERV_PATH); |
---|
| 56 | |
---|
[4040] | 57 | if (!isset($_GET['tab'])) |
---|
| 58 | $page['tab'] = 'mail_superv_admin'; |
---|
| 59 | else |
---|
| 60 | $page['tab'] = $_GET['tab']; |
---|
[4029] | 61 | |
---|
[4059] | 62 | $icon_path = 'template/yoga/icon/help.png'; |
---|
| 63 | |
---|
| 64 | $tabhelp= ' <img src="'.PHPWG_ROOT_PATH. $icon_path .'" class="button" alt="(?)"> '; |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
[4040] | 68 | $tabsheet = new tabsheet(); |
---|
| 69 | $tabsheet->add('mail_superv_admin', |
---|
[4879] | 70 | l10n('Sv_Tab_set'), |
---|
[4040] | 71 | $my_base_url.'&tab=mail_superv_admin'); |
---|
[4132] | 72 | |
---|
[4040] | 73 | $tabsheet->add('mail_superv_test', |
---|
[4879] | 74 | l10n('Sv_Tab_test'), |
---|
[4040] | 75 | $my_base_url.'&tab=mail_superv_test'); |
---|
[4132] | 76 | |
---|
| 77 | $tabsheet->add( 'mail_black_liste', |
---|
[4879] | 78 | l10n('Sv_blackliste'), |
---|
[4132] | 79 | $my_base_url.'&tab=mail_black_liste'); |
---|
| 80 | |
---|
| 81 | |
---|
[4059] | 82 | $tabsheet->add('mail_superv_help',$tabhelp |
---|
| 83 | , |
---|
[4040] | 84 | $my_base_url.'&tab=mail_superv_help'); |
---|
[4132] | 85 | |
---|
| 86 | |
---|
[4040] | 87 | $tabsheet->select($page['tab']); |
---|
| 88 | $tabsheet->assign(); |
---|
[4020] | 89 | |
---|
[4040] | 90 | $page['global'] = array(); |
---|
| 91 | $error = array(); |
---|
| 92 | |
---|
[4888] | 93 | |
---|
[4220] | 94 | include_once (MAIL_SUPERV_PATH.'include/constants.php'); |
---|
[4206] | 95 | |
---|
[4888] | 96 | if (!isset($infos_message)) |
---|
| 97 | { |
---|
| 98 | $infos_message = ""; |
---|
| 99 | } |
---|
| 100 | if (!isset($erreur_message)) |
---|
| 101 | { |
---|
| 102 | $erreur_message = ""; |
---|
| 103 | } |
---|
| 104 | |
---|
[4220] | 105 | if (isset($conf['mail_superv'])) { |
---|
| 106 | |
---|
| 107 | include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); |
---|
[4361] | 108 | global $pays,$region,$ville,$ip ; |
---|
[4721] | 109 | |
---|
[4361] | 110 | |
---|
[4715] | 111 | $mails_options = explode("," , $conf['mail_superv']); |
---|
[4861] | 112 | if (!isset($mails_options[set_id])) $mails_options[set_id] = 'off' ; // 7 |
---|
| 113 | if (!isset($mails_options[ip])) $mails_options[ip] = $ip ; //6 |
---|
| 114 | if (!isset($mails_options[set_auto])) $mails_options[set_auto] = 'off' ; //5 |
---|
| 115 | if (!isset($mails_options[no_connect])) $mails_options[no_connect] = 'off' ; //4 |
---|
| 116 | if (!isset($mails_options[no_mail_list])) $mails_options[no_mail_list] = 'off' ; //3 |
---|
[4224] | 117 | |
---|
[4861] | 118 | if (!isset($mails_options[check_header_text])) $mails_options[check_header_text] = 'off' ; //2 |
---|
| 119 | if (!isset($mails_options[check_header_carbon])) $mails_options[check_header_carbon] = 'off' ; //1 |
---|
| 120 | if (!isset($mails_options[check_mailto])) $mails_options[check_mailto] = 'off' ; //0 |
---|
[4888] | 121 | //================================================================================================ |
---|
[4224] | 122 | $mails_données = Get_Datas(); |
---|
[4040] | 123 | |
---|
[4220] | 124 | |
---|
| 125 | }else { |
---|
| 126 | die ("mail"); |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | |
---|
[4052] | 130 | $aff_nb=true; |
---|
[4051] | 131 | |
---|
| 132 | |
---|
[4888] | 133 | |
---|
[4040] | 134 | // ************************************************************************* |
---|
| 135 | // | Sélection de l'onglet | |
---|
| 136 | // ************************************************************************* |
---|
| 137 | |
---|
| 138 | $modif=false ; |
---|
[4888] | 139 | /* |
---|
[4451] | 140 | $sql="SELECT * |
---|
| 141 | FROM `".$prefixeTable."plugins` |
---|
| 142 | WHERE `id` LIKE 'Mail_supervisor' |
---|
| 143 | "; |
---|
| 144 | $result = @pwg_query($sql); |
---|
| 145 | if ($result) { |
---|
| 146 | $versions = mysql_fetch_array($result,MYSQL_ASSOC); |
---|
| 147 | } |
---|
[4888] | 148 | $version = $versions['version']; |
---|
| 149 | */ |
---|
| 150 | $plugin = Get_Version_plugins( MAIL_SUPERV_PATH); |
---|
| 151 | $version = $plugin['version'] ; |
---|
| 152 | //========================================================= |
---|
| 153 | |
---|
[4861] | 154 | if (!isset($ip)) { |
---|
| 155 | if (getenv("HTTP_CLIENT_IP")) |
---|
| 156 | { $ip=getenv("HTTP_CLIENT_IP"); } |
---|
| 157 | else{ $ip=getenv("REMOTE_ADDR"); } |
---|
| 158 | } |
---|
[4040] | 159 | //================================================================================ |
---|
| 160 | switch ($page['tab']) |
---|
| 161 | { |
---|
[4132] | 162 | |
---|
[4040] | 163 | // ************************************************************************* |
---|
| 164 | // initialisation | |
---|
| 165 | // ************************************************************************* |
---|
| 166 | case 'mail_superv_admin': |
---|
[4220] | 167 | |
---|
| 168 | //============================================================= |
---|
| 169 | if ( isset($_POST['submit']) ) { |
---|
[4888] | 170 | |
---|
| 171 | if ( $_POST['submit'] == l10n('Sv_refresh') ) { |
---|
[4059] | 172 | |
---|
| 173 | if ($mails_données['nb_mails'] == 0 ) |
---|
| 174 | $mails_données['date_mail'] = time(); |
---|
| 175 | |
---|
| 176 | if ($mails_données['nb_spams'] == 0 ) |
---|
| 177 | $mails_données['date_spam'] = time(); |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | if ($mails_données['quarantaine'] == false) |
---|
| 181 | { $mails_données['reste'] = 0; |
---|
| 182 | $mails_données['date_quarantaine']=time(); |
---|
| 183 | } |
---|
[4879] | 184 | $infos_message .= l10n('Sv_refresh') .'<br />'; |
---|
[4059] | 185 | sauve_données(); |
---|
[4888] | 186 | $aff_nb = false ; |
---|
[4059] | 187 | |
---|
[4220] | 188 | |
---|
[4040] | 189 | } |
---|
[4020] | 190 | |
---|
[4888] | 191 | if ( $_POST['submit'] == l10n('Sv_raz') ) { |
---|
[4220] | 192 | |
---|
[4020] | 193 | $mails_données['date_quarantaine']=time(); |
---|
| 194 | $mails_données['nb_mails'] = 0 ; |
---|
| 195 | $mails_données['nb_spams'] = 0 ; |
---|
| 196 | $mails_données['date_mail'] = time(); |
---|
| 197 | $mails_données['date_spam'] = time(); |
---|
[4029] | 198 | |
---|
[4020] | 199 | $mails_données['reste'] = 0; |
---|
[4132] | 200 | $mails_données['quarantaine']='false'; |
---|
[4020] | 201 | |
---|
[4029] | 202 | sauve_données(); |
---|
[4879] | 203 | $infos_message .= l10n('Sv_raz') .'<br />'; ; |
---|
[4220] | 204 | |
---|
[4020] | 205 | } |
---|
[4206] | 206 | |
---|
[4879] | 207 | |
---|
[4888] | 208 | if ( $_POST['submit'] == l10n('Sv_Valider') ) |
---|
| 209 | { |
---|
| 210 | $mails_options[check_mailto] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ; |
---|
| 211 | $mails_options[check_header_carbon] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ; |
---|
| 212 | $mails_options[check_header_text] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ; |
---|
[4020] | 213 | |
---|
[4888] | 214 | //données |
---|
| 215 | $mails_données['nb_mails_maxi'] = isset($_POST['nb_mails_maxi']) ? $_POST['nb_mails_maxi'] : $mails_données['nb_mails_maxi'] ; |
---|
| 216 | $mails_données['nb_mails_periode'] = isset($_POST['nb_mails_periode']) ? $_POST['nb_mails_periode'] : $mails_données['nb_mails_periode'] ; |
---|
| 217 | $mails_données['nb_spams_maxi'] = isset($_POST['nb_spams_maxi']) ? $_POST['nb_spams_maxi'] : $mails_données['nb_spams_maxi'] ; |
---|
| 218 | $mails_données['nb_spams_periode'] = isset($_POST['nb_spams_periode']) ? $_POST['nb_spams_periode'] : $mails_données['nb_spams_periode'] ; |
---|
[4020] | 219 | |
---|
[4888] | 220 | $mails_données['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] : $mails_données['quarantaine_periode'] ; |
---|
| 221 | |
---|
| 222 | $mails_données['message'] = isset($_POST['content']) ? $_POST['content'] : $mails_données['message'] ; |
---|
| 223 | $mails_données['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] : $mails_données['header_text'] ; |
---|
| 224 | //======================================================================================================= |
---|
| 225 | vérif_mails_données(); |
---|
| 226 | sauve_options(); |
---|
| 227 | sauve_données(); |
---|
[4180] | 228 | //======================================================================================================= |
---|
[4888] | 229 | $infos_message = l10n('Sv_save_config') . " : " . l10n('Sv_Datas') . "<br />" ; |
---|
| 230 | $erreur_message = ""; |
---|
| 231 | $mails_données = Get_Datas() ; |
---|
| 232 | } |
---|
| 233 | } |
---|
[4206] | 234 | |
---|
[4156] | 235 | $mails_données = Get_Datas(); |
---|
[4888] | 236 | vérif_mails_données(); |
---|
| 237 | //=============================================================================== |
---|
| 238 | |
---|
[4029] | 239 | $rest_mail= $mails_données['rest_mail']; |
---|
| 240 | $rest_spam= $mails_données['rest_spam']; |
---|
| 241 | $reste= $mails_données['reste']; |
---|
| 242 | |
---|
[4888] | 243 | $quarantaine = ($mails_données['quarantaine'] == 'true') ? true : false ; |
---|
[4132] | 244 | |
---|
[4020] | 245 | $template->assign( |
---|
| 246 | array( |
---|
[4861] | 247 | 'check_mailto' => ($mails_options[check_mailto] == 'on') ? 'checked="checked"' : '' , |
---|
| 248 | 'check_header_carbons' => ($mails_options[check_header_carbon] == 'on') ? 'checked="checked"' : '' , |
---|
| 249 | 'check_header_text' => ($mails_options[check_header_text] == 'on') ? 'checked="checked"' : '' , |
---|
[4156] | 250 | |
---|
[4020] | 251 | |
---|
| 252 | 'nb_mails' => $mails_données['nb_mails'] , |
---|
[4879] | 253 | 'date_mail' => "'".date(l10n('Sv_formatdate'),$mails_données['date_mail'])."'" , |
---|
[4020] | 254 | 'nb_mails_maxi' => $mails_données['nb_mails_maxi'] , |
---|
[4888] | 255 | 'nb_mails_periode' => "'". int_to_heure($mails_données['nb_mails_periode'])."'" , |
---|
[4029] | 256 | 'time_mails_reste' => "'".int_to_heure( $rest_mail )."'" , |
---|
[4020] | 257 | |
---|
| 258 | 'nb_spams' => $mails_données['nb_spams'] , |
---|
[4879] | 259 | 'date_spam' => "'".date(l10n('Sv_formatdate'),$mails_données['date_spam'])."'" , |
---|
[4020] | 260 | 'nb_spams_maxi' => $mails_données['nb_spams_maxi'] , |
---|
[4888] | 261 | 'nb_spams_periode' => "'".int_to_heure($mails_données['nb_spams_periode'])."'" , |
---|
[4029] | 262 | 'time_spams_reste' => "'".int_to_heure($rest_spam)."'" , |
---|
[4020] | 263 | |
---|
[4132] | 264 | 'quarantaine' => $quarantaine , |
---|
[4879] | 265 | 'date_quarantaine' => "'".date(l10n('Sv_formatdate'),time()+$reste)."'" , |
---|
[4888] | 266 | 'quarantaine_periode' => "'".int_to_heure($mails_données['quarantaine_periode'])."'" , |
---|
[4029] | 267 | 'reste' => "'".int_to_heure($reste)."'", |
---|
[4020] | 268 | |
---|
| 269 | 'message' => $mails_données['message'] , |
---|
| 270 | 'header_text' => "'".$mails_données['header_text']."'" , |
---|
[4029] | 271 | |
---|
[4451] | 272 | 'PHPWG_VERSION' => PHPWG_VERSION , |
---|
| 273 | 'version' => $version , |
---|
[4029] | 274 | |
---|
[4020] | 275 | ) |
---|
| 276 | ); |
---|
| 277 | |
---|
[4040] | 278 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl'))); |
---|
| 279 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 280 | |
---|
| 281 | break; |
---|
| 282 | |
---|
| 283 | |
---|
| 284 | // ************************************************************************* |
---|
| 285 | // TEST | |
---|
| 286 | // ************************************************************************* |
---|
| 287 | |
---|
| 288 | case 'mail_superv_test': |
---|
| 289 | |
---|
| 290 | $mails_données = Get_Datas() ; |
---|
| 291 | |
---|
| 292 | $group_id = isset($_POST['group']) ? $_POST['group'] : '-1' ; |
---|
| 293 | if ($group_id >= 0) { |
---|
| 294 | $query = ' |
---|
| 295 | SELECT |
---|
| 296 | name |
---|
| 297 | FROM '.GROUPS_TABLE.' |
---|
| 298 | WHERE id = '.$group_id.' |
---|
| 299 | ;'; |
---|
| 300 | list($group_name) = mysql_fetch_row(pwg_query($query)); |
---|
[4054] | 301 | } else { |
---|
| 302 | $group_name=""; |
---|
[4040] | 303 | } |
---|
| 304 | //================================================ |
---|
[4020] | 305 | |
---|
| 306 | |
---|
[4040] | 307 | |
---|
| 308 | if ( isset($_POST['test_envoie']) ) { |
---|
[4054] | 309 | |
---|
[4040] | 310 | $mails_données['message_test'] = isset($_POST['content']) ? $_POST['content'] : $mails_données['message_test'] ; |
---|
| 311 | $message=$mails_données['message_test']; |
---|
| 312 | sauve_données(); |
---|
| 313 | test_envoie($message,$group_name,$group_id); |
---|
| 314 | $mails_données = Get_Datas() ; |
---|
[4054] | 315 | |
---|
[4040] | 316 | } |
---|
| 317 | |
---|
| 318 | $groups[-1] = '---------'; |
---|
| 319 | |
---|
| 320 | $query = ' |
---|
| 321 | SELECT id, name |
---|
| 322 | FROM '.GROUPS_TABLE.' |
---|
| 323 | ORDER BY name ASC |
---|
| 324 | ;'; |
---|
| 325 | |
---|
| 326 | $result = pwg_query($query); |
---|
| 327 | //---------------------------------------------------------------- |
---|
[4132] | 328 | while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) |
---|
[4040] | 329 | { |
---|
| 330 | $groups[$row['id']] = $row['name']; |
---|
| 331 | } |
---|
| 332 | //--------------------------------------------------------------- |
---|
| 333 | |
---|
| 334 | $template->assign( |
---|
| 335 | 'Group', |
---|
| 336 | array( |
---|
| 337 | 'group_options'=> $groups, |
---|
| 338 | 'selected' => $group_id |
---|
| 339 | ) |
---|
| 340 | ); |
---|
| 341 | //================================================================= |
---|
| 342 | $destinataires= implode("<br />",get_liste($group_id)); |
---|
| 343 | $template->assign( |
---|
| 344 | array( |
---|
| 345 | 'Groupe' => $groups, |
---|
| 346 | 'message_test' => $mails_données['message_test'] , |
---|
| 347 | 'liste' => $destinataires , |
---|
[4451] | 348 | 'version' => $version , |
---|
[4040] | 349 | ) |
---|
| 350 | ); |
---|
| 351 | |
---|
| 352 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl'))); |
---|
| 353 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 354 | break; |
---|
| 355 | // ************************************************************************* |
---|
[4132] | 356 | // BLACK LISTE | |
---|
| 357 | // ************************************************************************* |
---|
| 358 | case 'mail_black_liste': |
---|
[4337] | 359 | global $user_name,$mail_adresse,$ip ; |
---|
[4220] | 360 | $aff_nb=false; |
---|
| 361 | //------------------------------------------------------------------------------------ |
---|
[4861] | 362 | $mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[no_mail_list] ; |
---|
| 363 | $mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ; |
---|
| 364 | $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ; |
---|
[4220] | 365 | //======================================================================================= |
---|
| 366 | $info_ip = (isset($info_ip)) ? $info_ip : '' ; |
---|
| 367 | $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ; |
---|
| 368 | $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ; |
---|
| 369 | $info_ip .= ":"; |
---|
| 370 | $val=explode(":",$info_ip); |
---|
| 371 | $info_ip = trim($val[0]) ; |
---|
| 372 | $ip_black = trim($val[1]) ; |
---|
[4721] | 373 | |
---|
[4220] | 374 | if (isset($_POST['ip_black'])) $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ; |
---|
| 375 | |
---|
[4337] | 376 | $istype=""; |
---|
[4721] | 377 | |
---|
| 378 | |
---|
[4220] | 379 | if ( isset($_POST['submit']) ) |
---|
[4156] | 380 | { |
---|
[4337] | 381 | |
---|
| 382 | if (clj_is_ip($ip_black)) $istype='IP'; |
---|
[4721] | 383 | elseif (clj_is_mail($ip_black)) $istype='MAIL'; |
---|
| 384 | else $istype='LOGIN'; |
---|
| 385 | |
---|
[4879] | 386 | if ( $_POST['submit'] == l10n('Sv_Ajout') ) |
---|
[4220] | 387 | { |
---|
[4224] | 388 | $info_ip = 'Ajout' ; |
---|
[4220] | 389 | $ip_black = trim( $_POST['ip_black']) ; |
---|
[4224] | 390 | $infos_message .= $info_ip . '---->'. $ip_black ; |
---|
[4220] | 391 | } |
---|
[4879] | 392 | if ( $_POST['submit'] == l10n('Sv_Valider') ) |
---|
[4180] | 393 | { |
---|
[4861] | 394 | $mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ; |
---|
| 395 | $mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ; |
---|
| 396 | $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ; |
---|
| 397 | $mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ; |
---|
[4190] | 398 | sauve_options(); |
---|
[4879] | 399 | $infos_message .= l10n('Sv_save_config') . '<br />'; |
---|
[4220] | 400 | |
---|
[4180] | 401 | } |
---|
[4220] | 402 | } |
---|
[4180] | 403 | |
---|
[4938] | 404 | if (!isset($params)) $params=array(); |
---|
| 405 | if (!isset($params['per_page'])) $params['per_page'] = 20 ; |
---|
| 406 | if (!isset($params['start'])) $params['start'] = 0 ; |
---|
| 407 | |
---|
| 408 | if (isset($_POST['per_page'])) $params['per_page'] =$_POST['per_page']; |
---|
| 409 | if (isset($_POST['start'])) $params['start'] =$_POST['start']; |
---|
| 410 | if (isset($_POST['next'])) $params['start'] += 1; |
---|
| 411 | if (isset($_POST['prev'])) $params['start'] -= 1; |
---|
| 412 | |
---|
| 413 | $params['start']= ($params['start']>=0) ? $params['start'] : 0 ; |
---|
| 414 | |
---|
| 415 | |
---|
[4220] | 416 | include (MAIL_SUPERV_PATH.'include/save_info.php'); |
---|
[4938] | 417 | $maxipage=(int) ( $nbip / $params['per_page']) ; |
---|
[4220] | 418 | //======================================================================================= |
---|
[4156] | 419 | $f_action = $my_base_url.'&tab=mail_black_liste' ; |
---|
[4132] | 420 | $champs_ip=array(); |
---|
| 421 | $champs_bl=array(); |
---|
[4156] | 422 | if (!empty($liste_ip)) $champs_ip=array_keys($liste_ip[0]); |
---|
| 423 | if (!empty($liste_bl)) $champs_bl=array_keys($liste_bl[0]); |
---|
[4721] | 424 | $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ; |
---|
| 425 | $img_logo=MAIL_SUPERV_PATH."smilies/logo.png" ; |
---|
[4156] | 426 | $template->assign( |
---|
[4132] | 427 | array( |
---|
[4938] | 428 | 'start' => $params['start'], |
---|
| 429 | 'per_page' => $params['per_page'] , |
---|
| 430 | 'maxipage' => $maxipage , |
---|
[4156] | 431 | 'smile_bonjour' => $smile_bonjour , |
---|
[4337] | 432 | 'img_logo' => $img_logo , |
---|
[4132] | 433 | 'champs_ip' => $champs_ip , |
---|
| 434 | 'liste_ip' => $liste_ip, |
---|
| 435 | 'champs_bl' => $champs_bl , |
---|
| 436 | 'liste_bl' => $liste_bl , |
---|
| 437 | 'conf_admin_layout' => $conf['admin_layout'] , |
---|
[4337] | 438 | 'istype' => $istype , |
---|
[4132] | 439 | 'ip_black' => $ip_black , |
---|
[4220] | 440 | 'IS_SPAM' => test_spam( $ip_black), |
---|
| 441 | 'ip_black_len' => strlen($ip_black) , |
---|
[4132] | 442 | 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , |
---|
[4156] | 443 | |
---|
[4132] | 444 | 'F_ACTION' => $f_action , |
---|
[4180] | 445 | |
---|
[4861] | 446 | 'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' , |
---|
| 447 | 'no_connect' => ($mails_options[no_connect] == 'on') ? 'checked="checked"' : '' , |
---|
| 448 | 'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' , |
---|
| 449 | 'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' , |
---|
[4220] | 450 | 'IP' => $ip , |
---|
[4180] | 451 | 'PAYS' => $pays , |
---|
| 452 | 'VILLE' => $ville , |
---|
| 453 | 'REGION' => $region , |
---|
[4451] | 454 | 'version' => $version , |
---|
[4132] | 455 | ) |
---|
| 456 | ); |
---|
[4156] | 457 | //=============================================================== |
---|
[4220] | 458 | |
---|
| 459 | |
---|
[4132] | 460 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl'))); |
---|
| 461 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 462 | break; |
---|
| 463 | |
---|
| 464 | // ************************************************************************* |
---|
[4040] | 465 | // AIDE | |
---|
| 466 | // ************************************************************************* |
---|
| 467 | case 'mail_superv_help': |
---|
[4052] | 468 | |
---|
[4065] | 469 | |
---|
[4052] | 470 | $aff_nb=false; |
---|
| 471 | $smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ; |
---|
| 472 | $template->assign( |
---|
| 473 | array( |
---|
| 474 | 'smile_bonjour' => $smile_bonjour , |
---|
[4451] | 475 | 'version' => $version , |
---|
[4052] | 476 | ) |
---|
| 477 | ); |
---|
[4059] | 478 | $aff_nb = false; |
---|
[4065] | 479 | ; |
---|
[4040] | 480 | |
---|
| 481 | $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_help.tpl'))); |
---|
| 482 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 483 | break; |
---|
| 484 | //==================================================================== |
---|
[4132] | 485 | } |
---|
[4040] | 486 | //================================================================================ |
---|
[4059] | 487 | |
---|
| 488 | |
---|
[4045] | 489 | if ( $mails_données['reste'] < 0 ) { |
---|
| 490 | $mails_données['quarantaine'] =false ; |
---|
| 491 | $mails_données['date_quarantaine']= time() ; |
---|
| 492 | $mails_données['nb_spams'] = 0 ; |
---|
| 493 | $modif == true ; |
---|
| 494 | } |
---|
| 495 | |
---|
| 496 | |
---|
[4040] | 497 | $rest_mail = $mails_données['rest_mail'] ; |
---|
| 498 | if ($rest_mail <=0 || $mails_données['nb_mails'] ==0 ){ |
---|
| 499 | $mails_données['nb_mails'] =0 ; |
---|
| 500 | $mails_données['date_mail'] = time(); |
---|
| 501 | $modif = true ; |
---|
| 502 | } |
---|
| 503 | |
---|
| 504 | $rest_spam = $mails_données['rest_spam'] ; |
---|
| 505 | |
---|
| 506 | if ($rest_spam <=0 || $mails_données['nb_spams'] ==0 ){ |
---|
| 507 | $mails_données['nb_spams'] =0 ; |
---|
| 508 | $mails_données['date_spam'] = time(); |
---|
| 509 | $modif = true ; |
---|
| 510 | } |
---|
| 511 | if ( $modif == true ) { |
---|
| 512 | sauve_données(); |
---|
| 513 | $modif = false ; |
---|
| 514 | } |
---|
[4888] | 515 | |
---|
[4052] | 516 | if ($aff_nb == true) { |
---|
[4040] | 517 | $infos_message .= 'Mails : '.$mails_données['nb_mails']. ' \\ ' . $mails_données['nb_mails_maxi']; |
---|
| 518 | $infos_message .= "\n".'Spams : '.$mails_données['nb_spams']. ' \\ ' . $mails_données['nb_spams_maxi']; |
---|
[4052] | 519 | } |
---|
[4059] | 520 | |
---|
[4132] | 521 | |
---|
[4059] | 522 | |
---|
[4156] | 523 | if ($infos_message != "") { |
---|
[4180] | 524 | array_push($page['infos'], $infos_message); |
---|
[4888] | 525 | $infos_message=""; |
---|
[4156] | 526 | } |
---|
[4888] | 527 | |
---|
[4156] | 528 | if ($erreur_message != "") { |
---|
| 529 | |
---|
| 530 | array_push($page['errors'], $erreur_message); |
---|
| 531 | $erreur_message=""; |
---|
| 532 | |
---|
[4052] | 533 | |
---|
[4156] | 534 | } |
---|
[4040] | 535 | //======================================================================== |
---|
[4020] | 536 | ?> |
---|