10 |
newsDelete($del_id); |
newsDelete($del_id); |
11 |
unset($top_edit, $wn_edit, $pn_edit); |
unset($top_edit, $wn_edit, $pn_edit); |
12 |
} |
} |
13 |
$empty = array("category" => "l", "limit" => 1, "npar" => 1); |
# ---KLUDGE-BEGIN--- |
14 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); |
$cat = ""; |
15 |
$art = array_shift($arts); |
if ($section == "conditions") $cat = "c"; |
16 |
$ed = ""; |
if ($section == "lifestyle") $cat = "l"; |
17 |
if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0)) { |
# ---KLUDGE-END--- |
18 |
|
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
19 |
|
if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); |
20 |
|
if (!$offset) $offset = 0; |
21 |
|
$empty = array("category" => $cat, "limit" => 11, "offset" => $offset, "npar" => 1); |
22 |
|
if ($top_edit && $ed_id <= 0) { |
23 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
24 |
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); |
$ed = newsEdit($empty, "top_edit"); |
25 |
|
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
26 |
|
else $top_edit = false; |
27 |
} |
} |
28 |
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]); |
29 |
else { |
$a2 = array(); |
30 |
if ($ed && $ed["category"] == "l") $art = $ed; |
$lm = count($arts); |
31 |
$tpl->assign("top_id", $art["id"]); |
if ($lm > $empty["limit"]) $lm = $empty["limit"]; |
32 |
$tpl->assign("top_title", MyEscape($art["title"])); |
for ($i = 0; $i < $lm; $i++) { |
33 |
$tpl->assign("top_lead", MyEscape($art["lead"])); |
$art = $arts[$i]; |
34 |
$tpl->assign("top_titlepic_url", MyEscape($art["pic_url"])); |
$ed = ""; |
35 |
$tpl->assign("top_titlepic_alt", MyEscape($art["pic_alt"])); |
if ($top_edit && ($art["id"] == $ed_id)) { |
36 |
$tpl->assign("top_titlepic_type", $art["pic_pos"]); |
include_once("inc/newsEdit.php"); |
37 |
$tpl->assign("top_titlepic_width", $art["pic_w"]); |
$ed = newsEdit($art, "top_edit"); |
38 |
$tpl->assign("top_titlepic_height", $art["pic_h"]); |
} |
39 |
for ($j = 0; $j < count($art["text"]); $j++) |
if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed)); |
40 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
else { |
41 |
$tpl->assign("top_text", $art["text"]); |
if ($ed && $ed["category"] == $cat) $art = $ed; |
42 |
include_once("inc/links.php"); |
for ($j = 0; $j < count($art["text"]); $j++) |
43 |
$tpl->assign("top_links", GetLinks($art["read"] && $art["id"], |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
44 |
MyEscape($art["more"]), $art["id"], $empty["category"], "top")); |
include_once("inc/links.php"); |
45 |
|
array_push($a2, array( |
46 |
|
"id" => $art["id"], |
47 |
|
"title" => MyEscape($art["title"]), |
48 |
|
"lead" => MyEscape($art["lead"]), |
49 |
|
"titlepic_url" => MyEscape($art["pic_url"]), |
50 |
|
"titlepic_alt" => MyEscape($art["pic_alt"]), |
51 |
|
"titlepic_type" => $art["pic_pos"], |
52 |
|
"titlepic_width" => $art["pic_w"], |
53 |
|
"titlepic_height" => $art["pic_h"], |
54 |
|
"text" => $art["text"], |
55 |
|
"links" => GetLinks($art["read"] && $art["id"], |
56 |
|
MyEscape($art["more"]), $art["id"], |
57 |
|
$empty["category"], "top", isEdit(), true, |
58 |
|
($i > 0), ($i < count($arts) - 1)) |
59 |
|
)); |
60 |
|
} |
61 |
} |
} |
62 |
$tpl->assign("top_edit", $top_edit); |
$tpl->assign("top", $a2); |
63 |
|
$tpl->assign("cat", $cat); |
64 |
|
$tpl->assign("isedit", isEdit()); |
65 |
|
$tpl->assign("next", (count($arts) > 10) ? ($offset + 10) : 0); |
66 |
|
$tpl->assign("prev", ($offset > 0) ? ($offset - 10) : false); |
67 |
} |
} |
68 |
$dbh->disconnect(); |
$dbh->disconnect(); |
69 |
?> |
?> |