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 | |
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')
-rw-r--r-- | apps/files/l10n/pt_PT.php | 1 | ||||
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 16 | ||||
-rw-r--r-- | apps/files_encryption/l10n/et_EE.php | 5 | ||||
-rw-r--r-- | apps/files_encryption/l10n/pt_PT.php | 8 | ||||
-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 | ||||
-rwxr-xr-x | apps/files_encryption/tests/crypt.php | 4 | ||||
-rwxr-xr-x | apps/files_encryption/tests/util.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/public.php | 6 |
11 files changed, 45 insertions, 39 deletions
diff --git a/apps/files/l10n/pt_PT.php b/apps/files/l10n/pt_PT.php index 15d6fc80bd3..d90e2999702 100644 --- a/apps/files/l10n/pt_PT.php +++ b/apps/files/l10n/pt_PT.php @@ -46,6 +46,7 @@ "{count} folders" => "{count} pastas", "1 file" => "1 ficheiro", "{count} files" => "{count} ficheiros", +"Invalid folder name. Usage of 'Shared' is reserved by ownCloud" => "Nome da pasta inválido. Palavra 'Shared' é reservado pela ownCloud", "Unable to rename file" => "Não foi possível renomear o ficheiro", "Upload" => "Carregar", "File handling" => "Manuseamento de ficheiros", 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 +} 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'); |