Файловый менеджер - Редактировать - /home/harasnat/www/mf/com_privacy.zip
Назад
PK k�/[�w�� forms/remind.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <form> <fieldset name="default" label="COM_PRIVACY_REMIND_REQUEST_FIELDSET_LABEL"> <field name="email" type="text" label="JGLOBAL_EMAIL" description="COM_PRIVACY_FIELD_CONFIRM_EMAIL_DESC" validate="email" required="true" size="30" /> <field name="remind_token" type="text" label="COM_PRIVACY_FIELD_REMIND_CONFIRM_TOKEN_LABEL" description="COM_PRIVACY_FIELD_REMIND_CONFIRM_TOKEN_DESC" filter="alnum" required="true" size="32" /> </fieldset> </form> PK k�/[��7o o forms/confirm.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <form> <fieldset name="default" label="COM_PRIVACY_CONFIRM_REQUEST_FIELDSET_LABEL"> <field name="confirm_token" type="text" label="COM_PRIVACY_FIELD_CONFIRM_CONFIRM_TOKEN_LABEL" description="COM_PRIVACY_FIELD_CONFIRM_CONFIRM_TOKEN_DESC" filter="alnum" required="true" size="32" /> </fieldset> </form> PK k�/[d��� � forms/request.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <form> <fieldset name="default"> <field name="request_type" type="list" label="COM_PRIVACY_FIELD_REQUEST_TYPE_LABEL" description="COM_PRIVACY_FIELD_REQUEST_TYPE_DESC" filter="string" default="export" validate="options" > <option value="export">COM_PRIVACY_REQUEST_TYPE_EXPORT</option> <option value="remove">COM_PRIVACY_REQUEST_TYPE_REMOVE</option> </field> </fieldset> </form> PK k�/[�h�; ; src/View/Request/HtmlView.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_privacy * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Privacy\Site\View\Request; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Object\CMSObject; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Request view class * * @since 3.9.0 */ class HtmlView extends BaseHtmlView { /** * The form object * * @var Form * @since 3.9.0 */ protected $form; /** * The CSS class suffix to append to the view container * * @var string * @since 3.9.0 */ protected $pageclass_sfx; /** * The view parameters * * @var Registry * @since 3.9.0 */ protected $params; /** * Flag indicating the site supports sending email * * @var boolean * @since 3.9.0 */ protected $sendMailEnabled; /** * The state information * * @var CMSObject * @since 3.9.0 */ protected $state; /** * 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 * * @see BaseHtmlView::loadTemplate() * @since 3.9.0 * @throws \Exception */ public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->params = $this->state->params; $this->sendMailEnabled = (bool) Factory::getApplication()->get('mailonline', 1); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); parent::display($tpl); } /** * Prepares the document. * * @return void * * @since 3.9.0 */ protected function prepareDocument() { // Because the application sets a default page title, // we need to get it from the menu item itself $menu = Factory::getApplication()->getMenu()->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', Text::_('COM_PRIVACY_VIEW_REQUEST_PAGE_TITLE')); } $this->setDocumentTitle($this->params->get('page_title', '')); if ($this->params->get('menu-meta_description')) { $this->getDocument()->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('robots')) { $this->getDocument()->setMetaData('robots', $this->params->get('robots')); } } } PK k�/[�QI9 9 src/View/Confirm/HtmlView.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_privacy * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Privacy\Site\View\Confirm; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Object\CMSObject; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Request confirmation view class * * @since 3.9.0 */ class HtmlView extends BaseHtmlView { /** * The form object * * @var Form * @since 3.9.0 */ protected $form; /** * The CSS class suffix to append to the view container * * @var string * @since 3.9.0 */ protected $pageclass_sfx; /** * The view parameters * * @var Registry * @since 3.9.0 */ protected $params; /** * The state information * * @var CMSObject * @since 3.9.0 */ protected $state; /** * 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 * * @see BaseHtmlView::loadTemplate() * @since 3.9.0 * @throws \Exception */ public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->params = $this->state->params; // Check for errors. if (count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); parent::display($tpl); } /** * Prepares the document. * * @return void * * @since 3.9.0 */ protected function prepareDocument() { // Because the application sets a default page title, // we need to get it from the menu item itself $menu = Factory::getApplication()->getMenu()->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', Text::_('COM_PRIVACY_VIEW_CONFIRM_PAGE_TITLE')); } $this->setDocumentTitle($this->params->get('page_title', '')); if ($this->params->get('menu-meta_description')) { $this->getDocument()->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('robots')) { $this->getDocument()->setMetaData('robots', $this->params->get('robots')); } } } PK k�/[�W�6 6 src/View/Remind/HtmlView.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_privacy * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Privacy\Site\View\Remind; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Object\CMSObject; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Remind confirmation view class * * @since 3.9.0 */ class HtmlView extends BaseHtmlView { /** * The form object * * @var Form * @since 3.9.0 */ protected $form; /** * The CSS class suffix to append to the view container * * @var string * @since 3.9.0 */ protected $pageclass_sfx; /** * The view parameters * * @var Registry * @since 3.9.0 */ protected $params; /** * The state information * * @var CMSObject * @since 3.9.0 */ protected $state; /** * 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 * * @see BaseHtmlView::loadTemplate() * @since 3.9.0 * @throws \Exception */ public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->params = $this->state->params; // Check for errors. if (count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); parent::display($tpl); } /** * Prepares the document. * * @return void * * @since 3.9.0 */ protected function prepareDocument() { // Because the application sets a default page title, // we need to get it from the menu item itself $menu = Factory::getApplication()->getMenu()->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', Text::_('COM_PRIVACY_VIEW_REMIND_PAGE_TITLE')); } $this->setDocumentTitle($this->params->get('page_title', '')); if ($this->params->get('menu-meta_description')) { $this->getDocument()->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('robots')) { $this->getDocument()->setMetaData('robots', $this->params->get('robots')); } } } PK k�/[���* * $ src/Controller/DisplayController.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_privacy * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Privacy\Site\Controller; use Joomla\CMS\MVC\Controller\BaseController; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Privacy Controller * * @since 3.9.0 */ class DisplayController extends BaseController { /** * 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 $this * * @since 3.9.0 */ public function display($cachable = false, $urlparams = []) { $view = $this->input->get('view', $this->default_view); // Set a Referrer-Policy header for views which require it if (in_array($view, ['confirm', 'remind'])) { $this->app->setHeader('Referrer-Policy', 'no-referrer', true); } return parent::display($cachable, $urlparams); } } PK k�/[���{� � $ src/Controller/RequestController.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_privacy * * @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\Privacy\Site\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; use Joomla\Component\Privacy\Site\Model\ConfirmModel; use Joomla\Component\Privacy\Site\Model\RequestModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Request action controller class. * * @since 3.9.0 */ class RequestController extends BaseController { /** * Method to confirm the information request. * * @return boolean * * @since 3.9.0 */ public function confirm() { // Check the request token. $this->checkToken('post'); /** @var ConfirmModel $model */ $model = $this->getModel('Confirm', 'Site'); $data = $this->input->post->get('jform', [], 'array'); $return = $model->confirmRequest($data); // Check for a hard error. if ($return instanceof \Exception) { // Get the error message to display. if ($this->app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = Text::_('COM_PRIVACY_ERROR_CONFIRMING_REQUEST'); } // Go back to the confirm form. $this->setRedirect(Route::_('index.php?option=com_privacy&view=confirm', false), $message, 'error'); return false; } elseif ($return === false) { // Confirm failed. // Go back to the confirm form. $message = Text::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REQUEST_FAILED', $model->getError()); $this->setRedirect(Route::_('index.php?option=com_privacy&view=confirm', false), $message, 'notice'); return false; } else { // Confirm succeeded. $this->setRedirect(Route::_(Uri::root()), Text::_('COM_PRIVACY_CONFIRM_REQUEST_SUCCEEDED'), 'info'); return true; } } /** * Method to submit an information request. * * @return boolean * * @since 3.9.0 */ public function submit() { // Check the request token. $this->checkToken('post'); /** @var RequestModel $model */ $model = $this->getModel('Request', 'Site'); $data = $this->input->post->get('jform', [], 'array'); $return = $model->createRequest($data); // Check for a hard error. if ($return instanceof \Exception) { // Get the error message to display. if ($this->app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = Text::_('COM_PRIVACY_ERROR_CREATING_REQUEST'); } // Go back to the confirm form. $this->setRedirect(Route::_('index.php?option=com_privacy&view=request', false), $message, 'error'); return false; } elseif ($return === false) { // Confirm failed. // Go back to the confirm form. $message = Text::sprintf('COM_PRIVACY_ERROR_CREATING_REQUEST_FAILED', $model->getError()); $this->setRedirect(Route::_('index.php?option=com_privacy&view=request', false), $message, 'notice'); return false; } else { // Confirm succeeded. $this->setRedirect(Route::_(Uri::root()), Text::_('COM_PRIVACY_CREATE_REQUEST_SUCCEEDED'), 'info'); return true; } } /** * Method to extend the privacy consent. * * @return boolean * * @since 3.9.0 */ public function remind() { // Check the request token. $this->checkToken('post'); /** @var ConfirmModel $model */ $model = $this->getModel('Remind', 'Site'); $data = $this->input->post->get('jform', [], 'array'); $return = $model->remindRequest($data); // Check for a hard error. if ($return instanceof \Exception) { // Get the error message to display. if ($this->app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = Text::_('COM_PRIVACY_ERROR_REMIND_REQUEST'); } // Go back to the confirm form. $this->setRedirect(Route::_('index.php?option=com_privacy&view=remind', false), $message, 'error'); return false; } elseif ($return === false) { // Confirm failed. // Go back to the confirm form. $message = Text::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REMIND_FAILED', $model->getError()); $this->setRedirect(Route::_('index.php?option=com_privacy&view=remind', false), $message, 'notice'); return false; } else { // Confirm succeeded. $this->setRedirect(Route::_(Uri::root()), Text::_('COM_PRIVACY_CONFIRM_REMIND_SUCCEEDED'), 'info'); return true; } } } PK k�/[_�� � src/Model/RemindModel.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_privacy * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Privacy\Site\Model; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\AdminModel; use Joomla\CMS\String\PunycodeHelper; use Joomla\CMS\Table\Table; use Joomla\CMS\User\UserHelper; use Joomla\Component\Privacy\Administrator\Table\ConsentTable; use Joomla\Database\Exception\ExecutionFailureException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Remind confirmation model class. * * @since 3.9.0 */ class RemindModel extends AdminModel { /** * Confirms the remind request. * * @param array $data The data expected for the form. * * @return mixed \Exception | JException | boolean * * @since 3.9.0 */ public function remindRequest($data) { // Get the form. $form = $this->getForm(); $data['email'] = PunycodeHelper::emailToPunycode($data['email']); // Check for an error. if ($form instanceof \Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof \Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $formError) { $this->setError($formError->getMessage()); } return false; } /** @var ConsentTable $table */ $table = $this->getTable(); $db = $this->getDatabase(); $query = $db->getQuery(true) ->select($db->quoteName(['r.id', 'r.user_id', 'r.token'])); $query->from($db->quoteName('#__privacy_consents', 'r')); $query->join( 'LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('r.user_id') ); $query->where($db->quoteName('u.email') . ' = :email') ->bind(':email', $data['email']); $query->where($db->quoteName('r.remind') . ' = 1'); $db->setQuery($query); try { $remind = $db->loadObject(); } catch (ExecutionFailureException $e) { $this->setError(Text::_('COM_PRIVACY_ERROR_NO_PENDING_REMIND')); return false; } if (!$remind) { $this->setError(Text::_('COM_PRIVACY_ERROR_NO_PENDING_REMIND')); return false; } // Verify the token if (!UserHelper::verifyPassword($data['remind_token'], $remind->token)) { $this->setError(Text::_('COM_PRIVACY_ERROR_NO_REMIND_REQUESTS')); return false; } // Everything is good to go, transition the request to extended $saved = $this->save( [ 'id' => $remind->id, 'remind' => 0, 'token' => '', 'created' => Factory::getDate()->toSql(), ] ); if (!$saved) { // Error was set by the save method return false; } return true; } /** * Method for getting the form from the model. * * @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 Form|boolean A Form object on success, false on failure * * @since 3.9.0 */ public function getForm($data = [], $loadData = true) { // Get the form. $form = $this->loadForm('com_privacy.remind', 'remind', ['control' => 'jform']); if (empty($form)) { return false; } $input = Factory::getApplication()->getInput(); if ($input->getMethod() === 'GET') { $form->setValue('remind_token', '', $input->get->getAlnum('remind_token')); } return $form; } /** * Method to get a table object, load it if necessary. * * @param string $name The table name. Optional. * @param string $prefix The class prefix. Optional. * @param array $options Configuration array for model. Optional. * * @return Table A Table object * * @throws \Exception * @since 3.9.0 */ public function getTable($name = 'Consent', $prefix = 'Administrator', $options = []) { return parent::getTable($name, $prefix, $options); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 3.9.0 */ protected function populateState() { // Get the application object. $params = Factory::getApplication()->getParams('com_privacy'); // Load the parameters. $this->setState('params', $params); } } PK k�/[3��b"