| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/com_privacy.zip |
PK )r!]�b�gg g
config.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="privacy"
label="COM_PRIVACY_OPTION_LABEL"
>
<field
name="notify"
type="integer"
label="COM_PRIVACY_NOTIFY_LABEL"
description="COM_PRIVACY_NOTIFY_DESC"
first="1"
last="29"
step="1"
default="14"
filter="int"
validate="number"
/>
</fieldset>
</config>
PK )r!]oxV�� � privacy.phpnu &1i� <?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
*/
defined('_JEXEC') or die;
$controller = JControllerLegacy::getInstance('Privacy');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK )r!]��$J J privacy.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.9" method="upgrade">
<name>com_privacy</name>
<author>Joomla! Project</author>
<creationDate>May 2018</creationDate>
<copyright>(C) 2018 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.9.0</version>
<description>COM_PRIVACY_XML_DESCRIPTION</description>
<files folder="site">
<filename>controller.php</filename>
<filename>privacy.php</filename>
<filename>router.php</filename>
<folder>controllers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="site">
<language tag="en-GB">language/en-GB.com_privacy.ini</language>
</languages>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>privacy.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_privacy.ini</language>
<language tag="en-GB">language/en-GB.com_privacy.sys.ini</language>
</languages>
</administration>
</extension>
PK )r!]Nj�� � helpers/plugin.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
JLoader::register('PrivacyExportDomain', __DIR__ . '/export/domain.php');
JLoader::register('PrivacyExportField', __DIR__ . '/export/field.php');
JLoader::register('PrivacyExportItem', __DIR__ . '/export/item.php');
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
/**
* Base class for privacy plugins
*
* @since 3.9.0
*/
abstract class PrivacyPlugin extends JPlugin
{
/**
* Database object
*
* @var JDatabaseDriver
* @since 3.9.0
*/
protected $db;
/**
* Affects constructor behaviour. If true, language files will be loaded automatically.
*
* @var boolean
* @since 3.9.0
*/
protected $autoloadLanguage = true;
/**
* Create a new domain object
*
* @param string $name The domain's name
* @param string $description The domain's description
*
* @return PrivacyExportDomain
*
* @since 3.9.0
*/
protected function createDomain($name, $description = '')
{
$domain = new PrivacyExportDomain;
$domain->name = $name;
$domain->description = $description;
return $domain;
}
/**
* Create an item object for an array
*
* @param array $data The array data to convert
* @param integer|null $itemId The ID of this item
*
* @return PrivacyExportItem
*
* @since 3.9.0
*/
protected function createItemFromArray(array $data, $itemId = null)
{
$item = new PrivacyExportItem;
$item->id = $itemId;
foreach ($data as $key => $value)
{
if (is_object($value))
{
$value = (array) $value;
}
if (is_array($value))
{
$value = print_r($value, true);
}
$field = new PrivacyExportField;
$field->name = $key;
$field->value = $value;
$item->addField($field);
}
return $item;
}
/**
* Create an item object for a JTable object
*
* @param JTable $table The JTable object to convert
*
* @return PrivacyExportItem
*
* @since 3.9.0
*/
protected function createItemForTable($table)
{
$data = array();
foreach (array_keys($table->getFields()) as $fieldName)
{
$data[$fieldName] = $table->$fieldName;
}
return $this->createItemFromArray($data, $table->{$table->getKeyName(false)});
}
/**
* Helper function to create the domain for the items custom fields.
*
* @param string $context The context
* @param array $items The items
*
* @return PrivacyExportDomain
*
* @since 3.9.0
*/
protected function createCustomFieldsDomain($context, $items = array())
{
if (!is_array($items))
{
$items = array($items);
}
$parts = FieldsHelper::extract($context);
if (!$parts)
{
return array();
}
$type = str_replace('com_', '', $parts[0]);
$domain = $this->createDomain($type . '_' . $parts[1] . '_custom_fields', 'joomla_' . $type . '_' . $parts[1] . '_custom_fields_data');
foreach ($items as $item)
{
// Get item's fields, also preparing their value property for manual display
$fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], $item);
foreach ($fields as $field)
{
$fieldValue = is_array($field->value) ? implode(', ', $field->value) : $field->value;
$data = array(
$type . '_id' => $item->id,
'field_name' => $field->name,
'field_title' => $field->title,
'field_value' => $fieldValue,
);
$domain->addItem($this->createItemFromArray($data));
}
}
return $domain;
}
}
PK )r!]�P� helpers/export/domain.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
JLoader::register('PrivacyExportItem', __DIR__ . '/item.php');
/**
* Data object representing all data contained in a domain.
*
* A domain is typically a single database table and the items within the domain are separate rows from the table.
*
* @since 3.9.0
*/
class PrivacyExportDomain
{
/**
* The name of this domain
*
* @var string
* @since 3.9.0
*/
public $name;
/**
* A short description of the data in this domain
*
* @var string
* @since 3.9.0
*/
public $description;
/**
* The items belonging to this domain
*
* @var PrivacyExportItem[]
* @since 3.9.0
*/
protected $items = array();
/**
* Add an item to the domain
*
* @param PrivacyExportItem $item The item to add
*
* @return void
*
* @since 3.9.0
*/
public function addItem(PrivacyExportItem $item)
{
$this->items[] = $item;
}
/**
* Get the domain's items
*
* @return PrivacyExportItem[]
*
* @since 3.9.0
*/
public function getItems()
{
return $this->items;
}
}
PK )r!]�H8�� � helpers/export/item.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
JLoader::register('PrivacyExportField', __DIR__ . '/field.php');
/**
* Data object representing a single item within a domain.
*
* An item is typically a single row from a database table.
*
* @since 3.9.0
*/
class PrivacyExportItem
{
/**
* The primary identifier of this item, typically the primary key for a database row.
*
* @var integer
* @since 3.9.0
*/
public $id;
/**
* The fields belonging to this item
*
* @var PrivacyExportField[]
* @since 3.9.0
*/
protected $fields = array();
/**
* Add a field to the item
*
* @param PrivacyExportField $field The field to add
*
* @return void
*
* @since 3.9.0
*/
public function addField(PrivacyExportField $field)
{
$this->fields[] = $field;
}
/**
* Get the item's fields
*
* @return PrivacyExportField[]
*
* @since 3.9.0
*/
public function getFields()
{
return $this->fields;
}
}
PK )r!]y��, , helpers/export/field.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Data object representing a field within an item.
*
* @since 3.9.0
*/
class PrivacyExportField
{
/**
* The name of this field
*
* @var string
* @since 3.9.0
*/
public $name;
/**
* The field's value
*
* @var mixed
* @since 3.9.0
*/
public $value;
}
PK )r!]=*N helpers/html/helper.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Privacy component HTML helper.
*
* @since 3.9.0
*/
class PrivacyHtmlHelper
{
/**
* Render a status label
*
* @param integer $status The item status
*
* @return string
*
* @since 3.9.0
*/
public static function statusLabel($status)
{
switch ($status)
{
case 2:
return '<span class="label label-success">' . JText::_('COM_PRIVACY_STATUS_COMPLETED') . '</span>';
case 1:
return '<span class="label label-info">' . JText::_('COM_PRIVACY_STATUS_CONFIRMED') . '</span>';
case -1:
return '<span class="label label-important">' . JText::_('COM_PRIVACY_STATUS_INVALID') . '</span>';
default:
case 0:
return '<span class="label label-warning">' . JText::_('COM_PRIVACY_STATUS_PENDING') . '</span>';
}
}
}
PK )r!]�:�< < helpers/removal/status.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Data object communicating the status of whether the data for an information request can be removed.
*
* Typically, this object will only be used to communicate data will be removed.
*
* @since 3.9.0
*/
class PrivacyRemovalStatus
{
/**
* Flag indicating the status reported by the plugin on whether the information can be removed
*
* @var boolean
* @since 3.9.0
*/
public $canRemove = true;
/**
* A status message indicating the reason data can or cannot be removed
*
* @var string
* @since 3.9.0
*/
public $reason;
}
PK )r!]�7� helpers/privacy.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
/**
* Privacy component helper.
*
* @since 3.9.0
*/
class PrivacyHelper extends JHelperContent
{
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
*
* @return void
*
* @since 3.9.0
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('COM_PRIVACY_SUBMENU_DASHBOARD'),
'index.php?option=com_privacy&view=dashboard',
$vName === 'dashboard'
);
JHtmlSidebar::addEntry(
JText::_('COM_PRIVACY_SUBMENU_REQUESTS'),
'index.php?option=com_privacy&view=requests',
$vName === 'requests'
);
JHtmlSidebar::addEntry(
JText::_('COM_PRIVACY_SUBMENU_CAPABILITIES'),
'index.php?option=com_privacy&view=capabilities',
$vName === 'capabilities'
);
JHtmlSidebar::addEntry(
JText::_('COM_PRIVACY_SUBMENU_CONSENTS'),
'index.php?option=com_privacy&view=consents',
$vName === 'consents'
);
}
/**
* Render the data request as a XML document.
*
* @param PrivacyExportDomain[] $exportData The data to be exported.
*
* @return string
*
* @since 3.9.0
*/
public static function renderDataAsXml(array $exportData)
{
$export = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><data-export />');
foreach ($exportData as $domain)
{
$xmlDomain = $export->addChild('domain');
$xmlDomain->addAttribute('name', $domain->name);
$xmlDomain->addAttribute('description', $domain->description);
foreach ($domain->getItems() as $item)
{
$xmlItem = $xmlDomain->addChild('item');
if ($item->id)
{
$xmlItem->addAttribute('id', $item->id);
}
foreach ($item->getFields() as $field)
{
$xmlItem->{$field->name} = $field->value;
}
}
}
$dom = new DOMDocument;
$dom->loadXML($export->asXML());
$dom->formatOutput = true;
return $dom->saveXML();
}
/**
* Gets the privacyconsent system plugin extension id.
*
* @return integer The privacyconsent system plugin extension id.
*
* @since 3.9.2
*/
public static function getPrivacyConsentPluginId()
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
->where($db->quoteName('element') . ' = ' . $db->quote('privacyconsent'));
$db->setQuery($query);
try
{
$result = (int) $db->loadResult();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
}
return $result;
}
}
PK )r!]Q�FR R controllers/request.xml.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Request management controller class.
*
* @since 3.9.0
*/
class PrivacyControllerRequest extends JControllerLegacy
{
/**
* Method to export the data for a request.
*
* @return $this
*
* @since 3.9.0
*/
public function export()
{
$this->input->set('view', 'export');
return $this->display();
}
}
PK )r!]�J$�z z controllers/consents.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Consents management controller class.
*
* @since 3.9.0
*/
class PrivacyControllerConsents extends JControllerForm
{
/**
* Method to invalidate specific consents.
*
* @return boolean
*
* @since 3.9.0
*/
public function invalidate($key = null, $urlVar = null)
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = (array) $this->input->get('cid', array(), 'int');
// Remove zero values resulting from input filter
$ids = array_filter($ids);
if (empty($ids))
{
$message = JText::_('JERROR_NO_ITEMS_SELECTED');
$this->setError($message);
}
else
{
// Get the model.
/** @var PrivacyModelConsents $model */
$model = $this->getModel();
// Publish the items.
if (!$model->invalidate($ids))
{
$this->setError($model->getError());
}
$message = JText::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids));
}
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=consents', false), $message);
}
/**
* Method to invalidate all consents of a specific subject.
*
* @return boolean
*
* @since 3.9.0
*/
public function invalidateAll()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$filters = $this->input->get('filter', array(), 'array');
if (isset($filters['subject']) && $filters['subject'] != '')
{
$subject = $filters['subject'];
}
else
{
$this->setError(JText::_('JERROR_NO_ITEMS_SELECTED'));
}
// Get the model.
/** @var PrivacyModelConsents $model */
$model = $this->getModel();
// Publish the items.
if (!$model->invalidateAll($subject))
{
$this->setError($model->getError());
}
$message = JText::_('COM_PRIVACY_CONSENTS_INVALIDATED_ALL');
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=consents', false), $message);
}
}
PK )r!]�T�# # controllers/request.phpnu &1i� <?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
*/
defined('_JEXEC') or die;
/**
* Request action controller class.
*
* @since 3.9.0
*/
class PrivacyControllerRequest extends JControllerLegacy
{
/**
* Method to confirm the information request.
*
* @return boolean
*
* @since 3.9.0
*/
public function confirm()
{
// Check the request token.
$this->checkToken('post');
/** @var PrivacyModelConfirm $model */
$model = $this->getModel('Confirm', 'PrivacyModel');
$data = $this->input->post->get('jform', array(), 'array');
$return = $model->confirmRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if (JFactory::getApplication()->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_PRIVACY_ERROR_CONFIRMING_REQUEST');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=confirm', false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message = JText::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REQUEST_FAILED', $model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=confirm', false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
$this->setRedirect(JRoute::_(JUri::root()), JText::_('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 PrivacyModelRequest $model */
$model = $this->getModel('Request', 'PrivacyModel');
$data = $this->input->post->get('jform', array(), 'array');
$return = $model->createRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if (JFactory::getApplication()->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_PRIVACY_ERROR_CREATING_REQUEST');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=request', false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message = JText::sprintf('COM_PRIVACY_ERROR_CREATING_REQUEST_FAILED', $model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=request', false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
$this->setRedirect(JRoute::_(JUri::root()), JText::_('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 PrivacyModelConfirm $model */
$model = $this->getModel('Remind', 'PrivacyModel');
$data = $this->input->post->get('jform', array(), 'array');
$return = $model->remindRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if (JFactory::getApplication()->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_PRIVACY_ERROR_REMIND_REQUEST');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=remind', false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message = JText::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REMIND_FAILED', $model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=remind', false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
$this->setRedirect(JRoute::_(JUri::root()), JText::_('COM_PRIVACY_CONFIRM_REMIND_SUCCEEDED'), 'info');
return true;
}
}
}
PK )r!]��B� � controllers/requests.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Requests management controller class.
*
* @since 3.9.0
*/
class PrivacyControllerRequests extends JControllerAdmin
{
/**
* 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 JModelLegacy|boolean Model object on success; otherwise false on failure.
*
* @since 3.9.0
*/
public function getModel($name = 'Request', $prefix = 'PrivacyModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
}
PK )r!]Z�y= = tables/request.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Table interface class for the #__privacy_requests table
*
* @property integer $id Item ID (primary key)
* @property string $email The email address of the individual requesting the data
* @property string $requested_at The time the request was created at
* @property integer $status The status of the information request
* @property string $request_type The type of information request
* @property string $confirm_token Hashed token for confirming the information request
* @property string $confirm_token_created_at The time the confirmation token was generated
*
* @since 3.9.0
*/
class PrivacyTableRequest extends JTable
{
/**
* The class constructor.
*
* @param JDatabaseDriver $db JDatabaseDriver connector object.
*
* @since 3.9.0
*/
public function __construct(JDatabaseDriver $db)
{
parent::__construct('#__privacy_requests', 'id', $db);
}
/**
* Method to store a row in the database from the Table instance properties.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 3.9.0
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
// Set default values for new records
if (!$this->id)
{
if (!$this->status)
{
$this->status = '0';
}
if (!$this->requested_at)
{
$this->requested_at = $date->toSql();
}
}
return parent::store($updateNulls);
}
}
PK )r!]<X��� � tables/consent.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
/**
* Table interface class for the #__privacy_consents table
*
* @property integer $id Item ID (primary key)
* @property integer $remind The status of the reminder request
* @property string $token Hashed token for the reminder request
* @property integer $user_id User ID (pseudo foreign key to the #__users table) if the request is associated to a user account
*
* @since 3.9.0
*/
class PrivacyTableConsent extends JTable
{
/**
* The class constructor.
*
* @param JDatabaseDriver $db JDatabaseDriver connector object.
*
* @since 3.9.0
*/
public function __construct(JDatabaseDriver $db)
{
parent::__construct('#__privacy_consents', 'id', $db);
}
/**
* Method to store a row in the database from the Table instance properties.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 3.9.0
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
// Set default values for new records
if (!$this->id)
{
if (!$this->remind)
{
$this->remind = '0';
}
if (!$this->created)
{
$this->created = $date->toSql();
}
}
return parent::store($updateNulls);
}
}
PK )r!]��>�� � models/remove.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @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
*/
defined('_JEXEC') or die;
JLoader::register('PrivacyHelper', JPATH_ADMINISTRATOR . '/components/com_privacy/helpers/privacy.php');
JLoader::register('PrivacyRemovalStatus', JPATH_ADMINISTRATOR . '/components/com_privacy/helpers/removal/status.php');
/**
* Remove model class.
*
* @since 3.9.0
*/
class PrivacyModelRemove extends JModelLegacy
{
/**
* Remove the user data.
*
* @param integer $id The request ID to process
*
* @return boolean
*
* @since 3.9.0
*/
public function removeDataForRequest($id = null)
{
$id = !empty($id) ? $id : (int) $this->getState($this->getName() . '.request_id');
if (!$id)
{
$this->setError(JText::_('COM_PRIVACY_ERROR_REQUEST_ID_REQUIRED_FOR_REMOVE'));
return false;
}
/** @var PrivacyTableRequest $table */
$table = $this->getTable();
if (!$table->load($id))
{
$this->setError($table->getError());
return false;
}
if ($table->request_type !== 'remove')
{
$this->setError(JText::_('COM_PRIVACY_ERROR_REQUEST_TYPE_NOT_REMOVE'));
return false;
}
if ($table->status != 1)
{
$this->setError(JText::_('COM_PRIVACY_ERROR_CANNOT_REMOVE_UNCONFIRMED_REQUEST'));
return false;
}
// If there is a user account associated with the email address, load it here for use in the plugins
$db = $this->getDbo();
$userId = (int) $db->setQuery(
$db->getQuery(true)
->select('id')
->from($db->quoteName('#__users'))
->where('LOWER(' . $db->quoteName('email') . ') = LOWER(' . $db->quote($table->email) . ')'),
0,
1
)->loadResult();
$user = $userId ? JUser::getInstance($userId) : null;
$canRemove = true;
JPluginHelper::importPlugin('privacy');
/** @var PrivacyRemovalStatus[] $pluginResults */
$pluginResults = JFactory::getApplication()->triggerEvent('onPrivacyCanRemoveData', array($table, $user));
foreach ($pluginResults as $status)
{
if (!$status->canRemove)
{
$this->setError($status->reason ?: JText::_('COM_PRIVACY_ERROR_CANNOT_REMOVE_DATA'));
$canRemove = false;
}
}
if (!$canRemove)
{
$this->logRemoveBlocked($table, $this->getErrors());
return false;
}
// Log the removal
$this->logRemove($table);
JFactory::getApplication()->triggerEvent('onPrivacyRemoveData', array($table, $user));
return true;
}
/**
* 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 JTable A JTable object
*
* @since 3.9.0
* @throws \Exception
*/
public function getTable($name = 'Request', $prefix = 'PrivacyTable', $options = array())
{
return parent::getTable($name, $prefix, $options);
}
/**
* Log the data removal to the action log system.
*
* @param PrivacyTableRequest $request The request record being processed
*
* @return void
*
* @since 3.9.0
*/
public function logRemove(PrivacyTableRequest $request)
{
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_actionlogs/models', 'ActionlogsModel');
$user = JFactory::getUser();
$message = array(
'action' => 'remove',
'id' => $request->id,
'itemlink' => 'index.php?option=com_privacy&view=request&id=' . $request->id,
'userid' => $user->id,
'username' => $user->username,
'accountlink' => 'index.php?option=com_users&task=user.edit&id=' . $user->id,
);
/** @var ActionlogsModelActionlog $model */
$model = JModelLegacy::getInstance('Actionlog', 'ActionlogsModel');
$model->addLog(array($message), 'COM_PRIVACY_ACTION_LOG_REMOVE', 'com_privacy.request', $user->id);
}
/**
* Log the data removal being blocked to the action log system.
*
* @param PrivacyTableRequest $request The request record being processed
* @param string[] $reasons The reasons given why the record could not be removed.
*
* @return void
*
* @since 3.9.0
*/
public function logRemoveBlocked(PrivacyTableRequest $request, array $reasons)
{
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_actionlogs/models', 'ActionlogsModel');
$user = JFactory::getUser();
$message = array(
'action' => 'remove-blocked',
'id' => $request->id,
'itemlink' => 'index.php?option=com_privacy&view=request&id=' . $request->id,
'userid' => $user->id,
'username' => $user->username,
'accountlink' => 'index.php?option=com_users&task=user.edit&id=' . $user->id,
'reasons' => implode('; ', $reasons),
);
/** @var ActionlogsModelActionlog $model */
$model = JModelLegacy::getInstance('Actionlog', 'ActionlogsModel');
$model->addLog(array($message), 'COM_PRIVACY_ACTION_LOG_REMOVE_BLOCKED', 'com_privacy.request', $user->id);
}
/**
* Method to auto-populate the model state.
*
* @return void
*
* @since 3.9.0
*/
protected function populateState()
{
// Get the pk of the record from the request.
$this->setState($this->getName() . '.request_id', JFactory::getApplication()->input->getUint('id'));
// Load the parameters.
$this->setState('params', JComponentHelper::getParams('com_privacy'));
}
}
PK )r!]�˾R R models/forms/filter_requests.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_privacy/models/fields" />
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_PRIVACY_FILTER_SEARCH_LABEL"
description="COM_PRIVACY_SEARCH_IN_EMAIL"
hint="JSEARCH_FILTER"
/>
<field
name="status"
type="privacy.requeststatus"
label="COM_PRIVACY_FILTER_STATUS"
description="COM_PRIVACY_FILTER_STATUS_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="request_type"
type="privacy.requesttype"
label="COM_PRIVACY_FILTER_REQUEST_TYPE"
description="COM_PRIVACY_FILTER_REQUEST_TYPE_DESC"
onchange="this.form.submit();"
>
<option value="">COM_PRIVACY_SELECT_REQUEST_TYPE</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.email ASC">COM_PRIVACY_HEADING_EMAIL_ASC</option>
<option value="a.email DESC">COM_PRIVACY_HEADING_EMAIL_DESC</option>
<option value="a.request_type ASC">COM_PRIVACY_HEADING_REQUEST_TYPE_ASC</option>
<option value="a.request_type DESC">COM_PRIVACY_HEADING_REQUEST_TYPE_DESC</option>
<option value="a.requested_at ASC">COM_PRIVACY_HEADING_REQUESTED_AT_ASC</option>
<option value="a.requested_at DESC">COM_PRIVACY_HEADING_REQUESTED_AT_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
PK )r!]�� models/forms/filter_consents.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_privacy/models/fields" />
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_PRIVACY_FILTER_SEARCH_LABEL"
description="COM_PRIVACY_SEARCH_IN_USERNAME"
hint="JSEARCH_FILTER"
/>
<field
name="state"
type="list"
label="COM_PRIVACY_CONSENTS_FILTER_STATE"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PRIVACY_CONSENTS_STATE_VALID</option>
<option value="0">COM_PRIVACY_CONSENTS_STATE_OBSOLETE</option>
<option value="-1">COM_PRIVACY_CONSENTS_STATE_INVALIDATED</option>
</field>
<field
name="subject"
type="sql"
label="COM_PRIVACY_CONSENTS_FILTER_SUBJECT"
sql_select="subject"
sql_from="#__privacy_consents"
sql_group="subject"
sql_order="subject ASC"
key_field="subject"
translate="true"
onchange="this.form.submit();"
>
<option value="">COM_PRIVACY_CONSENTS_SUBJECT_DEFAULT</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="a.state ASC">COM_PRIVACY_HEADING_STATUS_ASC</option>
<option value="a.state DESC">COM_PRIVACY_HEADING_STATUS_DESC</option>
<option value="u.username ASC">COM_PRIVACY_HEADING_USERNAME_ASC</option>
<option value="u.username DESC">COM_PRIVACY_HEADING_USERNAME_DESC</option>
<option value="a.user_id ASC">COM_PRIVACY_HEADING_USERID_ASC</option>
<option value="a.user_id DESC">COM_PRIVACY_HEADING_USERID_DESC</option>
<option value="a.subject ASC">COM_PRIVACY_HEADING_SUBJECT_ASC</option>
<option value="a.subject DESC">COM_PRIVACY_HEADING_SUBJECT_DESC</option>
<option value="a.created ASC">COM_PRIVACY_HEADING_CREATED_ASC</option>
<option value="a.created DESC">COM_PRIVACY_HEADING_CREATED_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
PK )r!]���� � models/forms/request.xmlnu &1i� <?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 )r!]_�Զ"