| Current Path : /var/www/cesa.co.za/Mailer/ |
| Current File : /var/www/cesa.co.za/Mailer/doAddArticle_old.php |
<?php
require_once ('includes/globals.php');
if (isset($_SESSION['database'])) {
if (isset($_SESSION['userid'])) {
$userid = $_SESSION['userid'];
} else {
echo "<script>document.location.href='index.php';</script>\n";
}
$h_sectionid = $_POST['parentid'];
$h_title = str_replace('"', '"', str_replace("'", '´', $_POST['title']));
$h_copy = str_replace('"', '"', str_replace("'", '´', $_POST['theBody'])); //, ENT_QUOTES);
/*
$config = array(
'clean' => true,
'drop-proprietary-attributes' => true,
'drop-font-tags' => true,
'drop-empty-paras' => true,
'hide-comments' => true,
'join-classes' => true,
'join-styles' => true); /*,
'indent' => true,
'output-xhtml' => true,
'wrap' => 200);*/
// Tidy
/*
$tidy = new tidy;
$tidy->parseString($_POST['theBody'], $config, 'utf8');
$tidy->cleanRepair();
*/
$h_image = 'n/a';
$h_url = $_POST['link'];
$h_linktitle = str_replace('"', '"', str_replace("'", '´', $_POST['linkText']));
if(is_uploaded_file($_FILES['image']['tmp_name'])) {
$h_image = $_FILES['image']['name'];
//echo $_FILES['image']['tmp_name'];
move_uploaded_file($_FILES['image']['tmp_name'], $local_image_folder . $_FILES['image']['name']);
}
//echo $sql_addnewsletter;
$db = $_SESSION['database'];
$next_nlid = 1;
$sql = "SELECT max(nOrder) as MaxOrder FROM Headlines where idSection = " . $h_sectionid;
//echo $sql;
$rs = $db->Execute($sql);
if (! $rs->EOF) {
$next_nlid = $rs->fields[0] + 1;
}
$sql = "INSERT INTO Headlines(idSection, sTitle, txtCopy, sImage, sUrl, sLinkTitle, nOrder)\n" .
"VALUES(" . $h_sectionid . ", '" . $h_title . "', '" . $h_copy . "', '" . $h_image . "', '" . $h_url . "', '" . $h_linktitle . "', " . $next_nlid . ")";
//echo $sql;
if ($db->Execute($sql) === false) {
die("Could not add newsletter");
} else {
?>
<script language="JavaScript" type="text/javascript">
//window.close();
window.location = "manageNewsletter.php?id=<?php echo intval($_POST['t']); ?>&pid=<?php echo intval($_POST['s']); ?>";
</script>
<?php
}
}
?>