1 |
<?php |
<?php |
2 |
include_once("inc/conn.php"); |
include("inc/conn.php"); |
3 |
include_once("inc/newsShow.php"); |
include_once("inc/newsShow.php"); |
4 |
if ($show) { |
if ($show) { |
5 |
$arts = newsLoad($id, $cat); |
$arts = newsLoad($id, $cat); |
6 |
newsShow(array_shift($arts)); |
newsShow(array_shift($arts)); |
7 |
} else { |
} else { |
8 |
if ($del_id) { |
if ($isEdit) { |
9 |
include_once("inc/newsDelete.php"); |
if ($del_id) { |
10 |
newsDelete($del_id); |
include_once("inc/newsDelete.php"); |
11 |
unset($top_edit, $wn_edit, $pn_edit); |
newsDelete($del_id); |
12 |
} |
unset($top_edit, $top2_edit, $wn_edit, $pn_edit); |
13 |
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
} |
14 |
if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); |
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
15 |
$empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 1); |
if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); |
16 |
|
if ($flip_id) $dbh->dbh_do("UPDATE news SET prikazi = NOT prikazi WHERE (news_id = $flip_id)"); |
17 |
|
} |
18 |
|
$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"]); |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
|
$art = array_shift($arts); |
|
26 |
$ed = ""; |
$ed = ""; |
27 |
if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0)) { |
$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 |
|
$empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0); |
64 |
|
if ($top_edit && $ed_id <= 0 && $isEdit) { |
65 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
66 |
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); |
$ed = newsEdit($empty, "top_edit"); |
67 |
|
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
68 |
|
else $top_edit = false; |
69 |
} |
} |
70 |
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
71 |
else { |
$ed = ""; |
72 |
if ($ed && $ed["category"] == "t") $art = $ed; |
$a2 = array(); |
73 |
$tpl->assign("top_id", $art["id"]); |
for ($i = 0; $i < count($arts); $i++) { |
74 |
$tpl->assign("top_title", MyEscape($art["title"])); |
$art = $arts[$i]; |
75 |
$tpl->assign("top_lead", MyEscape($art["lead"])); |
$ed = ""; |
76 |
$tpl->assign("top_titlepic_url", MyEscape($art["pic_url"])); |
if ($top_edit && ($art["id"] == $ed_id)) { |
77 |
$tpl->assign("top_titlepic_alt", MyEscape($art["pic_alt"])); |
include_once("inc/newsEdit.php"); |
78 |
$tpl->assign("top_titlepic_type", $art["pic_pos"]); |
$ed = newsEdit($art, "top_edit"); |
79 |
$tpl->assign("top_titlepic_width", $art["pic_w"]); |
} |
80 |
$tpl->assign("top_titlepic_height", $art["pic_h"]); |
if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed)); |
81 |
for ($j = 0; $j < count($art["text"]); $j++) |
else { |
82 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
if ($ed && $ed["category"] == $cat) $art = $ed; |
83 |
$tpl->assign("top_text", $art["text"]); |
for ($j = 0; $j < count($art["text"]); $j++) |
84 |
include_once("inc/links.php"); |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
85 |
$tpl->assign("top_links", GetLinks($art["read"] && $art["id"], |
$read = $art["read"]; |
86 |
MyEscape($art["more"]), $art["id"], $empty["category"], "top", |
if ($read && count($art["text"]) <= 0) $read = ($art["more"] && !strstr($art["more"], "?")) ? $read : ""; |
87 |
$isEdit, false, false, false)); |
if ($read && !$art["id"]) $read = ""; |
88 |
|
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 |
|
"links" => GetLinks($read, ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : "", |
100 |
|
MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", |
101 |
|
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 |
|
)); |
105 |
|
} |
106 |
} |
} |
107 |
$empty = array("category" => "w", "limit" => ($wn_edit ? 4 : 5), "offset" => 0, "npar" => 0); |
$tpl->assign("top", $a2); |
108 |
|
$menu2 = array(); |
109 |
|
$empty = array("category" => "w", "limit" => ($wn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); |
110 |
$ed = ""; |
$ed = ""; |
111 |
if ($wn_edit && $ed_id <= 0) { |
if ($wn_edit && $ed_id <= 0 && $isEdit) { |
112 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
113 |
$ed = newsEdit($empty, "wn_edit"); |
$ed = newsEdit($empty, "wn_edit", true); |
114 |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
115 |
else $wn_edit = false; |
else $wn_edit = false; |
116 |
} |
} |
117 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
118 |
$wn = array(); |
$wn = array(); |
119 |
|
$tmp2 = array(); |
120 |
for ($i = 0; $i < count($arts); $i++) { |
for ($i = 0; $i < count($arts); $i++) { |
121 |
$art = $arts[$i]; |
$art = $arts[$i]; |
122 |
$ed = ""; |
$ed = ""; |
123 |
if ($wn_edit && $art["id"] == $ed_id) { |
if ($wn_edit && $art["id"] == $ed_id && $isEdit) { |
124 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
125 |
$art["nlimit"] = count($arts); |
$art["nlimit"] = count($arts); |
126 |
$ed = newsEdit($art, "wn_edit"); |
$ed = newsEdit($art, "wn_edit", true); |
127 |
} |
} |
128 |
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
129 |
else { |
else { |
130 |
if ($ed && $ed["category"] == "w") $art = $ed; |
if ($ed && $ed["category"] == "w") $art = $ed; |
131 |
for ($j = 0; $j < count($art["text"]); $j++) |
for ($j = 0; $j < count($art["text"]); $j++) |
132 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
133 |
include_once("inc/links.php"); |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
134 |
|
$read = $art["read"]; |
135 |
|
if ($read && count($art["text"]) <= 0) $read = ($art["more"] && !strstr($art["more"], "?")) ? $read : ""; |
136 |
|
if ($read && !$art["id"]) $read = ""; |
137 |
array_push($wn, array( |
array_push($wn, array( |
138 |
"id" => $art["id"], |
"id" => $art["id"], |
139 |
"title" => MyEscape($art["title"]), |
"title" => MyEscape($art["title"]), |
140 |
"lead" => MyEscape($art["lead"]), |
"lead" => MyEscape($art["lead"]), |
141 |
|
"pgfs" => (count($art["text"]) > 0) ? true : false, |
142 |
"pic" => MyEscape($art["pic_url"]), |
"pic" => MyEscape($art["pic_url"]), |
143 |
"alt" => MyEscape($art["pic_alt"]), |
"alt" => MyEscape($art["pic_alt"]), |
144 |
"pos" => MyEscape($art["pic_pos"]), |
"pos" => MyEscape($art["pic_pos"]), |
145 |
"width" => MyEscape($art["pic_w"]), |
"width" => $art["pic_w"], |
146 |
"height" => MyEscape($art["pic_h"]), |
"height" => $art["pic_h"], |
147 |
"links" => GetLinks($art["read"] && $art["id"], |
"links" => GetLinks($read, ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : "", |
148 |
MyEscape($art["more"]), $art["id"], |
MyEscape($art["more_title"]), $art["id"], $empty["category"], "wn", true, |
149 |
$empty["category"], "wn", $isEdit, true, |
($i > 0), ($i < count($arts) - 1), $art["show"], $art["related"]), |
150 |
($i > 0), ($i < count($arts) - 1)), |
"read" => $read, |
151 |
"text" => $art["text"] |
"text" => $art["text"] |
152 |
)); |
)); |
153 |
|
array_push($tmp2, array( |
154 |
|
"cat" => $empty["category"], |
155 |
|
"id" => $art["id"], |
156 |
|
"title" => MyEscape($art["title"]) |
157 |
|
)); |
158 |
} |
} |
159 |
} |
} |
160 |
$empty = array("category" => "p", "limit" => ($pn_edit ? 4 : 5), "offset" => 0, "npar" => 0); |
array_push($menu2, array( |
161 |
|
"title" => "Vijesti", |
162 |
|
"class" => "wnhead", |
163 |
|
"pre" => "wn-", |
164 |
|
"items" => $tmp2 |
165 |
|
)); |
166 |
|
$empty = array("category" => "p", "limit" => ($pn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); |
167 |
$ed = ""; |
$ed = ""; |
168 |
if ($pn_edit && $ed_id <= 0) { |
if ($pn_edit && $ed_id <= 0 && $isEdit) { |
169 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
170 |
$ed = newsEdit($empty, "pn_edit"); |
$ed = newsEdit($empty, "pn_edit", true); |
171 |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
172 |
else $pn_edit = false; |
else $pn_edit = false; |
173 |
} |
} |
174 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
175 |
$pn = array(); |
$pn = array(); |
176 |
|
$tmp2 = array(); |
177 |
for ($i = 0; $i < count($arts); $i++) { |
for ($i = 0; $i < count($arts); $i++) { |
178 |
$art = $arts[$i]; |
$art = $arts[$i]; |
179 |
$ed = ""; |
$ed = ""; |
180 |
if ($pn_edit && $art["id"] == $ed_id) { |
if ($pn_edit && $art["id"] == $ed_id && $isEdit) { |
181 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
182 |
$art["nlimit"] = count($arts); |
$art["nlimit"] = count($arts); |
183 |
$ed = newsEdit($art, "pn_edit"); |
$ed = newsEdit($art, "pn_edit", true); |
184 |
} |
} |
185 |
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
186 |
else { |
else { |
187 |
if ($ed && $ed["category"] == "p") $art = $ed; |
if ($ed && $ed["category"] == "p") $art = $ed; |
188 |
for ($j = 0; $j < count($art["text"]); $j++) |
for ($j = 0; $j < count($art["text"]); $j++) |
189 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
190 |
include_once("inc/links.php"); |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
191 |
|
$read = $art["read"]; |
192 |
|
if ($read && count($art["text"]) <= 0) $read = ($art["more"] && !strstr($art["more"], "?")) ? $read : ""; |
193 |
|
if ($read && !$art["id"]) $read = ""; |
194 |
array_push($pn, array( |
array_push($pn, array( |
195 |
"id" => $art["id"], |
"id" => $art["id"], |
196 |
"title" => MyEscape($art["title"]), |
"title" => MyEscape($art["title"]), |
197 |
"lead" => MyEscape($art["lead"]), |
"lead" => MyEscape($art["lead"]), |
198 |
|
"pgfs" => (count($art["text"]) > 0) ? true : false, |
199 |
"pic" => MyEscape($art["pic_url"]), |
"pic" => MyEscape($art["pic_url"]), |
200 |
"alt" => MyEscape($art["pic_alt"]), |
"alt" => MyEscape($art["pic_alt"]), |
201 |
"pos" => MyEscape($art["pic_pos"]), |
"pos" => MyEscape($art["pic_pos"]), |
202 |
"width" => MyEscape($art["pic_w"]), |
"width" => MyEscape($art["pic_w"]), |
203 |
"height" => MyEscape($art["pic_h"]), |
"height" => MyEscape($art["pic_h"]), |
204 |
"links" => GetLinks($art["read"] && $art["id"], |
"links" => GetLinks($read, ($art["more"] && strstr($art["more"], "?") == 0) ? $art["more"] : "", |
205 |
MyEscape($art["more"]), $art["id"], |
MyEscape($art["more_title"]), $art["id"], $empty["category"], "pn", true, |
206 |
$empty["category"], "pn", $isEdit, true, |
($i > 0), ($i < count($arts) - 1), $art["show"], $art["related"]), |
207 |
($i > 0), ($i < count($arts) - 1)), |
"read" => $read, |
208 |
"text" => MyEscape($art["text"]) |
"text" => MyEscape($art["text"]) |
209 |
)); |
)); |
210 |
|
array_push($tmp2, array( |
211 |
|
"cat" => $empty["category"], |
212 |
|
"id" => $art["id"], |
213 |
|
"title" => MyEscape($art["title"]) |
214 |
|
)); |
215 |
} |
} |
216 |
} |
} |
217 |
|
array_push($menu2, array( |
218 |
|
"title" => "Novo na PLIVA".($isMed ? "med.net" : "zdravlju"), |
219 |
|
"class" => "pnhead", |
220 |
|
"pre" => "pn-", |
221 |
|
"items" => $tmp2 |
222 |
|
)); |
223 |
$tpl->assign("wn", $wn); |
$tpl->assign("wn", $wn); |
224 |
$tpl->assign("pn", $pn); |
$tpl->assign("pn", $pn); |
225 |
$tpl->assign("top_edit", $top_edit); |
$tpl->assign("top_edit", $top_edit); |
226 |
$tpl->assign("wn_edit", $wn_edit); |
$tpl->assign("wn_edit", $wn_edit); |
227 |
$tpl->assign("pn_edit", $pn_edit); |
$tpl->assign("pn_edit", $pn_edit); |
228 |
$tpl->assign("isedit", $isEdit); |
if (!$isMed) $tpl->assign("MENU2", $menu2); |
|
$tpl->assign("ismed", $isMed); |
|
229 |
} |
} |
230 |
$dbh->disconnect(); |
$dbh->disconnect(); |
231 |
?> |
?> |