Exemplo n.º 1
0
    } else {
        $Template->assign_vars(array('L_INFO' => $LANG['db_restore_file']));
    }
} else {
    if ($action == 'backup') {
        $backup_type = !empty($_POST['backup_type']) && $_POST['backup_type'] != 'all' ? $_POST['backup_type'] == 'data' ? 2 : 3 : 1;
        $selected_tables = array();
        if (!isset($_POST['table_list']) || count($_POST['table_list']) == 0) {
            redirect(HOST . DIR . url('/database/admin_database.php?error=empty_list'));
        }
        foreach ($backup->get_tables_properties_list() as $table => $properties) {
            if (in_array($properties['name'], $_POST['table_list'])) {
                $selected_tables[] = $properties['name'];
            }
        }
        if (count($selected_tables) == $backup->get_tables_number()) {
            if ($backup_type != 2) {
                $backup->generate_drop_table_query();
                $backup->concatenate_to_query("\n\n");
                $backup->generate_create_table_query();
                $backup->concatenate_to_query("\n\n");
            }
            if ($backup_type != 3) {
                $backup->generate_insert_values_query();
            }
        } else {
            if ($backup_type != 2) {
                $backup->generate_drop_table_query($selected_tables);
                $backup->concatenate_to_query("\n\n");
                $backup->generate_create_table_query($selected_tables);
                $backup->concatenate_to_query("\n\n");