Skip to content

Commit 1a4205c

Browse files
committed
Merge remote-tracking branch 'upstream/5.3-dev' into upmerges/2024-10-09
2 parents 3e45ba2 + 7400994 commit 1a4205c

File tree

148 files changed

+1692
-1095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1692
-1095
lines changed

administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ public static function getContentTypeLink($component, $contentType, $id, $urlVar
274274
*/
275275
public static function loadActionLogPluginsLanguage()
276276
{
277+
static $loaded;
278+
if ($loaded) {
279+
return;
280+
}
281+
$loaded = true;
282+
277283
$lang = Factory::getLanguage();
278284
$db = Factory::getDbo();
279285

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--
22
-- Add the Guided Tours selectable option to the User Action Logs
33
--
4-
INSERT INTO "#__action_logs_extensions" ("extension") VALUES ("com_guidedtours");
4+
INSERT INTO "#__action_logs_extensions" ("extension") VALUES ('com_guidedtours');
55

66
INSERT INTO "#__action_log_config" ("type_title", "type_alias", "id_holder", "title_holder", "table_name", "text_prefix") VALUES
77
('guidedtour', 'com_guidedtours.state', 'id', 'title', '#__guidedtours', 'PLG_ACTIONLOG_JOOMLA');

administrator/components/com_config/src/Model/ApplicationModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Joomla\CMS\Event\Application\AfterSaveConfigurationEvent;
1919
use Joomla\CMS\Event\Application\BeforeSaveConfigurationEvent;
2020
use Joomla\CMS\Factory;
21-
use Joomla\CMS\Filesystem\Folder;
2221
use Joomla\CMS\Http\HttpFactory;
2322
use Joomla\CMS\Language\Text;
2423
use Joomla\CMS\Log\Log;
@@ -34,6 +33,7 @@
3433
use Joomla\Database\DatabaseDriver;
3534
use Joomla\Database\ParameterType;
3635
use Joomla\Filesystem\File;
36+
use Joomla\Filesystem\Folder;
3737
use Joomla\Filesystem\Path;
3838
use Joomla\Filter\OutputFilter;
3939
use Joomla\Registry\Registry;

administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
namespace Joomla\Component\Contenthistory\Administrator\Helper;
1212

1313
use Joomla\CMS\Factory;
14-
use Joomla\CMS\Filesystem\File;
1514
use Joomla\CMS\Language\Text;
1615
use Joomla\CMS\Table\ContentHistory;
1716
use Joomla\CMS\Table\ContentType;
1817
use Joomla\CMS\Table\Table;
1918
use Joomla\Database\ParameterType;
19+
use Joomla\Filesystem\File;
2020
use Joomla\Filesystem\Folder;
2121
use Joomla\Filesystem\Path;
2222

administrator/components/com_fields/tmpl/field/edit.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,24 @@
5555
<?php endforeach; ?>
5656
</div>
5757
<div class="col-lg-3">
58-
<?php $this->set(
59-
'fields',
60-
[
61-
[
62-
'published',
63-
'state',
64-
'enabled',
65-
],
66-
'group_id',
67-
'assigned_cat_ids',
68-
'access',
69-
'language',
70-
'note',
71-
]
72-
); ?>
58+
<?php $this->fields = [
59+
[
60+
'published',
61+
'state',
62+
'enabled',
63+
],
64+
'group_id',
65+
'assigned_cat_ids',
66+
'access',
67+
'language',
68+
'note',
69+
]; ?>
7370
<?php echo LayoutHelper::render('joomla.edit.global', $this); ?>
74-
<?php $this->set('fields', null); ?>
71+
<?php $this->fields = null; ?>
7572
</div>
7673
</div>
7774
<?php echo HTMLHelper::_('uitab.endTab'); ?>
78-
<?php $this->set('ignore_fieldsets', ['fieldparams']); ?>
75+
<?php $this->ignore_fieldsets = ['fieldparams']; ?>
7976
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
8077
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
8178
<fieldset id="fieldset-publishingdata" class="options-form">

administrator/components/com_fields/tmpl/group/edit.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,22 @@
4141
<?php echo $this->form->renderField('description'); ?>
4242
</div>
4343
<div class="col-lg-3">
44-
<?php $this->set(
45-
'fields',
46-
[
47-
[
48-
'published',
49-
'state',
50-
'enabled',
51-
],
52-
'access',
53-
'language',
54-
'note',
55-
]
56-
); ?>
44+
<?php $this->fields = [
45+
[
46+
'published',
47+
'state',
48+
'enabled',
49+
],
50+
'access',
51+
'language',
52+
'note',
53+
]; ?>
5754
<?php echo LayoutHelper::render('joomla.edit.global', $this); ?>
58-
<?php $this->set('fields', null); ?>
55+
<?php $this->fields = null; ?>
5956
</div>
6057
</div>
6158
<?php echo HTMLHelper::_('uitab.endTab'); ?>
62-
<?php $this->set('ignore_fieldsets', ['fieldparams']); ?>
59+
<?php $this->ignore_fieldsets = ['fieldparams']; ?>
6360
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
6461
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
6562
<fieldset id="fieldset-rules" class="options-form">

administrator/components/com_guidedtours/config.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818
<field
1919
name="delayed_time"
20-
type="text"
20+
type="number"
2121
label="COM_GUIDEDTOURS_CONFIG_DELAYED_TIME_LABEL"
2222
description="COM_GUIDEDTOURS_CONFIG_DELAYED_TIME_DESCRIPTION"
2323
default="60"
24-
size="small"
24+
min="1"
25+
filter="integer"
26+
validate="number"
2527
showon="allowTourAutoStart:1"
2628
/>
2729
</fieldset>

administrator/components/com_guidedtours/src/Controller/AjaxController.php

Lines changed: 80 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -37,88 +37,91 @@ public function fetchUserState()
3737
{
3838
$user = $this->app->getIdentity();
3939

40-
$tourId = $this->app->input->getInt('tid', 0);
41-
$stepNumber = $this->app->input->getString('sid', '');
42-
$context = $this->app->input->getString('context', '');
43-
44-
if ($user != null && $user->id > 0) {
45-
$actionState = '';
46-
47-
switch ($context) {
48-
case 'tour.complete':
49-
$actionState = 'completed';
50-
break;
51-
case 'tour.cancel':
52-
$actionState = 'delayed';
53-
break;
54-
case 'tour.skip':
55-
$actionState = 'skipped';
56-
break;
57-
}
40+
$tourId = $this->app->getInput()->getInt('tid', 0);
41+
$stepNumber = $this->app->getInput()->getInt('sid', 0);
42+
$context = $this->app->getInput()->getString('context', '');
43+
44+
if ($user == null || $user->id <= 0) {
45+
echo new JsonResponse(['success' => false, 'tourId' => $tourId], Text::_('COM_GUIDEDTOURS_USERSTATE_CONNECTEDONLY'), true);
46+
$this->app->close();
47+
}
48+
49+
if (!\in_array($context, ['tour.complete', 'tour.cancel', 'tour.skip'])) {
50+
echo new JsonResponse(['success' => false, 'tourId' => $tourId], Text::_('COM_GUIDEDTOURS_USERSTATE_WRONGCONTEXT'), true);
51+
$this->app->close();
52+
}
53+
54+
if ($tourId <= 0) {
55+
echo new JsonResponse(['success' => false, 'tourId' => $tourId], Text::_('COM_GUIDEDTOURS_USERSTATE_BADTOURID'), true);
56+
$this->app->close();
57+
}
58+
59+
$actionState = '';
60+
61+
switch ($context) {
62+
case 'tour.complete':
63+
$actionState = 'completed';
64+
break;
65+
case 'tour.cancel':
66+
$actionState = 'delayed';
67+
break;
68+
case 'tour.skip':
69+
$actionState = 'skipped';
70+
break;
71+
}
5872

59-
PluginHelper::importPlugin('guidedtours');
60-
61-
// event onBeforeTourSaveUserState before save user tour state
62-
$beforeEvent = AbstractEvent::create(
63-
'onBeforeTourSaveUserState',
64-
[
65-
'subject' => new \stdClass(),
66-
'tourId' => $tourId,
67-
'actionState' => $actionState,
68-
'stepNumber' => $stepNumber,
69-
]
70-
);
71-
72-
$this->app->getDispatcher()->dispatch('onBeforeTourSaveUserState', $beforeEvent);
73-
74-
// Save the tour state only when the tour auto-starts.
75-
$tourModel = $this->getModel('Tour', 'Administrator');
76-
if ($tourModel->isAutostart($tourId)) {
77-
$result = $tourModel->saveTourUserState($tourId, $actionState);
78-
if ($result) {
79-
$message = Text::sprintf('COM_GUIDEDTOURS_USERSTATE_STATESAVED', $user->id, $tourId);
80-
} else {
81-
$message = Text::sprintf('COM_GUIDEDTOURS_USERSTATE_STATENOTSAVED', $user->id, $tourId);
82-
}
73+
PluginHelper::importPlugin('guidedtours');
74+
75+
// event onBeforeTourSaveUserState before save user tour state
76+
$beforeEvent = AbstractEvent::create(
77+
'onBeforeTourSaveUserState',
78+
[
79+
'subject' => new \stdClass(),
80+
'tourId' => $tourId,
81+
'actionState' => $actionState,
82+
'stepNumber' => $stepNumber,
83+
]
84+
);
85+
86+
$this->app->getDispatcher()->dispatch('onBeforeTourSaveUserState', $beforeEvent);
87+
88+
// Save the tour state only when the tour auto-starts.
89+
$tourModel = $this->getModel('Tour', 'Administrator');
90+
if ($tourModel->isAutostart($tourId)) {
91+
$result = $tourModel->saveTourUserState($tourId, $actionState);
92+
if ($result) {
93+
$message = Text::sprintf('COM_GUIDEDTOURS_USERSTATE_STATESAVED', $user->id, $tourId);
8394
} else {
84-
$result = false;
8595
$message = Text::sprintf('COM_GUIDEDTOURS_USERSTATE_STATENOTSAVED', $user->id, $tourId);
8696
}
87-
88-
// event onAfterTourSaveUserState after save user tour state (may override message)
89-
$afterEvent = AbstractEvent::create(
90-
'onAfterTourSaveUserState',
91-
[
92-
'subject' => new \stdClass(),
93-
'tourId' => $tourId,
94-
'actionState' => $actionState,
95-
'stepNumber' => $stepNumber,
96-
'result' => $result,
97-
'message' => &$message,
98-
]
99-
);
100-
101-
$this->app->getDispatcher()->dispatch('onAfterTourSaveUserState', $afterEvent);
102-
103-
// Construct the response data
104-
$data = [
105-
'tourId' => $tourId,
106-
'stepId' => $stepNumber,
107-
'context' => $context,
108-
'state' => $actionState,
109-
];
110-
echo new JsonResponse($data, $message);
111-
$this->app->close();
11297
} else {
113-
// Construct the response data
114-
$data = [
115-
'success' => false,
116-
'tourId' => $tourId,
117-
];
118-
119-
$message = Text::_('COM_GUIDEDTOURS_USERSTATE_CONNECTEDONLY');
120-
echo new JsonResponse($data, $message, true);
121-
$this->app->close();
98+
$result = false;
99+
$message = Text::sprintf('COM_GUIDEDTOURS_USERSTATE_STATENOTSAVED', $user->id, $tourId);
122100
}
101+
102+
// event onAfterTourSaveUserState after save user tour state (may override message)
103+
$afterEvent = AbstractEvent::create(
104+
'onAfterTourSaveUserState',
105+
[
106+
'subject' => new \stdClass(),
107+
'tourId' => $tourId,
108+
'actionState' => $actionState,
109+
'stepNumber' => $stepNumber,
110+
'result' => $result,
111+
'message' => &$message,
112+
]
113+
);
114+
115+
$this->app->getDispatcher()->dispatch('onAfterTourSaveUserState', $afterEvent);
116+
117+
// Construct the response data
118+
$data = [
119+
'tourId' => $tourId,
120+
'stepId' => $stepNumber,
121+
'context' => $context,
122+
'state' => $actionState,
123+
];
124+
echo new JsonResponse($data, $message);
125+
$this->app->close();
123126
}
124127
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
/**
4+
* @package Joomla.Administrator
5+
* @subpackage com_guidedtours
6+
*
7+
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
8+
* @license GNU General Public License version 2 or later; see LICENSE.txt
9+
*/
10+
11+
namespace Joomla\Component\Guidedtours\Administrator\Dispatcher;
12+
13+
use Joomla\CMS\Access\Exception\NotAllowed;
14+
use Joomla\CMS\Dispatcher\ComponentDispatcher;
15+
16+
// phpcs:disable PSR1.Files.SideEffects
17+
\defined('_JEXEC') or die;
18+
// phpcs:enable PSR1.Files.SideEffects
19+
20+
/**
21+
* ComponentDispatcher class for com_guidedtours
22+
*
23+
* @since 5.2.0
24+
*/
25+
class Dispatcher extends ComponentDispatcher
26+
{
27+
/**
28+
* Method to check component access permission
29+
*
30+
* @return void
31+
*
32+
* @throws \Exception|NotAllowed
33+
*/
34+
protected function checkAccess()
35+
{
36+
$command = $this->input->getCmd('task', 'display');
37+
if ($this->app->isClient('administrator') && $command == 'ajax.fetchUserState') {
38+
return;
39+
}
40+
41+
parent::checkAccess();
42+
}
43+
}

administrator/components/com_installer/src/Model/UpdatesitesModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
namespace Joomla\Component\Installer\Administrator\Model;
1212

1313
use Joomla\CMS\Factory;
14-
use Joomla\CMS\Filesystem\Folder;
1514
use Joomla\CMS\Installer\Installer;
1615
use Joomla\CMS\Language\Text;
1716
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
@@ -22,6 +21,7 @@
2221
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper;
2322
use Joomla\Database\ParameterType;
2423
use Joomla\Database\QueryInterface;
24+
use Joomla\Filesystem\Folder;
2525

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

0 commit comments

Comments
 (0)