Skip to content

Commit 81ed3dd

Browse files
authored
Merge pull request joomla#24375 from wilsonge/390-merge6
Joomla 3.9.0 Part #6
2 parents f2454ff + e07e3a5 commit 81ed3dd

File tree

100 files changed

+2578
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2578
-329
lines changed

administrator/components/com_actionlogs/access.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

administrator/components/com_actionlogs/config.xml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,4 @@
3131
default="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"
3232
/>
3333
</fieldset>
34-
<fieldset
35-
name="permissions"
36-
label="JCONFIG_PERMISSIONS_LABEL"
37-
description="JCONFIG_PERMISSIONS_DESC"
38-
>
39-
<field
40-
name="rules"
41-
type="rules"
42-
label="JCONFIG_PERMISSIONS_LABEL"
43-
class="inputbox"
44-
validate="rules"
45-
filter="rules"
46-
component="com_actionlogs"
47-
section="component"
48-
/>
49-
</fieldset>
50-
</config>
34+
</config>

administrator/components/com_actionlogs/controller.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ class ActionlogsController extends JControllerLegacy
2828
*/
2929
public function display($cachable = false, $urlparams = array())
3030
{
31-
$view = $this->input->get('view', 'actionlogs');
32-
33-
switch ($view)
34-
{
35-
case 'actionlogs':
36-
if (!JFactory::getUser()->authorise('core.viewlogs', 'com_actionlogs'))
37-
{
38-
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
39-
}
40-
break;
41-
}
42-
4331
return parent::display();
4432
}
4533
}

administrator/components/com_actionlogs/controllers/actionlogs.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,6 @@ public function exportLogs()
110110
*/
111111
public function delete()
112112
{
113-
if (!JFactory::getUser()->authorise('core.delete', $this->option))
114-
{
115-
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'));
116-
117-
return;
118-
}
119-
120113
parent::delete();
121114
}
122115

administrator/components/com_actionlogs/helpers/actionlogs.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,74 @@ public static function getContentTypeLink($component, $contentType, $id, $urlVar
189189
// Return default link to avoid having to implement getContentTypeLink in most of our components
190190
return 'index.php?option=' . $component . '&task=' . $contentType . '.edit&' . $urlVar . '=' . $id;
191191
}
192+
193+
/**
194+
* Load both enabled and disabled actionlog plugins language file. It is used to make sure actions log is
195+
* displayed properly instead of only language items displayed when a plugin is disabled
196+
*
197+
* @return void
198+
*
199+
* @since __DEPLOY_VERSION__
200+
*/
201+
public static function loadActionLogPluginsLanguage()
202+
{
203+
$lang = JFactory::getLanguage();
204+
$db = JFactory::getDbo();
205+
206+
// Get all (both enabled and disabled) actionlog plugins
207+
$query = $db->getQuery(true)
208+
->select(
209+
$db->quoteName(
210+
array(
211+
'folder',
212+
'element',
213+
'params',
214+
'extension_id'
215+
),
216+
array(
217+
'type',
218+
'name',
219+
'params',
220+
'id'
221+
)
222+
)
223+
)
224+
->from('#__extensions')
225+
->where('type = ' . $db->quote('plugin'))
226+
->where('folder = ' . $db->quote('actionlog'))
227+
->where('state IN (0,1)')
228+
->order('ordering');
229+
$db->setQuery($query);
230+
231+
try
232+
{
233+
$rows = $db->loadObjectList();
234+
}
235+
catch (RuntimeException $e)
236+
{
237+
$rows = array();
238+
}
239+
240+
if (empty($rows))
241+
{
242+
return;
243+
}
244+
245+
foreach ($rows as $row)
246+
{
247+
$name = $row->name;
248+
$type = $row->type;
249+
$extension = 'Plg_' . $type . '_' . $name;
250+
$extension = strtolower($extension);
251+
252+
// If language already loaded, don't load it again.
253+
if ($lang->getPaths($extension))
254+
{
255+
continue;
256+
}
257+
258+
$lang->load($extension, JPATH_ADMINISTRATOR, null, false, true)
259+
|| $lang->load($extension, JPATH_PLUGINS . '/' . $type . '/' . $name, null, false, true);
260+
}
261+
}
192262
}

administrator/components/com_actionlogs/layouts/logstable.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
JFactory::getLanguage()->load("com_actionlogs", JPATH_ADMINISTRATOR, null, false, true);
1313

1414
$messages = $displayData['messages'];
15+
$showIpColumn = $displayData['showIpColumn'];
1516
?>
1617
<h1>
1718
<?php echo JText::_('COM_ACTIONLOGS_EMAIL_SUBJECT'); ?>
@@ -25,22 +26,21 @@
2526
<th><?php echo JText::_('COM_ACTIONLOGS_DATE'); ?></th>
2627
<th><?php echo JText::_('COM_ACTIONLOGS_EXTENSION'); ?></th>
2728
<th><?php echo JText::_('COM_ACTIONLOGS_NAME'); ?></th>
28-
<th><?php echo JText::_('COM_ACTIONLOGS_IP_ADDRESS'); ?></th>
29+
<?php if ($showIpColumn) : ?>
30+
<th><?php echo JText::_('COM_ACTIONLOGS_IP_ADDRESS'); ?></th>
31+
<?php endif; ?>
2932
</thead>
3033
<tbody>
31-
<?php
32-
foreach ($messages as $message)
33-
{
34-
?>
35-
<tr>
36-
<td><?php echo $message->message; ?></td>
37-
<td><?php echo $message->log_date; ?></td>
38-
<td><?php echo $message->extension; ?></td>
39-
<td><?php echo $displayData['username']; ?></td>
40-
<td><?php echo $message->ip_address; ?></td>
41-
</tr>
42-
<?php
43-
}
44-
?>
34+
<?php foreach ($messages as $message) : ?>
35+
<tr>
36+
<td><?php echo $message->message; ?></td>
37+
<td><?php echo $message->log_date; ?></td>
38+
<td><?php echo $message->extension; ?></td>
39+
<td><?php echo $displayData['username']; ?></td>
40+
<?php if ($showIpColumn) : ?>
41+
<td><?php echo JText::_($message->ip_address); ?></td>
42+
<?php endif; ?>
43+
</tr>
44+
<?php endforeach; ?>
4545
</tbody>
4646
</table>

administrator/components/com_actionlogs/models/actionlog.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ public function addLogsToDb($messages, $messageLanguageKey, $context, $userId =
9090
*/
9191
protected function sendNotificationEmails($messages, $username, $context)
9292
{
93-
$db = $this->getDbo();
94-
$query = $db->getQuery(true);
93+
$db = $this->getDbo();
94+
$query = $db->getQuery(true);
95+
$params = ComponentHelper::getParams('com_actionlogs');
96+
$showIpColumn = (bool) $params->get('ip_logging', 0);
9597

9698
$query->select($db->quoteName(array('email', 'params')))
9799
->from($db->quoteName('#__users'))
@@ -138,8 +140,9 @@ protected function sendNotificationEmails($messages, $username, $context)
138140
}
139141

140142
$displayData = array(
141-
'messages' => $messages,
142-
'username' => $username,
143+
'messages' => $messages,
144+
'username' => $username,
145+
'showIpColumn' => $showIpColumn,
143146
);
144147

145148
$body = $layout->render($displayData);

administrator/components/com_actionlogs/views/actionlogs/tmpl/default.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<th>
6363
<?php echo JHtml::_('searchtools.sort', 'COM_ACTIONLOGS_NAME', 'a.user_id', $listDirn, $listOrder); ?>
6464
</th>
65-
<?php if ($this->ip) : ?>
65+
<?php if ($this->showIpColumn) : ?>
6666
<th>
6767
<?php echo JHtml::_('searchtools.sort', 'COM_ACTIONLOGS_IP_ADDRESS', 'a.ip_address', $listDirn, $listOrder); ?>
6868
</th>
@@ -96,7 +96,7 @@
9696
<td>
9797
<?php echo $item->name; ?>
9898
</td>
99-
<?php if ($this->ip) : ?>
99+
<?php if ($this->showIpColumn) : ?>
100100
<td>
101101
<?php echo JText::_($this->escape($item->ip_address)); ?>
102102
</td>

administrator/components/com_actionlogs/views/actionlogs/view.html.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
defined('_JEXEC') or die;
1111

12+
use Joomla\CMS\Component\ComponentHelper;
1213
use Joomla\Registry\Registry;
1314
use Joomla\CMS\Plugin\PluginHelper;
1415

@@ -66,17 +67,14 @@ class ActionlogsViewActionlogs extends JViewLegacy
6667
*/
6768
public function display($tpl = null)
6869
{
69-
if (PluginHelper::isEnabled('system', 'actionlogs'))
70-
{
71-
$params = new Registry(PluginHelper::getPlugin('system', 'actionlogs')->params);
72-
$this->ip = (bool) $params->get('ip_logging', 0);
73-
}
70+
$params = ComponentHelper::getParams('com_actionlogs');
7471

7572
$this->items = $this->get('Items');
7673
$this->state = $this->get('State');
7774
$this->filterForm = $this->get('FilterForm');
7875
$this->activeFilters = $this->get('ActiveFilters');
7976
$this->pagination = $this->get('Pagination');
77+
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
8078

8179
if (count($errors = $this->get('Errors')))
8280
{
@@ -87,6 +85,9 @@ public function display($tpl = null)
8785

8886
$this->addToolBar();
8987

88+
// Load all actionlog plugins language files
89+
ActionlogsHelper::loadActionLogPluginsLanguage();
90+
9091
parent::display($tpl);
9192
}
9293

@@ -101,18 +102,11 @@ protected function addToolbar()
101102
{
102103
JToolbarHelper::title(JText::_('COM_ACTIONLOGS_MANAGER_USERLOGS'));
103104

104-
if (JFactory::getUser()->authorise('core.delete', 'com_actionlogs'))
105-
{
106-
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
107-
$bar = JToolbar::getInstance('toolbar');
108-
$bar->appendButton('Confirm', 'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge', false);
109-
}
110-
111-
if (JFactory::getUser()->authorise('core.admin', 'com_actionlogs') || JFactory::getUser()->authorise('core.options', 'com_actionlogs'))
112-
{
113-
JToolbarHelper::preferences('com_actionlogs');
114-
}
115-
105+
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
106+
$bar = JToolbar::getInstance('toolbar');
107+
$bar->appendButton('Confirm', 'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge', false);
108+
JToolbarHelper::preferences('com_actionlogs');
109+
JToolbarHelper::help('JHELP_COMPONENTS_ACTIONLOGS');
116110
JToolBarHelper::custom('actionlogs.exportSelectedLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_CSV', true);
117111
JToolBarHelper::custom('actionlogs.exportLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', false);
118112
}

administrator/components/com_admin/sql/updates/mysql/3.9.0-2018-05-24.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ CREATE TABLE IF NOT EXISTS `#__privacy_consents` (
77
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
88
`subject` varchar(25) NOT NULL DEFAULT '',
99
`body` text NOT NULL,
10+
`remind` tinyint(4) NOT NULL DEFAULT '0',
11+
`token` varchar(100) NOT NULL DEFAULT '',
1012
PRIMARY KEY (`id`),
1113
KEY `idx_user_id` (`user_id`)
12-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
14+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

0 commit comments

Comments
 (0)