diff options
author | Sam Tuke <samtuke@owncloud.com> | 2013-05-07 16:17:38 +0200 |
---|---|---|
committer | Sam Tuke <samtuke@owncloud.com> | 2013-05-07 16:17:38 +0200 |
commit | 4b53f72d0d749cceec7a9fa7be5d8bc6bab722c6 (patch) | |
tree | 017627881e1278752b815148e8b4c5d01ec67227 /apps/files_encryption/ajax | |
parent | b535964006706fc2df1b3e8fb733a62a3351c585 (diff) | |
download | nextcloud-server-4b53f72d0d749cceec7a9fa7be5d8bc6bab722c6.tar.gz nextcloud-server-4b53f72d0d749cceec7a9fa7be5d8bc6bab722c6.zip |
Added facility to manually encrypt all files from personal settings
Added success/fail feedback to personal settings functions
Improved look/layout of personal settings page
Fixed misplaced plain text in ajax scripts
Diffstat (limited to 'apps/files_encryption/ajax')
-rw-r--r-- | apps/files_encryption/ajax/adminrecovery.php | 5 | ||||
-rw-r--r-- | apps/files_encryption/ajax/encryptall.php | 40 | ||||
-rw-r--r-- | apps/files_encryption/ajax/userrecovery.php | 22 |
3 files changed, 51 insertions, 16 deletions
diff --git a/apps/files_encryption/ajax/adminrecovery.php b/apps/files_encryption/ajax/adminrecovery.php index eeeaf4c6ed7..c3c19943c0d 100644 --- a/apps/files_encryption/ajax/adminrecovery.php +++ b/apps/files_encryption/ajax/adminrecovery.php @@ -1,5 +1,3 @@ -setValue( $app, $key, $value ) - <?php /** * Copyright (c) 2013, Sam Tuke <samtuke@owncloud.com> @@ -91,4 +89,5 @@ if ( } -($return) ? OC_JSON::success() : OC_JSON::error();
\ No newline at end of file +// Return success or failure +( $return ) ? \OCP\JSON::success() : \OCP\JSON::error();
\ No newline at end of file diff --git a/apps/files_encryption/ajax/encryptall.php b/apps/files_encryption/ajax/encryptall.php new file mode 100644 index 00000000000..ce613ca4435 --- /dev/null +++ b/apps/files_encryption/ajax/encryptall.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright (c) 2013, Sam Tuke <samtuke@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + * + * @brief Script to handle manual trigger of \OCA\Encryption\Util{}->encryptAll() + */ + +use OCA\Encryption; + +\OCP\JSON::checkAppEnabled( 'files_encryption' ); +\OCP\JSON::callCheck(); + +$return = false; + +if ( + isset( $_POST['encryptAll'] ) + && ! empty( $_POST['userPassword'] ) +) { + + $view = new \OC_FilesystemView( '' ); + $userId = \OCP\User::getUser(); + $util = new \OCA\Encryption\Util( $view, $userId ); + $session = new \OCA\Encryption\Session( $view ); + $publicKey = \OCA\Encryption\Keymanager::getPublicKey( $view, $userId ); + $path = '/' . $userId . '/' . 'files'; + + $util->encryptAll( $publicKey, $path, $session->getLegacyKey(), $_POST['userPassword'] ); + + $return = true; + +} else { + + $return = false; + +} + +// Return success or failure +( $return ) ? \OCP\JSON::success() : \OCP\JSON::error();
\ No newline at end of file diff --git a/apps/files_encryption/ajax/userrecovery.php b/apps/files_encryption/ajax/userrecovery.php index f72be3181ef..85a799011d7 100644 --- a/apps/files_encryption/ajax/userrecovery.php +++ b/apps/files_encryption/ajax/userrecovery.php @@ -1,5 +1,3 @@ -setValue( $app, $key, $value ) - <?php /** * Copyright (c) 2013, Sam Tuke <samtuke@owncloud.com> @@ -13,6 +11,7 @@ use OCA\Encryption; \OCP\JSON::checkLoggedIn(); \OCP\JSON::checkAppEnabled( 'files_encryption' ); +\OCP\JSON::callCheck(); if ( isset( $_POST['userEnableRecovery'] ) @@ -24,16 +23,13 @@ if ( $util = new \OCA\Encryption\Util( $view, $userId ); // Save recovery preference to DB - $result = $util->setRecoveryForUser( $_POST['userEnableRecovery'] ); - - if ( $result ) { - - \OCP\JSON::success(); - - } else { + $return = $util->setRecoveryForUser( $_POST['userEnableRecovery'] ); - \OCP\JSON::error(); - - } +} else { + + $return = false; -}
\ No newline at end of file +} + +// Return success or failure +( $return ) ? \OCP\JSON::success() : \OCP\JSON::error();
\ No newline at end of file |