1 |
ravilov |
1.1 |
<?php |
2 |
ravilov |
1.8 |
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.8 |
if ($isEdit) { |
9 |
|
|
if ($del_id) { |
10 |
|
|
include_once("inc/newsDelete.php"); |
11 |
|
|
newsDelete($del_id); |
12 |
ravilov |
1.14 |
unset($top_edit, $top2_edit, $wn_edit, $pn_edit); |
13 |
ravilov |
1.8 |
} |
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 |
ravilov |
1.12 |
if ($flip_id) $dbh->dbh_do("UPDATE news SET prikazi = NOT prikazi WHERE (news_id = $flip_id)"); |
17 |
ravilov |
1.1 |
} |
18 |
ravilov |
1.14 |
$empty = array("category" => "3", "limit" => 1, "offset" => 0, "npar" => 0); |
19 |
|
|
if ($top2_edit && $ed_id <= 0 && $isEdit) { |
20 |
|
|
include_once("inc/newsEdit.php"); |
21 |
|
|
$ed = newsEdit($empty, "top2_edit"); |
22 |
|
|
if ($ed && is_string($ed)) $tpl->assign("EDIT2", $ed); |
23 |
|
|
else $top2_edit = false; |
24 |
|
|
} |
25 |
|
|
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
26 |
|
|
$ed = ""; |
27 |
|
|
$a2 = array(); |
28 |
|
|
for ($i = 0; $i < count($arts); $i++) { |
29 |
|
|
$art = $arts[$i]; |
30 |
|
|
$ed = ""; |
31 |
|
|
if ($top2_edit && ($art["id"] == $ed_id)) { |
32 |
|
|
include_once("inc/newsEdit.php"); |
33 |
|
|
$ed = newsEdit($art, "top2_edit"); |
34 |
|
|
} |
35 |
|
|
if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed)); |
36 |
|
|
else { |
37 |
|
|
if ($ed && $ed["category"] == $cat) $art = $ed; |
38 |
|
|
for ($j = 0; $j < count($art["text"]); $j++) |
39 |
|
|
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
40 |
|
|
$read = $art["read"]; |
41 |
ravilov |
1.15 |
if ($read && count($art["text"]) <= 0) $read = (($art["more"] && !strstr($art["more"], "?")) || $art["related"]) ? $read : ""; |
42 |
ravilov |
1.14 |
if ($read && !$art["id"]) $read = ""; |
43 |
ravilov |
1.15 |
$more = ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : ""; |
44 |
ravilov |
1.14 |
array_push($a2, array( |
45 |
|
|
"id" => $art["id"], |
46 |
|
|
"title" => MyEscape($art["title"]), |
47 |
|
|
"lead" => MyEscape($art["lead"]), |
48 |
|
|
"pgfs" => (count($art["text"]) > 0) ? true : false, |
49 |
|
|
"titlepic_url" => MyEscape($art["pic_url"]), |
50 |
|
|
"titlepic_alt" => MyEscape($art["pic_alt"]), |
51 |
|
|
"titlepic_type" => $art["pic_pos"], |
52 |
|
|
"titlepic_width" => $art["pic_w"], |
53 |
|
|
"titlepic_height" => $art["pic_h"], |
54 |
|
|
"text" => $art["text"], |
55 |
ravilov |
1.15 |
"links" => GetLinks($read, $more, MyEscape($art["more_title"]), $art["id"], $empty["category"], "top2", |
56 |
ravilov |
1.14 |
true, ($i > 0), ($i < count($arts) - 1), $art["show"], $art["related"]), |
57 |
|
|
"read" => $read, |
58 |
ravilov |
1.15 |
"more" => $more, |
59 |
|
|
"more_title" => $art["more_title"], |
60 |
ravilov |
1.14 |
"AUTHOR" => GetAuthor($art["au_pic"], $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"], $art["au_cv"]) |
61 |
|
|
)); |
62 |
|
|
} |
63 |
|
|
} |
64 |
|
|
$tpl->assign("top2", $a2); |
65 |
ravilov |
1.7 |
$empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0); |
66 |
ravilov |
1.12 |
if ($top_edit && $ed_id <= 0 && $isEdit) { |
67 |
|
|
include_once("inc/newsEdit.php"); |
68 |
|
|
$ed = newsEdit($empty, "top_edit"); |
69 |
|
|
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
70 |
|
|
else $top_edit = false; |
71 |
|
|
} |
72 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
73 |
ravilov |
1.1 |
$ed = ""; |
74 |
ravilov |
1.12 |
$a2 = array(); |
75 |
|
|
for ($i = 0; $i < count($arts); $i++) { |
76 |
|
|
$art = $arts[$i]; |
77 |
|
|
$ed = ""; |
78 |
|
|
if ($top_edit && ($art["id"] == $ed_id)) { |
79 |
|
|
include_once("inc/newsEdit.php"); |
80 |
|
|
$ed = newsEdit($art, "top_edit"); |
81 |
|
|
} |
82 |
|
|
if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed)); |
83 |
|
|
else { |
84 |
|
|
if ($ed && $ed["category"] == $cat) $art = $ed; |
85 |
|
|
for ($j = 0; $j < count($art["text"]); $j++) |
86 |
|
|
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
87 |
ravilov |
1.14 |
$read = $art["read"]; |
88 |
ravilov |
1.15 |
if ($read && count($art["text"]) <= 0) $read = (($art["more"] && !strstr($art["more"], "?")) || $art["related"]) ? $read : ""; |
89 |
ravilov |
1.14 |
if ($read && !$art["id"]) $read = ""; |
90 |
ravilov |
1.15 |
$more = ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : ""; |
91 |
ravilov |
1.12 |
array_push($a2, array( |
92 |
|
|
"id" => $art["id"], |
93 |
|
|
"title" => MyEscape($art["title"]), |
94 |
|
|
"lead" => MyEscape($art["lead"]), |
95 |
|
|
"pgfs" => (count($art["text"]) > 0) ? true : false, |
96 |
|
|
"titlepic_url" => MyEscape($art["pic_url"]), |
97 |
|
|
"titlepic_alt" => MyEscape($art["pic_alt"]), |
98 |
|
|
"titlepic_type" => $art["pic_pos"], |
99 |
|
|
"titlepic_width" => $art["pic_w"], |
100 |
|
|
"titlepic_height" => $art["pic_h"], |
101 |
|
|
"text" => $art["text"], |
102 |
ravilov |
1.15 |
"links" => GetLinks($read, $more, MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", |
103 |
ravilov |
1.14 |
true, ($i > 0), ($i < count($arts) - 1), $art["show"], $art["related"]), |
104 |
|
|
"read" => $read, |
105 |
ravilov |
1.15 |
"more" => $more, |
106 |
|
|
"more_title" => $art["more_title"], |
107 |
ravilov |
1.14 |
"AUTHOR" => GetAuthor($art["au_pic"], $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"], $art["au_cv"]) |
108 |
ravilov |
1.12 |
)); |
109 |
|
|
} |
110 |
ravilov |
1.1 |
} |
111 |
ravilov |
1.12 |
$tpl->assign("top", $a2); |
112 |
ravilov |
1.6 |
$menu2 = array(); |
113 |
ravilov |
1.12 |
$empty = array("category" => "w", "limit" => ($wn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); |
114 |
ravilov |
1.2 |
$ed = ""; |
115 |
ravilov |
1.7 |
if ($wn_edit && $ed_id <= 0 && $isEdit) { |
116 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
117 |
ravilov |
1.7 |
$ed = newsEdit($empty, "wn_edit", true); |
118 |
ravilov |
1.1 |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
119 |
|
|
else $wn_edit = false; |
120 |
|
|
} |
121 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
122 |
ravilov |
1.1 |
$wn = array(); |
123 |
ravilov |
1.8 |
$tmp2 = array(); |
124 |
ravilov |
1.1 |
for ($i = 0; $i < count($arts); $i++) { |
125 |
|
|
$art = $arts[$i]; |
126 |
|
|
$ed = ""; |
127 |
ravilov |
1.7 |
if ($wn_edit && $art["id"] == $ed_id && $isEdit) { |
128 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
129 |
ravilov |
1.2 |
$art["nlimit"] = count($arts); |
130 |
ravilov |
1.7 |
$ed = newsEdit($art, "wn_edit", true); |
131 |
ravilov |
1.1 |
} |
132 |
|
|
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
133 |
|
|
else { |
134 |
ravilov |
1.2 |
if ($ed && $ed["category"] == "w") $art = $ed; |
135 |
ravilov |
1.1 |
for ($j = 0; $j < count($art["text"]); $j++) |
136 |
ravilov |
1.5 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
137 |
ravilov |
1.8 |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
138 |
ravilov |
1.14 |
$read = $art["read"]; |
139 |
ravilov |
1.15 |
if ($read && count($art["text"]) <= 0) $read = (($art["more"] && !strstr($art["more"], "?")) || $art["related"]) ? $read : ""; |
140 |
ravilov |
1.14 |
if ($read && !$art["id"]) $read = ""; |
141 |
ravilov |
1.15 |
$more = ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : ""; |
142 |
ravilov |
1.1 |
array_push($wn, array( |
143 |
|
|
"id" => $art["id"], |
144 |
|
|
"title" => MyEscape($art["title"]), |
145 |
|
|
"lead" => MyEscape($art["lead"]), |
146 |
ravilov |
1.9 |
"pgfs" => (count($art["text"]) > 0) ? true : false, |
147 |
ravilov |
1.1 |
"pic" => MyEscape($art["pic_url"]), |
148 |
|
|
"alt" => MyEscape($art["pic_alt"]), |
149 |
|
|
"pos" => MyEscape($art["pic_pos"]), |
150 |
ravilov |
1.8 |
"width" => $art["pic_w"], |
151 |
|
|
"height" => $art["pic_h"], |
152 |
ravilov |
1.15 |
"links" => GetLinks($read, $more, MyEscape($art["more_title"]), $art["id"], $empty["category"], "wn", true, |
153 |
ravilov |
1.14 |
($i > 0), ($i < count($arts) - 1), $art["show"], $art["related"]), |
154 |
|
|
"read" => $read, |
155 |
ravilov |
1.15 |
"more" => $more, |
156 |
|
|
"more_title" => $art["more_title"], |
157 |
ravilov |
1.1 |
"text" => $art["text"] |
158 |
|
|
)); |
159 |
ravilov |
1.8 |
array_push($tmp2, array( |
160 |
ravilov |
1.6 |
"cat" => $empty["category"], |
161 |
|
|
"id" => $art["id"], |
162 |
ravilov |
1.12 |
"title" => MyEscape($art["title"]) |
163 |
ravilov |
1.6 |
)); |
164 |
ravilov |
1.1 |
} |
165 |
|
|
} |
166 |
ravilov |
1.8 |
array_push($menu2, array( |
167 |
|
|
"title" => "Vijesti", |
168 |
|
|
"class" => "wnhead", |
169 |
|
|
"pre" => "wn-", |
170 |
|
|
"items" => $tmp2 |
171 |
|
|
)); |
172 |
ravilov |
1.12 |
$empty = array("category" => "p", "limit" => ($pn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); |
173 |
ravilov |
1.2 |
$ed = ""; |
174 |
ravilov |
1.7 |
if ($pn_edit && $ed_id <= 0 && $isEdit) { |
175 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
176 |
ravilov |
1.7 |
$ed = newsEdit($empty, "pn_edit", true); |
177 |
ravilov |
1.1 |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
178 |
|
|
else $pn_edit = false; |
179 |
|
|
} |
180 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
181 |
ravilov |
1.1 |
$pn = array(); |
182 |
ravilov |
1.8 |
$tmp2 = array(); |
183 |
ravilov |
1.1 |
for ($i = 0; $i < count($arts); $i++) { |
184 |
|
|
$art = $arts[$i]; |
185 |
|
|
$ed = ""; |
186 |
ravilov |
1.7 |
if ($pn_edit && $art["id"] == $ed_id && $isEdit) { |
187 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
188 |
ravilov |
1.2 |
$art["nlimit"] = count($arts); |
189 |
ravilov |
1.7 |
$ed = newsEdit($art, "pn_edit", true); |
190 |
ravilov |
1.1 |
} |
191 |
|
|
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
192 |
|
|
else { |
193 |
ravilov |
1.2 |
if ($ed && $ed["category"] == "p") $art = $ed; |
194 |
ravilov |
1.1 |
for ($j = 0; $j < count($art["text"]); $j++) |
195 |
ravilov |
1.5 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
196 |
ravilov |
1.8 |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
197 |
ravilov |
1.14 |
$read = $art["read"]; |
198 |
ravilov |
1.15 |
if ($read && count($art["text"]) <= 0) $read = (($art["more"] && !strstr($art["more"], "?")) || $art["related"]) ? $read : ""; |
199 |
ravilov |
1.14 |
if ($read && !$art["id"]) $read = ""; |
200 |
ravilov |
1.15 |
$more = ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : ""; |
201 |
ravilov |
1.1 |
array_push($pn, array( |
202 |
|
|
"id" => $art["id"], |
203 |
|
|
"title" => MyEscape($art["title"]), |
204 |
|
|
"lead" => MyEscape($art["lead"]), |
205 |
ravilov |
1.9 |
"pgfs" => (count($art["text"]) > 0) ? true : false, |
206 |
ravilov |
1.1 |
"pic" => MyEscape($art["pic_url"]), |
207 |
|
|
"alt" => MyEscape($art["pic_alt"]), |
208 |
|
|
"pos" => MyEscape($art["pic_pos"]), |
209 |
|
|
"width" => MyEscape($art["pic_w"]), |
210 |
|
|
"height" => MyEscape($art["pic_h"]), |
211 |
ravilov |
1.15 |
"links" => GetLinks($read, $more, MyEscape($art["more_title"]), $art["id"], $empty["category"], "pn", true, |
212 |
ravilov |
1.14 |
($i > 0), ($i < count($arts) - 1), $art["show"], $art["related"]), |
213 |
|
|
"read" => $read, |
214 |
ravilov |
1.15 |
"more" => $more, |
215 |
|
|
"more_title" => $art["more_title"], |
216 |
ravilov |
1.1 |
"text" => MyEscape($art["text"]) |
217 |
|
|
)); |
218 |
ravilov |
1.8 |
array_push($tmp2, array( |
219 |
ravilov |
1.6 |
"cat" => $empty["category"], |
220 |
|
|
"id" => $art["id"], |
221 |
ravilov |
1.12 |
"title" => MyEscape($art["title"]) |
222 |
ravilov |
1.6 |
)); |
223 |
ravilov |
1.1 |
} |
224 |
|
|
} |
225 |
ravilov |
1.8 |
array_push($menu2, array( |
226 |
|
|
"title" => "Novo na PLIVA".($isMed ? "med.net" : "zdravlju"), |
227 |
|
|
"class" => "pnhead", |
228 |
|
|
"pre" => "pn-", |
229 |
|
|
"items" => $tmp2 |
230 |
|
|
)); |
231 |
ravilov |
1.1 |
$tpl->assign("wn", $wn); |
232 |
|
|
$tpl->assign("pn", $pn); |
233 |
|
|
$tpl->assign("top_edit", $top_edit); |
234 |
|
|
$tpl->assign("wn_edit", $wn_edit); |
235 |
|
|
$tpl->assign("pn_edit", $pn_edit); |
236 |
ravilov |
1.7 |
if (!$isMed) $tpl->assign("MENU2", $menu2); |
237 |
ravilov |
1.1 |
} |
238 |
|
|
$dbh->disconnect(); |
239 |
|
|
?> |