<?php
#$Id: print.inc.php,v 1.2 2004/09/24 15:28:21 ryan Exp $
class printPage {
function printPage(){
$this->core = new core();
$theme_id = $this->core->db->dbCall("theme_id");
list($dir) = $this->core->db->fetch_row($this->core->db->query("select theme_dir from theme where theme_id = '$theme_id'"));
$this->templates = "templates/" . $dir;
$langFile = "lang/" . $this->core->db->dbCall("lang") . ".inc.php";
require($langFile);
$this->textArray = $textArray;
switch($_GET[action]){
case news:
$this->printNews();
break;
case page:
$this->printPageItem();
break;
}
print($this->body);
}
function printPageItem(){
//THANKS freeba
$result = $this->core->db->query("select title, body, page_id from pages where page_id = '$_GET[page_id]'");
list($title, $body, $page_id) = $this->core->db->fetch_row($result);
$text = "<html><head><title>" . stripslashes($title) . "</title>";
$text .= "<link rel=\"stylesheet\" type=\"text/css\"href=\"$this->style\">";
$text .= "</head><body onLoad=\"javascript: print();\">";
$text .= "<div id=box style=\"width: 600px\">";
$text .= "<div id=boxTitleLeft>" . stripslashes($title) . "</div>";
$text .= "<div id=boxCell>" . stripslashes($body) . "</div>";
$text .= "</body></html>";
$this->body = $text;
}
function printNews(){
$dateFormat = $this->core->db->dbCall("dateFormat");
$news_categories = $this->core->db->dbCall("news_categories");
$sql = "select news_id, title, post, date, news_cat_id, more, user_id, size from news where delay = '0' and news_id = '$_GET[news_id]'";
$result = $this->core->db->query($sql);
while(list($news_id, $title, $post, $date, $cat_id, $more, $user_id, $size) = $this->core->db->fetch_row($result)){
list($username) = $this->core->db->fetch_row($this->core->db->query("select username from users where user_id = '$user_id'"));
if ($news_categories == 1){
list($cat_name) = $this->core->db->fetch_row($this->core->db->query("select news_cat_title from news_cat where news_cat_id = '$cat_id'"));
$cat_name = stripslashes($cat_name);
$category = " <a href=index.php?id=$this->id&news_cat_id=$cat_id&action=view_cat>$cat_name</a> : ";
}
$title = stripslashes($title);
$post = stripslashes($post);
$more = "<br><br>" . stripslashes($more);
$date = $this->core->global->getTime($date);
$date = date($dateFormat . " H:i", $date);
$text = "<html><head><title>$title</title>";
$text .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$this->style\">";
$text .= "</head><body>";
$text .= "<table width=500 cellspacing=1 cellpadding=0 border=0 align=center class=outline>";
$text .= "<tr>";
$text .= "<td align=left class=title>$new $category $title</td></tr>";
$text .= "<tr><td class=main><table border=0 cellpadding=2 cellspacing=0 width=500 align=center>";
$text .= "<tr><td class=small>";
$text .= "<b>" . $this->textArray['Posted by'] . " <a href=users.php?action=view&user_id=$user_id>$username</a> " . $this->textArray['on'] . " $date</b>";
$text .= "</td></tr>";
$text .= "<tr><td colspan=2 align=left class=main>";
$text .= "$cat_image $post $more";
$text .= "</td></tr>";
$text .= "</table></td></tr>";
$text .= "</table><br><br>";
$text .= "</body></html>";
}
$this->body = $text;
}
}