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 |
|
|
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 |
ravilov |
1.1 |
} |
17 |
ravilov |
1.7 |
$empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0); |
18 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
19 |
ravilov |
1.1 |
$art = array_shift($arts); |
20 |
|
|
$ed = ""; |
21 |
ravilov |
1.7 |
if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0) && $isEdit) { |
22 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
23 |
|
|
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); |
24 |
|
|
} |
25 |
|
|
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
26 |
|
|
else { |
27 |
ravilov |
1.2 |
if ($ed && $ed["category"] == "t") $art = $ed; |
28 |
ravilov |
1.1 |
$tpl->assign("top_id", $art["id"]); |
29 |
|
|
$tpl->assign("top_title", MyEscape($art["title"])); |
30 |
|
|
$tpl->assign("top_lead", MyEscape($art["lead"])); |
31 |
|
|
$tpl->assign("top_titlepic_url", MyEscape($art["pic_url"])); |
32 |
|
|
$tpl->assign("top_titlepic_alt", MyEscape($art["pic_alt"])); |
33 |
|
|
$tpl->assign("top_titlepic_type", $art["pic_pos"]); |
34 |
|
|
$tpl->assign("top_titlepic_width", $art["pic_w"]); |
35 |
|
|
$tpl->assign("top_titlepic_height", $art["pic_h"]); |
36 |
|
|
for ($j = 0; $j < count($art["text"]); $j++) |
37 |
ravilov |
1.5 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
38 |
ravilov |
1.1 |
$tpl->assign("top_text", $art["text"]); |
39 |
ravilov |
1.7 |
include_once("inc/author.php"); |
40 |
|
|
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], |
41 |
|
|
$art["au_alt"], $art["au_info"], |
42 |
|
|
$art["au_w"], $art["au_h"])); |
43 |
ravilov |
1.1 |
$tpl->assign("top_links", GetLinks($art["read"] && $art["id"], |
44 |
ravilov |
1.8 |
/* MyEscape($art["more"]) */ (count($art["text"]) > 0 && $art["id"]) ? $art["more"] : "", |
45 |
ravilov |
1.7 |
MyEscape($art["more_title"]), $art["id"], $empty["category"], |
46 |
|
|
"top", $isEdit, false, false, false)); |
47 |
ravilov |
1.1 |
} |
48 |
ravilov |
1.6 |
$menu2 = array(); |
49 |
ravilov |
1.8 |
$empty = array("category" => "w", "limit" => ($wn_edit && !$ed_id ? 4 : 5), "offset" => 0, "npar" => 0); |
50 |
ravilov |
1.2 |
$ed = ""; |
51 |
ravilov |
1.7 |
if ($wn_edit && $ed_id <= 0 && $isEdit) { |
52 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
53 |
ravilov |
1.7 |
$ed = newsEdit($empty, "wn_edit", true); |
54 |
ravilov |
1.1 |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
55 |
|
|
else $wn_edit = false; |
56 |
|
|
} |
57 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
58 |
ravilov |
1.1 |
$wn = array(); |
59 |
ravilov |
1.8 |
$tmp2 = array(); |
60 |
ravilov |
1.1 |
for ($i = 0; $i < count($arts); $i++) { |
61 |
|
|
$art = $arts[$i]; |
62 |
|
|
$ed = ""; |
63 |
ravilov |
1.7 |
if ($wn_edit && $art["id"] == $ed_id && $isEdit) { |
64 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
65 |
ravilov |
1.2 |
$art["nlimit"] = count($arts); |
66 |
ravilov |
1.7 |
$ed = newsEdit($art, "wn_edit", true); |
67 |
ravilov |
1.1 |
} |
68 |
|
|
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
69 |
|
|
else { |
70 |
ravilov |
1.2 |
if ($ed && $ed["category"] == "w") $art = $ed; |
71 |
ravilov |
1.1 |
for ($j = 0; $j < count($art["text"]); $j++) |
72 |
ravilov |
1.5 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
73 |
ravilov |
1.8 |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
74 |
ravilov |
1.1 |
array_push($wn, array( |
75 |
|
|
"id" => $art["id"], |
76 |
|
|
"title" => MyEscape($art["title"]), |
77 |
|
|
"lead" => MyEscape($art["lead"]), |
78 |
|
|
"pic" => MyEscape($art["pic_url"]), |
79 |
|
|
"alt" => MyEscape($art["pic_alt"]), |
80 |
|
|
"pos" => MyEscape($art["pic_pos"]), |
81 |
ravilov |
1.8 |
"width" => $art["pic_w"], |
82 |
|
|
"height" => $art["pic_h"], |
83 |
ravilov |
1.7 |
"links" => GetLinks(($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"], |
84 |
ravilov |
1.6 |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
85 |
|
|
$art["id"], $empty["category"], "wn", $isEdit, true, |
86 |
ravilov |
1.3 |
($i > 0), ($i < count($arts) - 1)), |
87 |
ravilov |
1.1 |
"text" => $art["text"] |
88 |
|
|
)); |
89 |
ravilov |
1.8 |
array_push($tmp2, array( |
90 |
ravilov |
1.6 |
"cat" => $empty["category"], |
91 |
|
|
"id" => $art["id"], |
92 |
|
|
"title" => MyEscape($art["title"]), |
93 |
|
|
"url" => MyEscape($art["more"]), |
94 |
ravilov |
1.7 |
"more" => ($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] |
95 |
ravilov |
1.6 |
)); |
96 |
ravilov |
1.1 |
} |
97 |
|
|
} |
98 |
ravilov |
1.8 |
array_push($menu2, array( |
99 |
|
|
"title" => "Vijesti", |
100 |
|
|
"class" => "wnhead", |
101 |
|
|
"pre" => "wn-", |
102 |
|
|
"items" => $tmp2 |
103 |
|
|
)); |
104 |
|
|
$empty = array("category" => "p", "limit" => ($pn_edit && !$ed_id ? 4 : 5), "offset" => 0, "npar" => 0); |
105 |
ravilov |
1.2 |
$ed = ""; |
106 |
ravilov |
1.7 |
if ($pn_edit && $ed_id <= 0 && $isEdit) { |
107 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
108 |
ravilov |
1.7 |
$ed = newsEdit($empty, "pn_edit", true); |
109 |
ravilov |
1.1 |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
110 |
|
|
else $pn_edit = false; |
111 |
|
|
} |
112 |
ravilov |
1.3 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
113 |
ravilov |
1.1 |
$pn = array(); |
114 |
ravilov |
1.8 |
$tmp2 = array(); |
115 |
ravilov |
1.1 |
for ($i = 0; $i < count($arts); $i++) { |
116 |
|
|
$art = $arts[$i]; |
117 |
|
|
$ed = ""; |
118 |
ravilov |
1.7 |
if ($pn_edit && $art["id"] == $ed_id && $isEdit) { |
119 |
ravilov |
1.1 |
include_once("inc/newsEdit.php"); |
120 |
ravilov |
1.2 |
$art["nlimit"] = count($arts); |
121 |
ravilov |
1.7 |
$ed = newsEdit($art, "pn_edit", true); |
122 |
ravilov |
1.1 |
} |
123 |
|
|
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
124 |
|
|
else { |
125 |
ravilov |
1.2 |
if ($ed && $ed["category"] == "p") $art = $ed; |
126 |
ravilov |
1.1 |
for ($j = 0; $j < count($art["text"]); $j++) |
127 |
ravilov |
1.5 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
128 |
ravilov |
1.8 |
list($art["pic_w"], $art["pic_h"]) = PicResize($art["pic_w"], $art["pic_h"]); |
129 |
ravilov |
1.1 |
array_push($pn, array( |
130 |
|
|
"id" => $art["id"], |
131 |
|
|
"title" => MyEscape($art["title"]), |
132 |
|
|
"lead" => MyEscape($art["lead"]), |
133 |
|
|
"pic" => MyEscape($art["pic_url"]), |
134 |
|
|
"alt" => MyEscape($art["pic_alt"]), |
135 |
|
|
"pos" => MyEscape($art["pic_pos"]), |
136 |
|
|
"width" => MyEscape($art["pic_w"]), |
137 |
|
|
"height" => MyEscape($art["pic_h"]), |
138 |
ravilov |
1.7 |
"links" => GetLinks(($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"], |
139 |
ravilov |
1.6 |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
140 |
|
|
$art["id"], $empty["category"], "pn", $isEdit, true, |
141 |
ravilov |
1.3 |
($i > 0), ($i < count($arts) - 1)), |
142 |
ravilov |
1.1 |
"text" => MyEscape($art["text"]) |
143 |
|
|
)); |
144 |
ravilov |
1.8 |
array_push($tmp2, array( |
145 |
ravilov |
1.6 |
"cat" => $empty["category"], |
146 |
|
|
"id" => $art["id"], |
147 |
|
|
"title" => MyEscape($art["title"]), |
148 |
|
|
"url" => MyEscape($art["more"]), |
149 |
ravilov |
1.7 |
"more" => ($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] |
150 |
ravilov |
1.6 |
)); |
151 |
ravilov |
1.1 |
} |
152 |
|
|
} |
153 |
ravilov |
1.8 |
array_push($menu2, array( |
154 |
|
|
"title" => "Novo na PLIVA".($isMed ? "med.net" : "zdravlju"), |
155 |
|
|
"class" => "pnhead", |
156 |
|
|
"pre" => "pn-", |
157 |
|
|
"items" => $tmp2 |
158 |
|
|
)); |
159 |
ravilov |
1.1 |
$tpl->assign("wn", $wn); |
160 |
|
|
$tpl->assign("pn", $pn); |
161 |
|
|
$tpl->assign("top_edit", $top_edit); |
162 |
|
|
$tpl->assign("wn_edit", $wn_edit); |
163 |
|
|
$tpl->assign("pn_edit", $pn_edit); |
164 |
ravilov |
1.7 |
if (!$isMed) $tpl->assign("MENU2", $menu2); |
165 |
ravilov |
1.1 |
} |
166 |
|
|
$dbh->disconnect(); |
167 |
|
|
?> |