-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Privacy plugin for privacy tools in Joomla 3.9 #59 (#60) * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feat gdpr changes (#63) * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Feature #135356 feat: [GDPR Privacy Policy] - TJ Fields compatible with J3.9x. * Privacy plugin for privacy tools in Joomla 3.9 #59 #60
- Loading branch information
1 parent
e05d204
commit d97fc7c
Showing
10 changed files
with
817 additions
and
18 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><title></title> |
8 changes: 8 additions & 0 deletions
8
plugins/privacy/tjfields/language/en-GB/en-GB.plg_privacy_tjfields.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
; @package TJ-Fields | ||
; @subpackage Plg_Privacy_Tjfields | ||
; @copyright Copyright © 2009-2018 TechJoomla. All rights reserved. | ||
; @license GNU General Public License version 2, or later | ||
; Note: All ini files need to be saved as UTF-8 | ||
|
||
PLG_PRIVACY_TJFIELDS="Privacy - TJ-Fields" | ||
PLG_PRIVACY_TJFIELDS_XML_DESCRIPTION="TJ-Fields privacy plugin" |
8 changes: 8 additions & 0 deletions
8
plugins/privacy/tjfields/language/en-GB/en-GB.plg_privacy_tjfields.sys.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
; @package TJ-Fields | ||
; @subpackage Plg_Privacy_Tjfields | ||
; @copyright Copyright © 2009-2018 TechJoomla. All rights reserved. | ||
; @license GNU General Public License version 2, or later | ||
; Note: All ini files need to be saved as UTF-8 | ||
|
||
PLG_PRIVACY_TJFIELDS="Privacy - TJ-Fields" | ||
PLG_PRIVACY_TJFIELDS_XML_DESCRIPTION="TJ-Fields privacy plugin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
<?php | ||
/** | ||
* @package TJ-Fields | ||
* @subpackage Plg_Privacy_TjFields | ||
* | ||
* @author Techjoomla <extensions@techjoomla.com> | ||
* @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
// No direct access. | ||
defined('_JEXEC') or die(); | ||
|
||
JLoader::register('PrivacyPlugin', JPATH_ADMINISTRATOR . '/components/com_privacy/helpers/plugin.php'); | ||
JLoader::register('PrivacyRemovalStatus', JPATH_ADMINISTRATOR . '/components/com_privacy/helpers/removal/status.php'); | ||
|
||
use Joomla\CMS\User\User; | ||
|
||
/** | ||
* TjFields Privacy Plugin. | ||
* | ||
* @since 1.4.1 | ||
*/ | ||
class PlgPrivacyTjFields extends PrivacyPlugin | ||
{ | ||
/** | ||
* Load the language file on instantiation. | ||
* | ||
* @var boolean | ||
* | ||
* @since 1.4.1 | ||
*/ | ||
protected $autoloadLanguage = true; | ||
|
||
/** | ||
* Database object | ||
* | ||
* @var JDatabaseDriver | ||
* @since 1.4.1 | ||
*/ | ||
protected $db; | ||
|
||
/** | ||
* Processes an export request for TjFields user data | ||
* | ||
* This event will collect data for the following tables: | ||
* | ||
* - #__tjfields_fields | ||
* - #__tjfields_groups | ||
* - #__tjfields_fields_value | ||
* | ||
* @param PrivacyTableRequest $request The request record being processed | ||
* @param JUser $user The user account associated with this request if available | ||
* | ||
* @return PrivacyExportDomain[] | ||
* | ||
* @since 1.4.1 | ||
*/ | ||
public function onPrivacyExportRequest(PrivacyTableRequest $request, JUser $user = null) | ||
{ | ||
if (!$user) | ||
{ | ||
return array(); | ||
} | ||
|
||
/** @var JTableUser $user */ | ||
$userTable = User::getTable(); | ||
$userTable->load($user->id); | ||
|
||
$domains = array(); | ||
$domains[] = $this->createTjFieldsFields($userTable); | ||
$domains[] = $this->createTjFieldsFieldGroups($userTable); | ||
$domains[] = $this->createTjFieldsFieldValues($userTable); | ||
|
||
return $domains; | ||
} | ||
|
||
/** | ||
* Create the domain for the TjFields fields | ||
* | ||
* @param JTableUser $user The JTableUser object to process | ||
* | ||
* @return PrivacyExportDomain | ||
* | ||
* @since 1.4.1 | ||
*/ | ||
private function createTjFieldsFields(JTableUser $user) | ||
{ | ||
$domain = $this->createDomain('Fields', 'Fields created by a user'); | ||
|
||
$query = $this->db->getQuery(true) | ||
->select($this->db->quoteName(array('id', 'label', 'name', 'type', 'created_by', 'client', 'group_id'))) | ||
->from($this->db->quoteName('#__tjfields_fields')) | ||
->where($this->db->quoteName('created_by') . '=' . $user->id); | ||
|
||
$fields = $this->db->setQuery($query)->loadAssocList(); | ||
|
||
if (!empty($fields)) | ||
{ | ||
foreach ($fields as $field) | ||
{ | ||
$domain->addItem($this->createItemFromArray($field, $field['id'])); | ||
} | ||
} | ||
|
||
return $domain; | ||
} | ||
|
||
/** | ||
* Create the domain for the TjFields groups | ||
* | ||
* @param JTableUser $user The JTableUser object to process | ||
* | ||
* @return PrivacyExportDomain | ||
* | ||
* @since 1.4.1 | ||
*/ | ||
private function createTjFieldsFieldGroups(JTableUser $user) | ||
{ | ||
$domain = $this->createDomain('Groups', 'Field groups created by a user'); | ||
|
||
$query = $this->db->getQuery(true) | ||
->select($this->db->quoteName(array('id', 'state', 'created_by', 'name', 'client'))) | ||
->from($this->db->quoteName('#__tjfields_groups')) | ||
->where($this->db->quoteName('created_by') . '=' . $user->id); | ||
|
||
$groups = $this->db->setQuery($query)->loadAssocList(); | ||
|
||
if (!empty($groups)) | ||
{ | ||
foreach ($groups as $group) | ||
{ | ||
$domain->addItem($this->createItemFromArray($group, $group['id'])); | ||
} | ||
} | ||
|
||
return $domain; | ||
} | ||
|
||
/** | ||
* Create the domain for the TjFields field values | ||
* | ||
* @param JTableUser $user The JTableUser object to process | ||
* | ||
* @return PrivacyExportDomain | ||
* | ||
* @since 1.4.1 | ||
*/ | ||
private function createTjFieldsFieldValues(JTableUser $user) | ||
{ | ||
$domain = $this->createDomain('Field values', 'Field values submitted by a user'); | ||
|
||
$query = $this->db->getQuery(true) | ||
->select($this->db->qn(array('id', 'field_id', 'content_id', 'value', 'user_id', 'email_id', 'client', 'option_id'))) | ||
->from($this->db->qn('#__tjfields_fields_value')) | ||
->where('(' . $this->db->qn('user_id') . '=' . $user->id . ' OR ' . $this->db->qn('email_id') . '=' . $this->db->quote($user->email) . ')'); | ||
|
||
$fieldValues = $this->db->setQuery($query)->loadAssocList(); | ||
|
||
if (!empty($fieldValues)) | ||
{ | ||
foreach ($fieldValues as $fieldValue) | ||
{ | ||
$domain->addItem($this->createItemFromArray($fieldValue, $fieldValue['id'])); | ||
} | ||
} | ||
|
||
return $domain; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extension version="3.4" type="plugin" group="privacy" method="upgrade"> | ||
<name>plg_privacy_tjfields</name> | ||
<version>1.4.1</version> | ||
<creationDate>2nd Nov 2018</creationDate> | ||
<author>Techjoomla</author> | ||
<authorEmail>extensions@techjoomla.com</authorEmail> | ||
<authorUrl>https://techjoomla.com</authorUrl> | ||
<copyright>Copyright (C) 2010 - 2018 Techjoomla. All rights reserved.</copyright> | ||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license> | ||
<description>PLG_PRIVACY_TJFIELDS_XML_DESCRIPTION</description> | ||
<files> | ||
<filename plugin="tjfields">tjfields.php</filename> | ||
<filename>index.html</filename> | ||
</files> | ||
<languages folder="language"> | ||
<language tag="en-GB">en-GB/en-GB.plg_privacy_tjfields.ini</language> | ||
<language tag="en-GB">en-GB/en-GB.plg_privacy_tjfields.sys.ini</language> | ||
</languages> | ||
<config> | ||
<fields name="params"> | ||
<fieldset name="basic" /> | ||
</fields> | ||
</config> | ||
</extension> |
Oops, something went wrong.