Use global namespace

This commit is contained in:
Dennis Eichhorn 2019-04-27 00:13:26 +02:00
parent 011df2a6d1
commit 0519a59f8a
3 changed files with 4 additions and 15 deletions

View File

@ -22,17 +22,6 @@ return [
],
],
],
'^.*/media/create.*$' => [
[
'dest' => '\Modules\Media\Controller\ApiController:apiMediaCreate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => ApiController::MODULE_NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::MEDIA,
],
],
],
// todo: the order of find is bad but needed for now.
'^.*/media/find.*$' => [
[

View File

@ -135,7 +135,7 @@ class UploadFile
}
// TODO: do I need pecl fileinfo?
if (!empty($this->allowedTypes) && ($ext = array_search($f['type'], $this->allowedTypes, true)) === false) {
if (!empty($this->allowedTypes) && ($ext = \array_search($f['type'], $this->allowedTypes, true)) === false) {
$result[$key]['status'] = UploadStatus::WRONG_EXTENSION;
return $result;
@ -282,7 +282,7 @@ class UploadFile
private function findOutputDir(array $files) : string
{
do {
$rndPath = \str_pad(\dechex(rand(0, 65535)), 4, '0', STR_PAD_LEFT);
$rndPath = \str_pad(\dechex(\rand(0, 65535)), 4, '0', STR_PAD_LEFT);
} while (\file_exists($this->outputDir . '/' . $rndPath));
return $this->outputDir . '/' . $rndPath;

View File

@ -34,7 +34,7 @@ class MediaView extends View
{
protected function filePathFunction(Media $media, string $sub) : string
{
if (is_file($media->getPath() . $sub)
if (\is_file($media->getPath() . $sub)
&& StringUtils::startsWith(
\str_replace('\\', '/', \realpath($media->getPath() . $sub)),
$media->getPath()
@ -74,7 +74,7 @@ class MediaView extends View
$output = \file_get_contents($path);
$output = \str_replace(["\r\n", "\r"], "\n", $output);
return explode("\n", $output);
return \explode("\n", $output);
}
protected function isImageFunction(Media $media, string $path) : bool