Changeset 8917 for extensions/Mail_supervisor/admin/mail_superv_admin.php
- Timestamp:
- Jan 26, 2011, 3:59:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Mail_supervisor/admin/mail_superv_admin.php
r7050 r8917 28 28 29 29 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 30 if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' , dirname(__FILE__).'/'); 30 31 31 32 global $user, $lang, $conf, $errors,$mails_donnees; … … 77 78 78 79 $tabhelp= ' <img src="'.PHPWG_ROOT_PATH. $icon_path .'" width=10px alt="(?)"> '; 79 80 81 82 80 $tabsheet = new tabsheet(); 83 81 $tabsheet->add('mail_superv_admin', … … 98 96 $my_base_url.'&tab=mail_superv_help'); 99 97 100 101 98 $tabsheet->select($page['tab']); 102 99 $tabsheet->assign(); … … 133 130 if (!isset($mails_options[check_header_carbon])) $mails_options[check_header_carbon] = 'off' ; //1 134 131 if (!isset($mails_options[check_mailto])) $mails_options[check_mailto] = 'off' ; //0 135 //================================================================================================ 132 //================================================================================================ 133 $mails_options[set_auto] = 'off' ; 134 $mails_options[no_connect] = 'off' ; 135 136 136 $mails_donnees = Get_Datas(); 137 137 … … 144 144 $aff_nb=true; 145 145 146 147 148 146 // ************************************************************************* 149 147 // | Selection de l'onglet | … … 151 149 152 150 $modif=false ; 153 /* 154 $sql="SELECT * 155 FROM `".$prefixeTable."plugins` 156 WHERE `id` LIKE 'Mail_supervisor' 157 "; 158 $result = @pwg_query($sql); 159 if ($result) { 160 $versions = mysql_fetch_array($result,MYSQL_ASSOC); 161 } 162 $version = $versions['version']; 163 */ 164 $plugin = Get_Version_plugins( MAIL_SUPERV_PATH); 165 $version = $plugin['version'] ; 151 152 $plugin = Get_Version_plugins( MAIL_SUPERV_PATH); 153 $version = $plugin['version'] ; 166 154 //========================================================= 167 155 … … 219 207 } 220 208 221 209 //=================================================================== 222 210 if ( $_POST['submit'] == l10n('Sv_Valider') ) 223 211 { … … 287 275 'version' => $version , 288 276 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 289 'path_js' => $path_js 277 'path_js' => $path_js, 278 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS, 279 290 280 ) 291 281 ); 292 282 293 283 $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl'))); 294 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 284 285 286 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 295 287 296 288 break; … … 302 294 303 295 case 'mail_superv_test': 304 305 $mails_donnees = Get_Datas() ;306 $group_id = isset($_POST['group']) ? $_POST['group'] : '-1' ;307 if ($group_id >= 0) { 308 $query = ' 309 310 name311 FROM '.GROUPS_TABLE.'312 WHERE id = '.$group_id.'313 ;';314 list($group_name) = mysql_fetch_row(pwg_query($query));296 load_language('plugin.lang', MAIL_SUPERV_PATH); 297 $mails_donnees = Get_Datas() ; 298 $group_id = isset($_POST['group']) ? $_POST['group'] : '-1' ; 299 300 if ($group_id >= 0) { 301 $query = 'SELECT 302 name 303 FROM '.GROUPS_TABLE.' 304 WHERE id = '.$group_id.' 305 ;'; 306 list($group_name) = mysql_fetch_row(pwg_query($query)); 315 307 } else { 316 308 $group_name=""; 317 309 } 310 318 311 //================================================ 319 312 // info by email to an access granted group of category informations 320 if (isset($_POST['submitEmail']) and !empty($_POST['group'])) 313 314 315 if (isset($_POST['Submit']) and !empty($_POST['group'])) 321 316 { 322 317 set_make_full_url(); 318 323 319 /* TODO: if $category['representative_picture_id'] 324 320 is empty find child representative_picture_id */ 325 /* 326 * send en email to user's group 327 * 328 * @param: 329 * - group_id: mail are sent to group with this Id 330 * - email_format: mail format 331 * - keyargs_subject: mail subject on l10n_args format 332 * - dirname: short name of directory including template 333 * - tpl_shortname: short template name without extension 334 * - assign_vars: array used to assign_vars to mail template 335 * - language_selected: send mail only to user with this selected language 336 * 337 * @return boolean (Ok or not) 338 */ 339 340 if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']); 341 else 342 $titre=$conf['gallery_title']; 343 344 $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']); 321 322 323 if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']); 324 else $titre=$conf['gallery_title']; 325 326 $message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']); 345 327 346 328 if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message); 347 // TODO Mettre un array pour traduction subjet 348 349 350 pwg_mail_group( 351 $_POST['group'], 352 get_str_email_format(true), 353 get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet 354 'cat_group_info', // template 355 array 356 ( 357 'CPL_CONTENT' => $message."\n\n".$user['username'] 358 ), 359 '' ); 360 361 362 $mails_donnees['message_test']= str_replace('"',"'",$message) ; 363 unset_make_full_url(); 329 330 if ( $_POST['Submit']==l10n('Sv_Envoyer') ) { 331 /* 332 * send en email to user's group 333 * 334 * @param: 335 * - group_id: mail are sent to group with this Id 336 * - email_format: mail format 337 * - keyargs_subject: mail subject on l10n_args format 338 * - dirname: short name of directory including template 339 * - tpl_shortname: short template name without extension 340 * - assign_vars: array used to assign_vars to mail template 341 * - language_selected: send mail only to user with this selected language 342 * 343 * @return boolean (Ok or not) 344 */ 345 pwg_mail_group( 346 $_POST['group'], 347 get_str_email_format(true), 348 get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet 349 'cat_group_info', // template 350 array ('CPL_CONTENT' => $message."\n\n".$user['username'] ), 351 '' ); 352 353 $mails_donnees['message_test']= str_replace('"',"'",$message) ; 354 355 unset_make_full_url(); 364 356 sauve_donnees(); 365 $mails_donnees = Get_Datas() ; 366 367 $query = ' 368 SELECT 369 name 370 FROM '.GROUPS_TABLE.' 371 WHERE id = '.$_POST['group'].' 372 ;'; 373 list($group_name) = mysql_fetch_row(pwg_query($query)); 374 375 array_push( 376 $page['infos'], 377 sprintf( 378 l10n('An information email was sent to group "%s"'), 379 $group_name 380 ) 381 ); 357 $mails_donnees = Get_Datas() ; 358 $query = 'SELECT 359 name 360 FROM '.GROUPS_TABLE.' 361 WHERE id = '.$_POST['group'].' 362 ;'; 363 list($group_name) = mysql_fetch_row(pwg_query($query)); 364 365 array_push( 366 $page['infos'], 367 sprintf( l10n('An information email was sent to group "%s"'), 368 $group_name ) 369 ); 370 $group_id =-1 ; 371 } 382 372 } 383 load_language('plugin.lang', MAIL_SUPERV_PATH); 384 //===================================================================================== 385 if ( isset($_POST['test_envoie']) ) { 386 $mails_donnees['message_test'] = empty($_POST['MAIL_CONTENT']) ? '' : stripslashes($_POST['MAIL_CONTENT']); 387 $message=$mails_donnees['message_test']; 388 //test_envoie($message,$group_name,$group_id); 389 sauve_donnees(); 390 391 $mails_donnees = Get_Datas() ; 392 393 } 394 373 374 //====================================================================================== 395 375 $groups[-1] = '---------'; 396 397 $query = ' 398 SELECT id, name 399 FROM '.GROUPS_TABLE.' 400 ORDER BY name ASC 401 ;'; 376 $query = ' SELECT id, name 377 FROM '.GROUPS_TABLE.' 378 ORDER BY name ASC 379 ;'; 402 380 403 381 $result = pwg_query($query); 404 382 //---------------------------------------------------------------- 405 383 while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) 406 { 407 $groups[$row['id']] = $row['name']; 408 } 384 { $groups[$row['id']] = $row['name']; } 409 385 //--------------------------------------------------------------- 410 386 if ( isset($_POST['Submit'])) $group_id=-1; 411 387 $template->assign( 412 388 'Group', 413 array( 414 'group_options'=> $groups, 415 'selected' => $group_id 389 array( 'group_options'=> $groups, 390 'selected' => $group_id 416 391 ) 417 392 ); 418 393 //================================================================= 419 394 $destinataires= implode("<br />",get_liste($group_id)); 395 if( $destinataires !="" ) 396 $infos_message .= " List :<hr>" . $destinataires . "<hr>" ; 397 420 398 $template->assign( 421 399 array( 422 'Groupe' => $groups, 423 'message_test' => $mails_donnees['message_test'] , 424 'liste' => $destinataires , 425 'version' => $version , 426 'MAIL_CONTENT' => $mails_donnees['message_test'], 427 'path_js' => $path_js 400 'Groupe' => $groups, 401 'message_test' => $mails_donnees['message_test'] , 402 'liste' => $destinataires , 403 'version' => $version , 404 'MAIL_CONTENT' => $mails_donnees['message_test'], 405 'path_js' => $path_js, 406 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS, 407 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 428 408 ) 429 409 ); 430 410 431 $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl'))); 432 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 433 434 $toolbar = 'Basic'; 435 $width = '750px'; 436 $height = '200px'; 437 $areas = array(); 438 $areas[]='MAIL_CONTENT'; 439 // $areas[]= 'MAIL_CONTENT'; 440 if (!empty($areas)) 441 { 442 if (function_exists('set_fckeditor_instance')) 443 set_fckeditor_instance($areas, $toolbar, $width, $height); 444 } 445 411 $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl'))); 412 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 413 //========================================================================= 414 $toolbar = 'Basic'; 415 $width = '750px'; 416 $height = '200px'; 417 $areas = array(); 418 $areas[]='MAIL_CONTENT'; 419 if (!empty($areas)){ 420 if (function_exists('set_fckeditor_instance')) 421 set_fckeditor_instance($areas, $toolbar, $width, $height); 422 } 423 446 424 break; 447 425 // ************************************************************************* … … 453 431 //------------------------------------------------------------------------------------ 454 432 $mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[no_mail_list] ; 455 $mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;456 $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;433 $mails_options[no_connect] = 'off' ;//isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ; 434 $mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ; 457 435 //======================================================================================= 458 436 $info_ip = (isset($info_ip)) ? $info_ip : '' ; … … 485 463 { 486 464 $mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ; 487 $mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;488 $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;465 $mails_options[no_connect] ='off' ;// isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ; 466 $mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ; 489 467 $mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ; 490 468 sauve_options(); … … 518 496 $template->assign( 519 497 array( 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 498 'start' => $params['start'], 499 'per_page' => $params['per_page'] , 500 'maxipage' => $maxipage , 501 'smile_bonjour' => $smile_bonjour , 502 'img_logo' => $img_logo , 503 'champs_ip' => $champs_ip , 504 'liste_ip' => $liste_ip, 505 'champs_bl' => $champs_bl , 506 'liste_bl' => $liste_bl , 507 //'conf_admin_layout' => $conf['admin_layout'] , 508 'istype' => $istype , 509 'ip_black' => $ip_black , 510 'IS_SPAM' => test_spam( $ip_black), 511 'ip_black_len' => strlen($ip_black) , 512 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 513 'path_js' => $path_js , 514 'F_ACTION' => $f_action , 537 515 538 516 'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' , 539 517 'no_connect' => ($mails_options[no_connect] == 'on') ? 'checked="checked"' : '' , 540 'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' , 541 'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' , 542 'IP' => $ip , 543 'PAYS' => $pays , 544 'VILLE' => $ville , 545 'REGION' => $region , 546 'version' => $version , 518 'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' , 519 'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' , 520 'IP' => $ip , 521 'PAYS' => $pays , 522 'VILLE' => $ville , 523 'REGION' => $region , 524 'version' => $version , 525 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS, 547 526 ) 548 527 ); … … 567 546 'version' => $version , 568 547 'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH , 569 'path_js' => $path_js 548 'path_js' => $path_js, 549 'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS 570 550 ) 571 551 );
Note: See TracChangeset
for help on using the changeset viewer.