1 |
<?php |
2 |
include("inc/conn.php"); |
3 |
include_once("inc/newsShow.php"); |
4 |
if ($show) { |
5 |
$arts = newsLoad($id, $cat); |
6 |
newsShow(array_shift($arts)); |
7 |
} else { |
8 |
if ($isEdit) { |
9 |
if ($del_id) { |
10 |
include_once("inc/newsDelete.php"); |
11 |
newsDelete($del_id); |
12 |
unset($top_edit, $wn_edit, $pn_edit); |
13 |
} |
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 |
if ($flip_id) $dbh->dbh_do("UPDATE news SET prikazi = NOT prikazi WHERE (news_id = $flip_id)"); |
17 |
} |
18 |
$empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0); |
19 |
if ($top_edit && $ed_id <= 0 && $isEdit) { |
20 |
include_once("inc/newsEdit.php"); |
21 |
$ed = newsEdit($empty, "top_edit"); |
22 |
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
23 |
else $top_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 ($top_edit && ($art["id"] == $ed_id)) { |
32 |
include_once("inc/newsEdit.php"); |
33 |
$ed = newsEdit($art, "top_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 |
array_push($a2, array( |
41 |
"id" => $art["id"], |
42 |
"title" => MyEscape($art["title"]), |
43 |
"lead" => MyEscape($art["lead"]), |
44 |
"pgfs" => (count($art["text"]) > 0) ? true : false, |
45 |
"titlepic_url" => MyEscape($art["pic_url"]), |
46 |
"titlepic_alt" => MyEscape($art["pic_alt"]), |
47 |
"titlepic_type" => $art["pic_pos"], |
48 |
"titlepic_width" => $art["pic_w"], |
49 |
"titlepic_height" => $art["pic_h"], |
50 |
"text" => $art["text"], |
51 |
"links" => GetLinks((($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] && (!$art["more"] || ($art["more"] && !strpos($art["more"], "?")))) ? $art["read"] : "", |
52 |
/* MyEscape($art["more"]) */ /* ((count($art["text"]) > 0 || strstr("?", $art["more"]) == 0) && $art["id"]) ? $art["more"] : "" */ "", |
53 |
MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", |
54 |
true, ($i > 0), ($i < count($arts) - 1), $art["show"]), |
55 |
"read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "", |
56 |
"AUTHOR" => GetAuthor($art["au_pic"], $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"]) |
57 |
)); |
58 |
} |
59 |
} |
60 |
$tpl->assign("top", $a2); |
61 |
$menu2 = array(); |
62 |
$empty = array("category" => "w", "limit" => ($wn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); |
63 |
$ed = ""; |
64 |
if ($wn_edit && $ed_id <= 0 && $isEdit) { |
65 |
include_once("inc/newsEdit.php"); |
66 |
$ed = newsEdit($empty, "wn_edit", true); |
67 |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
68 |
else $wn_edit = false; |
69 |
} |
70 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
71 |
$wn = array(); |
72 |
$tmp2 = array(); |
73 |
for ($i = 0; $i < count($arts); $i++) { |
74 |
$art = $arts[$i]; |
75 |
$ed = ""; |
76 |
if ($wn_edit && $art["id"] == $ed_id && $isEdit) { |
77 |
include_once("inc/newsEdit.php"); |
78 |
$art["nlimit"] = count($arts); |
79 |
$ed = newsEdit($art, "wn_edit", true); |
80 |
} |
81 |
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
82 |
else { |
83 |
if ($ed && $ed["category"] == "w") $art = $ed; |
84 |
for ($j = 0; $j < count($art["text"]); $j++) |
85 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
86 |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
87 |
array_push($wn, array( |
88 |
"id" => $art["id"], |
89 |
"title" => MyEscape($art["title"]), |
90 |
"lead" => MyEscape($art["lead"]), |
91 |
"pgfs" => (count($art["text"]) > 0) ? true : false, |
92 |
"pic" => MyEscape($art["pic_url"]), |
93 |
"alt" => MyEscape($art["pic_alt"]), |
94 |
"pos" => MyEscape($art["pic_pos"]), |
95 |
"width" => $art["pic_w"], |
96 |
"height" => $art["pic_h"], |
97 |
"links" => GetLinks((($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] && (!$art["more"] || ($art["more"] && !strpos($art["more"], "?")))) ? $art["read"] : "", |
98 |
/* MyEscape($art["more"]) */ "", MyEscape($art["more_title"]), |
99 |
$art["id"], $empty["category"], "wn", true, |
100 |
($i > 0), ($i < count($arts) - 1), $art["show"]), |
101 |
"read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "", |
102 |
"text" => $art["text"] |
103 |
)); |
104 |
array_push($tmp2, array( |
105 |
"cat" => $empty["category"], |
106 |
"id" => $art["id"], |
107 |
"title" => MyEscape($art["title"]) |
108 |
)); |
109 |
} |
110 |
} |
111 |
array_push($menu2, array( |
112 |
"title" => "Vijesti", |
113 |
"class" => "wnhead", |
114 |
"pre" => "wn-", |
115 |
"items" => $tmp2 |
116 |
)); |
117 |
$empty = array("category" => "p", "limit" => ($pn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); |
118 |
$ed = ""; |
119 |
if ($pn_edit && $ed_id <= 0 && $isEdit) { |
120 |
include_once("inc/newsEdit.php"); |
121 |
$ed = newsEdit($empty, "pn_edit", true); |
122 |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
123 |
else $pn_edit = false; |
124 |
} |
125 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
126 |
$pn = array(); |
127 |
$tmp2 = array(); |
128 |
for ($i = 0; $i < count($arts); $i++) { |
129 |
$art = $arts[$i]; |
130 |
$ed = ""; |
131 |
if ($pn_edit && $art["id"] == $ed_id && $isEdit) { |
132 |
include_once("inc/newsEdit.php"); |
133 |
$art["nlimit"] = count($arts); |
134 |
$ed = newsEdit($art, "pn_edit", true); |
135 |
} |
136 |
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
137 |
else { |
138 |
if ($ed && $ed["category"] == "p") $art = $ed; |
139 |
for ($j = 0; $j < count($art["text"]); $j++) |
140 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
141 |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
142 |
array_push($pn, array( |
143 |
"id" => $art["id"], |
144 |
"title" => MyEscape($art["title"]), |
145 |
"lead" => MyEscape($art["lead"]), |
146 |
"pgfs" => (count($art["text"]) > 0) ? true : false, |
147 |
"pic" => MyEscape($art["pic_url"]), |
148 |
"alt" => MyEscape($art["pic_alt"]), |
149 |
"pos" => MyEscape($art["pic_pos"]), |
150 |
"width" => MyEscape($art["pic_w"]), |
151 |
"height" => MyEscape($art["pic_h"]), |
152 |
"links" => GetLinks((($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] && (!$art["more"] || ($art["more"] && !strpos($art["more"], "?")))) ? $art["read"] : "", |
153 |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
154 |
$art["id"], $empty["category"], "pn", true, |
155 |
($i > 0), ($i < count($arts) - 1), $art["show"]), |
156 |
"read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "", |
157 |
"text" => MyEscape($art["text"]) |
158 |
)); |
159 |
array_push($tmp2, array( |
160 |
"cat" => $empty["category"], |
161 |
"id" => $art["id"], |
162 |
"title" => MyEscape($art["title"]) |
163 |
)); |
164 |
} |
165 |
} |
166 |
array_push($menu2, array( |
167 |
"title" => "Novo na PLIVA".($isMed ? "med.net" : "zdravlju"), |
168 |
"class" => "pnhead", |
169 |
"pre" => "pn-", |
170 |
"items" => $tmp2 |
171 |
)); |
172 |
$tpl->assign("wn", $wn); |
173 |
$tpl->assign("pn", $pn); |
174 |
$tpl->assign("top_edit", $top_edit); |
175 |
$tpl->assign("wn_edit", $wn_edit); |
176 |
$tpl->assign("pn_edit", $pn_edit); |
177 |
if (!$isMed) $tpl->assign("MENU2", $menu2); |
178 |
} |
179 |
$dbh->disconnect(); |
180 |
?> |