diff --git a/administrator/components/com_actionlogs/src/Plugin/ActionLogPlugin.php b/administrator/components/com_actionlogs/src/Plugin/ActionLogPlugin.php index 87ad75ea15785..fcf8b95033e0d 100644 --- a/administrator/components/com_actionlogs/src/Plugin/ActionLogPlugin.php +++ b/administrator/components/com_actionlogs/src/Plugin/ActionLogPlugin.php @@ -64,7 +64,7 @@ abstract class ActionLogPlugin extends CMSPlugin */ protected function addLog($messages, $messageLanguageKey, $context, $userId = null) { - $user = Factory::getUser(); + $user = $this->app->getIdentity(); foreach ($messages as $index => $message) { if (!\array_key_exists('userid', $message)) { diff --git a/administrator/components/com_admin/src/View/Sysinfo/JsonView.php b/administrator/components/com_admin/src/View/Sysinfo/JsonView.php index 4ea9d7d79ef07..eb99fbaa10749 100644 --- a/administrator/components/com_admin/src/View/Sysinfo/JsonView.php +++ b/administrator/components/com_admin/src/View/Sysinfo/JsonView.php @@ -15,6 +15,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\AbstractView; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Component\Admin\Administrator\Model\SysinfoModel; // phpcs:disable PSR1.Files.SideEffects @@ -26,8 +28,10 @@ * * @since 3.5 */ -class JsonView extends AbstractView +class JsonView extends AbstractView implements CurrentUserInterface { + use CurrentUserTrait; + /** * Execute and display a template script. * @@ -42,7 +46,7 @@ class JsonView extends AbstractView public function display($tpl = null): void { // Access check. - if (!Factory::getUser()->authorise('core.admin')) { + if (!$this->getCurrentUser()->authorise('core.admin')) { throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); } diff --git a/administrator/components/com_admin/src/View/Sysinfo/TextView.php b/administrator/components/com_admin/src/View/Sysinfo/TextView.php index 603c565aeaebe..f8846100699ef 100644 --- a/administrator/components/com_admin/src/View/Sysinfo/TextView.php +++ b/administrator/components/com_admin/src/View/Sysinfo/TextView.php @@ -15,6 +15,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\AbstractView; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Component\Admin\Administrator\Model\SysinfoModel; // phpcs:disable PSR1.Files.SideEffects @@ -26,8 +28,10 @@ * * @since 3.5 */ -class TextView extends AbstractView +class TextView extends AbstractView implements CurrentUserInterface { + use CurrentUserTrait; + /** * Execute and display a template script. * @@ -42,7 +46,7 @@ class TextView extends AbstractView public function display($tpl = null): void { // Access check. - if (!Factory::getUser()->authorise('core.admin')) { + if (!$this->getCurrentUser()->authorise('core.admin')) { throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); } diff --git a/administrator/components/com_associations/tmpl/associations/default.php b/administrator/components/com_associations/tmpl/associations/default.php index 43ffc9f124e7e..7de2d1e98f222 100644 --- a/administrator/components/com_associations/tmpl/associations/default.php +++ b/administrator/components/com_associations/tmpl/associations/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -25,7 +24,7 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$canManageCheckin = Factory::getUser()->authorise('core.manage', 'com_checkin'); +$canManageCheckin = $this->getCurrentUser()->authorise('core.manage', 'com_checkin'); $iconStates = [ -2 => 'icon-trash', diff --git a/administrator/components/com_associations/tmpl/associations/modal.php b/administrator/components/com_associations/tmpl/associations/modal.php index 35597a263b8b6..a42d1e8ef5679 100644 --- a/administrator/components/com_associations/tmpl/associations/modal.php +++ b/administrator/components/com_associations/tmpl/associations/modal.php @@ -32,7 +32,7 @@ $function = $app->getInput()->getCmd('function', 'jSelectAssociation'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$canManageCheckin = Factory::getUser()->authorise('core.manage', 'com_checkin'); +$canManageCheckin = $this->getCurrentUser()->authorise('core.manage', 'com_checkin'); $iconStates = [ -2 => 'icon-trash', diff --git a/administrator/components/com_banners/tmpl/banners/default.php b/administrator/components/com_banners/tmpl/banners/default.php index bbbf39629fc3b..d5eaca038ecb5 100644 --- a/administrator/components/com_banners/tmpl/banners/default.php +++ b/administrator/components/com_banners/tmpl/banners/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; @@ -25,7 +24,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_banners/tmpl/clients/default.php b/administrator/components/com_banners/tmpl/clients/default.php index 8db12d77ee7f3..27b63c98706de 100644 --- a/administrator/components/com_banners/tmpl/clients/default.php +++ b/administrator/components/com_banners/tmpl/clients/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -32,7 +31,7 @@ '5' => 'DAILY', ]; -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_categories/tmpl/categories/default.php b/administrator/components/com_categories/tmpl/categories/default.php index a78db17f79fb5..93f613564c7ed 100644 --- a/administrator/components/com_categories/tmpl/categories/default.php +++ b/administrator/components/com_categories/tmpl/categories/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; @@ -24,7 +23,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $extension = $this->escape($this->state->get('filter.extension')); $listOrder = $this->escape($this->state->get('list.ordering')); diff --git a/administrator/components/com_contact/src/Table/ContactTable.php b/administrator/components/com_contact/src/Table/ContactTable.php index 78bb773421246..78108d81605f3 100644 --- a/administrator/components/com_contact/src/Table/ContactTable.php +++ b/administrator/components/com_contact/src/Table/ContactTable.php @@ -18,6 +18,8 @@ use Joomla\CMS\Table\Table; use Joomla\CMS\Tag\TaggableTableInterface; use Joomla\CMS\Tag\TaggableTableTrait; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\CMS\Versioning\VersionableTableInterface; use Joomla\Database\DatabaseDriver; use Joomla\String\StringHelper; @@ -31,9 +33,10 @@ * * @since 1.0 */ -class ContactTable extends Table implements VersionableTableInterface, TaggableTableInterface +class ContactTable extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface { use TaggableTableTrait; + use CurrentUserTrait; /** * Indicates that columns fully support the NULL value in the database @@ -79,7 +82,7 @@ public function __construct(DatabaseDriver $db) public function store($updateNulls = true) { $date = Factory::getDate()->toSql(); - $userId = Factory::getUser()->id; + $userId = $this->getCurrentUser()->id; // Set created date if not set. if (!(int) $this->created) { diff --git a/administrator/components/com_contact/tmpl/contacts/default.php b/administrator/components/com_contact/tmpl/contacts/default.php index 849ddc6e34551..00c6b8866d496 100644 --- a/administrator/components/com_contact/tmpl/contacts/default.php +++ b/administrator/components/com_contact/tmpl/contacts/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Multilanguage; @@ -24,7 +23,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_content/tmpl/articles/default.php b/administrator/components/com_content/tmpl/articles/default.php index ced3aba5a0635..76f36312b70e8 100644 --- a/administrator/components/com_content/tmpl/articles/default.php +++ b/administrator/components/com_content/tmpl/articles/default.php @@ -31,7 +31,7 @@ ->useScript('multiselect'); $app = Factory::getApplication(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_content/tmpl/articles/default_batch_body.php b/administrator/components/com_content/tmpl/articles/default_batch_body.php index 0f838accf462c..afa5759419c76 100644 --- a/administrator/components/com_content/tmpl/articles/default_batch_body.php +++ b/administrator/components/com_content/tmpl/articles/default_batch_body.php @@ -11,7 +11,6 @@ defined('_JEXEC') or die; use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Layout\LayoutHelper; @@ -19,7 +18,7 @@ $published = (int) $this->state->get('filter.published'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); ?>
diff --git a/administrator/components/com_content/tmpl/featured/default.php b/administrator/components/com_content/tmpl/featured/default.php index 4f6ce814814d8..17f035b59894b 100644 --- a/administrator/components/com_content/tmpl/featured/default.php +++ b/administrator/components/com_content/tmpl/featured/default.php @@ -31,7 +31,7 @@ ->useScript('multiselect'); $app = Factory::getApplication(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_cpanel/tmpl/cpanel/default.php b/administrator/components/com_cpanel/tmpl/cpanel/default.php index d3601723f5c18..3eaca29a4efcf 100644 --- a/administrator/components/com_cpanel/tmpl/cpanel/default.php +++ b/administrator/components/com_cpanel/tmpl/cpanel/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Helper\ModuleHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; @@ -30,7 +29,7 @@ $wa->useScript('com_cpanel.admin-cpanel') ->useScript('com_cpanel.admin-addmodule'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); // Set up the bootstrap modal that will be used for all module editors echo HTMLHelper::_( diff --git a/administrator/components/com_fields/src/Table/FieldTable.php b/administrator/components/com_fields/src/Table/FieldTable.php index eb409dc4b45d0..49b9928f55fa0 100644 --- a/administrator/components/com_fields/src/Table/FieldTable.php +++ b/administrator/components/com_fields/src/Table/FieldTable.php @@ -15,6 +15,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Database\DatabaseDriver; use Joomla\Registry\Registry; use Joomla\String\StringHelper; @@ -28,8 +30,10 @@ * * @since 3.7.0 */ -class FieldTable extends Table +class FieldTable extends Table implements CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -165,7 +169,7 @@ public function check() } $date = Factory::getDate()->toSql(); - $user = Factory::getUser(); + $user = $this->getCurrentUser(); // Set created date if not set. if (!(int) $this->created_time) { diff --git a/administrator/components/com_fields/src/Table/GroupTable.php b/administrator/components/com_fields/src/Table/GroupTable.php index 8658dd80621c4..7cc4eed99af42 100644 --- a/administrator/components/com_fields/src/Table/GroupTable.php +++ b/administrator/components/com_fields/src/Table/GroupTable.php @@ -14,6 +14,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Database\DatabaseDriver; use Joomla\Registry\Registry; @@ -26,8 +28,10 @@ * * @since 3.7.0 */ -class GroupTable extends Table +class GroupTable extends Table implements CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -101,7 +105,7 @@ public function check() } $date = Factory::getDate()->toSql(); - $user = Factory::getUser(); + $user = $this->getCurrentUser(); // Set created date if not set. if (!(int) $this->created) { diff --git a/administrator/components/com_fields/tmpl/fields/default.php b/administrator/components/com_fields/tmpl/fields/default.php index e0f5c4c72062c..a467b53540d26 100644 --- a/administrator/components/com_fields/tmpl/fields/default.php +++ b/administrator/components/com_fields/tmpl/fields/default.php @@ -26,7 +26,7 @@ ->useScript('multiselect'); $app = Factory::getApplication(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $context = $this->escape($this->state->get('filter.context')); $component = $this->state->get('filter.component'); diff --git a/administrator/components/com_fields/tmpl/groups/default.php b/administrator/components/com_fields/tmpl/groups/default.php index 1bde8e30eb335..cb91f895f082c 100644 --- a/administrator/components/com_fields/tmpl/groups/default.php +++ b/administrator/components/com_fields/tmpl/groups/default.php @@ -25,7 +25,7 @@ ->useScript('multiselect'); $app = Factory::getApplication(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $component = ''; diff --git a/administrator/components/com_finder/src/Table/FilterTable.php b/administrator/components/com_finder/src/Table/FilterTable.php index decbd8b51da33..e34af1033ea20 100644 --- a/administrator/components/com_finder/src/Table/FilterTable.php +++ b/administrator/components/com_finder/src/Table/FilterTable.php @@ -14,6 +14,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Database\DatabaseDriver; use Joomla\Registry\Registry; @@ -26,8 +28,10 @@ * * @since 2.5 */ -class FilterTable extends Table +class FilterTable extends Table implements CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -120,7 +124,7 @@ public function check() public function store($updateNulls = true) { $date = Factory::getDate()->toSql(); - $userId = Factory::getUser()->id; + $userId = $this->getCurrentUser()->id; // Set created date if not set. if (!(int) $this->created) { diff --git a/administrator/components/com_finder/tmpl/filters/default.php b/administrator/components/com_finder/tmpl/filters/default.php index 2710272a74fd0..33f3330b02f3a 100644 --- a/administrator/components/com_finder/tmpl/filters/default.php +++ b/administrator/components/com_finder/tmpl/filters/default.php @@ -10,13 +10,12 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_finder/tmpl/index/default.php b/administrator/components/com_finder/tmpl/index/default.php index c51294871e46c..39ffcc8fb7bcb 100644 --- a/administrator/components/com_finder/tmpl/index/default.php +++ b/administrator/components/com_finder/tmpl/index/default.php @@ -101,7 +101,7 @@ - authorise('core.manage', 'com_finder'); ?> + getCurrentUser()->authorise('core.manage', 'com_finder'); ?> items as $i => $item) : ?> diff --git a/administrator/components/com_guidedtours/src/Table/StepTable.php b/administrator/components/com_guidedtours/src/Table/StepTable.php index e5290aa9171df..df31d503587fe 100644 --- a/administrator/components/com_guidedtours/src/Table/StepTable.php +++ b/administrator/components/com_guidedtours/src/Table/StepTable.php @@ -12,6 +12,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Database\DatabaseDriver; // phpcs:disable PSR1.Files.SideEffects @@ -23,8 +25,10 @@ * * @since 4.3.0 */ -class StepTable extends Table +class StepTable extends Table implements CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -57,7 +61,7 @@ public function __construct(DatabaseDriver $db) public function store($updateNulls = true) { $date = Factory::getDate()->toSql(); - $userId = Factory::getUser()->id; + $userId = $this->getCurrentUser()->id; // Set created date if not set. if (!(int) $this->created) { diff --git a/administrator/components/com_guidedtours/src/Table/TourTable.php b/administrator/components/com_guidedtours/src/Table/TourTable.php index 53869e1910fad..bd64c056140b3 100644 --- a/administrator/components/com_guidedtours/src/Table/TourTable.php +++ b/administrator/components/com_guidedtours/src/Table/TourTable.php @@ -12,6 +12,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Database\DatabaseDriver; // phpcs:disable PSR1.Files.SideEffects @@ -23,8 +25,10 @@ * * @since 4.3.0 */ -class TourTable extends Table +class TourTable extends Table implements CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -65,7 +69,7 @@ public function __construct(DatabaseDriver $db) public function store($updateNulls = true) { $date = Factory::getDate()->toSql(); - $userId = Factory::getUser()->id; + $userId = $this->getCurrentUser()->id; // Set created date if not set. if (!(int) $this->created) { diff --git a/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php b/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php index 4efa56bbe9e1c..329d555b7e01c 100644 --- a/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php +++ b/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php @@ -361,7 +361,7 @@ class="extension-check upcomp hidden" - authorise('core.admin')) : ?> + getCurrentUser()->authorise('core.admin')) : ?>
diff --git a/administrator/components/com_languages/tmpl/installed/default.php b/administrator/components/com_languages/tmpl/installed/default.php index fb4156b39a3fc..ec095ad9251b7 100644 --- a/administrator/components/com_languages/tmpl/installed/default.php +++ b/administrator/components/com_languages/tmpl/installed/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -22,7 +21,7 @@ $wa = $this->document->getWebAssetManager(); $wa->useScript('table.columns'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> diff --git a/administrator/components/com_languages/tmpl/languages/default.php b/administrator/components/com_languages/tmpl/languages/default.php index 81cb88949b1fb..de0c97154ad95 100644 --- a/administrator/components/com_languages/tmpl/languages/default.php +++ b/administrator/components/com_languages/tmpl/languages/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -22,7 +21,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; diff --git a/administrator/components/com_languages/tmpl/overrides/default.php b/administrator/components/com_languages/tmpl/overrides/default.php index 852cc494ee4b8..01b56bcb82919 100644 --- a/administrator/components/com_languages/tmpl/overrides/default.php +++ b/administrator/components/com_languages/tmpl/overrides/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; @@ -71,7 +70,7 @@ - authorise('core.edit', 'com_languages'); ?> + getCurrentUser()->authorise('core.edit', 'com_languages'); ?> items as $key => $text) : ?> diff --git a/administrator/components/com_menus/tmpl/items/default.php b/administrator/components/com_menus/tmpl/items/default.php index 3e32247ee7f33..8abe15efd93e5 100644 --- a/administrator/components/com_menus/tmpl/items/default.php +++ b/administrator/components/com_menus/tmpl/items/default.php @@ -24,7 +24,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $app = Factory::getApplication(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); diff --git a/administrator/components/com_menus/tmpl/menus/default.php b/administrator/components/com_menus/tmpl/menus/default.php index 053b30313199c..33cbb9c29c77f 100644 --- a/administrator/components/com_menus/tmpl/menus/default.php +++ b/administrator/components/com_menus/tmpl/menus/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -25,7 +24,7 @@ $uri = Uri::getInstance(); $return = base64_encode($uri); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $modMenuId = (int) $this->get('ModMenuId'); diff --git a/administrator/components/com_messages/tmpl/messages/default.php b/administrator/components/com_messages/tmpl/messages/default.php index 27f4196dca822..d0f7cf2b9a3d9 100644 --- a/administrator/components/com_messages/tmpl/messages/default.php +++ b/administrator/components/com_messages/tmpl/messages/default.php @@ -20,7 +20,7 @@ $wa = $this->document->getWebAssetManager(); $wa->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> diff --git a/administrator/components/com_modules/tmpl/modules/default.php b/administrator/components/com_modules/tmpl/modules/default.php index 003cf8b9be202..aefc841d067a9 100644 --- a/administrator/components/com_modules/tmpl/modules/default.php +++ b/administrator/components/com_modules/tmpl/modules/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Helper\ModuleHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Multilanguage; @@ -25,7 +24,7 @@ ->useScript('multiselect'); $clientId = (int) $this->state->get('client_id', 0); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = ($listOrder == 'a.ordering'); diff --git a/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php b/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php index d4f317a638124..71eb681cc3560 100644 --- a/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php +++ b/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php @@ -17,6 +17,8 @@ use Joomla\CMS\Table\Table; use Joomla\CMS\Tag\TaggableTableInterface; use Joomla\CMS\Tag\TaggableTableTrait; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\CMS\Versioning\VersionableTableInterface; use Joomla\Database\DatabaseDriver; use Joomla\String\StringHelper; @@ -30,9 +32,10 @@ * * @since 1.6 */ -class NewsfeedTable extends Table implements VersionableTableInterface, TaggableTableInterface +class NewsfeedTable extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface { use TaggableTableTrait; + use CurrentUserTrait; /** * Indicates that columns fully support the NULL value in the database @@ -134,7 +137,7 @@ public function check() public function store($updateNulls = true) { $date = Factory::getDate(); - $user = Factory::getUser(); + $user = $this->getCurrentUser(); // Set created date if not set. if (!(int) $this->created) { diff --git a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php index 0e3b4719ec077..46b12cdd58e5b 100644 --- a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php +++ b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Multilanguage; @@ -24,7 +23,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; diff --git a/administrator/components/com_plugins/tmpl/plugins/default.php b/administrator/components/com_plugins/tmpl/plugins/default.php index 68da30c794581..50fd118d086c3 100644 --- a/administrator/components/com_plugins/tmpl/plugins/default.php +++ b/administrator/components/com_plugins/tmpl/plugins/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -22,7 +21,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'ordering'; diff --git a/administrator/components/com_privacy/tmpl/consents/default.php b/administrator/components/com_privacy/tmpl/consents/default.php index a4eef20c985ad..6a6c6f0adec21 100644 --- a/administrator/components/com_privacy/tmpl/consents/default.php +++ b/administrator/components/com_privacy/tmpl/consents/default.php @@ -24,7 +24,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $now = Factory::getDate(); diff --git a/administrator/components/com_privacy/tmpl/requests/default.php b/administrator/components/com_privacy/tmpl/requests/default.php index 382887ec3b79a..5c0252b2f3531 100644 --- a/administrator/components/com_privacy/tmpl/requests/default.php +++ b/administrator/components/com_privacy/tmpl/requests/default.php @@ -25,7 +25,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $now = Factory::getDate(); diff --git a/administrator/components/com_redirect/tmpl/links/default.php b/administrator/components/com_redirect/tmpl/links/default.php index 72b6310459ebb..46f326d2951fb 100644 --- a/administrator/components/com_redirect/tmpl/links/default.php +++ b/administrator/components/com_redirect/tmpl/links/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -22,7 +21,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> diff --git a/administrator/components/com_tags/src/Table/TagTable.php b/administrator/components/com_tags/src/Table/TagTable.php index ff77478d9b3c9..790d8d193c8d4 100644 --- a/administrator/components/com_tags/src/Table/TagTable.php +++ b/administrator/components/com_tags/src/Table/TagTable.php @@ -15,6 +15,8 @@ use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Nested; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\CMS\Versioning\VersionableTableInterface; use Joomla\Database\DatabaseDriver; use Joomla\String\StringHelper; @@ -28,8 +30,10 @@ * * @since 3.1 */ -class TagTable extends Nested implements VersionableTableInterface +class TagTable extends Nested implements VersionableTableInterface, CurrentUserInterface { + use CurrentUserTrait; + /** * An array of key names to be json encoded in the bind function * @@ -162,7 +166,7 @@ public function check() public function store($updateNulls = true) { $date = Factory::getDate(); - $user = Factory::getUser(); + $user = $this->getCurrentUser(); if ($this->id) { // Existing item diff --git a/administrator/components/com_tags/tmpl/tags/default.php b/administrator/components/com_tags/tmpl/tags/default.php index 2ce56a90d100f..acb1905feacd5 100644 --- a/administrator/components/com_tags/tmpl/tags/default.php +++ b/administrator/components/com_tags/tmpl/tags/default.php @@ -25,7 +25,7 @@ ->useScript('multiselect'); $app = Factory::getApplication(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_templates/tmpl/style/edit.php b/administrator/components/com_templates/tmpl/style/edit.php index f40dcbea9675d..b555515a6e5e4 100644 --- a/administrator/components/com_templates/tmpl/style/edit.php +++ b/administrator/components/com_templates/tmpl/style/edit.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -23,7 +22,7 @@ $this->useCoreUI = true; -$user = Factory::getUser(); +$user = $this->getCurrentUser(); ?>
diff --git a/administrator/components/com_templates/tmpl/style/edit_assignment.php b/administrator/components/com_templates/tmpl/style/edit_assignment.php index e910bc9539949..86742ae4c2678 100644 --- a/administrator/components/com_templates/tmpl/style/edit_assignment.php +++ b/administrator/components/com_templates/tmpl/style/edit_assignment.php @@ -10,14 +10,13 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\Component\Menus\Administrator\Helper\MenusHelper; // Initialise related data. $menuTypes = MenusHelper::getMenuLinks(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); diff --git a/administrator/components/com_templates/tmpl/styles/default.php b/administrator/components/com_templates/tmpl/styles/default.php index 8c2809c4eb626..46746169108c9 100644 --- a/administrator/components/com_templates/tmpl/styles/default.php +++ b/administrator/components/com_templates/tmpl/styles/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -22,7 +21,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $clientId = (int) $this->state->get('client_id', 0); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_templates/tmpl/template/default.php b/administrator/components/com_templates/tmpl/template/default.php index 87a7b11821f75..da2525b1673c3 100644 --- a/administrator/components/com_templates/tmpl/template/default.php +++ b/administrator/components/com_templates/tmpl/template/default.php @@ -34,7 +34,7 @@ ->useStyle('com_templates.admin-templates'); // No access if not global SuperUser -if (!Factory::getUser()->authorise('core.admin')) { +if (!$this->getCurrentUser()->authorise('core.admin')) { Factory::getApplication()->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'danger'); } diff --git a/administrator/components/com_templates/tmpl/templates/default.php b/administrator/components/com_templates/tmpl/templates/default.php index 9a012bb58b956..039d97c434dd5 100644 --- a/administrator/components/com_templates/tmpl/templates/default.php +++ b/administrator/components/com_templates/tmpl/templates/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -21,7 +20,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> diff --git a/administrator/components/com_users/src/Table/NoteTable.php b/administrator/components/com_users/src/Table/NoteTable.php index 228cfdc62a2bb..1d970ea828c42 100644 --- a/administrator/components/com_users/src/Table/NoteTable.php +++ b/administrator/components/com_users/src/Table/NoteTable.php @@ -12,6 +12,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\CMS\Versioning\VersionableTableInterface; use Joomla\Database\DatabaseDriver; @@ -24,8 +26,10 @@ * * @since 2.5 */ -class NoteTable extends Table implements VersionableTableInterface +class NoteTable extends Table implements VersionableTableInterface, CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -61,7 +65,7 @@ public function __construct(DatabaseDriver $db) public function store($updateNulls = true) { $date = Factory::getDate()->toSql(); - $userId = Factory::getUser()->get('id'); + $userId = $this->getCurrentUser()->get('id'); if (!((int) $this->review_time)) { $this->review_time = null; diff --git a/administrator/components/com_users/tmpl/groups/default.php b/administrator/components/com_users/tmpl/groups/default.php index 4378f295ea0f0..f6509ff90a80a 100644 --- a/administrator/components/com_users/tmpl/groups/default.php +++ b/administrator/components/com_users/tmpl/groups/default.php @@ -11,13 +11,12 @@ defined('_JEXEC') or die; use Joomla\CMS\Access\Access; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_users/tmpl/levels/default.php b/administrator/components/com_users/tmpl/levels/default.php index 61f830eb07432..79489280a4cb2 100644 --- a/administrator/components/com_users/tmpl/levels/default.php +++ b/administrator/components/com_users/tmpl/levels/default.php @@ -11,7 +11,6 @@ defined('_JEXEC') or die; use Joomla\CMS\Access\Access; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -24,7 +23,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; @@ -85,7 +84,7 @@ $groups = json_decode($item->rules); // If this group is super admin and this user is not super admin, $canEdit is false - if (!Factory::getUser()->authorise('core.admin') && $groups && Access::checkGroup($groups[0], 'core.admin')) { + if (!$this->getCurrentUser()->authorise('core.admin') && $groups && Access::checkGroup($groups[0], 'core.admin')) { $canEdit = false; $canChange = false; } diff --git a/administrator/components/com_users/tmpl/notes/default.php b/administrator/components/com_users/tmpl/notes/default.php index 8561727b3e8a6..198ffc06a3deb 100644 --- a/administrator/components/com_users/tmpl/notes/default.php +++ b/administrator/components/com_users/tmpl/notes/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -21,7 +20,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_users/tmpl/users/default.php b/administrator/components/com_users/tmpl/users/default.php index d2665a8fb8b08..46e6d8f734b93 100644 --- a/administrator/components/com_users/tmpl/users/default.php +++ b/administrator/components/com_users/tmpl/users/default.php @@ -11,7 +11,6 @@ defined('_JEXEC') or die; use Joomla\CMS\Access\Access; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -29,7 +28,7 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$loggeduser = Factory::getUser(); +$loggeduser = $this->getCurrentUser(); $mfa = PluginHelper::isEnabled('multifactorauth'); ?> diff --git a/administrator/components/com_workflow/src/Table/WorkflowTable.php b/administrator/components/com_workflow/src/Table/WorkflowTable.php index 06650b5b34070..c5ff156344ffb 100644 --- a/administrator/components/com_workflow/src/Table/WorkflowTable.php +++ b/administrator/components/com_workflow/src/Table/WorkflowTable.php @@ -14,6 +14,8 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; use Joomla\Database\DatabaseDriver; use Joomla\Database\ParameterType; @@ -26,8 +28,10 @@ * * @since 4.0.0 */ -class WorkflowTable extends Table +class WorkflowTable extends Table implements CurrentUserInterface { + use CurrentUserTrait; + /** * Indicates that columns fully support the NULL value in the database * @@ -173,7 +177,7 @@ public function check() public function store($updateNulls = true) { $date = Factory::getDate(); - $user = Factory::getUser(); + $user = $this->getCurrentUser(); $table = new WorkflowTable($this->getDbo()); diff --git a/administrator/components/com_workflow/tmpl/stages/default.php b/administrator/components/com_workflow/tmpl/stages/default.php index 908f14a9c78ef..0ad92d3dc0b8b 100644 --- a/administrator/components/com_workflow/tmpl/stages/default.php +++ b/administrator/components/com_workflow/tmpl/stages/default.php @@ -11,7 +11,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -23,7 +22,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->id; $listOrder = $this->escape($this->state->get('list.ordering')); diff --git a/administrator/components/com_workflow/tmpl/transitions/default.php b/administrator/components/com_workflow/tmpl/transitions/default.php index fd52a40be383f..1c56ee69f83ca 100644 --- a/administrator/components/com_workflow/tmpl/transitions/default.php +++ b/administrator/components/com_workflow/tmpl/transitions/default.php @@ -11,7 +11,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -23,7 +22,7 @@ $wa->useScript('table.columns') ->useScript('multiselect'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); diff --git a/administrator/components/com_workflow/tmpl/workflows/default.php b/administrator/components/com_workflow/tmpl/workflows/default.php index 865f831e2dc17..184f972ea3c5b 100644 --- a/administrator/components/com_workflow/tmpl/workflows/default.php +++ b/administrator/components/com_workflow/tmpl/workflows/default.php @@ -11,7 +11,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; @@ -42,7 +41,7 @@ $extension = $this->escape($this->state->get('filter.extension')); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $userId = $user->id; ?> diff --git a/components/com_config/tmpl/modules/default.php b/components/com_config/tmpl/modules/default.php index 7a46f66473d10..d4473f59c51b0 100644 --- a/components/com_config/tmpl/modules/default.php +++ b/components/com_config/tmpl/modules/default.php @@ -85,7 +85,7 @@
- authorise('core.edit.state', 'com_modules.module.' . $this->item['id'])) : ?> + getCurrentUser()->authorise('core.edit.state', 'com_modules.module.' . $this->item['id'])) : ?>
form->getLabel('published'); ?> diff --git a/components/com_config/tmpl/templates/default.php b/components/com_config/tmpl/templates/default.php index c3531496379c3..921625d252e6e 100644 --- a/components/com_config/tmpl/templates/default.php +++ b/components/com_config/tmpl/templates/default.php @@ -10,12 +10,11 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; -$user = Factory::getUser(); +$user = $this->getCurrentUser(); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); diff --git a/components/com_contact/tmpl/category/default_items.php b/components/com_contact/tmpl/category/default_items.php index f41aec476443d..c2ac4a1706c2f 100644 --- a/components/com_contact/tmpl/category/default_items.php +++ b/components/com_contact/tmpl/category/default_items.php @@ -26,7 +26,7 @@ $canDo = ContactHelper::getActions('com_contact', 'category', $this->category->id); $canEdit = $canDo->get('core.edit'); -$userId = Factory::getUser()->id; +$userId = $this->getCurrentUser()->id; $showEditColumn = false; if ($canEdit) { diff --git a/components/com_contact/tmpl/contact/default.php b/components/com_contact/tmpl/contact/default.php index d319e92d9109a..bcd6175f67a88 100644 --- a/components/com_contact/tmpl/contact/default.php +++ b/components/com_contact/tmpl/contact/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; @@ -22,7 +21,7 @@ $tparams = $this->item->params; $canDo = ContentHelper::getActions('com_contact', 'category', $this->item->catid); -$canEdit = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by === Factory::getUser()->id); +$canEdit = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by === $this->getCurrentUser()->id); $htag = $tparams->get('show_page_heading') ? 'h2' : 'h1'; ?> diff --git a/components/com_content/tmpl/article/default.php b/components/com_content/tmpl/article/default.php index 7122b1e5750e7..5f40632cdd89b 100644 --- a/components/com_content/tmpl/article/default.php +++ b/components/com_content/tmpl/article/default.php @@ -24,7 +24,7 @@ // Create shortcuts to some parameters. $params = $this->item->params; $canEdit = $params->get('access-edit'); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $info = $params->get('info_block_position', 0); $htag = $this->params->get('show_page_heading') ? 'h2' : 'h1'; diff --git a/components/com_content/tmpl/category/blog_children.php b/components/com_content/tmpl/category/blog_children.php index 6757330021bb8..17332726d4b57 100644 --- a/components/com_content/tmpl/category/blog_children.php +++ b/components/com_content/tmpl/category/blog_children.php @@ -17,7 +17,7 @@ use Joomla\Component\Content\Site\Helper\RouteHelper; $lang = Factory::getLanguage(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $groups = $user->getAuthorisedViewLevels(); if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) : ?> diff --git a/components/com_content/tmpl/category/default_children.php b/components/com_content/tmpl/category/default_children.php index 21d741a432e5d..c0cd77d279339 100644 --- a/components/com_content/tmpl/category/default_children.php +++ b/components/com_content/tmpl/category/default_children.php @@ -17,7 +17,7 @@ use Joomla\Component\Content\Site\Helper\RouteHelper; $lang = Factory::getLanguage(); -$user = Factory::getUser(); +$user = $this->getCurrentUser(); $groups = $user->getAuthorisedViewLevels(); ?> diff --git a/components/com_tags/tmpl/tag/default_items.php b/components/com_tags/tmpl/tag/default_items.php index 62e5185845fa2..0e109cdddb75a 100644 --- a/components/com_tags/tmpl/tag/default_items.php +++ b/components/com_tags/tmpl/tag/default_items.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; @@ -22,7 +21,7 @@ $wa->useScript('com_tags.tag-default'); // Get the user object. -$user = Factory::getUser(); +$user = $this->getCurrentUser(); // Check if user is allowed to add/edit based on tags permissions. // Do we really have to make it so people can see unpublished tags??? diff --git a/components/com_tags/tmpl/tags/default_items.php b/components/com_tags/tmpl/tags/default_items.php index 4d115e68e2af4..627a19903016a 100644 --- a/components/com_tags/tmpl/tags/default_items.php +++ b/components/com_tags/tmpl/tags/default_items.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; @@ -22,7 +21,7 @@ $wa->useScript('com_tags.tags-default'); // Get the user object. -$user = Factory::getUser(); +$user = $this->getCurrentUser(); // Check if user is allowed to add/edit based on tags permissions. $canEdit = $user->authorise('core.edit', 'com_tags'); diff --git a/components/com_users/tmpl/profile/default.php b/components/com_users/tmpl/profile/default.php index a534e5b458e82..10c9a08fe1ce2 100644 --- a/components/com_users/tmpl/profile/default.php +++ b/components/com_users/tmpl/profile/default.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; @@ -24,7 +23,7 @@
- id == $this->data->id) : ?> + getCurrentUser()->id == $this->data->id) : ?>