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