1 |
<?php |
<?php |
2 |
include("inc/stuff.php"); |
include("inc/stuff.php"); |
3 |
|
mt_srand(time()); |
4 |
$pages = array( |
$pages = array( |
5 |
0 => "main.php", |
0 => "main.php", |
6 |
1 => "OpciPodaci.php", |
1 => "OpciPodaci.php", |
25 |
function isparam($param) { |
function isparam($param) { |
26 |
eval('global $'.$param.', $'.$param.'_x, $'.$param.'_y;'); |
eval('global $'.$param.', $'.$param.'_x, $'.$param.'_y;'); |
27 |
if (eval('return isset($'.$param.') || isset($'.$param.'_x) || isset($'.$param.'_y);')) { |
if (eval('return isset($'.$param.') || isset($'.$param.'_x) || isset($'.$param.'_y);')) { |
28 |
#eval('unset($'.$param.'); unset($'.$param.'_x); unset($'.$param.'_y);'); |
# eval('unset($'.$param.'); unset($'.$param.'_x); unset($'.$param.'_y);'); |
29 |
return true; |
return true; |
30 |
} |
} |
31 |
return false; |
return false; |
41 |
} |
} |
42 |
function HTML_escape($str) { |
function HTML_escape($str) { |
43 |
$oldstr = $str; # KLUDGY!!! |
$oldstr = $str; # KLUDGY!!! |
|
$str = eregi_replace("<BR>", "\n", $str); # KLUDGY!!! |
|
44 |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
$str = eregi_replace("\<BR\>", "\n", $str); # KLUDGY!!! |
45 |
$foo = ($str != $oldstr); # KLUDGY!!! |
$foo = ($str != $oldstr); # KLUDGY!!! |
46 |
$str = str_replace("&", "&", $str); |
$str = str_replace("&", "&", $str); |
60 |
global $CRO_ISO, $CRO_Win; |
global $CRO_ISO, $CRO_Win; |
61 |
return strtr($str, $CRO_Win, $CRO_ISO); |
return strtr($str, $CRO_Win, $CRO_ISO); |
62 |
} |
} |
63 |
function ParseDate($str) { |
function YearFix(&$y) { |
64 |
|
if (isset($y) && ereg("^[0-9]+$", $y) && $y < 1900) |
65 |
|
if ($y <= 40) $y += 2000; else $y += 1900; |
66 |
|
} |
67 |
|
function &DateCheck($str) { |
68 |
|
if (!$str) return 0; |
69 |
|
$tmp = split("\s*[/.-]\s*", $str); |
70 |
|
YearFix($tmp[2]); |
71 |
|
# PHP ima problema sa godinama prije 1902... |
72 |
|
if ($tmp[2] < 1902) return 0; |
73 |
|
if (!checkdate($tmp[1], $tmp[0], $tmp[2])) return 0; |
74 |
|
$tmp = sprintf("%04d-%02d-%02d", $tmp[2], $tmp[1], $tmp[0]); |
75 |
|
$tmp = getdate(strtotime($tmp)); |
76 |
|
return array($tmp["mday"], $tmp["mon"], $tmp["year"]); |
77 |
|
} |
78 |
|
function &ParseDate($str) { |
79 |
if (!$str) return $str; |
if (!$str) return $str; |
80 |
|
$str = str_replace("/", "-", $str); |
81 |
$tmp = split("[\.\-]", $str); |
$tmp = split("[\.\-]", $str); |
82 |
$fnd = false; |
$fnd = false; |
83 |
for ($i = 0; $i < count($tmp); $i++) |
for ($i = 0; $i < count($tmp); $i++) |
85 |
if (!$fnd) return $str; |
if (!$fnd) return $str; |
86 |
return getdate(strtotime($str)); |
return getdate(strtotime($str)); |
87 |
} |
} |
88 |
function ComposeDate($d, $m, $y) { |
function ComposeDate($dt) { |
89 |
|
list($d, $m, $y) = $dt; |
90 |
return sprintf("%04d-%02d-%02d", $y, $m, $d); |
return sprintf("%04d-%02d-%02d", $y, $m, $d); |
91 |
} |
} |
92 |
function Compose() { |
function Compose() { |
93 |
global $sifra, $language; |
global $_composed; |
94 |
return implode("|", array($sifra, $language)); |
if (!$_composed) { |
95 |
|
global $sifra, $language; |
96 |
|
$chars = preg_split("//", "ABCDEFGHIJKLMNOPQRSTUVW". |
97 |
|
"XYZabcdefghijklmnopqrstuvwxyz0123456789", |
98 |
|
0, PREG_SPLIT_NO_EMPTY); |
99 |
|
$salt = ""; |
100 |
|
for ($i = 0; $i < CRYPT_SALT_LENGTH; $i++) |
101 |
|
$salt .= $chars[mt_rand(0, count($chars) - 1)]; |
102 |
|
$enc = substr(crypt($sifra, $salt), CRYPT_SALT_LENGTH); |
103 |
|
$lang_1 = $language[0]; |
104 |
|
$lang_2 = $language[1]; |
105 |
|
$salt_1 = substr($salt, 0, CRYPT_SALT_LENGTH / 2); |
106 |
|
$salt_2 = substr($salt, CRYPT_SALT_LENGTH / 2); |
107 |
|
$_composed = implode("|", array($sifra, |
108 |
|
$enc.$lang_1.$salt_1.$lang_2.$salt_2)); |
109 |
|
$_composed = str_replace("/", "!", $_composed); |
110 |
|
} |
111 |
|
return $_composed; |
112 |
} |
} |
113 |
function Decompose($str) { |
function Decompose($str) { |
114 |
global $sifra, $language; |
global $sifra, $language; |
115 |
list($sifra, $language) = explode("|", $str); |
$str = str_replace("!", "/", $str); |
116 |
|
list($sifra, $lang) = explode("|", $str); |
117 |
|
$enc = substr($lang, 0, -(CRYPT_SALT_LENGTH + 2)); |
118 |
|
$lang = substr($lang, strlen($enc)); |
119 |
|
$lang_1 = $lang[0]; |
120 |
|
$salt_1 = substr($lang, 1, CRYPT_SALT_LENGTH / 2); |
121 |
|
$lang_2 = $lang[(CRYPT_SALT_LENGTH / 2) + 1]; |
122 |
|
$salt_2 = substr($lang, (CRYPT_SALT_LENGTH / 2) + 2); |
123 |
|
$language = $lang_1.$lang_2; |
124 |
|
$salt = $salt_1.$salt_2; |
125 |
|
$cry = substr(crypt($sifra, $salt), CRYPT_SALT_LENGTH); |
126 |
|
if ($cry != $enc) $sifra = ""; |
127 |
} |
} |
128 |
function Params($pg = -1, $more = array()) { |
function Params($pg = -1, $more = array()) { |
129 |
global $page; |
global $page; |
148 |
} |
} |
149 |
function Auth() { |
function Auth() { |
150 |
global $sifra; |
global $sifra; |
151 |
if (!$sifra) { |
if ($sifra) return true; |
152 |
Header("Location: index.php"); |
Header("Location: index.php?x="); |
153 |
return false; |
return false; |
|
} |
|
|
return true; |
|
154 |
} |
} |
155 |
Header("Pragma: no-cache"); |
Header("Pragma: no-cache"); |
156 |
if (!isset($language) || !$language) $language = "HR"; |
if (!isset($language) || !$language) $language = "HR"; |
|
if (!isset($page) || !$page) $page = 0; |
|
157 |
if (!isset($sifra) || !$sifra) $sifra = ""; |
if (!isset($sifra) || !$sifra) $sifra = ""; |
158 |
if (isset($ID)) Decompose($ID); |
if ($ID) Decompose($ID); |
159 |
|
unset($ID); |
160 |
|
include_once("inc/MySmarty.php"); |
161 |
?> |
?> |