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