1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 20:51:53 +02:00

Old HTML ampersand strict compatibility

- FIX: e107::url() now puts "&" in the query string instead of "&" for compliance with the older,
       looser definition of ambiguous ampersands in the HTML specification.
       Fixes: #4054
- FIX: Typo in comment
- FIX: Clear the core/e107/addons/e_url registry (cache) because if a plugin is installed after that
       cache is initialized, the cache is not updated anymore. The plugin's e_url is therefore not
       loaded, so SEF URLs won't be generated for that plugin until the cache is regenerated.
- NEW: Test for #4054
- FIX: e_pluginTest::testGetFields() expects the initial condition of the "forum" plugin to be
       uninstalled.
This commit is contained in:
Nick Liu 2020-01-13 00:21:59 +01:00
parent d13fcd44c7
commit e62422d63a
No known key found for this signature in database
GPG Key ID: 1167C5F9C9897637
4 changed files with 1006 additions and 997 deletions

View File

@ -3474,7 +3474,7 @@ class e107
$active = true;
foreach ($matches[1] as $k => $v) // check if a field value is missing, if so, revent to legacy url.
foreach ($matches[1] as $k => $v) // check if a field value is missing, if so, revert to legacy url.
{
if (!isset($row[$v])) {
self::getMessage()->addDebug("Missing value for " . $v . " in " . $plugin . "/e_url.php - '" . $key . "'");
@ -3489,7 +3489,6 @@ class e107
$active = false;
}
if (deftrue('e_MOD_REWRITE') && ($active == true) && empty($options['legacy'])) // Search-Engine-Friendly URLs active.
{
$rawUrl = $tp->simpleParse($tmp[$plugin][$key]['sef'], $row);
@ -3501,13 +3500,6 @@ class e107
} else {
$sefUrl = e_HTTP . $rawUrl;
}
// Append the query.
if (is_array($options['query']) && !empty($options['query'])) {
$sefUrl .= (strpos($sefUrl, '?') !== FALSE ? '&' : '?') . self::httpBuildQuery($options['query']);
}
return $sefUrl . $options['fragment'];
} else // Legacy URL.
{
@ -3551,15 +3543,15 @@ class e107
}
}
// Append the query.
if (is_array($options['query']) && !empty($options['query'])) {
$legacyUrl .= (strpos($legacyUrl, '?') !== FALSE ? '&' : '?') . self::httpBuildQuery($options['query']);
}
return $legacyUrl . $options['fragment'];
$sefUrl = $legacyUrl;
}
// Append the query.
if (is_array($options['query']) && !empty($options['query'])) {
$sefUrl .= (strpos($sefUrl, '?') !== FALSE ? '&' : '?') . self::httpBuildQuery($options['query']);
}
return $sefUrl . $options['fragment'];
}
@ -3631,7 +3623,7 @@ class e107
}
}
return implode('&', $params);
return implode('&', $params);
}

View File

@ -140,6 +140,7 @@ class e_plugin
{
$this->_installed = array();
$this->_addons = array();
e107::setRegistry('core/e107/addons/e_url');
$this->_init(true);
$this->_initIDs();

File diff suppressed because it is too large Load Diff

View File

@ -227,6 +227,7 @@
public function testGetFields()
{
e107::getPlugin()->uninstall('forum');
$result = $this->ep->clearCache()->load('forum')->getFields(true);
// print_r($result);