12 |
} |
} |
13 |
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
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 ($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); |
$empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0); |
16 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
17 |
$art = array_shift($arts); |
$art = array_shift($arts); |
18 |
$ed = ""; |
$ed = ""; |
19 |
if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0)) { |
if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0) && $isEdit) { |
20 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
21 |
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); |
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); |
22 |
} |
} |
35 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
36 |
$tpl->assign("top_text", $art["text"]); |
$tpl->assign("top_text", $art["text"]); |
37 |
include_once("inc/links.php"); |
include_once("inc/links.php"); |
38 |
|
include_once("inc/author.php"); |
39 |
|
$tpl->assign("AUTHOR", GetAuthor($art["au_pic"], |
40 |
|
$art["au_alt"], $art["au_info"], |
41 |
|
$art["au_w"], $art["au_h"])); |
42 |
$tpl->assign("top_links", GetLinks($art["read"] && $art["id"], |
$tpl->assign("top_links", GetLinks($art["read"] && $art["id"], |
43 |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
/* MyEscape($art["more"]) */ (count($art["text"]) <= 0) ? true : false, |
44 |
$art["id"], $empty["category"], "top", $isEdit, |
MyEscape($art["more_title"]), $art["id"], $empty["category"], |
45 |
false, false, false)); |
"top", $isEdit, false, false, false)); |
46 |
} |
} |
47 |
$menu2 = array(); |
$menu2 = array(); |
48 |
$empty = array("category" => "w", "limit" => ($wn_edit ? 4 : 5), "offset" => 0, "npar" => 0); |
$empty = array("category" => "w", "limit" => ($wn_edit ? 4 : 5), "offset" => 0, "npar" => 0); |
49 |
$ed = ""; |
$ed = ""; |
50 |
if ($wn_edit && $ed_id <= 0) { |
if ($wn_edit && $ed_id <= 0 && $isEdit) { |
51 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
52 |
$ed = newsEdit($empty, "wn_edit"); |
$ed = newsEdit($empty, "wn_edit", true); |
53 |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); |
54 |
else $wn_edit = false; |
else $wn_edit = false; |
55 |
} |
} |
58 |
for ($i = 0; $i < count($arts); $i++) { |
for ($i = 0; $i < count($arts); $i++) { |
59 |
$art = $arts[$i]; |
$art = $arts[$i]; |
60 |
$ed = ""; |
$ed = ""; |
61 |
if ($wn_edit && $art["id"] == $ed_id) { |
if ($wn_edit && $art["id"] == $ed_id && $isEdit) { |
62 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
63 |
$art["nlimit"] = count($arts); |
$art["nlimit"] = count($arts); |
64 |
$ed = newsEdit($art, "wn_edit"); |
$ed = newsEdit($art, "wn_edit", true); |
65 |
} |
} |
66 |
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); |
67 |
else { |
else { |
78 |
"pos" => MyEscape($art["pic_pos"]), |
"pos" => MyEscape($art["pic_pos"]), |
79 |
"width" => MyEscape($art["pic_w"]), |
"width" => MyEscape($art["pic_w"]), |
80 |
"height" => MyEscape($art["pic_h"]), |
"height" => MyEscape($art["pic_h"]), |
81 |
"links" => GetLinks($art["read"] && $art["id"], |
"links" => GetLinks(($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"], |
82 |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
83 |
$art["id"], $empty["category"], "wn", $isEdit, true, |
$art["id"], $empty["category"], "wn", $isEdit, true, |
84 |
($i > 0), ($i < count($arts) - 1)), |
($i > 0), ($i < count($arts) - 1)), |
90 |
"id" => $art["id"], |
"id" => $art["id"], |
91 |
"title" => MyEscape($art["title"]), |
"title" => MyEscape($art["title"]), |
92 |
"url" => MyEscape($art["more"]), |
"url" => MyEscape($art["more"]), |
93 |
"more" => MyEscape($art["read"]) |
"more" => ($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] |
94 |
)); |
)); |
95 |
} |
} |
96 |
} |
} |
97 |
$empty = array("category" => "p", "limit" => ($pn_edit ? 4 : 5), "offset" => 0, "npar" => 0); |
$empty = array("category" => "p", "limit" => ($pn_edit ? 4 : 5), "offset" => 0, "npar" => 0); |
98 |
$ed = ""; |
$ed = ""; |
99 |
if ($pn_edit && $ed_id <= 0) { |
if ($pn_edit && $ed_id <= 0 && $isEdit) { |
100 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
101 |
$ed = newsEdit($empty, "pn_edit"); |
$ed = newsEdit($empty, "pn_edit", true); |
102 |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); |
103 |
else $pn_edit = false; |
else $pn_edit = false; |
104 |
} |
} |
107 |
for ($i = 0; $i < count($arts); $i++) { |
for ($i = 0; $i < count($arts); $i++) { |
108 |
$art = $arts[$i]; |
$art = $arts[$i]; |
109 |
$ed = ""; |
$ed = ""; |
110 |
if ($pn_edit && $art["id"] == $ed_id) { |
if ($pn_edit && $art["id"] == $ed_id && $isEdit) { |
111 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
112 |
$art["nlimit"] = count($arts); |
$art["nlimit"] = count($arts); |
113 |
$ed = newsEdit($art, "pn_edit"); |
$ed = newsEdit($art, "pn_edit", true); |
114 |
} |
} |
115 |
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); |
116 |
else { |
else { |
127 |
"pos" => MyEscape($art["pic_pos"]), |
"pos" => MyEscape($art["pic_pos"]), |
128 |
"width" => MyEscape($art["pic_w"]), |
"width" => MyEscape($art["pic_w"]), |
129 |
"height" => MyEscape($art["pic_h"]), |
"height" => MyEscape($art["pic_h"]), |
130 |
"links" => GetLinks($art["read"] && $art["id"], |
"links" => GetLinks(($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"], |
131 |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
MyEscape($art["more"]), MyEscape($art["more_title"]), |
132 |
$art["id"], $empty["category"], "pn", $isEdit, true, |
$art["id"], $empty["category"], "pn", $isEdit, true, |
133 |
($i > 0), ($i < count($arts) - 1)), |
($i > 0), ($i < count($arts) - 1)), |
139 |
"id" => $art["id"], |
"id" => $art["id"], |
140 |
"title" => MyEscape($art["title"]), |
"title" => MyEscape($art["title"]), |
141 |
"url" => MyEscape($art["more"]), |
"url" => MyEscape($art["more"]), |
142 |
"more" => MyEscape($art["read"]) |
"more" => ($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] |
143 |
)); |
)); |
144 |
} |
} |
145 |
} |
} |
148 |
$tpl->assign("top_edit", $top_edit); |
$tpl->assign("top_edit", $top_edit); |
149 |
$tpl->assign("wn_edit", $wn_edit); |
$tpl->assign("wn_edit", $wn_edit); |
150 |
$tpl->assign("pn_edit", $pn_edit); |
$tpl->assign("pn_edit", $pn_edit); |
151 |
$tpl->assign("MENU2", $menu2); |
if (!$isMed) $tpl->assign("MENU2", $menu2); |
152 |
} |
} |
153 |
$dbh->disconnect(); |
$dbh->disconnect(); |
154 |
?> |
?> |