";
if (($action <> 'show' && $action <> 'showp') || ($action_parent_id == 0))
{ // Action 'show' displays initial page, 'showp' displays following pages
$text .= NLLAN_68; // Invalid parameter defined
}
else
{
if(!isset($_POST['limit_start']))
{
$limit_start = 0;
}
else
{
$limit_start = intval($_POST['limit_start']);
}
$nl_count = $sql->count('newsletter', '(*)', "WHERE newsletter_parent='".$action_parent_id."' AND newsletter_flag='1'");
if ($nl_count > 0)
{
// Retrieve parent info
$sql->select('newsletter', "*", "newsletter_id='".$action_parent_id."'");
if ($row = $sql->fetch())
{
$parent_newsletter_title = $tp->toHTML($row['newsletter_title'],true);
$parent_newsletter_text = $tp->toHTML($row['newsletter_text'],true);
$parent_newsletter_header = $tp->toHTML($row['newsletter_header'],true);
$parent_newsletter_footer = $tp->toHTML($row['newsletter_footer'],true);
}
if ($action_nl_id == '' || $action_nl_id == 0) //Show list of sent newsletters
{
// Display parent name
$text .= "{$parent_newsletter_title}
{$parent_newsletter_text}
";
// Display list of sent newsletters titles
if ($action == 'showp')
{ // This should only be done when action is 'showp'
$limit_start = $limit_start + $page_size;
}
$sql->select('newsletter', '*', "newsletter_parent='".$action_parent_id."' AND newsletter_flag='1' ORDER BY newsletter_datestamp DESC LIMIT ".$limit_start.",".$page_size);
while ($row = $sql->fetch())
{
$ga = new convert();
$newsletter_datestamp = $ga->convert_date($row['newsletter_datestamp'], 'long');
$text .= "