| Current Path : /home/wuectly/www/03cbe/ |
| Current File : /home/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!]�r�J J 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;
// Only super user can access here
if (!JFactory::getUser()->authorise('core.admin'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
$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!])��WF&