Skip to content

Commit

Permalink
Merge branch '4.2-dev' into j4/plugins/tags
Browse files Browse the repository at this point in the history
  • Loading branch information
roland-d committed Jun 12, 2022
2 parents 00fc446 + b102a26 commit 0d9d1ba
Show file tree
Hide file tree
Showing 433 changed files with 17,538 additions and 3,037 deletions.
9 changes: 3 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ phpunit-pgsql.xml.dist @rdeutz @hackwar
# HttpHeaders Plugin
plugins/system/httpheaders/* @zero-24

# Web Authentication (WebAuthn)
plugins/system/webauthn/* @nikosdion
media/plg_system_webauthn/* @nikosdion
administrator/language/en-GB/plg_system_webauthn.ini @nikosdion
administrator/language/en-GB/plg_system_webauthn.sys.ini @nikosdion

# Workflow
administrator/components/com_workflow/* @bembelimen @hleithner
administrator/language/en-GB/com_workflow.ini @bembelimen @hleithner
Expand Down Expand Up @@ -72,3 +66,6 @@ installation/tmpl/* @chmst

# Translation GitHub Actions
.github/workflows/create-translation-pull-request-v4.yml @hleithner

# Libraries
libraries/src/* @laoneo
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/a11y_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Accessibility issue
about: Did you find an accessibility issue in the Joomla CMS? Please report it here.
labels: a11y

---

### Steps to reproduce the issue
1.


### Expected result



### Actual result



### Device and system info

* What version of Joomla were you using?


* What device were you using? (eg, phone, laptop)


* What web browser were you using? (eg, Chrome, Safari)


* If you were using assistive technology, please let us know the device or software you were using (eg VoiceOver, JAWS, sip-and-puff device, etc)



### Additional comments

If you know which [WCAG](https://www.w3.org/TR/WCAG/) or [ATAG](https://www.w3.org/TR/ATAG20/) criteria this violates, please indicate it here:

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ActionlogModel extends BaseDatabaseModel
public function addLog($messages, $messageLanguageKey, $context, $userId = null)
{
$user = Factory::getUser($userId);
$db = $this->getDbo();
$db = $this->getDatabase();
$date = Factory::getDate();
$params = ComponentHelper::getComponent('com_actionlogs')->getParams();

Expand Down Expand Up @@ -116,7 +116,7 @@ protected function sendNotificationEmails($messages, $username, $context)
{
$app = Factory::getApplication();
$lang = $app->getLanguage();
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true);

$query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function populateState($ordering = 'a.id', $direction = 'desc')
*/
protected function getListQuery()
{
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('a.*')
->select($db->quoteName('u.name'))
Expand Down Expand Up @@ -243,7 +243,7 @@ private function buildDateRange($range)
public function getLogsForItem($extension, $itemId)
{
$itemId = (int) $itemId;
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('a.*')
->select($db->quoteName('u.name'))
Expand Down Expand Up @@ -279,7 +279,7 @@ public function getLogsForItem($extension, $itemId)
*/
public function getLogsData($pks = null)
{
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $this->getLogDataQuery($pks);

$db->setQuery($query);
Expand All @@ -298,7 +298,7 @@ public function getLogsData($pks = null)
*/
public function getLogDataAsIterator($pks = null)
{
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $this->getLogDataQuery($pks);

$db->setQuery($query);
Expand All @@ -317,7 +317,7 @@ public function getLogDataAsIterator($pks = null)
*/
private function getLogDataQuery($pks = null)
{
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('a.*')
->select($db->quoteName('u.name'))
Expand Down Expand Up @@ -345,7 +345,7 @@ private function getLogDataQuery($pks = null)
public function delete(&$pks)
{
$keys = ArrayHelper::toInteger($pks);
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->delete($db->quoteName('#__action_logs'))
->whereIn($db->quoteName('id'), $keys);
Expand Down Expand Up @@ -378,7 +378,7 @@ public function purge()
{
try
{
$this->getDbo()->truncateTable('#__action_logs');
$this->getDatabase()->truncateTable('#__action_logs');
}
catch (Exception $e)
{
Expand Down
30 changes: 28 additions & 2 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -6447,13 +6447,33 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/libraries/vendor/maximebf/debugbar/tests/DebugBar/Tests/TracedStatementTest.php',
'/libraries/vendor/maximebf/debugbar/tests/DebugBar/Tests/full_init.html',
'/libraries/vendor/maximebf/debugbar/tests/bootstrap.php',
// From 4.1 to 4.2.0
// From 4.1 to 4.2.0-beta1
'/libraries/src/Service/Provider/ApiRouter.php',
'/libraries/vendor/nyholm/psr7/doc/final.md',
'/media/com_finder/js/index-es5.js',
'/media/com_finder/js/index-es5.min.js',
'/media/com_finder/js/index-es5.min.js.gz',
'/media/com_finder/js/index.js',
'/media/com_finder/js/index.min.js',
'/media/com_finder/js/index.min.js.gz',
'/media/com_users/js/two-factor-switcher-es5.js',
'/media/com_users/js/two-factor-switcher-es5.min.js',
'/media/com_users/js/two-factor-switcher-es5.min.js.gz',
'/media/com_users/js/two-factor-switcher.js',
'/media/com_users/js/two-factor-switcher.min.js',
'/media/com_users/js/two-factor-switcher.min.js.gz',
'/modules/mod_articles_news/mod_articles_news.php',
'/plugins/actionlog/joomla/joomla.php',
'/plugins/api-authentication/basic/basic.php',
'/plugins/api-authentication/token/token.php',
'/plugins/system/cache/cache.php',
'/plugins/twofactorauth/totp/postinstall/actions.php',
'/plugins/twofactorauth/totp/tmpl/form.php',
'/plugins/twofactorauth/totp/totp.php',
'/plugins/twofactorauth/totp/totp.xml',
'/plugins/twofactorauth/yubikey/tmpl/form.php',
'/plugins/twofactorauth/yubikey/yubikey.php',
'/plugins/twofactorauth/yubikey/yubikey.xml',
);

$folders = array(
Expand Down Expand Up @@ -7807,7 +7827,13 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/libraries/vendor/maximebf/debugbar/demo/bridge',
'/libraries/vendor/maximebf/debugbar/demo',
'/libraries/vendor/maximebf/debugbar/build',
// From 4.1 to 4.2.0
// From 4.1 to 4.2.0-beta1
'/plugins/twofactorauth/yubikey/tmpl',
'/plugins/twofactorauth/yubikey',
'/plugins/twofactorauth/totp/tmpl',
'/plugins/twofactorauth/totp/postinstall',
'/plugins/twofactorauth/totp',
'/plugins/twofactorauth',
'/libraries/vendor/nyholm/psr7/doc',
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
--
-- Create the new table for MFA
--
CREATE TABLE IF NOT EXISTS `#__user_mfa` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL,
`title` varchar(255) NOT NULL DEFAULT '',
`method` varchar(100) NOT NULL,
`default` tinyint NOT NULL DEFAULT 0,
`options` mediumtext NOT NULL,
`created_on` datetime NOT NULL,
`last_used` datetime,
PRIMARY KEY (`id`),
KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci COMMENT='Multi-factor Authentication settings';

--
-- Remove obsolete postinstallation message
--
DELETE FROM `#__postinstall_messages` WHERE `condition_file` = 'site://plugins/twofactorauth/totp/postinstall/actions.php';

--
-- Add new MFA plugins
--
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_multifactorauth_totp', 'plugin', 'totp', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 1, 0),
(0, 'plg_multifactorauth_yubikey', 'plugin', 'yubikey', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 2, 0),
(0, 'plg_multifactorauth_webauthn', 'plugin', 'webauthn', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 3, 0),
(0, 'plg_multifactorauth_email', 'plugin', 'email', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 4, 0),
(0, 'plg_multifactorauth_fixed', 'plugin', 'fixed', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 5, 0);

--
-- Update MFA plugins' publish status
--
UPDATE `#__extensions` AS `a`
INNER JOIN `#__extensions` AS `b` on `a`.`element` = `b`.`element`
SET `a`.enabled = `b`.enabled
WHERE `a`.folder = 'multifactorauth'
AND `b`.folder = 'twofactorauth';

--
-- Remove legacy TFA plugins
--
DELETE FROM `#__extensions`
WHERE `type` = 'plugin' AND `folder` = 'twofactorauth' AND `element` IN ('totp', 'yubikey');

--
-- Add post-installation message
--
INSERT IGNORE INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`)
SELECT `extension_id`, 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_TITLE', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_BODY', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_ACTION', 'com_users', 1, 'action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_condition', '4.2.0', 1 FROM `#__extensions` WHERE `name` = 'files_joomla';

--
-- Create a mail template for plg_multifactorauth_email
--
INSERT IGNORE INTO `#__mail_templates` (`template_id`, `extension`, `language`, `subject`, `body`, `htmlbody`, `attachments`, `params`) VALUES
('plg_multifactorauth_email.mail', 'plg_multifactorauth_email', '', 'PLG_MULTIFACTORAUTH_EMAIL_EMAIL_SUBJECT', 'PLG_MULTIFACTORAUTH_EMAIL_EMAIL_BODY', '', '', '{"tags":["code","sitename","siteurl","username","email","fullname"]}');
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
--
-- Create the new table for MFA
--
CREATE TABLE IF NOT EXISTS "#__user_mfa" (
"id" serial NOT NULL,
"user_id" bigint NOT NULL,
"title" varchar(255) DEFAULT '' NOT NULL,
"method" varchar(100) NOT NULL,
"default" smallint DEFAULT 0 NOT NULL,
"options" text NOT NULL,
"created_on" timestamp without time zone NOT NULL,
"last_used" timestamp without time zone,
PRIMARY KEY ("id")
);

CREATE INDEX "#__user_mfa_idx_user_id" ON "#__user_mfa" ("user_id") /** CAN FAIL **/;

COMMENT ON TABLE "#__user_mfa" IS 'Multi-factor Authentication settings';

--
-- Remove obsolete postinstallation message
--
DELETE FROM "#__postinstall_messages" WHERE "condition_file" = 'site://plugins/twofactorauth/totp/postinstall/actions.php';

--
-- Add new MFA plugins
--
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_multifactorauth_totp', 'plugin', 'totp', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 1, 0),
(0, 'plg_multifactorauth_yubikey', 'plugin', 'yubikey', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 2, 0),
(0, 'plg_multifactorauth_webauthn', 'plugin', 'webauthn', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 3, 0),
(0, 'plg_multifactorauth_email', 'plugin', 'email', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 4, 0),
(0, 'plg_multifactorauth_fixed', 'plugin', 'fixed', 'multifactorauth', 0, 0, 1, 0, 1, '', '', '', 5, 0);

--
-- Update MFA plugins' publish status
--
UPDATE "#__extensions" AS "a"
SET "enabled" = "b"."enabled"
FROM "#__extensions" AS "b"
WHERE "a"."element" = "b"."element"
AND "a"."folder" = 'multifactorauth'
AND "b"."folder" = 'twofactorauth';

--
-- Remove legacy TFA plugins
--
DELETE FROM "#__extensions"
WHERE "type" = 'plugin' AND "folder" = 'twofactorauth' AND "element" IN ('totp', 'yubikey');

--
-- Add post-installation message
--
INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled")
SELECT "extension_id", 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_TITLE', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_BODY', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_ACTION', 'com_users', 1, 'action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_condition', '4.2.0', 1 FROM "#__extensions" WHERE "name" = 'files_joomla'
ON CONFLICT DO NOTHING;

--
-- Create a mail template for plg_multifactorauth_email
--
INSERT INTO "#__mail_templates" ("template_id", "extension", "language", "subject", "body", "htmlbody", "attachments", "params") VALUES
('plg_multifactorauth_email.mail', 'plg_multifactorauth_email', '', 'PLG_MULTIFACTORAUTH_EMAIL_EMAIL_SUBJECT', 'PLG_MULTIFACTORAUTH_EMAIL_EMAIL_BODY', '', '', '{"tags":["code","sitename","siteurl","username","email","fullname"]}')
ON CONFLICT DO NOTHING;
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function &getInfo(): array
return $this->info;
}

$db = $this->getDbo();
$db = $this->getDatabase();

$this->info = [
'php' => php_uname(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class HtmlView extends BaseHtmlView
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);
}
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_associations/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC" >
>
<field
name="rules"
type="rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ protected function getListQuery()

// Create a new query object.
$user = Factory::getUser();
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true);

$details = $type->get('details');
Expand Down Expand Up @@ -505,7 +505,7 @@ protected function getListQuery()
public function purge($context = '', $key = '')
{
$app = Factory::getApplication();
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)->delete($db->quoteName('#__associations'));

// Filter by associations context.
Expand Down Expand Up @@ -556,7 +556,7 @@ public function purge($context = '', $key = '')
public function clean($context = '', $key = '')
{
$app = Factory::getApplication();
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select($db->quoteName('key') . ', COUNT(*)')
->from($db->quoteName('#__associations'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$user = Factory::getUser();
$user = $this->getCurrentUser();

if (isset($this->typeName) && isset($this->extensionName))
{
Expand Down
1 change: 0 additions & 1 deletion administrator/components/com_banners/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>

<field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ protected function prepareTable($table)
// Set ordering to the last item if not set
if (empty($table->ordering))
{
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('MAX(' . $db->quoteName('ordering') . ')')
->from($db->quoteName('#__banners'));
Expand Down

0 comments on commit 0d9d1ba

Please sign in to comment.