Rev 3 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3 | Rev 10 | ||
---|---|---|---|
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | ////////////////////////////////////////////////////////////////////////////// |
3 | ////////////////////////////////////////////////////////////////////////////// |
4 | // SICHERHEITSKONSTANTE // |
4 | // SICHERHEITSKONSTANTE // |
5 | ////////////////////////////////////////////////////////////////////////////// |
5 | ////////////////////////////////////////////////////////////////////////////// |
6 | // Ohne diese werden Modulinhalte nicht ausgeführt // |
6 | // Ohne diese werden Modulinhalte nicht ausgeführt // |
7 | ////////////////////////////////////////////////////////////////////////////// |
7 | ////////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | define('WBLEGAL', '1'); |
9 | define('WBLEGAL', '1'); |
10 | 10 | ||
11 | ////////////////////////////////////////////////////////////////////////////// |
11 | ////////////////////////////////////////////////////////////////////////////// |
12 | // FUNKTIONEN // |
12 | // FUNKTIONEN // |
13 | ////////////////////////////////////////////////////////////////////////////// |
13 | ////////////////////////////////////////////////////////////////////////////// |
14 | 14 | ||
15 | require 'includes/functions.inc.php'; |
15 | require 'includes/functions.inc.php'; |
16 | 16 | ||
17 | ////////////////////////////////////////////////////////////////////////////// |
17 | ////////////////////////////////////////////////////////////////////////////// |
18 | // PRÜFUNG VON MODDIR.TXT // |
18 | // PRÜFUNG VON MODDIR.TXT // |
19 | ////////////////////////////////////////////////////////////////////////////// |
19 | ////////////////////////////////////////////////////////////////////////////// |
20 | 20 | ||
21 | if (!file_exists('modules/moddir.txt')) |
21 | if (!file_exists('modules/moddir.txt')) |
22 | { |
22 | { |
23 | die('<h1>Personal WebBase ist gesperrt</h1>Kann Datei modules/moddir.txt, die das Modulverzeichnis idendifiziert, nicht finden. Ist diese vorhanden, sind die Zugriffsberechtigungen der Dateien falsch. Empfohlen: Ordner CHMOD 755, Dateien CHMOD 644.'); |
23 | die('<h1>Personal WebBase ist gesperrt</h1>Kann Datei modules/moddir.txt, die das Modulverzeichnis idendifiziert, nicht finden. Ist diese vorhanden, sind die Zugriffsberechtigungen der Dateien falsch. Empfohlen: Ordner CHMOD 755, Dateien CHMOD 644.'); |
24 | } |
24 | } |
25 | 25 | ||
26 | ////////////////////////////////////////////////////////////////////////////// |
26 | ////////////////////////////////////////////////////////////////////////////// |
27 | // KOMPATIBILITÄT // |
27 | // KOMPATIBILITÄT // |
28 | ////////////////////////////////////////////////////////////////////////////// |
28 | ////////////////////////////////////////////////////////////////////////////// |
29 | // Hier werden Einstellunen von PHP lokal verändert oder Variablen // |
29 | // Hier werden Einstellunen von PHP lokal verändert oder Variablen // |
30 | // bearbeitet, sodass Personal WebBase möglichst unabhängig von fremden // |
30 | // bearbeitet, sodass Personal WebBase möglichst unabhängig von fremden // |
31 | // Konfigurationen wird und funktionell bleibt! // |
31 | // Konfigurationen wird und funktionell bleibt! // |
32 | ////////////////////////////////////////////////////////////////////////////// |
32 | ////////////////////////////////////////////////////////////////////////////// |
33 | 33 | ||
34 | // TODO Gleichrichter Vollrevision. Alles nochmal prüfen und erneuern |
34 | // TODO Gleichrichter Vollrevision. Alles nochmal prüfen und erneuern |
35 | 35 | ||
36 | // 1. Magic Quotes Sybase abschalten |
36 | // 1. Magic Quotes Sybase abschalten |
37 | @ini_set('magic_quotes_sybase', 'Off'); |
37 | @ini_set('magic_quotes_sybase', 'Off'); |
38 | 38 | ||
39 | // 2. Magic Quotes Runtime abschalten |
39 | // 2. Magic Quotes Runtime abschalten |
40 | set_magic_quotes_runtime(0); |
40 | if (function_exists('set_magic_quotes_runtime')) set_magic_quotes_runtime(0); |
41 | 41 | ||
42 | // 3. variables_order / gpc_order ersetzen |
42 | // 3. variables_order / gpc_order ersetzen |
43 | @ini_set('register_long_arrays', '1'); |
43 | @ini_set('register_long_arrays', '1'); |
44 | $types_to_register = array('ENV', 'GET', 'POST', 'COOKIE', 'SERVER'); // SESSION und FILES werden nicht extrahiert |
44 | $types_to_register = array('ENV', 'GET', 'POST', 'COOKIE', 'SERVER'); // SESSION und FILES werden nicht extrahiert |
45 | foreach ($types_to_register as $rtype) |
45 | foreach ($types_to_register as $rtype) |
46 | { |
46 | { |
47 | // 4. Funktion von "Register Globals" ersetzen, wenn es ausgeschaltet ist |
47 | // 4. Funktion von "Register Globals" ersetzen, wenn es ausgeschaltet ist |
- | 48 | if (!ini_get('register_globals')) { |
|
- | 49 | if (@count(${'_'.$rtype}) > 0) { |
|
- | 50 | extract(${'_'.$rtype}, EXTR_OVERWRITE); |
|
48 | if ((!ini_get('register_globals')) && (@count(${'HTTP_'.$rtype.'_VARS'}) > 0)) |
51 | } else if (@count(${'HTTP_'.$rtype.'_VARS'}) > 0) { |
49 | extract(${'HTTP_'.$rtype.'_VARS'}, EXTR_OVERWRITE); |
52 | extract(${'_'.$rtype}, EXTR_OVERWRITE); |
- | 53 | } |
|
- | 54 | } |
|
50 | 55 | ||
51 | // Workaround, wenn register_long_arrays nicht auf 1 gesetzt werden konnte |
56 | // Workaround, wenn register_long_arrays nicht auf 1 gesetzt werden konnte |
52 | if (ini_get('register_long_arrays') == '1') |
57 | if (ini_get('register_long_arrays') == '1') |
53 | $ch = 'HTTP_'.$rtype.'_VARS'; |
58 | $ch = 'HTTP_'.$rtype.'_VARS'; |
54 | else |
59 | else |
55 | $ch = '_'.$rtype; |
60 | $ch = '_'.$rtype; |
56 | 61 | ||
57 | // 5. Wenn "Magic Quotes GPC" aktiviert, dann die Aenderungen an GET/POST/COOKIE wieder rueckgaengig machen! |
62 | // 5. Wenn "Magic Quotes GPC" aktiviert, dann die Aenderungen an GET/POST/COOKIE wieder rueckgaengig machen! |
58 | // Wir haben db_escape(), um SQL-Strings vor Injektionen zu schuetzen. Wir brauchen Magic Quotes nicht! |
63 | // Wir haben db_escape(), um SQL-Strings vor Injektionen zu schuetzen. Wir brauchen Magic Quotes nicht! |
59 | if ((get_magic_quotes_gpc() == 1) && (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE'))) |
64 | if ((get_magic_quotes_gpc() == 1) && (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE'))) |
60 | { |
65 | { |
61 | foreach ($$ch AS $m1 => $m2) |
66 | foreach ($$ch AS $m1 => $m2) |
62 | { |
67 | { |
63 | $$m1 = stripslashes($$m1); |
68 | $$m1 = stripslashes($$m1); |
64 | ${'HTTP_'.$rtype.'_VARS'}[$m1] = stripslashes(${'HTTP_'.$rtype.'_VARS'}[$m1]); |
69 | ${'HTTP_'.$rtype.'_VARS'}[$m1] = stripslashes(${'HTTP_'.$rtype.'_VARS'}[$m1]); |
65 | ${'_'.$rtype}[$m1] = stripslashes(${'_'.$rtype}[$m1]); |
70 | # ${'_'.$rtype}[$m1] = stripslashes(${'_'.$rtype}[$m1]); |
66 | } |
71 | } |
67 | 72 | ||
68 | unset($m1); |
73 | unset($m1); |
69 | unset($m2); |
74 | unset($m2); |
70 | } |
75 | } |
71 | 76 | ||
72 | // 6. In HTML-Zeichen translatieren |
77 | // 6. In HTML-Zeichen translatieren |
73 | // Wenn Benutzer z.B. ä in ein Formular eingeben, soll dies nicht uebersetzt werden etc! |
78 | // Wenn Benutzer z.B. ä in ein Formular eingeben, soll dies nicht uebersetzt werden etc! |
74 | // Übersetzung von < und > verhindert HTML-Code-Ausführung |
79 | // Übersetzung von < und > verhindert HTML-Code-Ausführung |
75 | if (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE')) |
80 | if (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE')) |
76 | { |
81 | { |
77 | foreach ($$ch AS $m1 => $m2) |
82 | foreach ($$ch AS $m1 => $m2) |
78 | { |
83 | { |
79 | $$m1 = encode_critical_html_characters($$m1); |
84 | $$m1 = encode_critical_html_characters($$m1); |
80 | ${'HTTP_'.$rtype.'_VARS'}[$m1] = encode_critical_html_characters(${'HTTP_'.$rtype.'_VARS'}[$m1]); |
85 | # ${'HTTP_'.$rtype.'_VARS'}[$m1] = encode_critical_html_characters(${'HTTP_'.$rtype.'_VARS'}[$m1]); |
81 | ${'_'.$rtype}[$m1] = encode_critical_html_characters(${'_'.$rtype}[$m1]); |
86 | ${'_'.$rtype}[$m1] = encode_critical_html_characters(${'_'.$rtype}[$m1]); |
82 | } |
87 | } |
83 | 88 | ||
84 | unset($m1); |
89 | unset($m1); |
85 | unset($m2); |
90 | unset($m2); |
86 | } |
91 | } |
87 | } |
92 | } |
88 | 93 | ||
89 | // 7. Deutsche Umgebung setzen |
94 | // 7. Deutsche Umgebung setzen |
90 | $ary = explode('.', phpversion()); |
95 | $ary = explode('.', phpversion()); |
91 | if (((int)$ary[0] < 4) || (((int)$ary[0] == 4) && ((int)$ary[1] < 3))) |
96 | if (((int)$ary[0] < 4) || (((int)$ary[0] == 4) && ((int)$ary[1] < 3))) |
92 | setlocale(LC_ALL, 'german'); |
97 | setlocale(LC_ALL, 'german'); |
93 | else |
98 | else |
94 | setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'german'); |
99 | setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'german'); |
95 | @ini_set('date.timezone', 'Europe/Zurich'); |
100 | @ini_set('date.timezone', 'Europe/Zurich'); |
96 | 101 | ||
97 | // 8. MAX_EXECUTION_TIME |
102 | // 8. MAX_EXECUTION_TIME |
98 | @set_time_limit(0); |
103 | @set_time_limit(0); |
99 | 104 | ||
100 | // 9. Um unsauber entwickelte Module zu verhindern, höchstes Fehlerlevel aktivieren |
105 | // 9. Um unsauber entwickelte Module zu verhindern, höchstes Fehlerlevel aktivieren |
101 | if ((int)$ary[0] >= 5) |
106 | if ((int)$ary[0] >= 5) |
102 | @error_reporting(E_ALL | E_STRICT); |
107 | @error_reporting(E_ALL | E_STRICT); |
103 | else |
108 | else |
104 | @error_reporting(E_ALL); |
109 | @error_reporting(E_ALL); |
105 | 110 | ||
106 | // Konfiguration laden |
111 | // Konfiguration laden |
107 | 112 | ||
108 | if (file_exists('includes/configmanager.class.php')) { |
113 | if (file_exists('includes/configmanager.class.php')) { |
109 | include 'includes/configmanager.class.php'; |
114 | include 'includes/configmanager.class.php'; |
110 | } |
115 | } |
111 | 116 | ||
112 | $WBConfig = new WBConfigManager(); |
117 | $WBConfig = new WBConfigManager(); |
113 | $WBConfig->init(); |
118 | $WBConfig->init(); |
114 | 119 | ||
115 | ////////////////////////////////////////////////////////////////////////////// |
120 | ////////////////////////////////////////////////////////////////////////////// |
116 | // MANUELLE SPERRUNG DURCH LOCK-VARIABLE // |
121 | // MANUELLE SPERRUNG DURCH LOCK-VARIABLE // |
117 | ////////////////////////////////////////////////////////////////////////////// |
122 | ////////////////////////////////////////////////////////////////////////////// |
118 | 123 | ||
119 | if ($WBConfig->getLockFlag()) |
124 | if ($WBConfig->getLockFlag()) |
120 | { |
125 | { |
121 | die('<h1>Personal WebBase ist gesperrt</h1>Die Variable "$lock" in "includes/config.inc.php" steht auf 1 bzw. true. Setzen Sie diese Variable erst auf 0, wenn das Hochladen der Dateien beim Installations- bzw. Updateprozess beendet ist. Wenn Sie Personal WebBase freigeben, bevor der Upload abgeschlossen ist, kann es zu einer Beschädigung der Kundendatenbank kommen!'); |
126 | die('<h1>Personal WebBase ist gesperrt</h1>Die Variable "$lock" in "includes/config.inc.php" steht auf 1 bzw. true. Setzen Sie diese Variable erst auf 0, wenn das Hochladen der Dateien beim Installations- bzw. Updateprozess beendet ist. Wenn Sie Personal WebBase freigeben, bevor der Upload abgeschlossen ist, kann es zu einer Beschädigung der Kundendatenbank kommen!'); |
122 | } |
127 | } |
123 | 128 | ||
124 | ////////////////////////////////////////////////////////////////////////////// |
129 | ////////////////////////////////////////////////////////////////////////////// |
125 | // SSL-VERBINDUNG ERZWINGEN? (NICHT BEI CRONJOBS) // |
130 | // SSL-VERBINDUNG ERZWINGEN? (NICHT BEI CRONJOBS) // |
126 | ////////////////////////////////////////////////////////////////////////////// |
131 | ////////////////////////////////////////////////////////////////////////////// |
127 | 132 | ||
128 | if (!((isset($modul)) && ($modul == 'core_cronjob'))) |
133 | if (!((isset($modul)) && ($modul == 'core_cronjob'))) |
129 | { |
134 | { |
130 | if ($WBConfig->getForceSSLFlag()) |
135 | if ($WBConfig->getForceSSLFlag()) |
131 | { |
136 | { |
132 | @ini_set('session.cookie_secure', 1); |
137 | @ini_set('session.cookie_secure', 1); |
133 | 138 | ||
134 | // Wenn keine SSL Verbindung da, dann zu SSL umleiten |
139 | // Wenn keine SSL Verbindung da, dann zu SSL umleiten |
135 | if (!isset($_SERVER['HTTPS']) || (strtolower($_SERVER['HTTPS']) != 'on')) |
140 | if (!isset($_SERVER['HTTPS']) || (strtolower($_SERVER['HTTPS']) != 'on')) |
136 | { |
141 | { |
137 | wb_redirect_now('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
142 | wb_redirect_now('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
138 | } |
143 | } |
139 | } |
144 | } |
140 | } |
145 | } |
141 | 146 | ||
142 | ////////////////////////////////////////////////////////////////////////////// |
147 | ////////////////////////////////////////////////////////////////////////////// |
143 | // DEBUG-INITIALISIERUNG // |
148 | // DEBUG-INITIALISIERUNG // |
144 | ////////////////////////////////////////////////////////////////////////////// |
149 | ////////////////////////////////////////////////////////////////////////////// |
145 | 150 | ||
146 | if (file_exists('modules/common_debugger/static_core/init.inc.php')) { |
151 | if (file_exists('modules/common_debugger/static_core/init.inc.php')) { |
147 | include('modules/common_debugger/static_core/init.inc.php'); |
152 | include('modules/common_debugger/static_core/init.inc.php'); |
148 | } |
153 | } |
149 | 154 | ||
150 | ////////////////////////////////////////////////////////////////////////////// |
155 | ////////////////////////////////////////////////////////////////////////////// |
151 | // DATENBANKKONNEKTIVITÄT // |
156 | // DATENBANKKONNEKTIVITÄT // |
152 | ////////////////////////////////////////////////////////////////////////////// |
157 | ////////////////////////////////////////////////////////////////////////////// |
153 | 158 | ||
154 | require 'includes/database.inc.php'; |
159 | require 'includes/database.inc.php'; |
155 | 160 | ||
156 | ////////////////////////////////////////////////////////////////////////////// |
161 | ////////////////////////////////////////////////////////////////////////////// |
157 | // KONSTANTEN FÜR DESIGN // |
162 | // KONSTANTEN FÜR DESIGN // |
158 | ////////////////////////////////////////////////////////////////////////////// |
163 | ////////////////////////////////////////////////////////////////////////////// |
159 | 164 | ||
160 | $javascript = '<script language="JavaScript" type="text/javascript"> |
165 | $javascript = '<script language="JavaScript" type="text/javascript"> |
161 | <!-- |
166 | <!-- |
162 | 167 | ||
163 | function abfrage(url) |
168 | function abfrage(url) |
164 | { |
169 | { |
165 | var is_confirmed = confirm("M\u00f6chten Sie diese Aktion wirklich ausf\u00fchren?"); |
170 | var is_confirmed = confirm("M\u00f6chten Sie diese Aktion wirklich ausf\u00fchren?"); |
166 | if (is_confirmed) |
171 | if (is_confirmed) |
167 | { |
172 | { |
168 | document.location.href = url; |
173 | document.location.href = url; |
169 | } |
174 | } |
170 | } |
175 | } |
171 | 176 | ||
172 | function oop(modul, seite, titel, gross) |
177 | function oop(modul, seite, titel, gross) |
173 | { |
178 | { |
174 | if (parent.Caption.fertig != "1") |
179 | if (parent.Caption.fertig != "1") |
175 | { |
180 | { |
176 | window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10); |
181 | window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10); |
177 | } |
182 | } |
178 | else |
183 | else |
179 | { |
184 | { |
180 | titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+titel; |
185 | titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+titel; |
181 | if (parent.Caption.document.getElementById) parent.Caption.document.getElementById("ueberschrift").innerHTML = titel; else if (parent.Caption.document.all) parent.Caption.document.ueberschrift.innerHTML = titel; |
186 | if (parent.Caption.document.getElementById) parent.Caption.document.getElementById("ueberschrift").innerHTML = titel; else if (parent.Caption.document.all) parent.Caption.document.ueberschrift.innerHTML = titel; |
182 | parent.Content.location.href = "page.php?'.(((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != '')) ? $_SERVER['QUERY_STRING'].'&' : '').'modul="+modul+"&seite="+seite; |
187 | parent.Content.location.href = "page.php?'.(((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != '')) ? $_SERVER['QUERY_STRING'].'&' : '').'modul="+modul+"&seite="+seite; |
183 | } |
188 | } |
184 | } |
189 | } |
185 | 190 | ||
186 | function oop2(myurl, titel, gross) |
191 | function oop2(myurl, titel, gross) |
187 | { |
192 | { |
188 | if (parent.Caption.fertig != "1") |
193 | if (parent.Caption.fertig != "1") |
189 | { |
194 | { |
190 | window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10); |
195 | window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10); |
191 | } |
196 | } |
192 | else |
197 | else |
193 | { |
198 | { |
194 | titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+titel; |
199 | titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+titel; |
195 | if (parent.Caption.document.getElementById) parent.Caption.document.getElementById("ueberschrift").innerHTML = titel; else if (parent.Caption.document.all) parent.Caption.document.ueberschrift.innerHTML = titel; |
200 | if (parent.Caption.document.getElementById) parent.Caption.document.getElementById("ueberschrift").innerHTML = titel; else if (parent.Caption.document.all) parent.Caption.document.ueberschrift.innerHTML = titel; |
196 | window.open(myurl, "_blank"); |
201 | window.open(myurl, "_blank"); |
197 | } |
202 | } |
198 | } |
203 | } |
199 | 204 | ||
200 | // --> |
205 | // --> |
201 | </script>'; |
206 | </script>'; |
202 | 207 | ||
203 | $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
208 | $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
204 | 209 | ||
205 | <html> |
210 | <html> |
206 | <head> |
211 | <head> |
207 | <title>ViaThinkSoft Personal WebBase</title> |
212 | <title>ViaThinkSoft Personal WebBase</title> |
208 | <link href="style.css.php" rel="stylesheet" type="text/css"> |
213 | <link href="style.css.php" rel="stylesheet" type="text/css"> |
209 | <link rel="SHORTCUT ICON" href="favicon.ico"> |
214 | <link rel="SHORTCUT ICON" href="favicon.ico"> |
210 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
215 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
211 | <meta name="robots" content="noindex"> |
216 | <meta name="robots" content="noindex"> |
212 | </head> |
217 | </head> |
213 | 218 | ||
214 | <body>'.$javascript; |
219 | <body>'.$javascript; |
215 | 220 | ||
216 | $header_navi = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
221 | $header_navi = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
217 | 222 | ||
218 | <html> |
223 | <html> |
219 | <head> |
224 | <head> |
220 | <title>ViaThinkSoft Personal WebBase</title> |
225 | <title>ViaThinkSoft Personal WebBase</title> |
221 | <link href="style.css.php" rel="stylesheet" type="text/css"> |
226 | <link href="style.css.php" rel="stylesheet" type="text/css"> |
222 | <meta name="robots" content="noindex"> |
227 | <meta name="robots" content="noindex"> |
223 | </head> |
228 | </head> |
224 | 229 | ||
225 | <body class="margin_middle">'.$javascript; |
230 | <body class="margin_middle">'.$javascript; |
226 | 231 | ||
227 | $footer = '</body></html>'; |
232 | $footer = '</body></html>'; |
228 | 233 | ||
229 | ?> |
234 | ?> |
230 | 235 |