1 |
<?php |
<?php |
2 |
include_once("inc/conn.php"); |
include("inc/conn.php"); |
3 |
include_once("inc/newsShow.php"); |
include_once("inc/newsShow.php"); |
4 |
if ($show) { |
if ($show) { |
5 |
|
$section_menu = "main"; |
6 |
$arts = newsLoad($id, $cat); |
$arts = newsLoad($id, $cat); |
7 |
newsShow(array_shift($arts)); |
newsShow(array_shift($arts)); |
8 |
} else { |
} else { |
9 |
if ($del_id) { |
if ($isEdit) { |
10 |
include_once("inc/newsDelete.php"); |
if ($del_id) { |
11 |
newsDelete($del_id); |
include_once("inc/newsDelete.php"); |
12 |
unset($top_edit, $wn_edit, $pn_edit); |
newsDelete($del_id); |
13 |
} |
unset($top_edit, $wn_edit, $pn_edit); |
14 |
# ---KLUDGE-BEGIN--- |
} |
15 |
$cat = ""; |
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
16 |
if ($section == "conditions") $cat = "c"; |
if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); |
17 |
if ($section == "lifestyle") $cat = "l"; |
} |
18 |
# ---KLUDGE-END--- |
$cat = "l"; |
19 |
if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)"); |
if ($section_menu == "sex") { |
20 |
if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)"); |
$cat = "x"; |
21 |
|
if ($section_menu2 == "qa") $cat = "q"; |
22 |
|
if ($section_menu2 == "rjecnik") $cat = "j"; |
23 |
|
} |
24 |
|
if ($section_menu == "zdrava") { |
25 |
|
$cat = "h"; |
26 |
|
if ($section_menu2 == "nutri") $cat = "n"; |
27 |
|
if ($section_menu2 == "qa") $cat = "a"; |
28 |
|
if ($section_menu2 == "kuhanje") $cat = "v"; |
29 |
|
if ($section_menu2 == "dtd") $cat = "y"; |
30 |
|
if ($section_menu2 == "vrijednosti") $cat = "i"; |
31 |
|
} |
32 |
|
if ($section_menu == "fitness") { |
33 |
|
$cat = "f"; |
34 |
|
if ($section_menu2 == "qa") $cat = "1"; |
35 |
|
if ($section_menu2 == "trening") $cat = "g"; |
36 |
|
if ($section_menu2 == "istezanje") $cat = "s"; |
37 |
|
if ($section_menu2 == "ozljede") $cat = "2"; |
38 |
|
if ($section_menu2 == "trener") $cat = "b"; |
39 |
|
if ($section_menu2 == "vjezbe") $cat = "u"; |
40 |
|
if ($section_menu2 == "fitcenter") $cat = "k"; |
41 |
|
} |
42 |
if (!$offset) $offset = 0; |
if (!$offset) $offset = 0; |
43 |
$empty = array("category" => $cat, "limit" => 11, "offset" => $offset, "npar" => 1); |
$empty = array("category" => $cat, "limit" => 11, "offset" => $offset, "npar" => 0); |
44 |
if ($top_edit && $ed_id <= 0) { |
if ($top_edit && $ed_id <= 0 && $isEdit) { |
45 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
46 |
$ed = newsEdit($empty, "top_edit"); |
$ed = newsEdit($empty, "top_edit"); |
47 |
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed); |
54 |
for ($i = 0; $i < $lm; $i++) { |
for ($i = 0; $i < $lm; $i++) { |
55 |
$art = $arts[$i]; |
$art = $arts[$i]; |
56 |
$ed = ""; |
$ed = ""; |
57 |
if ($top_edit && ($art["id"] == $ed_id)) { |
if ($top_edit && ($art["id"] == $ed_id) && $isEdit) { |
58 |
include_once("inc/newsEdit.php"); |
include_once("inc/newsEdit.php"); |
59 |
$ed = newsEdit($art, "top_edit"); |
$ed = newsEdit($art, "top_edit"); |
60 |
} |
} |
62 |
else { |
else { |
63 |
if ($ed && $ed["category"] == $cat) $art = $ed; |
if ($ed && $ed["category"] == $cat) $art = $ed; |
64 |
for ($j = 0; $j < count($art["text"]); $j++) |
for ($j = 0; $j < count($art["text"]); $j++) |
65 |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"])); |
$art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true); |
|
include_once("inc/links.php"); |
|
66 |
array_push($a2, array( |
array_push($a2, array( |
67 |
"id" => $art["id"], |
"id" => $art["id"], |
68 |
"title" => MyEscape($art["title"]), |
"title" => MyEscape($art["title"]), |
74 |
"titlepic_height" => $art["pic_h"], |
"titlepic_height" => $art["pic_h"], |
75 |
"text" => $art["text"], |
"text" => $art["text"], |
76 |
"links" => GetLinks($art["read"] && $art["id"], |
"links" => GetLinks($art["read"] && $art["id"], |
77 |
MyEscape($art["more"]), $art["id"], |
/* MyEscape($art["more"]) */ (count($art["text"]) > 0 && $art["id"]) ? $art["more"] : "", |
78 |
$empty["category"], "top", $isEdit, true, |
MyEscape($art["more_title"]), $art["id"], $empty["category"], "top", |
79 |
($i > 0), ($i < count($arts) - 1)) |
$isEdit, true, ($i > 0), ($i < count($arts) - 1)) |
80 |
)); |
)); |
81 |
} |
} |
82 |
} |
} |
83 |
$tpl->assign("top", $a2); |
$tpl->assign("top", $a2); |
84 |
$tpl->assign("cat", $cat); |
$tpl->assign("cat", $cat); |
|
$tpl->assign("isedit", $isEdit); |
|
|
$tpl->assign("ismed", $isMed); |
|
85 |
$tpl->assign("next", (count($arts) > 10) ? ($offset + 10) : 0); |
$tpl->assign("next", (count($arts) > 10) ? ($offset + 10) : 0); |
86 |
$tpl->assign("prev", ($offset > 0) ? ($offset - 10) : false); |
$tpl->assign("prev", ($offset > 0) ? ($offset - 10) : false); |
87 |
} |
} |