isConnected() public method

public isConnected ( ) : boolean
return boolean
Esempio n. 1
0
        $dbnr = $_COOKIE['kimai_db'] - 1;
        $kga['server_database'] = $server_ext_database[$dbnr];
        if ($server_ext_username[$dbnr] != '') {
            $kga['server_username'] = $server_ext_username[$dbnr];
        }
        if ($server_ext_password[$dbnr] != '') {
            $kga['server_password'] = $server_ext_password[$dbnr];
        }
        if ($server_ext_prefix[$dbnr] != '') {
            $kga['server_prefix'] = $server_ext_prefix[$dbnr];
        }
    }
}
$database = new Kimai_Database_Mysql($kga);
$database->connect($kga['server_hostname'], $kga['server_database'], $kga['server_username'], $kga['server_password'], $kga['utf8'], $kga['server_type']);
if (!$database->isConnected()) {
    die('Kimai could not connect to database. Check your autoconf.php.');
}
Kimai_Registry::setDatabase($database);
global $translations;
$translations = new Translations($kga);
if ($kga['language'] != 'en') {
    $translations->load($kga['language']);
}
$vars = $database->configuration_get_data();
if (!empty($vars)) {
    $kga['currency_name'] = $vars['currency_name'];
    $kga['currency_sign'] = $vars['currency_sign'];
    $kga['show_sensible_data'] = $vars['show_sensible_data'];
    $kga['show_update_warn'] = $vars['show_update_warn'];
    $kga['check_at_startup'] = $vars['check_at_startup'];