Skip to content

Commit

Permalink
Merge branch '4.2-dev' into j4/users/login-model
Browse files Browse the repository at this point in the history
  • Loading branch information
roland-d committed Jun 18, 2022
2 parents 9066b74 + 8899f66 commit 35c2c88
Show file tree
Hide file tree
Showing 113 changed files with 1,349 additions and 396 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
&nbsp;<span class="icon-lock" aria-hidden="true"></span>
</button>
<?php else : ?>
<button type="buttton" class="btn btn-secondary btn-sm" onclick="return Joomla.listItemTask('cb<?php echo $i; ?>','history.keep')">
<button type="button" class="btn btn-secondary btn-sm" onclick="return Joomla.listItemTask('cb<?php echo $i; ?>','history.keep')">
<?php echo Text::_('JNO'); ?>
</button>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Joomla\Component\Finder\Administrator\Service\HTML\Filter;
use Joomla\Component\Finder\Administrator\Service\HTML\Finder;
use Joomla\Component\Finder\Administrator\Service\HTML\Query;
use Joomla\Database\DatabaseInterface;
use Psr\Container\ContainerInterface;

/**
Expand Down Expand Up @@ -46,8 +47,16 @@ class FinderComponent extends MVCComponent implements BootableExtensionInterface
*/
public function boot(ContainerInterface $container)
{
$this->getRegistry()->register('finder', new Finder);
$this->getRegistry()->register('filter', new Filter);
$finder = new Finder;
$finder->setDatabase($container->get(DatabaseInterface::class));

$this->getRegistry()->register('finder', $finder);

$filter = new Filter;
$filter->setDatabase($container->get(DatabaseInterface::class));

$this->getRegistry()->register('filter', $filter);

$this->getRegistry()->register('query', new Query);
}
}
5 changes: 1 addition & 4 deletions administrator/components/com_finder/src/Indexer/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ abstract class Adapter extends CMSPlugin
*/
public function __construct(&$subject, $config)
{
// Get the database object.
$this->db = Factory::getDbo();

// Call the parent constructor.
parent::__construct($subject, $config);

Expand All @@ -157,7 +154,7 @@ public function __construct(&$subject, $config)
}

// Get the indexer object
$this->indexer = new Indexer;
$this->indexer = new Indexer($this->db);
}

/**
Expand Down
15 changes: 11 additions & 4 deletions administrator/components/com_finder/src/Indexer/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Profiler\Profiler;
use Joomla\Database\DatabaseInterface;
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\String\StringHelper;
Expand Down Expand Up @@ -112,13 +113,19 @@ class Indexer
/**
* Indexer constructor.
*
* @param DatabaseInterface $db The database
*
* @since 3.8.0
*/
public function __construct()
public function __construct(DatabaseInterface $db = null)
{
$this->db = Factory::getDbo();
if ($db === null)
{
@trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED);
$db = Factory::getContainer()->get(DatabaseInterface::class);
}

$db = $this->db;
$this->db = $db;

// Set up query template for addTokensToDb
$this->addTokensToDbQueryTemplate = $db->getQuery(true)->insert($db->quoteName('#__finder_tokens'))
Expand Down Expand Up @@ -1020,7 +1027,7 @@ protected function addTokensToDb($tokens, $context = '')
*/
protected function toggleTables($memory)
{
if (strtolower(Factory::getDbo()->getServerType()) != 'mysql')
if (strtolower($this->db->getServerType()) != 'mysql')
{
return true;
}
Expand Down
20 changes: 16 additions & 4 deletions administrator/components/com_finder/src/Indexer/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Finder\Administrator\Helper\LanguageHelper;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Database\DatabaseInterface;
use Joomla\Database\ParameterType;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
Expand All @@ -31,6 +33,8 @@
*/
class Query
{
use DatabaseAwareTrait;

/**
* Flag to show whether the query can return results.
*
Expand Down Expand Up @@ -191,8 +195,16 @@ class Query
* @since 2.5
* @throws Exception on database error.
*/
public function __construct($options)
public function __construct($options, DatabaseInterface $db = null)
{
if ($db === null)
{
@trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED);
$db = Factory::getContainer()->get(DatabaseInterface::class);
}

$this->setDatabase($db);

// Get the input string.
$this->input = $options['input'] ?? '';

Expand Down Expand Up @@ -516,7 +528,7 @@ public function getRequiredTermIds()
protected function processStaticTaxonomy($filterId)
{
// Get the database object.
$db = Factory::getDbo();
$db = $this->getDatabase();

// Initialize user variables
$groups = implode(',', Factory::getUser()->getAuthorisedViewLevels());
Expand Down Expand Up @@ -630,7 +642,7 @@ protected function processDynamicTaxonomy($filters)
}

// Get the database object.
$db = Factory::getDbo();
$db = $this->getDatabase();

$query = $db->getQuery(true);

Expand Down Expand Up @@ -1339,7 +1351,7 @@ protected function processString($input, $lang, $mode)
protected function getTokenData($token)
{
// Get the database object.
$db = Factory::getDbo();
$db = $this->getDatabase();

// Create a database query to build match the token.
$query = $db->getQuery(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Joomla\CMS\Language\Text;
use Joomla\Component\Finder\Administrator\Helper\LanguageHelper;
use Joomla\Component\Finder\Administrator\Indexer\Query;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Registry\Registry;

/**
Expand All @@ -27,6 +28,8 @@
*/
class Filter
{
use DatabaseAwareTrait;

/**
* Method to generate filters using the slider widget and decorated
* with the FinderFilter JavaScript behaviors.
Expand All @@ -39,7 +42,7 @@ class Filter
*/
public function slider($options = array())
{
$db = Factory::getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true);
$user = Factory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
Expand Down Expand Up @@ -239,7 +242,7 @@ public function select($idxQuery, $options)
}
else
{
$db = Factory::getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true);

// Load the predefined filter if specified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Component\Finder\Administrator\Helper\LanguageHelper;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Utilities\ArrayHelper;

/**
Expand All @@ -24,6 +25,8 @@
*/
class Finder
{
use DatabaseAwareTrait;

/**
* Creates a list of types to filter on.
*
Expand All @@ -34,7 +37,7 @@ class Finder
public function typeslist()
{
// Load the finder types.
$db = Factory::getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('DISTINCT t.title AS text, t.id AS value')
->from($db->quoteName('#__finder_types') . ' AS t')
Expand Down Expand Up @@ -75,7 +78,7 @@ public function typeslist()
public function mapslist()
{
// Load the finder types.
$db = Factory::getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select($db->quoteName('title', 'text'))
->select($db->quoteName('id', 'value'))
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_menus/presets/alternate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
xsi:schemaLocation="urn:joomla.org menu.xsd"
>
<menuitem
type="component"
title="MOD_MENU_CONTROL_PANEL"
link="index.php"
type="component"
element="com_cpanel"
link="index.php?option=com_cpanel&amp;view=cpanel"
class="class:home"
/>
<menuitem
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_modules/forms/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<config>
<inlinehelp button="show"/>
<config>
<inlinehelp button="show"/>
</config>
<fieldset addfieldprefix="Joomla\Component\Modules\Administrator\Field">
<field
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_modules/forms/moduleadmin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<config>
<inlinehelp button="show"/>
<config>
<inlinehelp button="show"/>
</config>
<fieldset addfieldprefix="Joomla\Component\Modules\Administrator\Field">
<field
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_plugins/forms/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<form addfieldprefix="Joomla\Component\Plugins\Administrator\Field">
<config>
<inlinehelp button="show"/>
<config>
<inlinehelp button="show"/>
</config>
<fieldset>
<field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected function getRoutineId(Form $form, $data): string
// If we're unable to find a routineId, it might be in the form input.
if (empty($routineId))
{
$app = $this->app ?? Factory::getApplication();
$app = $this->getApplication() ?? ($this->app ?? Factory::getApplication());
$form = $app->getInput()->get('jform', []);
$routineId = ArrayHelper::getValue($form, 'type', '', 'STRING');
}
Expand Down Expand Up @@ -248,7 +248,7 @@ protected function logTask(string $message, string $priority = 'info'): void

if (!$langLoaded)
{
$app = $this->app ?? Factory::getApplication();
$app = $this->getApplication() ?? ($this->app ?? Factory::getApplication());
$app->getLanguage()->load('com_scheduler', JPATH_ADMINISTRATOR);
$langLoaded = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public function loadCaptiveRenderOptions(?MfaTable $record): CaptiveRenderOption
{
return $renderOptions->merge(
[
'pre_message' => Text::_('COM_USERS_USER_BACKUPCODES_CAPTIVE_PROMPT'),
'input_type' => 'number',
'label' => Text::_('COM_USERS_USER_BACKUPCODE'),
]
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/com_users.ini
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ COM_USERS_USERS_TABLE_CAPTION="Table of Users"
COM_USERS_USER_ACCOUNT_DETAILS="Account Details"
COM_USERS_USER_BACKUPCODE="Backup Code"
COM_USERS_USER_BACKUPCODES="Backup Codes"
COM_USERS_USER_BACKUPCODES_CAPTIVE_PROMPT="If you do not have access to your usual Multi-factor Authentication method use any of your Backup Codes in the field below. Please remember that this emergency backup code cannot be reused."
COM_USERS_USER_BACKUPCODES_DESC="Lets you access the site if all other Multi-factor Authentication methods you have set up fail."
COM_USERS_USER_BATCH_FAILED="An error was encountered while performing the batch operation: %s."
COM_USERS_USER_BATCH_SUCCESS="Batch operation completed."
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/com_workflow.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
; Joomla! Project
; (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/plg_multifactorauth_totp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
; Note : All ini files need to be saved as UTF-8

PLG_MULTIFACTORAUTH_TOTP="Multi-factor Authentication - Verification Code"
PLG_MULTIFACTORAUTH_TOTP_CAPTIVE_PROMPT="Please open your authenticator application or password manager and copy the six digit code for this site in the text box below, then click on the Validate button. If this code has been automatically filled in for you just click on the Validate button."
PLG_MULTIFACTORAUTH_TOTP_ERR_VALIDATIONFAILED="You did not enter a valid verification code. Please check your authenticator app setup, and make sure that the time and time zone on your device is set correctly."
PLG_MULTIFACTORAUTH_TOTP_LBL_LABEL="Enter the six digit verification code"
PLG_MULTIFACTORAUTH_TOTP_LBL_SETUP_INSTRUCTIONS="Set up your verification code (also known as an “authenticator code”) using the information below. You can use an authenticator app (such Google Authenticator, Authy, LastPass Authenticator, etc), your favorite password manager (1Password, BitWarden, Keeper, KeePassXC, Strongbox, etc) or, in some cases, your browser."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
; Note : All ini files need to be saved as UTF-8

PLG_MULTIFACTORAUTH_YUBIKEY="Multi-factor Authentication - YubiKey"
PLG_MULTIFACTORAUTH_YUBIKEY_CAPTIVE_PROMPT="Please click in the text box below. Then insert your YubiKey into the USB port of your device and touch its golden disk or golden pad (depending on your model) to make it produce a YubiKey code. If you are on an NFC-capable phone or tablet with an NFC-enabled YubiKey you need to instead approach your YubiKey to the NFC reader area of your phone or tablet."
PLG_MULTIFACTORAUTH_YUBIKEY_CODE_LABEL="YubiKey code"
PLG_MULTIFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED="You did not enter a valid YubiKey secret code or the YubiCloud servers are unreachable at this time."
PLG_MULTIFACTORAUTH_YUBIKEY_LBL_AFTERSETUP_INSTRUCTIONS="You have already set up your YubiKey (the one generating codes starting with <code>%s</code>). You can only change its title from this page."
Expand Down
4 changes: 2 additions & 2 deletions administrator/modules/mod_menu/tmpl/default_submenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
// Get the menu icon
$icon = $this->getIconClass($current);
$iconClass = ($icon != '' && $current->level == 1) ? '<span class="' . $icon . '" aria-hidden="true"></span>' : '';
$ajax = $current->ajaxbadge ? '<span class="menu-badge"><span class="icon-spin icon-spinner mt-1 system-counter" data-url="' . $current->ajaxbadge . '"></span></span>' : '';
$ajax = !empty($current->ajaxbadge) ? '<span class="menu-badge"><span class="icon-spin icon-spinner mt-1 system-counter" data-url="' . $current->ajaxbadge . '"></span></span>' : '';
$iconImage = $current->icon;
$homeImage = '';

Expand Down Expand Up @@ -176,7 +176,7 @@
}
}

if ($current->dashboard)
if (!empty($current->dashboard))
{
$titleDashboard = Text::sprintf('MOD_MENU_DASHBOARD_LINK', Text::_($current->title));
echo '<span class="menu-dashboard"><a href="'
Expand Down
4 changes: 2 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ There are three options here:
- Legacy Javascript files must have an extension `.es5.js`.
This instructs ESLint to skip checking this file.
Also, it instructs the tools to create a minified version (production code WILL NOT have the `.es5` part)

- Javascript files with only an extension `.js`.
These files will be ignored by the build tools.

Expand Down Expand Up @@ -57,7 +57,7 @@ There are three options here:

Usually, the scope of a single contribution to the project should be limited. For example: fixing a CSS bug, a Javascript bug, some Markup, or a bug that involves changes in all these areas. The build tools were created so that you spend less time on compiling assets than testing a possible solution.

*Embrace the watchers*
*Embrace the watchers*
Let the computer help you succeed faster and safer. There are 2 watchers at the moment: one for the Media Manager (client app based on VueJS) and another one that handles templates and the source (build) folder.

Assuming that you are working on the Media Manager, you can run in your terminal (already in the root folder of the Joomla repo) `npm run watch:com_media`. This watcher will automatically recompile the app on every save (there is a debounce of 0.3s, so if you have autosave it will be a clever way to minimise the wait).
Expand Down
2 changes: 1 addition & 1 deletion build/media_source/com_media/js/edit-images.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class Edit {
new Edit();

/**
* Compute the corrent URL
* Compute the current URL
*
* @param {boolean} isModal is the URL for a modal window
*
Expand Down
2 changes: 1 addition & 1 deletion components/com_finder/src/Model/SearchModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ protected function populateState($ordering = null, $direction = null)
$options['when2'] = $request->getString('w2', $params->get('w2', ''));

// Load the query object.
$this->searchquery = new Query($options);
$this->searchquery = new Query($options, $this->getDatabase());

// Load the query token data.
$this->excludedTerms = $this->searchquery->getExcludedTermIds();
Expand Down
2 changes: 1 addition & 1 deletion components/com_users/tmpl/captive/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class="btn btn-sm btn-secondary"
</h2>

<?php if ($this->renderOptions['pre_message']): ?>
<div class="users-mfa-captive-pre-message text-muted">
<div class="users-mfa-captive-pre-message text-muted mb-3">
<?php echo $this->renderOptions['pre_message'] ?>
</div>
<?php endif; ?>
Expand Down

0 comments on commit 35c2c88

Please sign in to comment.