116 'application/x-httpd-php'
173 'php',
'phtml',
'phtm',
'php3',
'php4',
'cgi',
'pl',
'asp',
'php5'
182 1 =>
'gif', 2 =>
'jpg', 3 =>
'png', 4 =>
'swf', 5 =>
'psd', 6 =>
'bmp', 7 =>
'tif', 8 =>
'tif', 9 =>
'jpc',
183 10 =>
'jp2', 11 =>
'jpx', 12 =>
'jb2', 13 =>
'swf', 14 =>
'iff', 15 =>
'wbmp', 16 =>
'xbm'
220 if (!isset($_FILES[$media_name])) {
224 if (is_array($_FILES[$media_name][
'name']) && isset(
$index)) {
226 $this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$media_name][
'name'][
$index])
227 : $_FILES[$media_name][
'name'][
$index];
228 $this->mediaType = $_FILES[$media_name][
'type'][
$index];
229 $this->mediaSize = $_FILES[$media_name][
'size'][
$index];
230 $this->mediaTmpName = $_FILES[$media_name][
'tmp_name'][
$index];
231 $this->mediaError = !empty($_FILES[$media_name][
'error'][$index])
232 ? $_FILES[$media_name][
'error'][
$index] : 0;
234 $media_name = $_FILES[$media_name];
235 $this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($media_name[
'name']) : $media_name[
'name'];
236 $this->mediaType = $media_name[
'type'];
237 $this->mediaSize = $media_name[
'size'];
238 $this->mediaTmpName = $media_name[
'tmp_name'];
239 $this->mediaError = !empty($media_name[
'error']) ? $media_name[
'error'] : 0;
245 $this->mediaRealType = \Xoops\Core\MimeTypes::findType(
$ext);
247 $this->errors = array();
248 if (intval($this->mediaSize) < 0) {
252 if ($this->mediaName ==
'') {
256 if ($this->mediaTmpName ==
'none' || !is_uploaded_file($this->mediaTmpName)) {
260 if ($this->mediaError > 0) {
276 $this->targetFileName = strval(trim($value));
288 $this->prefix = strval(trim($value));
360 if ($this->uploadDir ==
'') {
364 if (!is_dir($this->uploadDir)) {
368 if (!is_writeable($this->uploadDir)) {
389 if (count($this->errors) > 0) {
405 if (!preg_match(
"/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
409 if (isset($this->targetFileName)) {
412 if (isset($this->prefix)) {
413 $this->savedFileName = uniqid($this->prefix) .
'.' . strtolower($matched[1]);
415 $this->savedFileName = strtolower($this->mediaName);
420 if (!move_uploaded_file($this->mediaTmpName, $this->savedDestination)) {
425 $ext = strtolower(substr(strrchr($this->savedDestination,
'.'), 1));
426 if (in_array(
$ext, $this->imageExtensions)) {
427 $info = @getimagesize($this->savedDestination);
428 if (
$info ===
false || $this->imageExtensions[(
int)
$info[2]] !=
$ext) {
430 @unlink($this->savedDestination);
434 @chmod($this->savedDestination, $chmod);
445 if (!isset($this->maxFileSize)) {
448 if ($this->mediaSize > $this->maxFileSize) {
462 if (!isset($this->maxWidth)) {
465 if (
false !== $dimension = getimagesize($this->mediaTmpName)) {
466 if ($dimension[0] > $this->maxWidth) {
483 if (!isset($this->maxHeight)) {
486 if (
false !== $dimension = getimagesize($this->mediaTmpName)) {
487 if ($dimension[1] > $this->maxHeight) {
504 if (empty($this->mediaRealType) && empty($this->allowUnknownTypes)) {
509 if ((!empty($this->allowedMimeTypes)
510 && !in_array($this->mediaRealType, $this->allowedMimeTypes))
511 || (!empty($this->deniedMimeTypes)
512 && in_array($this->mediaRealType, $this->deniedMimeTypes))
531 if ((
'image' == substr($this->mediaType, 0, strpos($this->mediaType,
'/')))
532 || (!empty($this->mediaRealType)
533 &&
'image' == substr($this->mediaRealType, 0, strpos($this->mediaRealType,
'/')))
535 if (!@getimagesize($this->mediaTmpName)) {
550 if (empty($this->extensionsToBeSanitized)) {
556 foreach ($this->extensionsToBeSanitized as
$ext) {
557 $patterns[] =
"/\." . preg_quote($ext) .
"\./i";
558 $replaces[] =
"_" . $ext .
".";
560 $this->mediaName = preg_replace($patterns, $replaces, $this->mediaName);
572 $this->errors[] = trim(
$error);
588 if (count($this->errors) > 0) {
591 foreach ($this->errors as
$error) {
592 $ret .= $error .
'<br />';
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
const EF_DIRECTORY_NOT_OPENED
const EF_FILE_MIME_TYPE_NOT_ALLOWED
if($mtime===false) if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) $path_parts
const E_UPLOAD_DIRECTORY_NOT_SET
const EF_FILE_NOT_SAVED_TO
const E_INVALID_FILE_SIZE
const EF_FILE_HEIGHT_TO_LARGE
const EF_FILE_SIZE_TO_LARGE
const E_INVALID_IMAGE_FILE
const EF_IMAGE_SIZE_NOT_FETCHED
const EF_UNEXPECTED_ERROR
if(isset($_POST['name'])) $info
const EF_DIRECTORY_WITH_WRITE_PERMISSION_NOT_OPENED
const EF_ERRORS_RETURNED_WHILE_UPLOADING_FILE
const E_INVALID_FILE_NAME
const E_FILE_TYPE_REJECTED
const EF_FILE_WIDTH_TO_LARGE
const E_SUSPICIOUS_IMAGE_UPLOAD_REFUSED
const E_FILE_NAME_MISSING