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

Merge PR #1147 branch 'marc1706/ticket/10763' into develop

* marc1706/ticket/10763:
  [ticket/10763] Use self when calling get_extension() in filespec class
  [ticket/10763] Make functions for remote avatars static
This commit is contained in:
Oleg Pudeyev
2012-12-18 04:11:56 -05:00
3 changed files with 11 additions and 36 deletions

View File

@@ -70,7 +70,7 @@ class filespec
$this->mimetype = 'application/octetstream';
}
$this->extension = strtolower($this->get_extension($this->realname));
$this->extension = strtolower(self::get_extension($this->realname));
// Try to get real filesize from temporary folder (not always working) ;)
$this->filesize = (@filesize($this->filename)) ? @filesize($this->filename) : $this->filesize;
@@ -187,8 +187,11 @@ class filespec
/**
* Get file extension
*
* @param string Filename that needs to be checked
* @return string Extension of the supplied filename
*/
function get_extension($filename)
static public function get_extension($filename)
{
if (strpos($filename, '.') === false)
{
@@ -369,7 +372,7 @@ class filespec
}
// Check image type
$types = $this->upload->image_types();
$types = fileupload::image_types();
if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]]))
{
@@ -1019,9 +1022,11 @@ class fileupload
}
/**
* Return image type/extension mapping
* Get image type/extension mapping
*
* @return array Array containing the image types and their extensions
*/
function image_types()
static public function image_types()
{
return array(
IMAGETYPE_GIF => array('gif'),