1 |
<?php |
2 |
include("inc/stuff.php"); |
3 |
mt_srand(time()); |
4 |
$PG_HOME = 0; |
5 |
$PG_OVERVIEW = 16; |
6 |
$pages = array( |
7 |
$PG_HOME => "main.php", |
8 |
1 => "OpciPodaci.php", |
9 |
2 => "UPlivi.php", |
10 |
3 => "IzvanPlive.php", |
11 |
4 => "Dodiplomski.php", |
12 |
5 => "Poslijediplomski.php", |
13 |
6 => "Obrazovanje.php", |
14 |
7 => "TecajeviManagementa.php", |
15 |
8 => "OstaliTecajevi.php", |
16 |
9 => "StraniJezici.php", |
17 |
10 => "RadSRacunalom.php", |
18 |
11 => "Nagrade.php", |
19 |
12 => "Patenti.php", |
20 |
13 => "Radovi.php", |
21 |
14 => "StrucniSkupovi.php", |
22 |
15 => "OMeni.php", |
23 |
$PG_OVERVIEW => "Overview.php", |
24 |
100 => "NovaAplikacija.php", |
25 |
200 => "NovaUstanova.php", |
26 |
300 => "NoviTecaj.php" |
27 |
); |
28 |
function isparam($param) { |
29 |
eval('global $'.$param.', $'.$param.'_x, $'.$param.'_y;'); |
30 |
if (eval('return isset($'.$param.') || isset($'.$param.'_x) || isset($'.$param.'_y);')) { |
31 |
# eval('unset($'.$param.'); unset($'.$param.'_x); unset($'.$param.'_y);'); |
32 |
return true; |
33 |
} |
34 |
return false; |
35 |
} |
36 |
function CalcPage($script) { |
37 |
global $pages; |
38 |
$script = basename($script); |
39 |
$pg = 0; |
40 |
reset($pages); |
41 |
while (list($var, $val) = each($pages)) |
42 |
if ($val == $script) $pg = $var; |
43 |
return $pg; |
44 |
} |
45 |
function HTML_Escape($str) { |
46 |
$oldstr = $str; # KLUDGY!!! |
47 |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
48 |
$foo = ($str != $oldstr); # KLUDGY!!! |
49 |
$str = str_replace("&", "&", $str); |
50 |
$str = str_replace("<", "<", $str); |
51 |
$str = str_replace(">", ">", $str); |
52 |
$str = str_replace("\"", """, $str); |
53 |
if ($foo) $str = ereg_replace("\n", "<BR>", $str); # KLUDGY!!! |
54 |
return $str; |
55 |
} |
56 |
$CRO_Win = "ÈÆÐèæð"; |
57 |
$CRO_ISO = "ÈƩЮèæ¹ð¾"; |
58 |
function ISO_Win($str) { |
59 |
global $CRO_ISO, $CRO_Win; |
60 |
return strtr($str, $CRO_ISO, $CRO_Win); |
61 |
} |
62 |
function Win_ISO($str) { |
63 |
global $CRO_ISO, $CRO_Win; |
64 |
return strtr($str, $CRO_Win, $CRO_ISO); |
65 |
} |
66 |
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; |
83 |
$str = str_replace("/", "-", $str); |
84 |
$tmp = split("[\.\-]", $str); |
85 |
$fnd = false; |
86 |
for ($i = 0; $i < count($tmp); $i++) |
87 |
if ($tmp[$i] + 0) $fnd = true; |
88 |
if (!$fnd) return $str; |
89 |
return getdate(strtotime($str)); |
90 |
} |
91 |
function ComposeDate($dt) { |
92 |
list($d, $m, $y) = $dt; |
93 |
return sprintf("%04d-%02d-%02d", $y, $m, $d); |
94 |
} |
95 |
$_composed = ""; |
96 |
function Compose() { |
97 |
global $_composed; |
98 |
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) { |
107 |
global $sifra, $language, $REMOTE_ADDR; |
108 |
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()) { |
114 |
global $page; |
115 |
if ($pg >= 0) $page = $pg; |
116 |
$tmp = Compose(); |
117 |
if (is_array($more)) { |
118 |
$foo = array(); |
119 |
while (list($key, $val) = each($more)) |
120 |
array_push($foo, "$key=$val"); |
121 |
$foo = implode("&", $foo); |
122 |
if ($foo) $tmp .= "&$foo"; |
123 |
} |
124 |
if (isset($tmp) && $tmp) $tmp = "?ID=".$tmp; |
125 |
return $tmp; |
126 |
} |
127 |
function nepoznato(&$sto) { |
128 |
global $language; |
129 |
if ($sto) return; |
130 |
$sto = "-"; |
131 |
/* STARO!!! |
132 |
switch ($language) { |
133 |
case "HR": $sto = "[nepoznato]"; break; |
134 |
case "EN": $sto = "[unknown]"; break; |
135 |
} |
136 |
$sto = "<I>$sto</I>"; |
137 |
*/ |
138 |
} |
139 |
function Auth() { |
140 |
global $sifra, $PHP_SELF; |
141 |
if ($sifra) return true; |
142 |
Header("Location: index.php?x="); |
143 |
return false; |
144 |
} |
145 |
Header("Pragma: no-cache"); |
146 |
if ($ID) Decompose($ID); |
147 |
if (!isset($language) || !$language) $language = "HR"; |
148 |
if (!isset($sifra) || !$sifra) $sifra = ""; |
149 |
include_once("inc/MySmarty.php"); |
150 |
?> |