Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 9 | Revision 50 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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