1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 06:20:46 +02:00

- file_get_contents instead of imploding file()s or fread()ing till the maximum filesize

- language and style properly use compression
- language now prompts user for methods
- functions_compress does not need to eval() to get a hex date, instead calls pack()
- A writing method is defined at the end of tar operations only if data has been sent to the archive
- BBCode parser does not have to eval(), it instead uses the regex to loop around the matches

Hopefully nothing broke :-)


git-svn-id: file:///svn/phpbb/trunk@5422 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M
2006-01-04 06:37:17 +00:00
parent 6583da5bf0
commit 17dc26e19b
7 changed files with 38 additions and 68 deletions

View File

@@ -31,15 +31,7 @@ class compress
if (is_file($phpbb_root_path . $src))
{
if (!($fp = @fopen("$phpbb_root_path$src", 'rb')))
{
return false;
}
$data = fread($fp, filesize("$phpbb_root_path$src"));
fclose($fp);
$this->data($src_path, $data, false, stat("$phpbb_root_path$src"));
$this->data($src_path, file_get_contents("$phpbb_root_path$src"), false, stat("$phpbb_root_path$src"));
}
else if (is_dir($phpbb_root_path . $src))
{
@@ -73,7 +65,7 @@ class compress
continue;
}
$this->data("$src_path$path$file", implode('', file("$phpbb_root_path$src$path$file")), false, stat("$phpbb_root_path$src$path$file"));
$this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), false, stat("$phpbb_root_path$src$path$file"));
}
}
@@ -99,8 +91,8 @@ class compress
function methods()
{
$methods = array('tar');
$available_methods = array('tar.gz' => 'zlib', 'tar.bz2' => 'bz2', 'zip' => 'zlib');
$methods = array('.tar');
$available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib');
foreach ($available_methods as $type => $module)
{
@@ -314,8 +306,7 @@ class compress_zip extends compress
$name = str_replace('\\', '/', $name);
$dtime = dechex($this->unix_to_dos_time($stat[9]));
$hexdtime = '\x' . $dtime[6] . $dtime[7] . '\x' . $dtime[4] . $dtime[5] . '\x' . $dtime[2] . $dtime[3] . '\x' . $dtime[0] . $dtime[1];
eval('$hexdtime = "' . $hexdtime . '";');
$hexdtime = pack('H*', $dtime[6] . $dtime[7] . $dtime[4] . $dtime[5] . $dtime[2] . $dtime[3] . $dtime[0] . $dtime[1]);
if ($is_dir)
{
@@ -563,11 +554,11 @@ class compress_tar extends compress
function close()
{
$fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && extension_loaded('zlib')) ? 'gzwrite' : 'fwrite');
$fzclose = ($this->isbz && function_exists('bzclose')) ? 'bzclose' : (($this->isgz && extension_loaded('zlib')) ? 'gzclose' : 'fclose');
if ($this->wrote)
if ($this->wrote)
{
$fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && extension_loaded('zlib')) ? 'gzwrite' : 'fwrite');
$fzwrite($this->fp, pack("a1024", ""));
}