Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 1 | Revision 8 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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