| 1 |
lars |
1 |
<?php
|
|
|
2 |
require_once "Config.php";
|
|
|
3 |
require_once "MDB2.php";
|
|
|
4 |
require_once "smarty/libs/Smarty.class.php";
|
|
|
5 |
require_once "classes/host.php";
|
|
|
6 |
require_once "classes/service.php";
|
| 8 |
lars |
7 |
require_once "classes/contact.php";
|
| 1 |
lars |
8 |
|
|
|
9 |
$GLOBALS["ui"] = new Smarty();
|
|
|
10 |
$cfg = new Config();
|
| 6 |
lars |
11 |
$cfg = $cfg->parseConfig("config.xml","xml");
|
| 1 |
lars |
12 |
$cfg = $cfg->toArray();
|
|
|
13 |
$GLOBALS["cfg"] = $cfg["root"]["config"];
|
|
|
14 |
$opts = array( "persistent" => true, "portability" =>
|
|
|
15 |
MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL ^
|
|
|
16 |
MDB2_PORTABILITY_FIX_CASE );
|
|
|
17 |
$dsn = array( "phptype" => "mysqli", "username" => $GLOBALS["cfg"]["db"]["user"],
|
|
|
18 |
"password" => $GLOBALS["cfg"]["db"]["pass"], "hostspec" => $GLOBBALS["cfg"]["db"]["server"],
|
|
|
19 |
"database" => $GLOBALS["cfg"]["db"]["db"], "new_link" => true, );
|
|
|
20 |
$GLOBALS["db"] = MDB2::connect( $dsn, $opts );
|
|
|
21 |
if ( PEAR::isError( $GLOBALS["db"] ) )
|
|
|
22 |
{
|
|
|
23 |
trigger_error( "Keine Verbindung zur Datenbank möglich!\n",
|
|
|
24 |
E_USER_ERROR );
|
|
|
25 |
}
|
|
|
26 |
$GLOBALS["db"]->setfetchMode( MDB2_FETCHMODE_ASSOC );
|
|
|
27 |
?>
|