1 |
<?php |
<?php |
2 |
include("inc/stuff.php"); |
include("inc/stuff.php"); |
3 |
|
mt_srand(time()); |
4 |
|
$PG_HOME = 0; |
5 |
|
$PG_OVERVIEW = 16; |
6 |
$pages = array( |
$pages = array( |
7 |
0 => "main.php", |
$PG_HOME => "main.php", |
8 |
1 => "OpciPodaci.php", |
1 => "OpciPodaci.php", |
9 |
2 => "UPlivi.php", |
2 => "UPlivi.php", |
10 |
3 => "IzvanPlive.php", |
3 => "IzvanPlive.php", |
16 |
9 => "StraniJezici.php", |
9 => "StraniJezici.php", |
17 |
10 => "RadSRacunalom.php", |
10 => "RadSRacunalom.php", |
18 |
11 => "Nagrade.php", |
11 => "Nagrade.php", |
19 |
12 => "Radovi.php", |
12 => "Patenti.php", |
20 |
13 => "StrucniSkupovi.php", |
13 => "Radovi.php", |
21 |
14 => "OMeni.php", |
14 => "StrucniSkupovi.php", |
22 |
15 => "Overview.php", |
15 => "OMeni.php", |
23 |
|
$PG_OVERVIEW => "Overview.php", |
24 |
100 => "NovaAplikacija.php", |
100 => "NovaAplikacija.php", |
25 |
200 => "NovaUstanova.php", |
200 => "NovaUstanova.php", |
26 |
300 => "NoviTecaj.php" |
300 => "NoviTecaj.php" |
28 |
function isparam($param) { |
function isparam($param) { |
29 |
eval('global $'.$param.', $'.$param.'_x, $'.$param.'_y;'); |
eval('global $'.$param.', $'.$param.'_x, $'.$param.'_y;'); |
30 |
if (eval('return isset($'.$param.') || isset($'.$param.'_x) || isset($'.$param.'_y);')) { |
if (eval('return isset($'.$param.') || isset($'.$param.'_x) || isset($'.$param.'_y);')) { |
31 |
#eval('unset($'.$param.'); unset($'.$param.'_x); unset($'.$param.'_y);'); |
# eval('unset($'.$param.'); unset($'.$param.'_x); unset($'.$param.'_y);'); |
32 |
return true; |
return true; |
33 |
} |
} |
34 |
return false; |
return false; |
42 |
if ($val == $script) $pg = $var; |
if ($val == $script) $pg = $var; |
43 |
return $pg; |
return $pg; |
44 |
} |
} |
45 |
function HTML_escape($str) { |
function HTML_Escape($str) { |
46 |
$oldstr = $str; # KLUDGY!!! |
$oldstr = $str; # KLUDGY!!! |
47 |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
48 |
$foo = ($str != $oldstr); # KLUDGY!!! |
$foo = ($str != $oldstr); # KLUDGY!!! |
63 |
global $CRO_ISO, $CRO_Win; |
global $CRO_ISO, $CRO_Win; |
64 |
return strtr($str, $CRO_Win, $CRO_ISO); |
return strtr($str, $CRO_Win, $CRO_ISO); |
65 |
} |
} |
66 |
function ParseDate($str) { |
function YearFix(&$y) { |
67 |
|
if (isset($y) && ereg("^[0-9]+$", $y) && $y < 1900) |
68 |
|
if ($y <= 40) $y += 2000; else $y += 1900; |
69 |
|
} |
70 |
|
function &DateCheck($str) { |
71 |
|
if (!$str) return 0; |
72 |
|
$tmp = split("\s*[/.-]\s*", $str); |
73 |
|
YearFix($tmp[2]); |
74 |
|
# PHP ima problema sa godinama prije 1902... |
75 |
|
if ($tmp[2] < 1902) return 0; |
76 |
|
if (!checkdate($tmp[1], $tmp[0], $tmp[2])) return 0; |
77 |
|
$tmp = sprintf("%04d-%02d-%02d", $tmp[2], $tmp[1], $tmp[0]); |
78 |
|
$tmp = getdate(strtotime($tmp)); |
79 |
|
return array($tmp["mday"], $tmp["mon"], $tmp["year"]); |
80 |
|
} |
81 |
|
function &ParseDate($str) { |
82 |
if (!$str) return $str; |
if (!$str) return $str; |
83 |
|
$str = str_replace("/", "-", $str); |
84 |
$tmp = split("[\.\-]", $str); |
$tmp = split("[\.\-]", $str); |
85 |
$fnd = false; |
$fnd = false; |
86 |
for ($i = 0; $i < count($tmp); $i++) |
for ($i = 0; $i < count($tmp); $i++) |
88 |
if (!$fnd) return $str; |
if (!$fnd) return $str; |
89 |
return getdate(strtotime($str)); |
return getdate(strtotime($str)); |
90 |
} |
} |
91 |
function ComposeDate($d, $m, $y) { |
function ComposeDate($dt) { |
92 |
|
list($d, $m, $y) = $dt; |
93 |
return sprintf("%04d-%02d-%02d", $y, $m, $d); |
return sprintf("%04d-%02d-%02d", $y, $m, $d); |
94 |
} |
} |
95 |
|
$_composed = ""; |
96 |
function Compose() { |
function Compose() { |
97 |
global $sifra, $language; |
global $_composed; |
98 |
return implode("|", array($sifra, $language)); |
if (!$_composed) { |
99 |
|
global $sifra, $language, $REMOTE_ADDR; |
100 |
|
$crc = md5($sifra."@".$REMOTE_ADDR); |
101 |
|
$_composed = implode("|", array($sifra, |
102 |
|
$language[1].$crc.$language[0])); |
103 |
|
} |
104 |
|
return $_composed; |
105 |
} |
} |
106 |
function Decompose($str) { |
function Decompose($str) { |
107 |
global $sifra, $language; |
global $sifra, $language, $REMOTE_ADDR; |
108 |
list($sifra, $language) = explode("|", $str); |
list($sifra, $crc) = explode("|", $str); |
109 |
|
$language = $crc[strlen($crc) - 1].$crc[0]; |
110 |
|
if (md5($sifra."@".$REMOTE_ADDR) != substr($crc, 1, -1)) |
111 |
|
$sifra = ""; |
112 |
} |
} |
113 |
function Params($pg = -1, $more = array()) { |
function Params($pg = -1, $more = array()) { |
114 |
global $page; |
global $page; |
115 |
if ($pg >= 0) $page = $pg; |
if ($pg >= 0) $page = $pg; |
116 |
$tmp = Compose(); |
$tmp = Compose(); |
117 |
if (is_array($more)) { |
if (is_array($more)) { |
118 |
while (list($key, $val) = each($more)) { |
$foo = array(); |
119 |
if ($tmp) $tmp = $tmp."&"; |
while (list($key, $val) = each($more)) |
120 |
$tmp = $tmp."$key=$val"; |
array_push($foo, "$key=$val"); |
121 |
} |
$foo = implode("&", $foo); |
122 |
|
if ($foo) $tmp .= "&$foo"; |
123 |
} |
} |
124 |
if (isset($tmp) && $tmp) $tmp = "?ID=".$tmp; |
if (isset($tmp) && $tmp) $tmp = "?ID=".$tmp; |
125 |
return $tmp; |
return $tmp; |
127 |
function nepoznato(&$sto) { |
function nepoznato(&$sto) { |
128 |
global $language; |
global $language; |
129 |
if (isset($sto) && $sto == "") { |
if (isset($sto) && $sto == "") { |
130 |
if ($language == "HR") $sto = "[nepoznato]"; |
switch ($language) { |
131 |
if ($language == "EN") $sto = "[unknown]"; |
case "HR": $sto = "[nepoznato]"; break; |
132 |
|
case "EN": $sto = "[unknown]"; break; |
133 |
|
} |
134 |
$sto = "<I>$sto</I>"; |
$sto = "<I>$sto</I>"; |
135 |
} |
} |
136 |
} |
} |
137 |
function Auth() { |
function Auth() { |
138 |
global $sifra; |
global $sifra, $PHP_SELF; |
139 |
if (!$sifra) { |
if ($sifra) return true; |
140 |
Header("Location: index.php"); |
Header("Location: index.php?x="); |
141 |
return false; |
return false; |
|
} |
|
|
return true; |
|
142 |
} |
} |
143 |
Header("Pragma: no-cache"); |
Header("Pragma: no-cache"); |
144 |
|
if ($ID) Decompose($ID); |
145 |
if (!isset($language) || !$language) $language = "HR"; |
if (!isset($language) || !$language) $language = "HR"; |
|
if (!isset($page) || !$page) $page = 0; |
|
146 |
if (!isset($sifra) || !$sifra) $sifra = ""; |
if (!isset($sifra) || !$sifra) $sifra = ""; |
147 |
if (isset($ID)) Decompose($ID); |
include_once("inc/MySmarty.php"); |
148 |
?> |
?> |