mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-01-26 15:58:41 +00:00
Use global namespace
This commit is contained in:
parent
011df2a6d1
commit
0519a59f8a
|
|
@ -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.*$' => [
|
||||
[
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user