Subversion Repositories personal-webbase

Rev

Rev 4 | Rev 9 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. //////////////////////////////////////////////////////////////////////////////
  4. // SICHERHEITSVARIABLE                                                      //
  5. //////////////////////////////////////////////////////////////////////////////
  6. // Ohne diese werden Modulinhalte nicht ausgeführt                          //
  7. //////////////////////////////////////////////////////////////////////////////
  8.  
  9. define('IBLEGAL', '1');
  10.  
  11. header('Content-Type: text/html; charset=ISO-8859-1');
  12. mb_internal_encoding("ISO-8859-1");
  13.  
  14. //////////////////////////////////////////////////////////////////////////////
  15. // FUNKTIONEN                                                               //
  16. //////////////////////////////////////////////////////////////////////////////
  17.  
  18. require 'includes/functions.inc.php';
  19.  
  20. //////////////////////////////////////////////////////////////////////////////
  21. // PRÜFUNG VON MODDIR.TXT                                                   //
  22. //////////////////////////////////////////////////////////////////////////////
  23.  
  24. if (!file_exists('modules/moddir.txt'))
  25. {
  26.   die('<h1>Personal WebBase ist gesperrt</h1>Kann Datei modules/moddir.txt, die das Modulverzeichnis identifiziert, nicht finden. Ist diese vorhanden, sind die Zugriffsberechtigungen der Dateien falsch. Empfohlen: Ordner CHMOD 755, Dateien CHMOD 644.');
  27. }
  28.  
  29. //////////////////////////////////////////////////////////////////////////////
  30. // KOMPATIBILITÄT                                                           //
  31. //////////////////////////////////////////////////////////////////////////////
  32. // Hier werden Einstellunen von PHP lokal verändert oder Variablen          //
  33. // bearbeitet, sodass Personal WebBase möglichst unabhängig von fremden             //
  34. // Konfigurationen wird und funktionell bleibt!                             //
  35. //////////////////////////////////////////////////////////////////////////////
  36.  
  37. // 1. Magic Quotes Sybase abschalten
  38. @ini_set('magic_quotes_sybase', 'Off');
  39.  
  40. // 2. Magic Quotes Runtime abschalten
  41. if (function_exists('set_magic_quotes_runtime'))
  42. {
  43.   @set_magic_quotes_runtime(0);
  44. }
  45.  
  46. // 3. variables_order / gpc_order ersetzen
  47. @ini_set('register_long_arrays', '1');
  48. $types_to_register = array('ENV', 'GET', 'POST', 'COOKIE', 'SERVER'); // SESSION und FILES werden nicht extrahiert
  49. foreach ($types_to_register as $rtype)
  50. {
  51.   // 4. Funktion von "Register Globals" ersetzen, wenn es ausgeschaltet ist
  52.   if ((!ini_get('register_globals')) && isset(${'_'.$rtype}) && (@count(${'_'.$rtype}) > 0))
  53.     extract(${'_'.$rtype}, EXTR_OVERWRITE);
  54.  
  55.   // Workaround, wenn register_long_arrays nicht auf 1 gesetzt werden konnte
  56.   $ch = '_'.$rtype;
  57.  
  58.   // 5. Wenn "Magic Quotes GPC" aktiviert, dann die Aenderungen an GET/POST/COOKIE wieder rueckgaengig machen!
  59.   // Wir haben db_escape(), um SQL-Strings vor Injektionen zu schuetzen. Wir brauchen Magic Quotes nicht!
  60.   if (function_exists('get_magic_quotes_gpc') && (get_magic_quotes_gpc() == 1) && (($rtype == 'GET') || ($rtype == 'POST') || ($rtype == 'COOKIE')))
  61.   {
  62.     foreach ($$ch AS $m1 => $m2)
  63.     {
  64.       $$m1 = stripslashes($$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. &auml; 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 = transamp_replace_spitze_klammern($$m1);
  80.       ${'_'.$rtype}[$m1] = transamp_replace_spitze_klammern(${'_'.$rtype}[$m1]);
  81.     }
  82.  
  83.     unset($m1);
  84.     unset($m2);
  85.   }
  86. }
  87.  
  88. // 7. Deutsche Umgebung setzen
  89. $ary = explode('.', phpversion());
  90. if (((int)$ary[0] < 4) || (((int)$ary[0] == 4) && ((int)$ary[1] < 3)))
  91.   setlocale(LC_ALL, 'german');
  92. else
  93.   setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'german');
  94. @ini_set('date.timezone', 'Europe/Zurich');
  95.  
  96. // 8. MAX_EXECUTION_TIME
  97. @set_time_limit(0);
  98.  
  99. // 9. Um unsauber entwickelte Module zu verhindern, höchstes Fehlerlevel aktivieren
  100. if ((int)$ary[0] >= 5)
  101.   @error_reporting(E_ALL | E_STRICT);
  102. else
  103.   @error_reporting(E_ALL);
  104.  
  105. //////////////////////////////////////////////////////////////////////////////
  106. // VARIABLEN-INCLUDES                                                       //
  107. //////////////////////////////////////////////////////////////////////////////
  108.  
  109. $revision = '?';
  110. $rev_datum = '?';
  111. $mysql_zugangsdaten = array();
  112. $mysql_zugangsdaten['server'] = 'localhost';
  113. $mysql_zugangsdaten['praefix'] = 'ironbase_';
  114. $mysql_zugangsdaten['username'] = 'root';
  115. $mysql_zugangsdaten['passwort'] = '';
  116. $mysql_zugangsdaten['datenbank'] = 'ironbase';
  117. $lock = 0;
  118. $force_ssl = 0;
  119.  
  120. if (file_exists('includes/rev.inc.php'))
  121.   include 'includes/rev.inc.php';
  122. if (file_exists('includes/config.inc.php'))
  123.   include 'includes/config.inc.php';
  124.  
  125. //////////////////////////////////////////////////////////////////////////////
  126. // MANUELLE SPERRUNG DURCH LOCK-VARIABLE                                    //
  127. //////////////////////////////////////////////////////////////////////////////
  128.  
  129. if ($lock)
  130. {
  131.   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!');
  132. }
  133.  
  134. //////////////////////////////////////////////////////////////////////////////
  135. // SSL-VERBINDUNG ERZWINGEN?                                                //
  136. //////////////////////////////////////////////////////////////////////////////
  137.  
  138. // Hotfix exklusiv für VTS Demosystem
  139. //if ((isset($modul)) && ($modul == 'core_cronjob')) {
  140. //} else {
  141.  
  142. if ($force_ssl) @ini_set('session.cookie_secure', 1);
  143.  
  144. if (($force_ssl) && (!isset($_SERVER['HTTPS']) || (strtolower($_SERVER['HTTPS']) != 'on')))
  145. {
  146.   if (!headers_sent()) header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
  147.   exit();
  148. }
  149.  
  150. //}
  151.  
  152. //////////////////////////////////////////////////////////////////////////////
  153. // DATENBANKKONNEKTIVITÄT                                                   //
  154. //////////////////////////////////////////////////////////////////////////////
  155.  
  156. require 'includes/database.inc.php';
  157.  
  158. //////////////////////////////////////////////////////////////////////////////
  159. // KONSTANTEN FÜR DESIGN                                                    //
  160. //////////////////////////////////////////////////////////////////////////////
  161.  
  162. $javascript = '<script language="JavaScript" type="text/javascript">
  163.  <!--
  164.  
  165.  function abfrage(url)
  166.  {
  167.    var is_confirmed = confirm("M\u00f6chten Sie diese Aktion wirklich ausf\u00fchren?");
  168.    if (is_confirmed)
  169.    {
  170.      document.location.href = url;
  171.    }
  172.  }
  173.  
  174.  function open_url(uri)
  175.  {
  176.       w = screen.availWidth/1.35;
  177.       h = screen.availHeight/1.35;
  178.       x = screen.availWidth/2-w/2;
  179.       y = screen.availHeight/2-h/2;
  180.       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\');
  181.       load.document.location.href = uri;
  182.  }
  183.  
  184.  function oop(modul, seite, titel, gross)
  185.  {
  186.    if (parent.Caption.fertig != "1")
  187.    {
  188.         window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10);
  189.    }
  190.    else
  191.    {
  192.      titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+titel;
  193.      if (parent.Caption.document.getElementById) parent.Caption.document.getElementById("ueberschrift").innerHTML = titel; else if (parent.Caption.document.all) parent.Caption.document.ueberschrift.innerHTML = titel;
  194.      parent.Inhalt.location.href = "modulseite.php?'.(($_SERVER["QUERY_STRING"] != '') ? $_SERVER["QUERY_STRING"].'&' : '').'modul="+modul+"&seite="+seite;
  195.    }
  196.  }
  197.  
  198.  function oop2(myurl, titel, gross)
  199.  {
  200.    if (parent.Caption.fertig != "1")
  201.    {
  202.           window.setTimeout("oop(\'"+modul+"\', \'"+seite+"\', \'"+titel+"\', \'"+gross+"\')", 10);
  203.    }
  204.    else
  205.    {
  206.      titel = \'<img src="\'+gross+\'" alt="Icon" width="32" height="32"> \'+titel;
  207.      if (parent.Caption.document.getElementById) parent.Caption.document.getElementById("ueberschrift").innerHTML = titel; else if (parent.Caption.document.all) parent.Caption.document.ueberschrift.innerHTML = titel;
  208.      open_url(myurl);
  209.    }
  210.  }
  211.  
  212.  // -->
  213. </script>';
  214.  
  215. $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  216.  
  217. <html>
  218.  <head>
  219.         <title>ViaThinkSoft Personal WebBase</title>
  220.    <link href="style.css.php" rel="stylesheet" type="text/css">
  221.    <link rel="SHORTCUT ICON" href="favicon.ico">
  222.    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  223.  </head>
  224.  
  225.  <body>'.$javascript;
  226.  
  227. $header_navi = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  228.  
  229.  <html>
  230.    <head>
  231.           <title>ViaThinkSoft Personal WebBase</title>
  232.      <link href="style.css.php" rel="stylesheet" type="text/css">
  233.      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  234.    </head>
  235.  
  236.  <body class="dark">'.$javascript;
  237.  
  238. $footer = '</body></html>';
  239.  
  240. //////////////////////////////////////////////////////////////////////////////
  241. // MODULINITIALISIERUNG                                                     //
  242. //////////////////////////////////////////////////////////////////////////////
  243.  
  244. // 1. Modulliste laden
  245.  
  246. function liste_module()
  247. {
  248.   $ary = array();
  249.   $i = 0;
  250.   $v = 'modules/';
  251.   $verz = opendir($v);
  252.  
  253.   while ($file = readdir($verz))
  254.   {
  255.     if (($file != '.') && ($file != '..') && (is_dir($v.$file)))
  256.     {
  257.       $i++;
  258.       $ary[$i] = $file;
  259.     }
  260.   }
  261.  
  262.   closedir($verz);
  263.   sort($ary);
  264.  
  265.   return $ary;
  266. }
  267.  
  268. $module = liste_module();
  269.  
  270. // 2. Modul-Autostarts ausführen
  271.  
  272. $erf = false;
  273. for ($st=0; true; $st++)
  274. {
  275.   $erf = false;
  276.   foreach ($module AS $m1 => $m2)
  277.   {
  278.     if (file_exists('modules/'.wb_dir_escape($m2).'/autostart_'.wb_dir_escape($st).'.inc.php'))
  279.     {
  280.       include 'modules/'.wb_dir_escape($m2).'/autostart_'.wb_dir_escape($st).'.inc.php';
  281.       $erf = true;
  282.     }
  283.   }
  284.  
  285.   unset($m1);
  286.   unset($m2);
  287.  
  288.   if (!$erf) break;
  289. }
  290.  
  291.