Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/src/Router/SiteRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ protected function processParseRules(&$uri, $stage = self::PROCESS_DURING)
if ($start !== null)
{
$uri->delVar('start');
$vars['limitstart'] = $start;
$uri->setVar('limitstart', $start);
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions templates/protostar/offline.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

use Joomla\CMS\Uri\Uri;

/** @var JDocumentHtml $this */

$twofactormethods = JAuthenticationHelper::getTwoFactorMethods();
Expand Down Expand Up @@ -116,7 +118,7 @@
<?php endif; ?>
</div>
<jdoc:include type="message" />
<form action="<?php echo JRoute::_('index.php', true); ?>" method="post" id="form-login">
<form action="<?php echo JRoute::_('index.php?option=com_users&view=login'); ?>" method="post" id="form-login">
<fieldset>
<label for="username"><?php echo JText::_('JGLOBAL_USERNAME'); ?></label>
<input name="username" id="username" type="text" title="<?php echo JText::_('JGLOBAL_USERNAME'); ?>" />
Expand All @@ -131,9 +133,10 @@

<input type="submit" name="Submit" class="btn btn-primary" value="<?php echo JText::_('JLOGIN'); ?>" />

<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.login" />
<input type="hidden" name="return" value="<?php echo base64_encode(JUri::base()); ?>" />
<?php $uri = new Uri('index.php'); ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can do this in a single line with:

<input type="hidden" name="return" value="<?php echo base64_encode(Uri::getInstance()->tostring()); ?>" />

<?php $uri->setQuery($app->getRouter()->getVars()); ?>
<input type="hidden" name="return" value="<?php echo base64_encode($uri->tostring()); ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
Expand Down
9 changes: 6 additions & 3 deletions templates/system/offline.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

use Joomla\CMS\Uri\Uri;

/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
Expand Down Expand Up @@ -58,7 +60,7 @@
<?php echo JText::_('JOFFLINE_MESSAGE'); ?>
</p>
<?php endif; ?>
<form action="<?php echo JRoute::_('index.php', true); ?>" method="post" id="form-login">
<form action="<?php echo JRoute::_('index.php?option=com_users&view=login'); ?>" method="post" id="form-login">
<fieldset class="input">
<p id="form-login-username">
<label for="username"><?php echo JText::_('JGLOBAL_USERNAME'); ?></label>
Expand All @@ -77,9 +79,10 @@
<p id="submit-buton">
<input type="submit" name="Submit" class="button login" value="<?php echo JText::_('JLOGIN'); ?>" />
</p>
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.login" />
<input type="hidden" name="return" value="<?php echo base64_encode(JUri::base()); ?>" />
<?php $uri = new Uri('index.php'); ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

<?php $uri->setQuery($app->getRouter()->getVars()); ?>
<input type="hidden" name="return" value="<?php echo base64_encode($uri->tostring()); ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/suites/libraries/cms/router/JRouterSiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ public function testBuildSefRoute($url, $expected)
*/
public function testProcessParseRules()
{
$uri = new JUri('index.php?start=42');
$uri = new JUri('index.php?limit=30&start=42');

$object = new JRouterSite(
array(),
Expand All @@ -1144,8 +1144,8 @@ public function testProcessParseRules()

$vars = $processParseRulesMethod->invokeArgs($object, array(&$uri));

$this->assertEquals('index.php', $uri->toString());
$this->assertEquals(array('limitstart' => '42'), $vars);
$this->assertEquals('index.php?limit=30&limitstart=42', $uri->toString());
$this->assertEquals(array(), $vars);
}

/**
Expand Down