Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-29 11:21:00 +0400
committerFlorin Peter <github@florin-peter.de>2013-05-29 11:21:00 +0400
commitc398fc59ad870751cee73a2fbef8bc75233a7515 (patch)
treef686bab6d58a62fefd231b8132b5efa0001ba0ec /apps/files_encryption
parent09b54ccb2b01c558b1d9ccad1e335492d97b4fe1 (diff)
parent7c0c6bd779cb73c4fdc9993f6dc78f9dd1138a88 (diff)
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')
-rw-r--r--apps/files_encryption/hooks/hooks.php16
-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.php10
-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, 41 insertions, 36 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 6bac7debea2..955425595ba 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']);
@@ -75,13 +75,13 @@ class Hooks {
$userView->file_exists('encryption.key')
&& $encLegacyKey = $userView->file_get_contents('encryption.key')
) {
-
+
$plainLegacyKey = Crypt::legacyBlockDecrypt($encLegacyKey, $params['password']);
-
+
$session->setLegacyKey($plainLegacyKey);
-
+
}
-
+
// Encrypt existing user files:
// This serves to upgrade old versions of the encryption
// app (see appinfo/spec.txt)
@@ -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();
@@ -268,7 +268,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']);
@@ -442,7 +442,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 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);
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index f5407deef0e..32156eea272 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
+}