mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
Slight performance increase for common parameter calls to append_sid() (Bug #37555 - Patch by BartVB)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9150 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f766dccc3b
commit
353b7edc9a
@ -105,6 +105,7 @@
|
||||
<li>[Change] Performance increase for format_date() (Bug #37575 - Patch by BartVB)</li>
|
||||
<li>[Change] Changed prosilver date separator from 'on' to '»'</li>
|
||||
<li>[Change] Performance increase for get_username_string() (Bug #37545 - Patch by BartVB)</li>
|
||||
<li>[Change] Slight performance increase for common parameter calls to append_sid() (Bug #37555 - Patch by BartVB)</li>
|
||||
<li>[Feature] Added 'AGO' setting to relative date strings. For example: posted 14 minutes ago. (Patch by BartVB)</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1831,6 +1831,33 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
|
||||
}
|
||||
}
|
||||
|
||||
$params_is_array = is_array($params);
|
||||
|
||||
// Get anchor
|
||||
$anchor = '';
|
||||
if (strpos($url, '#') !== false)
|
||||
{
|
||||
list($url, $anchor) = explode('#', $url, 2);
|
||||
$anchor = '#' . $anchor;
|
||||
}
|
||||
else if (!$params_is_array && strpos($params, '#') !== false)
|
||||
{
|
||||
list($params, $anchor) = explode('#', $params, 2);
|
||||
$anchor = '#' . $anchor;
|
||||
}
|
||||
|
||||
// Handle really simple cases quickly
|
||||
if ($_SID == '' && $session_id === false && empty($_EXTRA_URL) && !$params_is_array && !$anchor)
|
||||
{
|
||||
if ($params === false)
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
|
||||
$url_delim = (strpos($url, '?') === false) ? '?' : (($is_amp) ? '&' : '&');
|
||||
return $url . ($params !== false ? $url_delim. $params : '');
|
||||
}
|
||||
|
||||
// Assign sid if session id is not specified
|
||||
if ($session_id === false)
|
||||
{
|
||||
@ -1843,18 +1870,6 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
|
||||
// Appending custom url parameter?
|
||||
$append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : '';
|
||||
|
||||
$anchor = '';
|
||||
if (strpos($url, '#') !== false)
|
||||
{
|
||||
list($url, $anchor) = explode('#', $url, 2);
|
||||
$anchor = '#' . $anchor;
|
||||
}
|
||||
else if (!is_array($params) && strpos($params, '#') !== false)
|
||||
{
|
||||
list($params, $anchor) = explode('#', $params, 2);
|
||||
$anchor = '#' . $anchor;
|
||||
}
|
||||
|
||||
// Use the short variant if possible ;)
|
||||
if ($params === false)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user