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