Index: trunk/admin/email/do_send.php
===================================================================
diff -u -N -r5431 -r6093
--- trunk/admin/email/do_send.php (.../do_send.php) (revision 5431)
+++ trunk/admin/email/do_send.php (.../do_send.php) (revision 6093)
@@ -27,10 +27,10 @@
require_once($pathtoroot.$admin."/browse/toolbar.php");
//Set Section
-$section = 'in-portal:sendmail';
+$section = 'in-portal:sendmail';
//Set Environment Variable
-$envar = "env=" . BuildEnv();
+$envar = "env=" . BuildEnv();
$State = $_POST["EmailState"];
if(!strlen($State))
@@ -65,19 +65,19 @@
function getEmailFooter($is_html = true)
{
static $footer = Array('html' => null, 'plain' => null);
-
- $footer_body =& $footer[$is_html ? 'html' : 'plain'];
+
+ $footer_body =& $footer[$is_html ? 'html' : 'plain'];
if (is_null($footer_body)) {
$application =& kApplication::Instance();
$email_object =& $application->recallObject('kEmailMessage');
$email_object->Clear();
-
+
$sql = 'SELECT em.Template
FROM '.TABLE_PREFIX.'EmailMessage em
LEFT JOIN '.TABLE_PREFIX.'Events e ON e.EventId = em.EventId
WHERE em.LanguageId = '.$application->GetVar('m_lang').' AND e.Event = "COMMON.FOOTER"';
$footer_body = explode("\n\n", $application->Conn->GetOne($sql));
- $footer_body = "\r\n".($is_html ? $footer_body[1] : $email_object->convertHTMLtoPlain($footer_body[1]));
+ $footer_body = "\r\n".($is_html ? '
'.$footer_body[1] : $email_object->convertHTMLtoPlain($footer_body[1]));
}
return $footer_body;
}
@@ -89,14 +89,14 @@
case "email_single_send": /*single user send */
$PageTitle = admin_language("la_Title_SendInit");
$Subject = $_POST["subject"];
- $Html = $_POST["messageHTML"].getEmailFooter(true);
- $Text = strip_tags($_POST["messageTEXT"]).getEmailFooter(false);
-
+ $Html = $_POST["messageHTML"];
+ $Text = strip_tags($_POST["messageTEXT"]);
+
if(is_array($_FILES))
{
$attatch = $_FILES["attatchment"];
if(strlen($attatch["name"]) >0 && $attatch["size"]>0)
- {
+ {
$FileName = $attatch["name"];
$FileLoc = $attatch["tmp_name"];
}
@@ -111,22 +111,22 @@
$FileName = NULL;
$FileLoc = NULL;
}
- $charset = "";
+ $charset = "";
$TargetURL .= "&EmailState=email_send_complete";
break;
case "email_multi_send": /*Init multiuser send*/
$UserList = explode(",",$_POST["sendaddrs"]);
//echo $_POST["sendaddrs"]."
\n";
-
+
$Subject = $_POST["subject"];
- $Html = $_POST["messageHTML"].getEmailFooter(true);
- $Text = strip_tags($_POST["messageTEXT"]).getEmailFooter(false);
+ $Html = $_POST["messageHTML"];
+ $Text = strip_tags($_POST["messageTEXT"]);
if(is_array($_FILES))
{
$attatch = $_FILES["attatchment"];
if(strlen($attatch["name"]) >0 && $attatch["size"]>0)
- {
+ {
$FileName = $attatch["name"];
$FileLoc = $attatch["tmp_name"];
}
@@ -142,15 +142,15 @@
$FileLoc = NULL;
}
- $charset = "";
- $PageTitle = admin_language("la_Title_SendMailInit");
+ $charset = "";
+ $PageTitle = admin_language("la_Title_SendMailInit");
$TargetURL .="&EmailState=email_send_progress&Start=0&Total=".count($UserList);
break;
case "email_send_progress":
$total = $_GET["Total"];
$start = $_GET["Start"];
if($start < $total)
- {
+ {
$pct = (int)(($start/$total)*100);
$NewStart = $start+$MessagesPerPage;
$TargetURL .= "&EmailState=email_send_progress&Start=$NewStart&Total=$total";
@@ -165,7 +165,7 @@
case "email_send_complete":
$PageTitle = admin_language("la_Title_SendMailComplete");
$TargetURL="";
- break;
+ break;
case "email_user_cancel":
$PageTitle = admin_language("la_Title_SendMailCancel");
$TargetURL = "";
@@ -174,18 +174,22 @@
}
int_header(NULL,NULL,admin_language("la_Title_PleaseWait"));
- echo "\n";
+ echo "\n";
/*do page functions */
// echo "Current State:". $State."
\n";
+if ($Html) $Html .= getEmailFooter(true);
+if ($Text) $Text .= getEmailFooter(false);
+
+
echo "
";
switch($State)
{
case "email_single_send": /*single user send */
$PageTitle = admin_language($Pagetitle);
$ToAddr = $_POST["sendaddrs"];
-
+
$SendQueue->SendMail($FromAddr,$FromName,$ToAddr,"",$Subject,$Text,$Html,$charset, "",$FileName,$FileLoc,0, NULL);
$o = " |