Subversion Repositories personal-webbase

Rev

Rev 3 | 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
10 daniel-mar 40
if (function_exists('set_magic_quotes_runtime')) set_magic_quotes_runtime(0);
1 daniel-mar 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
10 daniel-mar 48
        if (!ini_get('register_globals')) {
49
                if (@count(${'_'.$rtype}) > 0) {
50
                        extract(${'_'.$rtype}, EXTR_OVERWRITE);
51
                } else if (@count(${'HTTP_'.$rtype.'_VARS'}) > 0) {
52
                        extract(${'_'.$rtype}, EXTR_OVERWRITE);
53
                }
54
        }
1 daniel-mar 55
 
56
        // Workaround, wenn register_long_arrays nicht auf 1 gesetzt werden konnte
57
        if (ini_get('register_long_arrays') == '1')
58
                $ch = 'HTTP_'.$rtype.'_VARS';
59
        else
60
                $ch = '_'.$rtype;
61
 
62
        // 5. Wenn "Magic Quotes GPC" aktiviert, dann die Aenderungen an GET/POST/COOKIE wieder rueckgaengig machen!
63
        // Wir haben db_escape(), um SQL-Strings vor Injektionen zu schuetzen. Wir brauchen Magic Quotes nicht!
64
        if ((get_magic_quotes_gpc() == 1) && (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE')))
65
        {
66
                foreach ($$ch AS $m1 => $m2)
67
                {
68
                        $$m1 = stripslashes($$m1);
69
                        ${'HTTP_'.$rtype.'_VARS'}[$m1] = stripslashes(${'HTTP_'.$rtype.'_VARS'}[$m1]);
10 daniel-mar 70
#                       ${'_'.$rtype}[$m1] = stripslashes(${'_'.$rtype}[$m1]);
1 daniel-mar 71
                }
72
 
73
                unset($m1);
74
                unset($m2);
75
        }
76
 
77
        // 6. In HTML-Zeichen translatieren
78
        // Wenn Benutzer z.B. &auml; in ein Formular eingeben, soll dies nicht uebersetzt werden etc!
79
        // Übersetzung von < und > verhindert HTML-Code-Ausführung
80
        if (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE'))
81
        {
82
                foreach ($$ch AS $m1 => $m2)
83
                {
84
                        $$m1 = encode_critical_html_characters($$m1);
10 daniel-mar 85
#                       ${'HTTP_'.$rtype.'_VARS'}[$m1] = encode_critical_html_characters(${'HTTP_'.$rtype.'_VARS'}[$m1]);
1 daniel-mar 86
                        ${'_'.$rtype}[$m1] = encode_critical_html_characters(${'_'.$rtype}[$m1]);
87
                }
88
 
89
                unset($m1);
90
                unset($m2);
91
        }
92
}
93
 
94
// 7. Deutsche Umgebung setzen
95
$ary = explode('.', phpversion());
96
if (((int)$ary[0] < 4) || (((int)$ary[0] == 4) && ((int)$ary[1] < 3)))
97
        setlocale(LC_ALL, 'german');
98
else
99
        setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'german');
100
@ini_set('date.timezone', 'Europe/Zurich');
101
 
102
// 8. MAX_EXECUTION_TIME
103
@set_time_limit(0);
104
 
105
// 9. Um unsauber entwickelte Module zu verhindern, höchstes Fehlerlevel aktivieren
106
if ((int)$ary[0] >= 5)
107
        @error_reporting(E_ALL | E_STRICT);
108
else
109
        @error_reporting(E_ALL);
110
 
111
// Konfiguration laden
112
 
113
if (file_exists('includes/configmanager.class.php')) {
114
        include 'includes/configmanager.class.php';
115
}
116
 
117
$WBConfig = new WBConfigManager();
118
$WBConfig->init();
119
 
120
//////////////////////////////////////////////////////////////////////////////
121
// MANUELLE SPERRUNG DURCH LOCK-VARIABLE                                    //
122
//////////////////////////////////////////////////////////////////////////////
123
 
124
if ($WBConfig->getLockFlag())
125
{
126
        die('<h1>Personal WebBase ist gesperrt</h1>Die Variable &quot;$lock&quot; in &quot;includes/config.inc.php&quot; 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&auml;digung der Kundendatenbank kommen!');
127
}
128
 
129
//////////////////////////////////////////////////////////////////////////////
130
// SSL-VERBINDUNG ERZWINGEN? (NICHT BEI CRONJOBS)                           //
131
//////////////////////////////////////////////////////////////////////////////
132
 
133
if (!((isset($modul)) && ($modul == 'core_cronjob')))
134
{
135
        if ($WBConfig->getForceSSLFlag())
136
        {
137
                @ini_set('session.cookie_secure', 1);
138
 
139
                // Wenn keine SSL Verbindung da, dann zu SSL umleiten
140
                if (!isset($_SERVER['HTTPS']) || (strtolower($_SERVER['HTTPS']) != 'on'))
141
                {
142
                        wb_redirect_now('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
143
                }
144
        }
145
}
146
 
147
//////////////////////////////////////////////////////////////////////////////
148
// DEBUG-INITIALISIERUNG                                                    //
149
//////////////////////////////////////////////////////////////////////////////
150
 
151
if (file_exists('modules/common_debugger/static_core/init.inc.php')) {
152
        include('modules/common_debugger/static_core/init.inc.php');
153
}
154
 
155
//////////////////////////////////////////////////////////////////////////////
156
// DATENBANKKONNEKTIVITÄT                                                   //
157
//////////////////////////////////////////////////////////////////////////////
158
 
159
require 'includes/database.inc.php';
160
 
161
//////////////////////////////////////////////////////////////////////////////
162
// KONSTANTEN FÜR DESIGN                                                    //
163
//////////////////////////////////////////////////////////////////////////////
164
 
165
$javascript = '<script language="JavaScript" type="text/javascript">
166
        <!--
167
 
168
        function abfrage(url)
169
        {
170
                var is_confirmed = confirm("M\u00f6chten Sie diese Aktion wirklich ausf\u00fchren?");
171
                if (is_confirmed)
172
                {
173
                        document.location.href = url;
174
                }
175
        }
176
 
177
        function oop(modul, seite, titel, gross)
178
        {
179
                if (parent.Caption.fertig != "1")
180
                {
181
                        window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10);
182
                }
183
                else
184
                {
185
                        titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+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;
187
                        parent.Content.location.href = "page.php?'.(((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != '')) ? $_SERVER['QUERY_STRING'].'&' : '').'modul="+modul+"&seite="+seite;
188
                }
189
        }
190
 
191
        function oop2(myurl, titel, gross)
192
        {
193
                if (parent.Caption.fertig != "1")
194
                {
195
                        window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10);
196
                }
197
                else
198
                {
199
                        titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+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;
201
                        window.open(myurl, "_blank");
202
                }
203
        }
204
 
205
        // -->
206
</script>';
207
 
208
$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
209
 
210
<html>
211
        <head>
212
                <title>ViaThinkSoft Personal WebBase</title>
213
                <link href="style.css.php" rel="stylesheet" type="text/css">
214
                <link rel="SHORTCUT ICON" href="favicon.ico">
215
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
216
                <meta name="robots" content="noindex">
217
        </head>
218
 
219
        <body>'.$javascript;
220
 
221
$header_navi = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
222
 
223
<html>
224
        <head>
225
                <title>ViaThinkSoft Personal WebBase</title>
226
                <link href="style.css.php" rel="stylesheet" type="text/css">
227
                <meta name="robots" content="noindex">
228
        </head>
229
 
230
        <body class="margin_middle">'.$javascript;
231
 
232
$footer = '</body></html>';
233
 
234
?>