1 |
<?php |
2 |
include_once("inc/conn.php"); |
3 |
include_once("inc/newsShow.php"); |
4 |
if ($show) { |
5 |
$arts = newsLoad($id, $cat); |
6 |
newsShow(array_shift($arts)); |
7 |
} else { |
8 |
if ($del_id) { |
9 |
include_once("inc/newsDelete.php"); |
10 |
newsDelete($del_id); |
11 |
unset($top_edit, $wn_edit, $pn_edit); |
12 |
} |
13 |
$empty = array("category" => "c", "limit" => 1, "npar" => 1); |
14 |
$arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["npar"]); |
15 |
$art = array_shift($arts); |
16 |
$ed = ""; |
17 |
if ($top_edit && ($art["id"] == $ed_id || $ed_id <= 0)) { |
18 |
include_once("inc/newsEdit.php"); |
19 |
$ed = newsEdit(($ed_id > 0) ? $art : $empty, "top_edit"); |
20 |
} |
21 |
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
22 |
else { |
23 |
if ($ed) $art = $ed; |
24 |
$tpl->assign("top_id", $art["id"]); |
25 |
$tpl->assign("top_title", MyEscape($art["title"])); |
26 |
$tpl->assign("top_lead", MyEscape($art["lead"])); |
27 |
$tpl->assign("top_titlepic_url", MyEscape($art["pic_url"])); |
28 |
$tpl->assign("top_titlepic_alt", MyEscape($art["pic_alt"])); |
29 |
$tpl->assign("top_titlepic_type", $art["pic_pos"]); |
30 |
$tpl->assign("top_titlepic_width", $art["pic_w"]); |
31 |
$tpl->assign("top_titlepic_height", $art["pic_h"]); |
32 |
for ($j = 0; $j < count($art["text"]); $j++) |
33 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
34 |
$tpl->assign("top_text", $art["text"]); |
35 |
include_once("inc/links.php"); |
36 |
$tpl->assign("top_links", GetLinks($art["read"] && $art["id"], |
37 |
MyEscape($art["more"]), $art["id"], $empty["category"], "top")); |
38 |
} |
39 |
$tpl->assign("top_edit", $top_edit); |
40 |
} |
41 |
$dbh->disconnect(); |
42 |
?> |