Skip to content

Commit 615c71a

Browse files
authored
Merge pull request #28335 from wilsonge/3916-merge
3.9.16 merge
2 parents b43209a + 2aa8cce commit 615c71a

File tree

28 files changed

+385
-239
lines changed

28 files changed

+385
-239
lines changed

administrator/components/com_categories/forms/category.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
default="0"
1818
class="readonly"
1919
readonly="true"
20+
filter="unset"
2021
/>
2122

2223
<field

administrator/components/com_fields/src/Field/FieldLayoutField.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class FieldLayoutField extends FormField
4343
*/
4444
protected function getInput()
4545
{
46-
$extension = explode('.', $this->form->getValue('context'))[0];
46+
$extension = explode('.', $this->form->getValue('context'));
47+
$extension = $extension[0];
4748

4849
if ($extension)
4950
{

administrator/components/com_fields/src/Model/FieldModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function save($data)
255255
private function checkDefaultValue($data)
256256
{
257257
// Empty default values are correct
258-
if (empty($data['default_value']))
258+
if (empty($data['default_value']) && $data['default_value'] !== '0')
259259
{
260260
return true;
261261
}

administrator/components/com_media/src/Controller/ApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ private function checkContent()
354354
$params = ComponentHelper::getParams('com_media');
355355

356356
$helper = new MediaHelper;
357-
$serverlength = $this->input->server->get('CONTENT_LENGTH');
357+
$serverlength = $this->input->server->getInt('CONTENT_LENGTH');
358358

359359
if ($serverlength > ($params->get('upload_maxsize', 0) * 1024 * 1024)
360360
|| $serverlength > $helper->toBytes(ini_get('upload_max_filesize'))

administrator/components/com_menus/forms/item_url.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@
3030
<option value="license"/>
3131
<option value="next"/>
3232
<option value="nofollow"/>
33+
<option value="noopener"/>
3334
<option value="noreferrer"/>
3435
<option value="prefetch"/>
3536
<option value="prev"/>
3637
<option value="search"/>
38+
<option value="sponsored"/>
3739
<option value="tag"/>
40+
<option value="ugc"/>
3841
</field>
3942

4043
<field

administrator/components/com_menus/src/Controller/MenuController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function save($key = null, $urlVar = null)
6868
$this->setMessage(Text::_('COM_MENUS_ERROR_MENUTYPE'), 'error');
6969

7070
// Redirect back to the edit screen.
71-
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit', false));
71+
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
7272

7373
return false;
7474
}
@@ -113,7 +113,7 @@ public function save($key = null, $urlVar = null)
113113
$app->setUserState($context . '.data', $data);
114114

115115
// Redirect back to the edit screen.
116-
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit', false));
116+
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
117117

118118
return false;
119119
}
@@ -133,7 +133,7 @@ public function save($key = null, $urlVar = null)
133133

134134
// Redirect back to the edit screen.
135135
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');
136-
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit', false));
136+
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
137137

138138
return false;
139139
}
@@ -168,6 +168,7 @@ public function save($key = null, $urlVar = null)
168168
// Set the record data in the session.
169169
$recordId = $model->getState($this->context . '.id');
170170
$this->holdEditId($context, $recordId);
171+
$app->setUserState($context . '.data', null);
171172

172173
// Redirect back to the edit screen.
173174
$this->setRedirect(Route::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));

administrator/components/com_tags/forms/tag.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
class="readonly"
1717
default="0"
1818
readonly="true"
19+
filter="unset"
1920
/>
2021

2122
<field

administrator/components/com_templates/src/Controller/TemplateController.php

Lines changed: 104 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ public function copy()
155155
$templateID = $this->input->getInt('id', 0);
156156
$file = $this->input->get('file');
157157

158+
// Access check.
159+
if (!$this->allowEdit())
160+
{
161+
$app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
162+
163+
return false;
164+
}
165+
158166
$this->setRedirect('index.php?option=com_templates&view=template&id=' . $templateID . '&file=' . $file);
159167

160168
/* @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $model */
@@ -260,19 +268,7 @@ public function getModel($name = 'Template', $prefix = 'Administrator', $config
260268
*/
261269
protected function allowEdit()
262270
{
263-
return $this->app->getIdentity()->authorise('core.edit', 'com_templates');
264-
}
265-
266-
/**
267-
* Method to check if you can save a new or existing record.
268-
*
269-
* @return boolean
270-
*
271-
* @since 3.2
272-
*/
273-
protected function allowSave()
274-
{
275-
return $this->allowEdit();
271+
return $this->app->getIdentity()->authorise('core.admin');
276272
}
277273

278274
/**
@@ -296,7 +292,7 @@ public function save()
296292
$explodeArray = explode(':', base64_decode($fileName));
297293

298294
// Access check.
299-
if (!$this->allowSave())
295+
if (!$this->allowEdit())
300296
{
301297
$this->setMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
302298

@@ -411,6 +407,14 @@ public function overrides()
411407
$override = base64_decode($this->input->get('folder'));
412408
$id = $this->input->get('id');
413409

410+
// Access check.
411+
if (!$this->allowEdit())
412+
{
413+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
414+
415+
return;
416+
}
417+
414418
if ($model->createOverride($override))
415419
{
416420
$this->setMessage(Text::_('COM_TEMPLATES_OVERRIDE_SUCCESS'));
@@ -438,6 +442,14 @@ public function delete()
438442
$id = $this->input->get('id');
439443
$file = $this->input->get('file');
440444

445+
// Access check.
446+
if (!$this->allowEdit())
447+
{
448+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
449+
450+
return;
451+
}
452+
441453
if (base64_decode(urldecode($file)) == '/index.php')
442454
{
443455
$this->setMessage(Text::_('COM_TEMPLATES_ERROR_INDEX_DELETE'), 'warning');
@@ -479,6 +491,14 @@ public function createFile()
479491
$location = base64_decode($this->input->get('address'));
480492
$type = $this->input->get('type');
481493

494+
// Access check.
495+
if (!$this->allowEdit())
496+
{
497+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
498+
499+
return;
500+
}
501+
482502
if ($type == 'null')
483503
{
484504
$this->setMessage(Text::_('COM_TEMPLATES_INVALID_FILE_TYPE'), 'error');
@@ -525,6 +545,14 @@ public function uploadFile()
525545
$upload = $this->input->files->get('files');
526546
$location = base64_decode($this->input->get('address'));
527547

548+
// Access check.
549+
if (!$this->allowEdit())
550+
{
551+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
552+
553+
return;
554+
}
555+
528556
if ($return = $model->uploadFile($upload, $location))
529557
{
530558
$this->setMessage(Text::_('COM_TEMPLATES_FILE_UPLOAD_SUCCESS') . $upload['name']);
@@ -559,6 +587,14 @@ public function createFolder()
559587
$name = $this->input->get('name');
560588
$location = base64_decode($this->input->get('address'));
561589

590+
// Access check.
591+
if (!$this->allowEdit())
592+
{
593+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
594+
595+
return;
596+
}
597+
562598
if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $name))
563599
{
564600
$this->setMessage(Text::_('COM_TEMPLATES_INVALID_FOLDER_NAME'), 'error');
@@ -597,6 +633,14 @@ public function deleteFolder()
597633
$file = $this->input->get('file');
598634
$location = base64_decode($this->input->get('address'));
599635

636+
// Access check.
637+
if (!$this->allowEdit())
638+
{
639+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
640+
641+
return;
642+
}
643+
600644
if (empty($location))
601645
{
602646
$this->setMessage(Text::_('COM_TEMPLATES_ERROR_ROOT_DELETE'), 'warning');
@@ -641,6 +685,14 @@ public function renameFile()
641685
$file = $this->input->get('file');
642686
$newName = $this->input->get('new_name');
643687

688+
// Access check.
689+
if (!$this->allowEdit())
690+
{
691+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
692+
693+
return;
694+
}
695+
644696
if (base64_decode(urldecode($file)) == '/index.php')
645697
{
646698
$this->setMessage(Text::_('COM_TEMPLATES_ERROR_RENAME_INDEX'), 'warning');
@@ -676,6 +728,9 @@ public function renameFile()
676728
*/
677729
public function cropImage()
678730
{
731+
// Check for request forgeries
732+
$this->checkToken();
733+
679734
$id = $this->input->get('id');
680735
$file = $this->input->get('file');
681736
$x = $this->input->get('x');
@@ -686,6 +741,14 @@ public function cropImage()
686741
/** @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $model */
687742
$model = $this->getModel();
688743

744+
// Access check.
745+
if (!$this->allowEdit())
746+
{
747+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
748+
749+
return;
750+
}
751+
689752
if (empty($w) && empty($h) && empty($x) && empty($y))
690753
{
691754
$this->setMessage(Text::_('COM_TEMPLATES_CROP_AREA_ERROR'), 'error');
@@ -715,6 +778,9 @@ public function cropImage()
715778
*/
716779
public function resizeImage()
717780
{
781+
// Check for request forgeries
782+
$this->checkToken();
783+
718784
$id = $this->input->get('id');
719785
$file = $this->input->get('file');
720786
$width = $this->input->get('width');
@@ -723,6 +789,14 @@ public function resizeImage()
723789
/** @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $model */
724790
$model = $this->getModel();
725791

792+
// Access check.
793+
if (!$this->allowEdit())
794+
{
795+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
796+
797+
return;
798+
}
799+
726800
if ($model->resizeImage($file, $width, $height))
727801
{
728802
$this->setMessage(Text::_('COM_TEMPLATES_FILE_RESIZE_SUCCESS'));
@@ -757,6 +831,14 @@ public function copyFile()
757831
/** @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $model */
758832
$model = $this->getModel();
759833

834+
// Access check.
835+
if (!$this->allowEdit())
836+
{
837+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
838+
839+
return;
840+
}
841+
760842
if (!preg_match('/^[a-zA-Z0-9-_]+$/', $newName))
761843
{
762844
$this->setMessage(Text::_('COM_TEMPLATES_INVALID_FILE_NAME'), 'error');
@@ -794,6 +876,14 @@ public function extractArchive()
794876
/** @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $model */
795877
$model = $this->getModel();
796878

879+
// Access check.
880+
if (!$this->allowEdit())
881+
{
882+
$this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
883+
884+
return;
885+
}
886+
797887
if ($model->extractArchive($file))
798888
{
799889
$this->setMessage(Text::_('COM_TEMPLATES_FILE_ARCHIVE_EXTRACT_SUCCESS'));

administrator/language/en-GB/plg_fields_sql.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; Note : All ini files need to be saved as UTF-8
55

66
PLG_FIELDS_SQL="Fields - SQL"
7-
PLG_FIELDS_SQL_CREATE_NOT_POSSIBLE="Only a Super User can create an SQL field!"
7+
PLG_FIELDS_SQL_CREATE_NOT_POSSIBLE="Only a Super User can create or edit an SQL field!"
88
PLG_FIELDS_SQL_LABEL="SQL (%s)"
99
PLG_FIELDS_SQL_PARAMS_MULTIPLE_LABEL="Multiple"
1010
; In the string below the terms 'value' and 'text' should not be translated

components/com_contact/src/View/Contact/HtmlView.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public function display($tpl = null)
117117
$item = $this->get('Item');
118118
$this->form = $this->get('Form');
119119
$params = $state->get('params');
120+
$contacts = array();
120121

121122
$temp = clone $params;
122123

@@ -154,7 +155,8 @@ public function display($tpl = null)
154155
$item->params = $temp;
155156
}
156157

157-
if ($item)
158+
// Collect extra contact information when this information is required
159+
if ($item && $item->params->get('show_contact_list'))
158160
{
159161
// Get Category Model data
160162
$categoryModel = new \Joomla\Component\Contact\Site\Model\CategoryModel(array('ignore_request' => true));

0 commit comments

Comments
 (0)