Viewing file: compose.php (4.86 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
$subject = (!empty($_POST['subject'])) ? $_POST['subject'] : '';
$message = (!empty($_POST['message'])) ? $_POST['message'] : '';
$format = (!empty($_POST['format'])) ? $_POST['format'] : '';
switch($op){
case "preview":
echo "<div class='subsection'>";
echo "<div class='subtitle'>".translate("COMPOSE_PREVIEW_TITLE")."</div>";
echo "<div class='subcontent'>";
echo "<form method='post' action='send.php' class='form-light'>";
echo "<table cellspacing=0 border=0 cellpadding=0 align='center'>\n";
echo "\t<tr><td width='100%'>\n";
$subj = htmlspecialchars($subject);
if($format == "html"){
$msg = $message;
} else {
$msg = htmlspecialchars($message);
}
echo "<u>".translate("COMPOSE_SUBJECT")."</u> : ".stripslashes($subj)."<br /><br />";
if($format == "html"){
echo stripslashes($msg);
} else {
echo nl2br(stripslashes($msg));
}
echo "\t</td></tr>\n";
echo "\t<tr><td>\n";
echo " <br />\n";
echo "<input type=hidden name=subject value=\"".stripslashes($subject)."\">\n";
echo "<input type=hidden name=message value=\"".urlencode(stripslashes($message))."\">\n";
echo "<input type=hidden name=format value=".$format.">\n";
echo "<input type='hidden' name='list_id' value='$list_id'>\n";
echo "<input type='hidden' name='op' value='send'>\n";
echo "<div align='center'><input type='button' value='<< ".translate("COMPOSE_BACK")."' onclick='javascript:history.go(-1)'>\n";
echo "<input type='submit' value='".translate("COMPOSE_SEND")." >>'></div>\n";
echo "\t</td></tr></table></form>";
echo "</div>";
echo "</div> <br /> <br />";
break;
default:
$newsletter = new Newsletter();
$newsletter->getConfig($conf->db_host, $conf->db_login, $conf->db_pass, $conf->db_name, $list_id,$conf->table_listsconfig);
if($newsletter->getSubscribersNumbers($conf->table_email)){
echo "<div class='subsection'>";
echo "<div class='subtitle'>".translate("COMPOSE_NEW")."</div>";
echo "<div class='subcontent'>";
echo"<table border='0' cellpadding='5' >\n";
echo "\t<tr>\n";
echo "\t\t<td width='868' height='25' align='left' valign='top'>\n";
echo "\t\t\t<form name='mailform' method='post' action='' class='form-light'>\n";
echo "\t\t\t<script language='javascript' type='text/javascript'>\n";
echo "\t\t\t\tfunction Soumettre(){\n";
echo "\t\t\t\t\tif ( (document.mailform.subject.value=='') || (document.mailform.message.value=='') )\n";
echo "\t\t\t\t\t\talert('".translate("ERROR_ALL_FIELDS_REQUIRED")."');\n";
echo "\t\t\t\t\telse {\n";
echo "\t\t\t\t\t\tdocument.mailform.submit();\n";
echo "\t\t\t\t\t}\n";
echo "\t\t\t\t}\n";
echo "\t\t\t</script>\n";
echo "\t\t\t".translate("COMPOSE_SUBJECT")." : <input type='text' name='subject' value=\"$newsletter->subject\" size='50' maxlength='255' /><br />\n";
echo "\t\t\t".translate("COMPOSE_FORMAT")." : <input type='radio' class='radio' name='format' value='text' checked='checked' />".translate("COMPOSE_FORMAT_TEXT")."<input type='radio' class='radio' name='format' value='html' />".translate("COMPOSE_FORMAT_HTML")." ".translate("COMPOSE_FORMAT_HTML_NOTICE")."<br />\n";
echo "\t\t\t<textarea name='message' rows='20' cols='70'>$newsletter->header";
echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
echo "$newsletter->footer</textarea><br />\n";
echo "\t\t\t<input type='hidden' name='op' value='preview' /><input type='hidden' name='action' value='compose' />\n";
echo "\t\t\t<input type='hidden' name='page' value='compose' /><input type='hidden' name='list_id' value='$list_id' />\n";
echo "\t\t\t<center><input type='reset' value=\"".translate("COMPOSE_RESET")."\" /><input type='button' value='".translate("COMPOSE_PREVIEW")." >>' onclick='Soumettre()' /></center>\n";
echo "\t\t\t</form>\n";
echo "\t\t </td>";
echo "\t</tr>\n";
echo "</table>\n\n";
echo "</div>";
echo "</div> <br /> <br />";
}
else {
echo error_msg(translate("ERROR_UNABLE_TO_SEND"));
}
break;
case "done":
echo "\t<div class='title'>".translate("COMPOSE_SENDING")."</div>\n";
$error = (empty($_GET['error']) ? "0" : $_GET['error']);
$errorlog = (empty($_GET['errorlog']) ? "0" : $_GET['errorlog']);
if($error !=0){
echo "<div align='center' class='error'>".translate("ERROR_SENDING")."</div>";
//exit;
}
else echo "<div align='center' class='success'>".translate("COMPOSE_SENT").".</div>";
if($errorlog) echo "<div align='center' class='error'>".translate("ERROR_LOG_CREATE")."</div>";
echo "<br /><div align='center'><img align='middle' src='img/puce.gif'> <a href='?page=compose&list_id=".$list_id."'>".translate("BACK")."</a></div>";
break;
}
?>
|