mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
safer name for the updater downloads (even if removed after download) - reported by SHS`
git-svn-id: file:///svn/phpbb/trunk@7134 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1070cf800f
commit
f0755f6daf
2 changed files with 20 additions and 8 deletions
|
@ -419,15 +419,20 @@ class compress_zip extends compress
|
||||||
/**
|
/**
|
||||||
* Download archive
|
* Download archive
|
||||||
*/
|
*/
|
||||||
function download($filename)
|
function download($filename, $download_name = false)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
|
if ($download_name === false)
|
||||||
|
{
|
||||||
|
$download_name = $filename;
|
||||||
|
}
|
||||||
|
|
||||||
$mimetype = 'application/zip';
|
$mimetype = 'application/zip';
|
||||||
|
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header("Content-Type: $mimetype; name=\"$filename.zip\"");
|
header("Content-Type: $mimetype; name=\"$download_name.zip\"");
|
||||||
header("Content-disposition: attachment; filename=$filename.zip");
|
header("Content-disposition: attachment; filename=$download_name.zip");
|
||||||
|
|
||||||
$fp = fopen("{$phpbb_root_path}store/$filename.zip", 'rb');
|
$fp = fopen("{$phpbb_root_path}store/$filename.zip", 'rb');
|
||||||
while ($buffer = fread($fp, 1024))
|
while ($buffer = fread($fp, 1024))
|
||||||
|
@ -611,10 +616,15 @@ class compress_tar extends compress
|
||||||
/**
|
/**
|
||||||
* Download archive
|
* Download archive
|
||||||
*/
|
*/
|
||||||
function download($filename)
|
function download($filename, $download_name = false)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
|
if ($download_name === false)
|
||||||
|
{
|
||||||
|
$download_name = $filename;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($this->type)
|
switch ($this->type)
|
||||||
{
|
{
|
||||||
case '.tar':
|
case '.tar':
|
||||||
|
@ -635,8 +645,8 @@ class compress_tar extends compress
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header("Content-Type: $mimetype; name=\"$filename$this->type\"");
|
header("Content-Type: $mimetype; name=\"$download_name$this->type\"");
|
||||||
header("Content-disposition: attachment; filename=$filename$this->type");
|
header("Content-disposition: attachment; filename=$download_name$this->type");
|
||||||
|
|
||||||
$fp = fopen("{$phpbb_root_path}store/$filename$this->type", 'rb');
|
$fp = fopen("{$phpbb_root_path}store/$filename$this->type", 'rb');
|
||||||
while ($buffer = fread($fp, 1024))
|
while ($buffer = fread($fp, 1024))
|
||||||
|
|
|
@ -590,7 +590,9 @@ class install_update extends module
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now update the installation or download the archive...
|
// Now update the installation or download the archive...
|
||||||
$archive_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to'];
|
$download_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to'];
|
||||||
|
$archive_filename = $download_filename . '_' . time() . '_' . unique_id();
|
||||||
|
|
||||||
$update_list = $cache->get('_update_list');
|
$update_list = $cache->get('_update_list');
|
||||||
$conflicts = request_var('conflict', array('' => 0));
|
$conflicts = request_var('conflict', array('' => 0));
|
||||||
|
|
||||||
|
@ -749,7 +751,7 @@ class install_update extends module
|
||||||
{
|
{
|
||||||
$compress->close();
|
$compress->close();
|
||||||
|
|
||||||
$compress->download($archive_filename);
|
$compress->download($archive_filename, $download_filename);
|
||||||
@unlink($phpbb_root_path . 'store/' . $archive_filename . $use_method);
|
@unlink($phpbb_root_path . 'store/' . $archive_filename . $use_method);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Add table
Reference in a new issue