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:
-rw-r--r--core/Nonce.php4
-rw-r--r--core/Session.php7
-rw-r--r--core/Session/Namespace.php30
-rw-r--r--plugins/Dashboard/Controller.php4
-rw-r--r--plugins/Installation/Controller.php2
-rw-r--r--plugins/LanguagesManager/API.php4
-rw-r--r--plugins/Login/Login.php2
7 files changed, 44 insertions, 9 deletions
diff --git a/core/Nonce.php b/core/Nonce.php
index 7ef98d8878..55888ef137 100644
--- a/core/Nonce.php
+++ b/core/Nonce.php
@@ -35,7 +35,7 @@ class Piwik_Nonce
static public function getNonce($id, $ttl = 300)
{
// save session-dependent nonce
- $ns = new Zend_Session_Namespace($id);
+ $ns = new Piwik_Session_Namespace($id);
$nonce = $ns->nonce;
// re-use an unexpired nonce (a small deviation from the "used only once" principle, so long as we do not reset the expiration)
@@ -60,7 +60,7 @@ class Piwik_Nonce
*/
static public function verifyNonce($id, $cnonce)
{
- $ns = new Zend_Session_Namespace($id);
+ $ns = new Piwik_Session_Namespace($id);
$nonce = $ns->nonce;
// validate token
diff --git a/core/Session.php b/core/Session.php
index 0874311434..ea56cb38ab 100644
--- a/core/Session.php
+++ b/core/Session.php
@@ -17,8 +17,13 @@
*/
class Piwik_Session extends Zend_Session
{
- public static function start($options = false)
+ public static function start($options = false)
{
+ if(Piwik_Common::isPhpCliMode())
+ {
+ return;
+ }
+
// use cookies to store session id on the client side
@ini_set('session.use_cookies', '1');
diff --git a/core/Session/Namespace.php b/core/Session/Namespace.php
new file mode 100644
index 0000000000..919928298d
--- /dev/null
+++ b/core/Session/Namespace.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ * @version $Id$
+ *
+ * @category Piwik
+ * @package Piwik
+ */
+
+/**
+ * Session namespace.
+ *
+ * @package Piwik
+ */
+class Piwik_Session_Namespace extends Zend_Session_Namespace
+{
+ public function __construct($namespace = 'Default', $singleInstance = false)
+ {
+ if(Piwik_Common::isPhpCliMode())
+ {
+ self::$_readable = true;
+ return;
+ }
+
+ parent::__construct($namespace, $singleInstance);
+ }
+}
diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php
index 11409f1203..3952d3cc6e 100644
--- a/plugins/Dashboard/Controller.php
+++ b/plugins/Dashboard/Controller.php
@@ -94,7 +94,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
$currentUser = Piwik::getCurrentUserLogin();
if($currentUser == 'anonymous')
{
- $session = new Zend_Session_Namespace("Piwik_Dashboard");
+ $session = new Piwik_Session_Namespace("Piwik_Dashboard");
$session->dashboardLayout = $layout;
}
else
@@ -115,7 +115,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
if($currentUser == 'anonymous')
{
- $session = new Zend_Session_Namespace("Piwik_Dashboard");
+ $session = new Piwik_Session_Namespace("Piwik_Dashboard");
if(!isset($session->dashboardLayout))
{
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index 76246058c7..b85327fba3 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -36,7 +36,7 @@ class Piwik_Installation_Controller extends Piwik_Controller
public function __construct()
{
- $this->session = new Zend_Session_Namespace('Piwik_Installation');
+ $this->session = new Piwik_Session_Namespace('Piwik_Installation');
if(!isset($this->session->currentStepDone))
{
$this->session->currentStepDone = '';
diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php
index 041b3285e5..6d530bdc27 100644
--- a/plugins/LanguagesManager/API.php
+++ b/plugins/LanguagesManager/API.php
@@ -186,7 +186,7 @@ class Piwik_LanguagesManager_API
*/
public function getLanguageForSession()
{
- $session = new Zend_Session_Namespace("Piwik_LanguagesManager");
+ $session = new Piwik_Session_Namespace("Piwik_LanguagesManager");
if(isset($session->language))
{
return $session->language;
@@ -201,7 +201,7 @@ class Piwik_LanguagesManager_API
*/
public function setLanguageForSession($languageCode)
{
- $session = new Zend_Session_Namespace("Piwik_LanguagesManager");
+ $session = new Piwik_Session_Namespace("Piwik_LanguagesManager");
$session->language = $languageCode;
}
}
diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php
index d2a2e5f230..08dc2000d9 100644
--- a/plugins/Login/Login.php
+++ b/plugins/Login/Login.php
@@ -123,7 +123,7 @@ class Piwik_Login extends Piwik_Plugin
throw new Exception(Piwik_Translate('Login_LoginPasswordNotCorrect'));
}
- $ns = new Zend_Session_Namespace('Piwik_Login.referer');
+ $ns = new Piwik_Session_Namespace('Piwik_Login.referer');
unset($ns->referer);
$authCookieName = Zend_Registry::get('config')->General->login_cookie_name;