Improved "open_basedir" handling
This commit is contained in:
@@ -11,6 +11,7 @@ $Source$
|
|||||||
- updated the FPDF library to the 1.5 revision;
|
- updated the FPDF library to the 1.5 revision;
|
||||||
- rewrote it to make it PHP3 and xhtml compliant;
|
- rewrote it to make it PHP3 and xhtml compliant;
|
||||||
- coding standards.
|
- coding standards.
|
||||||
|
* read_dump.php3, lines 245-252: improved the "open_basedir" handling.
|
||||||
|
|
||||||
2002-06-01 Alexander M. Turek <rabus@users.sourceforge.net>
|
2002-06-01 Alexander M. Turek <rabus@users.sourceforge.net>
|
||||||
* lang/indonesian.inc.php3: Updates, thanks to Rachim Tamsjadi.
|
* lang/indonesian.inc.php3: Updates, thanks to Rachim Tamsjadi.
|
||||||
|
@@ -229,7 +229,7 @@ if ($sql_file != 'none') {
|
|||||||
if (file_exists($sql_file) && is_uploaded_file($sql_file)) {
|
if (file_exists($sql_file) && is_uploaded_file($sql_file)) {
|
||||||
|
|
||||||
$open_basedir = '';
|
$open_basedir = '';
|
||||||
if (PMA_PHP_INT_VERSION >= 40000 ) {
|
if (PMA_PHP_INT_VERSION >= 40000) {
|
||||||
$open_basedir = @ini_get('open_basedir');
|
$open_basedir = @ini_get('open_basedir');
|
||||||
}
|
}
|
||||||
if (empty($open_basedir)) {
|
if (empty($open_basedir)) {
|
||||||
@@ -242,12 +242,14 @@ if ($sql_file != 'none') {
|
|||||||
|
|
||||||
if (!empty($open_basedir)) {
|
if (!empty($open_basedir)) {
|
||||||
// check if '.' is in open_basedir
|
// check if '.' is in open_basedir
|
||||||
$pos = strpos(' ' . $open_basedir, '.');
|
$split_char = (PMA_IS_WINDOWS ? ';' : ':');
|
||||||
|
$pos = ereg('(^|' . $split_char . ')\\.(' . $split_char . '|$)', $open_basedir);
|
||||||
|
|
||||||
// from the PHP annotated manual
|
// from the PHP annotated manual
|
||||||
if (!$pos) {
|
if (!$pos) {
|
||||||
// if no '.' in openbasedir, do not move the file, force the
|
// if no '.' in openbasedir, do not move the file (open_basedir
|
||||||
// error and let PHP report it
|
// may only be a prefix), force the error and let PHP reports
|
||||||
|
// it
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
$sql_query = fread(fopen($sql_file, 'r'), filesize($sql_file));
|
$sql_query = fread(fopen($sql_file, 'r'), filesize($sql_file));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user