summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-05-28 01:04:09 +0200
committerRobin Appelman <icewind@owncloud.com>2013-05-28 01:04:09 +0200
commit44f9af5a7fb6f0f9846bfb36ff99f9bf8aee5985 (patch)
tree542dda23ae155538850908d14536f3cc3a27aa6c /apps/files_encryption
parent76d13120eaf0bb6ed5661baa898b13cc6d35b111 (diff)
downloadnextcloud-server-44f9af5a7fb6f0f9846bfb36ff99f9bf8aee5985.tar.gz
nextcloud-server-44f9af5a7fb6f0f9846bfb36ff99f9bf8aee5985.zip
Use the new session wrapper
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/proxy.php2
-rw-r--r--apps/files_encryption/lib/session.php20
-rwxr-xr-xapps/files_encryption/tests/util.php6
3 files changed, 11 insertions, 17 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
+}