renamed class files according to PMA standard (or at least how i guess)

This commit is contained in:
Sebastian Mendel
2007-05-15 06:18:21 +00:00
parent f00ee2474f
commit c5cba195f1
6 changed files with 52 additions and 10 deletions

View File

@@ -429,16 +429,24 @@ class PMA_File
{ {
if ($this->setUploadedFromTblChangeRequest($key, $primary_key)) { if ($this->setUploadedFromTblChangeRequest($key, $primary_key)) {
// well done ... // well done ...
$this->_error_message = '';
return true; return true;
/*
} elseif ($this->setUploadedFromTblChangeRequest($key)) { } elseif ($this->setUploadedFromTblChangeRequest($key)) {
// well done ... // well done ...
$this->_error_message = '';
return true; return true;
*/
} elseif ($this->setSelectedFromTblChangeRequest($key, $primary_key)) { } elseif ($this->setSelectedFromTblChangeRequest($key, $primary_key)) {
// well done ... // well done ...
$this->_error_message = '';
return true; return true;
/*
} elseif ($this->setSelectedFromTblChangeRequest($key)) { } elseif ($this->setSelectedFromTblChangeRequest($key)) {
// well done ... // well done ...
$this->_error_message = '';
return true; return true;
*/
} }
// all failed, whether just no file uploaded/selected or an error // all failed, whether just no file uploaded/selected or an error
@@ -625,9 +633,10 @@ class PMA_File
$this->_compression = 'application/bzip2'; $this->_compression = 'application/bzip2';
} elseif ($len >= 4 && $test == "PK\003\004") { } elseif ($len >= 4 && $test == "PK\003\004") {
$this->_compression = 'application/zip'; $this->_compression = 'application/zip';
} else {
$this->_compression = 'none';
} }
$this->_compression = 'none';
return $this->_compression; return $this->_compression;
} }
@@ -641,6 +650,9 @@ class PMA_File
function getHandle() function getHandle()
{ {
if (null === $this->_handle) {
$this->open();
}
return $this->_handle; return $this->_handle;
} }
@@ -751,6 +763,11 @@ class PMA_File
} }
} }
/**
* http://bugs.php.net/bug.php?id=29532
* bzip reads a maximum of 8192 bytes on windows systems
*
*/
function getNextChunk($max_size = null) function getNextChunk($max_size = null)
{ {
if (null !== $max_size) { if (null !== $max_size) {
@@ -760,22 +777,45 @@ class PMA_File
} }
// $result = $this->handler->getNextChunk($size); // $result = $this->handler->getNextChunk($size);
$result = '';
switch ($this->getCompression()) { switch ($this->getCompression()) {
case 'application/bzip2': case 'application/bzip2':
$result = bzread($this->getHandle(), $size); $result = '';
while (strlen($result) < $size - 8192 && ! feof($this->getHandle())) {
$result .= bzread($this->getHandle(), $size);
}
break; break;
case 'application/gzip': case 'application/gzip':
$result = gzread($this->getHandle(), $size); $result = gzread($this->getHandle(), $size);
break; break;
case 'application/zip': case 'application/zip':
$result = $this->getContent($this->getOffset(), $this->_offset, $size); include_once './libraries/unzip.lib.php';
$import_handle = new SimpleUnzip();
$import_handle->ReadFile($this->getName());
if ($import_handle->Count() == 0) {
$this->_error_message = $GLOBALS['strNoFilesFoundInZip'];
return false;
} elseif ($import_handle->GetError(0) != 0) {
$this->_error_message = $GLOBALS['strErrorInZipFile']
. ' ' . $import_handle->GetErrorMsg(0);
return false;
} else {
$result = $import_handle->GetData(0);
}
break; break;
case 'none': case 'none':
$result = fread($this->getHandle(), $size); $result = fread($this->getHandle(), $size);
break; break;
default:
return false;
} }
echo $size . ' - ';
echo strlen($result) . ' - ';
echo (@$GLOBALS['__len__'] += strlen($result)) . ' - ';
echo $this->_error_message;
echo '<hr />';
if ($GLOBALS['charset_conversion']) { if ($GLOBALS['charset_conversion']) {
$result = PMA_convert_string($this->getCharset(), $GLOBALS['charset'], $result); $result = PMA_convert_string($this->getCharset(), $GLOBALS['charset'], $result);
} else { } else {
@@ -799,7 +839,9 @@ class PMA_File
} }
$this->_offset += $size; $this->_offset += $size;
if (0 === $result) {
return true;
}
return $result; return $result;
} }

View File

@@ -9,7 +9,7 @@
/** /**
* the list base class * the list base class
*/ */
require_once './libraries/PMA_List.class.php'; require_once './libraries/List.class.php';
/** /**
* handles database lists * handles database lists

View File

@@ -834,7 +834,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/** /**
* the PMA_List_Database class * the PMA_List_Database class
*/ */
require_once './libraries/PMA_List_Database.class.php'; require_once './libraries/List_Database.class.php';
$PMA_List_Database = new PMA_List_Database($userlink, $controllink); $PMA_List_Database = new PMA_List_Database($userlink, $controllink);
} // end server connecting } // end server connecting

View File

@@ -40,7 +40,7 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
* Gets some core libraries * Gets some core libraries
*/ */
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
require_once './libraries/PMA_File.class.php'; require_once './libraries/File.class.php';
$file_to_insert = new PMA_File(); $file_to_insert = new PMA_File();
$file_to_insert->checkTblChangeForm($key, $primary_key); $file_to_insert->checkTblChangeForm($key, $primary_key);