Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 8 | Revision 14 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

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