Skip to content

Commit

Permalink
Fix redirects not passing the right forum action
Browse files Browse the repository at this point in the history
Do not use base64 for encoding urls
Fix the call to the redirect action failing.
  • Loading branch information
jdarwood007 committed Mar 6, 2021
1 parent d09ed89 commit b5cd900
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ForumProvider/elk1.0.php
Expand Up @@ -42,7 +42,7 @@ public function decodeCookie()
*/
public function getRedirectURL(string $action, string $wiki_url, bool $do_return = false)
{
$forum_action = $this->$validRedirectActions[$action];
$forum_action = $this->validRedirectActions[$action];

$forum_url =
$this->ForumSettings['boardurl']
Expand Down
4 changes: 2 additions & 2 deletions ForumProvider/smf2.0.php
Expand Up @@ -138,13 +138,13 @@ public function decodeCookie()
*/
public function getRedirectURL(string $action, string $wiki_url, bool $do_return = false)
{
$forum_action = $this->$validRedirectActions[$action];
$forum_action = $this->validRedirectActions[$action];

$forum_url =
$this->ForumSettings['boardurl']
. '/index.php?action=' . $forum_action
. ';return_hash=' . hash_hmac('sha1', $wiki_url, $this->ForumSettings['image_proxy_secret'])
. ';return_to=' . base64_encode($wiki_url);
. ';return_to=' . urlencode($wiki_url);

return (string) $forum_url;
}
Expand Down
4 changes: 2 additions & 2 deletions ForumProvider/smf2.1.php
Expand Up @@ -37,13 +37,13 @@ public function decodeCookie()
*/
public function getRedirectURL(string $action, string $wiki_url, bool $do_return = false)
{
$forum_action = $this->$validRedirectActions[$action];
$forum_action = $this->validRedirectActions[$action];

$forum_url =
$this->ForumSettings['boardurl']
. '/index.php?action=' . $forum_action
. ';return_hash=' . hash_hmac('sha1', $wiki_url, $this->ForumSettings['auth_secret'])
. ';return_to=' . base64_encode($wiki_url);
. ';return_to=' . urlencode($wiki_url);

return $forum_url;
}
Expand Down
4 changes: 2 additions & 2 deletions ForumSsoProvider.php
Expand Up @@ -65,7 +65,7 @@ public function __construct(array $params = [])
parent::__construct($params);

// We hand this off for later to be used in our static function calls.
$wgForumSessionProviderInstance = &$this;
$wgForumSessionProviderInstance = $this;

// We use MWLogger here as logger seems to get destroyed. Sets up logging of this extension for debugging purposes.
$this->MWlogger = \MediaWiki\Logger\LoggerFactory::getInstance('ForumSessionProvider');
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function onSpecialPageBeforeExecute($special, $subPage)
global $wgForumSessionProviderInstance;

// Ensure its callable.
if (!is_callable($wgForumSessionProviderInstance, 'doRedirect'))
if (!is_callable(array($wgForumSessionProviderInstance, 'doRedirect')))
return;

// The case of some of these isn't always consistent with what shows up in the url.
Expand Down

0 comments on commit b5cd900

Please sign in to comment.