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