44 |
if ($ct) array_push($conds, "((category = '$ct') OR ((cat_news.cat_id = '$ct') AND (cat_news.news_id = news.news_id)))"); |
if ($ct) array_push($conds, "((category = '$ct') OR ((cat_news.cat_id = '$ct') AND (cat_news.news_id = news.news_id)))"); |
45 |
if (isset($spec) && (!$id || $id < 0)) array_push($conds, "((spec_news.news_id = news.news_id) AND (spec_news.spec_id = $spec))"); |
if (isset($spec) && (!$id || $id < 0)) array_push($conds, "((spec_news.news_id = news.news_id) AND (spec_news.spec_id = $spec))"); |
46 |
# if ($limit && $isEdit) array_push($conds, ""); |
# if ($limit && $isEdit) array_push($conds, ""); |
47 |
$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, autor_cv, ord, prikazi FROM news".(isset($ct)?", cat_news":"").((isset($spec)&&(!$id||$id<0))?", spec_news":""); |
$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, autor_cv, ord, prikazi, exclusive FROM news".(isset($ct)?", cat_news":"").((isset($spec)&&(!$id||$id<0))?", spec_news":""); |
48 |
$conds = implode(" AND ", $conds); |
$conds = implode(" AND ", $conds); |
49 |
if ($conds) $sql .= " WHERE ".$conds; |
if ($conds) $sql .= " WHERE ".$conds; |
50 |
$sql .= " ORDER BY d_orig DESC, title"; |
$sql .= " ORDER BY d_orig DESC, title"; |
59 |
$art["pic_alt"], $art["pic_pos"], $art["more"], |
$art["pic_alt"], $art["pic_pos"], $art["more"], |
60 |
$art["more_title"], $art["date"], $art["au_pic"], |
$art["more_title"], $art["date"], $art["au_pic"], |
61 |
$art["au_alt"], $art["au_info"], $art["au_name"], |
$art["au_alt"], $art["au_info"], $art["au_name"], |
62 |
$art["au_cv"], $ord, $art["show"]) = $row; |
$art["au_cv"], $ord, $art["show"], $art["ex"]) = $row; |
63 |
$art["show"] = ($art["show"][0] == "f" || $art["show"][0] == "F") ? false : true; |
$art["show"] = ($art["show"][0] == "f" || $art["show"][0] == "F") ? false : true; |
64 |
|
$art["ex"] = ($art["ex"][0] == "f" || $art["ex"][0] == "F") ? false : true; |
65 |
list($art["pic_w"], $art["pic_h"]) = PicSize($art["pic_url"]); |
list($art["pic_w"], $art["pic_h"]) = PicSize($art["pic_url"]); |
66 |
$art["more_new"] = strstr($art["more"], "://") ? true : false; |
$art["more_new"] = strstr($art["more"], "://") ? true : false; |
67 |
global $sysaupicdir; |
global $sysaupicdir; |
71 |
$art["text"] = array(); |
$art["text"] = array(); |
72 |
if ($art["id"]) get_sections($art["id"], $art["text"]); |
if ($art["id"]) get_sections($art["id"], $art["text"]); |
73 |
$art["order"] = $ord; |
$art["order"] = $ord; |
74 |
$art["read"] = (count($art["text"]) > $npar || $art["more"]) ? GetRead($art["id"], $ct) : ""; |
$sql = "SELECT rel_id FROM related WHERE (news_id = ".$art["id"].")"; |
|
$art["category"] = $ct; |
|
|
$art["limit"] = $limit; |
|
|
$art["offset"] = $offset; |
|
|
$art["npar"] = $npar; |
|
|
$sql = "SELECT rel_id FROM related WHERE (news_id = ".$art["id"].") LIMIT 1"; |
|
75 |
$sth2 = $dbh->prepare($sql); |
$sth2 = $dbh->prepare($sql); |
76 |
if (!$sth2) error("Cannot prepare query: \"$sql\""); |
if (!$sth2) error("Cannot prepare query: \"$sql\""); |
77 |
if (!$sth2->execute()) error("Cannot execute query: \"$sql\""); |
if (!$sth2->execute()) error("Cannot execute query: \"$sql\""); |
78 |
$row = $sth2->fetchrow_array(); |
$row = $sth2->fetchrow_array(); |
79 |
$sth2->finish(); |
$sth2->finish(); |
80 |
$art["related"] = $row ? true : false; |
$art["related"] = $row ? true : false; |
81 |
|
$art["read"] = (count($art["text"]) > $npar || $art["more"] || $art["related"]) ? GetRead($art["id"], $ct) : ""; |
82 |
|
$art["category"] = $ct; |
83 |
|
$art["limit"] = $limit; |
84 |
|
$art["offset"] = $offset; |
85 |
|
$art["npar"] = $npar; |
86 |
array_push($arts, $art); |
array_push($arts, $art); |
87 |
} |
} |
88 |
$sth->finish(); |
$sth->finish(); |
121 |
$tpl->assign("date", $art["date"] ? strftime("%d.%m.%Y.", strtotime($art["date"])) : ""); |
$tpl->assign("date", $art["date"] ? strftime("%d.%m.%Y.", strtotime($art["date"])) : ""); |
122 |
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], $art["au_alt"], |
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], $art["au_alt"], |
123 |
$art["au_info"], $art["au_w"], $art["au_h"], $art["au_cv"])); |
$art["au_info"], $art["au_w"], $art["au_h"], $art["au_cv"])); |
124 |
|
$tpl->assign("exclusive", $art["ex"]); |
125 |
$some_title = false; |
$some_title = false; |
126 |
for ($i = 0; $i < count($art["text"]); $i++) { |
for ($i = 0; $i < count($art["text"]); $i++) { |
127 |
if ($art["text"][$i]["title"]) $some_title = true; |
if ($art["text"][$i]["title"]) $some_title = true; |