1 |
ravilov |
1.1 |
<?php |
2 |
ravilov |
1.6 |
include("inc/conn.php"); |
3 |
ravilov |
1.1 |
include_once("inc/newsShow.php"); |
4 |
|
|
if ($show) { |
5 |
|
|
$arts = newsLoad($id, $cat); |
6 |
|
|
newsShow(array_shift($arts)); |
7 |
|
|
} else { |
8 |
ravilov |
1.6 |
if ($isEdit) { |
9 |
|
|
if ($del_id) { |
10 |
|
|
include_once("inc/newsDelete.php"); |
11 |
|
|
newsDelete($del_id); |
12 |
ravilov |
1.9 |
unset($top_edit); |
13 |
ravilov |
1.6 |
} |
14 |
|
|
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
15 |
|
|
if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); |
16 |
|
|
} |
17 |
|
|
$cat = "l"; |
18 |
|
|
if ($section_menu == "sex") { |
19 |
|
|
$cat = "x"; |
20 |
ravilov |
1.8 |
# if ($section_menu2 == "qa") $cat = "q"; |
21 |
ravilov |
1.6 |
if ($section_menu2 == "rjecnik") $cat = "j"; |
22 |
|
|
} |
23 |
|
|
if ($section_menu == "zdrava") { |
24 |
|
|
$cat = "h"; |
25 |
ravilov |
1.8 |
if ($section_menu2 == "tema") $cat = "a"; |
26 |
ravilov |
1.6 |
if ($section_menu2 == "nutri") $cat = "n"; |
27 |
ravilov |
1.8 |
# if ($section_menu2 == "qa") $cat = "a"; |
28 |
ravilov |
1.6 |
if ($section_menu2 == "kuhanje") $cat = "v"; |
29 |
ravilov |
1.8 |
# if ($section_menu2 == "dtd") $cat = "y"; |
30 |
|
|
# if ($section_menu2 == "vrijednosti") $cat = "i"; |
31 |
ravilov |
1.6 |
} |
32 |
|
|
if ($section_menu == "fitness") { |
33 |
|
|
$cat = "f"; |
34 |
ravilov |
1.8 |
if ($section_menu2 == "tema") $cat = "1"; |
35 |
|
|
# if ($section_menu2 == "qa") $cat = "1"; |
36 |
ravilov |
1.6 |
if ($section_menu2 == "trening") $cat = "g"; |
37 |
|
|
if ($section_menu2 == "istezanje") $cat = "s"; |
38 |
|
|
if ($section_menu2 == "ozljede") $cat = "2"; |
39 |
ravilov |
1.8 |
# if ($section_menu2 == "trener") $cat = "b"; |
40 |
ravilov |
1.6 |
if ($section_menu2 == "vjezbe") $cat = "u"; |
41 |
ravilov |
1.8 |
# if ($section_menu2 == "fitcenter") $cat = "k"; |
42 |
ravilov |
1.6 |
} |
43 |
ravilov |
1.9 |
if ($cat == "x") { |
44 |
|
|
$empty = array("category" => "y", "limit" => 1, "offset" => 0, "npar" => 0); |
45 |
|
|
include_once("inc/newsShow.php"); |
46 |
|
|
$art = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
47 |
|
|
$art = array_shift($art); |
48 |
|
|
$ed = ""; |
49 |
|
|
if ($kol_edit && ($art["id"] == $ed_id || $ed_id <= 0) && $isEdit) { |
50 |
|
|
include_once("inc/newsEdit.php"); |
51 |
|
|
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "kol_edit"); |
52 |
|
|
} |
53 |
|
|
if ($ed && is_string($ed)) $tpl->assign("KOL_EDIT", $ed); |
54 |
|
|
else { |
55 |
|
|
if ($ed && $ed["category"] == "y") $art = $ed; |
56 |
|
|
$tpl->assign("kol_id", $art["id"]); |
57 |
|
|
$tpl->assign("kol_title", MyEscape($art["title"])); |
58 |
|
|
$tpl->assign("kol_lead", MyEscape($art["lead"])); |
59 |
|
|
$tpl->assign("kol_pgfs", (count($art["text"]) > 0) ? true : false); |
60 |
|
|
$tpl->assign("kol_titlepic_url", MyEscape($art["pic_url"])); |
61 |
|
|
$tpl->assign("kol_titlepic_alt", MyEscape($art["pic_alt"])); |
62 |
|
|
$tpl->assign("kol_titlepic_type", $art["pic_pos"]); |
63 |
|
|
$tpl->assign("kol_titlepic_width", $art["pic_w"]); |
64 |
|
|
$tpl->assign("kol_titlepic_height", $art["pic_h"]); |
65 |
|
|
for ($j = 0; $j < count($art["text"]); $j++) |
66 |
|
|
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
67 |
|
|
$tpl->assign("kol_text", $art["text"]); |
68 |
|
|
include_once("inc/author.php"); |
69 |
|
|
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], |
70 |
|
|
$art["au_alt"], $art["au_info"], |
71 |
|
|
$art["au_w"], $art["au_h"])); |
72 |
|
|
$tpl->assign("kol_links", GetLinks($art["read"] && $art["id"], |
73 |
|
|
/* MyEscape($art["more"]) */ (count($art["text"]) > 0 && $art["id"]) ? $art["more"] : "", |
74 |
|
|
MyEscape($art["more_title"]), $art["id"], $empty["category"], |
75 |
|
|
"kol", $isEdit, false, false, false)); |
76 |
|
|
$tpl->assign("kol_read", $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? true : false); |
77 |
|
|
} |
78 |
|
|
} |
79 |
ravilov |
1.3 |
if (!$offset) $offset = 0; |
80 |
ravilov |
1.6 |
$empty = array("category" => $cat, "limit" => 11, "offset" => $offset, "npar" => 0); |
81 |
|
|
if ($top_edit && $ed_id <= 0 && $isEdit) { |
82 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
83 |
ravilov |
1.3 |
$ed = newsEdit($empty, "top_edit"); |
84 |
|
|
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
85 |
|
|
else $top_edit = false; |
86 |
ravilov |
1.1 |
} |
87 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
88 |
|
|
$a2 = array(); |
89 |
|
|
$lm = count($arts); |
90 |
|
|
if ($lm > $empty["limit"]) $lm = $empty["limit"]; |
91 |
|
|
for ($i = 0; $i < $lm; $i++) { |
92 |
|
|
$art = $arts[$i]; |
93 |
|
|
$ed = ""; |
94 |
ravilov |
1.6 |
if ($top_edit && ($art["id"] == $ed_id) && $isEdit) { |
95 |
ravilov |
1.3 |
include_once("inc/newsEdit.php"); |
96 |
|
|
$ed = newsEdit($art, "top_edit"); |
97 |
|
|
} |
98 |
|
|
if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed)); |
99 |
|
|
else { |
100 |
|
|
if ($ed && $ed["category"] == $cat) $art = $ed; |
101 |
|
|
for ($j = 0; $j < count($art["text"]); $j++) |
102 |
ravilov |
1.6 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
103 |
ravilov |
1.3 |
array_push($a2, array( |
104 |
|
|
"id" => $art["id"], |
105 |
|
|
"title" => MyEscape($art["title"]), |
106 |
|
|
"lead" => MyEscape($art["lead"]), |
107 |
ravilov |
1.8 |
"pgfs" => (count($art["text"]) > 0) ? true : false, |
108 |
ravilov |
1.3 |
"titlepic_url" => MyEscape($art["pic_url"]), |
109 |
|
|
"titlepic_alt" => MyEscape($art["pic_alt"]), |
110 |
|
|
"titlepic_type" => $art["pic_pos"], |
111 |
|
|
"titlepic_width" => $art["pic_w"], |
112 |
|
|
"titlepic_height" => $art["pic_h"], |
113 |
|
|
"text" => $art["text"], |
114 |
|
|
"links" => GetLinks($art["read"] && $art["id"], |
115 |
ravilov |
1.7 |
/* MyEscape($art["more"]) */ ((count($art["text"]) > 0 || strstr("?", $art["more"]) == 0) && $art["id"]) ? $art["more"] : "", |
116 |
ravilov |
1.6 |
MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", |
117 |
ravilov |
1.9 |
$isEdit, true, ($i > 0), ($i < count($arts) - 1)), |
118 |
|
|
"read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? true : false |
119 |
ravilov |
1.3 |
)); |
120 |
|
|
} |
121 |
ravilov |
1.1 |
} |
122 |
ravilov |
1.3 |
$tpl->assign("top", $a2); |
123 |
|
|
$tpl->assign("cat", $cat); |
124 |
|
|
$tpl->assign("next", (count($arts) > 10) ? ($offset + 10) : 0); |
125 |
|
|
$tpl->assign("prev", ($offset > 0) ? ($offset - 10) : false); |
126 |
ravilov |
1.1 |
} |
127 |
|
|
$dbh->disconnect(); |
128 |
|
|
?> |