Vergleich admin/dbtools.php - 1.2.0 - 1.2.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 66Zeile 66
	{
cperror($lang->error_no_tables_selected);
}

	{
cperror($lang->error_no_tables_selected);
}

 
	
@set_time_limit(0);

	
if($mybb->input['write'] == 'disk')
{
$file = MYBB_ADMIN_DIR.'backups/backup_'.substr(md5($mybb->user['uid'].time().random_str()), 0, 10);


	
if($mybb->input['write'] == 'disk')
{
$file = MYBB_ADMIN_DIR.'backups/backup_'.substr(md5($mybb->user['uid'].time().random_str()), 0, 10);


		if($mybb->input['type'] == 'gzip')
{

		if($mybb->input['type'] == 'gzip')
{

			if(!function_exists('gzopen')) // check zlib-ness
{
cperror($lang->error_no_zlib);

			if(!function_exists('gzopen')) // check zlib-ness
{
cperror($lang->error_no_zlib);

Zeile 83Zeile 85
		else
{
$fp = fopen($file.'.sql', 'w');

		else
{
$fp = fopen($file.'.sql', 'w');

		}
}

		}
}

	else
{
$file = 'backup_'.substr(md5($mybb->user['uid'].time().random_str()), 0, 10);

	else
{
$file = 'backup_'.substr(md5($mybb->user['uid'].time().random_str()), 0, 10);

Zeile 94Zeile 96
			header('Content-Encoding: x-gzip');
header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="'.$file.'.gz"');

			header('Content-Encoding: x-gzip');
header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="'.$file.'.gz"');

		}
else
{

		}
else
{

			// Send standard headers for .sql
header('Content-Type: text/x-sql');
header('Content-Disposition: attachment; filename="'.$file.'.sql"');
}
}


			// Send standard headers for .sql
header('Content-Type: text/x-sql');
header('Content-Disposition: attachment; filename="'.$file.'.sql"');
}
}


	$time = date('dS F Y \a\t H:i', time());
$header = "-- MyBB Database Backup\n-- Generated: ".$time."\n---------------------------------------\n\n";

if($mybb->input['write'] == 'disk')
{
if($mybb->input['type'] == 'gzip')
{
gzwrite($fp, $header, strlen($header));
}
else
{
fputs($fp, $header, strlen($header));
}
}
else
{
if($mybb->input['type'] == 'gzip')
{
echo gzencode($header);
}
else
{
echo $header;
}
}


	$time = date('dS F Y \a\t H:i', time());
$header = "-- MyBB Database Backup\n-- Generated: ".$time."\n-- -------------------------------------\n\n";
$contents = $header;
























	foreach($mybb->input['tables'] as $table)
{
$field_list = array();

	foreach($mybb->input['tables'] as $table)
{
$field_list = array();

Zeile 140Zeile 119
		$fields = implode(",", $field_list);
if($mybb->input['contents'] != 'data')
{

		$fields = implode(",", $field_list);
if($mybb->input['contents'] != 'data')
{

			$structure = $db->show_create_table($table)."\n";
if($mybb->input['write'] == 'disk')
{
if($type == 'gzip')
{
gzwrite($fp, $structure, strlen($structure));
}
else
{
fputs($fp, $structure, strlen($structure));
}
}
else
{
if($mybb->input['type'] == 'gzip')
{
echo gzencode($structure);
}
else
{
echo $structure;
}
}

			$structure = $db->show_create_table($table).";\n";
$contents .= $structure;
seq_backup($fp, $contents);





















		}
if($mybb->input['contents'] != 'structure')
{

		}
if($mybb->input['contents'] != 'structure')
{

Zeile 173Zeile 132
				$comma = '';
foreach($field_list as $field)
{

				$comma = '';
foreach($field_list as $field)
{

					if(!isset($row[$field]))

					if(!isset($row[$field]) || trim($row[$field]) == "")

					{

					{

						$insert .= $comma.'NULL';

						$insert .= $comma."''";

					}
else
{

					}
else
{

Zeile 183Zeile 142
					}
$comma = ',';
}

					}
$comma = ',';
}

				$insert .= ")\n";
if($mybb->input['write'] == 'disk')
{
if($type == 'gzip')
{
gzwrite($fp, $insert, strlen($insert));
}
else
{
fputs($fp, $insert, strlen($insert));
}
}
else
{
if($mybb->input['type'] == 'gzip')
{
echo gzencode($insert);
}
else
{
echo $insert;
}
}

				$insert .= ");\n";
$contents .= $insert;
seq_backup($fp, $contents);





















			}
}
}

			}
}
}

Zeile 214Zeile 153
	{
if($mybb->input['type'] == 'gzip')
{

	{
if($mybb->input['type'] == 'gzip')
{

 
			gzwrite($fp, $contents);

			gzclose($fp);
}
else
{

			gzclose($fp);
}
else
{

 
			fwrite($fp, $contents);

			fclose($fp);
}

if($mybb->input['type'] == 'gzip')

			fclose($fp);
}

if($mybb->input['type'] == 'gzip')

		{

		{

			$ext = '.gz';
}
else

			$ext = '.gz';
}
else

Zeile 233Zeile 174
		$file_from_admindir = 'dbtools.php?'.SID.'&action=dlbackup&file='.basename($file).$ext;
$lang->backup_complete = sprintf($lang->backup_complete, $file.$ext, $file_from_admindir);
cpmessage($lang->backup_complete);

		$file_from_admindir = 'dbtools.php?'.SID.'&action=dlbackup&file='.basename($file).$ext;
$lang->backup_complete = sprintf($lang->backup_complete, $file.$ext, $file_from_admindir);
cpmessage($lang->backup_complete);

 
	}
else
{
if($mybb->input['type'] == "gzip")
{
echo gzencode($contents);
}
else
{
echo $contents;
}

	}
}


	}
}


Zeile 373Zeile 325
if($mybb->input['action'] == 'optimize')
{
$plugins->run_hooks("admin_dbtools_optimize");

if($mybb->input['action'] == 'optimize')
{
$plugins->run_hooks("admin_dbtools_optimize");

	cpheader();
echo "<script type=\"text/javascript\" language=\"Javascript\">
function changeSelection(action, prefix)
{
var select_box = document.getElementById('table_select');

for(var i = 0; i < select_box.length; i++)
{
if(action == 'select')
{

	cpheader();
echo "<script type=\"text/javascript\" language=\"Javascript\">
function changeSelection(action, prefix)
{
var select_box = document.getElementById('table_select');

for(var i = 0; i < select_box.length; i++)
{
if(action == 'select')
{

					document.table_selection.table_select[i].selected = true;
}
else if(action == 'deselect')

					document.table_selection.table_select[i].selected = true;
}
else if(action == 'deselect')

Zeile 482Zeile 434
	$bgcolor = getaltbg();
echo "<tr>\n";
echo "<td class=\"$bgcolor\">".$lang->export_file_type."</td>\n";

	$bgcolor = getaltbg();
echo "<tr>\n";
echo "<td class=\"$bgcolor\">".$lang->export_file_type."</td>\n";

	echo "<td class=\"$bgcolor\">\n";

	echo "<td class=\"$bgcolor\">\n";

	if(function_exists("gzwrite") && function_exists("gzencode"))
{
echo "<label><input type=\"radio\" name=\"type\" value=\"gzip\" checked=\"checked\" /> ".$lang->gzip_compressed."</label><br />\n";

	if(function_exists("gzwrite") && function_exists("gzencode"))
{
echo "<label><input type=\"radio\" name=\"type\" value=\"gzip\" checked=\"checked\" /> ".$lang->gzip_compressed."</label><br />\n";

Zeile 491Zeile 443
	else
{
echo "<label><input type=\"radio\" name=\"type\" value=\"text\" checked=\"checked\" /> ".$lang->plain_text."</label>\n";

	else
{
echo "<label><input type=\"radio\" name=\"type\" value=\"text\" checked=\"checked\" /> ".$lang->plain_text."</label>\n";

	}
echo "</td>\n";
echo "</tr>\n";
$bgcolor = getaltbg();

	}
echo "</td>\n";
echo "</tr>\n";
$bgcolor = getaltbg();

	echo "<tr>\n";
echo "<td class=\"$bgcolor\">".$lang->download_save."</td>\n";
echo "<td class=\"$bgcolor\">\n";

	echo "<tr>\n";
echo "<td class=\"$bgcolor\">".$lang->download_save."</td>\n";
echo "<td class=\"$bgcolor\">\n";

Zeile 512Zeile 464
	echo "</td>\n";
echo "</tr>\n";
makeyesnocode($lang->analyse_optimise, 'analyse');

	echo "</td>\n";
echo "</tr>\n";
makeyesnocode($lang->analyse_optimise, 'analyse');

 
	makeyesnocode($lang->sequential_backup, 'sequential_backup');

	endtable();
endform($lang->perform_backup);
cpfooter();

	endtable();
endform($lang->perform_backup);
cpfooter();

 
}

function seq_backup($fp, &$contents)
{
global $mybb;

if($mybb->input['sequential_backup'] == 'yes')
{
if($mybb->input['write'] == 'disk')
{
if($mybb->input['type'] == 'gzip')
{
gzwrite($fp, $contents);
}
else
{
fwrite($fp, $contents);
}
}
else
{
if($mybb->input['type'] == "gzip")
{
echo gzencode($contents);
}
else
{
echo $contents;
}
}

$contents = '';
}

}
?>

}
?>