Skip to content

Commit

Permalink
Merge branch '4.1-dev' into j4/mce/paste
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Jan 6, 2022
2 parents 8edf1b2 + 74a225e commit 2c00ed6
Show file tree
Hide file tree
Showing 47 changed files with 317 additions and 225 deletions.
36 changes: 28 additions & 8 deletions administrator/components/com_banners/tmpl/clients/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,40 @@
<?php echo $item->contact; ?>
</td>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=1'); ?>">
<?php echo $item->count_published; ?></a>
<a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=1'); ?>"
aria-describedby="tip-publish<?php echo $i; ?>">
<?php echo $item->count_published; ?>
</a>
<div role="tooltip" id="tip-publish<?php echo $i; ?>">
<?php echo Text::_('COM_BANNERS_COUNT_PUBLISHED_ITEMS'); ?>
</div>
</td>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_unpublished > 0) ? 'btn-danger' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=0'); ?>">
<?php echo $item->count_unpublished; ?></a>
<a class="btn <?php echo ($item->count_unpublished > 0) ? 'btn-danger' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=0'); ?>"
aria-describedby="tip-unpublish<?php echo $i; ?>">
<?php echo $item->count_unpublished; ?>
</a>
<div role="tooltip" id="tip-unpublish<?php echo $i; ?>">
<?php echo Text::_('COM_BANNERS_COUNT_UNPUBLISHED_ITEMS'); ?>
</div>
</td>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_archived > 0) ? 'btn-info' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=2'); ?>">
<?php echo $item->count_archived; ?></a>
<a class="btn <?php echo ($item->count_archived > 0) ? 'btn-info' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=2'); ?>"
aria-describedby="tip-archived<?php echo $i; ?>">
<?php echo $item->count_archived; ?>
</a>
<div role="tooltip" id="tip-archived<?php echo $i; ?>">
<?php echo Text::_('COM_BANNERS_COUNT_ARCHIVED_ITEMS'); ?>
</div>
</td>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_trashed > 0) ? 'btn-inverse' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=-2'); ?>">
<?php echo $item->count_trashed; ?></a>
<a class="btn <?php echo ($item->count_trashed > 0) ? 'btn-dark' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=-2'); ?>"
aria-describedby="tip-trashed<?php echo $i; ?>">
<?php echo $item->count_trashed; ?>
</a>
<div role="tooltip" id="tip-trashed<?php echo $i; ?>">
<?php echo Text::_('COM_BANNERS_COUNT_TRASHED_ITEMS'); ?>
</div>
</td>
<td class="small d-none d-md-table-cell">
<?php if ($item->purchase_type < 0) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@

<?php echo $this->form->getInput('extension'); ?>
<input type="hidden" name="task" value="">
<input type="hidden" name="return" value="<?php echo $input->getBase64('return'); ?>">
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_content/forms/article.xml
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@

<fields name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<fieldset name="jmetadata"
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">

<field
name="robots"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,9 @@ public function getForm($data = array(), $loadData = true)
$record = new \stdClass;

// Get ID of the article from input, for frontend, we use a_id while backend uses id
$articleIdFromInput = (int) $app->input->getInt('a_id') ?: $app->input->getInt('id', 0);
$articleIdFromInput = $app->isClient('site')
? $app->input->getInt('a_id', 0)
: $app->input->getInt('id', 0);

// On edit article, we get ID of article from article.id state, but on save, we use data from input
$id = (int) $this->getState('article.id', $articleIdFromInput);
Expand Down
85 changes: 54 additions & 31 deletions administrator/components/com_installer/src/Model/WarningsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,76 +98,99 @@ public function getItems()
$messages = [];

// 16MB
$minMemory = 16 * 1024 * 1024;
$minLimit = 16 * 1024 * 1024;

$file_uploads = ini_get('file_uploads');

if (!$file_uploads)
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADISDISABLEDDESC'));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADISDISABLEDDESC'),
];
}

$upload_dir = ini_get('upload_tmp_dir');

if (!$upload_dir)
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC'));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC'),
];
}
elseif (!is_writable($upload_dir))
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLE'),
'description' => Text::sprintf('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC', $upload_dir));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLE'),
'description' => Text::sprintf('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC', $upload_dir),
];
}

$tmp_path = Factory::getApplication()->get('tmp_path');

if (!$tmp_path)
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC'));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC'),
];
}
elseif (!is_writable($tmp_path))
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE'),
'description' => Text::sprintf('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC', $tmp_path));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE'),
'description' => Text::sprintf('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC', $tmp_path),
];
}

$memory_limit = $this->return_bytes(ini_get('memory_limit'));

if ($memory_limit < $minMemory && $memory_limit != -1)
if ($memory_limit > -1)
{
// 16MB
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC'));
}
elseif ($memory_limit < ($minMemory * 1.5) && $memory_limit != -1)
{
// 24MB
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC'));
if ($memory_limit < $minLimit)
{
// 16MB
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC'),
];
}
elseif ($memory_limit < ($minLimit * 1.5))
{
// 24MB
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC'),
];
}
}

$post_max_size = $this->return_bytes(ini_get('post_max_size'));
$post_max_size = $this->return_bytes(ini_get('post_max_size'));
$upload_max_filesize = $this->return_bytes(ini_get('upload_max_filesize'));

if ($post_max_size < $upload_max_filesize)
if ($post_max_size > 0 && $post_max_size < $upload_max_filesize)
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOST'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC'));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOST'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC'),
];
}

if ($post_max_size < $minMemory)
if ($post_max_size > 0 && $post_max_size < $minLimit)
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC'));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC'),
];
}

if ($upload_max_filesize < $minMemory)
if ($upload_max_filesize > 0 && $upload_max_filesize < $minLimit)
{
$messages[] = array('message' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC'));
$messages[] = [
'message' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'),
'description' => Text::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC'),
];
}

return $messages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,19 @@ public function getModel($name = 'Api', $prefix = 'Administrator', $config = [])
*/
private function checkContent()
{
$params = ComponentHelper::getParams('com_media');

$helper = new MediaHelper;
$serverlength = $this->input->server->getInt('CONTENT_LENGTH');

if (($params->get('upload_maxsize', 0) > 0 && $serverlength > ($params->get('upload_maxsize', 0) * 1024 * 1024))
|| $serverlength > $helper->toBytes(ini_get('upload_max_filesize'))
|| $serverlength > $helper->toBytes(ini_get('post_max_size'))
|| $serverlength > $helper->toBytes(ini_get('memory_limit')))
$helper = new MediaHelper;
$contentLength = $this->input->server->getInt('CONTENT_LENGTH');
$params = ComponentHelper::getParams('com_media');
$paramsUploadMaxsize = $params->get('upload_maxsize', 0) * 1024 * 1024;
$uploadMaxFilesize = $helper->toBytes(ini_get('upload_max_filesize'));
$postMaxSize = $helper->toBytes(ini_get('post_max_size'));
$memoryLimit = $helper->toBytes(ini_get('memory_limit'));

if (($paramsUploadMaxsize > 0 && $contentLength > $paramsUploadMaxsize)
|| ($uploadMaxFilesize > 0 && $contentLength > $uploadMaxFilesize)
|| ($postMaxSize > 0 && $contentLength > $postMaxSize)
|| ($memoryLimit > -1 && $contentLength > $memoryLimit)
)
{
throw new \Exception(Text::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'), 403);
}
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_menus/forms/item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
showtime="true"
size="22"
filter="user_utc"
showon="home:0"
showon="home:0"
/>

<field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
{
parent::__construct($config, $factory, $app, $input);

$this->registerTask('unsetDefault', 'setDefault');
$this->registerTask('unsetDefault', 'setDefault');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function __construct(array $config = array(), MVCFactoryInterface $factor
}
}

$this->registerTask('unsetDefault', 'setDefault');
$this->registerTask('unsetDefault', 'setDefault');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
}
}

$this->registerTask('unsetDefault', 'setDefault');
$this->registerTask('unsetDefault', 'setDefault');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ public function setDefault($pk, $value = 1)
if ($value)
{
// Unset other default item
if ($table->load(array('default' => '1')))
if ($table->load(
[
'default' => '1',
'extension' => $table->get('extension')
]
))
{
$table->default = 0;
$table->modified = $date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function check()
}
else
{
$db = $this->getDbo();
$db = $this->getDbo();
$query = $db->getQuery(true);

$query
Expand Down Expand Up @@ -192,7 +192,7 @@ public function store($updateNulls = true)
{
// Existing item
$this->modified_by = $user->id;
$this->modified = $date->toSql();
$this->modified = $date->toSql();
}
else
{
Expand All @@ -219,10 +219,15 @@ public function store($updateNulls = true)
$this->modified_by = $this->created_by;
}

if ($this->default == '1')
if ((int) $this->default === 1)
{
// Verify that the default is unique for this workflow
if ($table->load(array('default' => '1')))
if ($table->load(
[
'default' => '1',
'extension' => $this->extension
]
))
{
$table->default = 0;
$table->store();
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/com_joomlaupdate.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ COM_JOOMLAUPDATE_SELF_EMPTYSTATE_TITLE="A new version of the Joomla Update Compo
COM_JOOMLAUPDATE_SYSTEM_CHECK="System Check"
COM_JOOMLAUPDATE_TOOLBAR_CHECK="Check for Updates"
COM_JOOMLAUPDATE_UPDATE_CHECK="Update Check"
COM_JOOMLAUPDATE_UPDATE_CONFIRM_BACKUP="I'm prepared for the update and have made a backup."
COM_JOOMLAUPDATE_UPDATE_CONFIRM_BACKUP="I'm prepared for the update and have made a backup of the files and database."
COM_JOOMLAUPDATE_UPDATE_EMPTYSTATE_TITLE="Update your site to \"Joomla! %s\""
COM_JOOMLAUPDATE_UPDATE_EMPTYSTATE_BUTTON_ADD="Start update"
COM_JOOMLAUPDATE_UPDATE_LOG_CLEANUP="Cleaning up after installation."
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>English (en-GB)</name>
<tag>en-GB</tag>
<version>4.1.0</version>
<creationDate>December 2021</creationDate>
<creationDate>January 2022</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="administrator">
<name>English (en-GB)</name>
<version>4.1.0</version>
<creationDate>December 2021</creationDate>
<creationDate>January 2022</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
2 changes: 1 addition & 1 deletion administrator/manifests/files/joomla.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<copyright>(C) 2019 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>4.1.0-dev</version>
<creationDate>December 2021</creationDate>
<creationDate>January 2022</creationDate>
<description>FILES_JOOMLA_XML_DESCRIPTION</description>

<scriptfile>administrator/components/com_admin/script.php</scriptfile>
Expand Down
2 changes: 1 addition & 1 deletion administrator/manifests/packages/pkg_en-GB.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>English (en-GB) Language Pack</name>
<packagename>en-GB</packagename>
<version>4.1.0.1</version>
<creationDate>December 2021</creationDate>
<creationDate>January 2022</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function preprocessSaveData(array $data): array
*
* @return integer The record ID on success, false on failure
*
* @since __DEPLOY_VERSION__
* @since 4.1.0
*/
protected function save($recordKey = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ protected function save($recordKey = null)
/** @var \Joomla\CMS\MVC\Model\AdminModel $model */
$model = $this->getModel(Inflector::singularize($this->contentType));

$model->setState('filter.language', $this->input->post->get('lang_code'));
$model->setState('filter.client', $this->input->post->get('app'));

if (!$model)
{
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_MODEL_CREATE'));
}

$model->setState('filter.language', $this->input->post->get('lang_code'));
$model->setState('filter.client', $this->input->post->get('app'));

$data = $this->input->get('data', json_decode($this->input->json->getRaw(), true), 'array');

// TODO: Not the cleanest thing ever but it works...
Expand Down

0 comments on commit 2c00ed6

Please sign in to comment.