diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-05-28 01:04:09 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-05-28 01:04:09 +0200 |
commit | 44f9af5a7fb6f0f9846bfb36ff99f9bf8aee5985 (patch) | |
tree | 542dda23ae155538850908d14536f3cc3a27aa6c /apps | |
parent | 76d13120eaf0bb6ed5661baa898b13cc6d35b111 (diff) | |
download | nextcloud-server-44f9af5a7fb6f0f9846bfb36ff99f9bf8aee5985.tar.gz nextcloud-server-44f9af5a7fb6f0f9846bfb36ff99f9bf8aee5985.zip |
Use the new session wrapper
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_encryption/lib/proxy.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/session.php | 20 | ||||
-rwxr-xr-x | apps/files_encryption/tests/util.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/public.php | 6 |
4 files changed, 14 insertions, 20 deletions
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index d9520810bf4..0f7eb84dc1b 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -220,7 +220,7 @@ class Proxy extends \OC_FileProxy } elseif ( Crypt::mode() == 'server' - && isset( $_SESSION['legacyenckey'] ) + &&\OC::$session->exists('legacyenckey') && Crypt::isEncryptedMeta( $path ) ) { $plainData = Crypt::legacyBlockDecrypt( $data, $session->getLegacyKey() ); diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php index 2ddad0a15da..d3353c73818 100644 --- a/apps/files_encryption/lib/session.php +++ b/apps/files_encryption/lib/session.php @@ -106,7 +106,7 @@ class Session */ public function setPrivateKey( $privateKey ) { - $_SESSION['privateKey'] = $privateKey; + \OC::$session->set('privateKey', $privateKey) return true; @@ -119,12 +119,9 @@ class Session */ public function getPrivateKey() { - if ( - isset( $_SESSION['privateKey'] ) - && !empty( $_SESSION['privateKey'] ) - ) { + if ( !is_null( \OC::$session->get('privateKey') ) ) { - return $_SESSION['privateKey']; + return \OC::$session->get('privateKey'); } else { @@ -141,7 +138,7 @@ class Session */ public function setLegacyKey( $legacyKey ) { - $_SESSION['legacyKey'] = $legacyKey; + \OC::$session->set('legacyKey', $legacyKey); return true; } @@ -153,12 +150,9 @@ class Session */ public function getLegacyKey() { - if ( - isset( $_SESSION['legacyKey'] ) - && !empty( $_SESSION['legacyKey'] ) - ) { + if ( !is_null( \OC::$session->get('legacyKey') ) ) { - return $_SESSION['legacyKey']; + return \OC::$session->get('legacyKey'); } else { @@ -168,4 +162,4 @@ class Session } -}
\ No newline at end of file +} diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php index 2069cae27e5..0dc452a41c8 100755 --- a/apps/files_encryption/tests/util.php +++ b/apps/files_encryption/tests/util.php @@ -183,7 +183,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $this->assertTrue(OCA\Encryption\Hooks::login($params)); - $this->assertEquals($this->legacyKey, $_SESSION['legacyKey']); + $this->assertEquals($this->legacyKey, \OC::$session->get('legacyKey')); } function testRecoveryEnabledForUser() { @@ -273,7 +273,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $this->assertTrue(OCA\Encryption\Hooks::login($params)); - $this->assertEquals($this->legacyKey, $_SESSION['legacyKey']); + $this->assertEquals($this->legacyKey, \OC::$session->get('legacyKey')); $files = $util->findEncFiles('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER . '/files/'); @@ -314,4 +314,4 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $params['password'] = $password; OCA\Encryption\Hooks::login($params); } -}
\ No newline at end of file +} diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 59598e35fa2..98d2a84fb66 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -84,7 +84,7 @@ if (isset($path)) { exit(); } else { // Save item id in session for future requests - $_SESSION['public_link_authenticated'] = $linkItem['id']; + \OC::$session->set('public_link_authenticated', $linkItem['id']); } } else { OCP\Util::writeLog('share', 'Unknown share type '.$linkItem['share_type'] @@ -97,8 +97,8 @@ if (isset($path)) { } else { // Check if item id is set in session - if (!isset($_SESSION['public_link_authenticated']) - || $_SESSION['public_link_authenticated'] !== $linkItem['id'] + if ( ! \OC::$session->exists('public_link_authenticated') + || \OC::$session->get('public_link_authenticated') !== $linkItem['id'] ) { // Prompt for password $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); |