Skip to content

Commit

Permalink
Merge branch '4.2-dev' into feature/com_joomlaupdate_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas K. Dionysopoulos committed Jun 16, 2022
2 parents 6af571f + ee07c75 commit ca04b38
Show file tree
Hide file tree
Showing 20 changed files with 204 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,58 @@ public function unpublish()
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}

/**
* Re-Publishes an archived post-installation message of the specified extension.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function republish()
{
$model = $this->getModel('Messages', '', array('ignore_request' => true));

$id = $this->input->get('id');

$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());

if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}

$model->setState('published', 1);
$model->republishMessage($id);

$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}

/**
* Archives a published post-installation message of the specified extension.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function archive()
{
$model = $this->getModel('Messages', '', array('ignore_request' => true));

$id = $this->input->get('id');

$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());

if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}

$model->setState('published', 2);
$model->archiveMessage($id);

$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}

/**
* Executes the action associated with an item.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,56 @@ public function unpublishMessage($id)
Factory::getCache()->clean('com_postinstall');
}

/**
* Archives specified post-install message
*
* @param integer $id The message id
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function archiveMessage($id)
{
$db = $this->getDbo();
$id = (int) $id;

$query = $db->getQuery(true);
$query
->update($db->quoteName('#__postinstall_messages'))
->set($db->quoteName('enabled') . ' = 2')
->where($db->quoteName('postinstall_message_id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);
$db->setQuery($query);
$db->execute();
Factory::getCache()->clean('com_postinstall');
}

/**
* Republishes specified post-install message
*
* @param integer $id The message id
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function republishMessage($id)
{
$db = $this->getDbo();
$id = (int) $id;

$query = $db->getQuery(true);
$query
->update($db->quoteName('#__postinstall_messages'))
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('postinstall_message_id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);
$db->setQuery($query);
$db->execute();
Factory::getCache()->clean('com_postinstall');
}

/**
* Returns a list of messages from the #__postinstall_messages table
*
Expand All @@ -131,10 +181,9 @@ public function getItems()
{
// Add a forced extension filtering to the list
$eid = (int) $this->getState('eid', $this->getJoomlaFilesExtensionId());
$published = (int) $this->getState('published', 1);

// Build a cache ID for the resulting data object
$cacheId = $eid . '.' . $published;
$cacheId = 'postinstall_messages.' . $eid;

$db = $this->getDatabase();
$query = $db->getQuery(true);
Expand All @@ -161,8 +210,7 @@ public function getItems()
->bind(':eid', $eid, ParameterType::INTEGER);

// Force filter only enabled messages
$query->where($db->quoteName('enabled') . ' = :published')
->bind(':published', $published, ParameterType::INTEGER);
$query->where($db->quoteName('enabled') . ' IN (1,2)');
$db->setQuery($query);

try
Expand Down
61 changes: 41 additions & 20 deletions administrator/components/com_postinstall/tmpl/messages/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,46 @@
</form>

<?php foreach ($this->items as $item) : ?>
<div class="card card-outline-secondary mb-3">
<div class="card-body">
<h3><?php echo Text::_($item->title_key); ?></h3>
<p class="small">
<?php echo Text::sprintf('COM_POSTINSTALL_LBL_SINCEVERSION', $item->version_introduced); ?>
</p>
<div>
<?php echo Text::_($item->description_key); ?>
<?php if ($item->type !== 'message') : ?>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.action&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-primary">
<?php echo Text::_($item->action_key); ?>
</a>
<?php endif; ?>
<?php if (Factory::getApplication()->getIdentity()->authorise('core.edit.state', 'com_postinstall')) : ?>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.unpublish&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-danger btn-sm">
<?php echo Text::_('COM_POSTINSTALL_BTN_HIDE'); ?>
</a>
<?php endif; ?>
<?php if ($item->enabled === 1) : ?>
<div class="card card-outline-secondary mb-3">
<div class="card-body">
<h3><?php echo Text::_($item->title_key); ?></h3>
<p class="small">
<?php echo Text::sprintf('COM_POSTINSTALL_LBL_SINCEVERSION', $item->version_introduced); ?>
</p>
<div>
<?php echo Text::_($item->description_key); ?>
<?php if ($item->type !== 'message') : ?>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.action&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-primary">
<?php echo Text::_($item->action_key); ?>
</a>
<?php endif; ?>
<?php if (Factory::getApplication()->getIdentity()->authorise('core.edit.state', 'com_postinstall')) : ?>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.unpublish&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-danger btn-sm">
<?php echo Text::_('COM_POSTINSTALL_BTN_HIDE'); ?>
</a>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.archive&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-danger btn-sm">
<?php echo Text::_('COM_POSTINSTALL_BTN_ARCHIVE'); ?>
</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php elseif ($item->enabled === 2) : ?>
<div class="card card-outline-secondary mb-3">
<div class="card-body">
<h3><?php echo Text::_($item->title_key); ?></h3>
<div>
<?php if (Factory::getApplication()->getIdentity()->authorise('core.edit.state', 'com_postinstall')) : ?>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.unpublish&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-danger btn-sm">
<?php echo Text::_('COM_POSTINSTALL_BTN_HIDE'); ?>
</a>
<a href="<?php echo Route::_('index.php?option=com_postinstall&view=messages&task=message.republish&id=' . $item->postinstall_message_id . '&' . $this->token . '=1'); ?>" class="btn btn-success btn-sm">
<?php echo Text::_('COM_POSTINSTALL_BTN_REPUBLISH'); ?>
</a>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ protected function checkAccess()
$allowedViews,
function ($carry, $taskPrefix) use ($task)
{
return $carry || strpos($task, $taskPrefix . '.') === 0;
return $carry || strpos($task ?? '', $taskPrefix . '.') === 0;
},
false
);

if (in_array(strtolower($view), $allowedViews) || $isAllowedTask)
if (in_array(strtolower($view ?? ''), $allowedViews) || $isAllowedTask)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/src/Helper/Mfa.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static function getConfigurationInterface(User $user): ?string
/**
* This is intentional! When you are developing a Multi-factor Authentication plugin you
* will inevitably mess something up and end up with an error. This would cause the
* entire MFA configuration page to dissappear. No problem! Set Debug System to Yes in
* entire MFA configuration page to disappear. No problem! Set Debug System to Yes in
* Global Configuration and you can see the error exception which will help you solve
* your problem.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\Button\BasicButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarFactoryInterface;
Expand Down Expand Up @@ -109,6 +110,7 @@ public function display($tpl = null)
$user = Factory::getApplication()->getIdentity()
?: Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById(0);

PluginHelper::importPlugin('multifactorauth');
$event = new BeforeDisplayMethods($user);
$app->getDispatcher()->dispatch($event->getName(), $event);

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

COM_POSTINSTALL="Post-installation Messages"
COM_POSTINSTALL_BTN_ARCHIVE="Archive"
COM_POSTINSTALL_BTN_HIDE="Hide this message"
COM_POSTINSTALL_BTN_REPUBLISH="Read Again"
COM_POSTINSTALL_CONFIGURATION="Post-installation Messages: Options"
COM_POSTINSTALL_EMPTYSTATE_BUTTON_ADD="Reset Messages"
COM_POSTINSTALL_EMPTYSTATE_CONTENT="You have read all the messages."
Expand Down
8 changes: 4 additions & 4 deletions administrator/language/en-GB/plg_multifactorauth_yubikey.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
PLG_MULTIFACTORAUTH_YUBIKEY="Multi-factor Authentication - YubiKey"
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."
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."
PLG_MULTIFACTORAUTH_YUBIKEY_LBL_SETUP_INSTRUCTIONS="Please provide a code generated by your <a href='https://www.yubico.com/'>YubiKey</a> below and then click or touch the Confirm button. The first twelve characters, which are the unique identification code for your YubiKey, will be saved."
PLG_MULTIFACTORAUTH_YUBIKEY_LBL_SETUP_LABEL="Yubikey Identification"
PLG_MULTIFACTORAUTH_YUBIKEY_LBL_SETUP_PLACEHOLDER="Enter a Yubikey code"
PLG_MULTIFACTORAUTH_YUBIKEY_LBL_SETUP_LABEL="YubiKey Identification"
PLG_MULTIFACTORAUTH_YUBIKEY_LBL_SETUP_PLACEHOLDER="Enter a YubiKey code"
PLG_MULTIFACTORAUTH_YUBIKEY_METHOD_TITLE="YubiKey"
PLG_MULTIFACTORAUTH_YUBIKEY_SHORTINFO="Use YubiKey secure hardware tokens."
PLG_MULTIFACTORAUTH_YUBIKEY_XML_DESCRIPTION="Allows users on your site to use Multi-factor Authentication using a YubiKey secure hardware token. Users need their own Yubikey available from https://www.yubico.com/. To use Multi-factor Authentication users have to edit their user profile and enable Multi-factor Authentication."
PLG_MULTIFACTORAUTH_YUBIKEY_XML_DESCRIPTION="Allows users on your site to use Multi-factor Authentication using a YubiKey secure hardware token. Users need their own YubiKey available from https://www.yubico.com/. To use Multi-factor Authentication users have to edit their user profile and enable Multi-factor Authentication."
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
; Note : All ini files need to be saved as UTF-8

PLG_MULTIFACTORAUTH_YUBIKEY="Multi-factor Authentication - YubiKey"
PLG_MULTIFACTORAUTH_YUBIKEY_XML_DESCRIPTION="Allows users on your site to use Multi-factor Authentication using a YubiKey secure hardware token. Users need their own Yubikey available from https://www.yubico.com/. To use Multi-factor Authentication users have to edit their user profile and enable Multi-factor Authentication."
PLG_MULTIFACTORAUTH_YUBIKEY_XML_DESCRIPTION="Allows users on your site to use Multi-factor Authentication using a YubiKey secure hardware token. Users need their own YubiKey available from https://www.yubico.com/. To use Multi-factor Authentication users have to edit their user profile and enable Multi-factor Authentication."
3 changes: 3 additions & 0 deletions administrator/language/en-GB/plg_system_accessibility.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ PLG_SYSTEM_ACCESSIBILITY_CLOSE="Close"
PLG_SYSTEM_ACCESSIBILITY_CURSOR="Big Cursor"
PLG_SYSTEM_ACCESSIBILITY_DECREASE_SPACING="Decrease Text Spacing"
PLG_SYSTEM_ACCESSIBILITY_DECREASE_TEXT="Decrease Text Size"
PLG_SYSTEM_ACCESSIBILITY_EMOJIS="Icons"
PLG_SYSTEM_ACCESSIBILITY_EMOJIS_FALSE="Use Google Material Font"
PLG_SYSTEM_ACCESSIBILITY_EMOJIS_TRUE="Use Emojis"
PLG_SYSTEM_ACCESSIBILITY_GREY="Grey Hues"
PLG_SYSTEM_ACCESSIBILITY_INCREASE_SPACING="Increase Text Spacing"
PLG_SYSTEM_ACCESSIBILITY_INCREASE_TEXT="Increase Text Size"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ private function needsMultiFactorAuthenticationRedirection(): bool
return false;
}

// Allow the Joomla update finalisation to run
if ($isAdmin && $option === 'com_joomlaupdate' && in_array($task, ['update.finalise', 'update.cleanup', 'update.finaliseconfirm']))
{
return false;
}

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Event/CoreEventAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ trait CoreEventAware
// View
'onBeforeDisplay' => DisplayEvent::class,
'onAfterDisplay' => DisplayEvent::class,
// Worflow
// Workflow
'onWorkflowFunctionalityUsed' => WorkflowFunctionalityUsedEvent::class,
'onWorkflowAfterTransition' => WorkflowTransitionEvent::class,
'onWorkflowBeforeTransition' => WorkflowTransitionEvent::class,
Expand Down
4 changes: 2 additions & 2 deletions modules/mod_login/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
?>
<div class="mod-login__submit form-group">
<button type="button"
class="btn btn-secondary w-100 mt-4 <?php echo $button['class'] ?? '' ?>"
class="btn btn-secondary w-100 <?php echo $button['class'] ?? '' ?>"
<?php foreach ($dataAttributeKeys as $key): ?>
<?php echo $key ?>="<?php echo $button[$key] ?>"
<?php endforeach; ?>
Expand All @@ -104,7 +104,7 @@ class="btn btn-secondary w-100 mt-4 <?php echo $button['class'] ?? '' ?>"
<?php endforeach; ?>

<div class="mod-login__submit form-group">
<button type="submit" name="Submit" class="btn btn-primary"><?php echo Text::_('JLOGIN'); ?></button>
<button type="submit" name="Submit" class="btn btn-primary w-100"><?php echo Text::_('JLOGIN'); ?></button>
</div>

<?php
Expand Down

0 comments on commit ca04b38

Please sign in to comment.