Skip to content

Commit

Permalink
[Regression] Keep B/C in the redirect plugin (joomla#17124)
Browse files Browse the repository at this point in the history
* keep B/C in the redirect plugin

* drone

* grammar (#28)
  • Loading branch information
zero-24 authored and rdeutz committed Jul 17, 2017
1 parent 48f58a6 commit 11432b5
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions plugins/system/redirect/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,16 @@ private static function doErrorHandling($error)

$uri = JUri::getInstance();

$url = StringHelper::strtolower(rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'))));
$urlRel = StringHelper::strtolower(rawurldecode($uri->toString(array('path', 'query', 'fragment'))));

$urlWithoutQuery = StringHelper::strtolower(rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'fragment'))));
// These are the original URLs
$orgurl = rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment')));
$orgurlRel = rawurldecode($uri->toString(array('path', 'query', 'fragment')));
$orgurlWithoutQuery = rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'fragment')));
$orgurlRelWithoutQuery = rawurldecode($uri->toString(array('path', 'fragment')));

// These are the URLs we save and use
$url = StringHelper::strtolower(rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'))));
$urlRel = StringHelper::strtolower(rawurldecode($uri->toString(array('path', 'query', 'fragment'))));
$urlWithoutQuery = StringHelper::strtolower(rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'fragment'))));
$urlRelWithoutQuery = StringHelper::strtolower(rawurldecode($uri->toString(array('path', 'fragment'))));

// Why is this (still) here?
Expand All @@ -146,6 +152,14 @@ private static function doErrorHandling($error)
. $db->quoteName('old_url') . ' = ' . $db->quote($urlWithoutQuery)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($urlRelWithoutQuery)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurl)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlRel)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlWithoutQuery)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlRelWithoutQuery)
. ')'
);

Expand All @@ -163,7 +177,16 @@ private static function doErrorHandling($error)
}

$possibleMatches = array_unique(
array($url, $urlRel, $urlWithoutQuery, $urlRelWithoutQuery)
array(
$url,
$urlRel,
$urlWithoutQuery,
$urlRelWithoutQuery,
$orgurl,
$orgurlRel,
$orgurlWithoutQuery,
$orgurlRelWithoutQuery,
)
);

foreach ($possibleMatches as $match)
Expand Down

0 comments on commit 11432b5

Please sign in to comment.