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