git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8505 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2008-04-20 04:39:04 +00:00
parent c1c3b9f912
commit 79c72890e6
2 changed files with 28 additions and 7 deletions

View file

@ -87,6 +87,7 @@
<ul> <ul>
<li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li> <li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li>
<li>[Fix] Fixed blank style on setups having no username defined within config.php (Bug #25065)</li> <li>[Fix] Fixed blank style on setups having no username defined within config.php (Bug #25065)</li>
<li>[Fix] Made the compress_tar class tolerate archives that do not properly have their archived contents listed (Bug #14429 / thanks to JRSweets for his patch)</li>
</ul> </ul>
<a name="v300"></a><h3>1.ii. Changes since 3.0.0</h3> <a name="v300"></a><h3>1.ii. Changes since 3.0.0</h3>

View file

@ -231,7 +231,7 @@ class compress_zip extends compress
} }
else else
{ {
// Some archivers are punks, they don't don't include folders in their archives! // Some archivers are punks, they don't include folders in their archives!
$str = ''; $str = '';
$folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME)); $folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME));
@ -507,12 +507,14 @@ class compress_tar extends compress
$tmp = unpack('A12size', substr($buffer, 124, 12)); $tmp = unpack('A12size', substr($buffer, 124, 12));
$filesize = octdec((int) trim($tmp['size'])); $filesize = octdec((int) trim($tmp['size']));
$target_filename = "$dst$filename";
if ($filetype == 5) if ($filetype == 5)
{ {
if (!is_dir("$dst$filename")) if (!is_dir($target_filename))
{ {
$str = ''; $str = '';
$folders = explode('/', "$dst$filename"); $folders = explode('/', $target_filename);
// Create and folders and subfolders if they do not exist // Create and folders and subfolders if they do not exist
foreach ($folders as $folder) foreach ($folders as $folder)
@ -529,17 +531,35 @@ class compress_tar extends compress
} }
} }
} }
else if ($filesize != 0 && ($filetype == 0 || $filetype == "\0")) else if ($filesize >= 0 && ($filetype == 0 || $filetype == "\0"))
{ {
// Some archivers are punks, they don't properly order the folders in their archives!
$str = '';
$folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME));
// Create and folders and subfolders if they do not exist
foreach ($folders as $folder)
{
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
if (!is_dir($str))
{
if (!@mkdir($str, 0777))
{
trigger_error("Could not create directory $folder");
}
@chmod($str, 0777);
}
}
// Write out the files // Write out the files
if (!($fp = fopen("$dst$filename", 'wb'))) if (!($fp = fopen($target_filename, 'wb')))
{ {
trigger_error("Couldn't create file $filename"); trigger_error("Couldn't create file $filename");
} }
@chmod("$dst$filename", 0777); @chmod($target_filename, 0777);
// Grab the file contents // Grab the file contents
fwrite($fp, $fzread($this->fp, ($filesize + 511) &~ 511), $filesize); fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize);
fclose($fp); fclose($fp);
} }
} }