/[health_html]/inc/pgLifestyle.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /inc/pgLifestyle.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations)
Thu Oct 4 14:59:35 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.9: +8 -13 lines
Added the archive. Some more bug fixes.

1 <?php
2 include("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 ($isEdit) {
9 if ($del_id) {
10 include_once("inc/newsDelete.php");
11 newsDelete($del_id);
12 unset($top_edit);
13 }
14 if ($down_id) $dbh->dbh_do("UPDATE news SET ord = ord + 1 WHERE (news_id = $down_id)");
15 if ($up_id) $dbh->dbh_do("UPDATE news SET ord = ord - 1 WHERE (news_id = $up_id)");
16 }
17 $cat = "l"; $acat = "l";
18 if ($section_menu == "sex") {
19 $cat = "x"; $acat2 = "x";
20 if ($section_menu2 == "rjecnik") $cat = "j";
21 }
22 if ($section_menu == "zdrava") {
23 $cat = "h"; $acat2 = "z";
24 if ($section_menu2 == "tema") $cat = "a";
25 if ($section_menu2 == "nutri") $cat = "n";
26 if ($section_menu2 == "kuhanje") $cat = "v";
27 }
28 if ($section_menu == "fitness") {
29 $cat = "f"; $acat2 = "f";
30 if ($section_menu2 == "tema") $cat = "1";
31 if ($section_menu2 == "trening") $cat = "g";
32 if ($section_menu2 == "istezanje") $cat = "s";
33 if ($section_menu2 == "ozljede") $cat = "2";
34 # if ($section_menu2 == "trener") $cat = "b";
35 if ($section_menu2 == "vjezbe") $cat = "u";
36 }
37 if ($cat == "x") {
38 $empty = array("category" => "y", "limit" => 1, "offset" => 0, "npar" => 0);
39 include_once("inc/newsShow.php");
40 $art = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]);
41 $art = array_shift($art);
42 $ed = "";
43 if ($kol_edit && ($art["id"] == $ed_id || $ed_id <= 0) && $isEdit) {
44 include_once("inc/newsEdit.php");
45 $ed = newsEdit(($ed_id > 0) ? $art : $empty, "kol_edit");
46 }
47 if ($ed && is_string($ed)) $tpl->assign("KOL_EDIT", $ed);
48 else {
49 if ($ed && $ed["category"] == "y") $art = $ed;
50 $tpl->assign("kol_id", $art["id"]);
51 $tpl->assign("kol_title", MyEscape($art["title"]));
52 $tpl->assign("kol_lead", MyEscape($art["lead"]));
53 $tpl->assign("kol_pgfs", (count($art["text"]) > 0) ? true : false);
54 $tpl->assign("kol_titlepic_url", MyEscape($art["pic_url"]));
55 $tpl->assign("kol_titlepic_alt", MyEscape($art["pic_alt"]));
56 $tpl->assign("kol_titlepic_type", $art["pic_pos"]);
57 $tpl->assign("kol_titlepic_width", $art["pic_w"]);
58 $tpl->assign("kol_titlepic_height", $art["pic_h"]);
59 for ($j = 0; $j < count($art["text"]); $j++)
60 $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true);
61 $tpl->assign("kol_text", $art["text"]);
62 include_once("inc/author.php");
63 $tpl->assign("AUTHOR", GetAuthor($art["au_pic"],
64 $art["au_alt"], $art["au_info"],
65 $art["au_w"], $art["au_h"]));
66 $tpl->assign("kol_links", GetLinks($art["read"] && $art["id"],
67 /* MyEscape($art["more"]) */ (count($art["text"]) > 0 && $art["id"]) ? $art["more"] : "",
68 MyEscape($art["more_title"]), $art["id"], $empty["category"],
69 "kol", $isEdit, false, false, false));
70 $tpl->assign("kol_read", $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : "");
71 }
72 }
73 if (!$offset) $offset = 0;
74 $empty = array("category" => $cat, "limit" => 11, "offset" => $offset, "npar" => 0);
75 if ($top_edit && $ed_id <= 0 && $isEdit) {
76 include_once("inc/newsEdit.php");
77 $ed = newsEdit($empty, "top_edit");
78 if ($ed && is_string($ed)) $tpl->assign("EDIT", $ed);
79 else $top_edit = false;
80 }
81 $arts = newsLoad(-1, $empty["category"], $empty["limit"], $empty["offset"], $empty["npar"]);
82 $a2 = array();
83 $lm = count($arts);
84 if ($lm > $empty["limit"]) $lm = $empty["limit"];
85 for ($i = 0; $i < $lm; $i++) {
86 $art = $arts[$i];
87 $ed = "";
88 if ($top_edit && ($art["id"] == $ed_id) && $isEdit) {
89 include_once("inc/newsEdit.php");
90 $ed = newsEdit($art, "top_edit");
91 }
92 if ($ed && is_string($ed)) array_push($a2, array("EDIT" => $ed));
93 else {
94 if ($ed && $ed["category"] == $cat) $art = $ed;
95 for ($j = 0; $j < count($art["text"]); $j++)
96 $art["text"][$j]["text"] = ParseNewline(MyEscape($art["text"][$j]["text"]), true);
97 array_push($a2, array(
98 "id" => $art["id"],
99 "title" => MyEscape($art["title"]),
100 "lead" => MyEscape($art["lead"]),
101 "pgfs" => (count($art["text"]) > 0) ? true : false,
102 "titlepic_url" => MyEscape($art["pic_url"]),
103 "titlepic_alt" => MyEscape($art["pic_alt"]),
104 "titlepic_type" => $art["pic_pos"],
105 "titlepic_width" => $art["pic_w"],
106 "titlepic_height" => $art["pic_h"],
107 "text" => $art["text"],
108 "links" => GetLinks($art["read"] && $art["id"],
109 /* MyEscape($art["more"]) */ ((count($art["text"]) > 0 || strstr("?", $art["more"]) == 0) && $art["id"]) ? $art["more"] : "",
110 MyEscape($art["more_title"]), $art["id"], $empty["category"], "top",
111 $isEdit, true, ($i > 0), ($i < count($arts) - 1)),
112 "read" => $art["read"] || ($art["more"] && !strstr($art["more"], "?")) ? $art["read"] : ""
113 ));
114 }
115 }
116 $tpl->assign("top", $a2);
117 $tpl->assign("cat", $cat);
118 $tpl->assign("next", (count($arts) > 10) ? ($offset + 10) : 0);
119 $tpl->assign("prev", $offset ? ($offset - 10) : 0);
120 $tpl->assign("offset", $offset);
121 }
122 $dbh->disconnect();
123 ?>

  ViewVC Help
Powered by ViewVC 1.1.26