Skip to content
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

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bc10b35
initial commit
brianteeman Apr 1, 2018
2925e98
update files
brianteeman Apr 1, 2018
b460676
install files
brianteeman Apr 1, 2018
6be49ff
postinstall
brianteeman Apr 1, 2018
f64d318
cs
brianteeman Apr 1, 2018
4c63e79
cs
brianteeman Apr 1, 2018
79f39d7
usernotes
brianteeman Apr 1, 2018
00c1f04
postgres fix
brianteeman Apr 1, 2018
7ddea51
fix confirmation check
brianteeman Apr 1, 2018
006911c
check the correct field this time
brianteeman Apr 1, 2018
053fe53
cs
brianteeman Apr 2, 2018
e970129
cs
brianteeman Apr 2, 2018
cf89b53
only check for consent in the front end
brianteeman Apr 2, 2018
50f6ce9
declared as core plugin for manifest cache refresh
brianteeman Apr 2, 2018
aed2244
check the ip
brianteeman Apr 2, 2018
08c0feb
weird cs issue - ok locally but not online - lets try this
brianteeman Apr 2, 2018
31a19c0
drone
brianteeman Apr 2, 2018
f3a206d
cs
brianteeman Apr 2, 2018
ea14b54
cs
brianteeman Apr 2, 2018
0563140
HTTP_USER_AGENT
brianteeman Apr 2, 2018
8235261
dont display link to privacy article in admin
brianteeman Apr 2, 2018
0b998f7
remove unused
brianteeman Apr 3, 2018
bd1af95
queries the joomla way
brianteeman Apr 3, 2018
00f5ddf
remove hardcoded user_id for author of note. Its never used anyway
brianteeman Apr 3, 2018
91c2b20
clean up and admin updates for ot2sen
brianteeman Apr 3, 2018
51160ba
Check we are manipulating a valid form - we do not display this in th…
brianteeman Apr 3, 2018
3f8ac61
update query
brianteeman Apr 3, 2018
451ff34
cs
brianteeman Apr 3, 2018
65b4abc
oops should be quoteName
brianteeman Apr 3, 2018
e550c08
cs
brianteeman Apr 3, 2018
af80a94
commit again
brianteeman Apr 3, 2018
0faf119
I must remember to press save before commit
brianteeman Apr 4, 2018
4c1a3c8
Display the short privacy policy if created in the plugin config - el…
brianteeman Apr 13, 2018
b60abe8
Bootstrap modal (#71)
Apr 13, 2018
4316bde
Bootstrap modal (#71)
brianteeman Apr 13, 2018
d239671
cs
brianteeman Apr 13, 2018
1b3daae
Proposed fixes for the new privacyconsent plugin (#73)
zero-24 Apr 16, 2018
a02aa72
fix for existing users logging from frontend (#72)
alikon Apr 16, 2018
b13e87c
remove empty privacyconsent tab from admin profile
brianteeman Apr 16, 2018
9aa4995
make sure it is still displayed in admin profile if not completed
brianteeman Apr 16, 2018
74426be
cs
brianteeman Apr 16, 2018
201fa6a
oops semi-colon
brianteeman Apr 17, 2018
c2190d6
insert privacy consent note only one (#76)
alikon Apr 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
23 changes: 23 additions & 0 deletions administrator/language/en-GB/en-GB.plg_user_privacyconsent.ini
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"
2 changes: 2 additions & 0 deletions installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,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, '0000-00-00 00:00:00', 0, 0),
(479, 0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(481, 0, 'plg_user_privacyconsent', 'plugin', 'privacyconsent', 'user', 0, 0, 1, 0, '', '', '', '', 0, '0000-00-00 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, '0000-00-00 00:00:00', 0, 0),
(504, 0, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(506, 0, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
Expand Down Expand Up @@ -1645,6 +1646,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);
Copy link
Contributor

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 (;)

(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1);

-- --------------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions installation/sql/postgresql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Copy link
Contributor

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 (;)

(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1);

--
-- Table structure for table `#__redirect_links`
Expand Down
2 changes: 2 additions & 0 deletions installation/sql/sqlazure/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Copy link
Contributor

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 (;)

(700, 'PLG_USER_PRIVACYCONSENT_TITLE', 'PLG_USER_PRIVACYCONSENT_BODY', '', 'plg_user_privacyconsent', 1, 'message', '', '', '', '', '3.9.0', 1);

--
-- Table structure for table `#__redirect_links`
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class ExtensionHelper
// Core plugin extensions - user
array('plugin', 'contactcreator', 'user', 0),
array('plugin', 'joomla', 'user', 0),
array('plugin', 'privacyconsent', 'user', 0),
array('plugin', 'profile', 'user', 0),

// Core template extensions - administrator
Expand Down
119 changes: 119 additions & 0 deletions plugins/user/privacyconsent/field/privacy.php
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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianteeman can we go with the bootstrap modal here?
I know it's kinda weird me asking to actually use Bootstrap, but I guess it is better than loading mootools just for a modal..
Let me know if you need a PR for this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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')))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianteeman, don't forget the quotes in rule 84.

'id', 'alias', 'catid', 'language'

->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">&#160;*</span></label>';

return $label;
}
}
Loading