1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- some cross-db related changes

- putting active bots array into cache


git-svn-id: file:///svn/phpbb/trunk@5140 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2005-05-05 16:55:05 +00:00
parent 16e50db4ba
commit b576d6af0a
11 changed files with 206 additions and 120 deletions

View File

@@ -56,6 +56,12 @@ class filespec
// Opera adds the name to the mime type
$this->mimetype = (strpos($this->mimetype, '; name') !== false) ? str_replace(strstr($this->mimetype, '; name'), '', $this->mimetype) : $this->mimetype;
if (!$this->mimetype)
{
$this->mimetype = 'application/octetstream';
}
$this->extension = array_pop(explode('.', strtolower($this->realname)));
// Try to get real filesize from temporary folder (not always working) ;)
@@ -122,7 +128,12 @@ class filespec
function is_uploaded()
{
return (file_exists($this->filename) && is_uploaded_file($this->filename)) ? true : false;
if (!$this->local && !is_uploaded_file($this->filename))
{
return false;
}
return (file_exists($this->filename)) ? true : false;
}
function remove()
@@ -394,8 +405,64 @@ class fileupload
}
// Move file from another location to phpBB
function local_upload($source_file)
function local_upload($source_file, $filedata = false)
{
global $user;
$form_name = 'local';
$_FILES[$form_name]['local_mode'] = true;
$_FILES[$form_name]['tmp_name'] = $source_file;
if ($filedata === false)
{
$_FILES[$form_name]['name'] = basename($source_file);
$_FILES[$form_name]['size'] = 0;
$_FILES[$form_name]['type'] = '';
}
else
{
$_FILES[$form_name]['name'] = $filedata['realname'];
$_FILES[$form_name]['size'] = $filedata['size'];
$_FILES[$form_name]['type'] = $filedata['type'];
}
$file = new filespec($_FILES[$form_name], $this);
if ($file->init_error)
{
$file->error[] = '';
return $file;
}
if (isset($_FILES[$form_name]['error']))
{
$error = $this->assign_internal_error($_FILES[$form_name]['error']);
if ($error !== false)
{
$file->error[] = $error;
return $file;
}
}
// PHP Upload filesize exceeded
if ($file->get('filename') == 'none')
{
$file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
return $file;
}
// Not correctly uploaded
if (!$file->is_uploaded())
{
$file->error[] = $user->lang[$this->error_prefix . 'NOT_UPLOADED'];
return $file;
}
$this->common_checks($file);
return $file;
}
/**