mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-14 00:08: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.
|
// todo: the order of find is bad but needed for now.
|
||||||
'^.*/media/find.*$' => [
|
'^.*/media/find.*$' => [
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ class UploadFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: do I need pecl fileinfo?
|
// 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;
|
$result[$key]['status'] = UploadStatus::WRONG_EXTENSION;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
@ -282,7 +282,7 @@ class UploadFile
|
||||||
private function findOutputDir(array $files) : string
|
private function findOutputDir(array $files) : string
|
||||||
{
|
{
|
||||||
do {
|
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));
|
} while (\file_exists($this->outputDir . '/' . $rndPath));
|
||||||
|
|
||||||
return $this->outputDir . '/' . $rndPath;
|
return $this->outputDir . '/' . $rndPath;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class MediaView extends View
|
||||||
{
|
{
|
||||||
protected function filePathFunction(Media $media, string $sub) : string
|
protected function filePathFunction(Media $media, string $sub) : string
|
||||||
{
|
{
|
||||||
if (is_file($media->getPath() . $sub)
|
if (\is_file($media->getPath() . $sub)
|
||||||
&& StringUtils::startsWith(
|
&& StringUtils::startsWith(
|
||||||
\str_replace('\\', '/', \realpath($media->getPath() . $sub)),
|
\str_replace('\\', '/', \realpath($media->getPath() . $sub)),
|
||||||
$media->getPath()
|
$media->getPath()
|
||||||
|
|
@ -74,7 +74,7 @@ class MediaView extends View
|
||||||
$output = \file_get_contents($path);
|
$output = \file_get_contents($path);
|
||||||
$output = \str_replace(["\r\n", "\r"], "\n", $output);
|
$output = \str_replace(["\r\n", "\r"], "\n", $output);
|
||||||
|
|
||||||
return explode("\n", $output);
|
return \explode("\n", $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isImageFunction(Media $media, string $path) : bool
|
protected function isImageFunction(Media $media, string $path) : bool
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user