File manager - Edit - /home/opticamezl/www/newok/com_media.zip
Back
PK ���\�V� index.htmlnu &1i� <!DOCTYPE html><title></title> PK ���\�x�� � media.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <extension type="component" method="upgrade"> <name>com_media</name> <author>Joomla! Project</author> <creationDate>2006-04</creationDate> <copyright>(C) 2006 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.0.0</version> <description>COM_MEDIA_XML_DESCRIPTION</description> <namespace path="src">Joomla\Component\Media</namespace> <files folder="site"> <folder>src</folder> </files> <languages folder="site"> <language tag="en-GB">language/en-GB/com_media.ini</language> </languages> <administration> <files folder="admin"> <filename>access.xml</filename> <filename>config.xml</filename> <filename>media.xml</filename> <folder>forms</folder> <folder>layouts</folder> <folder>resources</folder> <folder>services</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages folder="admin"> <language tag="en-GB">language/en-GB/com_media.ini</language> <language tag="en-GB">language/en-GB/com_media.sys.ini</language> </languages> </administration> </extension> PK ���\�r� y y helpers/media.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace */ use Joomla\CMS\Object\CMSObject; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Media helper class. * * @since 1.6 */ abstract class MediaHelper { /** * Generates the URL to the object in the action logs component * * @param string $contentType The content type * @param integer $id The integer id * @param CMSObject $mediaObject The media object being uploaded * * @return string The link for the action log * * @since 3.9.27 */ public static function getContentTypeLink($contentType, $id, CMSObject $mediaObject) { if ($contentType === 'com_media.file') { return ''; } $link = 'index.php?option=com_media'; $adapter = $mediaObject->get('adapter'); $uploadedPath = $mediaObject->get('path'); if (!empty($adapter) && !empty($uploadedPath)) { $link = $link . '&path=' . $adapter . ':' . $uploadedPath; } return $link; } } PK ���\�V� helpers/index.htmlnu &1i� <!DOCTYPE html><title></title> PK ���\��u� � access.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <access component="com_media"> <section name="component"> <action name="core.admin" title="JACTION_ADMIN" /> <action name="core.options" title="JACTION_OPTIONS" /> <action name="core.manage" title="JACTION_MANAGE" /> <action name="core.create" title="JACTION_CREATE" /> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> </section> </access> PK ���\2�2�; ; services/provider.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; use Joomla\CMS\Extension\MVCComponent; use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; use Joomla\CMS\Extension\Service\Provider\MVCFactory; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; /** * The media service provider. * * @since 4.0.0 */ return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.0.0 */ public function register(Container $container) { $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Media')); $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Media')); $container->set( ComponentInterface::class, function (Container $container) { $component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); return $component; } ); } }; PK ���\��@� � config.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <config> <help key="Media:_Options"/> <inlinehelp button="show"/> <fieldset name="component" label="COM_MEDIA_FIELDSET_OPTIONS_LABEL"> <help key="Media:_Options"/> <field name="upload_maxsize" type="number" label="COM_MEDIA_FIELD_MAXIMUM_SIZE_LABEL" description="COM_MEDIA_FIELD_MAXIMUM_SIZE_DESC" validate="number" min="0" default="10" /> <field name="file_path" type="text" label="COM_MEDIA_FIELD_PATH_FILE_FOLDER_LABEL" description="COM_MEDIA_FIELD_PATH_FILE_FOLDER_DESC" default="images" validate="folderPathExists" exclude="administrator|api|cache|cli|components|includes|language|layouts|libraries|media|modules|plugins|templates|tmp" /> <field name="image_path" type="text" label="COM_MEDIA_FIELD_PATH_IMAGE_FOLDER_LABEL" description="COM_MEDIA_FIELD_PATH_IMAGE_FOLDER_DESC" default="images" validate="folderPathExists" exclude="administrator|api|cache|cli|components|includes|language|layouts|libraries|modules|plugins|templates|tmp" /> <field name="restrict_uploads" type="radio" label="COM_MEDIA_FIELD_RESTRICT_UPLOADS_LABEL" description="COM_MEDIA_FIELD_RESTRICT_UPLOADS_DESC" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="restrict_uploads_extensions" type="textarea" label="COM_MEDIA_FIELD_RESTRICT_UPLOADS_EXTENSIONS_LABEL" description="COM_MEDIA_FIELD_RESTRICT_UPLOADS_EXTENSIONS_DESC" default="bmp,gif,jpg,jpeg,png,webp,ico,mp3,mp4,odg,odp,ods,odt,pdf,ppt,txt,xcf,xls,csv" showon="restrict_uploads:1" /> <field name="check_mime" type="radio" label="COM_MEDIA_FIELD_CHECK_MIME_LABEL" description="COM_MEDIA_FIELD_CHECK_MIME_DESC" layout="joomla.form.field.radio.switcher" default="1" showon="restrict_uploads:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="image_extensions" type="textarea" label="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_LABEL" description="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_DESC" default="bmp,gif,jpg,jpeg,png,webp" /> <field name="audio_extensions" type="textarea" label="COM_MEDIA_FIELD_LEGAL_AUDIO_EXTENSIONS_LABEL" description="COM_MEDIA_FIELD_LEGAL_AUDIO_EXTENSIONS_DESC" default="mp3,m4a,mp4a,ogg" /> <field name="video_extensions" type="textarea" label="COM_MEDIA_FIELD_LEGAL_VIDEO_EXTENSIONS_LABEL" description="COM_MEDIA_FIELD_LEGAL_VIDEO_EXTENSIONS_DESC" default="mp4,mp4v,mpeg,mov,webm" /> <field name="doc_extensions" type="textarea" label="COM_MEDIA_FIELD_LEGAL_DOCUMENT_EXTENSIONS_LABEL" description="COM_MEDIA_FIELD_LEGAL_DOCUMENT_EXTENSIONS_DESC" default="doc,odg,odp,ods,odt,pdf,ppt,txt,xcf,xls,csv" /> <field name="ignore_extensions" type="textarea" label="COM_MEDIA_FIELD_IGNORED_EXTENSIONS_LABEL" description="COM_MEDIA_FIELD_IGNORED_EXTENSIONS_DESC" /> <field name="upload_mime" type="textarea" label="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_LABEL" description="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_DESC" default="image/jpeg,image/gif,image/png,image/bmp,image/webp,audio/ogg,audio/mpeg,audio/mp4,video/mp4,video/mpeg,video/quicktime,video/webm,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip" showon="restrict_uploads:1" /> </fieldset> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" > <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" validate="rules" component="com_media" section="component" /> </fieldset> </config> PK ���\���� src/Model/FileModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Administrator\Model; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\MVC\Model\FormModel; use Joomla\CMS\Plugin\PluginHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * File Model * * @since 4.0.0 */ class FileModel extends FormModel { /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return \Joomla\CMS\Form\Form|boolean A Form object on success, false on failure * * @since 4.0.0 */ public function getForm($data = [], $loadData = true) { PluginHelper::importPlugin('media-action'); // Load backend forms in frontend. FormHelper::addFormPath(JPATH_ADMINISTRATOR . '/components/com_media/forms'); // Get the form. $form = $this->loadForm('com_media.file', 'file', ['control' => 'jform', 'load_data' => $loadData]); if (empty($form)) { return false; } return $form; } /** * Method to get the file information for the given path. Path must be * in the format: adapter:path/to/file.extension * * @param string $path The path to get the information from. * * @return \stdClass An object with file information * * @since 4.0.0 * @see ApiModel::getFile() */ public function getFileInformation($path) { list($adapter, $path) = explode(':', $path, 2); return $this->bootComponent('com_media')->getMVCFactory()->createModel('Api', 'Administrator') ->getFile($adapter, $path, ['url' => true, 'content' => true]); } } PK ���\�"�BRG RG src/Model/ApiModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Administrator\Model; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Component\Media\Administrator\Event\FetchMediaItemEvent; use Joomla\Component\Media\Administrator\Event\FetchMediaItemsEvent; use Joomla\Component\Media\Administrator\Event\FetchMediaItemUrlEvent; use Joomla\Component\Media\Administrator\Exception\FileExistsException; use Joomla\Component\Media\Administrator\Exception\FileNotFoundException; use Joomla\Component\Media\Administrator\Exception\InvalidPathException; use Joomla\Component\Media\Administrator\Provider\ProviderManagerHelperTrait; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Api Model * * @since 4.0.0 */ class ApiModel extends BaseDatabaseModel { use ProviderManagerHelperTrait; /** * The available extensions. * * @var string[] * @since 4.0.0 */ private $allowedExtensions = null; /** * Returns the requested file or folder information. More information * can be found in AdapterInterface::getFile(). * * @param string $adapter The adapter * @param string $path The path to the file or folder * @param array $options The options * * @return \stdClass * * @since 4.0.0 * @throws \Exception * @see AdapterInterface::getFile() */ public function getFile($adapter, $path = '/', $options = []) { // Add adapter prefix to the file returned $file = $this->getAdapter($adapter)->getFile($path); // Check if it is a media file if ($file->type == 'file' && !$this->isMediaFile($file->path)) { throw new InvalidPathException(); } if (isset($options['url']) && $options['url'] && $file->type == 'file') { $file->url = $this->getUrl($adapter, $file->path); } if (isset($options['content']) && $options['content'] && $file->type == 'file') { $resource = $this->getAdapter($adapter)->getResource($file->path); if ($resource) { $file->content = base64_encode(stream_get_contents($resource)); } } $file->path = $adapter . ":" . $file->path; $file->adapter = $adapter; $event = new FetchMediaItemEvent('onFetchMediaItem', ['item' => $file]); Factory::getApplication()->getDispatcher()->dispatch($event->getName(), $event); return $event->getArgument('item'); } /** * Returns the folders and files for the given path. More information * can be found in AdapterInterface::getFiles(). * * @param string $adapter The adapter * @param string $path The folder * @param array $options The options * * @return \stdClass[] * * @since 4.0.0 * @throws \Exception * @see AdapterInterface::getFile() */ public function getFiles($adapter, $path = '/', $options = []) { // Check whether user searching if ($options['search'] != null) { // Do search $files = $this->search($adapter, $options['search'], $path, $options['recursive']); } else { // Grab files for the path $files = $this->getAdapter($adapter)->getFiles($path); } // Add adapter prefix to all the files to be returned foreach ($files as $key => $file) { // Check if the file is valid if ($file->type == 'file' && !$this->isMediaFile($file->path)) { // Remove the file from the data unset($files[$key]); continue; } // Check if we need more information if (isset($options['url']) && $options['url'] && $file->type == 'file') { $file->url = $this->getUrl($adapter, $file->path); } if (isset($options['content']) && $options['content'] && $file->type == 'file') { $resource = $this->getAdapter($adapter)->getResource($file->path); if ($resource) { $file->content = base64_encode(stream_get_contents($resource)); } } $file->path = $adapter . ":" . $file->path; $file->adapter = $adapter; } // Make proper indexes $files = array_values($files); $event = new FetchMediaItemsEvent('onFetchMediaItems', ['items' => $files]); Factory::getApplication()->getDispatcher()->dispatch($event->getName(), $event); return $event->getArgument('items'); } /** * Creates a folder with the given name in the given path. More information * can be found in AdapterInterface::createFolder(). * * @param string $adapter The adapter * @param string $name The name * @param string $path The folder * @param boolean $override Should the folder being overridden when it exists * * @return string * * @since 4.0.0 * @throws \Exception * @see AdapterInterface::createFolder() */ public function createFolder($adapter, $name, $path, $override) { try { $file = $this->getFile($adapter, $path . '/' . $name); } catch (FileNotFoundException $e) { // Do nothing } // Check if the file exists if (isset($file) && !$override) { throw new FileExistsException(); } $app = Factory::getApplication(); $object = new CMSObject(); $object->adapter = $adapter; $object->name = $name; $object->path = $path; PluginHelper::importPlugin('content'); $result = $app->triggerEvent('onContentBeforeSave', ['com_media.folder', $object, true, $object]); if (in_array(false, $result, true)) { throw new \Exception($object->getError()); } $object->name = $this->getAdapter($object->adapter)->createFolder($object->name, $object->path); $app->triggerEvent('onContentAfterSave', ['com_media.folder', $object, true, $object]); return $object->name; } /** * Creates a file with the given name in the given path with the data. More information * can be found in AdapterInterface::createFile(). * * @param string $adapter The adapter * @param string $name The name * @param string $path The folder * @param string $data The data * @param boolean $override Should the file being overridden when it exists * * @return string * * @since 4.0.0 * @throws \Exception * @see AdapterInterface::createFile() */ public function createFile($adapter, $name, $path, $data, $override) { try { $file = $this->getFile($adapter, $path . '/' . $name); } catch (FileNotFoundException $e) { // Do nothing } // Check if the file exists if (isset($file) && !$override) { throw new FileExistsException(); } // Check if it is a media file if (!$this->isMediaFile($path . '/' . $name)) { throw new InvalidPathException(Text::_('JLIB_MEDIA_ERROR_WARNFILETYPE')); } $app = Factory::getApplication(); $object = new CMSObject(); $object->adapter = $adapter; $object->name = $name; $object->path = $path; $object->data = $data; $object->extension = strtolower(File::getExt($name)); PluginHelper::importPlugin('content'); // Also include the filesystem plugins, perhaps they support batch processing too PluginHelper::importPlugin('media-action'); $result = $app->triggerEvent('onContentBeforeSave', ['com_media.file', $object, true, $object]); if (in_array(false, $result, true)) { throw new \Exception($object->getError()); } $object->name = $this->getAdapter($object->adapter)->createFile($object->name, $object->path, $object->data); $app->triggerEvent('onContentAfterSave', ['com_media.file', $object, true, $object]); return $object->name; } /** * Updates the file with the given name in the given path with the data. More information * can be found in AdapterInterface::updateFile(). * * @param string $adapter The adapter * @param string $name The name * @param string $path The folder * @param string $data The data * * @return void * * @since 4.0.0 * @throws \Exception * @see AdapterInterface::updateFile() */ public function updateFile($adapter, $name, $path, $data) { // Check if it is a media file if (!$this->isMediaFile($path . '/' . $name)) { throw new InvalidPathException(); } $app = Factory::getApplication(); $object = new CMSObject(); $object->adapter = $adapter; $object->name = $name; $object->path = $path; $object->data = $data; $object->extension = strtolower(File::getExt($name)); PluginHelper::importPlugin('content'); // Also include the filesystem plugins, perhaps they support batch processing too PluginHelper::importPlugin('media-action'); $result = $app->triggerEvent('onContentBeforeSave', ['com_media.file', $object, false, $object]); if (in_array(false, $result, true)) { throw new \Exception($object->getError()); } $this->getAdapter($object->adapter)->updateFile($object->name, $object->path, $object->data); $app->triggerEvent('onContentAfterSave', ['com_media.file', $object, false, $object]); } /** * Deletes the folder or file of the given path. More information * can be found in AdapterInterface::delete(). * * @param string $adapter The adapter * @param string $path The path to the file or folder * * @return void * * @since 4.0.0 * @throws \Exception * @see AdapterInterface::delete() */ public function delete($adapter, $path) { $file = $this->getFile($adapter, $path); // Check if it is a media file if ($file->type == 'file' && !$this->isMediaFile($file->path)) { throw new InvalidPathException(); } $type = $file->type === 'file' ? 'file' : 'folder'; $app = Factory::getApplication(); $object = new CMSObject(); $object->adapter = $adapter; $object->path = $path; PluginHelper::importPlugin('content'); // Also include the filesystem plugins, perhaps they support batch processing too PluginHelper::importPlugin('media-action'); $result = $app->triggerEvent('onContentBeforeDelete', ['com_media.' . $type, $object]); if (in_array(false, $result, true)) { throw new \Exception($object->getError()); } $this->getAdapter($object->adapter)->delete($object->path); $app->triggerEvent('onContentAfterDelete', ['com_media.' . $type, $object]); } /** * Copies file or folder from source path to destination path * If forced, existing files/folders would be overwritten * * @param string $adapter The adapter * @param string $sourcePath Source path of the file or folder (relative) * @param string $destinationPath Destination path(relative) * @param bool $force Force to overwrite * * @return string * * @since 4.0.0 * @throws \Exception */ public function copy($adapter, $sourcePath, $destinationPath, $force = false) { return $this->getAdapter($adapter)->copy($sourcePath, $destinationPath, $force); } /** * Moves file or folder from source path to destination path * If forced, existing files/folders would be overwritten * * @param string $adapter The adapter * @param string $sourcePath Source path of the file or folder (relative) * @param string $destinationPath Destination path(relative) * @param bool $force Force to overwrite * * @return string * * @since 4.0.0 * @throws \Exception */ public function move($adapter, $sourcePath, $destinationPath, $force = false) { return $this->getAdapter($adapter)->move($sourcePath, $destinationPath, $force); } /** * Returns a url for serve media files from adapter. * Url must provide a valid image type to be displayed on Joomla! site. * * @param string $adapter The adapter * @param string $path The relative path for the file * * @return string Permalink to the relative file * * @since 4.0.0 * @throws FileNotFoundException */ public function getUrl($adapter, $path) { // Check if it is a media file if (!$this->isMediaFile($path)) { throw new InvalidPathException(); } $url = $this->getAdapter($adapter)->getUrl($path); $event = new FetchMediaItemUrlEvent('onFetchMediaFileUrl', ['adapter' => $adapter, 'path' => $path, 'url' => $url]); Factory::getApplication()->getDispatcher()->dispatch($event->getName(), $event); return $event->getArgument('url'); } /** * Search for a pattern in a given path * * @param string $adapter The adapter to work on * @param string $needle The search therm * @param string $path The base path for the search * @param bool $recursive Do a recursive search * * @return \stdClass[] * * @since 4.0.0 * @throws \Exception */ public function search($adapter, $needle, $path = '/', $recursive = true) { return $this->getAdapter($adapter)->search($path, $needle, $recursive); } /** * Checks if the given path is an allowed media file. * * @param string $path The path to file * * @return boolean * * @since 4.0.0 */ private function isMediaFile($path) { // Check if there is an extension available if (!strrpos($path, '.')) { return false; } // Initialize the allowed extensions if ($this->allowedExtensions === null) { // Get options from the input or fallback to images only $mediaTypes = explode(',', Factory::getApplication()->getInput()->getString('mediatypes', '0')); $types = []; $extensions = []; // Default to showing all supported formats if (count($mediaTypes) === 0) { $mediaTypes = ['0', '1', '2', '3']; } array_map( function ($mediaType) use (&$types) { switch ($mediaType) { case '0': $types[] = 'images'; break; case '1': $types[] = 'audios'; break; case '2': $types[] = 'videos'; break; case '3': $types[] = 'documents'; break; default: break; } }, $mediaTypes ); $images = array_map( 'trim', explode( ',', ComponentHelper::getParams('com_media')->get( 'image_extensions', 'bmp,gif,jpg,jpeg,png,webp' ) ) ); $audios = array_map( 'trim', explode( ',', ComponentHelper::getParams('com_media')->get( 'audio_extensions', 'mp3,m4a,mp4a,ogg' ) ) ); $videos = array_map( 'trim', explode( ',', ComponentHelper::getParams('com_media')->get( 'video_extensions', 'mp4,mp4v,mpeg,mov,webm' ) ) ); $documents = array_map( 'trim', explode( ',', ComponentHelper::getParams('com_media')->get( 'doc_extensions', 'doc,odg,odp,ods,odt,pdf,ppt,txt,xcf,xls,csv' ) ) ); foreach ($types as $type) { if (in_array($type, ['images', 'audios', 'videos', 'documents'])) { $extensions = array_merge($extensions, ${$type}); } } // Make them an array $this->allowedExtensions = $extensions; } // Extract the extension $extension = strtolower(substr($path, strrpos($path, '.') + 1)); // Check if the extension exists in the allowed extensions return in_array($extension, $this->allowedExtensions); } } PK ���\���'B B src/Model/MediaModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Administrator\Model; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Component\Media\Administrator\Provider\ProviderManagerHelperTrait; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Media View Model * * @since 4.0.0 */ class MediaModel extends BaseDatabaseModel { use ProviderManagerHelperTrait; /** * Obtain list of supported providers * * @return array * * @since 4.0.0 */ public function getProviders() { $results = []; foreach ($this->getProviderManager()->getProviders() as $provider) { $result = new \stdClass(); $result->name = $provider->getID(); $result->displayName = $provider->getDisplayName(); $result->adapterNames = []; foreach ($provider->getAdapters() as $adapter) { $result->adapterNames[] = $adapter->getAdapterName(); } $results[] = $result; } return $results; } } PK ���\�ZU>� � src/View/Media/HtmlView.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Administrator\View\Media; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Router\Route; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Media List View * * @since 4.0.0 */ class HtmlView extends BaseHtmlView { /** * Holds a list of providers * * @var array|string * * @since 4.0.0 */ protected $providers = null; /** * The current path of the media manager * * @var string * * @since 4.0.0 */ protected $currentPath; /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; * automatically searches through the template paths. * * @return void * * @since 4.0.0 */ public function display($tpl = null) { // Prepare the toolbar $this->prepareToolbar(); // Get enabled adapters $this->providers = $this->get('Providers'); // Check that there are providers if (!count($this->providers)) { $link = Route::_('index.php?option=com_plugins&view=plugins&filter[folder]=filesystem'); Factory::getApplication()->enqueueMessage(Text::sprintf('COM_MEDIA_ERROR_NO_PROVIDERS', $link), CMSApplication::MSG_WARNING); } $this->currentPath = Factory::getApplication()->getInput()->getString('path'); parent::display($tpl); } /** * Prepare the toolbar. * * @return void * * @since 4.0.0 */ protected function prepareToolbar() { $tmpl = Factory::getApplication()->getInput()->getCmd('tmpl'); $toolbar = Toolbar::getInstance(); $user = $this->getCurrentUser(); // Set the title ToolbarHelper::title(Text::_('COM_MEDIA'), 'images mediamanager'); // Add the upload and create folder buttons if ($user->authorise('core.create', 'com_media')) { // Add the upload button $layout = new FileLayout('toolbar.upload', JPATH_COMPONENT_ADMINISTRATOR . '/layouts'); $toolbar->customButton('upload') ->html($layout->render([])); $toolbar->divider(); // Add the create folder button $layout = new FileLayout('toolbar.create-folder', JPATH_COMPONENT_ADMINISTRATOR . '/layouts'); $toolbar->customButton('new') ->html($layout->render([])); $toolbar->divider(); } // Add a delete button if ($user->authorise('core.delete', 'com_media')) { // Instantiate a new FileLayout instance and render the layout $layout = new FileLayout('toolbar.delete', JPATH_COMPONENT_ADMINISTRATOR . '/layouts'); $toolbar->customButton('delete') ->html($layout->render([])); $toolbar->divider(); } // Add the preferences button if (($user->authorise('core.admin', 'com_media') || $user->authorise('core.options', 'com_media')) && $tmpl !== 'component') { $toolbar->preferences('com_media'); $toolbar->divider(); } if ($tmpl !== 'component') { $toolbar->help('Media'); } } } PK ���\�&�b@ @ src/View/File/HtmlView.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Administrator\View\File; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View to edit a file. * * @since 4.0.0 */ class HtmlView extends BaseHtmlView { /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void * * @since 4.0.0 */ public function display($tpl = null) { $input = Factory::getApplication()->getInput(); $this->form = $this->get('Form'); // The component params $this->params = ComponentHelper::getParams('com_media'); // The requested file $this->file = $this->getModel()->getFileInformation($input->getString('path', null)); if (empty($this->file->content)) { // @todo error handling controller redirect files throw new \Exception(Text::_('COM_MEDIA_ERROR_NO_CONTENT_AVAILABLE')); } $this->addToolbar(); parent::display($tpl); } /** * Add the toolbar buttons * * @return void * * @since 4.0.0 */ protected function addToolbar() { ToolbarHelper::title(Text::_('COM_MEDIA_EDIT'), 'images mediamanager'); $toolbar = Toolbar::getInstance(); $toolbar->apply('apply'); $toolbar->save('save'); $toolbar->standardButton('reset', 'COM_MEDIA_RESET', 'reset') ->icon('icon-refresh') ->listCheck(false); $toolbar->cancel('cancel'); } } PK ���\��* % src/Exception/FileExistsException.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_media * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Administrator\Exception; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Media file exists exception. * * @since 4.0.0 */ class FileExistsException extends \Exception { } PK ���\��{ &