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