Пример #1
0
    } else {
        if (!($imgtype = KUNENA_check_image_type($imageExt))) {
            imageUploadError(_IMAGE_ERROR_TYPE);
        } else {
            if ($imageSize > $maxImgSize) {
                imageUploadError(_IMAGE_ERROR_SIZE . " (" . $fbConfig->imagesize . "kb)");
            } else {
                list($width, $height) = @getimagesize($attachimage['tmp_name']);
                // Check image width
                if ($width > $fbConfig->imagewidth) {
                    imageUploadError(_IMAGE_ERROR_WIDTH . " (" . $fbConfig->imagewidth . " pixels");
                } else {
                    if ($height > $fbConfig->imageheight) {
                        imageUploadError(_IMAGE_ERROR_HEIGHT . " (" . $fbConfig->imageheight . " pixels");
                    }
                }
            }
        }
    }
}
if ($GLOBALS['KUNENA_rc']) {
    // file is OK, move it to the proper location
    CKunenaFile::upload($attachimage['tmp_name'], $imageLocation);
    // echo '<span class="contentheading">'._IMAGE_UPLOADED."...</span>";
    $code = '[img]' . KUNENA_LIVEUPLOADEDPATH . '/images/' . $newFileName . '[/img]';
    if (preg_match("/\\[img\\/\\]/si", $message)) {
        $message = str_replace("[img/]", $code, $message);
    } else {
        $message = $message . ' ' . $code;
    }
}
Пример #2
0
    }
}
if ($GLOBALS['KUNENA_rc']) {
    //Filename + proper path
    $fileLocation = strtr(KUNENA_PATH_UPLOADED . DS . "files" . DS . $newFileName, "\\", "/");
    $allowedArray = explode(',', strtolower($fbConfig->filetypes));
    $maxImgSize = $fbConfig->filesize * 1024;
    // Check for empty filename
    if (!is_uploaded_file($attachfile['tmp_name']) || empty($attachfile['name'])) {
        fileUploadError(_FILE_ERROR_EMPTY);
    } else {
        if (!in_array($fileExt, $allowedArray)) {
            fileUploadError(_FILE_ERROR_TYPE . " " . $fbConfig->filetypes);
        } else {
            if ($fileSize > $maxImgSize) {
                fileUploadError(_FILE_ERROR_SIZE . " (" . $fbConfig->filesize . "kb)");
            }
        }
    }
}
if ($GLOBALS['KUNENA_rc']) {
    // file is OK, move it to the proper location
    CKunenaFile::upload($attachfile['tmp_name'], $fileLocation);
    // Insert file code into message
    $code = '[file name=' . $newFileName . ' size=' . $fileSize . ']' . KUNENA_LIVEUPLOADEDPATH . '/files/' . $newFileName . '[/file]';
    if (preg_match("/\\[file\\/\\]/si", $message)) {
        $message = str_replace("[file/]", $code, $message);
    } else {
        $message = $message . ' ' . $code;
    }
}