/[hr-web]/inc/global.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/global.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Tue May 1 16:43:23 2001 UTC (23 years ago) by dpavlin
Branch: MAIN
Changes since 1.3: +15 -33 lines
zadnje promjene

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

  ViewVC Help
Powered by ViewVC 1.1.26