- Patch #861566 by p.brouwers: use uppercase for PHP constants, e.g. NULL, TRUE, FALSE.
parent
076002833c
commit
002ca866d5
|
@ -33,7 +33,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
|
||||||
|
|
||||||
// PostgreSQL in trust mode doesn't require a password to be supplied.
|
// PostgreSQL in trust mode doesn't require a password to be supplied.
|
||||||
if (empty($connection_options['password'])) {
|
if (empty($connection_options['password'])) {
|
||||||
$connection_options['password'] = null;
|
$connection_options['password'] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->connectionOptions = $connection_options;
|
$this->connectionOptions = $connection_options;
|
||||||
|
|
|
@ -1050,5 +1050,5 @@ function db_run_tasks($driver) {
|
||||||
$task_class = 'DatabaseTasks_' . $driver;
|
$task_class = 'DatabaseTasks_' . $driver;
|
||||||
$DatabaseTasks = new $task_class();
|
$DatabaseTasks = new $task_class();
|
||||||
$DatabaseTasks->runTasks();
|
$DatabaseTasks->runTasks();
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,9 @@ class Archive_Tar
|
||||||
var $_tarname='';
|
var $_tarname='';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean if true, the Tar file will be gzipped
|
* @var boolean if TRUE, the Tar file will be gzipped
|
||||||
*/
|
*/
|
||||||
var $_compress=false;
|
var $_compress=FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Type of compression : 'none', 'gz' or 'bz2'
|
* @var string Type of compression : 'none', 'gz' or 'bz2'
|
||||||
|
@ -95,12 +95,12 @@ class Archive_Tar
|
||||||
* @param string $p_compress can be null, 'gz' or 'bz2'. This
|
* @param string $p_compress can be null, 'gz' or 'bz2'. This
|
||||||
* parameter indicates if gzip or bz2 compression
|
* parameter indicates if gzip or bz2 compression
|
||||||
* is required. For compatibility reason the
|
* is required. For compatibility reason the
|
||||||
* boolean value 'true' means 'gz'.
|
* boolean value 'TRUE' means 'gz'.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function __construct($p_tarname, $p_compress = null)
|
function __construct($p_tarname, $p_compress = null)
|
||||||
{
|
{
|
||||||
$this->_compress = false;
|
$this->_compress = FALSE;
|
||||||
$this->_compress_type = 'none';
|
$this->_compress_type = 'none';
|
||||||
if (($p_compress === null) || ($p_compress == '')) {
|
if (($p_compress === null) || ($p_compress == '')) {
|
||||||
if (@file_exists($p_tarname)) {
|
if (@file_exists($p_tarname)) {
|
||||||
|
@ -109,11 +109,11 @@ class Archive_Tar
|
||||||
$data = fread($fp, 2);
|
$data = fread($fp, 2);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if ($data == "\37\213") {
|
if ($data == "\37\213") {
|
||||||
$this->_compress = true;
|
$this->_compress = TRUE;
|
||||||
$this->_compress_type = 'gz';
|
$this->_compress_type = 'gz';
|
||||||
// No sure it's enought for a magic code ....
|
// No sure it's enought for a magic code ....
|
||||||
} elseif ($data == "BZ") {
|
} elseif ($data == "BZ") {
|
||||||
$this->_compress = true;
|
$this->_compress = TRUE;
|
||||||
$this->_compress_type = 'bz2';
|
$this->_compress_type = 'bz2';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,25 +121,25 @@ class Archive_Tar
|
||||||
// probably a remote file or some file accessible
|
// probably a remote file or some file accessible
|
||||||
// through a stream interface
|
// through a stream interface
|
||||||
if (substr($p_tarname, -2) == 'gz') {
|
if (substr($p_tarname, -2) == 'gz') {
|
||||||
$this->_compress = true;
|
$this->_compress = TRUE;
|
||||||
$this->_compress_type = 'gz';
|
$this->_compress_type = 'gz';
|
||||||
} elseif ((substr($p_tarname, -3) == 'bz2') ||
|
} elseif ((substr($p_tarname, -3) == 'bz2') ||
|
||||||
(substr($p_tarname, -2) == 'bz')) {
|
(substr($p_tarname, -2) == 'bz')) {
|
||||||
$this->_compress = true;
|
$this->_compress = TRUE;
|
||||||
$this->_compress_type = 'bz2';
|
$this->_compress_type = 'bz2';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (($p_compress === true) || ($p_compress == 'gz')) {
|
if (($p_compress === TRUE) || ($p_compress == 'gz')) {
|
||||||
$this->_compress = true;
|
$this->_compress = TRUE;
|
||||||
$this->_compress_type = 'gz';
|
$this->_compress_type = 'gz';
|
||||||
} else if ($p_compress == 'bz2') {
|
} else if ($p_compress == 'bz2') {
|
||||||
$this->_compress = true;
|
$this->_compress = TRUE;
|
||||||
$this->_compress_type = 'bz2';
|
$this->_compress_type = 'bz2';
|
||||||
} else {
|
} else {
|
||||||
die("Unsupported compression type '$p_compress'\n".
|
die("Unsupported compression type '$p_compress'\n".
|
||||||
"Supported types are 'gz' and 'bz2'.\n");
|
"Supported types are 'gz' and 'bz2'.\n");
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_tarname = $p_tarname;
|
$this->_tarname = $p_tarname;
|
||||||
|
@ -156,7 +156,7 @@ class Archive_Tar
|
||||||
die("The extension '$extname' couldn't be found.\n".
|
die("The extension '$extname' couldn't be found.\n".
|
||||||
"Make sure your version of PHP was built ".
|
"Make sure your version of PHP was built ".
|
||||||
"with '$extname' support.\n");
|
"with '$extname' support.\n");
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,9 +172,9 @@ class Archive_Tar
|
||||||
function loadExtension($ext)
|
function loadExtension($ext)
|
||||||
{
|
{
|
||||||
if (!extension_loaded($ext)) {
|
if (!extension_loaded($ext)) {
|
||||||
// if either returns true dl() will produce a FATAL error, stop that
|
// if either returns TRUE dl() will produce a FATAL error, stop that
|
||||||
if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
|
if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OS_WINDOWS) {
|
if (OS_WINDOWS) {
|
||||||
|
@ -192,7 +192,7 @@ class Archive_Tar
|
||||||
return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
|
return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class Archive_Tar
|
||||||
* that are listed in $p_filelist.
|
* that are listed in $p_filelist.
|
||||||
* If a file with the same name exist and is writable, it is replaced
|
* If a file with the same name exist and is writable, it is replaced
|
||||||
* by the new tar.
|
* by the new tar.
|
||||||
* The method return false and a PEAR error text.
|
* The method return FALSE and a PEAR error text.
|
||||||
* The $p_filelist parameter can be an array of string, each string
|
* The $p_filelist parameter can be an array of string, each string
|
||||||
* representing a filename or a directory name with their path if
|
* representing a filename or a directory name with their path if
|
||||||
* needed. It can also be a single string with names separated by a
|
* needed. It can also be a single string with names separated by a
|
||||||
|
@ -224,7 +224,7 @@ class Archive_Tar
|
||||||
* @param array $p_filelist An array of filenames and directory names, or a
|
* @param array $p_filelist An array of filenames and directory names, or a
|
||||||
* single string with names separated by a single
|
* single string with names separated by a single
|
||||||
* blank space.
|
* blank space.
|
||||||
* @return true on success, false on error.
|
* @return TRUE on success, FALSE on error.
|
||||||
* @see createModify()
|
* @see createModify()
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -238,7 +238,7 @@ class Archive_Tar
|
||||||
/**
|
/**
|
||||||
* This method add the files / directories that are listed in $p_filelist in
|
* This method add the files / directories that are listed in $p_filelist in
|
||||||
* the archive. If the archive does not exist it is created.
|
* the archive. If the archive does not exist it is created.
|
||||||
* The method return false and a PEAR error text.
|
* The method return FALSE and a PEAR error text.
|
||||||
* The files and directories listed are only added at the end of the archive,
|
* The files and directories listed are only added at the end of the archive,
|
||||||
* even if a file with the same name is already archived.
|
* even if a file with the same name is already archived.
|
||||||
* See also createModify() method for more details.
|
* See also createModify() method for more details.
|
||||||
|
@ -246,7 +246,7 @@ class Archive_Tar
|
||||||
* @param array $p_filelist An array of filenames and directory names, or a
|
* @param array $p_filelist An array of filenames and directory names, or a
|
||||||
* single string with names separated by a single
|
* single string with names separated by a single
|
||||||
* blank space.
|
* blank space.
|
||||||
* @return true on success, false on error.
|
* @return TRUE on success, FALSE on error.
|
||||||
* @see createModify()
|
* @see createModify()
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -287,7 +287,7 @@ class Archive_Tar
|
||||||
* If the file already exists and is writable, it is replaced by the
|
* If the file already exists and is writable, it is replaced by the
|
||||||
* new tar. It is a create and not an add. If the file exists and is
|
* new tar. It is a create and not an add. If the file exists and is
|
||||||
* read-only or is a directory it is not replaced. The method return
|
* read-only or is a directory it is not replaced. The method return
|
||||||
* false and a PEAR error text.
|
* FALSE and a PEAR error text.
|
||||||
* The $p_filelist parameter can be an array of string, each string
|
* The $p_filelist parameter can be an array of string, each string
|
||||||
* representing a filename or a directory name with their path if
|
* representing a filename or a directory name with their path if
|
||||||
* needed. It can also be a single string with names separated by a
|
* needed. It can also be a single string with names separated by a
|
||||||
|
@ -312,16 +312,16 @@ class Archive_Tar
|
||||||
* @param string $p_remove_dir A string which contains a path to be
|
* @param string $p_remove_dir A string which contains a path to be
|
||||||
* removed from the memorized path of each
|
* removed from the memorized path of each
|
||||||
* element in the list, when relevant.
|
* element in the list, when relevant.
|
||||||
* @return boolean true on success, false on error.
|
* @return boolean TRUE on success, FALSE on error.
|
||||||
* @access public
|
* @access public
|
||||||
* @see addModify()
|
* @see addModify()
|
||||||
*/
|
*/
|
||||||
function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
|
function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = TRUE;
|
||||||
|
|
||||||
if (!$this->_openWrite())
|
if (!$this->_openWrite())
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
if ($p_filelist != '') {
|
if ($p_filelist != '') {
|
||||||
if (is_array($p_filelist))
|
if (is_array($p_filelist))
|
||||||
|
@ -331,7 +331,7 @@ class Archive_Tar
|
||||||
else {
|
else {
|
||||||
$this->_cleanFile();
|
$this->_cleanFile();
|
||||||
$this->_error('Invalid file list');
|
$this->_error('Invalid file list');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
|
$v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
|
||||||
|
@ -385,12 +385,12 @@ class Archive_Tar
|
||||||
* removed from the memorized path of
|
* removed from the memorized path of
|
||||||
* each element in the list, when
|
* each element in the list, when
|
||||||
* relevant.
|
* relevant.
|
||||||
* @return true on success, false on error.
|
* @return TRUE on success, FALSE on error.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
|
function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = TRUE;
|
||||||
|
|
||||||
if (!$this->_isArchive())
|
if (!$this->_isArchive())
|
||||||
$v_result = $this->createModify($p_filelist, $p_add_dir,
|
$v_result = $this->createModify($p_filelist, $p_add_dir,
|
||||||
|
@ -402,7 +402,7 @@ class Archive_Tar
|
||||||
$v_list = explode($this->_separator, $p_filelist);
|
$v_list = explode($this->_separator, $p_filelist);
|
||||||
else {
|
else {
|
||||||
$this->_error('Invalid file list');
|
$this->_error('Invalid file list');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
|
$v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
|
||||||
|
@ -423,22 +423,22 @@ class Archive_Tar
|
||||||
* with the string.
|
* with the string.
|
||||||
* @param string $p_string The content of the file added in
|
* @param string $p_string The content of the file added in
|
||||||
* the archive.
|
* the archive.
|
||||||
* @return true on success, false on error.
|
* @return TRUE on success, FALSE on error.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function addString($p_filename, $p_string)
|
function addString($p_filename, $p_string)
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = TRUE;
|
||||||
|
|
||||||
if (!$this->_isArchive()) {
|
if (!$this->_isArchive()) {
|
||||||
if (!$this->_openWrite()) {
|
if (!$this->_openWrite()) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
$this->_close();
|
$this->_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->_openAppend())
|
if (!$this->_openAppend())
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
// Need to check the get back to the temporary file ? ....
|
// Need to check the get back to the temporary file ? ....
|
||||||
$v_result = $this->_addString($p_filename, $p_string);
|
$v_result = $this->_addString($p_filename, $p_string);
|
||||||
|
@ -472,7 +472,7 @@ class Archive_Tar
|
||||||
* the extraction is aborted.
|
* the extraction is aborted.
|
||||||
* If after extraction an extracted file does not show the correct
|
* If after extraction an extracted file does not show the correct
|
||||||
* stored file size, the extraction is aborted.
|
* stored file size, the extraction is aborted.
|
||||||
* When the extraction is aborted, a PEAR error text is set and false
|
* When the extraction is aborted, a PEAR error text is set and FALSE
|
||||||
* is returned. However the result can be a partial extraction that may
|
* is returned. However the result can be a partial extraction that may
|
||||||
* need to be manually cleaned.
|
* need to be manually cleaned.
|
||||||
*
|
*
|
||||||
|
@ -481,13 +481,13 @@ class Archive_Tar
|
||||||
* @param string $p_remove_path Part of the memorized path that can be
|
* @param string $p_remove_path Part of the memorized path that can be
|
||||||
* removed if present at the beginning of
|
* removed if present at the beginning of
|
||||||
* the file/dir path.
|
* the file/dir path.
|
||||||
* @return boolean true on success, false on error.
|
* @return boolean TRUE on success, FALSE on error.
|
||||||
* @access public
|
* @access public
|
||||||
* @see extractList()
|
* @see extractList()
|
||||||
*/
|
*/
|
||||||
function extractModify($p_path, $p_remove_path)
|
function extractModify($p_path, $p_remove_path)
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = TRUE;
|
||||||
$v_list_detail = array();
|
$v_list_detail = array();
|
||||||
|
|
||||||
if ($v_result = $this->_openRead()) {
|
if ($v_result = $this->_openRead()) {
|
||||||
|
@ -536,13 +536,13 @@ class Archive_Tar
|
||||||
* @param string $p_remove_path Part of the memorized path that can be
|
* @param string $p_remove_path Part of the memorized path that can be
|
||||||
* removed if present at the beginning of
|
* removed if present at the beginning of
|
||||||
* the file/dir path.
|
* the file/dir path.
|
||||||
* @return true on success, false on error.
|
* @return TRUE on success, FALSE on error.
|
||||||
* @access public
|
* @access public
|
||||||
* @see extractModify()
|
* @see extractModify()
|
||||||
*/
|
*/
|
||||||
function extractList($p_filelist, $p_path='', $p_remove_path='')
|
function extractList($p_filelist, $p_path='', $p_remove_path='')
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = TRUE;
|
||||||
$v_list_detail = array();
|
$v_list_detail = array();
|
||||||
|
|
||||||
if (is_array($p_filelist))
|
if (is_array($p_filelist))
|
||||||
|
@ -551,7 +551,7 @@ class Archive_Tar
|
||||||
$v_list = explode($this->_separator, $p_filelist);
|
$v_list = explode($this->_separator, $p_filelist);
|
||||||
else {
|
else {
|
||||||
$this->_error('Invalid string list');
|
$this->_error('Invalid string list');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($v_result = $this->_openRead()) {
|
if ($v_result = $this->_openRead()) {
|
||||||
|
@ -570,16 +570,16 @@ class Archive_Tar
|
||||||
* list of parameters, in the format attribute code + attribute values :
|
* list of parameters, in the format attribute code + attribute values :
|
||||||
* $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
|
* $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
|
||||||
* @param mixed $argv variable list of attributes and values
|
* @param mixed $argv variable list of attributes and values
|
||||||
* @return true on success, false on error.
|
* @return TRUE on success, FALSE on error.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function setAttribute()
|
function setAttribute()
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = TRUE;
|
||||||
|
|
||||||
// ----- Get the number of variable list of arguments
|
// ----- Get the number of variable list of arguments
|
||||||
if (($v_size = func_num_args()) == 0) {
|
if (($v_size = func_num_args()) == 0) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Get the arguments
|
// ----- Get the arguments
|
||||||
|
@ -597,7 +597,7 @@ class Archive_Tar
|
||||||
if (($i+1) >= $v_size) {
|
if (($i+1) >= $v_size) {
|
||||||
$this->_error('Invalid number of parameters for '
|
$this->_error('Invalid number of parameters for '
|
||||||
.'attribute ARCHIVE_TAR_ATT_SEPARATOR');
|
.'attribute ARCHIVE_TAR_ATT_SEPARATOR');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Get the value
|
// ----- Get the value
|
||||||
|
@ -607,7 +607,7 @@ class Archive_Tar
|
||||||
|
|
||||||
default :
|
default :
|
||||||
$this->_error('Unknow attribute code '.$v_att_list[$i].'');
|
$this->_error('Unknow attribute code '.$v_att_list[$i].'');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Next attribute
|
// ----- Next attribute
|
||||||
|
@ -661,10 +661,10 @@ class Archive_Tar
|
||||||
if ($this->_file == 0) {
|
if ($this->_file == 0) {
|
||||||
$this->_error('Unable to open in write mode \''
|
$this->_error('Unable to open in write mode \''
|
||||||
.$this->_tarname.'\'');
|
.$this->_tarname.'\'');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -680,13 +680,13 @@ class Archive_Tar
|
||||||
$this->_error('Unable to open in read mode \''
|
$this->_error('Unable to open in read mode \''
|
||||||
.$this->_tarname.'\'');
|
.$this->_tarname.'\'');
|
||||||
$this->_temp_tarname = '';
|
$this->_temp_tarname = '';
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
|
if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
|
||||||
$this->_error('Unable to open in write mode \''
|
$this->_error('Unable to open in write mode \''
|
||||||
.$this->_temp_tarname.'\'');
|
.$this->_temp_tarname.'\'');
|
||||||
$this->_temp_tarname = '';
|
$this->_temp_tarname = '';
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
while ($v_data = @fread($v_file_from, 1024))
|
while ($v_data = @fread($v_file_from, 1024))
|
||||||
@fwrite($v_file_to, $v_data);
|
@fwrite($v_file_to, $v_data);
|
||||||
|
@ -713,10 +713,10 @@ class Archive_Tar
|
||||||
|
|
||||||
if ($this->_file == 0) {
|
if ($this->_file == 0) {
|
||||||
$this->_error('Unable to open in read mode \''.$v_filename.'\'');
|
$this->_error('Unable to open in read mode \''.$v_filename.'\'');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -728,7 +728,7 @@ class Archive_Tar
|
||||||
else if ($this->_compress_type == 'bz2') {
|
else if ($this->_compress_type == 'bz2') {
|
||||||
$this->_error('Unable to open bz2 in read/write mode \''
|
$this->_error('Unable to open bz2 in read/write mode \''
|
||||||
.$this->_tarname.'\' (limitation of bz2 extension)');
|
.$this->_tarname.'\' (limitation of bz2 extension)');
|
||||||
return false;
|
return FALSE;
|
||||||
} else if ($this->_compress_type == 'none')
|
} else if ($this->_compress_type == 'none')
|
||||||
$this->_file = @fopen($this->_tarname, "r+b");
|
$this->_file = @fopen($this->_tarname, "r+b");
|
||||||
else
|
else
|
||||||
|
@ -738,10 +738,10 @@ class Archive_Tar
|
||||||
if ($this->_file == 0) {
|
if ($this->_file == 0) {
|
||||||
$this->_error('Unable to open in read/write mode \''
|
$this->_error('Unable to open in read/write mode \''
|
||||||
.$this->_tarname.'\'');
|
.$this->_tarname.'\'');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ class Archive_Tar
|
||||||
$this->_temp_tarname = '';
|
$this->_temp_tarname = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -790,7 +790,7 @@ class Archive_Tar
|
||||||
}
|
}
|
||||||
$this->_tarname = '';
|
$this->_tarname = '';
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -821,7 +821,7 @@ class Archive_Tar
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -865,7 +865,7 @@ class Archive_Tar
|
||||||
.$this->_compress_type.')');
|
.$this->_compress_type.')');
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -877,27 +877,27 @@ class Archive_Tar
|
||||||
$v_binary_data = pack('a1024', '');
|
$v_binary_data = pack('a1024', '');
|
||||||
$this->_writeBlock($v_binary_data);
|
$this->_writeBlock($v_binary_data);
|
||||||
}
|
}
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ _addList()
|
// {{{ _addList()
|
||||||
function _addList($p_list, $p_add_dir, $p_remove_dir)
|
function _addList($p_list, $p_add_dir, $p_remove_dir)
|
||||||
{
|
{
|
||||||
$v_result=true;
|
$v_result=TRUE;
|
||||||
$v_header = array();
|
$v_header = array();
|
||||||
|
|
||||||
// ----- Remove potential windows directory separator
|
// ----- Remove potential windows directory separator
|
||||||
$p_add_dir = $this->_translateWinPath($p_add_dir);
|
$p_add_dir = $this->_translateWinPath($p_add_dir);
|
||||||
$p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
|
$p_remove_dir = $this->_translateWinPath($p_remove_dir, FALSE);
|
||||||
|
|
||||||
if (!$this->_file) {
|
if (!$this->_file) {
|
||||||
$this->_error('Invalid file descriptor');
|
$this->_error('Invalid file descriptor');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof($p_list) == 0)
|
if (sizeof($p_list) == 0)
|
||||||
return true;
|
return TRUE;
|
||||||
|
|
||||||
foreach ($p_list as $v_filename) {
|
foreach ($p_list as $v_filename) {
|
||||||
if (!$v_result) {
|
if (!$v_result) {
|
||||||
|
@ -918,14 +918,14 @@ class Archive_Tar
|
||||||
|
|
||||||
// ----- Add the file or directory header
|
// ----- Add the file or directory header
|
||||||
if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
|
if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
if (@is_dir($v_filename) && !@is_link($v_filename)) {
|
if (@is_dir($v_filename) && !@is_link($v_filename)) {
|
||||||
if (!($p_hdir = opendir($v_filename))) {
|
if (!($p_hdir = opendir($v_filename))) {
|
||||||
$this->_warning("Directory '$v_filename' can not be read");
|
$this->_warning("Directory '$v_filename' can not be read");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
while (false !== ($p_hitem = readdir($p_hdir))) {
|
while (FALSE !== ($p_hitem = readdir($p_hdir))) {
|
||||||
if (($p_hitem != '.') && ($p_hitem != '..')) {
|
if (($p_hitem != '.') && ($p_hitem != '..')) {
|
||||||
if ($v_filename != ".")
|
if ($v_filename != ".")
|
||||||
$p_temp_list[0] = $v_filename.'/'.$p_hitem;
|
$p_temp_list[0] = $v_filename.'/'.$p_hitem;
|
||||||
|
@ -953,19 +953,19 @@ class Archive_Tar
|
||||||
{
|
{
|
||||||
if (!$this->_file) {
|
if (!$this->_file) {
|
||||||
$this->_error('Invalid file descriptor');
|
$this->_error('Invalid file descriptor');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($p_filename == '') {
|
if ($p_filename == '') {
|
||||||
$this->_error('Invalid file name');
|
$this->_error('Invalid file name');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Calculate the stored filename
|
// ----- Calculate the stored filename
|
||||||
$p_filename = $this->_translateWinPath($p_filename, false);
|
$p_filename = $this->_translateWinPath($p_filename, FALSE);
|
||||||
$v_stored_filename = $p_filename;
|
$v_stored_filename = $p_filename;
|
||||||
if (strcmp($p_filename, $p_remove_dir) == 0) {
|
if (strcmp($p_filename, $p_remove_dir) == 0) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if ($p_remove_dir != '') {
|
if ($p_remove_dir != '') {
|
||||||
if (substr($p_remove_dir, -1) != '/')
|
if (substr($p_remove_dir, -1) != '/')
|
||||||
|
@ -988,11 +988,11 @@ class Archive_Tar
|
||||||
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
||||||
$this->_warning("Unable to open file '".$p_filename
|
$this->_warning("Unable to open file '".$p_filename
|
||||||
."' in binary read mode");
|
."' in binary read mode");
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->_writeHeader($p_filename, $v_stored_filename))
|
if (!$this->_writeHeader($p_filename, $v_stored_filename))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
while (($v_buffer = fread($v_file, 512)) != '') {
|
while (($v_buffer = fread($v_file, 512)) != '') {
|
||||||
$v_binary_data = pack("a512", "$v_buffer");
|
$v_binary_data = pack("a512", "$v_buffer");
|
||||||
|
@ -1004,10 +1004,10 @@ class Archive_Tar
|
||||||
} else {
|
} else {
|
||||||
// ----- Only header for dir
|
// ----- Only header for dir
|
||||||
if (!$this->_writeHeader($p_filename, $v_stored_filename))
|
if (!$this->_writeHeader($p_filename, $v_stored_filename))
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1016,20 +1016,20 @@ class Archive_Tar
|
||||||
{
|
{
|
||||||
if (!$this->_file) {
|
if (!$this->_file) {
|
||||||
$this->_error('Invalid file descriptor');
|
$this->_error('Invalid file descriptor');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($p_filename == '') {
|
if ($p_filename == '') {
|
||||||
$this->_error('Invalid file name');
|
$this->_error('Invalid file name');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Calculate the stored filename
|
// ----- Calculate the stored filename
|
||||||
$p_filename = $this->_translateWinPath($p_filename, false);
|
$p_filename = $this->_translateWinPath($p_filename, FALSE);
|
||||||
|
|
||||||
if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
|
if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
|
||||||
time(), 384, "", 0, 0))
|
time(), 384, "", 0, 0))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
|
while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
|
||||||
|
@ -1037,7 +1037,7 @@ class Archive_Tar
|
||||||
$this->_writeBlock($v_binary_data);
|
$this->_writeBlock($v_binary_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1050,7 +1050,7 @@ class Archive_Tar
|
||||||
|
|
||||||
if (strlen($v_reduce_filename) > 99) {
|
if (strlen($v_reduce_filename) > 99) {
|
||||||
if (!$this->_writeLongHeader($v_reduce_filename))
|
if (!$this->_writeLongHeader($v_reduce_filename))
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_info = lstat($p_filename);
|
$v_info = lstat($p_filename);
|
||||||
|
@ -1120,7 +1120,7 @@ class Archive_Tar
|
||||||
// ----- Write the last 356 bytes of the header in the archive
|
// ----- Write the last 356 bytes of the header in the archive
|
||||||
$this->_writeBlock($v_binary_data_last, 356);
|
$this->_writeBlock($v_binary_data_last, 356);
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1132,7 +1132,7 @@ class Archive_Tar
|
||||||
|
|
||||||
if (strlen($p_filename) > 99) {
|
if (strlen($p_filename) > 99) {
|
||||||
if (!$this->_writeLongHeader($p_filename))
|
if (!$this->_writeLongHeader($p_filename))
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($p_type == "5") {
|
if ($p_type == "5") {
|
||||||
|
@ -1194,7 +1194,7 @@ class Archive_Tar
|
||||||
// ----- Write the last 356 bytes of the header in the archive
|
// ----- Write the last 356 bytes of the header in the archive
|
||||||
$this->_writeBlock($v_binary_data_last, 356);
|
$this->_writeBlock($v_binary_data_last, 356);
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ class Archive_Tar
|
||||||
$this->_writeBlock($v_binary_data);
|
$this->_writeBlock($v_binary_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1267,13 +1267,13 @@ class Archive_Tar
|
||||||
{
|
{
|
||||||
if (strlen($v_binary_data)==0) {
|
if (strlen($v_binary_data)==0) {
|
||||||
$v_header['filename'] = '';
|
$v_header['filename'] = '';
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($v_binary_data) != 512) {
|
if (strlen($v_binary_data) != 512) {
|
||||||
$v_header['filename'] = '';
|
$v_header['filename'] = '';
|
||||||
$this->_error('Invalid block size : '.strlen($v_binary_data));
|
$this->_error('Invalid block size : '.strlen($v_binary_data));
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($v_header)) {
|
if (!is_array($v_header)) {
|
||||||
|
@ -1303,12 +1303,12 @@ class Archive_Tar
|
||||||
|
|
||||||
// ----- Look for last block (empty block)
|
// ----- Look for last block (empty block)
|
||||||
if (($v_checksum == 256) && ($v_header['checksum'] == 0))
|
if (($v_checksum == 256) && ($v_header['checksum'] == 0))
|
||||||
return true;
|
return TRUE;
|
||||||
|
|
||||||
$this->_error('Invalid checksum for file "'.$v_data['filename']
|
$this->_error('Invalid checksum for file "'.$v_data['filename']
|
||||||
.'" : '.$v_checksum.' calculated, '
|
.'" : '.$v_checksum.' calculated, '
|
||||||
.$v_header['checksum'].' expected');
|
.$v_header['checksum'].' expected');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Extract the properties
|
// ----- Extract the properties
|
||||||
|
@ -1316,7 +1316,7 @@ class Archive_Tar
|
||||||
if ($this->_maliciousFilename($v_header['filename'])) {
|
if ($this->_maliciousFilename($v_header['filename'])) {
|
||||||
$this->_error('Malicious .tar detected, file "' . $v_header['filename'] .
|
$this->_error('Malicious .tar detected, file "' . $v_header['filename'] .
|
||||||
'" will not install in desired directory tree');
|
'" will not install in desired directory tree');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
$v_header['mode'] = OctDec(trim($v_data['mode']));
|
$v_header['mode'] = OctDec(trim($v_data['mode']));
|
||||||
$v_header['uid'] = OctDec(trim($v_data['uid']));
|
$v_header['uid'] = OctDec(trim($v_data['uid']));
|
||||||
|
@ -1337,7 +1337,7 @@ class Archive_Tar
|
||||||
$v_header[devminor] = trim($v_data[devminor]);
|
$v_header[devminor] = trim($v_data[devminor]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1351,13 +1351,13 @@ class Archive_Tar
|
||||||
*/
|
*/
|
||||||
function _maliciousFilename($file)
|
function _maliciousFilename($file)
|
||||||
{
|
{
|
||||||
if (strpos($file, '/../') !== false) {
|
if (strpos($file, '/../') !== FALSE) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (strpos($file, '../') === 0) {
|
if (strpos($file, '../') === 0) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1379,17 +1379,17 @@ class Archive_Tar
|
||||||
$v_binary_data = $this->_readBlock();
|
$v_binary_data = $this->_readBlock();
|
||||||
|
|
||||||
if (!$this->_readHeader($v_binary_data, $v_header))
|
if (!$this->_readHeader($v_binary_data, $v_header))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
$v_filename = trim($v_filename);
|
$v_filename = trim($v_filename);
|
||||||
$v_header['filename'] = $v_filename;
|
$v_header['filename'] = $v_filename;
|
||||||
if ($this->_maliciousFilename($v_filename)) {
|
if ($this->_maliciousFilename($v_filename)) {
|
||||||
$this->_error('Malicious .tar detected, file "' . $v_filename .
|
$this->_error('Malicious .tar detected, file "' . $v_filename .
|
||||||
'" will not install in desired directory tree');
|
'" will not install in desired directory tree');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1449,12 +1449,12 @@ class Archive_Tar
|
||||||
function _extractList($p_path, &$p_list_detail, $p_mode,
|
function _extractList($p_path, &$p_list_detail, $p_mode,
|
||||||
$p_file_list, $p_remove_path)
|
$p_file_list, $p_remove_path)
|
||||||
{
|
{
|
||||||
$v_result=true;
|
$v_result=TRUE;
|
||||||
$v_nb = 0;
|
$v_nb = 0;
|
||||||
$v_extract_all = true;
|
$v_extract_all = TRUE;
|
||||||
$v_listing = false;
|
$v_listing = FALSE;
|
||||||
|
|
||||||
$p_path = $this->_translateWinPath($p_path, false);
|
$p_path = $this->_translateWinPath($p_path, FALSE);
|
||||||
if ($p_path == '' || (substr($p_path, 0, 1) != '/'
|
if ($p_path == '' || (substr($p_path, 0, 1) != '/'
|
||||||
&& substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
|
&& substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
|
||||||
$p_path = "./".$p_path;
|
$p_path = "./".$p_path;
|
||||||
|
@ -1481,7 +1481,7 @@ class Archive_Tar
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
$this->_error('Invalid extract mode ('.$p_mode.')');
|
$this->_error('Invalid extract mode ('.$p_mode.')');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
@ -1492,7 +1492,7 @@ class Archive_Tar
|
||||||
$v_extraction_stopped = 0;
|
$v_extraction_stopped = 0;
|
||||||
|
|
||||||
if (!$this->_readHeader($v_binary_data, $v_header))
|
if (!$this->_readHeader($v_binary_data, $v_header))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
if ($v_header['filename'] == '') {
|
if ($v_header['filename'] == '') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1501,12 +1501,12 @@ class Archive_Tar
|
||||||
// ----- Look for long filename
|
// ----- Look for long filename
|
||||||
if ($v_header['typeflag'] == 'L') {
|
if ($v_header['typeflag'] == 'L') {
|
||||||
if (!$this->_readLongHeader($v_header))
|
if (!$this->_readLongHeader($v_header))
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!$v_extract_all) && (is_array($p_file_list))) {
|
if ((!$v_extract_all) && (is_array($p_file_list))) {
|
||||||
// ----- By default no unzip if the file is not found
|
// ----- By default no unzip if the file is not found
|
||||||
$v_extract_file = false;
|
$v_extract_file = FALSE;
|
||||||
|
|
||||||
for ($i=0; $i<sizeof($p_file_list); $i++) {
|
for ($i=0; $i<sizeof($p_file_list); $i++) {
|
||||||
// ----- Look if it is a directory
|
// ----- Look if it is a directory
|
||||||
|
@ -1552,18 +1552,18 @@ class Archive_Tar
|
||||||
&& ($v_header['typeflag'] == '')) {
|
&& ($v_header['typeflag'] == '')) {
|
||||||
$this->_error('File '.$v_header['filename']
|
$this->_error('File '.$v_header['filename']
|
||||||
.' already exists as a directory');
|
.' already exists as a directory');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ( ($this->_isArchive($v_header['filename']))
|
if ( ($this->_isArchive($v_header['filename']))
|
||||||
&& ($v_header['typeflag'] == "5")) {
|
&& ($v_header['typeflag'] == "5")) {
|
||||||
$this->_error('Directory '.$v_header['filename']
|
$this->_error('Directory '.$v_header['filename']
|
||||||
.' already exists as a file');
|
.' already exists as a file');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!is_writeable($v_header['filename'])) {
|
if (!is_writeable($v_header['filename'])) {
|
||||||
$this->_error('File '.$v_header['filename']
|
$this->_error('File '.$v_header['filename']
|
||||||
.' already exists and is write protected');
|
.' already exists and is write protected');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (filemtime($v_header['filename']) > $v_header['mtime']) {
|
if (filemtime($v_header['filename']) > $v_header['mtime']) {
|
||||||
// To be completed : An error or silent no replace ?
|
// To be completed : An error or silent no replace ?
|
||||||
|
@ -1576,7 +1576,7 @@ class Archive_Tar
|
||||||
?$v_header['filename']
|
?$v_header['filename']
|
||||||
:dirname($v_header['filename'])))) != 1) {
|
:dirname($v_header['filename'])))) != 1) {
|
||||||
$this->_error('Unable to create path for '.$v_header['filename']);
|
$this->_error('Unable to create path for '.$v_header['filename']);
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($v_extract_file) {
|
if ($v_extract_file) {
|
||||||
|
@ -1585,7 +1585,7 @@ class Archive_Tar
|
||||||
if (!@drupal_mkdir($v_header['filename'], 0777)) {
|
if (!@drupal_mkdir($v_header['filename'], 0777)) {
|
||||||
$this->_error('Unable to create directory {'
|
$this->_error('Unable to create directory {'
|
||||||
.$v_header['filename'].'}');
|
.$v_header['filename'].'}');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($v_header['typeflag'] == "2") {
|
} elseif ($v_header['typeflag'] == "2") {
|
||||||
|
@ -1595,13 +1595,13 @@ class Archive_Tar
|
||||||
if (!@symlink($v_header['link'], $v_header['filename'])) {
|
if (!@symlink($v_header['link'], $v_header['filename'])) {
|
||||||
$this->_error('Unable to extract symbolic link {'
|
$this->_error('Unable to extract symbolic link {'
|
||||||
.$v_header['filename'].'}');
|
.$v_header['filename'].'}');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
|
if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
|
||||||
$this->_error('Error while opening {'.$v_header['filename']
|
$this->_error('Error while opening {'.$v_header['filename']
|
||||||
.'} in write binary mode');
|
.'} in write binary mode');
|
||||||
return false;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
$n = floor($v_header['size']/512);
|
$n = floor($v_header['size']/512);
|
||||||
for ($i=0; $i<$n; $i++) {
|
for ($i=0; $i<$n; $i++) {
|
||||||
|
@ -1632,7 +1632,7 @@ class Archive_Tar
|
||||||
.filesize($v_header['filename'])
|
.filesize($v_header['filename'])
|
||||||
.'\' ('.$v_header['size']
|
.'\' ('.$v_header['size']
|
||||||
.' expected). Archive may be corrupted.');
|
.' expected). Archive may be corrupted.');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1659,12 +1659,12 @@ class Archive_Tar
|
||||||
|
|
||||||
$p_list_detail[$v_nb++] = $v_header;
|
$p_list_detail[$v_nb++] = $v_header;
|
||||||
if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
|
if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1681,7 +1681,7 @@ class Archive_Tar
|
||||||
$this->_error('Error while renaming \''.$this->_tarname
|
$this->_error('Error while renaming \''.$this->_tarname
|
||||||
.'\' to temporary file \''.$this->_tarname
|
.'\' to temporary file \''.$this->_tarname
|
||||||
.'.tmp\'');
|
.'.tmp\'');
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_compress_type == 'gz')
|
if ($this->_compress_type == 'gz')
|
||||||
|
@ -1693,12 +1693,12 @@ class Archive_Tar
|
||||||
$this->_error('Unable to open file \''.$this->_tarname
|
$this->_error('Unable to open file \''.$this->_tarname
|
||||||
.'.tmp\' in binary read mode');
|
.'.tmp\' in binary read mode');
|
||||||
@rename($this->_tarname.".tmp", $this->_tarname);
|
@rename($this->_tarname.".tmp", $this->_tarname);
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->_openWrite()) {
|
if (!$this->_openWrite()) {
|
||||||
@rename($this->_tarname.".tmp", $this->_tarname);
|
@rename($this->_tarname.".tmp", $this->_tarname);
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_compress_type == 'gz') {
|
if ($this->_compress_type == 'gz') {
|
||||||
|
@ -1736,7 +1736,7 @@ class Archive_Tar
|
||||||
// ----- For not compressed tar, just add files before the last
|
// ----- For not compressed tar, just add files before the last
|
||||||
// one or two 512 bytes block
|
// one or two 512 bytes block
|
||||||
if (!$this->_openReadWrite())
|
if (!$this->_openReadWrite())
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$v_size = filesize($this->_tarname);
|
$v_size = filesize($this->_tarname);
|
||||||
|
@ -1753,7 +1753,7 @@ class Archive_Tar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1761,14 +1761,14 @@ class Archive_Tar
|
||||||
function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
|
function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
|
||||||
{
|
{
|
||||||
if (!$this->_openAppend())
|
if (!$this->_openAppend())
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
|
if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
|
||||||
$this->_writeFooter();
|
$this->_writeFooter();
|
||||||
|
|
||||||
$this->_close();
|
$this->_close();
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
@ -1786,21 +1786,21 @@ class Archive_Tar
|
||||||
{
|
{
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
if ((@is_dir($p_dir)) || ($p_dir == ''))
|
if ((@is_dir($p_dir)) || ($p_dir == ''))
|
||||||
return true;
|
return TRUE;
|
||||||
|
|
||||||
$p_parent_dir = dirname($p_dir);
|
$p_parent_dir = dirname($p_dir);
|
||||||
|
|
||||||
if (($p_parent_dir != $p_dir) &&
|
if (($p_parent_dir != $p_dir) &&
|
||||||
($p_parent_dir != '') &&
|
($p_parent_dir != '') &&
|
||||||
(!$this->_dirCheck($p_parent_dir)))
|
(!$this->_dirCheck($p_parent_dir)))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
if (!@drupal_mkdir($p_dir, 0777)) {
|
if (!@drupal_mkdir($p_dir, 0777)) {
|
||||||
$this->_error("Unable to create directory '$p_dir'");
|
$this->_error("Unable to create directory '$p_dir'");
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
@ -1856,12 +1856,12 @@ class Archive_Tar
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ _translateWinPath()
|
// {{{ _translateWinPath()
|
||||||
function _translateWinPath($p_path, $p_remove_disk_letter=true)
|
function _translateWinPath($p_path, $p_remove_disk_letter=TRUE)
|
||||||
{
|
{
|
||||||
if (defined('OS_WINDOWS') && OS_WINDOWS) {
|
if (defined('OS_WINDOWS') && OS_WINDOWS) {
|
||||||
// ----- Look for potential disk letter
|
// ----- Look for potential disk letter
|
||||||
if ( ($p_remove_disk_letter)
|
if ( ($p_remove_disk_letter)
|
||||||
&& (($v_position = strpos($p_path, ':')) != false)) {
|
&& (($v_position = strpos($p_path, ':')) != FALSE)) {
|
||||||
$p_path = substr($p_path, $v_position+1);
|
$p_path = substr($p_path, $v_position+1);
|
||||||
}
|
}
|
||||||
// ----- Change potential windows directory separator
|
// ----- Change potential windows directory separator
|
||||||
|
|
Loading…
Reference in New Issue