/[health_html]/inc/pgHome.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /inc/pgHome.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations)
Tue Oct 23 16:13:59 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.13: +67 -16 lines
Added an author's CV. Added a secondary main article. Added the Related fields to news editor, and also fixed some bugs in it. Other bugfixes and improvements.

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, $top2_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" => "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 $empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0);
64 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 $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]);
71 $ed = "";
72 $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 $read = $art["read"];
86 if ($read && count($art["text"]) <= 0) $read = ($art["more"] && !strstr($art["more"], "?")) ? $read : "";
87 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 $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 = "";
111 if ($wn_edit && $ed_id <= 0 && $isEdit) {
112 include_once("inc/newsEdit.php");
113 $ed = newsEdit($empty, "wn_edit", true);
114 if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed);
115 else $wn_edit = false;
116 }
117 $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]);
118 $wn = array();
119 $tmp2 = array();
120 for ($i = 0; $i < count($arts); $i++) {
121 $art = $arts[$i];
122 $ed = "";
123 if ($wn_edit && $art["id"] == $ed_id && $isEdit) {
124 include_once("inc/newsEdit.php");
125 $art["nlimit"] = count($arts);
126 $ed = newsEdit($art, "wn_edit", true);
127 }
128 if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed));
129 else {
130 if ($ed && $ed["category"] == "w") $art = $ed;
131 for ($j = 0; $j < count($art["text"]); $j++)
132 $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true);
133 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(
138 "id" => $art["id"],
139 "title" => MyEscape($art["title"]),
140 "lead" => MyEscape($art["lead"]),
141 "pgfs" => (count($art["text"]) > 0) ? true : false,
142 "pic" => MyEscape($art["pic_url"]),
143 "alt" => MyEscape($art["pic_alt"]),
144 "pos" => MyEscape($art["pic_pos"]),
145 "width" => $art["pic_w"],
146 "height" => $art["pic_h"],
147 "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 "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 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 = "";
168 if ($pn_edit && $ed_id <= 0 && $isEdit) {
169 include_once("inc/newsEdit.php");
170 $ed = newsEdit($empty, "pn_edit", true);
171 if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed);
172 else $pn_edit = false;
173 }
174 $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]);
175 $pn = array();
176 $tmp2 = array();
177 for ($i = 0; $i < count($arts); $i++) {
178 $art = $arts[$i];
179 $ed = "";
180 if ($pn_edit && $art["id"] == $ed_id && $isEdit) {
181 include_once("inc/newsEdit.php");
182 $art["nlimit"] = count($arts);
183 $ed = newsEdit($art, "pn_edit", true);
184 }
185 if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed));
186 else {
187 if ($ed && $ed["category"] == "p") $art = $ed;
188 for ($j = 0; $j < count($art["text"]); $j++)
189 $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true);
190 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(
195 "id" => $art["id"],
196 "title" => MyEscape($art["title"]),
197 "lead" => MyEscape($art["lead"]),
198 "pgfs" => (count($art["text"]) > 0) ? true : false,
199 "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 "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 "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);
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 if (!$isMed) $tpl->assign("MENU2", $menu2);
229 }
230 $dbh->disconnect();
231 ?>

  ViewVC Help
Powered by ViewVC 1.1.26