コード例 #1
0
ファイル: startup.php プロジェクト: AlexanderS/Part-DB
try {
    $database = new Database();
    $log = new Log($database);
    $system = new System($database, $log);
    $current_user = new User($database, $current_user, $log, 1);
    // admin
} catch (Exception $e) {
    $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
    $fatal_error = true;
}
/********************************************************************************
 *
 *   Database Update (if required and automatic updates are enabled)
 *
 *********************************************************************************/
if (!$fatal_error && $database->is_update_required()) {
    if ($database->get_current_version() < 13 && $database->get_latest_version() >= 13) {
        $config['db']['auto_update'] = false;
        $html->set_variable('auto_disabled_autoupdate', true, 'boolean');
    }
    $html->set_variable('database_update', true, 'boolean');
    $html->set_variable('disabled_autoupdate', !$config['db']['auto_update'], 'boolean');
    $html->set_variable('db_version_current', $database->get_current_version(), 'integer');
    $html->set_variable('db_version_latest', $database->get_latest_version(), 'integer');
    if ($config['db']['auto_update'] == true) {
        $update_log = $database->update();
        $html->set_variable('database_update_log', nl2br($update_log));
    }
}
/********************************************************************************
 *
コード例 #2
0
ファイル: navigation.php プロジェクト: AlexanderS/Part-DB
    $config['debug']['request_debugging_enable'] = isset($_REQUEST["enable_request_debugging"]);
    save_config();
    header('Location: navigation.php');
    // reload the navigation frame
}
/********************************************************************************
 *
 *   Initialize Objects
 *
 *********************************************************************************/
$html = new HTML($config['html']['theme'], $config['html']['custom_css'], 'Navigation');
try {
    $database = new Database();
    // The database is outdated, so an exception with a huge MySQL error message will be thrown somewhere in this file.
    // This is ugly, so we will only show something like "database update needed"
    if ($database->is_update_required()) {
        throw new Exception('Datenbank-Update notwendig!');
    }
    $log = new Log($database);
    $current_user = new User($database, $current_user, $log, 1);
    // admin
    $root_category = new Category($database, $current_user, $log, 0);
    $root_device = new Device($database, $current_user, $log, 0);
} catch (Exception $e) {
    $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
    $fatal_error = true;
}
/********************************************************************************
 *
 *   Build Navigation Trees
 *