--- inc/newsShow.php 2001/10/02 16:18:09 1.10 +++ inc/newsShow.php 2001/10/04 14:59:35 1.11 @@ -28,13 +28,13 @@ } $sth->finish(); } - function newsLoad($id, $cat = "", $limit = 0, $offset = 0, $npar = 1) { + function newsLoad($id, $ct = "", $limit = 0, $offset = 0, $npar = 1) { global $dbh, $spec, $isMed; $arts = array(); if (!$offset) $offset = 0; - $sql = "SELECT DISTINCT news.news_id, title, lead, title_pic, title_alt, title_pos, url, url_title, d_orig, author_pic, author_alt, author_info, ord FROM news".(isset($cat)?", cat_news":"").($spec?", spec_news":"")." WHERE (".($isMed?"":"NOT ")."plivamed)"; + $sql = "SELECT DISTINCT news.news_id, title, lead, title_pic, title_alt, title_pos, url, url_title, d_orig, author_pic, author_alt, author_info, author_name, ord FROM news".(isset($ct)?", cat_news":"").($spec?", spec_news":"")." WHERE (".($isMed?"":"NOT ")."plivamed)"; if ($id > 0) $sql .= " AND (news.news_id = $id)"; - if ($cat) $sql .= " AND ((category = '$cat') OR ((cat_news.cat_id = '$cat') AND (cat_news.news_id = news.news_id)))"; + if ($ct) $sql .= " AND ((category = '$ct') OR ((cat_news.cat_id = '$ct') AND (cat_news.news_id = news.news_id)))"; if ($spec) $sql .= " AND (spec_news.news_id = news.news_id) AND (spec_news.spec_id = $spec)"; $sql .= " ORDER BY d_orig DESC"; if ($limit) $sql .= " LIMIT $limit OFFSET $offset"; @@ -46,7 +46,8 @@ list($art["id"], $art["title"], $art["lead"], $art["pic_url"], $art["pic_alt"], $art["pic_pos"], $art["more"], $art["more_title"], $art["date"], $art["au_pic"], - $art["au_alt"], $art["au_info"], $ord) = $row; + $art["au_alt"], $art["au_info"], $art["au_name"], + $ord) = $row; list($art["pic_w"], $art["pic_h"]) = PicSize($art["pic_url"]); $art["more_new"] = strstr($art["more"], "://") ? true : false; global $sysaupicdir; @@ -56,8 +57,8 @@ $art["text"] = array(); if ($art["id"]) get_sections($art["id"], $art["text"]); $art["order"] = $ord; - $art["read"] = (count($art["text"]) > $npar) ? true : false; - $art["category"] = $cat; + $art["read"] = (count($art["text"]) > $npar) ? GetRead($art["id"], $ct) : ""; + $art["category"] = $ct; $art["limit"] = $limit; $art["offset"] = $offset; $art["npar"] = $npar; @@ -84,7 +85,7 @@ } function newsShow($art) { - global $fname, $tpl; + global $fname, $tpl, $acat, $acat2; $fname = "show.tpl"; $tpl->assign("title", MyEscape(convert_html($art["title"]))); $tpl->assign("lead", MyEscape(convert_html($art["lead"]), false)); @@ -96,7 +97,7 @@ $tpl->assign("title_url_title", MyEscape(convert_html($art["more_title"]))); $tpl->assign("titlepic_width", $art["pic_w"]); $tpl->assign("titlepic_height", $art["pic_h"]); - $tpl->assign("date", strftime("%d.%m.%Y.", strtotime($art["date"]))); + $tpl->assign("date", $art["date"] ? strftime("%d.%m.%Y.", strtotime($art["date"])) : ""); include_once("author.php"); $tpl->assign("AUTHOR", GetAuthor($art["au_pic"], $art["au_alt"], $art["au_info"], @@ -113,6 +114,8 @@ } $tpl->assign("text", $art["text"]); $tpl->assign("cat", $art["category"]); + $tpl->assign("acat", $acat); + $tpl->assign("acat2", $acat2); global $PATH; if (is_array($PATH)) array_push($PATH, MyUpper(MyEscape(convert_html($art["title"]))));