38 |
return array($w, $h); |
return array($w, $h); |
39 |
} |
} |
40 |
|
|
41 |
function GetLinks($read, $more, $more_title, $id, $cat, $name, $edit, $updown = false, $up = false, $down = false) { |
function GetLinks($read, $more, $more_title, $id, $cat, $name, $updown = false, $up = false, $down = false, $prikazi = true) { |
42 |
$t = new Smarty(); |
$t = new Smarty(); |
43 |
global $section, $section_menu, $section_menu2, $spec, $isMed, $offset; |
global $section, $section_menu, $section_menu2, $spec, $isMed, $isEdit, $offset; |
44 |
$t->assign("section", $section); |
$t->assign("section", $section); |
45 |
$t->assign("section_menu", $section_menu); |
$t->assign("section_menu", $section_menu); |
46 |
$t->assign("section_menu2", $section_menu2); |
$t->assign("section_menu2", $section_menu2); |
59 |
$t->assign("more", /* $more */ strstr($more, "?") ? $more : ""); |
$t->assign("more", /* $more */ strstr($more, "?") ? $more : ""); |
60 |
$t->assign("more_new", strstr($more, "://") ? true : false); |
$t->assign("more_new", strstr($more, "://") ? true : false); |
61 |
$t->assign("more_title", $more_title); |
$t->assign("more_title", $more_title); |
62 |
$t->assign("edit", $edit); |
$t->assign("edit", $isEdit); |
63 |
$t->assign("updown", $updown); |
$t->assign("updown", $updown); |
64 |
$t->assign("up", $up); |
$t->assign("up", $up); |
65 |
$t->assign("down", $down); |
$t->assign("down", $down); |
66 |
|
$t->assign("prikazi", $prikazi); |
67 |
return $t->fetch("links.tpl"); |
return $t->fetch("links.tpl"); |
68 |
} |
} |
69 |
|
|
90 |
return $tp->fetch("highlight.tpl"); |
return $tp->fetch("highlight.tpl"); |
91 |
} |
} |
92 |
|
|
93 |
|
function GetAuthor($pic = "", $alt = "", $info = "", $width = 0, $height = 0) { |
94 |
|
$t = new Smarty(); |
95 |
|
global $aupicdir; |
96 |
|
$t->assign("aupicdir", "$aupicdir/"); |
97 |
|
$t->assign("url", $pic); |
98 |
|
$t->assign("alt", $alt); |
99 |
|
$t->assign("info", nl2br($info)); |
100 |
|
$t->assign("width", $width); |
101 |
|
$t->assign("height", $hight); |
102 |
|
return $t->fetch("author.tpl"); |
103 |
|
} |
104 |
|
|
105 |
|
function GetSemafor() { |
106 |
|
global $dbh; |
107 |
|
$conn = $dbh ? true : false; |
108 |
|
if (!$conn) include("inc/conn.php"); |
109 |
|
$sql = "SELECT stanje, trave, korov, stabla, date FROM semafor ORDER BY date DESC LIMIT 1"; |
110 |
|
$sth = $dbh->prepare($sql); |
111 |
|
if (!$sth) error("Cannot prepare query: \"$sql\""); |
112 |
|
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
113 |
|
$row = $sth->fetchrow_array(); |
114 |
|
$sth->finish(); |
115 |
|
if (!$conn) $dbh->disconnect(); |
116 |
|
$t = new Smarty(); |
117 |
|
if ($row) { |
118 |
|
list($stanje, $trave, $korov, $stabla, $date) = $row; |
119 |
|
$t->assign("stabla", $stabla); |
120 |
|
$t->assign("trave", $trave); |
121 |
|
$t->assign("korov", $korov); |
122 |
|
$t->assign("msg", $stanje); |
123 |
|
$t->assign("date", $date ? strftime("%d.%m.%y.", strtotime($date)) : ""); |
124 |
|
} |
125 |
|
return $t->fetch("semafor-table.tpl"); |
126 |
|
} |
127 |
|
|
128 |
function GenerateUsername($ime, $prezime) { |
function GenerateUsername($ime, $prezime) { |
129 |
global $dbh; |
global $dbh; |
130 |
$replace_from = "¹šðè澞©ŠÐÈÆ®Ž "; |
$replace_from = "¹šðè澞©ŠÐÈÆ®Ž "; |
170 |
return $password; |
return $password; |
171 |
} |
} |
172 |
|
|
173 |
|
$isEdit = stristr($ME, "/edit/") ? true : false; |
174 |
|
$isMed = stristr($ME, "med") || stristr($ME, "pm") ? true : false; |
175 |
|
|
176 |
function Auth($user = "", $pwd = "") { |
function Auth($user = "", $pwd = "") { |
177 |
global $ME,$HTTP_USER_AGENT,$REMOTE_ADDR; |
global $ME,$HTTP_USER_AGENT,$REMOTE_ADDR; |
178 |
|
global $isEdit; |
179 |
|
if ($isEdit) return 0; |
180 |
// DEBUG: |
// DEBUG: |
181 |
#if (stristr($ME, "test.plivamed.net")) return 0; |
#if (stristr($ME, "test.plivamed.net")) return 0; |
182 |
// User-Agent: should be mnoGoSearch, but in version 3.1.19 |
// User-Agent: should be mnoGoSearch, but in version 3.1.19 |
203 |
} |
} |
204 |
|
|
205 |
Header("Content-Type: text/html; charset=ISO-8859-2"); |
Header("Content-Type: text/html; charset=ISO-8859-2"); |
206 |
$isEdit = stristr($ME, "/edit/") ? true : false; |
/* |
|
$isMed = stristr($ME, "med") || stristr($ME, "pm") ? true : false; |
|
207 |
if ($isEdit) { |
if ($isEdit) { |
208 |
if ($PHP_AUTH_USER != "editor" && $PHP_AUTH_PW != "jokkvpr") { |
if ($PHP_AUTH_USER != "editor" && $PHP_AUTH_PW != "jokkvpr") { |
209 |
Header("WWW-Authenticate: Basic realm=\"PLIVA".($isMed?"med.net":"zdravlje.hr")."\""); |
Header("WWW-Authenticate: Basic realm=\"PLIVA".($isMed?"med.net":"zdravlje.hr")."\""); |
212 |
exit; |
exit; |
213 |
} |
} |
214 |
} |
} |
215 |
|
*/ |
216 |
$isReg = $isMed ? false : true; |
$isReg = $isMed ? false : true; |
217 |
if (!$isReg) $isReg = (Auth() == 0) ? true : false; |
if (!$isReg) $isReg = (Auth() == 0) ? true : false; |
218 |
?> |
?> |