this.focus()
[x] Close
Preview Sent Successfully
 
A preview of your newsletter has been sent to " . $PreviewEmail . ".

Send Preview Again »
"; } } else { // The email couldn't be sent $OUTPUT .= MakeErrorBox("An Error Occurred", "Please provide an email address to send the preview to."); } } echo $OUTPUT; OutputPageFooter(false); die(); } if($Action == 'Copy') { // Copy the newsletter to a new record $cResult = mysql_query("SELECT * FROM " . $TABLEPREFIX . "composed_emails WHERE ComposedID = '".addslashes($ComposedID)."'"); if($cRow = mysql_fetch_assoc($cResult)) { $cRow = stripslashes_array($cRow); $iQuery = "INSERT INTO " . $TABLEPREFIX . "composed_emails values(0,'" . addslashes($cRow['Format']) . "','" . addslashes($NewsletterName) . "','" . time() . "','" . addslashes($cRow['Subject']) . "','" . addslashes($cRow['TextBody']). "','" . addslashes($cRow['HTMLBody']) . "','" . addslashes($cRow['AdminID']) . "', '" . addslashes($cRow['AttachmentIDs']) . "')"; if(mysql_query($iQuery)) { $OUTPUT .= MakeSuccessBox("Newsletter Copied Successfully", "The selected newsletter has been copied successfully.", MakeAdminLink("compose?Action=")); } else { // Couldn't run the query $OUTPUT .= MakeErrorBox("An Error Occurred", "The selected newsletter couldn't be copied."); } } else { $OUTPUT .= MakeErrorBox("An Error Occurred", "The selected newsletter no longer exists."); } } if($Action == 'CopyForm') { // Show the form to copy one newsletter to another $EmailName = mysql_result(mysql_query("SELECT EmailName FROM " . $TABLEPREFIX . "composed_emails where ComposedID = '".addslashes($ComposedID)."'"), 0, 0); $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Newsletter Name"]="textfield|NewsletterName:100:44:Copy of " . $EmailName; $HELP_ITEMS["NewsletterName"]["Title"] = "Newsletter Name"; $HELP_ITEMS["NewsletterName"]["Content"] = "Enter a name for the new newsletter here."; $FORM_ITEMS[-1]="submit|Save:1-compose"; $RandomKey=uniqid("p"); $FORM_ITEMS[-12]="hidden|RandomKey:$RandomKey"; $FORM=new AdminForm; $FORM->title="CopyEmail"; $FORM->items=$FORM_ITEMS; $FORM->action=MakeAdminLink("compose?Action=Copy&ComposedID=$ComposedID"); $FORM->MakeForm("Copy Newsletter"); $FORM->output = "Complete the form below to copy the selected newsletter.
" . $FORM->output; $OUTPUT.=MakeBox("Copy Newsletter",$FORM->output); $OUTPUT .= ' '; } if($Action == 'PreviewTopFrame') { ob_start(); ?>
  [ x Close ]  
"> ">
Keep clear of words such as \'Free\', \'\$\$\$\', \'RE:\', etc as these words could trigger spam filters on your subscribers mail server, meaning that they wouldn\'t receive this newsletter."; $FORM_ITEMS[-2]="spacer| "; $FORM_ITEMS[-2]="hidden|Format:$Format"; if($Format != 1) { $FORM_ITEMS['-300'] = 'spacer|
  HTML Content
'; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "HTML Content"]="wysiwyg|HTMLBODY:64:10:".str_replace("|", "|", str_replace(":",'$$COLON$$',stripslashes($Composed["HTMLBody"]))); $FORM_ITEMS[-4]="spacer|
[ Insert HTML Custom Field ]"; $FORM_ITEMS[-3]="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 newsletter 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 newsletter."; $FORM_ITEMS[-4]="spacer|
[ Insert HTML Custom Field ] [ Insert Unsubscribe Link ]"; if($Format == 3) { $FORM_ITEMS[-9]="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 > 2) { $FORM_ITEMS['-400'] = 'spacer|

  Text Content
'; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Text Content"]="textarea|TEXTBODY:60:30:".str_replace("|", "|",str_replace(":",'$$COLON$$',stripslashes($Composed["TextBody"]))); $FORM_ITEMS[-8]="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 newsletter as a text 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 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 newsletter."; $FORM_ITEMS[-8]="spacer|
[Insert Text Custom Field] [ Insert Unsubscribe Link ]
 "; } if ($Format == 1) { $OUTPUT .= ' '; } /* $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Add Attachment"]="raw|Add Attachment"; */ $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(':', '~', $Composed['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[-6]="spacer| "; $FORM_ITEMS[-1]="submit|Finish:1-compose"; $RandomKey=uniqid("p"); $FORM_ITEMS[-12]="hidden|RandomKey:$RandomKey"; $FORM=new AdminForm; $FORM->title="EditEmail"; $FORM->items=$FORM_ITEMS; $FORM->action=MakeAdminLink("compose?Action=EditEmail&Format=$Format&ComposedID=$ComposedID&Save=Yes"); $FORM->MakeForm("Newsletter Content"); $FORM->output = $intro . $FORM->output; if($SubAction == '') $OUTPUT.=MakeBox("Create Newsletter (Step 2 of 2)",$FORM->output); else $OUTPUT.=MakeBox("Update Newsletter",$FORM->output); $OUTPUT .= ' '; } } if($OrigAction != 'EditEmail') { $Total = 0; $PerPage = 20; $Pages = 0; $TO = ''; $ListName = 'All Lists'; if($Action=='') { if($CURRENTADMIN['Manager'] == 1) { $Total = mysql_result(mysql_query("SELECT COUNT(*) FROM " . $TABLEPREFIX . "composed_emails"), 0, 0); $templates = mysql_query("SELECT * FROM " . $TABLEPREFIX . "composed_emails ORDER BY EmailName LIMIT ".($OffSet*$PerPage).",$PerPage"); } else { $Total = mysql_result(mysql_query("SELECT COUNT(*) FROM " . $TABLEPREFIX . "composed_emails WHERE AdminID = '" . addslashes($CURRENTADMIN['AdminID']) . "'"), 0, 0); $templates = mysql_query("SELECT * FROM " . $TABLEPREFIX . "composed_emails WHERE AdminID = '" . addslashes($CURRENTADMIN['AdminID']) . "' ORDER BY EmailName LIMIT ".($OffSet*$PerPage).",$PerPage"); } if($Total > 0){ $DisplayPage = floor($OffSet / $PerPage); if($Total <= $PerPage) { $Pages = 1; }else{ $Pages = ceil($Total/$PerPage); } if($Total > 0) { $TO = ' Use the form below to review, edit and send your newsletters.
To create a new newsletter, click on the "Create Newsletter" button below.



'; if($Pages > 1) { $TO .= ' '; } $TO .= ' '; while($temp=mysql_fetch_assoc($templates)) { $temp = stripslashes_array($temp); /* Has this email already been sent? The sends tables stores the details of newsletters that have been sent. The composeID field links from the composed_emails table. If an entry exists in the sends table with the same composeID as this newsletter, then it has been partially/full sent. To determine which, we add up the HTMLRecipients and TextRecipients fields and minus them from the EmailsSent field. If the result is positive, then there are still some that need to be sent. If not, it's been sent. We'll check the last time a newsletter was sent, so the latest one based on date started. */ $email_results = mysql_query("SELECT * FROM " . $TABLEPREFIX . "sends WHERE ComposedID = '" . addslashes($temp['ComposedID'])."' ORDER BY DateStarted DESC LIMIT 1"); $found_email = false; if (mysql_num_rows($email_results) == 1) { $email_details = stripslashes_array(mysql_fetch_assoc($email_results)); $emails_sent = $email_details['EmailsSent']; $email_recipients = $email_details['TotalRecipients']; $found_email = true; } else { $emails_sent = 0; $email_recipients = 0; } $Format = ''; switch($temp['Format']) { case 1: $Format = 'Text'; break; case 2: $Format = 'HTML'; break; case 3: $Format = 'HTML + Text'; break; } $TO .= ' '; } $TO .= '
«« |'; } if($DisplayPage > 0) { $TO.=' Prev |'; } if($Pages > 1) { for($i = 0; $i < $Pages; $i++) { if($DisplayPage != $i) $TO .= ' ' . ($i+1) . ' |'; else $TO .= ' ' . ($i+1) . ' |'; } } if($DisplayPage < $Pages-1){ $TO.=' Next |'; } if($Pages > 1) { $TO .= ' »»
  Newsletter Name Sent Date Created Date Last Sent Format Status Action
' . $temp["EmailName"] . ' '; if ($emails_sent > 0 || $email_recipients > 0) { $TO .= number_format($emails_sent, 0) . " of " . number_format($email_recipients, 0); } else { $TO .= "Not Sent"; } global $ServerSending; $TO .= ' ' . DisplayDate($temp["DateCreated"]) . ' '; if ($found_email && $email_details['DateStarted'] > 0) { $TO .= DisplayDate($email_details["DateStarted"]); } else { $TO .= 'Not Sent'; } $TO .= ' ' . $Format . ' '; if($found_email) { // Has it been sent? if($email_details['Completed'] == 0) { $TO .= ($ServerSending) ? 'Waiting to send' : 'Partially Sent'; } else { $TO .= 'Sent'; } } else { $TO .= 'Not Sent'; } $TO .= ' '; $TO .= MakeLink("compose?Action=PreviewPopup&ComposedID=".$temp["ComposedID"],"View",0,0, "_blank") . "   "; // only show "Send" if they have access... if(AllowSection(12)) { $schedule_link = MakeLink('send?ComposedID=' . $temp['ComposedID'] . '&SendType=Schedule', 'Schedule'). "   "; $send_link = MakeLink("send?ComposedID=" . $temp["ComposedID"],"Send"); if($found_email) { if($email_details['Completed'] == 0) { $SendID = $email_details['SendID']; if ($ServerSending) { $resume_link = "scheduler"; $heading = 'View Schedule'; } else { $resume_link = "send?Action=FinalOptions&Resuming=1&SendID=".$SendID; $heading = 'Resume'; } $TO .= MakeLink($resume_link, $heading) . "   "; } else { $TO .= $send_link . "   " . $schedule_link; } } else { $TO .= $send_link . "   " . $schedule_link; } } else { $TO .= "Send" . "   " . "Schedule" . "   "; } $TO .= MakeLink("compose?Action=EditEmail&SubAction=Edit&ComposedID=".$temp["ComposedID"],"Edit") . "   "; $TO .= MakeLink("compose?Action=CopyForm&ComposedID=".$temp["ComposedID"],"Copy") . "   "; $TO .= MakeConfirmBox("compose?Action=DeleteEmail&ComposedID=".$temp["ComposedID"],"Delete", "This will also delete newsletter archives - be careful.") . "   "; $TO .= '
'; } else { if(AllowSection(11)) { $TO .= 'No newsletters have been created. Click the "Create Newsletter" button to create one.



'; } else { $TO .= 'No newsletters have been created.

'; } } $OUTPUT.=MakeBox("Manage Newsletters",$TO); } else { if(AllowSection(11)) { $TO .= 'No newsletters have been created. Click the "Create Newsletter" button to create one.



'; } else { $TO .= 'No newsletters have been created.

'; } $OUTPUT.=MakeBox("Manage Newsletters",$TO); } } } if($Action == 'Add') { 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 . "Newsletter Name"]="textfield|Name:100:44:"; $HELP_ITEMS["Name"]["Title"] = "Newsletter Name"; $HELP_ITEMS["Name"]["Content"] = "What do you want to call this newsletter? This name will only be used to show you a \'friendly name\' for this newsletter in the control panel."; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "Newsletter Format"]="select|Format:1:1->Text;2->HTML;3->HTML and Text"; $HELP_ITEMS["Format"]["Title"] = "Newsletter Format"; $HELP_ITEMS["Format"]["Content"] = "How will this newsletter be composed and sent? Select HTML if you want to include colored text, images, tables, etc. Choose text to create and send your newsletter in plain-text. Alternatively, you can choose \'Both HTML and Text\' to create 2 versions of your newsletter. 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|TempID:5:$alltemps::onDblClick=\"showTemplatePreview(this)\""; $HELP_ITEMS["TempID"]["Title"] = "Use Template?"; $HELP_ITEMS["TempID"]["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 newsletter content on the next page.

Double click on a template to preview it."; $FORM_ITEMS[-1]="submit|Next »:1-compose"; $FORM=new AdminForm; $FORM->title="AddTemplate"; $FORM->items=$FORM_ITEMS; $FORM->action=MakeAdminLink("compose?Action=AddEmail"); $FORM->MakeForm("New Newsletter Details"); $FORM->output = "Complete the form below to create a new newsletter. Double click on a template to preview it before continuing.
Click on the \"Next\" button to continue." . $FORM->output; $FORM->output .= ' '; $OUTPUT.=MakeBox("Create Newsletter (Step 1 of 2)",$FORM->output); } ?>