Zeile 94 | Zeile 94 |
---|
if($mybb->input['action'] == "delete") {
|
if($mybb->input['action'] == "delete") {
|
if($mybb->input['no'])
| if($mybb->get_input('no'))
|
{ admin_redirect("index.php?module=tools-backupdb"); }
$file = basename($mybb->input['file']);
|
{ admin_redirect("index.php?module=tools-backupdb"); }
$file = basename($mybb->input['file']);
|
| $ext = get_extension($file);
|
|
|
if(!trim($mybb->input['file']) || !file_exists(MYBB_ADMIN_DIR.'backups/'.$file))
| if(!trim($mybb->input['file']) || !file_exists(MYBB_ADMIN_DIR.'backups/'.$file) || filetype(MYBB_ADMIN_DIR.'backups/'.$file) != 'file' || ($ext != 'gz' && $ext != 'sql'))
|
{ flash_message($lang->error_backup_doesnt_exist, 'error'); admin_redirect("index.php?module=tools-backupdb");
| { flash_message($lang->error_backup_doesnt_exist, 'error'); admin_redirect("index.php?module=tools-backupdb");
|
Zeile 141 | Zeile 142 |
---|
if($mybb->request_method == "post") {
|
if($mybb->request_method == "post") {
|
if(!is_array($mybb->input['tables']))
| if(empty($mybb->input['tables']) || !is_array($mybb->input['tables']))
|
{ flash_message($lang->error_tables_not_selected, 'error'); admin_redirect("index.php?module=tools-backupdb&action=backup"); }
@set_time_limit(0);
|
{ flash_message($lang->error_tables_not_selected, 'error'); admin_redirect("index.php?module=tools-backupdb&action=backup"); }
@set_time_limit(0);
|
| // create an array with table prefix appended for checks, as full table names are accepted $binary_fields_prefixed = array(); foreach($mybb->binary_fields as $table => $fields) { $binary_fields_prefixed[TABLE_PREFIX.$table] = $fields; }
|
if($mybb->input['method'] == 'disk') {
| if($mybb->input['method'] == 'disk') {
|
Zeile 174 | Zeile 182 |
---|
if($mybb->input['filetype'] == 'gzip') { if(!function_exists('gzopen')) // check zlib-ness
|
if($mybb->input['filetype'] == 'gzip') { if(!function_exists('gzopen')) // check zlib-ness
|
{
| {
|
flash_message($lang->error_no_zlib, 'error'); admin_redirect("index.php?module=tools-backupdb&action=backup"); }
// Send headers for gzip file
|
flash_message($lang->error_no_zlib, 'error'); admin_redirect("index.php?module=tools-backupdb&action=backup"); }
// Send headers for gzip file
|
header('Content-Encoding: gzip');
| |
header('Content-Type: application/x-gzip'); header('Content-Disposition: attachment; filename="'.$file.'.sql.gz"'); }
| header('Content-Type: application/x-gzip'); header('Content-Disposition: attachment; filename="'.$file.'.sql.gz"'); }
|
Zeile 201 | Zeile 208 |
---|
if(!$db->table_exists($db->escape_string($table))) { continue;
|
if(!$db->table_exists($db->escape_string($table))) { continue;
|
}
| }
|
if($mybb->input['analyzeoptimize'] == 1)
|
if($mybb->input['analyzeoptimize'] == 1)
|
{
| {
|
$db->optimize_table($table); $db->analyze_table($table);
|
$db->optimize_table($table); $db->analyze_table($table);
|
}
| }
|
$field_list = array(); $fields_array = $db->show_fields_from($table); foreach($fields_array as $field) { $field_list[] = $field['Field'];
|
$field_list = array(); $fields_array = $db->show_fields_from($table); foreach($fields_array as $field) { $field_list[] = $field['Field'];
|
}
| }
|
$fields = "`".implode("`,`", $field_list)."`"; if($mybb->input['contents'] != 'data') { $structure = $db->show_create_table($table).";\n"; $contents .= $structure;
|
$fields = "`".implode("`,`", $field_list)."`"; if($mybb->input['contents'] != 'data') { $structure = $db->show_create_table($table).";\n"; $contents .= $structure;
|
clear_overflow($fp, $contents);
| if(isset($fp)) { clear_overflow($fp, $contents); }
|
}
if($mybb->input['contents'] != 'structure')
| }
if($mybb->input['contents'] != 'structure')
|
Zeile 228 | Zeile 239 |
---|
if($db->engine == 'mysqli') { $query = mysqli_query($db->read_link, "SELECT * FROM {$db->table_prefix}{$table}", MYSQLI_USE_RESULT);
|
if($db->engine == 'mysqli') { $query = mysqli_query($db->read_link, "SELECT * FROM {$db->table_prefix}{$table}", MYSQLI_USE_RESULT);
|
}
| }
|
else
|
else
|
{
| {
|
$query = $db->simple_select($table); }
| $query = $db->simple_select($table); }
|
Zeile 241 | Zeile 252 |
---|
foreach($field_list as $field) { if(!isset($row[$field]) || is_null($row[$field]))
|
foreach($field_list as $field) { if(!isset($row[$field]) || is_null($row[$field]))
|
{
| {
|
$insert .= $comma."NULL";
|
$insert .= $comma."NULL";
|
} else if($db->engine == 'mysqli') { $insert .= $comma."'".mysqli_real_escape_string($db->read_link, $row[$field])."'";
| |
} else {
|
} else {
|
$insert .= $comma."'".$db->escape_string($row[$field])."'";
| if($db->engine == 'mysqli') { if(!empty($binary_fields_prefixed[$table][$field])) { $insert .= $comma."X'".mysqli_real_escape_string($db->read_link, bin2hex($row[$field]))."'"; } else { $insert .= $comma."'".mysqli_real_escape_string($db->read_link, $row[$field])."'"; } } else { if(!empty($binary_fields_prefixed[$table][$field])) { $insert .= $comma.$db->escape_binary($db->unescape_binary($row[$field])); } else { $insert .= $comma."'".$db->escape_string($row[$field])."'"; } }
|
} $comma = ',';
|
} $comma = ',';
|
}
| }
|
$insert .= ");\n"; $contents .= $insert;
|
$insert .= ");\n"; $contents .= $insert;
|
clear_overflow($fp, $contents);
| if(isset($fp)) { clear_overflow($fp, $contents); }
|
} $db->free_result($query); }
| } $db->free_result($query); }
|