diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-29 09:21:00 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-29 09:21:00 +0200 |
commit | c398fc59ad870751cee73a2fbef8bc75233a7515 (patch) | |
tree | f686bab6d58a62fefd231b8132b5efa0001ba0ec /apps/files_encryption/lib | |
parent | 09b54ccb2b01c558b1d9ccad1e335492d97b4fe1 (diff) | |
parent | 7c0c6bd779cb73c4fdc9993f6dc78f9dd1138a88 (diff) | |
download | nextcloud-server-c398fc59ad870751cee73a2fbef8bc75233a7515.tar.gz nextcloud-server-c398fc59ad870751cee73a2fbef8bc75233a7515.zip |
Merge branch 'master' into remove_unused_vars
Conflicts:
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/proxy.php
apps/files_encryption/lib/session.php
apps/files_encryption/lib/stream.php
Diffstat (limited to 'apps/files_encryption/lib')
-rw-r--r-- | apps/files_encryption/lib/proxy.php | 10 | ||||
-rw-r--r-- | apps/files_encryption/lib/session.php | 24 | ||||
-rw-r--r-- | apps/files_encryption/lib/stream.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/util.php | 2 |
4 files changed, 17 insertions, 21 deletions
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 5ccf0d94d37..11308612daf 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -110,7 +110,7 @@ class Proxy extends \OC_FileProxy { $userId = \OCP\USER::getUser(); $view = new \OC_FilesystemView('/'); $util = new Util($view, $userId); - $session = new Session($view); + $session = new \OCA\Encryption\Session($view); $privateKey = $session->getPrivateKey(); $filePath = $util->stripUserFilesPath($path); // Set the filesize for userland, before encrypting @@ -200,7 +200,7 @@ class Proxy extends \OC_FileProxy { \OC_FileProxy::$enabled = false; // init session - $session = new Session($view); + $session = new \OCA\Encryption\Session($view); // If data is a catfile if ( @@ -222,8 +222,8 @@ class Proxy extends \OC_FileProxy { $plainData = Crypt::symmetricDecryptFileContent($data, $plainKeyfile); } elseif ( - Crypt::mode() === 'server' - && isset($_SESSION['legacyenckey']) + Crypt::mode() == 'server' + && \OC::$session->exists('legacyenckey') && Crypt::isEncryptedMeta($path) ) { $plainData = Crypt::legacyBlockDecrypt($data, $session->getLegacyKey()); @@ -443,7 +443,7 @@ class Proxy extends \OC_FileProxy { \OC_FileProxy::$enabled = false; $view = new \OC_FilesystemView('/'); - $session = new Session($view); + $session = new \OCA\Encryption\Session($view); $userId = \OCP\User::getUser(); $util = new Util($view, $userId); diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php index dbf9a487995..bff1737554b 100644 --- a/apps/files_encryption/lib/session.php +++ b/apps/files_encryption/lib/session.php @@ -105,7 +105,7 @@ class Session { */ public function setPrivateKey($privateKey) { - $_SESSION['privateKey'] = $privateKey; + \OC::$session->set('privateKey', $privateKey); return true; @@ -121,8 +121,8 @@ class Session { if (\OCA\Encryption\Helper::isPublicAccess()) { return $this->getPublicSharePrivateKey(); } else { - if (isset($_SESSION['privateKey']) && !empty($_SESSION['privateKey'])) { - return $_SESSION['privateKey']; + if (!is_null( \OC::$session->get('privateKey') )) { + return \OC::$session->get('privateKey'); } else { return false; } @@ -136,7 +136,7 @@ class Session { */ public function setPublicSharePrivateKey($privateKey) { - $_SESSION['publicSharePrivateKey'] = $privateKey; + \OC::$session->set('publicSharePrivateKey', $privateKey); return true; @@ -149,12 +149,11 @@ class Session { */ public function getPublicSharePrivateKey() { - if (isset($_SESSION['publicSharePrivateKey']) && !empty($_SESSION['publicSharePrivateKey'])) { - return $_SESSION['publicSharePrivateKey']; + if (!is_null( \OC::$session->get('publicSharePrivateKey') )) { + return \OC::$session->get('publicSharePrivateKey'); } else { return false; } - } @@ -165,7 +164,7 @@ class Session { */ public function setLegacyKey($legacyKey) { - $_SESSION['legacyKey'] = $legacyKey; + \OC::$session->set('legacyKey', $legacyKey); return true; } @@ -177,12 +176,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 { @@ -192,4 +188,4 @@ class Session { } -}
\ No newline at end of file +} diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index 49e93730cd5..072c5286644 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -228,7 +228,7 @@ class Stream { // If a keyfile already exists if ($this->encKeyfile) { - $session = new Session($this->rootView); + $session = new \OCA\Encryption\Session( $this->rootView ); $privateKey = $session->getPrivateKey($this->userId); diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 840e37ddb26..16a5e8d7653 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1420,7 +1420,7 @@ class Util { if ($item['type'] === 'dir') { $this->addRecoveryKeys($filePath . '/'); } else { - $session = new Session(new \OC_FilesystemView('/')); + $session = new \OCA\Encryption\Session(new \OC_FilesystemView('/')); $sharingEnabled = \OCP\Share::isEnabled(); $file = substr($filePath, 0, -4); $usersSharing = $this->getSharingUsersArray($sharingEnabled, $file); |