/[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

Annotation of /inc/global.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Sat Apr 21 08:37:49 2001 UTC (23 years, 1 month ago) by dpavlin
Branch: MAIN
Changes since 1.1: +1 -0 lines
support for non-quoted <br>

1 dpavlin 1.1 <?php
2     include("inc/stuff.php");
3     $pages = array(
4     0 => "main.php",
5     1 => "OpciPodaci.php",
6     2 => "UPlivi.php",
7     3 => "IzvanPlive.php",
8     4 => "Dodiplomski.php",
9     5 => "Poslijediplomski.php",
10     6 => "Obrazovanje.php",
11     7 => "TecajeviManagementa.php",
12     8 => "OstaliTecajevi.php",
13     9 => "StraniJezici.php",
14     10 => "RadSRacunalom.php",
15     11 => "Nagrade.php",
16     12 => "Radovi.php",
17     13 => "StrucniSkupovi.php",
18     14 => "OMeni.php",
19     15 => "Overview.php",
20     100 => "NovaAplikacija.php",
21     200 => "NovaUstanova.php",
22     300 => "NoviTecaj.php"
23     );
24     function isparam($param) {
25     eval('global $'.$param.', $'.$param.'_x, $'.$param.'_y;');
26     if (eval('return isset($'.$param.') || isset($'.$param.'_x) || isset($'.$param.'_y);')) {
27     #eval('unset($'.$param.'); unset($'.$param.'_x); unset($'.$param.'_y);');
28     return true;
29     }
30     return false;
31     }
32     function CalcPage($script) {
33     global $pages;
34     $script = basename($script);
35     $pg = 0;
36     reset($pages);
37     while (list($var, $val) = each($pages))
38     if ($val == $script) $pg = $var;
39     return $pg;
40     }
41     function HTML_escape($str) {
42     $oldstr = $str; # KLUDGY!!!
43 dpavlin 1.2 $str = eregi_replace("<BR>", "\n", $str); # KLUDGY!!!
44 dpavlin 1.1 $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 ParseDate($str) {
64     if (!$str) return $str;
65     $tmp = split("[\.\-]", $str);
66     $fnd = false;
67     for ($i = 0; $i < count($tmp); $i++)
68     if ($tmp[$i] + 0) $fnd = true;
69     if (!$fnd) return $str;
70     return getdate(strtotime($str));
71     }
72     function ComposeDate($d, $m, $y) {
73     return sprintf("%04d-%02d-%02d", $y, $m, $d);
74     }
75     function Compose() {
76     global $sifra, $language;
77     return implode("|", array($sifra, $language));
78     }
79     function Decompose($str) {
80     global $sifra, $language;
81     list($sifra, $language) = explode("|", $str);
82     }
83     function Params($pg = -1, $more = array()) {
84     global $page;
85     if ($pg >= 0) $page = $pg;
86     $tmp = Compose();
87     if (is_array($more)) {
88     while (list($key, $val) = each($more)) {
89     if ($tmp) $tmp = $tmp."&";
90     $tmp = $tmp."$key=$val";
91     }
92     }
93     if (isset($tmp) && $tmp) $tmp = "?ID=".$tmp;
94     return $tmp;
95     }
96     function nepoznato(&$sto) {
97     global $language;
98     if (isset($sto) && $sto == "") {
99     if ($language == "HR") $sto = "[nepoznato]";
100     if ($language == "EN") $sto = "[unknown]";
101     $sto = "<I>$sto</I>";
102     }
103     }
104     function Auth() {
105     global $sifra;
106     if (!$sifra) {
107     Header("Location: index.php");
108     return false;
109     }
110     return true;
111     }
112     Header("Pragma: no-cache");
113     if (!isset($language) || !$language) $language = "HR";
114     if (!isset($page) || !$page) $page = 0;
115     if (!isset($sifra) || !$sifra) $sifra = "";
116     if (isset($ID)) Decompose($ID);
117     ?>

  ViewVC Help
Powered by ViewVC 1.1.26