--- inc/pgLifestyle.php 2001/08/03 10:03:20 1.1.1.1 +++ inc/pgLifestyle.php 2001/09/25 15:38:04 1.6 @@ -1,42 +1,89 @@ "l", "limit" => 1, "npar" => 1); - $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); - $art = array_shift($arts); - $ed = ""; - if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0)) { + if ($isEdit) { + if ($del_id) { + include_once("inc/newsDelete.php"); + 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)"); + } + $cat = "l"; + if ($section_menu == "sex") { + $cat = "x"; + if ($section_menu2 == "qa") $cat = "q"; + if ($section_menu2 == "rjecnik") $cat = "j"; + } + if ($section_menu == "zdrava") { + $cat = "h"; + if ($section_menu2 == "nutri") $cat = "n"; + if ($section_menu2 == "qa") $cat = "a"; + if ($section_menu2 == "kuhanje") $cat = "v"; + if ($section_menu2 == "dtd") $cat = "y"; + if ($section_menu2 == "vrijednosti") $cat = "i"; + } + if ($section_menu == "fitness") { + $cat = "f"; + if ($section_menu2 == "qa") $cat = "1"; + if ($section_menu2 == "trening") $cat = "g"; + if ($section_menu2 == "istezanje") $cat = "s"; + if ($section_menu2 == "ozljede") $cat = "2"; + if ($section_menu2 == "trener") $cat = "b"; + if ($section_menu2 == "vjezbe") $cat = "u"; + if ($section_menu2 == "fitcenter") $cat = "k"; + } + if (!$offset) $offset = 0; + $empty = array("category" => $cat, "limit" => 11, "offset" => $offset, "npar" => 0); + 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) $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_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"])); - $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")); + $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); + $a2 = array(); + $lm = count($arts); + if ($lm > $empty["limit"]) $lm = $empty["limit"]; + for ($i = 0; $i < $lm; $i++) { + $art = $arts[$i]; + $ed = ""; + if ($top_edit && ($art["id"] == $ed_id) && $isEdit) { + 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"]), + "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["id"], + /* MyEscape($art["more"]) */ (count($art["text"]) > 0 && $art["id"]) ? $art["more"] : "", + MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", + $isEdit, true, ($i > 0), ($i < count($arts) - 1)) + )); + } } - $tpl->assign("top_edit", $top_edit); + $tpl->assign("top", $a2); + $tpl->assign("cat", $cat); + $tpl->assign("next", (count($arts) > 10) ? ($offset + 10) : 0); + $tpl->assign("prev", ($offset > 0) ? ($offset - 10) : false); } $dbh->disconnect(); ?>