aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-12-02 16:23:32 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-12-02 16:23:32 +0000
commit353b7edc9abad9ceb0d9dc929e3efd9e2d75ee79 (patch)
tree2fadcb4e1bdaf226b146600ac784ca95a8d01eac /phpBB/includes/functions.php
parentf766dccc3b7edaf850b0aff2dec6335b413cd4a3 (diff)
downloadforums-353b7edc9abad9ceb0d9dc929e3efd9e2d75ee79.tar
forums-353b7edc9abad9ceb0d9dc929e3efd9e2d75ee79.tar.gz
forums-353b7edc9abad9ceb0d9dc929e3efd9e2d75ee79.tar.bz2
forums-353b7edc9abad9ceb0d9dc929e3efd9e2d75ee79.tar.xz
forums-353b7edc9abad9ceb0d9dc929e3efd9e2d75ee79.zip
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
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php39
1 files changed, 27 insertions, 12 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index f92b4f91ab..3ed71add61 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1831,30 +1831,45 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
}
}
- // Assign sid if session id is not specified
- if ($session_id === false)
- {
- $session_id = $_SID;
- }
-
- $amp_delim = ($is_amp) ? '&amp;' : '&';
- $url_delim = (strpos($url, '?') === false) ? '?' : $amp_delim;
-
- // Appending custom url parameter?
- $append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : '';
+ $params_is_array = is_array($params);
+ // Get anchor
$anchor = '';
if (strpos($url, '#') !== false)
{
list($url, $anchor) = explode('#', $url, 2);
$anchor = '#' . $anchor;
}
- else if (!is_array($params) && strpos($params, '#') !== false)
+ 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) ? '&amp;' : '&');
+ return $url . ($params !== false ? $url_delim. $params : '');
+ }
+
+ // Assign sid if session id is not specified
+ if ($session_id === false)
+ {
+ $session_id = $_SID;
+ }
+
+ $amp_delim = ($is_amp) ? '&amp;' : '&';
+ $url_delim = (strpos($url, '?') === false) ? '?' : $amp_delim;
+
+ // Appending custom url parameter?
+ $append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : '';
+
// Use the short variant if possible ;)
if ($params === false)
{