Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Cookie.php')
-rw-r--r--core/Cookie.php22
1 files changed, 9 insertions, 13 deletions
diff --git a/core/Cookie.php b/core/Cookie.php
index 3da0fe5cd4..215f985450 100644
--- a/core/Cookie.php
+++ b/core/Cookie.php
@@ -46,11 +46,12 @@ class Piwik_Cookie
*
* @param string cookie Name
* @param int The timestamp after which the cookie will expire, eg time() + 86400
+ * @param string The path on the server in which the cookie will be available on.
*/
- public function __construct( $cookieName, $expire = null)
+ public function __construct( $cookieName, $expire = null, $path = null)
{
$this->name = $cookieName;
-
+ $this->path = $path;
$this->expire = $expire;
if(is_null($expire)
|| !is_numeric($expire)
@@ -59,6 +60,7 @@ class Piwik_Cookie
$this->expire = $this->getDefaultExpire();
}
+
if($this->isCookieFound())
{
$this->loadContentFromCookie();
@@ -139,7 +141,7 @@ class Piwik_Cookie
public function save()
{
$this->setP3PHeader();
- $this->setCookie( $this->name, $this->generateContentString(), $this->expire);
+ $this->setCookie( $this->name, $this->generateContentString(), $this->expire, $this->path);
}
/**
@@ -164,13 +166,7 @@ class Piwik_Cookie
$varValue = base64_decode($varValue);
// some of the values may be serialized array so we try to unserialize it
- if( ($arrayValue = @unserialize($varValue)) !== false
- // we set the unserialized version only for arrays as you can have set a serialized string on purpose
- && is_array($arrayValue)
- )
- {
- $varValue = $arrayValue;
- }
+ $varValue = Piwik_Common::unserialize_array($varValue);
}
$this->set($varName, $varValue);
@@ -245,12 +241,12 @@ class Piwik_Cookie
*/
public function __toString()
{
- $str = "<-- Content of the cookie '{$this->name}' <br>\n";
+ $str = "&lt;-- Content of the cookie '{$this->name}' <br />\n";
foreach($this->value as $name => $value )
{
- $str .= $name . " = " . var_export($this->get($name), true) . "<br>\n";
+ $str .= $name . " = " . var_export($this->get($name), true) . "<br />\n";
}
- $str .= "--> <br>\n";
+ $str .= "--&gt; <br />\n";
return $str;
}