diff options
author | Marc Alexander <admin@m-a-styles.de> | 2012-12-17 12:59:44 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2012-12-17 17:42:13 +0100 |
commit | 54d96dfac720d5aa1cdc617ca93749d26ee9f264 (patch) | |
tree | 9f9a5e009453c973497c35c3950c903560f44e38 /phpBB/includes | |
parent | 9420647c43b300699afe6fe72f09d1746daf64a2 (diff) | |
download | forums-54d96dfac720d5aa1cdc617ca93749d26ee9f264.tar forums-54d96dfac720d5aa1cdc617ca93749d26ee9f264.tar.gz forums-54d96dfac720d5aa1cdc617ca93749d26ee9f264.tar.bz2 forums-54d96dfac720d5aa1cdc617ca93749d26ee9f264.tar.xz forums-54d96dfac720d5aa1cdc617ca93749d26ee9f264.zip |
[ticket/10763] Make functions for remote avatars static
fileupload::image_types() and filespec::get_extension() are called
statically while submitting the form for the remote avatar. Make them
static as described in the ticket in order to prevent a PHP notice.
Also change the tests to use the static functions.
PHPBB3-10763
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_upload.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index b467aa93d1..d4cb34cc4e 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -70,7 +70,7 @@ class filespec $this->mimetype = 'application/octetstream'; } - $this->extension = strtolower($this->get_extension($this->realname)); + $this->extension = strtolower(filespec::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'), |