File manager - Edit - /home/ferretapmx/public_html/Controller.zip
Back
PK e �\l߮�F/ F/ MediaController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_media * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Api\Controller; use Joomla\CMS\Access\Exception\NotAllowed; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Filter\InputFilter; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\ApiController; use Joomla\Component\Media\Administrator\Exception\FileExistsException; use Joomla\Component\Media\Administrator\Exception\InvalidPathException; use Joomla\Component\Media\Administrator\Provider\ProviderManagerHelperTrait; use Joomla\Component\Media\Api\Model\MediumModel; use Joomla\String\Inflector; use Tobscure\JsonApi\Exception\InvalidParameterException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Media web service controller. * * @since 4.1.0 */ class MediaController extends ApiController { use ProviderManagerHelperTrait; /** * The content type of the item. * * @var string * @since 4.1.0 */ protected $contentType = 'media'; /** * Query parameters => model state mappings * * @var array * @since 4.1.0 */ private static $listQueryModelStateMap = [ 'path' => [ 'name' => 'path', 'type' => 'STRING', ], 'url' => [ 'name' => 'url', 'type' => 'BOOLEAN', ], 'temp' => [ 'name' => 'temp', 'type' => 'BOOLEAN', ], 'content' => [ 'name' => 'content', 'type' => 'BOOLEAN', ], ]; /** * Item query parameters => model state mappings * * @var array * @since 4.1.0 */ private static $itemQueryModelStateMap = [ 'path' => [ 'name' => 'path', 'type' => 'STRING', ], 'url' => [ 'name' => 'url', 'type' => 'BOOLEAN', ], 'temp' => [ 'name' => 'temp', 'type' => 'BOOLEAN', ], 'content' => [ 'name' => 'content', 'type' => 'BOOLEAN', ], ]; /** * The default view for the display method. * * @var string * * @since 4.1.0 */ protected $default_view = 'media'; /** * Display a list of files and/or folders. * * @return static A \JControllerLegacy object to support chaining. * * @since 4.1.0 * * @throws \Exception */ public function displayList() { // Set list specific request parameters in model state. $this->setModelState(self::$listQueryModelStateMap); // Display files in specific path. if ($this->input->exists('path')) { $this->modelState->set('path', $this->input->get('path', '', 'STRING')); } // Return files (not folders) as urls. if ($this->input->exists('url')) { $this->modelState->set('url', $this->input->get('url', true, 'BOOLEAN')); } // Map JSON:API compliant filter[search] to com_media model state. $apiFilterInfo = $this->input->get('filter', [], 'array'); $filter = InputFilter::getInstance(); // Search for files matching (part of) a name or glob pattern. if (\array_key_exists('search', $apiFilterInfo)) { $this->modelState->set('search', $filter->clean($apiFilterInfo['search'], 'STRING')); // Tell model to search recursively $this->modelState->set('search_recursive', $this->input->get('search_recursive', false, 'BOOLEAN')); } return parent::displayList(); } /** * Display one specific file or folder. * * @param string $path The path of the file to display. Leave empty if you want to retrieve data from the request. * * @return static A \JControllerLegacy object to support chaining. * * @since 4.1.0 * * @throws InvalidPathException * @throws \Exception */ public function displayItem($path = '') { // Set list specific request parameters in model state. $this->setModelState(self::$itemQueryModelStateMap); // Display files in specific path. $this->modelState->set('path', $path ?: $this->input->get('path', '', 'STRING')); // Return files (not folders) as urls. if ($this->input->exists('url')) { $this->modelState->set('url', $this->input->get('url', true, 'BOOLEAN')); } return parent::displayItem(); } /** * Set model state using a list of mappings between query parameters and model state names. * * @param array $mappings A list of mappings between query parameters and model state names. * * @return void * * @since 4.1.0 */ private function setModelState(array $mappings): void { foreach ($mappings as $queryName => $modelState) { if ($this->input->exists($queryName)) { $this->modelState->set($modelState['name'], $this->input->get($queryName, '', $modelState['type'])); } } } /** * Method to add a new file or folder. * * @return void * * @since 4.1.0 * * @throws FileExistsException * @throws InvalidPathException * @throws InvalidParameterException * @throws \RuntimeException * @throws \Exception */ public function add(): void { $path = $this->input->json->get('path', '', 'STRING'); $content = $this->input->json->get('content', '', 'RAW'); $missingParameters = []; if (empty($path)) { $missingParameters[] = 'path'; } // Content is only required when it is a file if (empty($content) && str_contains($path, '.')) { $missingParameters[] = 'content'; } if (\count($missingParameters)) { throw new InvalidParameterException( Text::sprintf('WEBSERVICE_COM_MEDIA_MISSING_REQUIRED_PARAMETERS', implode(' & ', $missingParameters)) ); } $this->modelState->set('path', $this->input->json->get('path', '', 'STRING')); // Check if an existing file may be overwritten. Defaults to false. $this->modelState->set('override', $this->input->json->get('override', false)); parent::add(); } /** * Method to check if it's allowed to add a new file or folder * * @param array $data An array of input data. * * @return boolean * * @since 4.1.0 */ protected function allowAdd($data = []): bool { $user = $this->app->getIdentity(); // In the override mode, adding a file will override and therefore edit an existing file if ($this->input->json->get('override', false)) { return $user->authorise('core.edit', 'com_media'); } return $user->authorise('core.create', 'com_media'); } /** * Method to modify an existing file or folder. * * @return void * * @since 4.1.0 * * @throws FileExistsException * @throws InvalidPathException * @throws \RuntimeException * @throws \Exception */ public function edit(): void { // Access check. if (!$this->allowEdit()) { throw new NotAllowed('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED', 403); } $path = $this->input->json->get('path', '', 'STRING'); $content = $this->input->json->get('content', '', 'RAW'); if (empty($path) && empty($content)) { throw new InvalidParameterException( Text::sprintf('WEBSERVICE_COM_MEDIA_MISSING_REQUIRED_PARAMETERS', 'path | content') ); } $this->modelState->set('path', $this->input->json->get('path', '', 'STRING')); // For renaming/moving files, we need the path to the existing file or folder. $this->modelState->set('old_path', $this->input->get('path', '', 'STRING')); // Check if an existing file may be overwritten. Defaults to true. $this->modelState->set('override', $this->input->json->get('override', true)); $recordId = $this->save(); $this->displayItem($recordId); } /** * Method to check if it's allowed to modify an existing file or folder. * * @param array $data An array of input data. * * @return boolean * * @since 4.1.0 */ protected function allowEdit($data = [], $key = 'id'): bool { $user = $this->app->getIdentity(); // com_media's access rules contains no specific update rule. return $user->authorise('core.edit', 'com_media'); } /** * Method to create or modify a file or folder. * * @param integer $recordKey The primary key of the item (if exists) * * @return string The path * * @since 4.1.0 */ protected function save($recordKey = null) { // Explicitly get the single item model name. $modelName = $this->input->get('model', Inflector::singularize($this->contentType)); /** @var MediumModel $model */ $model = $this->getModel($modelName, '', ['ignore_request' => true, 'state' => $this->modelState]); $json = $this->input->json; // Decode content, if any if ($content = base64_decode($json->get('content', '', 'raw'))) { $this->checkContent(); } // If there is no content, com_media assumes the path refers to a folder. $this->modelState->set('content', $content); return $model->save(); } /** * Performs various checks to see if it is allowed to save the content. * * @return void * * @since 4.1.0 * * @throws \RuntimeException */ private function checkContent(): void { $params = ComponentHelper::getParams('com_media'); $helper = new \Joomla\CMS\Helper\MediaHelper(); $serverlength = $this->input->server->getInt('CONTENT_LENGTH'); // Check if the size of the request body does not exceed various server imposed limits. if ( ($params->get('upload_maxsize', 0) > 0 && $serverlength > ($params->get('upload_maxsize', 0) * 1024 * 1024)) || $serverlength > $helper->toBytes(\ini_get('upload_max_filesize')) || $serverlength > $helper->toBytes(\ini_get('post_max_size')) || $serverlength > $helper->toBytes(\ini_get('memory_limit')) ) { throw new \RuntimeException(Text::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'), 400); } } /** * Method to delete an existing file or folder. * * @return void * * @since 4.1.0 * * @throws InvalidPathException * @throws \RuntimeException * @throws \Exception */ public function delete($id = null): void { if (!$this->allowDelete()) { throw new NotAllowed('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED', 403); } $this->modelState->set('path', $this->input->get('path', '', 'STRING')); $modelName = $this->input->get('model', Inflector::singularize($this->contentType)); $model = $this->getModel($modelName, '', ['ignore_request' => true, 'state' => $this->modelState]); $model->delete(); $this->app->setHeader('status', 204); } /** * Method to check if it's allowed to delete an existing file or folder. * * @return boolean * * @since 4.1.0 */ protected function allowDelete(): bool { $user = $this->app->getIdentity(); return $user->authorise('core.delete', 'com_media'); } } PK e �\�[�JY Y AdaptersController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_media * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Media\Api\Controller; use Joomla\CMS\MVC\Controller\ApiController; 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 /** * Media web service controller. * * @since 4.1.0 */ class AdaptersController extends ApiController { use ProviderManagerHelperTrait; /** * The content type of the item. * * @var string * @since 4.1.0 */ protected $contentType = 'adapters'; /** * The default view for the display method. * * @var string * * @since 4.1.0 */ protected $default_view = 'adapters'; /** * Display one specific adapter. * * @param string $path The path of the file to display. Leave empty if you want to retrieve data from the request. * * @return static A \JControllerLegacy object to support chaining. * * @throws InvalidPathException * @throws \Exception * * @since 4.1.0 */ public function displayItem($path = '') { // Set the id as the parent sets it as int $this->modelState->set('id', $this->input->get('id', '', 'string')); return parent::displayItem(); } } PK e �\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK w �\-�JI I MessagesController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_messages * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Messages\Api\Controller; use Joomla\CMS\MVC\Controller\ApiController; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The messages controller * * @since 4.0.0 */ class MessagesController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'messages'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'messages'; } PK | �\<=0O O StylesController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_templates * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Templates\Api\Controller; use Joomla\CMS\MVC\Controller\ApiController; use Joomla\String\Inflector; use Tobscure\JsonApi\Exception\InvalidParameterException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The styles controller * * @since 4.0.0 */ class StylesController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'styles'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'styles'; /** * Basic display of an item view * * @param integer $id The primary key to display. Leave empty if you want to retrieve data from the request * * @return static A \JControllerLegacy object to support chaining. * * @since 4.0.0 */ public function displayItem($id = null) { $this->modelState->set('client_id', $this->getClientIdFromInput()); return parent::displayItem($id); } /** * Basic display of a list view * * @return static A \JControllerLegacy object to support chaining. * * @since 4.0.0 */ public function displayList() { $this->modelState->set('client_id', $this->getClientIdFromInput()); return parent::displayList(); } /** * Method to allow extended classes to manipulate the data to be saved for an extension. * * @param array $data An array of input data. * * @return array * * @since 4.0.0 * @throws InvalidParameterException */ protected function preprocessSaveData(array $data): array { $data['client_id'] = $this->getClientIdFromInput(); // If we are updating an item the template is a readonly property based on the ID if ($this->input->getMethod() === 'PATCH') { if (\array_key_exists('template', $data)) { unset($data['template']); } $model = $this->getModel(Inflector::singularize($this->contentType), '', ['ignore_request' => true]); $data['template'] = $model->getItem($this->input->getInt('id'))->template; } return $data; } /** * Get client id from input * * @return string * * @since 4.0.0 */ private function getClientIdFromInput() { return $this->input->exists('client_id') ? $this->input->get('client_id') : $this->input->post->get('client_id'); } } PK !�\/��+ ArticlesController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_content * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Api\Controller; use Joomla\CMS\Filter\InputFilter; use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\MVC\Controller\ApiController; use Joomla\Component\Fields\Administrator\Helper\FieldsHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The article controller * * @since 4.0.0 */ class ArticlesController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'articles'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'articles'; /** * Article list view amended to add filtering of data * * @return static A BaseController object to support chaining. * * @since 4.0.0 */ public function displayList() { $apiFilterInfo = $this->input->get('filter', [], 'array'); $filter = InputFilter::getInstance(); if (\array_key_exists('author', $apiFilterInfo)) { $this->modelState->set('filter.author_id', $filter->clean($apiFilterInfo['author'], 'INT')); } if (\array_key_exists('category', $apiFilterInfo)) { $this->modelState->set('filter.category_id', $filter->clean($apiFilterInfo['category'], 'INT')); } if (\array_key_exists('search', $apiFilterInfo)) { $this->modelState->set('filter.search', $filter->clean($apiFilterInfo['search'], 'STRING')); } if (\array_key_exists('state', $apiFilterInfo)) { $this->modelState->set('filter.published', $filter->clean($apiFilterInfo['state'], 'INT')); } if (\array_key_exists('featured', $apiFilterInfo)) { $this->modelState->set('filter.featured', $filter->clean($apiFilterInfo['featured'], 'INT')); } if (\array_key_exists('tag', $apiFilterInfo)) { $this->modelState->set('filter.tag', $filter->clean($apiFilterInfo['tag'], 'INT')); } if (\array_key_exists('language', $apiFilterInfo)) { $this->modelState->set('filter.language', $filter->clean($apiFilterInfo['language'], 'STRING')); } if (\array_key_exists('checked_out', $apiFilterInfo)) { $this->modelState->set('filter.checked_out', $filter->clean($apiFilterInfo['checked_out'], 'INT')); } $apiListInfo = $this->input->get('list', [], 'array'); if (\array_key_exists('ordering', $apiListInfo)) { $this->modelState->set('list.ordering', $filter->clean($apiListInfo['ordering'], 'STRING')); } if (\array_key_exists('direction', $apiListInfo)) { $this->modelState->set('list.direction', $filter->clean($apiListInfo['direction'], 'STRING')); } return parent::displayList(); } /** * Method to allow extended classes to manipulate the data to be saved for an extension. * * @param array $data An array of input data. * * @return array * * @since 4.0.0 */ protected function preprocessSaveData(array $data): array { foreach (FieldsHelper::getFields('com_content.article') as $field) { if (isset($data[$field->name])) { !isset($data['com_fields']) && $data['com_fields'] = []; $data['com_fields'][$field->name] = $data[$field->name]; unset($data[$field->name]); } } if (($this->input->getMethod() === 'PATCH') && !(\array_key_exists('tags', $data))) { $tags = new TagsHelper(); $tags->getTagIds($data['id'], 'com_content.article'); $data['tags'] = explode(',', $tags->tags); } return $data; } } PK !�\��WO O LanguagesController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_languages * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Languages\Api\Controller; use Joomla\CMS\MVC\Controller\ApiController; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The languages controller * * @since 4.0.0 */ class LanguagesController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'languages'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'languages'; } PK !�\m♽� � ManageController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_installer * * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Installer\Api\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\ApiController; use Tobscure\JsonApi\Exception\InvalidParameterException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The manage controller * * @since 4.0.0 */ class ManageController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'manage'; /** * The default view for the display method. * * @var string * @since 4.0.0 */ protected $default_view = 'manage'; /** * Extension list view amended to add filtering of data * * @return static A BaseController object to support chaining. * * @since 4.0.0 */ public function displayList() { $requestBool = $this->input->get('core', $this->input->get->get('core')); if (!\is_null($requestBool) && $requestBool !== 'true' && $requestBool !== 'false') { // Send the error response $error = Text::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'core'); throw new InvalidParameterException($error, 400, null, 'core'); } if (!\is_null($requestBool)) { $this->modelState->set('filter.core', ($requestBool === 'true') ? '1' : '0'); } $this->modelState->set('filter.status', $this->input->get('status', $this->input->get->get('status', null, 'INT'), 'INT')); $this->modelState->set('filter.type', $this->input->get('type', $this->input->get->get('type', null, 'STRING'), 'STRING')); return parent::displayList(); } } PK !�\�0ڵ StringsController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_languages * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Languages\Api\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\ApiController; use Tobscure\JsonApi\Exception\InvalidParameterException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The strings controller * * @since 4.0.0 */ class StringsController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'strings'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'strings'; /** * Search by languages constants * * @return static A \JControllerLegacy object to support chaining. * * @throws InvalidParameterException * @since 4.0.0 */ public function search() { $data = $this->input->get('data', json_decode($this->input->json->getRaw(), true), 'array'); if (!isset($data['searchstring']) || !\is_string($data['searchstring'])) { throw new InvalidParameterException("Invalid param 'searchstring'"); } if (!isset($data['searchtype']) || !\in_array($data['searchtype'], ['constant', 'value'])) { throw new InvalidParameterException("Invalid param 'searchtype'"); } $this->input->set('searchstring', $data['searchstring']); $this->input->set('searchtype', $data['searchtype']); $this->input->set('more', 0); $viewType = $this->app->getDocument()->getType(); $viewName = $this->input->get('view', $this->default_view); $viewLayout = $this->input->get('layout', 'default', 'string'); try { /** @var \Joomla\Component\Languages\Api\View\Strings\JsonapiView $view */ $view = $this->getView( $viewName, $viewType, '', ['base_path' => $this->basePath, 'layout' => $viewLayout, 'contentType' => $this->contentType] ); } catch (\Exception $e) { throw new \RuntimeException($e->getMessage()); } /** @var \Joomla\Component\Languages\Administrator\Model\StringsModel $model */ $model = $this->getModel($this->contentType, '', ['ignore_request' => true]); if (!$model) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_MODEL_CREATE')); } // Push the model into the view (as default) $view->setModel($model, true); $view->document = $this->app->getDocument(); $view->displayList(); return $this; } /** * Refresh cache * * @return static A \JControllerLegacy object to support chaining. * * @throws \Exception * @since 4.0.0 */ public function refresh() { /** @var \Joomla\Component\Languages\Administrator\Model\StringsModel $model */ $model = $this->getModel($this->contentType, '', ['ignore_request' => true]); if (!$model) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_MODEL_CREATE')); } $result = $model->refresh(); if ($result instanceof \Exception) { throw $result; } return $this; } } PK !�\�\V�* * OverridesController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_languages * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Languages\Api\Controller; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\ApiController; use Joomla\CMS\MVC\Controller\Exception; use Joomla\String\Inflector; use Tobscure\JsonApi\Exception\InvalidParameterException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The overrides controller * * @since 4.0.0 */ class OverridesController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'overrides'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'overrides'; /** * Basic display of an item view * * @param integer $id The primary key to display. Leave empty if you want to retrieve data from the request * * @return static A \JControllerLegacy object to support chaining. * * @since 4.0.0 */ public function displayItem($id = null) { $this->modelState->set('filter.language', $this->getLanguageFromInput()); $this->modelState->set('filter.client', $this->getClientFromInput()); return parent::displayItem($id); } /** * Basic display of a list view * * @return static A \JControllerLegacy object to support chaining. * * @since 4.0.0 */ public function displayList() { $this->modelState->set('filter.language', $this->getLanguageFromInput()); $this->modelState->set('filter.client', $this->getClientFromInput()); return parent::displayList(); } /** * Method to save a record. * * @param integer $recordKey The primary key of the item (if exists) * * @return integer The record ID on success, false on failure * * @since 4.0.0 */ protected function save($recordKey = null) { /** @var \Joomla\CMS\MVC\Model\AdminModel $model */ $model = $this->getModel(Inflector::singularize($this->contentType)); if (!$model) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_MODEL_CREATE')); } $model->setState('filter.language', $this->input->post->get('lang_code')); $model->setState('filter.client', $this->input->post->get('app')); $data = $this->input->get('data', json_decode($this->input->json->getRaw(), true), 'array'); // @todo: Not the cleanest thing ever but it works... Form::addFormPath(JPATH_ADMINISTRATOR . '/components/com_languages/forms'); // Validate the posted data. $form = $model->getForm($data, false); if (!$form) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_FORM_CREATE')); } // Test whether the data is valid. $validData = $model->validate($form, $data); // Check for validation errors. if ($validData === false) { $errors = $model->getErrors(); $messages = []; for ($i = 0, $n = \count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof \Exception) { $messages[] = "{$errors[$i]->getMessage()}"; } else { $messages[] = "{$errors[$i]}"; } } throw new InvalidParameterException(implode("\n", $messages)); } if (!isset($validData['tags'])) { $validData['tags'] = []; } if (!$model->save($validData)) { throw new Exception\Save(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); } return $validData['key']; } /** * Removes an item. * * @param integer $id The primary key to delete item. * * @return void * * @since 4.0.0 */ public function delete($id = null) { $id = $this->input->get('id', '', 'string'); $this->input->set('model', $this->contentType); $this->modelState->set('filter.language', $this->getLanguageFromInput()); $this->modelState->set('filter.client', $this->getClientFromInput()); parent::delete($id); } /** * Get client code from input * * @return string * * @since 4.0.0 */ private function getClientFromInput() { return $this->input->exists('app') ? $this->input->get('app') : $this->input->post->get('app'); } /** * Get language code from input * * @return string * * @since 4.0.0 */ private function getLanguageFromInput() { return $this->input->exists('lang_code') ? $this->input->get('lang_code') : $this->input->post->get('lang_code'); } } PK e �\l߮�F/ F/ MediaController.phpnu �[��� PK e �\�[�JY Y �/ AdaptersController.phpnu �[��� PK e �\�Sʉ� � (6 .htaccessnu �7��m PK w �\-�JI I N7 MessagesController.phpnu �[��� PK | �\<=0O O �: StylesController.phpnu �[��� PK !�\/��+ pF ArticlesController.phpnu �[��� PK !�\��WO O �V LanguagesController.phpnu �[��� PK !�\m♽� � ]Z ManageController.phpnu �[��� PK !�\�0ڵ ]b StringsController.phpnu �[��� PK !�\�\V�* * �p OverridesController.phpnu �[��� PK I (�
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.09 |
proxy
|
phpinfo
|
Settings