summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-29 19:19:40 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-29 19:19:40 +0200
commit1202ab9995e2fa2293bfb8017fc58ca6daa4fba2 (patch)
tree7e839e730867ffe42b1d6626c819e87c450cae7f /apps/files_encryption
parentd2652645425777c1a97f8421e51aad9bdcf39684 (diff)
parent8a5dec777553eab92c6ddf7a5a131b47761f1e28 (diff)
downloadnextcloud-server-1202ab9995e2fa2293bfb8017fc58ca6daa4fba2.tar.gz
nextcloud-server-1202ab9995e2fa2293bfb8017fc58ca6daa4fba2.zip
Merge branch 'master' into file_encryption_external_storage_fixes
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/hooks/hooks.php8
-rw-r--r--apps/files_encryption/l10n/et_EE.php5
-rw-r--r--apps/files_encryption/l10n/pt_PT.php8
-rw-r--r--apps/files_encryption/lib/proxy.php8
-rw-r--r--apps/files_encryption/lib/session.php24
-rw-r--r--apps/files_encryption/lib/stream.php2
-rw-r--r--apps/files_encryption/lib/util.php2
-rwxr-xr-xapps/files_encryption/tests/crypt.php4
-rwxr-xr-xapps/files_encryption/tests/util.php6
9 files changed, 36 insertions, 31 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 4fc8fa75709..dd51a75f8f8 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -57,7 +57,7 @@ class Hooks {
$privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, $params['password'] );
- $session = new Session( $view );
+ $session = new \OCA\Encryption\Session( $view );
$session->setPrivateKey( $privateKey, $params['uid'] );
@@ -151,7 +151,7 @@ class Hooks {
$view = new \OC_FilesystemView('/');
- $session = new Session($view);
+ $session = new \OCA\Encryption\Session($view);
// Get existing decrypted private key
$privateKey = $session->getPrivateKey();
@@ -266,7 +266,7 @@ class Hooks {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
$view = new \OC_FilesystemView('/');
- $session = new Session($view);
+ $session = new \OCA\Encryption\Session($view);
$userId = \OCP\User::getUser();
$util = new Util($view, $userId);
$path = $util->fileIdToPath($params['itemSource']);
@@ -451,7 +451,7 @@ class Hooks {
\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/l10n/et_EE.php b/apps/files_encryption/l10n/et_EE.php
index c8d5361c08a..daa0b118821 100644
--- a/apps/files_encryption/l10n/et_EE.php
+++ b/apps/files_encryption/l10n/et_EE.php
@@ -1,4 +1,7 @@
<?php $TRANSLATIONS = array(
"Saving..." => "Salvestamine...",
-"Encryption" => "Krüpteerimine"
+"Encryption" => "Krüpteerimine",
+"Enabled" => "Sisse lülitatud",
+"Disabled" => "Väljalülitatud",
+"Change Password" => "Muuda parooli"
);
diff --git a/apps/files_encryption/l10n/pt_PT.php b/apps/files_encryption/l10n/pt_PT.php
index be75c0b768a..94c8d5bafa4 100644
--- a/apps/files_encryption/l10n/pt_PT.php
+++ b/apps/files_encryption/l10n/pt_PT.php
@@ -1,4 +1,10 @@
<?php $TRANSLATIONS = array(
+"Could not " => "Não foi possivel",
+"Password successfully changed." => "Password alterada com sucesso.",
+"Could not change the password. Maybe the old password was not correct." => "Não foi possivel alterar a password. Possivelmente a password antiga não está correcta.",
"Saving..." => "A guardar...",
-"Encryption" => "Encriptação"
+"Encryption" => "Encriptação",
+"Enabled" => "Activado",
+"Disabled" => "Desactivado",
+"Change Password" => "Mudar a Password"
);
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index d9520810bf4..e381ecab5c3 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -111,7 +111,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
@@ -197,7 +197,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 (
@@ -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() );
@@ -439,7 +439,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 1551275c63f..d60c386fb1c 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;
@@ -122,8 +122,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;
}
@@ -137,7 +137,7 @@ class Session
*/
public function setPublicSharePrivateKey($privateKey) {
- $_SESSION['publicSharePrivateKey'] = $privateKey;
+ \OC::$session->set('publicSharePrivateKey', $privateKey);
return true;
@@ -150,12 +150,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;
}
-
}
@@ -166,7 +165,7 @@ class Session
*/
public function setLegacyKey( $legacyKey ) {
- $_SESSION['legacyKey'] = $legacyKey;
+ \OC::$session->set('legacyKey', $legacyKey);
return true;
}
@@ -178,12 +177,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 {
@@ -193,4 +189,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 fa9df02f085..da8c2494139 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 64d7e9e5842..218e58c3402 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);
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index e9f155e2649..5b0486aad8c 100755
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
@@ -270,7 +270,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$shareKey = Encryption\Keymanager::getShareKey($this->view, $this->userId, $filename);
// get session
- $session = new Encryption\Session($this->view);
+ $session = new \OCA\Encryption\Session($this->view);
// get private key
$privateKey = $session->getPrivateKey($this->userId);
@@ -345,7 +345,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$shareKey = Encryption\Keymanager::getShareKey($this->view, $this->userId, $filename);
// get session
- $session = new Encryption\Session($this->view);
+ $session = new \OCA\Encryption\Session($this->view);
// get private key
$privateKey = $session->getPrivateKey($this->userId);
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
+}