Subversion Repositories personal-webbase

Rev

Rev 3 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
<?php
2
 
3
//////////////////////////////////////////////////////////////////////////////
4
// SICHERHEITSVARIABLE                                                      //
5
//////////////////////////////////////////////////////////////////////////////
6
// Ohne diese werden Modulinhalte nicht ausgeführt                          //
7
//////////////////////////////////////////////////////////////////////////////
8
 
9
define('IBLEGAL', '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>IronBASE 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 IronBASE möglichst unabhängig von fremden             //
31
// Konfigurationen wird und funktionell bleibt!                             //
32
//////////////////////////////////////////////////////////////////////////////
33
 
34
// 1. Magic Quotes Sybase abschalten
35
@ini_set('magic_quotes_sybase', 'Off');
36
 
37
// 2. Magic Quotes Runtime abschalten
38
set_magic_quotes_runtime(0);
39
 
40
// 3. variables_order / gpc_order ersetzen
41
@ini_set('register_long_arrays', '1');
42
$types_to_register = array('ENV', 'GET', 'POST', 'COOKIE', 'SERVER'); // SESSION und FILES werden nicht extrahiert
43
foreach ($types_to_register as $rtype)
44
{
45
  // 4. Funktion von "Register Globals" ersetzen, wenn es ausgeschaltet ist
46
  if ((!ini_get('register_globals')) && (@count(${'HTTP_'.$rtype.'_VARS'}) > 0))
47
    extract(${'HTTP_'.$rtype.'_VARS'}, EXTR_OVERWRITE);
48
 
49
  // Workaround, wenn register_long_arrays nicht auf 1 gesetzt werden konnte
50
  if (ini_get('register_long_arrays') == '1')
51
    $ch = 'HTTP_'.$rtype.'_VARS';
52
  else
53
    $ch = '_'.$rtype;
54
 
55
  // 5. Wenn "Magic Quotes GPC" aktiviert, dann die Aenderungen an GET/POST/COOKIE wieder rueckgaengig machen!
56
  // Wir haben db_escape(), um SQL-Strings vor Injektionen zu schuetzen. Wir brauchen Magic Quotes nicht!
57
  if ((get_magic_quotes_gpc() == 1) && (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE')))
58
  {
59
    foreach ($$ch AS $m1 => $m2)
60
    {
61
      $$m1 = stripslashes($$m1);
62
      ${'HTTP_'.$rtype.'_VARS'}[$m1] = stripslashes(${'HTTP_'.$rtype.'_VARS'}[$m1]);
63
      ${'_'.$rtype}[$m1] = stripslashes(${'_'.$rtype}[$m1]);
64
    }
65
 
66
    unset($m1);
67
    unset($m2);
68
  }
69
 
70
  // 6. In HTML-Zeichen translatieren
71
  // Wenn Benutzer z.B. &auml; in ein Formular eingeben, soll dies nicht uebersetzt werden etc!
72
  // Übersetzung von < und > verhindert HTML-Code-Ausführung
73
  if (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE'))
74
  {
75
    foreach ($$ch AS $m1 => $m2)
76
    {
77
      $$m1 = transamp_replace_spitze_klammern($$m1);
78
      ${'HTTP_'.$rtype.'_VARS'}[$m1] = transamp_replace_spitze_klammern(${'HTTP_'.$rtype.'_VARS'}[$m1]);
79
      ${'_'.$rtype}[$m1] = transamp_replace_spitze_klammern(${'_'.$rtype}[$m1]);
80
    }
81
 
82
    unset($m1);
83
    unset($m2);
84
  }
85
}
86
 
87
// 7. Deutsche Umgebung setzen
88
$ary = explode('.', phpversion());
89
if (((int)$ary[0] < 4) || (((int)$ary[0] == 4) && ((int)$ary[1] < 3)))
90
  setlocale(LC_ALL, 'german');
91
else
92
  setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'german');
93
@ini_set('date.timezone', 'Europe/Zurich');
94
 
95
// 8. MAX_EXECUTION_TIME
96
@set_time_limit(0);
97
 
98
// 9. Um unsauber entwickelte Module zu verhindern, höchstes Fehlerlevel aktivieren
99
if ((int)$ary[0] >= 5)
100
  @error_reporting(E_ALL | E_STRICT);
101
else
102
  @error_reporting(E_ALL);
103
 
104
//////////////////////////////////////////////////////////////////////////////
105
// VARIABLEN-INCLUDES                                                       //
106
//////////////////////////////////////////////////////////////////////////////
107
 
108
$revision = '?';
109
$rev_datum = '?';
110
$mysql_zugangsdaten = array();
111
$mysql_zugangsdaten['server'] = 'localhost';
112
$mysql_zugangsdaten['praefix'] = 'ironbase_';
113
$mysql_zugangsdaten['username'] = 'root';
114
$mysql_zugangsdaten['passwort'] = '';
115
$mysql_zugangsdaten['datenbank'] = 'ironbase';
116
$lock = 0;
117
$force_ssl = 0;
118
 
119
if (file_exists('includes/rev.inc.php'))
120
  include 'includes/rev.inc.php';
121
if (file_exists('includes/config.inc.php'))
122
  include 'includes/config.inc.php';
123
 
124
//////////////////////////////////////////////////////////////////////////////
125
// MANUELLE SPERRUNG DURCH LOCK-VARIABLE                                    //
126
//////////////////////////////////////////////////////////////////////////////
127
 
128
if ($lock)
129
{
130
  die('<h1>IronBASE 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 IronBASE freigeben, bevor der Upload abgeschlossen ist, kann es zu einer Besch&auml;digung der Kundendatenbank kommen!');
131
}
132
 
133
//////////////////////////////////////////////////////////////////////////////
134
// SSL-VERBINDUNG ERZWINGEN?                                                //
135
//////////////////////////////////////////////////////////////////////////////
136
 
137
if ($force_ssl) @ini_set('session.cookie_secure', 1);
138
 
139
if (($force_ssl) && (!isset($_SERVER['HTTPS']) || (strtolower($_SERVER['HTTPS']) != 'on')))
140
{
141
  if (!headers_sent()) header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
142
  exit();
143
}
144
 
145
//////////////////////////////////////////////////////////////////////////////
146
// DATENBANKKONNEKTIVITÄT                                                   //
147
//////////////////////////////////////////////////////////////////////////////
148
 
149
require 'includes/database.inc.php';
150
 
151
//////////////////////////////////////////////////////////////////////////////
152
// KONSTANTEN FÜR DESIGN                                                    //
153
//////////////////////////////////////////////////////////////////////////////
154
 
155
$javascript = '<script language="JavaScript" type="text/javascript">
156
  <!--
157
 
158
  function abfrage(url)
159
  {
160
    var is_confirmed = confirm("M\u00f6chten Sie diese Aktion wirklich ausf\u00fchren?");
161
    if (is_confirmed)
162
    {
163
      document.location.href = url;
164
    }
165
  }
166
 
167
  function open_url(uri)
168
  {
169
       w = screen.availWidth/1.35;
170
       h = screen.availHeight/1.35;
171
       x = screen.availWidth/2-w/2;
172
       y = screen.availHeight/2-h/2;
173
       var load = window.open(\'\', \'\', \'height=\'+h+\',width=\'+w+\',left=\'+x+\',top=\'+y+\',screenX=\'+x+\',screenY=\'+y+\',scrollbars=yes,resizable=yes,toolbar=no,location=no,menubar=no,status=no\');
174
       load.document.location.href = uri;
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.Inhalt.location.href = "modulseite.php?'.(($_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
      open_url(myurl);
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>IronBASE</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
  </head>
217
 
218
  <body>'.$javascript;
219
 
220
$header_navi = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
221
 
222
  <html>
223
    <head>
224
        <title>IronBASE</title>
225
      <link href="style.css.php" rel="stylesheet" type="text/css">
226
    </head>
227
 
228
  <body class="dark">'.$javascript;
229
 
230
$footer = '</body></html>';
231
 
232
//////////////////////////////////////////////////////////////////////////////
233
// MODULINITIALISIERUNG                                                     //
234
//////////////////////////////////////////////////////////////////////////////
235
 
236
// 1. Modulliste laden
237
 
238
function liste_module()
239
{
240
  $ary = array();
241
  $i = 0;
242
  $v = 'modules/';
243
  $verz = opendir($v);
244
 
245
  while ($file = readdir($verz))
246
  {
247
    if (($file != '.') && ($file != '..') && (is_dir($v.$file)))
248
    {
249
      $i++;
250
      $ary[$i] = $file;
251
    }
252
  }
253
 
254
  closedir($verz);
255
  sort($ary);
256
 
257
  return $ary;
258
}
259
 
260
$module = liste_module();
261
 
262
// 2. Modul-Autostarts ausführen
263
 
264
$erf = false;
265
for ($st=0; true; $st++)
266
{
267
  $erf = false;
268
  foreach ($module AS $m1 => $m2)
269
  {
270
    if (file_exists('modules/'.$m2.'/autostart_'.$st.'.inc.php'))
271
    {
272
      include 'modules/'.$m2.'/autostart_'.$st.'.inc.php';
273
      $erf = true;
274
    }
275
  }
276
 
277
  unset($m1);
278
  unset($m2);
279
 
280
  if (!$erf) break;
281
}
282
 
283
?>