-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.9][New Feature] Privacy Policy plugin #20051
Changes from 29 commits
bc10b35
2925e98
b460676
6be49ff
f64d318
4c63e79
79f39d7
00c1f04
7ddea51
006911c
053fe53
e970129
cf89b53
50f6ce9
aed2244
08c0feb
31a19c0
f3a206d
ea14b54
0563140
8235261
0b998f7
bd1af95
00f5ddf
91c2b20
51160ba
3f8ac61
451ff34
65b4abc
e550c08
af80a94
0faf119
4c1a3c8
b60abe8
4316bde
d239671
1b3daae
a02aa72
b13e87c
9aa4995
74426be
201fa6a
c2190d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES | ||
(481, 0, 'plg_user_privacyconsent', 'plugin', 'privacyconsent', 'user', 0, 0, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); | ||
INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) | ||
VALUES | ||
(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES | ||
(481, 0, 'plg_user_privacyconsent', 'plugin', 'privacyconsent', 'user', 0, 0, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); | ||
INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") | ||
VALUES | ||
(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES | ||
(481, 0, 'plg_user_privacyconsent', 'plugin', 'privacyconsent', 'user', 0, 0, 1, 0, '', '', '', '', 0, '1990-01-01 00:00:00', 0, 0); | ||
INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") | ||
VALUES | ||
(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; Brian Teeman | ||
; Copyright (C) 2018 - Brian Teeman. All rights reserved. | ||
; License GNU General Public License version 3 | ||
|
||
|
||
PLG_USER_PRIVACY_BODY="<p>The user consented to storing their user information using the IP address <strong>%s</strong></p><p>The user agent string of the user's browser was:<br/>%s</p><p>This information was automatically recorded when the user submitted their details on the web site and checked the confirm box</p>" | ||
PLG_USER_PRIVACY_FIELD_ARTICLE_DESC="Select the desired Privacy article from the list." | ||
PLG_USER_PRIVACY_FIELD_ARTICLE_LABEL="Privacy Article" | ||
PLG_USER_PRIVACY_FIELD_DESC="Read the full privacy policy" | ||
PLG_USER_PRIVACY_FIELD_ERROR="Agreement to the site's Privacy Policy is required." | ||
PLG_USER_PRIVACY_FIELD_LABEL="Privacy Policy" | ||
PLG_USER_PRIVACY_LABEL="Web Site Privacy" | ||
PLG_USER_PRIVACY_NOTE_FIELD_DEFAULT="By signing up to this web site and agree to the Privacy Policy you agree to this web site storing your information." | ||
PLG_USER_PRIVACY_NOTE_FIELD_DESC="Write a summary of the site's privacy policy." | ||
PLG_USER_PRIVACY_NOTE_FIELD_LABEL="Short Privacy Policy" | ||
PLG_USER_PRIVACY_OPTION_AGREE="I agree" | ||
PLG_USER_PRIVACY_REDIRECT_MESSAGE_DEFAULT="Please confirm that you consent to this web site storing your information by agreeing to the privacy policy." | ||
PLG_USER_PRIVACY_REDIRECT_MESSAGE_DESC="Custom message to be displayed on redirect. If left blank then the default message will be used." | ||
PLG_USER_PRIVACY_REDIRECT_MESSAGE_LABEL="Redirect Message" | ||
PLG_USER_PRIVACY_SUBJECT="Privacy Policy" | ||
PLG_USER_PRIVACY_XML_DESCRIPTION="Basic plugin to request user's consent to the site's privacy policy. Existing users who have not consented yet will be redirected on login to update their profile." | ||
PLG_USER_PRIVACYCONSENT_TITLE="Privacy Policy (GDPR) Plugin" | ||
PLG_USER_PRIVACYCONSENT_BODY="This is a basic plugin to request user's consent to the site's privacy policy. Existing users who have not consented yet will be redirected on login to update their profile." |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
; Brian Teeman | ||
; Copyright (C) 2018 - Brian Teeman. All rights reserved. | ||
; License GNU General Public License version 3 | ||
|
||
|
||
|
||
PLG_USER_PRIVACY_XML_DESCRIPTION="Basic plugin to request user's consent to the site's privacy policy. Existing users who have not consented yet will be redirected on login to update their profile." | ||
PLG_USER_PRIVACYCONSENT="User - Privacy Consent" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -657,6 +657,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem | |
(478, 0, 'plg_editors-xtd_fields', 'plugin', 'fields', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), | ||
(479, 0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), | ||
(480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), | ||
(481, 0, 'plg_user_privacyconsent', 'plugin', 'privacyconsent', 'user', 0, 0, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); | ||
(503, 0, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), | ||
(504, 0, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), | ||
(506, 0, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), | ||
|
@@ -1628,6 +1629,7 @@ INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description | |
(700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1), | ||
(700, 'TPL_HATHOR_MESSAGE_POSTINSTALL_TITLE', 'TPL_HATHOR_MESSAGE_POSTINSTALL_BODY', 'TPL_HATHOR_MESSAGE_POSTINSTALL_ACTION', 'tpl_hathor', 1, 'action', 'admin://templates/hathor/postinstall/hathormessage.php', 'hathormessage_postinstall_action', 'admin://templates/hathor/postinstall/hathormessage.php', 'hathormessage_postinstall_condition', '3.7.0', 1), | ||
(700, 'PLG_PLG_RECAPTCHA_VERSION_1_POSTINSTALL_TITLE', 'PLG_PLG_RECAPTCHA_VERSION_1_POSTINSTALL_BODY', 'PLG_PLG_RECAPTCHA_VERSION_1_POSTINSTALL_ACTION', 'plg_captcha_recaptcha', 1, 'action', 'site://plugins/captcha/recaptcha/postinstall/actions.php', 'recaptcha_postinstall_action', 'site://plugins/captcha/recaptcha/postinstall/actions.php', 'recaptcha_postinstall_condition', '3.8.6', 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the line should end with a comma (,) and not with a semicolon (;) |
||
(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1); | ||
|
||
-- | ||
-- Table structure for table `#__redirect_links` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -872,6 +872,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem | |
(478, 0, 'plg_editors-xtd_fields', 'plugin', 'fields', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), | ||
(479, 0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), | ||
(480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), | ||
(481, 0, 'plg_user_privacyconsent', 'plugin', 'privacyconsent', 'user', 0, 0, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0); | ||
(503, 0, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '1900-01-01 00:00:00', 0, 0), | ||
(504, 0, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '1900-01-01 00:00:00', 0, 0), | ||
(506, 0, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '1900-01-01 00:00:00', 0, 0), | ||
|
@@ -2343,6 +2344,7 @@ INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description | |
(700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1), | ||
(700, 'TPL_HATHOR_MESSAGE_POSTINSTALL_TITLE', 'TPL_HATHOR_MESSAGE_POSTINSTALL_BODY', 'TPL_HATHOR_MESSAGE_POSTINSTALL_ACTION', 'tpl_hathor', 1, 'action', 'admin://templates/hathor/postinstall/hathormessage.php', 'hathormessage_postinstall_action', 'admin://templates/hathor/postinstall/hathormessage.php', 'hathormessage_postinstall_condition', '3.7.0', 1), | ||
(700, 'PLG_PLG_RECAPTCHA_VERSION_1_POSTINSTALL_TITLE', 'PLG_PLG_RECAPTCHA_VERSION_1_POSTINSTALL_BODY', 'PLG_PLG_RECAPTCHA_VERSION_1_POSTINSTALL_ACTION', 'plg_captcha_recaptcha', 1, 'action', 'site://plugins/captcha/recaptcha/postinstall/actions.php', 'recaptcha_postinstall_action', 'site://plugins/captcha/recaptcha/postinstall/actions.php', 'recaptcha_postinstall_condition', '3.8.6', 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the line should end with a comma (,) and not with a semicolon (;) |
||
(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1); | ||
|
||
-- | ||
-- Table structure for table `#__redirect_links` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage User.privacyconsent | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('JPATH_PLATFORM') or die; | ||
|
||
JFormHelper::loadFieldClass('radio'); | ||
|
||
/** | ||
* Provides input for privacy | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class JFormFieldprivacy extends JFormFieldRadio | ||
{ | ||
/** | ||
* The form field type. | ||
* | ||
* @var string | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $type = 'privacy'; | ||
|
||
/** | ||
* Method to get the field label markup. | ||
* | ||
* @return string The field label markup. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function getLabel() | ||
{ | ||
$label = ''; | ||
|
||
if ($this->hidden) | ||
{ | ||
return $label; | ||
} | ||
|
||
// Get the label text from the XML element, defaulting to the element name. | ||
$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; | ||
$text = $this->translateLabel ? JText::_($text) : $text; | ||
|
||
// Set required to true as this field is not displayed at all if not required. | ||
$this->required = true; | ||
|
||
JHtml::_('behavior.modal'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brianteeman can we go with the bootstrap modal here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure - I just used the same one that is used in the userprofile plugin for the TOS field There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you send a pr for the change please |
||
|
||
// Build the class for the label. | ||
$class = !empty($this->description) ? 'hasTooltip' : ''; | ||
$class = $class . ' required'; | ||
$class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class; | ||
|
||
// Add the opening label tag and main attributes. | ||
$label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"'; | ||
|
||
// If a description is specified, use it to build a tooltip. | ||
if (!empty($this->description)) | ||
{ | ||
$label .= ' title="' | ||
. htmlspecialchars( | ||
trim($text, ':') . '<br />' . ($this->translateDescription ? JText::_($this->description) : $this->description), | ||
ENT_COMPAT, 'UTF-8' | ||
) . '"'; | ||
} | ||
|
||
$privacyarticle = $this->element['article'] > 0 ? (int) $this->element['article'] : 0; | ||
|
||
if ($privacyarticle && JFactory::getApplication()->isClient('site')) | ||
{ | ||
JLoader::register('ContentHelperRoute', JPATH_BASE . '/components/com_content/helpers/route.php'); | ||
|
||
$attribs = array(); | ||
$attribs['class'] = 'modal'; | ||
$attribs['rel'] = '{handler: \'iframe\', size: {x:800, y:500}}'; | ||
|
||
$db = JFactory::getDbo(); | ||
$query = $db->getQuery(true) | ||
->select($db->quoteName(array('id, alias, catid, language'))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brianteeman, don't forget the quotes in rule 84.
|
||
->from($db->quoteName('#__content')) | ||
->where($db->quoteName('id') . ' = ' . (int) $privacyarticle); | ||
$db->setQuery($query); | ||
$article = $db->loadObject(); | ||
|
||
if (JLanguageAssociations::isEnabled()) | ||
{ | ||
$privacyassociated = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $privacyarticle); | ||
} | ||
|
||
$current_lang = JFactory::getLanguage()->getTag(); | ||
|
||
if (isset($privacyassociated) && $current_lang !== $article->language && array_key_exists($current_lang, $privacyassociated)) | ||
{ | ||
$url = ContentHelperRoute::getArticleRoute($privacyassociated[$current_lang]->id, $privacyassociated[$current_lang]->catid); | ||
$link = JHtml::_('link', JRoute::_($url . '&tmpl=component&lang=' . $privacyassociated[$current_lang]->language), $text, $attribs); | ||
} | ||
else | ||
{ | ||
$slug = $article->alias ? ($article->id . ':' . $article->alias) : $article->id; | ||
$url = ContentHelperRoute::getArticleRoute($slug, $article->catid); | ||
$link = JHtml::_('link', JRoute::_($url . '&tmpl=component&lang=' . $article->language), $text, $attribs); | ||
} | ||
} | ||
else | ||
{ | ||
$link = $text; | ||
} | ||
|
||
// Add the label text and closing tag. | ||
$label .= '>' . $link . '<span class="star"> *</span></label>'; | ||
|
||
return $label; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the line should end with a comma (,) and not with a semicolon (;)