[ Index ]

PHP Cross Reference of phpBB-3.1.10-deutsch

title

Body

[close]

/includes/ -> functions_upload.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 1118 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

filespec:: (12 methods):
  filespec()
  clean_filename()
  get()
  is_image()
  is_uploaded()
  remove()
  get_extension()
  get_mimetype()
  get_filesize()
  check_content()
  move_file()
  additional_checks()

fileerror:: (1 method):
  fileerror()

fileupload:: (17 methods):
  fileupload()
  reset_vars()
  set_allowed_extensions()
  set_allowed_dimensions()
  set_max_filesize()
  set_disallowed_content()
  set_error_prefix()
  form_upload()
  local_upload()
  remote_upload()
  assign_internal_error()
  common_checks()
  valid_extension()
  valid_dimensions()
  is_valid()
  valid_content()
  image_types()


Class: filespec  - X-Ref

Responsible for holding all file relevant information, as well as doing file-specific operations.
The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on.

filespec($upload_ary, $upload_namespace, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)   X-Ref
File Class


clean_filename($mode = 'unique', $prefix = '', $user_id = '')   X-Ref
Cleans destination filename

param: real|unique|unique_ext $mode real creates a realname, filtering some characters, lowering every character. Unique creates an unique filename
param: string $prefix Prefix applied to filename
param: string $user_id The user_id is only needed for when cleaning a user's avatar

get($property)   X-Ref
Get property from file object


is_image()   X-Ref
Check if file is an image (mimetype)

return: true if it is an image, false if not

is_uploaded()   X-Ref
Check if the file got correctly uploaded

return: true if it is a valid upload, false if not

remove()   X-Ref
Remove file


get_extension($filename)   X-Ref
Get file extension

return: string Extension of the supplied filename
param: string Filename that needs to be checked

get_mimetype($filename)   X-Ref
Get mimetype

return: string Mimetype of supplied filename
param: string $filename Filename that needs to be checked

get_filesize($filename)   X-Ref
Get filesize


check_content($disallowed_content)   X-Ref
Check the first 256 bytes for forbidden content


move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false)   X-Ref
Move file to destination folder
The phpbb_root_path variable will be applied to the destination path

param: string $destination Destination path, for example $config['avatar_path']
param: bool $overwrite If set to true, an already existing file will be overwritten
param: bool $skip_image_check If set to true, the check for the file to be a valid image is skipped
param: string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}

additional_checks()   X-Ref
Performing additional checks


Class: fileerror  - X-Ref

Class for assigning error messages before a real filespec class can be assigned

fileerror($error_msg)   X-Ref
No description

Class: fileupload  - X-Ref

File upload class
Init class (all parameters optional and able to be set/overwritten separately) - scope is global and valid for all uploads

fileupload($error_prefix = '', $allowed_extensions = false, $max_filesize = false, $min_width = false, $min_height = false, $max_width = false, $max_height = false, $disallowed_content = false)   X-Ref
Init file upload class.

param: string $error_prefix Used error messages will get prefixed by this string
param: array $allowed_extensions Array of allowed extensions, for example array('jpg', 'jpeg', 'gif', 'png')
param: int $max_filesize Maximum filesize
param: int $min_width Minimum image width (only checked for images)
param: int $min_height Minimum image height (only checked for images)
param: int $max_width Maximum image width (only checked for images)
param: int $max_height Maximum image height (only checked for images)
param: bool|array $disallowed_content If enabled, the first 256 bytes of the file must not

reset_vars()   X-Ref
Reset vars


set_allowed_extensions($allowed_extensions)   X-Ref
Set allowed extensions


set_allowed_dimensions($min_width, $min_height, $max_width, $max_height)   X-Ref
Set allowed dimensions


set_max_filesize($max_filesize)   X-Ref
Set maximum allowed filesize


set_disallowed_content($disallowed_content)   X-Ref
Set disallowed strings


set_error_prefix($error_prefix)   X-Ref
Set error prefix


form_upload($form_name, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)   X-Ref
Form upload method
Upload file from users harddisk

return: object $file Object "filespec" is returned, all further operations can be done with this object
param: string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified)
param: \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
param: \phpbb\plupload\plupload $plupload The plupload object

local_upload($source_file, $filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null)   X-Ref
Move file from another location to phpBB


remote_upload($upload_url, \phpbb\mimetype\guesser $mimetype_guesser = null)   X-Ref
Remote upload method
Uploads file from given url

return: object $file Object "filespec" is returned, all further operations can be done with this object
param: string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif
param: \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser

assign_internal_error($errorcode)   X-Ref
Assign internal error


common_checks(&$file)   X-Ref
Perform common checks


valid_extension(&$file)   X-Ref
Check for allowed extension


valid_dimensions(&$file)   X-Ref
Check for allowed dimension


is_valid($form_name)   X-Ref
Check if form upload is valid


valid_content(&$file)   X-Ref
Check for bad content (IE mime-sniffing)


image_types()   X-Ref
Get image type/extension mapping

return: array Array containing the image types and their extensions



Generated: Sun Feb 19 19:52:41 2017 Cross-referenced by PHPXref 0.7.1