diff options
author | robocoder <anthon.pang@gmail.com> | 2010-11-06 22:24:43 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2010-11-06 22:24:43 +0300 |
commit | 8d92330ddfcb90605ba5cf69c911fa463ef9b882 (patch) | |
tree | f3b112a0e4b46156697ef8f972f369cdfb87b715 /core/Cookie.php | |
parent | 9030acee19745a17716ac49fefb53cf26f509e1d (diff) |
micro-optimizations and some code clean-up
git-svn-id: http://dev.piwik.org/svn/trunk@3296 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Cookie.php')
-rw-r--r-- | core/Cookie.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/Cookie.php b/core/Cookie.php index 94ee0358cc..d50a58ef97 100644 --- a/core/Cookie.php +++ b/core/Cookie.php @@ -124,8 +124,10 @@ class Piwik_Cookie if (!empty($Domain)) { // Fix the domain to accept domains with and without 'www.'. - if (strtolower(substr($Domain, 0, 4)) == 'www.') $Domain = substr($Domain, 4); - + if (!strncasecmp($Domain, 'www.', 4)) + { + $Domain = substr($Domain, 4); + } $Domain = '.' . $Domain; // Remove port information. @@ -191,7 +193,7 @@ class Piwik_Cookie private function extractSignedContent($content) { $signature = substr($content, -40); - if(substr($content, -43, 3) == self::VALUE_SEPARATOR . '_=' && + if(!substr_compare($content, self::VALUE_SEPARATOR . '_=', -43, 3) && $signature == sha1(substr($content, 0, -40) . Piwik_Common::getSalt())) { // strip trailing: VALUE_SEPARATOR '_=' signature" |