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 �!�\���9 9 DisplayController.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Site\Controller; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Contact Component Controller * * @since 1.5 */ class DisplayController extends BaseController { /** * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'default_task', 'model_path', and * 'view_path' (this list is not meant to be comprehensive). * @param ?MVCFactoryInterface $factory The factory. * @param ?CMSApplication $app The Application for the dispatcher * @param ?\Joomla\CMS\Input\Input $input The Input object for the request * * @since 3.0 */ public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null) { // Contact frontpage Editor contacts proxying. $input = Factory::getApplication()->getInput(); if ($input->get('view') === 'contacts' && $input->get('layout') === 'modal') { $config['base_path'] = JPATH_ADMINISTRATOR . '/components/com_contact'; } parent::__construct($config, $factory, $app, $input); } /** * Method to display a view. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe URL parameters and their variable types. * @see \Joomla\CMS\Filter\InputFilter::clean() for valid values. * * @return DisplayController This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = []) { if ($this->app->getUserState('com_contact.contact.data') === null) { $cachable = true; } // Set the default view name and format from the Request. $vName = $this->input->get('view', 'categories'); $this->input->set('view', $vName); if ($this->app->getIdentity()->id) { $cachable = false; } $safeurlparams = [ 'catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', ]; parent::display($cachable, $safeurlparams); return $this; } } PK S$�\�[�; �; ContactController.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Site\Controller; use Joomla\CMS\Event\Contact\SubmitContactEvent; use Joomla\CMS\Event\Contact\ValidateContactEvent; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Log\Log; use Joomla\CMS\Mail\Exception\MailDisabledException; use Joomla\CMS\Mail\MailTemplate; use Joomla\CMS\MVC\Controller\FormController; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\String\PunycodeHelper; use Joomla\CMS\Uri\Uri; use Joomla\CMS\User\UserFactoryAwareInterface; use Joomla\CMS\User\UserFactoryAwareTrait; use Joomla\CMS\Versioning\VersionableControllerTrait; use Joomla\Component\Fields\Administrator\Helper\FieldsHelper; use Joomla\Utilities\ArrayHelper; use PHPMailer\PHPMailer\Exception as phpMailerException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Controller for single contact view * * @since 1.5.19 */ class ContactController extends FormController implements UserFactoryAwareInterface { use UserFactoryAwareTrait; use VersionableControllerTrait; /** * The URL view item variable. * * @var string * @since 4.0.0 */ protected $view_item = 'form'; /** * The URL view list variable. * * @var string * @since 4.0.0 */ protected $view_list = 'categories'; /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model. * * @since 1.6.4 */ public function getModel($name = 'form', $prefix = '', $config = ['ignore_request' => true]) { return parent::getModel($name, $prefix, ['ignore_request' => false]); } /** * Method to submit the contact form and send an email. * * @return boolean True on success sending the email. False on failure. * * @since 1.5.19 */ public function submit() { // Check for request forgeries. $this->checkToken(); $app = $this->app; $model = $this->getModel('contact'); $stub = $this->input->getString('id'); $id = (int) $stub; // Get the data from POST $data = $this->input->post->get('jform', [], 'array'); // Get item $model->setState('filter.published', 1); $contact = $model->getItem($id); if ($contact === false) { $this->setMessage($model->getError(), 'error'); return false; } // Get item params, take menu parameters into account if necessary $active = $app->getMenu()->getActive(); $stateParams = clone $model->getState()->get('params'); // If the current view is the active item and a contact view for this contact, then the menu item params take priority if ($active && strpos($active->link, 'view=contact') && strpos($active->link, '&id=' . (int) $contact->id)) { // $item->params are the contact params, $temp are the menu item params // Merge so that the menu item params take priority $contact->params->merge($stateParams); } else { // Current view is not a single contact, so the contact params take priority here $stateParams->merge($contact->params); $contact->params = $stateParams; } // Check if the contact form is enabled if (!$contact->params->get('show_email_form')) { $this->setRedirect(Route::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false)); return false; } // Check for a valid session cookie if ($contact->params->get('validate_session', 0)) { if (Factory::getSession()->getState() !== 'active') { $this->app->enqueueMessage(Text::_('JLIB_ENVIRONMENT_SESSION_INVALID'), 'warning'); // Save the data in the session. $this->app->setUserState('com_contact.contact.data', $data); // Redirect back to the contact form. $this->setRedirect(Route::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false)); return false; } } // Contact plugins PluginHelper::importPlugin('contact'); // Validate the posted data. $form = $model->getForm(); if (!$form) { throw new \Exception($model->getError(), 500); } if (!$model->validate($form, $data)) { $errors = $model->getErrors(); foreach ($errors as $error) { $errorMessage = $error; if ($error instanceof \Exception) { $errorMessage = $error->getMessage(); } $app->enqueueMessage($errorMessage, 'error'); } $app->setUserState('com_contact.contact.data', $data); $this->setRedirect(Route::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false)); return false; } // Validation succeeded, continue with custom handlers $results = $this->getDispatcher()->dispatch('onValidateContact', new ValidateContactEvent('onValidateContact', [ 'subject' => $contact, 'data' => &$data, // @todo: Remove reference in Joomla 6, @deprecated: Data modification onValidateContact is not allowed, use onSubmitContact instead ]))->getArgument('result', []); $passValidation = true; foreach ($results as $result) { if ($result instanceof \Exception) { $passValidation = false; $app->enqueueMessage($result->getMessage(), 'error'); } } if (!$passValidation) { $app->setUserState('com_contact.contact.data', $data); $this->setRedirect(Route::_('index.php?option=com_contact&view=contact&id=' . $id . '&catid=' . $contact->catid, false)); return false; } // Passed Validation: Process the contact plugins to integrate with other applications $event = $this->getDispatcher()->dispatch('onSubmitContact', new SubmitContactEvent('onSubmitContact', [ 'subject' => $contact, 'data' => &$data, // @todo: Remove reference in Joomla 6, see SubmitContactEvent::__constructor() ])); // Get the final data $data = $event->getArgument('data', $data); // Send the email $sent = false; if (!$contact->params->get('custom_reply')) { $sent = $this->_sendEmail($data, $contact, $contact->params->get('show_email_copy', 0)); } $msg = ''; // Set the success message if it was a success if ($sent) { $msg = Text::_('COM_CONTACT_EMAIL_THANKS'); } // Flush the data from the session $this->app->setUserState('com_contact.contact.data', null); // Redirect if it is set in the parameters, otherwise redirect back to where we came from if ($contact->params->get('redirect')) { $this->setRedirect($contact->params->get('redirect'), $msg); } else { $this->setRedirect(Route::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false), $msg); } return true; } /** * Method to get a model object, loading it if required. * * @param array $data The data to send in the email. * @param \stdClass $contact The user information to send the email to * @param boolean $emailCopyToSender True to send a copy of the email to the user. * * @return boolean True on success sending the email, false on failure. * * @since 1.6.4 */ private function _sendEmail($data, $contact, $emailCopyToSender) { $app = $this->app; if ($contact->email_to == '' && $contact->user_id != 0) { $contact_user = $this->getUserFactory()->loadUserById($contact->user_id); $contact->email_to = $contact_user->email; } $templateData = [ 'sitename' => $app->get('sitename'), 'name' => $data['contact_name'], 'contactname' => $contact->name, 'email' => PunycodeHelper::emailToPunycode($data['contact_email']), 'subject' => $data['contact_subject'], 'body' => stripslashes($data['contact_message']), 'url' => Uri::base(), 'customfields' => '', ]; // Load the custom fields if (!empty($data['com_fields']) && $fields = FieldsHelper::getFields('com_contact.mail', $contact, true, $data['com_fields'])) { $output = FieldsHelper::render( 'com_contact.mail', 'fields.render', [ 'context' => 'com_contact.mail', 'item' => $contact, 'fields' => $fields, ] ); if ($output) { $templateData['customfields'] = $output; } } try { $mailer = new MailTemplate('com_contact.mail', $app->getLanguage()->getTag()); $mailer->addRecipient($contact->email_to); $mailer->setReplyTo($templateData['email'], $templateData['name']); $mailer->addTemplateData($templateData); $mailer->addUnsafeTags(['name', 'email', 'body']); $sent = $mailer->send(); // If we are supposed to copy the sender, do so. if ($emailCopyToSender && !empty($data['contact_email_copy'])) { $mailer = new MailTemplate('com_contact.mail.copy', $app->getLanguage()->getTag()); $mailer->addRecipient($templateData['email']); $mailer->setReplyTo($templateData['email'], $templateData['name']); $mailer->addTemplateData($templateData); $mailer->addUnsafeTags(['name', 'email', 'body']); $sent = $mailer->send(); } } catch (MailDisabledException | phpMailerException $exception) { try { Log::add(Text::_($exception->getMessage()), Log::WARNING, 'jerror'); $sent = false; } catch (\RuntimeException $exception) { $this->app->enqueueMessage(Text::_($exception->getMessage()), 'warning'); $sent = false; } } return $sent; } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 4.0.0 */ protected function allowAdd($data = []) { if ($categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int')) { $user = $this->app->getIdentity(); // If the category has been passed in the data or URL check it. return $user->authorise('core.create', 'com_contact.category.' . $categoryId); } // In the absence of better information, revert to the component permissions. return parent::allowAdd(); } /** * Method override to check if you can edit an existing record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @since 4.0.0 */ protected function allowEdit($data = [], $key = 'id') { $recordId = isset($data[$key]) ? (int) $data[$key] : 0; if (!$recordId) { return false; } // Need to do a lookup from the model. $record = $this->getModel()->getItem($recordId); $categoryId = (int) $record->catid; if ($categoryId) { $user = $this->app->getIdentity(); // The category has been set. Check the category permissions. if ($user->authorise('core.edit', $this->option . '.category.' . $categoryId)) { return true; } // Fallback on edit.own. if ($user->authorise('core.edit.own', $this->option . '.category.' . $categoryId)) { return $record->created_by === $user->id; } return false; } // Since there is no asset tracking, revert to the component permissions. return parent::allowEdit($data, $key); } /** * Method to cancel an edit. * * @param string $key The name of the primary key of the URL variable. * * @return boolean True if access level checks pass, false otherwise. * * @since 4.0.0 */ public function cancel($key = null) { $result = parent::cancel($key); $this->setRedirect(Route::_($this->getReturnPage(), false)); return $result; } /** * Gets the URL arguments to append to an item redirect. * * @param integer $recordId The primary key id for the item. * @param string $urlVar The name of the URL variable for the id. * * @return string The arguments to append to the redirect URL. * * @since 4.0.0 */ protected function getRedirectToItemAppend($recordId = 0, $urlVar = 'id') { // Need to override the parent method completely. $tmpl = $this->input->get('tmpl'); $append = ''; // Setup redirect info. if ($tmpl) { $append .= '&tmpl=' . $tmpl; } $append .= '&layout=edit'; $append .= '&' . $urlVar . '=' . (int) $recordId; $itemId = $this->input->getInt('Itemid'); $return = $this->getReturnPage(); $catId = $this->input->getInt('catid'); if ($itemId) { $append .= '&Itemid=' . $itemId; } if ($catId) { $append .= '&catid=' . $catId; } if ($return) { $append .= '&return=' . base64_encode($return); } return $append; } /** * Get the return URL. * * If a "return" variable has been passed in the request * * @return string The return URL. * * @since 4.0.0 */ protected function getReturnPage() { $return = $this->input->get('return', null, 'base64'); if (empty($return) || !Uri::isInternal(base64_decode($return))) { return Uri::base(); } return base64_decode($return); } } PK )1�\Ƞ�C C FeedsController.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_newsfeeds * * @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\Newsfeeds\Api\Controller; use Joomla\CMS\MVC\Controller\ApiController; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The feeds controller * * @since 4.0.0 */ class FeedsController extends ApiController { /** * The content type of the item. * * @var string * @since 4.0.0 */ protected $contentType = 'newsfeeds'; /** * The default view for the display method. * * @var string * @since 3.0 */ protected $default_view = 'feeds'; } 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 �!�\���9 9 (� DisplayController.phpnu �[��� PK S$�\�[�; �; �� ContactController.phpnu �[��� PK )1�\Ƞ�C C �� FeedsController.phpnu �[��� PK F �
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings