Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/4.3-dev' into fix_ldap_ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
tatankat committed Jan 23, 2023
2 parents 3ab8579 + 77c1ad6 commit f2f9909
Show file tree
Hide file tree
Showing 1,357 changed files with 12,881 additions and 10,029 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function exportLogs()

$task = $this->getTask();

$pks = array();
$pks = [];

if ($task == 'exportSelectedLogs') {
// Get selected logs
Expand Down Expand Up @@ -116,7 +116,7 @@ public function exportLogs()
}

fclose($output);
$this->app->triggerEvent('onAfterLogExport', array());
$this->app->triggerEvent('onAfterLogExport', []);
$this->app->close();
} else {
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getOptions()
$db->setQuery($query);
$context = $db->loadColumn();

$options = array();
$options = [];

if (\count($context) > 0) {
foreach ($context as $item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ class LogsdaterangeField extends PredefinedlistField
* @var array
* @since 3.9.0
*/
protected $predefinedOptions = array(
protected $predefinedOptions = [
'today' => 'COM_ACTIONLOGS_OPTION_RANGE_TODAY',
'past_week' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_WEEK',
'past_1month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_1MONTH',
'past_3month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_3MONTH',
'past_6month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_6MONTH',
'past_year' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_YEAR',
);
];

/**
* Method to instantiate the form field object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function getInput()
'link',
Route::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $result),
Text::_('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED'),
array('class' => 'alert-link')
['class' => 'alert-link']
);

return '<div class="alert alert-info">'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ActionlogsHelper
*
* @since 3.9.7
*/
private static $characters = array('=', '+', '-', '@');
private static $characters = ['=', '+', '-', '@'];

/**
* Method to convert logs objects array to an iterable type for use with a CSV export
Expand Down Expand Up @@ -72,14 +72,14 @@ public static function getCsvData($data): Generator

static::loadTranslationFiles($extension);

yield array(
yield [
'id' => $log->id,
'message' => self::escapeCsvFormula(strip_tags(static::getHumanReadableLogMessage($log, false))),
'extension' => self::escapeCsvFormula(Text::_($extension)),
'date' => (new Date($log->log_date, new \DateTimeZone('UTC')))->format('Y-m-d H:i:s T'),
'name' => self::escapeCsvFormula($log->name),
'ip_address' => self::escapeCsvFormula($log->ip_address === 'COM_ACTIONLOGS_DISABLED' ? $disabledText : $log->ip_address)
);
];
}
}

Expand All @@ -94,7 +94,7 @@ public static function getCsvData($data): Generator
*/
public static function loadTranslationFiles($extension)
{
static $cache = array();
static $cache = [];
$extension = strtolower($extension);

if (isset($cache[$extension])) {
Expand Down Expand Up @@ -175,7 +175,7 @@ public static function getLogContentTypeParams($context)
*/
public static function getHumanReadableLogMessage($log, $generateLinks = true)
{
static $links = array();
static $links = [];

$message = Text::_($log->message_language_key);
$messageData = json_decode($log->message, true);
Expand All @@ -200,7 +200,7 @@ public static function getHumanReadableLogMessage($log, $generateLinks = true)

foreach ($messageData as $key => $value) {
// Escape any markup in the values to prevent XSS attacks
$value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
$value = $value !== null ? htmlspecialchars($value, ENT_QUOTES, 'UTF-8') : '';

// Convert relative url to absolute url so that it is clickable in action logs notification email
if ($generateLinks && StringHelper::strpos($value, 'index.php?') === 0) {
Expand Down Expand Up @@ -242,7 +242,7 @@ public static function getContentTypeLink($component, $contentType, $id, $urlVar

\JLoader::register($cName, $file);

if (class_exists($cName) && \is_callable(array($cName, 'getContentTypeLink'))) {
if (class_exists($cName) && \is_callable([$cName, 'getContentTypeLink'])) {
return $cName::getContentTypeLink($contentType, $id, $object);
}
}
Expand Down Expand Up @@ -273,18 +273,18 @@ public static function loadActionLogPluginsLanguage()
$query = $db->getQuery(true)
->select(
$db->quoteName(
array(
[
'folder',
'element',
'params',
'extension_id'
),
array(
],
[
'type',
'name',
'params',
'id'
)
]
)
)
->from($db->quoteName('#__extensions'))
Expand All @@ -297,7 +297,7 @@ public static function loadActionLogPluginsLanguage()
try {
$rows = $db->loadObjectList();
} catch (\RuntimeException $e) {
$rows = array();
$rows = [];
}

if (empty($rows)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function addLog($messages, $messageLanguageKey, $context, $userId = null)
$ip = 'COM_ACTIONLOGS_DISABLED';
}

$loggedMessages = array();
$loggedMessages = [];

foreach ($messages as $message) {
$logMessage = new \stdClass();
Expand Down Expand Up @@ -112,7 +112,7 @@ protected function sendNotificationEmails($messages, $username, $context)
$query = $db->getQuery(true);

$query
->select($db->quoteName(array('u.email', 'l.extensions')))
->select($db->quoteName(['u.email', 'l.extensions']))
->from($db->quoteName('#__users', 'u'))
->where($db->quoteName('u.block') . ' = 0')
->join(
Expand All @@ -125,7 +125,7 @@ protected function sendNotificationEmails($messages, $username, $context)

$users = $db->loadObjectList();

$recipients = array();
$recipients = [];

foreach ($users as $user) {
$extensions = json_decode($user->extensions, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ class ActionlogsModel extends ListModel
*
* @throws Exception
*/
public function __construct($config = array())
public function __construct($config = [])
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
$config['filter_fields'] = [
'a.id', 'id',
'a.extension', 'extension',
'a.user_id', 'user',
'a.message', 'message',
'a.log_date', 'log_date',
'a.ip_address', 'ip_address',
'dateRange',
);
];
}

parent::__construct($config);
Expand Down Expand Up @@ -217,7 +217,7 @@ private function buildDateRange($range)
break;
}

return array('dNow' => $dNow, 'dStart' => $dStart);
return ['dNow' => $dNow, 'dStart' => $dStart];
}

/**
Expand Down Expand Up @@ -347,7 +347,7 @@ public function delete(&$pks)
return false;
}

Factory::getApplication()->triggerEvent('onAfterLogPurge', array());
Factory::getApplication()->triggerEvent('onAfterLogPurge', []);

return true;
}
Expand All @@ -367,7 +367,7 @@ public function purge()
return false;
}

Factory::getApplication()->triggerEvent('onAfterLogPurge', array());
Factory::getApplication()->triggerEvent('onAfterLogPurge', []);

return true;
}
Expand All @@ -382,7 +382,7 @@ public function purge()
*
* @since 3.9.0
*/
public function getFilterForm($data = array(), $loadData = true)
public function getFilterForm($data = [], $loadData = true)
{
$form = parent::getFilterForm($data, $loadData);
$params = ComponentHelper::getParams('com_actionlogs');
Expand All @@ -392,8 +392,8 @@ public function getFilterForm($data = array(), $loadData = true)
if ($form && $ipLogging) {
/* @var \Joomla\CMS\Form\Field\ListField $field */
$field = $form->getField('fullordering', 'list');
$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_ASC'), array('value' => 'a.ip_address ASC'));
$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_DESC'), array('value' => 'a.ip_address DESC'));
$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_ASC'), ['value' => 'a.ip_address ASC']);
$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_DESC'), ['value' => 'a.ip_address DESC']);
}

return $form;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,24 @@ public function display($tpl = null)
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'icon-list-2');
$toolbar = Toolbar::getInstance();

ToolbarHelper::custom('actionlogs.exportSelectedLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_CSV', true);
ToolbarHelper::custom('actionlogs.exportLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', false);
ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
$bar = Toolbar::getInstance('toolbar');
$bar->appendButton('Confirm', 'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge', false);
ToolbarHelper::preferences('com_actionlogs');
ToolbarHelper::help('User_Actions_Log');
$toolbar->standardButton('download', 'COM_ACTIONLOGS_EXPORT_CSV', 'actionlogs.exportSelectedLogs')
->icon('icon-download')
->listCheck(true);

$toolbar->standardButton('download', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', 'actionlogs.exportLogs')
->icon('icon-download')
->listCheck(false);

$toolbar->delete('actionlogs.delete')
->message('JGLOBAL_CONFIRM_DELETE');

$toolbar->confirmButton('delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge')
->message('COM_ACTIONLOGS_PURGE_CONFIRM')
->listCheck(false);

$toolbar->preferences('com_actionlogs');
$toolbar->help('User_Actions_Log');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<form action="<?php echo Route::_('index.php?option=com_actionlogs&view=actionlogs'); ?>" method="post" name="adminForm" id="adminForm">
<div id="j-main-container" class="j-main-container">
<?php // Search tools bar ?>
<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function admin_postinstall_behindproxy_condition()
function behindproxy_postinstall_action()
{
$prev = ArrayHelper::fromObject(new JConfig());
$data = array_merge($prev, array('behind_loadbalancer' => '1'));
$data = array_merge($prev, ['behind_loadbalancer' => '1']);

$config = new Registry($data);

Expand All @@ -71,7 +71,7 @@ function behindproxy_postinstall_action()
}

// Attempt to write the configuration file as a PHP class named JConfig.
$configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
$configuration = $config->toString('PHP', ['class' => 'JConfig', 'closingtag' => false]);

if (!File::write($file, $configuration)) {
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
Expand Down

0 comments on commit f2f9909

Please sign in to comment.