--- inc/pgHome.php 2001/08/03 10:02:49 1.1.1.1 +++ inc/pgHome.php 2001/09/03 15:52:15 1.6 @@ -10,8 +10,10 @@ newsDelete($del_id); unset($top_edit, $wn_edit, $pn_edit); } - $empty = array("category" => "t", "limit" => 1, "npar" => 1); - $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); + if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); + if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); + $empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 1); + $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); $art = array_shift($arts); $ed = ""; if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0)) { @@ -20,7 +22,7 @@ } if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); else { - if ($ed) $art = $ed; + if ($ed && $ed["category"] == "t") $art = $ed; $tpl->assign("top_id", $art["id"]); $tpl->assign("top_title", MyEscape($art["title"])); $tpl->assign("top_lead", MyEscape($art["lead"])); @@ -30,33 +32,38 @@ $tpl->assign("top_titlepic_width", $art["pic_w"]); $tpl->assign("top_titlepic_height", $art["pic_h"]); for ($j = 0; $j < count($art["text"]); $j++) - $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); + $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); $tpl->assign("top_text", $art["text"]); include_once("inc/links.php"); $tpl->assign("top_links", GetLinks($art["read"] && $art["id"], - MyEscape($art["more"]), $art["id"], $empty["category"], "top")); + MyEscape($art["more"]), MyEscape($art["more_title"]), + $art["id"], $empty["category"], "top", $isEdit, + false, false, false)); } - $empty = array("category" => "w", "limit" => ($wn_edit ? 4 : 5), "npar" => 0); + $menu2 = array(); + $empty = array("category" => "w", "limit" => ($wn_edit ? 4 : 5), "offset" => 0, "npar" => 0); + $ed = ""; if ($wn_edit && $ed_id <= 0) { include_once("inc/newsEdit.php"); $ed = newsEdit($empty, "wn_edit"); if ($ed && is_string($ed)) $tpl->assign("WN_EDIT", $ed); else $wn_edit = false; } - $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); + $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); $wn = array(); for ($i = 0; $i < count($arts); $i++) { $art = $arts[$i]; $ed = ""; if ($wn_edit && $art["id"] == $ed_id) { include_once("inc/newsEdit.php"); + $art["nlimit"] = count($arts); $ed = newsEdit($art, "wn_edit"); } if ($ed && is_string($ed)) array_push($wn, array("EDIT" => $ed)); else { - if ($ed) $art = $ed; + if ($ed && $ed["category"] == "w") $art = $ed; for ($j = 0; $j < count($art["text"]); $j++) - $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); + $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); include_once("inc/links.php"); array_push($wn, array( "id" => $art["id"], @@ -68,33 +75,44 @@ "width" => MyEscape($art["pic_w"]), "height" => MyEscape($art["pic_h"]), "links" => GetLinks($art["read"] && $art["id"], - MyEscape($art["more"]), $art["id"], - $empty["category"], "wn"), + MyEscape($art["more"]), MyEscape($art["more_title"]), + $art["id"], $empty["category"], "wn", $isEdit, true, + ($i > 0), ($i < count($arts) - 1)), "text" => $art["text"] )); + array_push($menu2, array( + "pre" => "wn-", + "cat" => $empty["category"], + "id" => $art["id"], + "title" => MyEscape($art["title"]), + "url" => MyEscape($art["more"]), + "more" => MyEscape($art["read"]) + )); } } - $empty = array("category" => "p", "limit" => ($pn_edit ? 4 : 5), "npar" => 0); + $empty = array("category" => "p", "limit" => ($pn_edit ? 4 : 5), "offset" => 0, "npar" => 0); + $ed = ""; if ($pn_edit && $ed_id <= 0) { include_once("inc/newsEdit.php"); $ed = newsEdit($empty, "pn_edit"); if ($ed && is_string($ed)) $tpl->assign("PN_EDIT", $ed); else $pn_edit = false; } - $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); + $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); $pn = array(); for ($i = 0; $i < count($arts); $i++) { $art = $arts[$i]; $ed = ""; if ($pn_edit && $art["id"] == $ed_id) { include_once("inc/newsEdit.php"); + $art["nlimit"] = count($arts); $ed = newsEdit($art, "pn_edit"); } if ($ed && is_string($ed)) array_push($pn, array("EDIT" => $ed)); else { - if ($ed) $art = $ed; + if ($ed && $ed["category"] == "p") $art = $ed; for ($j = 0; $j < count($art["text"]); $j++) - $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); + $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); include_once("inc/links.php"); array_push($pn, array( "id" => $art["id"], @@ -106,10 +124,19 @@ "width" => MyEscape($art["pic_w"]), "height" => MyEscape($art["pic_h"]), "links" => GetLinks($art["read"] && $art["id"], - MyEscape($art["more"]), $art["id"], - $empty["category"], "pn"), + MyEscape($art["more"]), MyEscape($art["more_title"]), + $art["id"], $empty["category"], "pn", $isEdit, true, + ($i > 0), ($i < count($arts) - 1)), "text" => MyEscape($art["text"]) )); + array_push($menu2, array( + "pre" => "pn-", + "cat" => $empty["category"], + "id" => $art["id"], + "title" => MyEscape($art["title"]), + "url" => MyEscape($art["more"]), + "more" => MyEscape($art["read"]) + )); } } $tpl->assign("wn", $wn); @@ -117,6 +144,7 @@ $tpl->assign("top_edit", $top_edit); $tpl->assign("wn_edit", $wn_edit); $tpl->assign("pn_edit", $pn_edit); + $tpl->assign("MENU2", $menu2); } $dbh->disconnect(); ?>