mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-01-11 17:08:40 +00:00
update
This commit is contained in:
parent
79720c2e0b
commit
54aa5729ab
19
Admin/Hooks/Cli.php
Normal file
19
Admin/Hooks/Cli.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Media
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'Module:Admin-encryption-change' => [
|
||||
'callback' => ['\Modules\Media\Controller\CliController:runEncryptionChangeFromHook'],
|
||||
],
|
||||
];
|
||||
|
|
@ -183,7 +183,7 @@ final class Installer extends InstallerAbstract
|
|||
|
||||
$module->apiReferenceCreate($request, $response);
|
||||
|
||||
$responseData = $response->get('');
|
||||
$responseData = $response->getData('');
|
||||
if (!\is_array($responseData)) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ final class Installer extends InstallerAbstract
|
|||
|
||||
$module->apiCollectionCreate($request, $response);
|
||||
|
||||
$responseData = $response->get('');
|
||||
$responseData = $response->getData('');
|
||||
if (!\is_array($responseData)) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ final class Installer extends InstallerAbstract
|
|||
|
||||
$module->apiMediaTypeCreate($request, $response);
|
||||
|
||||
$responseData = $response->get('');
|
||||
$responseData = $response->getData('');
|
||||
if (!\is_array($responseData)) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -375,7 +375,7 @@ final class Installer extends InstallerAbstract
|
|||
$module->apiCollectionCreate($request, $response);
|
||||
}
|
||||
|
||||
$responseData = $response->get('');
|
||||
$responseData = $response->getData('');
|
||||
if (!\is_array($responseData)) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import { jsOMS } from '../../jsOMS/Utils/oLib.js';
|
||||
import { Autoloader } from '../../jsOMS/Autoloader.js';
|
||||
import { NotificationMessage } from '../../jsOMS/Message/Notification/NotificationMessage.js';
|
||||
import { NotificationType } from '../../jsOMS/Message/Notification/NotificationType.js';
|
||||
import { Upload } from './Models/Upload.js';
|
||||
|
||||
Autoloader.defineNamespace('jsOMS.Modules');
|
||||
Autoloader.defineNamespace('omsApp.Modules');
|
||||
|
||||
jsOMS.Modules.Media = class {
|
||||
omsApp.Modules.Media = class {
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ final class ApiController extends Controller
|
|||
$internalResponse = new HttpResponse();
|
||||
$this->apiMediaTypeCreate($request, $internalResponse);
|
||||
|
||||
if (!\is_array($data = $internalResponse->get($request->uri->__toString()))) {
|
||||
if (!\is_array($data = $internalResponse->getDataArray($request->uri->__toString()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ final class ApiController extends Controller
|
|||
$internalResponse = new HttpResponse();
|
||||
$this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse);
|
||||
|
||||
if (!\is_array($data = $internalResponse->get($request->uri->__toString()))) {
|
||||
if (!\is_array($data = $internalResponse->getDataArray($request->uri->__toString()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
61
Controller/CliController.php
Normal file
61
Controller/CliController.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Media
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Media\Controller;
|
||||
|
||||
use Model\SettingMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Security\EncryptionHelper;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
* Media controller class.
|
||||
*
|
||||
* @package Modules\Media
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class CliController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api method to make a call to the cli app
|
||||
*
|
||||
* @param mixed ...$data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function runEncryptionChangeFromHook(mixed ...$data) : void
|
||||
{
|
||||
$mapper = MediaMapper::yield()
|
||||
->where('isEncrypted', true);
|
||||
|
||||
foreach ($mapper->execute() as $media) {
|
||||
if (!empty($data['old'])) {
|
||||
$media->decrypt($data['old']);
|
||||
}
|
||||
|
||||
if (!empty($data['new'])) {
|
||||
$media->encrypt($data['new']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ use \phpOMS\Uri\UriFactory;
|
|||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<style>html, body, iframe { margin: 0; padding: 0; border: 0; }</style>
|
||||
<style>html, body, iframe { margin: 0; padding: 0; border: 0; width: 100%; height: 100%; overflow: hidden; }</style>
|
||||
<iframe
|
||||
class="col-simple"
|
||||
id="iMediaFrame"
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'يختار',
|
||||
'Settings' => 'إعدادات',
|
||||
'Size' => 'بحجم',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'نوع',
|
||||
'Upload' => 'تحميل',
|
||||
'VirtualPath' => 'المسار الافتراضي',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Vybrat',
|
||||
'Settings' => 'Nastavení',
|
||||
'Size' => 'Velikost',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Typ',
|
||||
'Upload' => 'nahrát',
|
||||
'VirtualPath' => 'Virtuální cesta',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Vælg',
|
||||
'Settings' => 'Indstillinger.',
|
||||
'Size' => 'Størrelse',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Type',
|
||||
'Upload' => 'Upload',
|
||||
'VirtualPath' => 'Virtual Path.',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Wählen',
|
||||
'Settings' => 'Einstellungen',
|
||||
'Size' => 'Größe',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Typ',
|
||||
'Upload' => 'Hochladen',
|
||||
'VirtualPath' => 'Virtueller Pfad',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Επιλέγω',
|
||||
'Settings' => 'Ρυθμίσεις',
|
||||
'Size' => 'Μέγεθος',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Τύπος',
|
||||
'Upload' => 'Μεταφόρτω',
|
||||
'VirtualPath' => 'Εικονική διαδρομή',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Seleccione',
|
||||
'Settings' => 'Ajustes',
|
||||
'Size' => 'Tamaño',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Escribe',
|
||||
'Upload' => 'Subir',
|
||||
'VirtualPath' => 'Camino virtual',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Valitse',
|
||||
'Settings' => 'asetukset',
|
||||
'Size' => 'Koko',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Tyyppi',
|
||||
'Upload' => 'Ladata',
|
||||
'VirtualPath' => 'Virtuaalinen polku',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Sélectionner',
|
||||
'Settings' => 'Réglages',
|
||||
'Size' => 'Taille',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Taper',
|
||||
'Upload' => 'Télécharger',
|
||||
'VirtualPath' => 'Voie virtuelle',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Kiválaszt',
|
||||
'Settings' => 'Beállítások',
|
||||
'Size' => 'Méret',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'típus',
|
||||
'Upload' => 'Feltöltés',
|
||||
'VirtualPath' => 'Virtuális út',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Selezionare',
|
||||
'Settings' => 'Impostazioni',
|
||||
'Size' => 'Misurare',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Tipo',
|
||||
'Upload' => 'Caricamento',
|
||||
'VirtualPath' => 'Percorso virtuale',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => '選択する',
|
||||
'Settings' => '設定',
|
||||
'Size' => 'サイズ',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'タイプ',
|
||||
'Upload' => 'アップロード',
|
||||
'VirtualPath' => '仮想パス',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => '선택하다',
|
||||
'Settings' => '설정',
|
||||
'Size' => '크기',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => '유형',
|
||||
'Upload' => '업로드',
|
||||
'VirtualPath' => '가상 경로',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Plukke ut',
|
||||
'Settings' => 'Innstillinger',
|
||||
'Size' => 'Størrelse',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Type',
|
||||
'Upload' => 'Laste opp',
|
||||
'VirtualPath' => 'Virtual Path.',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Wybierać',
|
||||
'Settings' => 'Ustawienia',
|
||||
'Size' => 'Rozmiar',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Rodzaj',
|
||||
'Upload' => 'Wgrywać',
|
||||
'VirtualPath' => 'Wirtualna ścieżka',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Selecione.',
|
||||
'Settings' => 'Configurações',
|
||||
'Size' => 'Tamanho',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Modelo',
|
||||
'Upload' => 'Envio',
|
||||
'VirtualPath' => 'Caminho virtual',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Выбирать',
|
||||
'Settings' => 'Настройки',
|
||||
'Size' => 'Размер',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Тип',
|
||||
'Upload' => 'Загрузить',
|
||||
'VirtualPath' => 'Виртуальный путь',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Välj',
|
||||
'Settings' => 'inställningar',
|
||||
'Size' => 'Storlek',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Typ',
|
||||
'Upload' => 'Ladda upp',
|
||||
'VirtualPath' => 'Virtuell väg',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'เลือก',
|
||||
'Settings' => 'การตั้งค่า',
|
||||
'Size' => 'ขนาด',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'พิมพ์',
|
||||
'Upload' => 'ที่อัพโหลด',
|
||||
'VirtualPath' => 'เส้นทางเสมือน',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Seçme',
|
||||
'Settings' => 'Ayarlar',
|
||||
'Size' => 'Boyut',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Tip',
|
||||
'Upload' => 'Yüklemek',
|
||||
'VirtualPath' => 'Sanal yol',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => 'Вибирати',
|
||||
'Settings' => 'Налаштування',
|
||||
'Size' => 'Розмір',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => 'Тип',
|
||||
'Upload' => 'Завантажувати',
|
||||
'VirtualPath' => 'Віртуальний шлях',
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ return ['Media' => [
|
|||
'Select' => '选择',
|
||||
'Settings' => '设置',
|
||||
'Size' => '尺寸',
|
||||
'Tag' => '#VALUE!',
|
||||
'Tags' => '#VALUE!',
|
||||
'Tag' => '',
|
||||
'Tags' => '',
|
||||
'Type' => '类型',
|
||||
'Upload' => '上传',
|
||||
'VirtualPath' => '虚拟路径',
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ trait ApiControllerCollectionTrait
|
|||
}
|
||||
|
||||
$media = [];
|
||||
$createdMedia = $response->get('')['response'];
|
||||
$createdMedia = $response->getDataArray('')['response'];
|
||||
foreach ($createdMedia as $file) {
|
||||
$media[] = $file;
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ trait ApiControllerCollectionTrait
|
|||
|
||||
$this->module->apiCollectionCreate($request, $response);
|
||||
|
||||
$collection = $response->get('')['response'];
|
||||
$collection = $response->getDataArray('')['response'];
|
||||
self::assertEquals('Test Collection', $collection->name);
|
||||
self::assertCount(2, $collection->getSources());
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ trait ApiControllerCollectionTrait
|
|||
|
||||
$this->module->apiCollectionCreate($request, $response);
|
||||
|
||||
$collection = $response->get('')['response'];
|
||||
$collection = $response->getDataArray('')['response'];
|
||||
self::assertTrue(\is_dir(__DIR__ . '/../../../Files/test/path'));
|
||||
|
||||
Directory::delete(__DIR__ . '/../../../Files/test/path');
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ trait ApiControllerMediaTrait
|
|||
Directory::delete(__DIR__ . '/temp');
|
||||
}
|
||||
|
||||
$media = $response->get('')['response'];
|
||||
$media = $response->getDataArray('')['response'];
|
||||
self::assertCount(2, $media);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ trait ApiControllerMediaTrait
|
|||
Directory::delete(__DIR__ . '/temp');
|
||||
}
|
||||
|
||||
$media = $response->get('')['response'];
|
||||
$media = $response->getDataArray('')['response'];
|
||||
self::assertTrue(\is_file(__DIR__ . '/../test/path/testFile1.txt'));
|
||||
self::assertTrue(\is_file(__DIR__ . '/../test/path/testFile2.txt'));
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ trait ApiControllerMediaTrait
|
|||
TestUtils::setMember($request, 'files', $files);
|
||||
$this->module->apiMediaUpload($request, $response);
|
||||
|
||||
$id = \reset($response->get('')['response']);
|
||||
$id = \reset($response->getDataArray('')['response']);
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ trait ApiControllerMediaTrait
|
|||
|
||||
$this->module->apiMediaCreate($request, $response);
|
||||
|
||||
self::assertCount(1, $response->get('')['response']);
|
||||
self::assertCount(1, $response->getDataArray('')['response']);
|
||||
self::assertTrue(\is_file(__DIR__ . '/../test/path/created.md'));
|
||||
|
||||
Directory::delete(__DIR__ . '/../test');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user