--- inc/pgHome.php 2001/10/04 14:59:35 1.11 +++ inc/pgHome.php 2001/10/10 12:40:58 1.12 @@ -13,42 +13,53 @@ } 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)"); + if ($flip_id) $dbh->dbh_do("UPDATE news SET prikazi = NOT prikazi WHERE (news_id = $flip_id)"); } $empty = array("category" => "t", "limit" => 1, "offset" => 0, "npar" => 0); - $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) && $isEdit) { + if ($top_edit && $ed_id <= 0 && $isEdit) { include_once("inc/newsEdit.php"); - $ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); + $ed = newsEdit($empty, "top_edit"); + if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); + else $top_edit = false; } - if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); - else { - 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"])); - $tpl->assign("top_pgfs", (count($art["text"]) > 0) ? true : false); - $tpl->assign("top_titlepic_url", MyEscape($art["pic_url"])); - $tpl->assign("top_titlepic_alt", MyEscape($art["pic_alt"])); - $tpl->assign("top_titlepic_type", $art["pic_pos"]); - $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"]), true); - $tpl->assign("top_text", $art["text"]); - include_once("inc/author.php"); - $tpl->assign("AUTHOR", GetAuthor($art["au_pic"], - $art["au_alt"], $art["au_info"], - $art["au_w"], $art["au_h"])); - $tpl->assign("top_links", GetLinks($art["read"] && $art["id"], - /* MyEscape($art["more"]) */ (count($art["text"]) > 0 && $art["id"]) ? $art["more"] : "", - MyEscape($art["more_title"]), $art["id"], $empty["category"], - "top", $isEdit, false, false, false)); - $tpl->assign("top_read", $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : ""); + $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); + $ed = ""; + $a2 = array(); + for ($i = 0; $i < count($arts); $i++) { + $art = $arts[$i]; + $ed = ""; + if ($top_edit && ($art["id"] == $ed_id)) { + include_once("inc/newsEdit.php"); + $ed = newsEdit($art, "top_edit"); + } + if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed)); + else { + if ($ed && $ed["category"] == $cat) $art = $ed; + for ($j = 0; $j < count($art["text"]); $j++) + $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); + array_push($a2, array( + "id" => $art["id"], + "title" => MyEscape($art["title"]), + "lead" => MyEscape($art["lead"]), + "pgfs" => (count($art["text"]) > 0) ? true : false, + "titlepic_url" => MyEscape($art["pic_url"]), + "titlepic_alt" => MyEscape($art["pic_alt"]), + "titlepic_type" => $art["pic_pos"], + "titlepic_width" => $art["pic_w"], + "titlepic_height" => $art["pic_h"], + "text" => $art["text"], + "links" => GetLinks((($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"]) ? $art["read"] : "", + /* MyEscape($art["more"]) */ /* ((count($art["text"]) > 0 || strstr("?", $art["more"]) == 0) && $art["id"]) ? $art["more"] : "" */ "", + MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", + true, ($i > 0), ($i < count($arts) - 1), $art["show"]), + "read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "", + "AUTHOR" => GetAuthor($art["au_pic"], $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"]) + )); + } } + $tpl->assign("top", $a2); $menu2 = array(); - $empty = array("category" => "w", "limit" => $isEdit ? 0 : ($wn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); + $empty = array("category" => "w", "limit" => ($wn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); $ed = ""; if ($wn_edit && $ed_id <= 0 && $isEdit) { include_once("inc/newsEdit.php"); @@ -83,19 +94,17 @@ "pos" => MyEscape($art["pic_pos"]), "width" => $art["pic_w"], "height" => $art["pic_h"], - "links" => GetLinks(($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"], - MyEscape($art["more"]), MyEscape($art["more_title"]), - $art["id"], $empty["category"], "wn", $isEdit, true, - ($i > 0), ($i < count($arts) - 1)), + "links" => GetLinks((($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"]) ? $art["read"] : "", + /* MyEscape($art["more"]) */ "", MyEscape($art["more_title"]), + $art["id"], $empty["category"], "wn", true, + ($i > 0), ($i < count($arts) - 1), $art["show"]), "read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "", "text" => $art["text"] )); array_push($tmp2, array( "cat" => $empty["category"], "id" => $art["id"], - "title" => MyEscape($art["title"]), - "url" => MyEscape($art["more"]), - "more" => ($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] ? $art["read"] : "" + "title" => MyEscape($art["title"]) )); } } @@ -105,7 +114,7 @@ "pre" => "wn-", "items" => $tmp2 )); - $empty = array("category" => "p", $isEdit ? 0 : "limit" => ($pn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); + $empty = array("category" => "p", "limit" => ($pn_edit && !$ed_id ? 9 : 10), "offset" => 0, "npar" => 0); $ed = ""; if ($pn_edit && $ed_id <= 0 && $isEdit) { include_once("inc/newsEdit.php"); @@ -140,19 +149,17 @@ "pos" => MyEscape($art["pic_pos"]), "width" => MyEscape($art["pic_w"]), "height" => MyEscape($art["pic_h"]), - "links" => GetLinks(($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"], + "links" => GetLinks((($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"]) ? $art["read"] : "", MyEscape($art["more"]), MyEscape($art["more_title"]), - $art["id"], $empty["category"], "pn", $isEdit, true, - ($i > 0), ($i < count($arts) - 1)), + $art["id"], $empty["category"], "pn", true, + ($i > 0), ($i < count($arts) - 1), $art["show"]), "read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "", "text" => MyEscape($art["text"]) )); array_push($tmp2, array( "cat" => $empty["category"], "id" => $art["id"], - "title" => MyEscape($art["title"]), - "url" => MyEscape($art["more"]), - "more" => ($art["read"] || $art["au_pic"] || $art["au_info"]) && $art["id"] ? $art["read"] : "" + "title" => MyEscape($art["title"]) )); } }