Skip to content

Commit

Permalink
Merge branch '4.0-dev' into zero-24-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jeckodevelopment committed Apr 15, 2019
2 parents 1209da6 + f2ce350 commit 6288376
Show file tree
Hide file tree
Showing 93 changed files with 1,385 additions and 1,096 deletions.
25 changes: 6 additions & 19 deletions administrator/components/com_actionlogs/helpers/actionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class ActionlogsHelper
*
* @param array|Traversable $data The logs data objects to be exported
*
* @return array|Generator For PHP 5.5 and newer, a Generator is returned; PHP 5.4 and earlier use an array
* @return Generator
*
* @since 3.9.0
* @throws InvalidArgumentException
*/
public static function getCsvData($data)
public static function getCsvData($data): Generator
{
if (!is_iterable($data))
{
Expand All @@ -42,37 +42,24 @@ public static function getCsvData($data)
);
}

if (version_compare(PHP_VERSION, '5.5', '>='))
{
// Only include the PHP 5.5 helper in this conditional to prevent the potential of parse errors for PHP 5.4 or earlier
JLoader::register('ActionlogsHelperPhp55', __DIR__ . '/actionlogsphp55.php');

return ActionlogsHelperPhp55::getCsvAsGenerator($data);
}

$rows = array();

// Header row
$rows[] = array('Id', 'Message', 'Date', 'Extension', 'User', 'Ip');
yield ['Id', 'Message', 'Date', 'Extension', 'User', 'Ip'];

foreach ($data as $log)
{
$date = new JDate($log->log_date, new DateTimeZone('UTC'));
$extension = strtok($log->extension, '.');

static::loadTranslationFiles($extension);

$rows[] = array(
yield [
'id' => $log->id,
'message' => strip_tags(static::getHumanReadableLogMessage($log, false)),
'date' => $date->format('Y-m-d H:i:s T'),
'date' => (new JDate($log->log_date, new DateTimeZone('UTC')))->format('Y-m-d H:i:s T'),
'extension' => JText::_($extension),
'name' => $log->name,
'ip_address' => JText::_($log->ip_address),
);
];
}

return $rows;
}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,11 @@ protected function addToolbar()
{
JToolbarHelper::title(JText::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'list-2');

JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
JToolBarHelper::custom('actionlogs.exportSelectedLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_CSV', true);
JToolBarHelper::custom('actionlogs.exportLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', false); JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
$bar = JToolbar::getInstance('toolbar');
$bar->appendButton('Confirm', 'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge', false);
JToolbarHelper::preferences('com_actionlogs');
JToolbarHelper::help('JHELP_COMPONENTS_ACTIONLOGS');
JToolBarHelper::custom('actionlogs.exportSelectedLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_CSV', true);
JToolBarHelper::custom('actionlogs.exportLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@

if ($data['view'] instanceof \Joomla\Component\Languages\Administrator\View\Overrides\HtmlView)
{
// Client selector doesn't have to activate the filter bar.
// Language/Client selector doesn't have to activate the filter bar.
unset($data['view']->activeFilters['language_client']);
}

if ($data['view'] instanceof \Joomla\Component\Languages\Administrator\View\Installed\HtmlView)
{
// Client selector doesn't have to activate the filter bar.
unset($data['view']->activeFilters['client_id']);
}

// Set some basic options
$customOptions = array(
'filtersHidden' => $data['options']['filtersHidden'] ?? empty($data['view']->activeFilters),
Expand All @@ -46,11 +52,19 @@
<?php if ($data['view'] instanceof \Joomla\Component\Languages\Administrator\View\Overrides\HtmlView) : ?>
<?php $langClient = $data['view']->filterForm->getField('language_client'); ?>
<div class="js-stools-container-selector">
<div class="js-stools-field-selector js-stools-langClient">
<div class="js-stools-field-selector js-stools-langclient">
<?php echo $langClient->input; ?>
</div>
</div>
<?php endif; ?>
<?php if ($data['view'] instanceof \Joomla\Component\Languages\Administrator\View\Installed\HtmlView) : ?>
<?php $client = $data['view']->filterForm->getField('client_id'); ?>
<div class="js-stools-container-selector">
<div class="js-stools-field-selector js-stools-client">
<?php echo $client->input; ?>
</div>
</div>
<?php endif; ?>
<div class="js-stools-container-bar">
<?php echo LayoutHelper::render('joomla.searchtools.default.bar', $data); ?>
</div>
Expand Down
25 changes: 14 additions & 11 deletions administrator/components/com_messages/Model/MessageModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@

defined('_JEXEC') or die;

use Joomla\CMS\Access\Access;
use Joomla\CMS\Access\Rule;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Language;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Table\Asset;
use Joomla\CMS\Table\Table;
use Joomla\CMS\User\User;

/**
Expand Down Expand Up @@ -446,17 +449,17 @@ public function notifySuperUsers($subject, $message, $fromUser = null)

try
{
/** @var JTableAsset $table */
$table = $this->getTable('Asset', 'JTable');
/** @var Asset $table */
$table = Table::getInstance('Asset');
$rootId = $table->getRootId();

/** @var JAccessRule[] $rules */
$rules = JAccess::getAssetRules($rootId)->getData();
/** @var Rule[] $rules */
$rules = Access::getAssetRules($rootId)->getData();
$rawGroups = $rules['core.admin']->getData();

if (empty($rawGroups))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_MISSING_ROOT_ASSET_GROUPS'));
$this->setError(Text::_('COM_MESSAGES_ERROR_MISSING_ROOT_ASSET_GROUPS'));

return false;
}
Expand All @@ -473,7 +476,7 @@ public function notifySuperUsers($subject, $message, $fromUser = null)

if (empty($groups))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_NO_GROUPS_SET_AS_SUPER_USER'));
$this->setError(Text::_('COM_MESSAGES_ERROR_NO_GROUPS_SET_AS_SUPER_USER'));

return false;
}
Expand All @@ -487,7 +490,7 @@ public function notifySuperUsers($subject, $message, $fromUser = null)

if (empty($userIDs))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_NO_USERS_SET_AS_SUPER_USER'));
$this->setError(Text::_('COM_MESSAGES_ERROR_NO_USERS_SET_AS_SUPER_USER'));

return false;
}
Expand All @@ -498,12 +501,12 @@ public function notifySuperUsers($subject, $message, $fromUser = null)
* All messages must have a valid from user, we have use cases where an unauthenticated user may trigger this
* so we will set the from user as the to user
*/
$data = array(
$data = [
'user_id_from' => $id,
'user_id_to' => $id,
'subject' => $subject,
'message' => $message,
);
];

if (!$this->save($data))
{
Expand All @@ -513,7 +516,7 @@ public function notifySuperUsers($subject, $message, $fromUser = null)

return true;
}
catch (Exception $exception)
catch (\Exception $exception)
{
$this->setError($exception->getMessage());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
* @package Joomla.Administrator
* @subpackage com_plugins
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;
namespace Joomla\Component\Plugins\Administrator\Field;

JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php');
defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');
use Joomla\CMS\Form\Field\ListField;
use Joomla\Component\Plugins\Administrator\Helper\PluginsHelper;

/**
* Plugin Element field.
*
* @since 3.9.0
*/
class JFormFieldPluginElement extends JFormFieldList
class PluginElementField extends ListField
{
/**
* The form field type.
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_plugins/forms/filter_plugins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@

<field
name="element"
type="pluginelement"
type="PluginElement"
label="COM_PLUGINS_OPTION_ELEMENT"
onchange="this.form.submit();"
>
>
<option value="">COM_PLUGINS_OPTION_ELEMENT</option>
</field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Privacy\Administrator\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;
use Joomla\Component\Privacy\Administrator\Model\ConsentsModel;

/**
* Consents management controller class.
*
* @since 3.9.0
*/
class PrivacyControllerConsents extends JControllerForm
class ConsentsController extends FormController
{
/**
* Method to invalidate specific consents.
Expand All @@ -26,18 +33,18 @@ class PrivacyControllerConsents extends JControllerForm
public function invalidate($key = null, $urlVar = null)
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$this->checkToken();

$ids = $this->input->get('cid', array(), 'array');
$ids = $this->input->get('cid', [], 'array');

if (empty($ids))
{
$this->setError(JText::_('JERROR_NO_ITEMS_SELECTED'));
$this->setError(Text::_('JERROR_NO_ITEMS_SELECTED'));
}
else
{
// Get the model.
/** @var PrivacyModelConsents $model */
/** @var ConsentsModel $model */
$model = $this->getModel();

// Publish the items.
Expand All @@ -46,10 +53,10 @@ public function invalidate($key = null, $urlVar = null)
$this->setError($model->getError());
}

$message = JText::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids));
$message = Text::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids));
}

$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=consents', false), $message);
$this->setRedirect(Route::_('index.php?option=com_privacy&view=consents', false), $message);
}

/**
Expand All @@ -62,21 +69,21 @@ public function invalidate($key = null, $urlVar = null)
public function invalidateAll()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$this->checkToken();

$filters = $this->input->get('filter', array(), 'array');
$filters = $this->input->get('filter', [], 'array');

if (isset($filters['subject']) && $filters['subject'] != '')
{
$subject = $filters['subject'];
}
else
{
$this->setError(JText::_('JERROR_NO_ITEMS_SELECTED'));
$this->setError(Text::_('JERROR_NO_ITEMS_SELECTED'));
}

// Get the model.
/** @var PrivacyModelConsents $model */
/** @var ConsentsModel $model */
$model = $this->getModel();

// Publish the items.
Expand All @@ -85,8 +92,8 @@ public function invalidateAll()
$this->setError($model->getError());
}

$message = JText::_('COM_PRIVACY_CONSENTS_INVALIDATED_ALL');
$message = Text::_('COM_PRIVACY_CONSENTS_INVALIDATED_ALL');

$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=consents', false), $message);
$this->setRedirect(Route::_('index.php?option=com_privacy&view=consents', false), $message);
}
}

0 comments on commit 6288376

Please sign in to comment.