Skip to content

Commit

Permalink
Merge pull request #37404 from fancyFranci/4.2/upmerges/2022-03-29
Browse files Browse the repository at this point in the history
[4.2] Upmerge 2022-03-29
  • Loading branch information
fancyFranci committed Mar 29, 2022
2 parents 61c6f1f + fe70d45 commit ef231cf
Show file tree
Hide file tree
Showing 62 changed files with 1,189 additions and 194 deletions.
40 changes: 40 additions & 0 deletions administrator/components/com_admin/script.php
Expand Up @@ -105,6 +105,7 @@ public function update($installer)
$this->updateAssets($installer);
$this->clearStatsCache();
$this->convertTablesToUtf8mb4(true);
$this->addUserAuthProviderColumn();
$this->cleanJoomlaCache();
}

Expand Down Expand Up @@ -706,6 +707,7 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/administrator/components/com_admin/sql/updates/mysql/3.10.0-2020-08-10.sql',
'/administrator/components/com_admin/sql/updates/mysql/3.10.0-2021-05-28.sql',
'/administrator/components/com_admin/sql/updates/mysql/3.10.7-2022-02-20.sql',
'/administrator/components/com_admin/sql/updates/mysql/3.10.7-2022-03-18.sql',
'/administrator/components/com_admin/sql/updates/mysql/3.2.0.sql',
'/administrator/components/com_admin/sql/updates/mysql/3.2.1.sql',
'/administrator/components/com_admin/sql/updates/mysql/3.2.2-2013-12-22.sql',
Expand Down Expand Up @@ -830,6 +832,7 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/administrator/components/com_admin/sql/updates/postgresql/3.10.0-2021-05-28.sql',
'/administrator/components/com_admin/sql/updates/postgresql/3.10.7-2022-02-20.sql',
'/administrator/components/com_admin/sql/updates/postgresql/3.10.7-2022-02-20.sql.sql',
'/administrator/components/com_admin/sql/updates/postgresql/3.10.7-2022-03-18.sql',
'/administrator/components/com_admin/sql/updates/postgresql/3.2.0.sql',
'/administrator/components/com_admin/sql/updates/postgresql/3.2.1.sql',
'/administrator/components/com_admin/sql/updates/postgresql/3.2.2-2013-12-22.sql',
Expand Down Expand Up @@ -956,6 +959,7 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/administrator/components/com_admin/sql/updates/sqlazure/3.10.1-2021-08-17.sql',
'/administrator/components/com_admin/sql/updates/sqlazure/3.10.7-2022-02-20.sql',
'/administrator/components/com_admin/sql/updates/sqlazure/3.10.7-2022-02-20.sql.sql',
'/administrator/components/com_admin/sql/updates/sqlazure/3.10.7-2022-03-18.sql',
'/administrator/components/com_admin/sql/updates/sqlazure/3.2.0.sql',
'/administrator/components/com_admin/sql/updates/sqlazure/3.2.1.sql',
'/administrator/components/com_admin/sql/updates/sqlazure/3.2.2-2013-12-22.sql',
Expand Down Expand Up @@ -8647,4 +8651,40 @@ function ($template) use ($db)
['atum', 'cassiopeia']
);
}

/**
* Add the user Auth Provider Column as it could be preset from 3.10 already
*
* @return void
*
* @since 4.1.1
*/
protected function addUserAuthProviderColumn(): void
{
$db = Factory::getContainer()->get('DatabaseDriver');

// Check if the column already exists
$fields = $db->getTableColumns('#__users');

// Column exists, skip
if (isset($fields['authProvider']))
{
return;
}

$query = 'ALTER TABLE ' . $db->quoteName('#__users')
. ' ADD COLUMN ' . $db->quoteName('authProvider') . ' varchar(100) DEFAULT ' . $db->quote('') . ' NOT NULL';

// Add column
try
{
$db->setQuery($query)->execute();
}
catch (Exception $e)
{
echo Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '<br>';

return;
}
}
}
Expand Up @@ -107,7 +107,7 @@ public function checkin()
return;
}

$cid = $this->input->get('cid', array(), 'array');
$cid = (array) $this->input->get('cid', array(), 'int');

if (empty($cid))
{
Expand All @@ -118,6 +118,12 @@ public function checkin()
// We know the first element is the one we need because we don't allow multi selection of rows
$id = $cid[0];

if ($id === 0)
{
// Seems we don't have an id to work with.
return;
}

if (AssociationsHelper::canCheckinItem($extensionName, $typeName, $id) === true)
{
$item = AssociationsHelper::getItem($extensionName, $typeName, $id);
Expand Down
Expand Up @@ -78,11 +78,14 @@ public function sticky_publish()
// Check for request forgeries.
$this->checkToken();

$ids = $this->input->get('cid', array(), 'array');
$ids = (array) $this->input->get('cid', array(), 'int');
$values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');

// Remove zero values resulting from input filter
$ids = array_filter($ids);

if (empty($ids))
{
$this->app->enqueueMessage(Text::_('COM_BANNERS_NO_BANNERS_SELECTED'), 'warning');
Expand Down
Expand Up @@ -79,7 +79,7 @@ public function delete()
// Check for request forgeries
$this->checkToken();

$cid = $this->input->post->get('cid', array(), 'array');
$cid = (array) $this->input->post->get('cid', array(), 'string');

if (empty($cid))
{
Expand Down
Expand Up @@ -53,7 +53,7 @@ public function checkin()
// Check for request forgeries
$this->checkToken();

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

if (empty($ids))
{
Expand Down
Expand Up @@ -56,7 +56,7 @@ public function featured()
// Check for request forgeries
$this->checkToken();

$ids = $this->input->get('cid', array(), 'array');
$ids = (array) $this->input->get('cid', array(), 'int');
$values = array('featured' => 1, 'unfeatured' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
Expand All @@ -68,6 +68,14 @@ public function featured()
// Access checks.
foreach ($ids as $i => $id)
{
// Remove zero value resulting from input filter
if ($id === 0)
{
unset($ids[$i]);

continue;
}

$item = $model->getItem($id);

if (!$this->app->getIdentity()->authorise('core.edit.state', 'com_contact.category.' . (int) $item->catid))
Expand All @@ -80,6 +88,8 @@ public function featured()

if (empty($ids))
{
$message = null;

$this->app->enqueueMessage(Text::_('COM_CONTACT_NO_ITEM_SELECTED'), 'warning');
}
else
Expand Down
Expand Up @@ -66,7 +66,7 @@ public function featured()
$this->checkToken();

$user = $this->app->getIdentity();
$ids = $this->input->get('cid', array(), 'array');
$ids = (array) $this->input->get('cid', array(), 'int');
$values = array('featured' => 1, 'unfeatured' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
Expand All @@ -75,6 +75,14 @@ public function featured()
// Access checks.
foreach ($ids as $i => $id)
{
// Remove zero value resulting from input filter
if ($id === 0)
{
unset($ids[$i]);

continue;
}

if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id))
{
// Prune items that you can't change.
Expand Down
Expand Up @@ -33,11 +33,19 @@ public function delete()
$this->checkToken();

$user = $this->app->getIdentity();
$ids = $this->input->get('cid', array(), 'array');
$ids = (array) $this->input->get('cid', array(), 'int');

// Access checks.
foreach ($ids as $i => $id)
{
// Remove zero value resulting from input filter
if ($id === 0)
{
unset($ids[$i]);

continue;
}

if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id))
{
// Prune items that you can't delete.
Expand Down
Expand Up @@ -15,7 +15,6 @@
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;

/**
* Contenthistory list controller class.
Expand Down Expand Up @@ -52,9 +51,12 @@ public function keep()
$this->checkToken();

// Get items to toggle keep forever from the request.
$cid = $this->input->get('cid', array(), 'array');
$cid = (array) $this->input->get('cid', array(), 'int');

if (!is_array($cid) || count($cid) < 1)
// Remove zero values resulting from input filter
$cid = array_filter($cid);

if (empty($cid))
{
$this->app->enqueueMessage(Text::_('COM_CONTENTHISTORY_NO_ITEM_SELECTED'), 'warning');
}
Expand All @@ -63,9 +65,6 @@ public function keep()
// Get the model.
$model = $this->getModel();

// Make sure the item ids are integers
$cid = ArrayHelper::toInteger($cid);

// Toggle keep forever status of the selected items.
if ($model->keep($cid))
{
Expand Down
Expand Up @@ -40,9 +40,12 @@ public function fix()
$this->checkToken();

// Get items to fix the database.
$cid = $this->input->get('cid', array(), 'array');
$cid = (array) $this->input->get('cid', array(), 'int');

if (!is_array($cid) || count($cid) < 1)
// Remove zero values resulting from input filter
$cid = array_filter($cid);

if (empty($cid))
{
$this->app->getLogger()->warning(
Text::_(
Expand Down
Expand Up @@ -60,11 +60,14 @@ public function publish()
// Check for request forgeries.
$this->checkToken();

$ids = $this->input->get('cid', array(), 'array');
$ids = (array) $this->input->get('cid', array(), 'int');
$values = array('publish' => 1, 'unpublish' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');

// Remove zero values resulting from input filter
$ids = array_filter($ids);

if (empty($ids))
{
$this->setMessage(Text::_('COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'), 'warning');
Expand Down Expand Up @@ -111,12 +114,19 @@ public function remove()
// Check for request forgeries.
$this->checkToken();

/** @var ManageModel $model */
$model = $this->getModel('manage');
$eid = (array) $this->input->get('cid', array(), 'int');

// Remove zero values resulting from input filter
$eid = array_filter($eid);

if (!empty($eid))
{
/** @var ManageModel $model */
$model = $this->getModel('manage');

$model->remove($eid);
}

$eid = $this->input->get('cid', array(), 'array');
$eid = ArrayHelper::toInteger($eid, array());
$model->remove($eid);
$this->setRedirect(Route::_('index.php?option=com_installer&view=manage', false));
}

Expand All @@ -134,12 +144,19 @@ public function refresh()
// Check for request forgeries.
$this->checkToken();

/** @var ManageModel $model */
$model = $this->getModel('manage');
$uid = (array) $this->input->get('cid', array(), 'int');

// Remove zero values resulting from input filter
$uid = array_filter($uid);

if (!empty($uid))
{
/** @var ManageModel $model */
$model = $this->getModel('manage');

$model->refresh($uid);
}

$uid = $this->input->get('cid', array(), 'array');
$uid = ArrayHelper::toInteger($uid, array());
$model->refresh($uid);
$this->setRedirect(Route::_('index.php?option=com_installer&view=manage', false));
}

Expand Down
Expand Up @@ -20,7 +20,6 @@
use Joomla\CMS\Updater\Updater;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Installer\Administrator\Model\UpdateModel;
use Joomla\Utilities\ArrayHelper;

/**
* Installer Update Controller
Expand All @@ -44,8 +43,10 @@ public function update()
/** @var UpdateModel $model */
$model = $this->getModel('update');

$uid = $this->input->get('cid', array(), 'array');
$uid = ArrayHelper::toInteger($uid, array());
$uid = (array) $this->input->get('cid', array(), 'int');

// Remove zero values resulting from input filter
$uid = array_filter($uid);

// Get the minimum stability.
$params = ComponentHelper::getComponent('com_installer')->getParams();
Expand Down
Expand Up @@ -86,11 +86,14 @@ public function publish()
// Check for request forgeries.
$this->checkToken();

$ids = $this->input->get('cid', array(), 'array');
$ids = (array) $this->input->get('cid', array(), 'int');
$values = array('publish' => 1, 'unpublish' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');

// Remove zero values resulting from input filter
$ids = array_filter($ids);

if (empty($ids))
{
throw new \Exception(Text::_('COM_INSTALLER_ERROR_NO_UPDATESITES_SELECTED'), 500);
Expand Down Expand Up @@ -127,7 +130,10 @@ public function delete()
// Check for request forgeries.
$this->checkToken();

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

// Remove zero values resulting from input filter
$ids = array_filter($ids);

if (empty($ids))
{
Expand Down

0 comments on commit ef231cf

Please sign in to comment.