28 |
} |
} |
29 |
$sth->finish(); |
$sth->finish(); |
30 |
} |
} |
31 |
function newsLoad($id, $cat = "", $limit = 0, $offset = 0, $npar = 1) { |
function newsLoad($id, $ct = "", $limit = 0, $offset = 0, $npar = 1) { |
32 |
global $dbh, $spec, $isMed; |
global $dbh, $spec, $isMed; |
33 |
$arts = array(); |
$arts = array(); |
34 |
if (!$offset) $offset = 0; |
if (!$offset) $offset = 0; |
35 |
$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)"; |
36 |
if ($id > 0) $sql .= " AND (news.news_id = $id)"; |
if ($id > 0) $sql .= " AND (news.news_id = $id)"; |
37 |
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)))"; |
38 |
if ($spec) $sql .= " AND (spec_news.news_id = news.news_id) AND (spec_news.spec_id = $spec)"; |
if ($spec) $sql .= " AND (spec_news.news_id = news.news_id) AND (spec_news.spec_id = $spec)"; |
39 |
$sql .= " ORDER BY d_orig DESC"; |
$sql .= " ORDER BY d_orig DESC"; |
40 |
if ($limit) $sql .= " LIMIT $limit OFFSET $offset"; |
if ($limit) $sql .= " LIMIT $limit OFFSET $offset"; |
46 |
list($art["id"], $art["title"], $art["lead"], $art["pic_url"], |
list($art["id"], $art["title"], $art["lead"], $art["pic_url"], |
47 |
$art["pic_alt"], $art["pic_pos"], $art["more"], |
$art["pic_alt"], $art["pic_pos"], $art["more"], |
48 |
$art["more_title"], $art["date"], $art["au_pic"], |
$art["more_title"], $art["date"], $art["au_pic"], |
49 |
$art["au_alt"], $art["au_info"], $ord) = $row; |
$art["au_alt"], $art["au_info"], $art["au_name"], |
50 |
|
$ord) = $row; |
51 |
list($art["pic_w"], $art["pic_h"]) = PicSize($art["pic_url"]); |
list($art["pic_w"], $art["pic_h"]) = PicSize($art["pic_url"]); |
52 |
$art["more_new"] = strstr($art["more"], "://") ? true : false; |
$art["more_new"] = strstr($art["more"], "://") ? true : false; |
53 |
global $sysaupicdir; |
global $sysaupicdir; |
57 |
$art["text"] = array(); |
$art["text"] = array(); |
58 |
if ($art["id"]) get_sections($art["id"], $art["text"]); |
if ($art["id"]) get_sections($art["id"], $art["text"]); |
59 |
$art["order"] = $ord; |
$art["order"] = $ord; |
60 |
$art["read"] = (count($art["text"]) > $npar) ? true : false; |
$art["read"] = (count($art["text"]) > $npar) ? GetRead($art["id"], $ct) : ""; |
61 |
$art["category"] = $cat; |
$art["category"] = $ct; |
62 |
$art["limit"] = $limit; |
$art["limit"] = $limit; |
63 |
$art["offset"] = $offset; |
$art["offset"] = $offset; |
64 |
$art["npar"] = $npar; |
$art["npar"] = $npar; |
85 |
} |
} |
86 |
|
|
87 |
function newsShow($art) { |
function newsShow($art) { |
88 |
global $fname, $tpl; |
global $fname, $tpl, $acat, $acat2; |
89 |
$fname = "show.tpl"; |
$fname = "show.tpl"; |
90 |
$tpl->assign("title", MyEscape(convert_html($art["title"]))); |
$tpl->assign("title", MyEscape(convert_html($art["title"]))); |
91 |
$tpl->assign("lead", MyEscape(convert_html($art["lead"]), false)); |
$tpl->assign("lead", MyEscape(convert_html($art["lead"]), false)); |
97 |
$tpl->assign("title_url_title", MyEscape(convert_html($art["more_title"]))); |
$tpl->assign("title_url_title", MyEscape(convert_html($art["more_title"]))); |
98 |
$tpl->assign("titlepic_width", $art["pic_w"]); |
$tpl->assign("titlepic_width", $art["pic_w"]); |
99 |
$tpl->assign("titlepic_height", $art["pic_h"]); |
$tpl->assign("titlepic_height", $art["pic_h"]); |
100 |
$tpl->assign("date", strftime("%d.%m.%Y.", strtotime($art["date"]))); |
$tpl->assign("date", $art["date"] ? strftime("%d.%m.%Y.", strtotime($art["date"])) : ""); |
101 |
include_once("author.php"); |
include_once("author.php"); |
102 |
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], |
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], |
103 |
$art["au_alt"], $art["au_info"], |
$art["au_alt"], $art["au_info"], |
114 |
} |
} |
115 |
$tpl->assign("text", $art["text"]); |
$tpl->assign("text", $art["text"]); |
116 |
$tpl->assign("cat", $art["category"]); |
$tpl->assign("cat", $art["category"]); |
117 |
|
$tpl->assign("acat", $acat); |
118 |
|
$tpl->assign("acat2", $acat2); |
119 |
global $PATH; |
global $PATH; |
120 |
if (is_array($PATH)) array_push($PATH, |
if (is_array($PATH)) array_push($PATH, |
121 |
MyUpper(MyEscape(convert_html($art["title"])))); |
MyUpper(MyEscape(convert_html($art["title"])))); |