$data) {
$fid = current(array_keys($data));
$search_fields[$fid] = $data[$fid];
}
}
$SearchCriteria['Fields'] = $search_fields;
if (!isset($SearchCriteria['Status'])) $SearchCriteria['Status'] = 'ALL';
if (!isset($SearchCriteria['Confirmed'])) $SearchCriteria['Confirmed'] = 'ALL';
if (!isset($SearchCriteria['SearchFormat'])) $SearchCriteria['SearchFormat'] = 'ALL';
if (!isset($SearchCriteria['Email'])) $SearchCriteria['Email'] = '';
if (!isset($SearchCriteria['HaveClickedLink'])) $SearchCriteria['HaveClickedLink'] = '';
} else {
$SearchCriteria = array(
'Status' => '1',
'Confirmed' => '1',
'SearchFormat' => 'ALL',
'Email' => '',
'HaveClickedLink' => '',
'Fields' => array(
)
);
$responder['Name'] = '';
}
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Autoresponder Name"] = "textfield|Name:100:44:" . $responder['Name'];
$HELP_ITEMS["Name"]["Title"] = "Auto responder Name";
$HELP_ITEMS["Name"]["Content"] = "Enter a name for the auto responder here.";
//search for members form!
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Match Status"]="select|Status:1:ALL->View All;0->Inactive;1->Active:" . $SearchCriteria['Status'];
$HELP_ITEMS["Status"]["Title"] = "Status";
$HELP_ITEMS["Status"]["Content"] = "Should this auto responder be sent to only active, only inactive or all subscribers?";
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Match Confirmed"]="select|Confirmed:1:ALL->Either;0->Not Confirmed;1->Confirmed:" . $SearchCriteria['Confirmed'];
$HELP_ITEMS["Confirmed"]["Title"] = "Confirmed";
$HELP_ITEMS["Confirmed"]["Content"] = "Should this auto responder be sent to only confirmed, only unconfirmed or all subscribers?";
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Match Format"]="select|SearchFormat:1:ALL->Either;1->Text;2->HTML:" . $SearchCriteria['SearchFormat'];
$HELP_ITEMS["SearchFormat"]["Title"] = "Format";
$HELP_ITEMS["SearchFormat"]["Content"] = "Should this auto responder be sent to subscribers who are flagged to receive text, HTML or both types of newsletters?";
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match Email"]="textfield|Email:100:44:" . $SearchCriteria['Email'];
$HELP_ITEMS["Email"]["Title"] = "Match Email";
$HELP_ITEMS["Email"]["Content"] = "If you want to filter which subscribers receive this email, then enter the complete or partial email address to match here.";
$links = FetchLinks();
$alllinks = '0->Not Applicable;A->Any Link;';
foreach($links as $pos => $details) {
$alllinks .= $details['LinkID'] . '->' . str_replace(':', '$$COLON$$', $details['URL']) . ';';
}
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Have Clicked Link"]="select|HaveClickedLink:1:$alllinks:" . $SearchCriteria['HaveClickedLink'];
$HELP_ITEMS["HaveClickedLink"]["Title"] = "Have Clicked Link";
$HELP_ITEMS["HaveClickedLink"]["Content"] = "Should this auto responder be sent only to subscribers who have clicked on a particular link?";
if (!empty($custom_fields)) {
$FORM_ITEMS['-100'] = 'spacer|
| Filter by Custom Fields | |
| ';
}
foreach($custom_fields as $pos => $f) {
$f = stripslashes_array($f);
$default = (isset($SearchCriteria['Fields'][$f['FieldID']])) ? $SearchCriteria['Fields'][$f['FieldID']] : '';
switch($f['FieldType']){
case 'shorttext':
if (strpos($f['AllValues'], ',') === false) {
$size = 10; $min = 10; $max = 10;
} else {
list($size,$min,$max)=explode(',',$f['AllValues']);
}
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match ".$f['FieldName']]="textfield|Fields[".$f['FieldID']."]:$max:44:" . $default;
break;
case 'longtext':
if (strpos($f['AllValues'], ',') === false) {
$Width = 10; $Height=5;
} else {
list($Width,$Height)=explode(',',$f['AllValues']);
}
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match ".$f['FieldName']]="textfield|Fields[".$f['FieldID']."]:500:44:" . $default;
break;
case 'checkbox':
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM ."Match " . $f["FieldName"]]="select|Fields[".$f['FieldID']."]:1:y->Yes;n->No;all->All:all;:" . $default;
break;
case 'multicheckbox':
$default = (isset($SearchCriteria['Fields'][$f['FieldID']])) ? $SearchCriteria['Fields'][$f['FieldID']] : array();
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match " . $f["FieldName"]]="checkboxes|Fields[".$f["FieldID"]."]:" . $f['AllValues'] . ":".implode(',',$default);
break;
case 'dropdown':
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match " . $f['FieldName']]="select|Fields[".$f['FieldID']."]:1:->All Values;".$f['AllValues'].":".$default;
break;
case 'number':
if (strpos($f['AllValues'], ',') === false) {
$size = 10; $min = 10; $max = 10;
} else {
list($size,$min,$max)=explode(',',$f['AllValues']);
}
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match ".$f['FieldName']]="number|Fields[".$f['FieldID']."]:$max:44:" . $default;
$HELP_ITEMS['Fields['.$f['FieldID'].']']['Title'] = 'Search Numbers';
$HELP_ITEMS['Fields['.$f['FieldID'].']']['Content'] = 'You can use operators like >, <, <=, >= in this field';
break;
case 'datebox':
$defaults = array();
$default = (isset($SearchCriteria['Fields'][$f['FieldID']])) ? $SearchCriteria['Fields'][$f['FieldID']] : array();
$defaults['dd_start'] = (isset($default['dd_start'])) ? $default['dd_start'] : 1;
$defaults['mm_start'] = (isset($default['mm_start'])) ? $default['mm_start'] : 1;
$defaults['yy_start'] = (isset($default['yy_start'])) ? $default['yy_start'] : date('Y');
$defaults['dd_end'] = (isset($default['dd_end'])) ? $default['dd_end'] : 1;
$defaults['mm_end'] = (isset($default['mm_end'])) ? $default['mm_end'] : 1;
$defaults['yy_end'] = (isset($default['yy_end'])) ? $default['yy_end'] : date('Y');
$defaults['type'] = (isset($default['type'])) ? $default['type'] : 'ignore';
$defaults['enable'] = (isset($default['enable'])) ? $default['enable'] : '';
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Match ".$f['FieldName']]="dateboxsearch|Fields[".$f['FieldID']."]:" . $f['AllValues'] . ":" . implode(',',$defaults);
break;
}
}
$FORM_ITEMS[-1]="submit|Next »:1-autoresponders?Action=ViewResponders&ListID=$ListID";
$FORM=new AdminForm;
$FORM->title="SelectList";
$FORM->items=$FORM_ITEMS;
$link = "autoresponders?Action=".$Action."&Step=2&ListID=$ListID";
if ($Action == 'Edit') $link .= '&AutoresponderID=' . $_GET['AutoresponderID'];
$FORM->action=MakeAdminLink($link);
$FORM->MakeForm("Autoresponder Details");
$FORM->output = "Choose who your autoresponder will be sent to. When you are done, click on the 'Next' button." . $FORM->output; $title = ($Action == 'Edit') ? 'Edit' : 'Create'; $OUTPUT.=MakeBox($title . " Autoresponder (Step 1 of 3)", $FORM->output); $OUTPUT .= ' '; break; case 2: $search_args = array(); $search_args['ListID'] = $_REQUEST['ListID']; $search_args['Email'] = $_POST['Email']; $search_args['Status'] = $_POST['Status']; $search_args['Confirmed'] = $_POST['Confirmed']; $search_args['SearchFormat'] = $_POST['SearchFormat']; $search_args['HaveClickedLink'] = $_POST['HaveClickedLink']; if (!empty($_POST['Fields'])) { $db_fields = array(); $db_fields_result = mysql_query("SELECT * FROM " . $TABLEPREFIX . "list_fields"); while($db_field_row=mysql_fetch_assoc($db_fields_result)) { $db_fields[] = stripslashes_array($db_field_row); } $Fields = $_POST['Fields']; foreach($db_fields as $fid => $f) { $val=(isset($Fields[$f['FieldID']])) ? $Fields[$f['FieldID']] : ''; if (empty($val)) continue; if ($f['FieldType'] == 'checkbox' && $val == 'all') continue; if ($f['FieldType'] == 'datebox' || $f['FieldType'] == 'multicheckbox') { if (!is_array($val)) { $val = stripslashes($val); $val = unserialize(stripslashes($val)); } if (isset($val['type']) && strtolower($val['type']) == 'ignore') continue; } $val = stripslashes_array($val); $search_args['Fields'][] = array($f['FieldID'] => $val); } } $templateid = (isset($_POST['TemplateID'])) ? $_POST['TemplateID'] : 0; if ($Action == 'Add') { $qry = "INSERT INTO " . $TABLEPREFIX . "autoresponders(ListID, DateCreated, SearchCriteria, Name, AdminID) VALUES ('" . addslashes($_GET['ListID']) . "', '" . $SYSTEMTIME . "', '" . addslashes(serialize($search_args)) . "', '" . addslashes($_POST['Name']) . "', '" . addslashes($CURRENTADMIN['AdminID']) . "')"; mysql_query($qry); $AutoresponderID = mysql_insert_id(); } else { $qry = "UPDATE " . $TABLEPREFIX . "autoresponders SET Name='" . addslashes($_POST['Name']) . "', SearchCriteria='" . addslashes(serialize($search_args)) . "' WHERE AutoresponderID='" . addslashes($_GET['AutoresponderID']) . "'"; mysql_query($qry); $AutoresponderID = $_GET['AutoresponderID']; } $responder_result = mysql_query("SELECT * FROM " . $TABLEPREFIX . "autoresponders WHERE AutoresponderID='" . addslashes($AutoresponderID) . "'"); $responder = stripslashes_array(mysql_fetch_assoc($responder_result)); if (!isset($responder['ReplyTo'])) $responder['ReplyTo'] = $responder['SendFrom']; if (!isset($responder['ReturnPath'])) $responder['ReturnPath'] = $responder['SendFrom']; if ($Action == 'Add') { $list_fetch_result = mysql_query("SELECT WebmasterName, WebmasterEmail FROM " . $TABLEPREFIX . "lists WHERE ListID='" . addslashes($_GET['ListID']) . "'"); $row = mysql_fetch_assoc($list_fetch_result); $name = $row['WebmasterName']; $email = $row['WebmasterEmail']; $responder['SendName'] = stripslashes($name); $responder['SendFrom'] = $responder['ReturnPath'] = stripslashes($email); $responder['ReplyTo'] = stripslashes($email); } if($CURRENTADMIN['Manager'] == 1) { $templates=mysql_query("SELECT * FROM " . $TABLEPREFIX . "templates ORDER BY TemplateName ASC"); } else { $templates=mysql_query("SELECT * FROM " . $TABLEPREFIX . "templates WHERE AdminID = '" . addslashes($CURRENTADMIN['AdminID']) . "' ORDER BY TemplateName ASC"); } $alltemps = ''; while($temp=mysql_fetch_assoc($templates)){ $alltemps.= stripslashes($temp["TemplateID"]).'->'.stripslashes($temp["TemplateName"]) . ';'; } $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Send From Name"]="textfield|SendName:1000:46:" . $responder['SendName']; $HELP_ITEMS["SendName"]["Title"] = "Send Name"; $HELP_ITEMS["SendName"]["Content"] = "Which person or company name should show in the "From Name" field for this email?"; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Send From Email"] = "textfield|SendFrom:1000:46:" . $responder['SendFrom']; $HELP_ITEMS["SendFrom"]["Title"] = "Send From Email"; $HELP_ITEMS["SendFrom"]["Content"] = "The email address that should appear in the \'From\' field when this autoresponder email is sent."; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Reply-To Email"] = "textfield|ReplyTo:1000:46:" . $responder['ReplyTo']; $HELP_ITEMS["ReplyTo"]["Title"] = "Reply-To Email"; $HELP_ITEMS["ReplyTo"]["Content"] = "If someone hits reply, the email will get sent to this address."; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Return-Path Email"] = "textfield|ReturnPath:1000:46:" . $responder['ReturnPath']; $HELP_ITEMS["ReturnPath"]["Title"] = "Return-Path Email"; $HELP_ITEMS["ReturnPath"]["Content"] = "Where emails will be bounced to if they don\'t work."; $format = $responder['Format']; if ($format <= 0) $format = 1; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Email Format"]="select|Format:1:1->Text;2->HTML;3->HTML and Text;:" . $format; $HELP_ITEMS["Format"]["Title"] = "Newsletter Format"; $HELP_ITEMS["Format"]["Content"] = "How will this autoresponder be composed and sent? Select HTML if you want to include colored text, images, tables, etc. Choose text to create and send your autoresponder in plain-text. Alternatively, you can choose \'Both HTML and Text\' to create 2 versions of your autoresponder. Subscribers who can view HTML will see the HTML version. Those that can\'t will see the plain-text version only."; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Use Template"]="select|TemplateID:5:$alltemps::onDblClick=\"showTemplatePreview(this)\""; $HELP_ITEMS["TemplateID"]["Title"] = "Use Template?"; $HELP_ITEMS["TemplateID"]["Content"] = "If you have created a template, you can choose to use it from the list below. The content from that template will then be included in your autoresponder content on the next page. Double click on a template to preview it."; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Hours Delayed"]="textfield|HoursAfter:4:3:" . $responder['HoursAfterSubscription']; $HELP_ITEMS["HoursAfter"]["Title"] = "Hours Delayed"; $HELP_ITEMS["HoursAfter"]["Content"] = "How many hours after someone subscribes to your mailing list should this autoresponder be sent to them (in hours)?"; $multipart = ($responder['Multipart'] == 1) ? 'CHECKED' : ''; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Send Multipart"]="checkbox|Multipart:1:Yes, send the email as multipart :" . $multipart; $HELP_ITEMS["Multipart"]["Title"] = "Send Multipart"; $HELP_ITEMS["Multipart"]["Content"] = "Sending a multipart email will let the subscribers email program decide which format to display the newsletter in. It is best to use this if you don\'t give your subscribers a choice to which format they receive (e.g. they all subscribe as HTML), when they receive the newsletter their email program will show them the correct version."; $trackopens = ($responder['TrackOpens'] == 1) ? 'CHECKED' : ''; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Track Email Opens"]="checkbox|TrackOpens:1:Yes, track opening of HTML emails :" . $trackopens; $HELP_ITEMS["TrackOpens"]["Title"] = "Track Email Opens"; $HELP_ITEMS["TrackOpens"]["Content"] = "Track opening of emails when a subscriber receives a newsletter. This only applies to HTML newsletters."; $tracklinks = ($responder['TrackLinks'] == 1) ? 'CHECKED' : ''; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Track Links"]="checkbox|TrackLinks:1:Yes, track all links in this newsletter :" . $tracklinks; $HELP_ITEMS["TrackLinks"]["Title"] = "Track Links"; $HELP_ITEMS["TrackLinks"]["Content"] = "Track all links in this newsletter (for use with statistics)"; $FORM_ITEMS[-1]="submit|Next »:1-autoresponders?Action=ViewResponders&ListID=$ListID"; $FORM=new AdminForm; $FORM->title="SelectList"; $FORM->items=$FORM_ITEMS; $FORM->action=MakeAdminLink("autoresponders?Action=Add&Step=3&ListID=$ListID&AutoresponderID=".$AutoresponderID); $FORM->MakeForm("Autoresponder Details"); $title = ($Action == 'Edit') ? 'Edit' : 'Create'; $FORM->output = "Complete the form below to ".strtolower($title)." your autoresponder. Double click on a template to preview it before continuing. When you are done, click on the 'Next' button." . $FORM->output; $OUTPUT.=MakeBox($title . " Autoresponder (Step 2 of 3)", $FORM->output); $OUTPUT .= ' '; break; case 3: $multipart = (isset($_POST['Multipart'])) ? 1 : 0; $tracklinks = (isset($_POST['TrackLinks'])) ? 1 : 0; $trackopens = (isset($_POST['TrackOpens'])) ? 1 : 0; $qry = "UPDATE " . $TABLEPREFIX . "autoresponders SET SendName='" . addslashes($_POST['SendName']) . "', SendFrom='" . addslashes($_POST['SendFrom']) . "', ReturnPath='" . addslashes($_POST['ReturnPath']) . "', ReplyTo='" . addslashes($_POST['ReplyTo']) . "', Format='" . addslashes($_POST['Format']) . "', Multipart='" . addslashes($multipart) . "', TrackLinks='" . addslashes($tracklinks) . "', TrackOpens='" . addslashes($trackopens) . "', HoursAfterSubscription='" . addslashes($_POST['HoursAfter']) . "' WHERE AutoresponderID='" . addslashes($_GET['AutoresponderID']) . "'"; mysql_query($qry); $responder_result = mysql_query("SELECT * FROM " . $TABLEPREFIX . "autoresponders WHERE AutoresponderID='" . addslashes($_GET['AutoresponderID']) . "'"); $responder = stripslashes_array(mysql_fetch_assoc($responder_result)); $htmlbody = $responder['HTMLBody']; $textbody = $responder['TextBody']; if (isset($_POST['TemplateID']) && $_POST['TemplateID'] > 0) { $template=mysql_fetch_assoc(mysql_query("SELECT * FROM " . $TABLEPREFIX . "templates WHERE TemplateID='".addslashes($_POST['TemplateID'])."'")); $htmlbody = $template['HTMLContent']; $textbody = $template['TextContent']; } $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Email Subject"]="textfield|Subject:1000:46:" . str_replace(':', '$$COLON$$', $responder['Subject']); $HELP_ITEMS["Subject"]["Title"] = "Email Subject"; $HELP_ITEMS["Subject"]["Content"] = "The subject line that your subscribers will see when this autoresponder arrives in their inbox."; $Format = $responder['Format']; switch($Format) { case '1': //Text $intro = 'Complete the form below to build a text-only autoresponder.'; break; case '2': //HTML $intro = 'Complete the form below to build a HTML-only autoresponder.'; break; case '3': //Both $intro = 'Complete the form below to build a multi-part autoresponder containing both text and HTML versions.'; break; } if($Format == 2 || $Format == 3) { $FORM_ITEMS['-300'] = 'spacer| | |
| HTML Content | |
| ';
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "HTML Content"]="wysiwyg|HTMLBODY:64:10:".str_replace("|", "|",str_replace(":",'$$COLON$$',stripslashes($htmlbody)));
$HELP_ITEMS["HTMLBODY"]["Title"] = "HTML Content";
$HELP_ITEMS["HTMLBODY"]["Content"] = "Enter the HTML content for your autoresponder here.";
$FORM_ITEMS[-4]="spacer| [ Insert HTML Custom Field ]"; $FORM_ITEMS[-8]="spacer| "; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "OR HTML Content from URL"]="textfield|HTMLFile:1000:100:http://"; $HELP_ITEMS["HTMLFile"]["Title"] = "HTML Content from URL"; $HELP_ITEMS["HTMLFile"]["Content"] = "If you have already uploaded your autoresponder as a HTML file, enter the URL of the file and it will be downloaded and saved as the content of your newsletter."; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "OR HTML Content From File"]="file|HTMLContentFile"; $HELP_ITEMS["HTMLContentFile"]["Title"] = "HTML Content from File"; $HELP_ITEMS["HTMLContentFile"]["Content"] = "Select a file from your local hard drive to use as content for this autoresponder."; if($Format == 3) { $FORM_ITEMS[-2]="spacer| [ Extract Text from HTML » ] Note: On some browsers, you may lose line breaks. As a workaround, simply select all the content in the HTML editor (Ctrl A), then copy and paste into the Text editor below.')\" src='" . $ROOTURL . "admin/images/help.gif' width='24' height='16' border='0'>"; } } if($Format == 1 || $Format == 3) { if($Format == 3) $FORM_ITEMS[-3]="spacer| "; $FORM_ITEMS['-400'] = 'spacer| | |
| Text Content | |
| ';
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Text Content"]="textarea|TEXTBODY:60:30:".str_replace("|", "|",str_replace(":",'$$COLON$$',stripslashes($textbody)));
$HELP_ITEMS["TEXTBODY"]["Title"] = "Text Content";
$HELP_ITEMS["TEXTBODY"]["Content"] = "Enter the text for your autoresponder here.";
$FORM_ITEMS[-9]="spacer| "; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "OR Text Content from URL"]="textfield|TextFile:1000:100:http://"; $HELP_ITEMS["TextFile"]["Title"] = "Text Content from URL"; $HELP_ITEMS["TextFile"]["Content"] = "If you have already uploaded your autoresponder as a text file, enter the URL of the file and it will be downloaded and saved as the content of your autoresponder."; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "OR Text Content from File"]="file|TextContentFile"; $HELP_ITEMS["TextContentFile"]["Title"] = "Text Content from File"; $HELP_ITEMS["TextContentFile"]["Content"] = "Select a file from your local hard drive to use as content for this autoresponder."; $FORM_ITEMS[-7]="spacer| [Insert Text Custom Field]"; } $attachments_query = "SELECT AttachmentID, AttachmentName, AttachmentDescription FROM " . $TABLEPREFIX . "attachments WHERE Status='1'"; if (!isset($CURRENTADMIN['Manager']) || $CURRENTADMIN['Manager'] != 1) $attachments_query .= " AND AdminID='".addslashes($CURRENTADMIN['AdminID']) . "'"; $attachments_query .= " ORDER BY AttachmentDescription"; $attachments = ''; $result = mysql_query($attachments_query); while($temp = mysql_fetch_assoc($result)) { $attachments .= stripslashes($temp['AttachmentID']) . '->'. stripslashes($temp['AttachmentDescription']) . ' (' . stripslashes($temp['AttachmentName']).');'; } if ($attachments != '') { $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Include Attachments"]="select|AttachmentIDs[]:5:$attachments:".str_replace(':', '~', $responder['AttachmentIDs']).":multiple"; $HELP_ITEMS["AttachmentIDs"]["Title"] = "Include Attachments"; $HELP_ITEMS["AttachmentIDs"]["Content"] = "If you would like to put attachments with this email, choose them here. To select more than one, hold down the CTRL key. To unselect one, hold down the CTRL key and click it again."; } $FORM_ITEMS['-100'] = 'spacer| | |
| Preview Newsletter | ||||||||||||||||
';
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Email Address"]="textfield|PreviewEmail:100:44::0: ";
$HELP_ITEMS["PreviewEmail"]["Title"] = "Email Address";
$HELP_ITEMS["PreviewEmail"]["Content"] = "If you\'d like to preview this newsletter before it\'s sent out, then enter your email address here, and click on the \'Send Preview\' button below.";
$FORM_ITEMS["-5"]="spacer| ";
$FORM_ITEMS["-1"]="submit|Finish:1-autoresponders?Action=ViewResponders&ListID=$ListID";
$RandomKey=uniqid("a");
$FORM_ITEMS["-12"]="hidden|RandomKey:$RandomKey";
$FORM_ITEMS["-15"]="hidden|Format:$Format";
$FORM=new AdminForm;
$FORM->title="Edit Autoresponder";
$FORM->items=$FORM_ITEMS;
$FORM->action=MakeAdminLink("autoresponders?Action=Add&Step=4&ListID=$ListID&AutoresponderID=".$_GET['AutoresponderID']);
$FORM->MakeForm("Autoresponder Details");
$FORM->output = $intro . $FORM->output;
$title = ($Action == 'Edit') ? 'Edit' : 'Create';
$OUTPUT.=MakeBox($title . " Autoresponder (Step 3 of 3)",$FORM->output);
$OUTPUT .= '
';
break;
case 4:
$textbody = (isset($_POST['TEXTBODY'])) ? $_POST['TEXTBODY'] : '';
$htmlbody = (isset($_POST['wysiwyg'])) ? $_POST['wysiwyg'] : '';
$errorfound = false;
if (isset($_POST['TextFile'])) {
$TextFile = $_POST['TextFile'];
// Do we need to load an external file?
if(isset($TextFile) && $TextFile != '' && $TextFile != 'http://')
{
if(substr($TextFile, 0,7) == 'http://')
{
// Try and grab the external file
$textbody = '';
if($fp = fopen($TextFile, 'rb'))
{
while(!feof($fp))
{
$textbody .= fgets($fp, 1024);
}
fclose($fp);
}
else
{
$OUTPUT .= MakeErrorBox("Invalid Content File", "The file '$TextFile' couldn't be loaded. The URL you specified may be invalid.");
$DoSave = false;
}
}
else
{
// Invalid file
$OUTPUT .= MakeErrorBox("Invalid Content File", "The URL you specified must start with 'http://'.");
$DoSave = false;
}
}
}
$text_content = ReadUploadedFile('TextContentFile');
if (!$text_content) {
$OUTPUT .= MakeErrorBox("Invalid Content File", "Unable to find contents of uploaded file.");
$errorfound = true;
}
if ($text_content != '-1') {
$textbody = $text_content;
}
if (isset($_POST['HTMLFile'])) {
$HTMLFile = $_POST['HTMLFile'];
// Do we need to load an external HTML file?
if(isset($HTMLFile) && $HTMLFile != '' && $HTMLFile != 'http://')
{
if(substr($HTMLFile, 0,7) == 'http://')
{
// Try and grab the external file
$htmlbody = '';
if($fp = fopen($HTMLFile, 'rb'))
{
while(!feof($fp))
{
$htmlbody .= fgets($fp, 1024);
}
fclose($fp);
}
else
{
$OUTPUT .= MakeErrorBox("Invalid Content File", "The file '$HTMLFile' couldn't be loaded. The URL you specified may be invalid.");
$errorfound = true;
}
}
else
{
// Invalid file
$OUTPUT .= MakeErrorBox("Invalid Content File", "The URL you specified must start with 'http://'.");
$errorfound = true;
}
}
}
$html_content = ReadUploadedFile('HTMLContentFile');
if (!$html_content) {
$OUTPUT .= MakeErrorBox("Invalid Content File", "Unable to find contents of uploaded file.");
$errorfound = true;
}
if ($html_content != '-1') {
$htmlbody = $html_content;
}
$htmlbody = str_replace($BAD_ENCODED_CHARS, $PROPER_ENCODED_CHARS, $htmlbody);
$attachments = (isset($_POST['AttachmentIDs'])) ? $_POST['AttachmentIDs'] : array();
$attachments_list = implode(':', $attachments);
if (!$errorfound) {
$qry = "UPDATE " . $TABLEPREFIX . "autoresponders SET Subject='" . addslashes($_POST['Subject']) . "', HTMLBody='" . addslashes($htmlbody) . "', TextBody='" . addslashes($textbody) . "', AttachmentIDs='".addslashes($attachments_list)."' WHERE AutoresponderID='" . addslashes($_GET['AutoresponderID']) . "'";
mysql_query($qry);
$OUTPUT .= MakeSuccessBox("Autoresponder Saved Successfully", "The selected autoresponder has been saved successfully.", MakeAdminLink("autoresponders?ListID=$ListID&Action=ViewResponders"));
}
break;
}
}
if($Action=="DeleteResponder") {
mysql_query("DELETE FROM " . $TABLEPREFIX . "autoresponders WHERE AutoresponderID='".addslashes($_GET['AutoresponderID'])."'");
$Action="ViewResponders";
}
if($Action == 'ViewResponders')
{
$responders=mysql_query("SELECT * FROM " . $TABLEPREFIX . "autoresponders WHERE ListID='".addslashes($ListID)."' ORDER BY Subject ASC");
$AO = '';
if(mysql_num_rows($responders) > 0)
{
$AO.='
To create a new autoresponder, click on the "Create Autoresponder" button below. ' . $AO; } else { $AO = 'The are currently no saved autoresponders. Click "Create Autoresponder" to create one. ' . $AO; } $OUTPUT.=MakeBox("Manage Autoresponders",$AO); } if(!$ListID && $Action != 'SendPreview') { $lists=mysql_query("SELECT * FROM " . $TABLEPREFIX . "lists ORDER BY ListName ASC"); $alllists = ''; while($l=mysql_fetch_assoc($lists)) { $l = stripslashes_array($l); if(AllowList($l["ListID"])) { if ($CURRENTADMIN['DisplaySummaries']) { $numSubs = (int)mysql_result(mysql_query("SELECT COUNT(*) from " . $TABLEPREFIX . "members where ListID=" . addslashes($l['ListID'])), 0, 0); if($numSubs == 1) $subs = "1 subscriber"; else $subs = number_format($numSubs, 0) . " subscribers"; $subs = " (" . $subs . ")"; } else { $subs = ""; } $alllists.=$l["ListID"]."->".str_replace(';', '$$SEMI$$', str_replace(':', '$$COLON$$', $l["ListName"]))."$subs;"; } } if ($alllists == '') { $OUTPUT = MakeBox("Manage Autoresponders",'No mailing lists have been created. Please click on the "Create Mailing List" button below to create one. '); } else { $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Mailing List"]="select|ListID:5:$alllists"; $FORM_ITEMS["-1"]="submit|Next »"; $FORM=new AdminForm; $FORM->title="SelectList"; $FORM->items=$FORM_ITEMS; $FORM->action=MakeAdminLink("autoresponders?Action=ViewResponders"); $FORM->MakeForm("Mailing List Details"); $FORM->output = "Before you can create or view existing autoresponders, please choose a mailing list to work with." . $FORM->output; $OUTPUT.=MakeBox("Manage Autoresponders",$FORM->output); $OUTPUT .= ' '; } } if($Action == 'PreviewTopFrame') { ob_start(); ?> this.focus()
| ||||||||||||||||