Skip to content

Commit

Permalink
Merge branch '4.2-dev' into patch-37017
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyFranci committed Dec 3, 2022
2 parents fa0c6e5 + f35ce22 commit edc337d
Show file tree
Hide file tree
Showing 135 changed files with 7,123 additions and 7,025 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ public static function loadActionLogPluginsLanguage()
)
)
)
->from('#__extensions')
->where('type = ' . $db->quote('plugin'))
->where('folder = ' . $db->quote('actionlog'))
->where('state IN (0,1)')
->order('ordering');
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote('actionlog'))
->whereIn($db->quoteName('state'), [0, 1])
->order($db->quoteName('ordering'));
$db->setQuery($query);

try {
Expand Down
224 changes: 112 additions & 112 deletions administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,116 +30,116 @@
*/
class HtmlView extends BaseHtmlView
{
/**
* An array of items.
*
* @var array
* @since 3.9.0
*/
protected $items;

/**
* The model state
*
* @var array
* @since 3.9.0
*/
protected $state;

/**
* The pagination object
*
* @var Pagination
* @since 3.9.0
*/
protected $pagination;

/**
* Form object for search filters
*
* @var Form
* @since 3.9.0
*/
public $filterForm;

/**
* The active search filters
*
* @var array
* @since 3.9.0
*/
public $activeFilters;

/**
* Setting if the IP column should be shown
*
* @var boolean
* @since 3.9.0
*/
protected $showIpColumn = false;

/**
* Setting if the date should be displayed relative to the current date.
*
* @var boolean
* @since 4.1.0
*/
protected $dateRelative = false;

/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return void
*
* @since 3.9.0
*
* @throws Exception
*/
public function display($tpl = null)
{
/** @var ActionlogsModel $model */
$model = $this->getModel();
$this->items = $model->getItems();
$this->state = $model->getState();
$this->pagination = $model->getPagination();
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
$params = ComponentHelper::getParams('com_actionlogs');
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
$this->dateRelative = (bool) $params->get('date_relative', 1);

if (\count($errors = $model->getErrors()))
{
throw new GenericDataException(implode("\n", $errors), 500);
}

$this->addToolbar();

// Load all actionlog plugins language files
ActionlogsHelper::loadActionLogPluginsLanguage();

parent::display($tpl);
}

/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.9.0
*/
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'icon-list-2');

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');
}
/**
* An array of items.
*
* @var array
* @since 3.9.0
*/
protected $items;

/**
* The model state
*
* @var array
* @since 3.9.0
*/
protected $state;

/**
* The pagination object
*
* @var Pagination
* @since 3.9.0
*/
protected $pagination;

/**
* Form object for search filters
*
* @var Form
* @since 3.9.0
*/
public $filterForm;

/**
* The active search filters
*
* @var array
* @since 3.9.0
*/
public $activeFilters;

/**
* Setting if the IP column should be shown
*
* @var boolean
* @since 3.9.0
*/
protected $showIpColumn = false;

/**
* Setting if the date should be displayed relative to the current date.
*
* @var boolean
* @since 4.1.0
*/
protected $dateRelative = false;

/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return void
*
* @since 3.9.0
*
* @throws Exception
*/
public function display($tpl = null)
{
/** @var ActionlogsModel $model */
$model = $this->getModel();
$this->items = $model->getItems();
$this->state = $model->getState();
$this->pagination = $model->getPagination();
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
$params = ComponentHelper::getParams('com_actionlogs');
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
$this->dateRelative = (bool) $params->get('date_relative', 1);

if (\count($errors = $model->getErrors()))
{
throw new GenericDataException(implode("\n", $errors), 500);
}

$this->addToolbar();

// Load all actionlog plugins language files
ActionlogsHelper::loadActionLogPluginsLanguage();

parent::display($tpl);
}

/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.9.0
*/
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'icon-list-2');

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');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@
*/
class Configuration
{
/**
* Method to generate a string for a value
*
* @param mixed $value The configuration value
*
* @return string Formatted and escaped string
*
* @since 4.0.0
*/
public function value($value): string
{
if (\is_bool($value))
{
return $value ? 'true' : 'false';
}
/**
* Method to generate a string for a value
*
* @param mixed $value The configuration value
*
* @return string Formatted and escaped string
*
* @since 4.0.0
*/
public function value($value): string
{
if (\is_bool($value))
{
return $value ? 'true' : 'false';
}

if (\is_array($value))
{
$value = implode(', ', $value);
}
if (\is_array($value))
{
$value = implode(', ', $value);
}

return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
}

0 comments on commit edc337d

Please sign in to comment.