makePDF($text);
}
else
{
echo "file missing.";
exit;
}
}
else
{
if($source == 'news'){
$con = new convert;
$sql->db_Select("news", "*", "news_id='".intval($parms)."'");
$row = $sql->db_Fetch();
$news_body = $tp->toHTML($row['news_body'], TRUE);
$news_extended = $tp->toHTML($row['news_extended'], TRUE);
if ($row['news_author'] == 0){
$a_name = "e107";
$category_name = "e107 welcome message";
}else{
$sql->db_Select("news_category", "category_id, category_name", "category_id='".intval($row['news_category'])."'");
list($category_id, $category_name) = $sql->db_Fetch();
$sql->db_Select("user", "user_id, user_name", "user_id='".intval($row['news_author'])."'");
list($a_id, $a_name) = $sql->db_Fetch();
}
$row['news_datestamp'] = $con->convert_date($row['news_datestamp'], "long");
$row['news_title'] = $tp -> toHTML($row['news_title'], TRUE, 'parse_sc');
//remove existing links from news title
$search = array();
$replace = array();
$search[0] = "/\(.*?)<\/a>/si";
$replace[0] = '\\2';
$search[1] = "/\(.*?)<\/a>/si";
$replace[1] = '\\2';
$search[2] = "/\(.*?)<\/a>/si";
$replace[2] = '\\2';
$search[3] = "/\(.*?)<\/a>/si";
$replace[3] = '\\2';
$search[4] = "/\(.*?)<\/a>/si";
$replace[4] = '\\2';
$row['news_title'] = preg_replace($search, $replace, $row['news_title']);
$text = "
".$row['news_title']."
".$row['category_name']."
".$a_name.", ".$row['news_datestamp']."
".$row['news_body']."
";
if ($row['news_extended'] != ""){ $text .= "
".$row['news_extended']; }
if ($row['news_source'] != ""){ $text .= "
".$row['news_source']; }
if ($row['news_url'] != ""){ $text .= "
".$row['news_url']; }
$text = $text; //define text
$creator = SITENAME; //define creator
$author = $a_name; //define author
$title = $row['news_title']; //define title
$subject = $category_name; //define subject
$keywords = ""; //define keywords
//define url and logo to use in the header of the pdf file
$url = SITEURL."news.php?item.".$row['news_id'];
//always return an array with the following data:
$text = array($text, $creator, $author, $title, $subject, $keywords, $url);
$pdf->makePDF($text);
}
}
?>