Example #1
0
    if (is_demo_mode()) {
        print_cp_message('This function is disabled within demo mode');
    }
    if (!preg_match('#\\.sql$#i', $vbulletin->GPC['filename'])) {
        print_stop_message('backup_filename_must_end_with_sql');
    }
    if (file_exists($vbulletin->GPC['filename'])) {
        print_stop_message('file_x_already_exists', htmlspecialchars_uni($vbulletin->GPC['filename']));
    }
    $filehandle = @fopen($vbulletin->GPC['filename'], 'w');
    if (!$filehandle) {
        print_stop_message('unable_write_backup_file_x', htmlspecialchars_uni($vbulletin->GPC['filename']));
    }
    $result = $db->query_write('SHOW tables');
    while ($currow = $db->fetch_array($result, DBARRAY_NUM)) {
        fetch_table_dump_sql($currow[0], $filehandle);
        fwrite($filehandle, "\n\n\n");
        echo '<p>' . construct_phrase($vbphrase['processing_x'], $currow[0]) . '</p>';
        vbflush();
    }
    fwrite($filehandle, "\n\n\n### VBULLETIN DATABASE DUMP COMPLETED ###");
    fclose($filehandle);
    print_stop_message('completed_database_backup_successfully');
}
print_cp_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: www.vietvbb.vn
|| # CVS: $RCSfile$ - $Revision: 15976 $
|| ####################################################################
\*======================================================================*/
     header("Content-disposition: attachment; filename=\"" . preg_replace('#[\\r\\n]#', '', $vbulletin->GPC['table']) . ".csv\"");
     header("Content-type: text/plain");
     echo construct_csv_backup($vbulletin->GPC['table'], $vbulletin->GPC['separator'], $vbulletin->GPC['quotes'], $vbulletin->GPC['showhead']);
     exit;
 }
 // dump SQL table / database
 if ($_REQUEST['do'] == 'sqltable') {
     header("Content-type: text/plain");
     if (!empty($vbulletin->GPC['table']) and $vbulletin->GPC['table'] != 'all tables') {
         header("Content-disposition: attachment; filename=\"" . preg_replace('#[\\r\\n]#', '', $vbulletin->GPC['table']) . ".sql\"");
         echo fetch_table_dump_sql($vbulletin->GPC['table']);
     } else {
         header("Content-disposition: attachment; filename=\"vbulletin.sql\"");
         $result = $db->query_write("SHOW tables");
         while ($currow = $db->fetch_row($result)) {
             echo fetch_table_dump_sql($currow[0]) . "\n\n\n";
         }
     }
     echo "\r\n\r\n\r\n### {$upgradecore_phrases['vb_db_dump_completed']} ###";
     exit;
 }
 if ($_REQUEST['do'] == 'choose') {
     print_upgrade_header();
     echo '</div>';
     print_form_header('', '');
     print_table_header($upgradecode_phrases['vb_database_backup_system']);
     print_description_row($upgradecore_phrases['dump_database_desc']);
     print_table_footer();
     $sqltable = array('all tables' => $upgradecore_phrases['dump_all_tables']);
     $tables = $db->query_write("SHOW TABLES");
     while ($table = $db->fetch_array($tables, DBARRAY_NUM)) {
Example #3
0
function dump()
{
    global $mysqlHandle, $action, $dbname, $tablename;
    if ($action == "dumpTable") {
        header("Content-disposition: filename={$tablename}.sql");
        header('Content-type: unknown/unknown');
        fetch_table_dump_sql($tablename);
        echo "\n\n\n";
        echo "\r\n\r\n\r\n### {$tablename} TABLE DUMP COMPLETED ###";
        exit;
    } else {
        header("Content-disposition: filename={$dbname}.sql");
        header('Content-type: unknown/unknown');
        mysql_select_db($dbname, $mysqlHandle);
        $query_id = mysql_query("SHOW tables", $mysqlHandle);
        while ($row = mysql_fetch_array($query_id, MYSQL_NUM)) {
            fetch_table_dump_sql($row[0]);
            echo "\n\n\n";
            echo "\r\n\r\n\r\n### {$row['0']} TABLE DUMP COMPLETED ###";
            echo "\n\n\n";
        }
        echo "\r\n\r\n\r\n### {$dbname} DATABASE DUMP COMPLETED ###";
        exit;
    }
}