Skip to content

Commit

Permalink
Merge pull request joomla#24371 from wilsonge/joomla390-merge5
Browse files Browse the repository at this point in the history
Joomla 3.9.0 Part #5
  • Loading branch information
wilsonge authored Mar 27, 2019
2 parents 5010651 + e684c41 commit 5d85b08
Show file tree
Hide file tree
Showing 40 changed files with 1,053 additions and 56 deletions.
34 changes: 34 additions & 0 deletions administrator/components/com_actionlogs/models/actionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,40 @@ private function buildDateRange($range)
return array('dNow' => $dNow, 'dStart' => $dStart);
}

/**
* Get all log entries for an item
*
* @param string $extension The extension the item belongs to
* @param integer $itemId The item ID
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
public function getLogsForItem($extension, $itemId)
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('a.*, u.name')
->from('#__action_logs AS a')
->innerJoin('#__users AS u ON a.user_id = u.id')
->where($db->quoteName('a.extension') . ' = ' . $db->quote($extension))
->where($db->quoteName('a.item_id') . ' = ' . (int) $itemId);

// Get ordering
$fullorderCol = $this->getState('list.fullordering', 'a.id DESC');

// Apply ordering
if (!empty($fullorderCol))
{
$query->order($db->escape($fullorderCol));
}

$db->setQuery($query);

return $db->loadObjectList();
}

/**
* Get logs data into JTable object
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +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
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":"0","csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users","com_privacy"]}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":"0","csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users"]}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(483, 0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 0, 1, 0, '', '{"logDeletePeriod":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(484, 0, 'plg_actionlog_joomla', 'plugin', 'joomla', 'actionlog', 0, 1, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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
(320, 0, 'mod_privacy_dashboard', 'module', 'mod_privacy_dashboard', '', 1, 0, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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, 'COM_ACTIONLOGS_POSTINSTALL_TITLE', 'COM_ACTIONLOGS_POSTINSTALL_BODY', '', 'com_actionlogs', 1, 'message', '', '', '', '', '3.9.0', 1),
(700, 'COM_PRIVACY_POSTINSTALL_TITLE', 'COM_PRIVACY_POSTINSTALL_BODY', '', 'com_privacy', 1, 'message', '', '', '', '', '3.9.0', 1);
Original file line number Diff line number Diff line change
@@ -1,5 +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
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":"0","csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users","com_privacy"]}', '', '', 0, '1970-01-01 00:00:00', 0, 0),
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":"0","csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users"]}', '', '', 0, '1970-01-01 00:00:00', 0, 0),
(483, 0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 0, 1, 0, '', '{"logDeletePeriod":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0),
(484, 0, 'plg_actionlog_joomla', 'plugin', 'joomla', 'actionlog', 0, 1, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0);

Expand Down Expand Up @@ -46,10 +46,9 @@ INSERT INTO "#__action_logs_extensions" ("id", "extension") VALUES
(14, 'com_redirect'),
(15, 'com_tags'),
(16, 'com_templates'),
(17, 'com_users'),
(18, 'com_privacy');
(17, 'com_users');

SELECT setval('#__action_logs_extensions_id_seq', 19, false);
SELECT setval('#__action_logs_extensions_id_seq', 18, false);
-- --------------------------------------------------------

--
Expand Down Expand Up @@ -87,8 +86,7 @@ INSERT INTO "#__action_logs_tables_data" ("id", "type_title", "type_alias", "id_
(15, 'contact', 'com_contact.contact', 'id', 'name', '#__contact_details', 'PLG_ACTIONLOG_JOOMLA'),
(16, 'module', 'com_modules.module', 'id' ,'title', '#__modules', 'PLG_ACTIONLOG_JOOMLA'),
(17, 'access_level', 'com_users.level', 'id' , 'title', '#__viewlevels', 'PLG_ACTIONLOG_JOOMLA'),
(18, 'banner_client', 'com_banners.client', 'id', 'name', '#__banner_clients', 'PLG_ACTIONLOG_JOOMLA'),
(19, 'privacy_request', 'com_privacy.request', 'id', 'email', '#__privacy_requests', 'PLG_ACTIONLOG_JOOMLA');
(18, 'banner_client', 'com_banners.client', 'id', 'name', '#__banner_clients', 'PLG_ACTIONLOG_JOOMLA');


SELECT setval('#__action_logs_tables_data_id_seq', 19, false);
SELECT setval('#__action_logs_tables_data_id_seq', 18, false);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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
(320, 0, 'mod_privacy_dashboard', 'module', 'mod_privacy_dashboard', '', 1, 0, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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, 'COM_ACTIONLOGS_POSTINSTALL_TITLE', 'COM_ACTIONLOGS_POSTINSTALL_BODY', '', 'com_actionlogs', 1, 'message', '', '', '', '', '3.9.0', 1),
(700, 'COM_PRIVACY_POSTINSTALL_TITLE', 'COM_PRIVACY_POSTINSTALL_BODY', '', 'com_privacy', 1, 'message', '', '', '', '', '3.9.0', 1);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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
(320, 0, 'mod_privacy_dashboard', 'module', 'mod_privacy_dashboard', '', 1, 0, 1, 0, '', '{}', '', '', 0, '1900-01-01 00:00:00', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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])
SELECT 700, 'COM_ACTIONLOGS_POSTINSTALL_TITLE', 'COM_ACTIONLOGS_POSTINSTALL_BODY', '', 'com_actionlogs', 1, 'message', '', '', '', '', '3.9.0', 1,
SELECT 700, 'COM_PRIVACY_POSTINSTALL_TITLE', 'COM_PRIVACY_POSTINSTALL_BODY', '', 'com_privacy', 1, 'message', '', '', '', '', '3.9.0', 1
17 changes: 17 additions & 0 deletions administrator/components/com_menus/presets/joomla.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@
<menuitem
type="separator"
/>
<menuitem
title="MOD_MENU_COM_PRIVACY"
type="component"
element="com_privacy"
link="index.php?option=com_privacy"
class="class:privacy"
/>
<menuitem
title="MOD_MENU_COM_ACTIONLOGS"
type="component"
element="com_actionlogs"
link="index.php?option=com_actionlogs"
class="class:userlogs"
/>
<menuitem
type="separator"
/>
<menuitem
title="MOD_MENU_MASS_MAIL_USERS"
type="component"
Expand Down
17 changes: 17 additions & 0 deletions administrator/components/com_menus/presets/modern.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@
<menuitem
type="separator"
/>
<menuitem
title="MOD_MENU_COM_PRIVACY"
type="component"
element="com_privacy"
link="index.php?option=com_privacy"
class="class:privacy"
/>
<menuitem
title="MOD_MENU_COM_ACTIONLOGS"
type="component"
element="com_actionlogs"
link="index.php?option=com_actionlogs"
class="class:userlogs"
/>
<menuitem
type="separator"
/>
<menuitem
title="MOD_MENU_MASS_MAIL_USERS"
type="component"
Expand Down
43 changes: 40 additions & 3 deletions administrator/components/com_privacy/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,46 @@ public function display($cachable = false, $urlparams = array())
{
JLoader::register('PrivacyHelper', JPATH_ADMINISTRATOR . '/components/com_privacy/helpers/privacy.php');

// Load the submenu.
PrivacyHelper::addSubmenu($this->input->get('view', $this->default_view));
// Get the document object.
$document = JFactory::getDocument();

return parent::display();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', $this->default_view);
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');

// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
$model = $this->getModel($vName);
$view->setModel($model, true);

// For the request view, we need to also push the action logs model into the view
if ($vName === 'request')
{
JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_actionlogs/models', 'ActionlogsModel');

$logsModel = $this->getModel('Actionlogs', 'ActionlogsModel');

// Set default ordering for the context
$logsModel->setState('list.fullordering', 'a.log_date DESC');

// And push the model into the view
$view->setModel($logsModel, false);
}

$view->setLayout($lName);

// Push document object into the view.
$view->document = $document;

// Load the submenu.
PrivacyHelper::addSubmenu($this->input->get('view', $this->default_view));

$view->display();
}

return $this;
}
}
63 changes: 62 additions & 1 deletion administrator/components/com_privacy/controllers/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public function complete($key = null, $urlVar = null)
return false;
}

// Log the request completed
$model->logRequestCompleted($recordId);

$this->setMessage(\JText::_('COM_PRIVACY_REQUEST_COMPLETED'));

$url = 'index.php?option=com_privacy&view=requests';
Expand Down Expand Up @@ -253,6 +256,9 @@ public function invalidate($key = null, $urlVar = null)
return false;
}

// Log the request invalidated
$model->logRequestInvalidated($recordId);

$this->setMessage(\JText::_('COM_PRIVACY_REQUEST_INVALIDATED'));

$url = 'index.php?option=com_privacy&view=requests';
Expand All @@ -271,6 +277,53 @@ public function invalidate($key = null, $urlVar = null)
return true;
}

/**
* Method to remove the user data for a privacy remove request.
*
* @return boolean
*
* @since __DEPLOY_VERSION__
*/
public function remove()
{
/** @var PrivacyModelRemove $model */
$model = $this->getModel('Remove');

$recordId = $this->input->getUint('id');

if (!$model->removeDataForRequest($recordId))
{
// Redirect back to the edit screen.
$this->setError(\JText::sprintf('COM_PRIVACY_ERROR_REMOVE_DATA_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
\JRoute::_(
'index.php?option=com_privacy&view=request&id=' . $recordId, false
)
);

return false;
}

$this->setMessage(\JText::_('COM_PRIVACY_DATA_REMOVED'));

$url = 'index.php?option=com_privacy&view=requests';

// Check if there is a return value
$return = $this->input->get('return', null, 'base64');

if (!is_null($return) && \JUri::isInternal(base64_decode($return)))
{
$url = base64_decode($return);
}

// Redirect to the list screen.
$this->setRedirect(\JRoute::_($url, false));

return true;
}

/**
* Function that allows child controller access to model data after the data has been saved.
*
Expand All @@ -283,12 +336,20 @@ public function invalidate($key = null, $urlVar = null)
*/
protected function postSaveHook(\JModelLegacy $model, $validData = array())
{
// Only process an email for a new record
// This hook only processes new items
if (!$model->getState($model->getName() . '.new', false))
{
return;
}

if (!$model->logRequestCreated($model->getState($model->getName() . '.id')))
{
if ($error = $model->getError())
{
JFactory::getApplication()->enqueueMessage($error, 'warning');
}
}

if (!$model->notifyUserAdminCreatedRequest($model->getState($model->getName() . '.id')))
{
if ($error = $model->getError())
Expand Down
36 changes: 36 additions & 0 deletions administrator/components/com_privacy/helpers/removal/status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_privacy
*
* @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('_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 __DEPLOY_VERSION__
*/
class PrivacyRemovalStatus
{
/**
* Flag indicating the status reported by the plugin on whether the information can be removed
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
public $canRemove = true;

/**
* A status message indicating the reason data can or cannot be removed
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $reason;
}
Loading

0 comments on commit 5d85b08

Please sign in to comment.