2006-12-02 04:36:16 +00:00
< ? php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <EFBFBD> Steve Dunstan 2001 - 2002
| http :// e107 . org
| jalist @ e107 . org
|
| Released under the terms and conditions of the
| GNU General Public License ( http :// gnu . org ) .
|
| $Source : / cvs_backup / e107_0 . 8 / e107_admin / mailout . php , v $
2009-09-03 19:32:33 +00:00
| $Revision : 1.18 $
| $Date : 2009 - 09 - 03 19 : 32 : 33 $
| $Author : e107steved $
2007-12-22 14:49:34 +00:00
|
| Work in progress - supplementary mailer plugin
|
2006-12-02 04:36:16 +00:00
+----------------------------------------------------------------------------+
2007-12-22 14:49:34 +00:00
Features :
1. Additional sources of email addresses for mailouts can be provided via plugins
2. Both list of email recipients and the email are separately stored in the DB using a documented interface ( allows alternative creation / mailout routines )
3. Can specify qmail in the sendmail path
4. Handling of partially sent email runs
Interface to add extra mailout ( source ) handlers - these provide email addresses :
1. Plugin path defined in $eplug_array_pref - added to $pref [ 'mailout_sources' ]
2. Mailout options has a facility to enable the individual handlers
3. The handler is called 'mailout_class.php' in the plugin directory .
4. Certain variables may be defined at load time to determine whether this is exclusive or supplementary
5. The class name must be 'mailout_plugin_path'
$pref [ 'mailout_enabled' ][ plugin_path ] - array of flags determining which mailers are active
*/
/*
Various information is stored in the 'generic' table , with tags :
'sendmail' - an entry for which an email is to be sent
'massmail' - a saved email
Each mailout task is implemented as a class , which must include a number of mandatory entry points :
show_select ( $allow_edit = FALSE ) - in edit mode , returns text which facilitates address selection . Otherwise shows the current selection criteria
select_init () - initialise the selection mechanism
select_add () - routine pulls out email addresses etc , for caller to add to the list of addressees
select_close () - selection complete
2006-12-02 04:36:16 +00:00
*/
require_once ( " ../class2.php " );
2009-08-28 16:11:02 +00:00
if ( ! getperms ( " W " ))
{
header ( " location: " . e_BASE . " index.php " );
exit ;
}
//TODO multilanguage?
include_lan ( e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE );
2006-12-02 04:36:16 +00:00
$e_sub_cat = 'mail' ;
2009-07-14 11:05:54 +00:00
2006-12-02 04:36:16 +00:00
set_time_limit ( 180 );
session_write_close ();
require_once ( e_ADMIN . " auth.php " );
require_once ( e_HANDLER . " ren_help.php " );
include_lan ( e_LANGUAGEDIR . e_LANGUAGE . " /admin/lan_users.php " );
require_once ( e_HANDLER . " userclass_class.php " );
2008-11-14 06:01:06 +00:00
2007-12-22 14:49:34 +00:00
$images_path = e_IMAGE . 'admin_images/' ;
$mail_plugin = FALSE ;
$action = '' ;
$sub_par = '' ;
$mail_id = 0 ;
if ( e_QUERY )
{
$qs = explode ( '.' , e_QUERY );
$action = varset ( $qs [ 0 ], '' );
switch ( $action )
{
case 'justone' :
$mail_plugin = varset ( $qs [ 1 ], '' );
$mail_plugin = trim ( $mail_plugin );
break ;
case 'debug' :
$sub_par = varset ( $qs [ 1 ], 'sendmail' );
break ;
case 'savedmail' :
case 'mailouts' :
$sub_par = varset ( $qs [ 1 ], '' );
if ( $sub_par ) $mail_id = intval ( varset ( $qs [ 2 ], 0 ));
}
}
// Class handler for core mailout functions
require_once ( e_HANDLER . " mailout_class.php " );
$mail_handlers = array ();
$mail_handlers [] = new core_mailout (); // Start by loading the core mailout class
$active_mailers = explode ( ',' , varset ( $pref [ 'mailout_enabled' ], '' ));
// Load additional configured handlers
foreach ( explode ( ',' , $pref [ 'mailout_sources' ]) as $mailer )
{
if ( isset ( $pref [ 'plug_installed' ][ $mailer ]) && in_array ( $mailer , $active_mailers ))
// if (isset($pref['plug_installed'][$mailer])) // Check its enabled later
{ // Could potentially use this handler - its installed and enabled
if (( $mail_plugin === FALSE ) || ( $mail_plugin == $mailer ))
{
if ( ! is_readable ( e_PLUGIN . $mailer . " /mailout_class.php " ))
{
echo " Invalid mailer selected: " . $mailer . " <br /> " ;
exit ;
}
require_once ( e_PLUGIN . $mailer . " /mailout_class.php " );
if ( varset ( $mailer_include_with_default , TRUE ) || ( $mail_plugin == $mailer ))
{ // Definitely need this plugin
$mail_class = 'mailout_' . $mailer ;
$temp = new $mail_class ;
if ( $temp -> mailer_enabled )
{
$mail_handlers [] = & $temp ;
if (( $mail_plugin !== FALSE ) && varset ( $mailer_exclude_default , FALSE ))
{
$mail_handlers [ 0 ] -> mailer_enabled = FALSE ; // Don't need default handler
}
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
else
{
unset ( $temp );
}
}
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
}
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
//----------------------------------------
// Send test email - uses standard 'single email' handler
//----------------------------------------
if ( isset ( $_POST [ 'testemail' ]) && getperms ( " 0 " ))
{
if ( trim ( $_POST [ 'testaddress' ]) == " " )
{
$message = LAN_MAILOUT_19 ;
}
else
{
2008-12-07 14:22:40 +00:00
$mailheader_e107id = USERID ;
require_once ( e_HANDLER . " mail.php " );
$add = ( $pref [ 'mailer' ]) ? " ( " . strtoupper ( $pref [ 'mailer' ]) . " ) " : " (PHP) " ;
$sendto = trim ( $_POST [ 'testaddress' ]);
if ( ! sendemail ( $sendto , LAN_MAILOUT_113 . " " . SITENAME . $add , LAN_MAILOUT_114 , LAN_MAILOUT_125 ))
{
$message = ( $pref [ 'mailer' ] == " smtp " ) ? LAN_MAILOUT_67 : LAN_MAILOUT_106 ;
}
else
{
$message = LAN_MAILOUT_81 . " ( " . $sendto . " ) " ;
$admin_log -> log_event ( 'MAIL_01' , $sendto , E_LOG_INFORMATIVE , '' );
}
2007-12-22 14:49:34 +00:00
}
}
/*
// Delete any mailout entries that have hung around for a day or more (intentionally commented out - done manually now)
2006-12-02 04:36:16 +00:00
$sql -> db_Delete ( " generic " , " gen_type='sendmail' AND gen_datestamp < " . ( time () - 86400 ));
2007-12-22 14:49:34 +00:00
*/
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
//----------------------------------------
// Saved emails
//----------------------------------------
if ( isset ( $_POST [ 'save_email' ]))
{
2006-12-02 04:36:16 +00:00
$qry = " 0,'massmail', ' " . time () . " ', ' " . USERID . " ', ' " . $tp -> toDB ( $_POST [ 'email_subject' ]) . " ', '0', \" " . $tp -> toDB ( $_POST [ 'email_body' ]) . " \" " ;
$message = $sql -> db_Insert ( " generic " , $qry ) ? LAN_SAVED : LAN_ERROR ;
}
2007-12-22 14:49:34 +00:00
if ( isset ( $_POST [ 'update_email' ]))
{
2006-12-02 04:36:16 +00:00
$qry = " gen_user_id = ' " . USERID . " ', gen_datestamp = ' " . time () . " ', gen_ip = ' " . $tp -> toDB ( $_POST [ 'email_subject' ]) . " ', gen_chardata= \" " . $tp -> toDB ( $_POST [ 'email_body' ]) . " \" WHERE gen_id = ' " . $_POST [ 'update_id' ] . " ' " ;
$message = $sql -> db_Update ( " generic " , $qry ) ? LAN_UPDATED : LAN_UPDATED_FAILED ;
}
2007-12-22 14:49:34 +00:00
/*
if ( isset ( $_POST [ 'delete' ]))
{
2006-12-02 04:36:16 +00:00
$d_idt = array_keys ( $_POST [ 'delete' ]);
$message = ( $sql -> db_Delete ( " generic " , " gen_id=' " . $d_idt [ 0 ] . " ' " )) ? LAN_DELETED : LAN_DELETED_FAILED ;
2007-12-22 14:49:34 +00:00
$action = 'list' ;
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
if ( isset ( $_POST [ 'edit' ]))
{
$e_idt = array_keys ( $_POST [ 'edit' ]);
if ( $sql -> db_Select ( " generic " , " * " , " gen_id=' " . $e_idt [ 0 ] . " ' " ))
{
$foo = $sql -> db_Fetch ();
}
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
*/
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
if (( $action == 'savedmail' ) && $sub_par && $mail_id )
{
// echo "Dealing with saved emails {$sub_par} ID {$mail_id}<br />";
switch ( $sub_par )
{
case 'edit' :
if ( $sql -> db_Select ( " generic " , " * " , " gen_id=' " . $mail_id . " ' " ))
{
$foo = $sql -> db_Fetch ();
$action = 'makemail' ;
}
break ;
case 'delete' :
$message = ( $sql -> db_Delete ( " generic " , " gen_id=' " . $mail_id . " ' " )) ? LAN_DELETED : LAN_DELETED_FAILED ;
$action = 'list' ;
break ;
default :
$action = 'makemail' ;
}
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$_POST [ 'mail_id' ] = time (); // Unique ID for email - used to select our run of emails (as opposed to any other that might be going on)
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// if (!is_object($sql2)) $sql2 = new db; // Should be OK in 0.8
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
function ret_extended_field_list ( $list_name , $add_blank = FALSE )
{
global $sql ;
$ret = " <select name=' { $list_name } ' class='tbox'> \n " ;
if ( $add_blank ) $ret .= " <option value=''> </option> \n " ;
$sql -> db_Select ( " user_extended_struct " );
while ( $row = $sql -> db_Fetch ())
{
$ret .= " <option value='ue.user_ " . $row [ 'user_extended_struct_name' ] . " ' > " . ucfirst ( $row [ 'user_extended_struct_name' ]) . " </option> \n " ;
}
$ret .= " </select> \n " ;
return $ret ;
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// ---------------------------------------------
// Find a block of emails to send
// ---------------------------------------------
if ( isset ( $_POST [ 'submit' ]))
{
$c = 0 ; // Record count
$dups = 0 ; // Counter for duplicates
$email_subject = $tp -> toDB ( $_POST [ 'email_subject' ]);
$mail_id = intval ( varset ( $_POST [ 'mail_id' ], 0 ));
/* Save the actual email , so we aren ' t reliant on passing $_POST data for immediate use
Format is as follows :
gen_id int ( 10 ) unsigned NOT NULL auto_increment , - set to zero ( auto assigned )
gen_type varchar ( 80 ) NOT NULL default '' , - record type being added ( 'savemail' )
gen_datestamp int ( 10 ) unsigned NOT NULL default '0' , - Mail ID code - to match the destination address records
gen_user_id int ( 10 ) unsigned NOT NULL default '0' , - User ID of current author
gen_ip varchar ( 80 ) NOT NULL default '' , - Email subject
gen_intdata int ( 10 ) unsigned NOT NULL default '0' , - Initially set to zero - set to number of emails initially added
gen_chardata text NOT NULL , - 'From' email address and name , Email body
*/
$email_data = array ( 'sender_email' => $email_address ,
'sender_name' => $email_name ,
'copy_to' => $tp -> toDB ( $_POST [ 'email_cc' ]),
'bcopy_to' => $tp -> toDB ( $_POST [ 'email_bcc' ]),
'attach' => $tp -> toDB ( trim ( $_POST [ 'email_attachment' ])),
'email_subject' => $tp -> toDB ( trim ( $_POST [ 'email_subject' ])),
'email_body' => $tp -> toDB ( $_POST [ 'email_body' ]),
'use_theme' => intval ( varset ( $_POST [ 'use_theme' ], 0 ))
);
$qry = " 0,'savemail', ' " . $mail_id . " ', ' " . USERID . " ', ' " . $tp -> toDB ( $_POST [ 'email_subject' ]) . " ', '0', ' " . serialize ( $email_data ) . " ' " ;
$message = ( $mail_text_id = $sql -> db_Insert ( " generic " , $qry )) ? LAN_SAVED : LAN_ERROR ;
$mail_text_id = intval ( $mail_text_id );
if ( $mail_text_id == 0 )
{
Echo " Email not saved.<br /> " ;
echo $message ;
require_once ( FOOTERF );
exit ;
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
foreach ( $mail_handlers as $m )
{ // Get email addresses from each handler in turn. Do them one at a time, so that all can use the $sql data object
if ( $m -> mailer_enabled )
{
// Initialise
$m -> select_init ();
// Get email addresses - add to list, strip duplicates
while ( $row = $m -> select_add ())
{ // Add email addresses to the database ready for sending (the body is never saved in the DB - it gets passed as a $_POST value)
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$email_address = trim ( $row [ 'user_email' ]);
$email_name = $row [ 'user_name' ];
if ( $email_name == '' ) { $email_name = 'unknown' ; }
$email_target = serialize ( array ( 'user_email' => $email_address ,
'user_name' => $email_name ,
'user_signup' => varset ( $row [ 'user_signup' ], '' )));
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
/*
Table data :
gen_id int ( 10 ) unsigned NOT NULL auto_increment , - set to zero ( auto assigned )
gen_type varchar ( 80 ) NOT NULL default '' , - record type being added - 'sendmail'
gen_datestamp int ( 10 ) unsigned NOT NULL default '0' , - Mail ID code ( matches the stored email )
gen_user_id int ( 10 ) unsigned NOT NULL default '0' , - User ID - zero if not a registered user
gen_ip varchar ( 80 ) NOT NULL default '' , - User email address ( so we can search for duplicates )
gen_intdata int ( 10 ) unsigned NOT NULL default '0' , - ID number of email text in 'generic' table ( previous version used zero here )
gen_chardata text NOT NULL , - User email address , name , signup link ID ( previous version stored subject here )
*/
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$qry = " 0,'sendmail', ' " . $_POST [ 'mail_id' ] . " ', ' " . $row [ 'user_id' ] . " ', ' " . $email_address . " ', ' " . $mail_text_id . " ', ' " . $email_target . " ' " ;
2007-09-29 17:24:43 +00:00
2007-12-22 14:49:34 +00:00
if ( $sql2 -> db_Select ( 'generic' , 'gen_ip' , " `gen_datestamp`= ' { $_POST [ 'mail_id' ] } ' AND `gen_ip`=' { $email_address } ' " ))
{
$dups ++ ; // Found second entry with same email address
}
else
{
if ( $sql2 -> db_Insert ( " generic " , $qry ))
{
2006-12-02 04:36:16 +00:00
$c ++ ;
2007-12-22 14:49:34 +00:00
}
else
{
echo " Error on insert: " . $qry . " <br /> " ;
}
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
}
// Close
$m -> select_close ();
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
}
2008-12-07 14:22:40 +00:00
$sql -> db_Update ( 'generic' , " `gen_intdata`= { $c } WHERE `gen_id`= { $mail_text_id } " );
$admin_log -> log_event ( 'MAIL_02' , 'ID: ' . $mail_text_id . ' ' . $c . '[!br!]' . $_POST [ 'email_from_name' ] . " < " . $_POST [ 'email_from_email' ], E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// We've got all the email addresses here - display a confirmation form
2006-12-02 04:36:16 +00:00
$debug = ( e_MENU == " debug " ) ? " ?[debug] " : " " ;
$text = " <div style='text-align:center'>
< form method = 'post' action = '".e_HANDLER."phpmailer/mailout_process.php".$debug."' name = 'mailform' onsubmit = \ " open('', 'popup','width=230,height=170,resizable=1,scrollbars=0');this.target = 'popup';return true; \" >
< div > " ;
2007-12-22 14:49:34 +00:00
$text .= " <input type='hidden' name='mail_text_id' value=' " . $mail_text_id . " ' /> \n " ;
$text .= " <input type='hidden' name='mail_id' value=' " . $mail_id . " ' /> \n " ;
2006-12-02 04:36:16 +00:00
$text .= " </div> " ;
2007-12-22 14:49:34 +00:00
$text .= " <div> { $c } " . LAN_MAILOUT_24 . " </div> " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$text .= " <div><br /><input class='button' type='submit' name='send_mails' value=' " . LAN_MAILOUT_37 . " ' />
< input class = 'button' type = 'submit' name = 'cancel_emails' value = '".LAN_MAILOUT_38."' />
2006-12-02 04:36:16 +00:00
</ div > " ;
2007-12-22 14:49:34 +00:00
$text .= " <br /><br /> " . LAN_MAILOUT_118 . " </form><br /><br /></div> " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Preview Email
// --------------
2006-12-02 04:36:16 +00:00
$text .= "
< div >
2009-07-15 09:38:00 +00:00
< table cellpadding = '0' cellspacing = '0' class = 'adminform' >
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
2006-12-02 04:36:16 +00:00
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_01. " / " .LAN_MAILOUT_02. " </ td >
< td > " . $_POST['email_from_name'] . " & lt ; " . $_POST['email_from_email'] . " & gt ; </ td >
2006-12-02 04:36:16 +00:00
</ tr > " ;
2007-12-22 14:49:34 +00:00
// Add in core and any plugin selectors here
foreach ( $mail_handlers as $m )
{
if ( $m -> mailer_enabled )
{
2009-07-15 09:38:00 +00:00
$text .= " <tr><td> " . $m -> mailer_name . " </td><td> " . $m -> show_select ( FALSE ) . " </td></tr> " ;
2007-12-22 14:49:34 +00:00
}
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Support 'cc' and 'bcc' as standard mailout addresses
$text .= ( $_POST [ 'email_cc' ]) ? "
2006-12-02 04:36:16 +00:00
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_04. " </ td >
< td > " . $_POST['email_cc'] . " & nbsp ; </ td >
2006-12-02 04:36:16 +00:00
</ tr > " : " " ;
2007-12-22 14:49:34 +00:00
$text .= ( $_POST [ 'email_bcc' ]) ? "
2006-12-02 04:36:16 +00:00
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_05. " </ td >
< td > " . $_POST['email_bcc'] . " & nbsp ; </ td >
2006-12-02 04:36:16 +00:00
</ tr > " : " " ;
2007-12-22 14:49:34 +00:00
$text .= "
2006-12-02 04:36:16 +00:00
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_51. " </ td >
< td > " . $_POST['email_subject'] . " & nbsp ; </ td >
2007-12-22 14:49:34 +00:00
</ tr > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Attachment
if ( $email_data [ 'attach' ])
{
$text .= "
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_07. " </ td >
< td > " . $email_data['attach'] . " & nbsp ; </ td >
2007-12-22 14:49:34 +00:00
</ tr > " ;
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Figures - number of emails to send, number of duplicates stripped
$text .= "
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_71. " </ td >
< td > " . $c . " " .LAN_MAILOUT_69. $dups .LAN_MAILOUT_70. " </ td >
2007-12-22 14:49:34 +00:00
</ tr > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Email text
$text .= " <tr>
2009-07-15 09:38:00 +00:00
< td colspan = '2' > " .stripslashes( $tp->toHTML ( $_POST['email_body'] ,TRUE)). " </ td >
2006-12-02 04:36:16 +00:00
</ tr >
</ table >
</ div > " ;
2007-12-22 14:49:34 +00:00
$ns -> tablerender ( LAN_MAILOUT_39 . " ( { $c } ) " , $text );
2006-12-02 04:36:16 +00:00
require_once ( e_ADMIN . " footer.php " );
exit ;
2007-12-22 14:49:34 +00:00
} // End of previewed email
2006-12-02 04:36:16 +00:00
//. Update Preferences.
2009-09-03 19:32:33 +00:00
if ( isset ( $_POST [ 'updateprefs' ]) && getperms ( '0' ))
2007-12-22 14:49:34 +00:00
{
2008-12-07 14:22:40 +00:00
unset ( $temp );
2009-09-03 19:32:33 +00:00
if ( ! in_array ( $_POST [ 'mailer' ], array ( 'smtp' , 'sendmail' , 'php' ))) $_POST [ 'mailer' ] = 'php' ;
2008-12-07 14:22:40 +00:00
$temp [ 'mailer' ] = $_POST [ 'mailer' ];
2007-12-22 14:49:34 +00:00
// Allow qmail as an option as well - works much as sendmail
2009-09-03 19:32:33 +00:00
if (( strpos ( $_POST [ 'sendmail' ], 'sendmail' ) !== FALSE ) || ( strpos ( $_POST [ 'sendmail' ], 'qmail' ) !== FALSE )) $temp [ 'sendmail' ] = $e107 -> tp -> toDB ( $_POST [ 'sendmail' ]);
$temp [ 'smtp_server' ] = $e107 -> tp -> toDB ( $_POST [ 'smtp_server' ]);
$temp [ 'smtp_username' ] = $e107 -> tp -> toDB ( $_POST [ 'smtp_username' ]);
$temp [ 'smtp_password' ] = $e107 -> tp -> toDB ( $_POST [ 'smtp_password' ]);
2007-12-22 14:49:34 +00:00
$smtp_opts = array ();
switch ( trim ( $_POST [ 'smtp_options' ]))
{
case 'smtp_ssl' :
$smtp_opts [] = 'secure=SSL' ;
break ;
case 'smtp_tls' :
$smtp_opts [] = 'secure=TLS' ;
break ;
case 'smtp_pop3auth' :
$smtp_opts [] = 'pop3auth' ;
break ;
}
if ( varsettrue ( $_POST [ 'smtp_keepalive' ])) $smtp_opts [] = 'keepalive' ;
if ( varsettrue ( $_POST [ 'smtp_useVERP' ])) $smtp_opts [] = 'useVERP' ;
2008-12-07 14:22:40 +00:00
$temp [ 'smtp_options' ] = implode ( ',' , $smtp_opts );
2007-12-22 14:49:34 +00:00
2008-12-07 14:22:40 +00:00
$temp [ 'mail_pause' ] = intval ( $_POST [ 'mail_pause' ]);
$temp [ 'mail_pausetime' ] = intval ( $_POST [ 'mail_pausetime' ]);
2009-09-03 19:32:33 +00:00
$temp [ 'mail_bounce_email' ] = $e107 -> tp -> toDB ( $_POST [ 'mail_bounce_email' ]);
$temp [ 'mail_bounce_pop3' ] = $e107 -> tp -> toDB ( $_POST [ 'mail_bounce_pop3' ]);
$temp [ 'mail_bounce_user' ] = $e107 -> tp -> toDB ( $_POST [ 'mail_bounce_user' ]);
$temp [ 'mail_bounce_pass' ] = $e107 -> tp -> toDB ( $_POST [ 'mail_bounce_pass' ]);
$temp [ 'mail_bounce_type' ] = $e107 -> tp -> toDB ( $_POST [ 'mail_bounce_type' ]);
2008-12-07 14:22:40 +00:00
$temp [ 'mail_bounce_delete' ] = intval ( $_POST [ 'mail_bounce_delete' ]);
2006-12-02 04:36:16 +00:00
2008-12-07 14:22:40 +00:00
$temp [ 'mailout_enabled' ] = implode ( ',' , $_POST [ 'mail_mailer_enabled' ]);
$temp [ 'mail_log_options' ] = intval ( $_POST [ 'mail_log_option' ]) . ',' . intval ( $_POST [ 'mail_log_email' ]);
2007-12-22 14:49:34 +00:00
2008-12-07 14:22:40 +00:00
if ( $admin_log -> logArrayDiffs ( $temp , $pref , 'MAIL_03' ))
{
save_prefs (); // Only save if changes
$message = LAN_SETSAVED ;
}
else
{
$message = IMALAN_20 ;
}
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
if ( isset ( $message ))
{
2006-12-02 04:36:16 +00:00
$ns -> tablerender ( " " , " <div style='text-align:center'><b> " . $message . " </b></div> " );
}
// ----------------- Actions ----------------------------------------------->
2007-12-22 14:49:34 +00:00
//if((!e_QUERY && !$_POST['delete']) || $_POST['edit']) $action = 'makemail';
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
if ( ! varsettrue ( $action )) $action = 'makemail' ;
switch ( $action )
{
2009-09-03 19:32:33 +00:00
case " prefs " :
if ( getperms ( " 0 " ))
{
show_prefs ();
}
break ;
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
case 'makemail' :
show_mailform ( $foo );
break ;
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
case " list " :
showList ();
break ;
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
case 'debug' :
showList ( $sub_par );
break ;
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
case 'mailouts' :
showMailouts ( $sub_par , $mail_id );
2007-12-22 14:49:34 +00:00
}
2006-12-02 04:36:16 +00:00
require_once ( e_ADMIN . " footer.php " );
2007-12-22 14:49:34 +00:00
//---------------------------------------------
// List of incomplete mailouts
//---------------------------------------------
function showMailouts ( $sub_par , $mail_id )
{
2009-09-03 19:32:33 +00:00
global $images_path ;
$e107 = e107 :: getInstance ();
2007-12-22 14:49:34 +00:00
// gen_datestamp int(10) unsigned NOT NULL default '0', - Mail ID code - to match the destination address records
// gen_user_id int(10) unsigned NOT NULL default '0', - User ID of current author
// gen_ip varchar(80) NOT NULL default '', - Email subject
// gen_intdata int(10) unsigned NOT NULL default '0', - Initially set to zero - set to number of emails initially added
2009-09-03 19:32:33 +00:00
$message = '' ;
if ( $sub_par && $mail_id )
2007-12-22 14:49:34 +00:00
{
2009-09-03 19:32:33 +00:00
switch ( $sub_par )
2007-12-22 14:49:34 +00:00
{
2009-09-03 19:32:33 +00:00
case 'delete' :
if ( $e107 -> sql -> db_Select ( 'generic' , 'gen_datestamp' , " `gen_datestamp`= { $mail_id } AND `gen_type`='savemail' " ))
{
$message = $e107 -> sql -> db_Delete ( 'generic' , " `gen_datestamp`= { $mail_id } AND (`gen_type`='sendmail' OR `gen_type`='savemail') " ) ? LAN_DELETED : LAN_DELETED_FAILED ;
$e107 -> admin_log -> log_event ( 'MAIL_04' , $mail_id , E_LOG_INFORMATIVE , '' );
}
else
{ // Should only happen if people fiddle!
$message = " Error - database record not found " ;
echo " DB error<br /> " ;
}
break ;
case 'detail' : // Show the detail of an email run above the main list
if ( $e107 -> sql -> db_Select ( 'generic' , 'gen_id,gen_datestamp,gen_chardata' , " `gen_datestamp`= { $mail_id } AND `gen_type`='savemail' " ))
{
$row = $e107 -> sql -> db_Fetch ();
// Display a little bit of the email
$mail = unserialize ( $row [ 'gen_chardata' ]);
$text = "
< table style = '".ADMIN_WIDTH."' class = 'fborder' >
< colgroup >
< col style = 'width:25%; text-align: center;' />
< col style = 'width:75%' />
</ colgroup > \n
< tr >
< td > " .LAN_MAILOUT_51. " </ td >
< td > " . $mail['email_subject'] . " </ td >
</ tr > \n
< tr >
< td > " .LAN_MAILOUT_103. " </ td >
< td > " .(isset( $mail['send_results'] ) ? implode('<br />', $mail['send_results'] ) : LAN_MAILOUT_104). " </ td >
</ tr > \n " ;
if ( $e107 -> sql -> db_Select ( 'generic' , 'gen_id,gen_datestamp,gen_chardata' , " `gen_datestamp`= { $mail_id } AND `gen_type`='sendmail' " ))
{
$text .= " <tr><td> " . LAN_MAILOUT_105 . " </td><td> " ;
$spacer = '' ;
$i = 0 ;
while (( $row = $e107 -> sql -> db_Fetch ()) && ( $i < 10 ))
{
$this_mail = unserialize ( $row [ 'gen_chardata' ]);
if ( isset ( $this_mail [ 'send_result' ]))
{
$text .= $spacer . LAN_MAILOUT_03 . ' ' . $this_mail [ 'user_name' ] . ' ' . LAN_MAILOUT_107 . ' ' . $this_mail [ 'user_email' ] . ' ' . LAN_MAILOUT_108 . ' ' . $this_mail [ 'send_result' ];
$spacer = '<br />' ;
$i ++ ;
}
}
$text .= " </td></tr> \n " ;
}
$text .= "
</ table >
" ;
$e107 -> ns -> tablerender ( LAN_MAILOUT_102 , $text );
}
else
{ // Should only happen if people fiddle!
$message = " Error - database record not found " ;
echo " DB error<br /> " ;
}
break ;
case 'resend' :
// Echo "resend: {$mail_id}<br />";
if ( $e107 -> sql -> db_Select ( 'generic' , 'gen_id,gen_datestamp,gen_chardata' , " `gen_datestamp`= { $mail_id } AND `gen_type`='savemail' " ))
{ // Put up confirmation
$row = $e107 -> sql -> db_Fetch ();
$debug = ( e_MENU == " debug " ) ? " [debug] " : " " ;
$mailer_url = e_HANDLER . " phpmailer/mailout_process.php? " . $debug . " { $row [ 'gen_datestamp' ] } . { $row [ 'gen_id' ] } " ;
$c = $e107 -> sql -> db_Count ( 'generic' , '(*)' , " WHERE `gen_datestamp`= { $mail_id } AND `gen_type`='sendmail' " ); // Count of mails to go
$text = " <div style='text-align:center'>
< form method = 'post' action = '{$mailer_url}' name = 'mailform' onsubmit = \ " open('', 'popup','width=230,height=170,resizable=1,scrollbars=0');this.target = 'popup';return true; \" >
" ;
$text .= " <div> { $c } " . LAN_MAILOUT_24 . " </div> " ;
$text .= " <div><br /><input class='button' type='submit' name='send_mails' value=' " . LAN_MAILOUT_37 . " ' />
< input class = 'button' type = 'submit' name = 'cancel_emails' value = '".LAN_MAILOUT_38."' />
</ div > " ;
$text .= " </form><br /><br /></div> " ;
$e107 -> ns -> tablerender ( LAN_MAILOUT_99 , $text );
// Display a little bit of the email
$mail = unserialize ( $row [ 'gen_chardata' ]);
$text = "
< table style = '".ADMIN_WIDTH."' class = 'fborder' >
< colgroup >
< col style = 'width:25%; text-align: center;' />
< col style = 'width:75%' />
</ colgroup > \n
< tr >
< td > " .LAN_MAILOUT_51. " </ td >
< td > " . $mail['email_subject'] . " </ td >
</ tr > \n
< tr >
< td > " .LAN_MAILOUT_100. " </ td >
< td > " . $mail['email_body'] . " </ td >
</ tr > \n
</ table >
" ;
$e107 -> ns -> tablerender ( LAN_MAILOUT_101 , $text );
return ;
}
else
{ // Should only happen if people fiddle!
$message = " Error - database record not found " ;
echo " DB error<br /> " ;
}
break ;
case 'orphans' : // Delete any orphaned emails
if ( $e107 -> sql -> db_Select ( 'generic' , 'gen_datestamp' , " `gen_datestamp`= { $mail_id } AND `gen_type`='sendmail' " ))
{
$message = $e107 -> sql -> db_Delete ( 'generic' , " `gen_datestamp`= { $mail_id } AND `gen_type`='sendmail' " ) ? LAN_DELETED : LAN_DELETED_FAILED ;
$e107 -> admin_log -> log_event ( 'MAIL_04' , $mail_id , E_LOG_INFORMATIVE , '' );
}
else
{ // Should only happen if people fiddle!
$message = " Error - database record not found " ;
echo " DB error<br /> " ;
}
break ;
default :
echo " Invalid parameter: { $sub_par } <br /> " ;
2007-12-22 14:49:34 +00:00
}
}
2009-09-03 19:32:33 +00:00
if ( $message ) $e107 -> ns -> tablerender ( " <div style='text-align:center'> " . LAN_MAILOUT_78 . " </div> " , $message );
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
// Need to select main email entries; count number of addresses attached to each
$gen = new convert ;
$qry = " SELECT
2007-12-22 14:49:34 +00:00
u . user_name , g .* ,
COUNT ( m . gen_datestamp ) AS pending
FROM `#generic` AS g
LEFT JOIN `#user` as u ON g . gen_user_id = u . user_id
LEFT JOIN `#generic` AS m ON m . gen_datestamp = g . gen_datestamp AND m . gen_type = 'sendmail'
WHERE g . gen_type = 'savemail'
GROUP BY g . gen_datestamp
ORDER BY g . gen_id ASC " ;
2009-09-03 19:32:33 +00:00
$count = $e107 -> sql -> db_Select_gen ( $qry );
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
$emails_found = array (); // Log ID and count for later
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
$text = " <div style='text-align:center'> " ;
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
if ( ! $count )
{
$text = " <div class='forumheader2' style='text-align:center'> " . LAN_MAILOUT_79 . " </div> " ;
$e107 -> ns -> tablerender ( " <div style='text-align:center'> " . LAN_MAILOUT_78 . " </div> " , $text );
require_once ( e_ADMIN . " footer.php " );
exit ;
}
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
$text .= "
2007-12-22 14:49:34 +00:00
< form action = '".e_SELF.' ? '.e_QUERY."' id = 'email_list' method = 'post' >
< table style = '".ADMIN_WIDTH."' class = 'fborder' >
< colgroup >
< col style = 'width:5%; text-align: center;' />
< col style = 'width:12%' />
< col style = 'width:10%' />
< col style = 'width:30%' />
< col style = 'width:7%; text-align: center;' />
< col style = 'width:7%; text-align: center;' />
< col style = 'width:9%; text-align: center;' />
</ colgroup >
< tr >
< td class = 'fcaption' > " .LAN_MAILOUT_84. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_80. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_85. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_06. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_82. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_83. " </ td >
< td class = 'fcaption' > " .LAN_OPTIONS. " </ td >
</ tr >
" ;
2009-09-03 19:32:33 +00:00
while ( $row = $e107 -> sql -> db_Fetch ())
2007-12-22 14:49:34 +00:00
{
2009-09-03 19:32:33 +00:00
$datestamp = $gen -> convert_date ( $row [ 'gen_datestamp' ], " short " );
if ( $row [ 'pending' ]) $emails_found [ $row [ 'gen_datestamp' ]] = $row [ 'pending' ]; // Log the mailshot in a list if any emails to go
$text .= " <tr>
< td > " . $row['gen_datestamp'] . " </ td >
< td > " . $datestamp . " </ td >
< td > " . $row['user_name'] . " </ td >
< td > " . $row['gen_ip'] . " </ td >
< td > " . $row['gen_intdata'] . " </ td >
< td > " . $row['pending'] . " </ td >
< td style = 'width:50px;white-space:nowrap' >
< div > " ;
$text .= " <a href=' " . e_SELF . " ?mailouts.detail. { $row [ 'gen_datestamp' ] } '><img src=' " . $images_path . " search_16.png' alt=' " . LAN_MAILOUT_109 . " ' title=' " . LAN_MAILOUT_109 . " ' class='icon S16' /></a> " ;
if ( $row [ 'pending' ])
{
$text .= " <a href=' " . e_SELF . " ?mailouts.resend. { $row [ 'gen_datestamp' ] } '><img src=' " . $images_path . " mail_16.png' alt=' " . LAN_MAILOUT_86 . " ' title=' " . LAN_MAILOUT_86 . " ' class='icon S16' /></a> " ;
}
$text .= "
< a href = '".e_SELF."?mailouts.delete.{$row[' gen_datestamp ']}' onclick = 'return jsconfirm(\"".$tp->toJS(LAN_CONFIRMDEL." [".$row2[' gen_ip ']."]")."\")' >< img src = '".$images_path."delete_16.png' alt = '".LAN_DELETE."' title = '".LAN_DELETE."' class = 'icon S16' /></ a >
</ div >
</ td >
</ tr >
" ;
2007-12-22 14:49:34 +00:00
}
2009-09-03 19:32:33 +00:00
$text .= " </table> \n </form><br /><br /><br /></div> " ;
$e107 -> ns -> tablerender ( " <div style='text-align:center'> " . LAN_MAILOUT_78 . " </div> " , $text );
2007-12-22 14:49:34 +00:00
2009-09-03 19:32:33 +00:00
// Now see if we can find any 'orphaned' mailout entries
$qry = " SELECT
2007-12-22 14:49:34 +00:00
g . gen_datestamp ,
COUNT ( g . gen_datestamp ) AS pending
FROM `#generic` AS g
WHERE g . gen_type = 'sendmail'
GROUP BY g . gen_datestamp
ORDER BY g . gen_id ASC " ;
2009-09-03 19:32:33 +00:00
$count = $e107 -> sql -> db_Select_gen ( $qry );
// Echo "There are {$count} groups of unsent emails: ".count($emails_found)." in previous table<br />";
if ( $count > count ( $emails_found ))
2007-12-22 14:49:34 +00:00
{
2009-09-03 19:32:33 +00:00
$text = "
< form action = '".e_SELF.' ? '.e_QUERY."' id = 'email_orphans' method = 'post' >
< table style = '".ADMIN_WIDTH."' class = 'fborder' >
< colgroup >
< col style = 'width:25%; text-align: center;' />
< col style = 'width:60%' />
< col style = 'width:15%; text-align: center;' />
</ colgroup >
< tr >
< td class = 'fcaption' > " .LAN_MAILOUT_84. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_83. " </ td >
< td class = 'fcaption' > " .LAN_OPTIONS. " </ td >
2007-12-22 14:49:34 +00:00
</ tr > \n
" ;
2009-09-03 19:32:33 +00:00
while ( $row = $e107 -> sql -> db_Fetch ())
{
if ( ! isset ( $emails_found [ $row [ 'gen_datestamp' ]]))
{
$text .= " <tr>
< td > " . $row['gen_datestamp'] . " </ td >
< td > " . $row['pending'] . " </ td >
< td style = 'white-space:nowrap' >
< div >
< a href = '".e_SELF."?mailouts.orphans.{$row[' gen_datestamp ']}' onclick = \ " return jsconfirm(' " . $tp -> toJS ( LAN_CONFIRMDEL . " [ " . $row [ 'gen_datestamp' ] . " ] " ) . " ') \" ><img src=' " . $images_path . " delete_16.png' alt=' " . LAN_DELETE . " ' title=' " . LAN_DELETE . " ' class='icon S16' /></a>
</ div >
</ td >
</ tr > \n
" ;
}
// echo "ID: {$row['gen_datestamp']} Unsent: {$row['pending']}";
}
$text .= " </table> \n </form><br /><br /><br /></div> " ;
$e107 -> ns -> tablerender ( " <div style='text-align:center'> " . LAN_MAILOUT_98 . " </div> " , $text );
2007-12-22 14:49:34 +00:00
}
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
//---------------------------------------------
// Display Mailout Form
//---------------------------------------------
function show_mailform ( $foo = " " )
{
2009-09-03 19:32:33 +00:00
global $pref , $HANDLERS_DIRECTORY ;
2007-12-22 14:49:34 +00:00
global $mail_handlers ;
2009-09-03 19:32:33 +00:00
$e107 = e107 :: getInstance ();
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
2006-12-02 04:36:16 +00:00
$email_subject = $foo [ 'gen_ip' ];
2009-09-03 19:32:33 +00:00
$email_body = $e107 -> tp -> toForm ( $foo [ 'gen_chardata' ]);
2006-12-02 04:36:16 +00:00
$email_id = $foo [ 'gen_id' ];
$text = " " ;
2007-12-22 14:49:34 +00:00
if ( strpos ( $_SERVER [ 'SERVER_SOFTWARE' ], " mod_gzip " ) && ! is_readable ( e_HANDLER . " phpmailer/.htaccess " ))
{
$warning = LAN_MAILOUT_40 . " " . $HANDLERS_DIRECTORY . " phpmailer/ " . LAN_MAILOUT_41 ;
2009-09-03 19:32:33 +00:00
$e107 -> ns -> tablerender ( LAN_MAILOUT_42 , $warning );
2006-12-02 04:36:16 +00:00
}
$debug = ( e_MENU == " debug " ) ? " ?[debug] " : " " ;
2009-07-15 09:38:00 +00:00
$text .= " <div>
2009-09-03 19:32:33 +00:00
< form method = 'post' action = '".e_SELF.$debug."' id = 'mailout_form' >
< table cellpadding = '0' cellspacing = '0' class = 'adminform' >
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tr >
< td > " .LAN_MAILOUT_01. " : </ td >
< td >
< input type = 'text' name = 'email_from_name' class = 'tbox' style = 'width:80%' size = '10' value = \ " " . varset ( $_POST [ 'email_from_name' ], USERNAME ) . " \" />
</ td >
</ tr > " ;
2006-12-02 04:36:16 +00:00
$text .= "
2009-09-03 19:32:33 +00:00
< tr >
< td > " .LAN_MAILOUT_02. " : </ td >
< td >
< input type = 'text' name = 'email_from_email' class = 'tbox' style = 'width:80%' value = \ " " . varset ( $_POST [ 'email_from_email' ], USEREMAIL ) . " \" />
</ td >
</ tr > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Add in the core and any plugin selectors here
foreach ( $mail_handlers as $m )
{
2009-09-03 19:32:33 +00:00
if ( $m -> mailer_enabled )
{
$text .= " <tr><td> " . $m -> mailer_name . " </td><td> " . $m -> show_select ( TRUE ) . " </td></tr> " ;
}
2007-12-22 14:49:34 +00:00
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// CC, BCC
2006-12-02 04:36:16 +00:00
$text .= "
2009-09-03 19:32:33 +00:00
< tr >
< td > " .LAN_MAILOUT_04. " : </ td >
< td >
< input type = 'text' name = 'email_cc' class = 'tbox' style = 'width:80%' value = \ " " . $_POST [ 'email_cc' ] . " \" />
</ td >
</ tr >
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
< tr >
< td > " .LAN_MAILOUT_05. " : </ td >
< td >
< input type = 'text' name = 'email_bcc' class = 'tbox' style = 'width:80%' value = '{$email_bcc}' />
</ td >
</ tr > " ;
2007-12-22 14:49:34 +00:00
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Close one table, open another - to give a boundary between addressees and content
$text .= " </table>
2009-09-03 19:32:33 +00:00
< table cellpadding = '0' cellspacing = '0' class = 'adminform' >
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup > " ;
2007-12-22 14:49:34 +00:00
// Subject
$text .= "
2009-09-03 19:32:33 +00:00
< tr >
< td > " .LAN_MAILOUT_51. " : </ td >
< td >
< input type = 'text' name = 'email_subject' class = 'tbox' style = 'width:80%' value = '{$email_subject}' />
</ td >
</ tr > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Attachment.
2006-12-02 04:36:16 +00:00
$text .= " <tr>
2009-09-03 19:32:33 +00:00
< td > " .LAN_MAILOUT_07. " : </ td >
< td > " ;
2006-12-02 04:36:16 +00:00
$text .= " <select class='tbox' name='email_attachment' >
2009-09-03 19:32:33 +00:00
< option value = '' >& nbsp ; </ option > \n " ;
$e107 -> sql -> db_Select ( " download " , " download_url,download_name " , " download_id !='' ORDER BY download_name " );
while ( $row = $e107 -> sql -> db_Fetch ())
2007-12-22 14:49:34 +00:00
{
2006-12-02 04:36:16 +00:00
extract ( $row );
$selected = ( $_POST [ 'email_attachment' ] == $download_url ) ? " selected='selected' " :
" " ;
2007-12-22 14:49:34 +00:00
$text .= " <option value= \" { $download_url } \" { $selected } > " . htmlspecialchars ( $download_name ) . " </option> \n " ;
2006-12-02 04:36:16 +00:00
}
$text .= " </select> " ;
$text .= " </td>
</ tr > " ;
$text .= "
2009-09-03 19:32:33 +00:00
< tr >
< td > " .LAN_MAILOUT_09. " : </ td >
< td >
< input type = 'checkbox' name = 'use_theme' value = '1' />
</ td >
</ tr >
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
< tr >
< td colspan = '2' >
< textarea rows = '10' cols = '20' id = 'email_body' name = 'email_body' class = 'e-wysiwyg tbox' style = 'width:80%;height:200px' onselect = 'storeCaret(this);' onclick = 'storeCaret(this);' onkeyup = 'storeCaret(this);' > " . $email_body . " </ textarea >
</ td >
</ tr > " ;
2006-12-02 04:36:16 +00:00
$text .= "
2009-09-03 19:32:33 +00:00
< tr >
< td colspan = '2' >
< div > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
global $eplug_bb ;
2006-12-02 04:36:16 +00:00
$eplug_bb [] = array (
2009-09-03 19:32:33 +00:00
'name' => 'shortcode' ,
'onclick' => 'expandit' ,
'onclick_var' => 'sc_selector' ,
'icon' => e_IMAGE . 'generic/bbcode/shortcode.png' ,
'helptext' => LAN_MAILOUT_11 ,
'function' => 'sc_Select' ,
'function_var' => 'sc_selector'
2006-12-02 04:36:16 +00:00
);
2009-09-03 19:32:33 +00:00
$text .= display_help ( 'helpb' , 'mailout' );
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
if ( e_WYSIWYG )
{
$text .= " <span style='vertical-align: super;margin-left:5%;margin-bottom:auto;margin-top:auto'><input type='button' class='button' name='usrname' value= \" " . LAN_MAILOUT_16 . " \" onclick= \" tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERNAME|') \" />
< input type = 'button' class = 'button' name = 'usrlink' value = \ " " . LAN_MAILOUT_17 . " \" onclick= \" tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|SIGNUP_LINK|') \" />
< input type = 'button' class = 'button' name = 'usrid' value = \ " " . LAN_MAILOUT_18 . " \" onclick= \" tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERID|') \" /></span> " ;
2006-12-02 04:36:16 +00:00
}
$text .= "
2009-09-03 19:32:33 +00:00
</ div ></ td >
</ tr >
2009-07-15 09:38:00 +00:00
</ table > " ;
2006-12-02 04:36:16 +00:00
2009-07-15 09:38:00 +00:00
$text .= " <div class='buttons-bar center'> " ;
2009-09-03 19:32:33 +00:00
if ( isset ( $_POST [ 'edit' ]))
{
2006-12-02 04:36:16 +00:00
$text .= " <input type='hidden' name='update_id' value=' " . $email_id . " ' /> " ;
$text .= " <input class='button' type='submit' name='update_email' value= \" " . LAN_UPDATE . " \" /> " ;
2009-09-03 19:32:33 +00:00
}
else
{
2006-12-02 04:36:16 +00:00
$text .= " <input class='button' type='submit' name='save_email' value= \" " . LAN_SAVE . " \" /> " ;
}
2007-12-22 14:49:34 +00:00
$text .= " <input class='button' type='submit' name='submit' value= \" " . LAN_MAILOUT_08 . " \" />
2006-12-02 04:36:16 +00:00
2009-07-15 09:38:00 +00:00
</ div >
2006-12-02 04:36:16 +00:00
</ form >
</ div > " ;
2009-09-03 19:32:33 +00:00
$e107 -> ns -> tablerender ( LAN_MAILOUT_15 , $text );
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
//----------------------------------------------------
// MAILER OPTIONS
//----------------------------------------------------
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
function show_prefs ()
{
2009-09-03 19:32:33 +00:00
global $pref ;
$e107 = e107 :: getInstance ();
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
$text = "
< form method = 'post' action = '".e_SELF."?".e_QUERY."' id = 'mailsettingsform' >
< div id = 'mail' >
< table cellpadding = '0' cellspacing = '0' class = 'adminform' >
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tr >
< td > " .LAN_MAILOUT_110. " < br /></ td >
< td style = 'text-align:right' >< input class = 'button' type = 'submit' name = 'testemail' value = \ " " . LAN_MAILOUT_112 . " \" />
< input name = 'testaddress' class = 'tbox' type = 'text' size = '40' maxlength = '80' value = \ " " . SITEADMINEMAIL . " \" />
</ td >
</ tr >
< tr >
< td style = 'vertical-align:top' > " .LAN_MAILOUT_115. " < br />< span class = 'smalltext' > " .LAN_MAILOUT_116. " </ span ></ td >
< td style = 'text-align:right' >
< select class = 'tbox' name = 'mailer' onchange = 'disp(this.value)' > \n " ;
$mailers = array ( 'php' , 'smtp' , 'sendmail' );
2007-12-22 14:49:34 +00:00
foreach ( $mailers as $opt )
{
2009-09-03 19:32:33 +00:00
$sel = ( $pref [ 'mailer' ] == $opt ) ? " selected='selected' " : " " ;
$text .= " <option value=' { $opt } ' { $sel } > { $opt } </option> \n " ;
2006-12-02 04:36:16 +00:00
}
$text .= " </select><br /> " ;
2007-12-22 14:49:34 +00:00
// SMTP. -------------->
$smtp_opts = explode ( ',' , varset ( $pref [ 'smtp_options' ], '' ));
2006-12-02 04:36:16 +00:00
$smtpdisp = ( $pref [ 'mailer' ] != " smtp " ) ? " display:none; " : " " ;
2007-12-22 14:49:34 +00:00
$text .= " <div id='smtp' style=' { $smtpdisp } text-align:right'>
< table style = 'margin-right:0px;margin-left:auto;border:0px' > " ;
2006-12-02 04:36:16 +00:00
$text .= " <tr>
2009-09-03 19:32:33 +00:00
< td style = 'text-align:right' > " .LAN_MAILOUT_87. " :& nbsp ; & nbsp ; </ td >
< td style = 'width:50%; text-align:right' >
< input class = 'tbox' type = 'text' name = 'smtp_server' size = '40' value = '".$pref[' smtp_server ']."' maxlength = '50' />
</ td >
</ tr >
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
< tr >
< td style = 'text-align:right' > " .LAN_MAILOUT_88. " :& nbsp ;( " .LAN_OPTIONAL. " ) & nbsp ; & nbsp ; </ td >
< td style = 'width:50%; text-align:right' >
< input class = 'tbox' type = 'text' name = 'smtp_username' size = '40' value = \ " " . $pref [ 'smtp_username' ] . " \" maxlength='50' />
</ td >
</ tr >
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
< tr >
< td style = 'text-align:right' > " .LAN_MAILOUT_89. " :& nbsp ;( " .LAN_OPTIONAL. " ) & nbsp ; & nbsp ; </ td >
< td style = 'width:50%; text-align:right' >
< input class = 'tbox' type = 'password' name = 'smtp_password' size = '40' value = '".$pref[' smtp_password ']."' maxlength = '50' />
</ td >
</ tr >
2006-12-02 04:36:16 +00:00
2009-09-03 19:32:33 +00:00
< tr >
< td colspan = '2' style = 'text-align:right' > " .LAN_MAILOUT_90. " :& nbsp ;
< select class = 'tbox' name = 'smtp_options' > \n
< option value = '' > " .LAN_MAILOUT_96. " </ option > \n " ;
2007-12-22 14:49:34 +00:00
$selected = ( in_array ( 'secure=SSL' , $smtp_opts ) ? " selected='selected' " : '' );
$text .= " <option value='smtp_ssl' { $selected } > " . LAN_MAILOUT_92 . " </option> \n " ;
$selected = ( in_array ( 'secure=TLS' , $smtp_opts ) ? " selected='selected' " : '' );
$text .= " <option value='smtp_tls' { $selected } > " . LAN_MAILOUT_93 . " </option> \n " ;
$selected = ( in_array ( 'pop3auth' , $smtp_opts ) ? " selected='selected' " : '' );
$text .= " <option value='smtp_pop3auth' { $selected } > " . LAN_MAILOUT_91 . " </option> \n " ;
$text .= " </select> \n <br /> " . LAN_MAILOUT_94 . " </td></tr> " ;
$text .= " <tr>
2009-09-03 19:32:33 +00:00
< td colspan = '2' style = 'text-align:right' > " .LAN_MAILOUT_57. " :& nbsp ;
" ;
2007-12-22 14:49:34 +00:00
$checked = ( varsettrue ( $pref [ 'smtp_keepalive' ]) ) ? " checked='checked' " : " " ;
2006-12-02 04:36:16 +00:00
$text .= " <input type='checkbox' name='smtp_keepalive' value='1' { $checked } />
2009-09-03 19:32:33 +00:00
</ td >
</ tr > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$checked = ( in_array ( 'useVERP' , $smtp_opts ) ? " checked='checked' " : " " );
$text .= " <tr>
< td colspan = '2' style = 'text-align:right' > " .LAN_MAILOUT_95. " :& nbsp ;
< input type = 'checkbox' name = 'smtp_useVERP' value = '1' { $checked } />
2009-09-03 19:32:33 +00:00
</ td >
</ tr >
</ table ></ div > " ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Sendmail. -------------->
2006-12-02 04:36:16 +00:00
$senddisp = ( $pref [ 'mailer' ] != " sendmail " ) ? " display:none; " : " " ;
2007-12-22 14:49:34 +00:00
$text .= " <div id='sendmail' style=' { $senddisp } text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'> " ;
2006-12-02 04:36:16 +00:00
$text .= "
< tr >
2007-12-22 14:49:34 +00:00
< td > " .LAN_MAILOUT_20. " :& nbsp ; & nbsp ; </ td >
2006-12-02 04:36:16 +00:00
< td style = 'text-align:right' >
< input class = 'tbox' type = 'text' name = 'sendmail' size = '60' value = \ " " . ( ! $pref [ 'sendmail' ] ? " /usr/sbin/sendmail -t -i -r " . $pref [ 'siteadminemail' ] : $pref [ 'sendmail' ]) . " \" maxlength='80' />
</ td >
</ tr >
</ table ></ div > " ;
2007-12-22 14:49:34 +00:00
2006-12-02 04:36:16 +00:00
$text .= " </td>
</ tr >
< tr >
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_25. " </ td >
< td style = 'text-align: right;' > " .LAN_MAILOUT_26. "
2007-12-22 14:49:34 +00:00
< input class = 'tbox' size = '3' type = 'text' name = 'mail_pause' value = '".$pref[' mail_pause ']."' /> " .LAN_MAILOUT_27.
" <input class='tbox' size='3' type='text' name='mail_pausetime' value=' " . $pref [ 'mail_pausetime' ] . " ' /> " . LAN_MAILOUT_29 . " .<br />
< span class = 'smalltext' > " .LAN_MAILOUT_30. " </ span >
2006-12-02 04:36:16 +00:00
</ td >
</ tr > \n
< tr >
2009-07-15 09:38:00 +00:00
< td style = 'vertical-align:top' > " .LAN_MAILOUT_31. " </ td >
< td style = ' text-align:right' >
2007-12-22 14:49:34 +00:00
" .LAN_MAILOUT_32. " : < input class = 'tbox' size = '40' type = 'text' name = 'mail_bounce_email' value = \ " " . $pref [ 'mail_bounce_email' ] . " \" /><br />
2008-01-02 20:14:13 +00:00
" .LAN_MAILOUT_33. " : < input class = 'tbox' size = '40' type = 'text' name = 'mail_bounce_pop3' value = \ " " . $pref [ 'mail_bounce_pop3' ] . " \" /><br />
2007-12-22 14:49:34 +00:00
" .LAN_MAILOUT_34. " : < input class = 'tbox' size = '40' type = 'text' name = 'mail_bounce_user' value = \ " " . $pref [ 'mail_bounce_user' ] . " \" /><br />
2008-01-02 20:14:13 +00:00
" .LAN_MAILOUT_35. " : < input class = 'tbox' size = '40' type = 'text' name = 'mail_bounce_pass' value = \ " " . $pref [ 'mail_bounce_pass' ] . " \" /><br />
" .LAN_MAILOUT_120. " : < select class = 'tbox' name = 'mail_bounce_type' > \n
< option value = '' >& nbsp ; </ option > \n
< option value = 'pop3' " .(( $pref['mail_bounce_type'] =='pop3') ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_121. " </ option > \n
< option value = 'pop3/notls' " .(( $pref['mail_bounce_type'] =='pop3/notls') ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_122. " </ option > \n
< option value = 'pop3/tls' " .(( $pref['mail_bounce_type'] =='pop3/tls') ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_123. " </ option > \n
< option value = 'imap' " .(( $pref['mail_bounce_type'] =='imap') ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_124. " </ option > \n
</ select >< br /> \n
" ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$check = ( $pref [ 'mail_bounce_delete' ] == 1 ) ? " checked='checked' " : " " ;
$text .= LAN_MAILOUT_36 . " : <input type='checkbox' name='mail_bounce_delete' value='1' { $check } />
2006-12-02 04:36:16 +00:00
</ td >
2007-12-22 14:49:34 +00:00
</ tr > \n " ;
if ( isset ( $pref [ 'mailout_sources' ]))
{ // Allow selection of email address sources
$text .= " <tr>
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_77. " </ td >
< td style = 'text-align:right' >
2007-12-22 14:49:34 +00:00
" ;
$mail_enable = explode ( ',' , $pref [ 'mailout_enabled' ]);
foreach ( explode ( ',' , $pref [ 'mailout_sources' ]) as $mailer )
{
$check = ( in_array ( $mailer , $mail_enable )) ? " checked='checked' " : " " ;
$text .= $mailer . " <input type='checkbox' name='mail_mailer_enabled[]' value=' { $mailer } ' { $check } /><br /> " ;
}
$text .= " </td></tr> \n " ;
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
list ( $mail_log_option , $mail_log_email ) = explode ( ',' , varset ( $pref [ 'mail_log_options' ], '0,0' ));
$check = ( $mail_log_email == 1 ) ? " checked='checked' " : " " ;
$text .= " <tr>
2009-07-15 09:38:00 +00:00
< td > " .LAN_MAILOUT_72. " </ td >
< td style = 'text-align:right' >
2007-12-22 14:49:34 +00:00
< select class = 'tbox' name = 'mail_log_option' > \n
< option value = '0' " .(( $mail_log_option ==0) ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_73. " </ option > \n
< option value = '1' " .(( $mail_log_option ==1) ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_74. " </ option > \n
< option value = '2' " .(( $mail_log_option ==2) ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_75. " </ option > \n
< option value = '2' " .(( $mail_log_option ==3) ? " selected = 'selected' " : " " ). " > " .LAN_MAILOUT_119. " </ option > \n
</ select >< br /> \n
< input type = 'checkbox' name = 'mail_log_email' value = '1' { $check } /> " .LAN_MAILOUT_76.
" </td>
</ tr > \n " ;
2006-12-02 04:36:16 +00:00
2009-07-15 09:38:00 +00:00
$text .= " </table>
< div class = 'buttons-bar center' >
2007-12-22 14:49:34 +00:00
< input class = 'button' type = 'submit' name = 'updateprefs' value = \ " " . LAN_MAILOUT_28 . " \" />
2009-07-15 09:38:00 +00:00
</ div >
2006-12-02 04:36:16 +00:00
2009-07-15 09:38:00 +00:00
</ div ></ form > " ;
2006-12-02 04:36:16 +00:00
$caption = LAN_PREFS ;
2009-09-03 19:32:33 +00:00
$e107 -> ns -> tablerender ( $caption , $text );
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
//--------------------------------------------------------
// Show list of saved emails
//--------------------------------------------------------
// Default is what the user wants - saved emails
// Debug modes list any type of data in the generic table - don't believe the column headings!
function showList ( $type = 'massmail' )
{
global $sql , $ns , $tp , $images_path ;
$gen = new convert ;
if ( ! ( trim ( $type ))) $type = 'massmail' ;
$qry = " SELECT g.*,u.* FROM #generic AS g LEFT JOIN #user AS u ON g.gen_user_id = u.user_id WHERE g.gen_type = ' { $type } ' ORDER BY g.gen_datestamp DESC " ;
$count = $sql -> db_Select_gen ( $qry );
$text = " <div style='text-align:center'> " ;
if ( ! $count )
{
$text = " <div class='forumheader2' style='text-align:center'> " . LAN_MAILOUT_22 . " </div> " ;
$ns -> tablerender ( " <div style='text-align:center'> " . LAN_MAILOUT_21 . " </div> " , $text );
require_once ( e_ADMIN . " footer.php " );
exit ;
}
$text .= "
< form action = '".e_SELF."' id = 'display' method = 'post' >
< table style = '".ADMIN_WIDTH."' class = 'fborder' >
< colgroup >
< col style = 'width:5%; text-align: center;' />
< col style = 'width:10%' />
< col style = 'width:40%' />
< col style = 'width:20%; text-align: center;' />
< col style = 'width:5%; text-align: center;' />
</ colgroup >
< tr >
< td class = 'fcaption' > " .LAN_MAILOUT_49. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_50. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_51. " </ td >
< td class = 'fcaption' > " .LAN_MAILOUT_52. " </ td >
< td class = 'fcaption' > " .LAN_OPTIONS. " </ td >
</ tr >
" ;
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$glArray = $sql -> db_getList ();
foreach ( $glArray as $row2 )
{
$datestamp = $gen -> convert_date ( $row2 [ 'gen_datestamp' ], " short " );
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$text .= " <tr>
2009-07-15 09:38:00 +00:00
< td > " . $row2['gen_id'] . " </ td >
< td > " . $row2['user_name'] . " </ td >
< td > " . $row2['gen_ip'] . " </ td >
< td > " . $datestamp . " </ td >
< td style = 'width:50px;white-space:nowrap' >
2007-12-22 14:49:34 +00:00
< div > " ;
2009-07-25 07:54:36 +00:00
$text .= " <a href=' " . e_SELF . " ?savedmail.edit. { $row2 [ 'gen_id' ] } '><img src=' " . $images_path . " edit_16.png' alt=' " . LAN_EDIT . " ' title=' " . LAN_EDIT . " ' class='icon S16' /></a> " ;
2007-12-22 14:49:34 +00:00
// <input type='image' name='edit[{$row2['gen_id']}]' value='edit' src='".$images_path."edit_16.png' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' />
// <input type='image' name='delete[{$row2['gen_id']}]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$row2['gen_ip']."]")."') \" src='".$images_path."delete_16.png' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' />
$text .= "
2009-07-25 07:54:36 +00:00
< a href = '".e_SELF."?savedmail.delete.{$row2[' gen_id ']}' onclick = \ " return jsconfirm(' " . $tp -> toJS ( LAN_CONFIRMDEL . " [ " . $row2 [ 'gen_ip' ] . " ] " ) . " ') \" ><img src=' " . $images_path . " delete_16.png' alt=' " . LAN_DELETE . " ' title=' " . LAN_DELETE . " ' class='icon S16' /></a>
2007-12-22 14:49:34 +00:00
</ div >
</ td >
</ tr >
" ;
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
$text .= " </table> \n </form><br /><br /><br /></div> " ;
$ns -> tablerender ( " <div style='text-align:center'> " . LAN_MAILOUT_21 . " </div> " , $text );
}
2006-12-02 04:36:16 +00:00
2007-12-22 14:49:34 +00:00
// Generate list of userclasses, including the number of members in each class.
function userclasses ( $name )
{
2006-12-02 04:36:16 +00:00
global $sql ;
2007-12-22 14:49:34 +00:00
$text .= " <select style='width:80%' class='tbox' name=' { $name } ' >
< option value = 'all' > " .LAN_MAILOUT_12. " </ option >
< option value = 'unverified' > " .LAN_MAILOUT_13. " </ option >
< option value = 'admin' > " .LAN_MAILOUT_53. " </ option >
< option value = 'self' > " .LAN_MAILOUT_54. " </ option > " ;
2006-12-02 04:36:16 +00:00
$query = " SELECT uc.*, count(u.user_id) AS members
FROM #userclass_classes AS uc
LEFT JOIN #user AS u ON u.user_class REGEXP concat('(^|,)',uc.userclass_id,'(,|$)')
GROUP BY uc . userclass_id
" ;
$sql -> db_Select_gen ( $query );
2007-12-22 14:49:34 +00:00
while ( $row = $sql -> db_Fetch ())
{
$public = ( $row [ 'userclass_editclass' ] == 0 ) ? " ( " . LAN_MAILOUT_10 . " ) " : " " ;
$text .= " <option value=' { $row [ 'userclass_id' ] } ' > " . LAN_MAILOUT_55 . " - { $row [ 'userclass_name' ] } { $public } [ { $row [ 'members' ] } ]</option> " ;
2006-12-02 04:36:16 +00:00
}
$text .= " </select> " ;
return $text ;
}
2007-12-22 14:49:34 +00:00
function mailout_adminmenu ()
{
2006-12-02 04:36:16 +00:00
$action = ( e_QUERY ) ? e_QUERY : " post " ;
2007-12-22 14:49:34 +00:00
if ( $action == " edit " )
{
2006-12-02 04:36:16 +00:00
$action = " post " ;
}
2007-12-22 14:49:34 +00:00
$var [ 'post' ][ 'text' ] = LAN_MAILOUT_56 ;
2006-12-02 04:36:16 +00:00
$var [ 'post' ][ 'link' ] = e_SELF ;
$var [ 'post' ][ 'perm' ] = " W " ;
2007-12-22 14:49:34 +00:00
$var [ 'list' ][ 'text' ] = LAN_MAILOUT_97 ; // Saved emails
2006-12-02 04:36:16 +00:00
$var [ 'list' ][ 'link' ] = e_SELF . " ?list " ;
$var [ 'list' ][ 'perm' ] = " W " ;
2007-12-22 14:49:34 +00:00
$var [ 'mailouts' ][ 'text' ] = LAN_MAILOUT_78 ; // Email runs
$var [ 'mailouts' ][ 'link' ] = e_SELF . " ?mailouts " ;
$var [ 'mailouts' ][ 'perm' ] = " W " ;
2006-12-02 04:36:16 +00:00
if ( getperms ( " 0 " )){
$var [ 'prefs' ][ 'text' ] = LAN_OPTIONS ;
$var [ 'prefs' ][ 'link' ] = e_SELF . " ?prefs " ;
$var [ 'prefs' ][ 'perm' ] = " 0 " ;
}
2007-12-22 14:49:34 +00:00
show_admin_menu ( LAN_MAILOUT_15 , $action , $var );
2006-12-02 04:36:16 +00:00
}
2007-12-22 14:49:34 +00:00
function sc_Select ( $container = 'sc_selector' )
{
2006-12-02 04:36:16 +00:00
$text = "
<!-- Start of Shortcode selector -->
< div style = 'margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id = '{$container}' >
< div style = 'position:absolute; bottom:30px; right:125px' >
< table class = 'fborder' style = 'background-color: #fff' >
2009-07-15 09:38:00 +00:00
< tr >< td >
2007-10-28 13:03:26 +00:00
< select class = 'tbox' name = 'sc_sel' onchange = \ " addtext(this.value); this.selectedIndex= 0; expandit(' { $container } ') \" >
2006-12-02 04:36:16 +00:00
< option value = '' > -- </ option > \n " ;
$sc = array (
2007-12-22 14:49:34 +00:00
" |USERNAME| " => LAN_MAILOUT_16 ,
" |SIGNUP_LINK| " => LAN_MAILOUT_17 ,
" |USERID| " => LAN_MAILOUT_18
2006-12-02 04:36:16 +00:00
);
foreach ( $sc as $key => $val ){
$text .= " <option value=' " . $key . " '> " . $val . " </option> \n " ;
}
$text .= "
</ select ></ td ></ tr > \n </ table ></ div >
</ div >
\n <!-- End of SC selector -->
" ;
return $text ;
}
function headerjs ()
{
$text = "
< script type = 'text/javascript' >
function disp ( type ) {
if ( type == 'smtp' ){
document . getElementById ( 'smtp' ) . style . display = '' ;
document . getElementById ( 'sendmail' ) . style . display = 'none' ;
return ;
}
if ( type == 'sendmail' ){
document . getElementById ( 'smtp' ) . style . display = 'none' ;
document . getElementById ( 'sendmail' ) . style . display = '' ;
return ;
}
document . getElementById ( 'smtp' ) . style . display = 'none' ;
document . getElementById ( 'sendmail' ) . style . display = 'none' ;
}
</ script > " ;
return $text ;
}
?>