mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
Fixed bug in split_sql_file.
git-svn-id: file:///svn/phpbb/trunk@795 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1a9142c4c5
commit
b71aee15ab
1 changed files with 22 additions and 4 deletions
|
@ -67,6 +67,7 @@ else if( $userdata['user_level'] != ADMIN )
|
||||||
//
|
//
|
||||||
define("VERBOSE", 0);
|
define("VERBOSE", 0);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Increase maximum execution time, but don't complain about it if it isn't
|
// Increase maximum execution time, but don't complain about it if it isn't
|
||||||
// allowed.
|
// allowed.
|
||||||
|
@ -713,10 +714,14 @@ function split_sql_file($sql, $delimiter)
|
||||||
$last_char = "";
|
$last_char = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($last_char == $in_string && $char == ")")
|
//
|
||||||
|
// Added lat $sql[$i-2] != "\\" to fix potential problem with restore..
|
||||||
|
//
|
||||||
|
if($last_char == $in_string && $char == ")" && $sql[$i-2] != "\\")
|
||||||
{
|
{
|
||||||
$in_string = false;
|
$in_string = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($char == $in_string && $last_char != "\\")
|
if($char == $in_string && $last_char != "\\")
|
||||||
{
|
{
|
||||||
|
@ -944,17 +949,28 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//
|
||||||
// Handle the file upload ....
|
// Handle the file upload ....
|
||||||
|
// If no file was uploaded report an error...
|
||||||
|
//
|
||||||
if($backup_file == "none")
|
if($backup_file == "none")
|
||||||
{
|
{
|
||||||
include('page_header_admin.'.$phpEx);
|
include('page_header_admin.'.$phpEx);
|
||||||
message_die(GENERAL_ERROR, "Backup file upload failed");
|
message_die(GENERAL_ERROR, "Backup file upload failed");
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// If I file was actually uploaded, check to make sure that we
|
||||||
|
// are actually passed the name of an uploaded file, and not
|
||||||
|
// a hackers attempt at getting us to process a local system
|
||||||
|
// file.
|
||||||
|
//
|
||||||
if(ereg("^php[0-9A-Za-z_.-]+$", basename($backup_file)))
|
if(ereg("^php[0-9A-Za-z_.-]+$", basename($backup_file)))
|
||||||
{
|
{
|
||||||
$sql_query = fread(fopen($backup_file, 'r'), filesize($backup_file));
|
$sql_query = fread(fopen($backup_file, 'r'), filesize($backup_file));
|
||||||
$sql_query = stripslashes($sql_query);
|
//
|
||||||
|
// Comment this line out to see if this fixes the stuff...
|
||||||
|
//
|
||||||
|
//$sql_query = stripslashes($sql_query);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -979,6 +995,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
|
||||||
if(VERBOSE == 1)
|
if(VERBOSE == 1)
|
||||||
{
|
{
|
||||||
echo "Executing: $sql\n<br>";
|
echo "Executing: $sql\n<br>";
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
@ -986,7 +1003,8 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
|
||||||
if(!$result && ( !(SQL_LAYER == 'postgres' && eregi("drop table", $sql) ) ) )
|
if(!$result && ( !(SQL_LAYER == 'postgres' && eregi("drop table", $sql) ) ) )
|
||||||
{
|
{
|
||||||
include('page_header_admin.'.$phpEx);
|
include('page_header_admin.'.$phpEx);
|
||||||
message_die(GENERAL_ERROR, "Error importing backup file", "", __LINE__, __FILE__, $sql);
|
|
||||||
|
message_die(GENERAL_ERROR, "Error importing backup file", "", __LINE__, __FILE__, mysql_error() ."<br>". $sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue