Skip to content

Commit

Permalink
Merge branch '5.2-dev' into not_new
Browse files Browse the repository at this point in the history
  • Loading branch information
Quy committed Apr 30, 2024
2 parents 3e3db3b + 7db6a0f commit d31e366
Show file tree
Hide file tree
Showing 154 changed files with 476 additions and 304 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Database\DatabaseIterator;
use Joomla\Database\DatabaseQuery;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Utilities\ArrayHelper;

// phpcs:disable PSR1.Files.SideEffects
Expand Down Expand Up @@ -79,7 +79,7 @@ protected function populateState($ordering = 'a.id', $direction = 'desc')
/**
* Build an SQL query to load the list data.
*
* @return DatabaseQuery
* @return QueryInterface
*
* @since 3.9.0
*
Expand Down Expand Up @@ -298,7 +298,7 @@ public function getLogDataAsIterator($pks = null)
*
* @param integer[]|null $pks An optional array of log record IDs to load
*
* @return DatabaseQuery
* @return QueryInterface
*
* @since 3.9.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper;
use Joomla\Database\Exception\ExecutionFailureException;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand Down Expand Up @@ -152,7 +153,7 @@ protected function getStoreId($id = '')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery|boolean
* @return QueryInterface|boolean
*
* @since 3.7.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand Down Expand Up @@ -94,7 +95,7 @@ public function &getCategoryOrders()
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 1.6
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand Down Expand Up @@ -94,7 +95,7 @@ protected function getStoreId($id = '')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*/
protected function getListQuery()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Folder;
use Joomla\String\StringHelper;
Expand Down Expand Up @@ -87,7 +88,7 @@ protected function populateState($ordering = 'b.name', $direction = 'asc')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 1.6
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
->useScript('multiselect');

$user = $this->getCurrentUser();
$userId = $user->get('id');
$userId = $user->id;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_banners/tmpl/clients/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
];

$user = $this->getCurrentUser();
$userId = $user->get('id');
$userId = $user->id;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$params = $this->state->get('params') ?? new Registry();
Expand Down Expand Up @@ -107,7 +107,7 @@
<?php foreach ($this->items as $i => $item) :
$canCreate = $user->authorise('core.create', 'com_banners');
$canEdit = $user->authorise('core.edit', 'com_banners');
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || is_null($item->checked_out);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_banners') && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table;
use Joomla\Database\DatabaseQuery;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Utilities\ArrayHelper;

// phpcs:disable PSR1.Files.SideEffects
Expand Down Expand Up @@ -156,7 +156,7 @@ protected function getStoreId($id = '')
/**
* Method to get a database query to list categories.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 1.6
*/
Expand Down Expand Up @@ -493,7 +493,7 @@ public function countItems(&$items, $extension)
/**
* Manipulate the query to be used to evaluate if this is an Empty State to provide specific conditions for this extension.
*
* @return DatabaseQuery
* @return QueryInterface
*
* @since 4.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
->useScript('multiselect');

$user = $this->getCurrentUser();
$userId = $user->get('id');
$userId = $user->id;
$extension = $this->escape($this->state->get('filter.extension'));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function save($data)

// Check that we aren't removing our Super User permission
// Need to get groups from database, since they might have changed
$myGroups = Access::getGroupsByUser($this->getCurrentUser()->get('id'));
$myGroups = Access::getGroupsByUser($this->getCurrentUser()->id);
$myRules = $rules->getData();
$hasSuperAdmin = $myRules['core.admin']->allow($myGroups);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Utilities\ArrayHelper;

// phpcs:disable PSR1.Files.SideEffects
Expand Down Expand Up @@ -135,7 +136,7 @@ protected function getStoreId($id = '')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 1.6
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function edit($contact, $params, $attribs = [], $legacy = false)
property_exists($contact, 'checked_out')
&& property_exists($contact, 'checked_out_time')
&& !\is_null($contact->checked_out)
&& $contact->checked_out !== $user->get('id')
&& $contact->checked_out !== $user->id
) {
$checkoutUser = $this->getUserFactory()->loadUserById($contact->checked_out);
$date = HTMLHelper::_('date', $contact->checked_out_time);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ContactTable extends Table implements VersionableTableInterface, TaggableT
protected $_supportNullValue = true;

/**
* Ensure the params and metadata in json encoded in the bind method
* Ensure the params and metadata are json encoded in the bind method
*
* @var array
* @since 3.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
->useScript('multiselect');

$user = $this->getCurrentUser();
$userId = $user->get('id');
$userId = $user->id;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Joomla\CMS\Table\Table;
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

Expand Down Expand Up @@ -217,7 +218,7 @@ protected function getStoreId($id = '')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 1.6
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
namespace Joomla\Component\Content\Administrator\Model;

// phpcs:disable PSR1.Files.SideEffects
use Joomla\Database\QueryInterface;

\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

Expand Down Expand Up @@ -88,7 +90,7 @@ protected function populateState($ordering = 'a.title', $direction = 'asc')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 4.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function edit($article, $params, $attribs = [], $legacy = false)
property_exists($article, 'checked_out')
&& property_exists($article, 'checked_out_time')
&& !\is_null($article->checked_out)
&& $article->checked_out != $user->get('id')
&& $article->checked_out != $user->id
) {
$checkoutUser = Factory::getUser($article->checked_out);
$date = HTMLHelper::_('date', $article->checked_out_time);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

$app = Factory::getApplication();
$user = $this->getCurrentUser();
$userId = $user->get('id');
$userId = $user->id;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

$app = Factory::getApplication();
$user = $this->getCurrentUser();
$userId = $user->get('id');
$userId = $user->id;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'fp.ordering';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Joomla\CMS\Table\ContentType;
use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand Down Expand Up @@ -317,7 +318,7 @@ protected function populateState($ordering = 'h.save_date', $direction = 'DESC')
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
* @return QueryInterface
*
* @since 3.2
*/
Expand Down
14 changes: 2 additions & 12 deletions administrator/components/com_fields/src/Helper/FieldsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,24 +485,14 @@ public static function prepareForm($context, Form $form, $data)
// Loading the XML fields string into the form
$form->load($xml->saveXML());

$model = Factory::getApplication()->bootComponent('com_fields')
->getMVCFactory()->createModel('Field', 'Administrator', ['ignore_request' => true]);

if (
(!isset($data->id) || !$data->id) && Factory::getApplication()->getInput()->getCmd('controller') == 'modules'
&& Factory::getApplication()->isClient('site')
) {
// Modules on front end editing don't have data and an id set
$data->id = Factory::getApplication()->getInput()->getInt('id');
}

// Looping through the fields again to set the value
if (!isset($data->id) || !$data->id) {
return true;
}

foreach ($fields as $field) {
$value = $model->getFieldValue($field->id, $data->id);
// Get the value already loaded by static::getFields()
$value = $field->rawvalue;

if ($value === null) {
continue;
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_fields/src/Model/FieldsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

Expand Down Expand Up @@ -129,9 +130,9 @@ protected function getStoreId($id = '')
}

/**
* Method to get a DatabaseQuery object for retrieving the data set from a database.
* Method to get a QueryInterface object for retrieving the data set from a database.
*
* @return \Joomla\Database\DatabaseQuery A DatabaseQuery object to retrieve the data set.
* @return QueryInterface An object implementing QueryInterface to retrieve the data set.
*
* @since 3.7.0
*/
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_fields/src/Model/GroupsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

Expand Down Expand Up @@ -117,9 +118,9 @@ protected function getStoreId($id = '')
}

/**
* Method to get a DatabaseQuery object for retrieving the data set from a database.
* Method to get a QueryInterface object for retrieving the data set from a database.
*
* @return \Joomla\Database\DatabaseQuery A DatabaseQuery object to retrieve the data set.
* @return QueryInterface An object implementing QueryInterface to retrieve the data set.
*
* @since 3.7.0
*/
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_fields/src/Table/FieldTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ public function check()
if ($this->id) {
// Existing item
$this->modified_time = $date;
$this->modified_by = $user->get('id');
$this->modified_by = $user->id;
} else {
if (!(int) $this->modified_time) {
$this->modified_time = $this->created_time;
}

if (empty($this->created_user_id)) {
$this->created_user_id = $user->get('id');
$this->created_user_id = $user->id;
}

if (empty($this->modified_by)) {
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_fields/src/Table/GroupTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ public function check()

if ($this->id) {
$this->modified = $date;
$this->modified_by = $user->get('id');
$this->modified_by = $user->id;
} else {
if (!(int) $this->modified) {
$this->modified = $this->created;
}

if (empty($this->created_by)) {
$this->created_by = $user->get('id');
$this->created_by = $user->id;
}

if (empty($this->modified_by)) {
Expand Down

0 comments on commit d31e366

Please sign in to comment.