示例#1
0
    error_page("Can't connect to database server");
}
if (!$db->table_exists('bossa_app')) {
    admin_page_head("Create Bossa database");
    $db_name = $db->db_name;
    echo "\n        The database tables for Bossa don't seem to exist.\n        To create them, go to ~/boinc/db and type\n        <pre>\nmysql {$db_name} < bossa_schema.sql\nmysql {$db_name} < bossa_constraints.sql\n</pre>\n    Then <a href=bossa_admin.php>reload this page</a>.\n    ";
    admin_page_tail();
    exit;
}
BossaUser::lookup($user);
$action = get_str('action', true);
switch ($action) {
    case 'add_app':
        $name = BossaDb::escape_string(get_str('app_name'));
        $short_name = get_str('short_name');
        $description = BossaDb::escape_string(get_str('description'));
        $training_course = get_str('training_course', true);
        if (strlen($training_course)) {
            $course = BoltCourse::lookup_name($training_course);
            if (!$course) {
                error_page("No course named {$training_course}");
            }
            $courseid = $course->id;
        } else {
            $courseid = 0;
        }
        $time_estimate = get_str('time_estimate');
        if (!$time_estimate) {
            $time_estimate = 60;
        }
        $time_limit = get_str('time_limit');