/[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.6 - (show annotations)
Mon Sep 3 15:52:15 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.5: +25 -6 lines
Made the menu on the left into images. More bugfixes.

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

  ViewVC Help
Powered by ViewVC 1.1.26