--- inc/pgHome.php 2001/08/03 10:02:49 1.1 +++ inc/pgHome.php 2001/08/07 13:55:51 1.2 @@ -10,6 +10,8 @@ newsDelete($del_id); unset($top_edit, $wn_edit, $pn_edit); } + 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, "npar" => 1); $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); $art = array_shift($arts); @@ -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"])); @@ -34,9 +36,11 @@ $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"]), $art["id"], $empty["category"], "top", + false, false, false)); } $empty = array("category" => "w", "limit" => ($wn_edit ? 4 : 5), "npar" => 0); + $ed = ""; if ($wn_edit && $ed_id <= 0) { include_once("inc/newsEdit.php"); $ed = newsEdit($empty, "wn_edit"); @@ -50,11 +54,12 @@ $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"])); include_once("inc/links.php"); @@ -69,12 +74,14 @@ "height" => MyEscape($art["pic_h"]), "links" => GetLinks($art["read"] && $art["id"], MyEscape($art["more"]), $art["id"], - $empty["category"], "wn"), + $empty["category"], "wn", true, ($i > 0), + ($i < count($arts) - 1)), "text" => $art["text"] )); } } $empty = array("category" => "p", "limit" => ($pn_edit ? 4 : 5), "npar" => 0); + $ed = ""; if ($pn_edit && $ed_id <= 0) { include_once("inc/newsEdit.php"); $ed = newsEdit($empty, "pn_edit"); @@ -88,11 +95,12 @@ $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"])); include_once("inc/links.php"); @@ -107,7 +115,8 @@ "height" => MyEscape($art["pic_h"]), "links" => GetLinks($art["read"] && $art["id"], MyEscape($art["more"]), $art["id"], - $empty["category"], "pn"), + $empty["category"], "pn", true, ($i > 0), + ($i < count($arts) - 1)), "text" => MyEscape($art["text"]) )); }