Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 8 | Revision 50 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

    require_once "Config.php";
    require_once "MDB2.php";
    require_once "smarty/libs/Smarty.class.php";
    require_once "classes/host.php";
    require_once "classes/service.php";
    require_once "classes/contact.php";

    $GLOBALS["ui"] = new Smarty();
    $cfg = new Config();
    $cfg = $cfg->parseConfig( "config.xml", "xml" );
    $cfg = $cfg->toArray();
    $GLOBALS["cfg"] = $cfg["root"]["config"];
    $opts = array( "persistent" => true, "portability" => MDB2_PORTABILITY_ALL ^
            MDB2_PORTABILITY_EMPTY_TO_NULL ^ MDB2_PORTABILITY_FIX_CASE );
    $dsn = array(
        "phptype" => "mysqli",
        "username" => $GLOBALS["cfg"]["db"]["user"],
        "password" => $GLOBALS["cfg"]["db"]["pass"],
        "hostspec" => $GLOBBALS["cfg"]["db"]["server"],
        "database" => $GLOBALS["cfg"]["db"]["db"],
        "new_link" => true,
        );
    $GLOBALS["db"] = MDB2::connect( $dsn, $opts );
    if ( PEAR::isError( $GLOBALS["db"] ) )
    {
        trigger_error( "Keine Verbindung zur Datenbank möglich!\n", E_USER_ERROR );
    }
    $GLOBALS["db"]->setfetchMode( MDB2_FETCHMODE_ASSOC );

?>