summaryrefslogtreecommitdiffstats
path: root/settings/ajax
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2013-08-19 11:24:17 +0200
committerGeorg Ehrke <developer@georgehrke.com>2013-08-19 11:24:17 +0200
commitf2702ff1ca45d72300eed5dfa58ebc19aa6e9910 (patch)
treeb1424be17877cbd25bf3781600d353efd3dd0759 /settings/ajax
parent7e4dcd268f6cb6618600718a51c4d882e9027829 (diff)
parent9be836814cb4165ea54a086a0f97526d783bcd37 (diff)
downloadnextcloud-server-f2702ff1ca45d72300eed5dfa58ebc19aa6e9910.tar.gz
nextcloud-server-f2702ff1ca45d72300eed5dfa58ebc19aa6e9910.zip
Merge master into oc_preview
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/decryptall.php25
-rw-r--r--settings/ajax/getlog.php2
-rw-r--r--settings/ajax/setsecurity.php2
-rw-r--r--settings/ajax/updateapp.php2
4 files changed, 28 insertions, 3 deletions
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
new file mode 100644
index 00000000000..e53067931e8
--- /dev/null
+++ b/settings/ajax/decryptall.php
@@ -0,0 +1,25 @@
+<?php
+
+//encryption app needs to be loaded
+OC_App::loadApp('files_encryption');
+
+// init encryption app
+$params = array('uid' => \OCP\User::getUser(),
+ 'password' => $_POST['password']);
+
+$view = new OC_FilesystemView('/');
+$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
+
+$result = $util->initEncryption($params);
+
+if ($result !== false) {
+ $successful = $util->decryptAll();
+ if ($successful === true) {
+ \OCP\JSON::success(array('data' => array('message' => 'Files decrypted successfully')));
+ } else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt your files, please check your owncloud.log or ask your administrator')));
+ }
+} else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt your files, check your password and try again')));
+}
+
diff --git a/settings/ajax/getlog.php b/settings/ajax/getlog.php
index e7151419286..34c8d3ce467 100644
--- a/settings/ajax/getlog.php
+++ b/settings/ajax/getlog.php
@@ -16,6 +16,6 @@ $data = array();
OC_JSON::success(
array(
"data" => $entries,
- "remain"=>(count(OC_Log_Owncloud::getEntries(1, $offset + $count)) !== 0) ? true : false
+ "remain" => count(OC_Log_Owncloud::getEntries(1, $offset + $count)) !== 0,
)
);
diff --git a/settings/ajax/setsecurity.php b/settings/ajax/setsecurity.php
index 16a85aade81..675d7eced47 100644
--- a/settings/ajax/setsecurity.php
+++ b/settings/ajax/setsecurity.php
@@ -10,4 +10,4 @@ OCP\JSON::callCheck();
OC_Config::setValue( 'forcessl', filter_var($_POST['enforceHTTPS'], FILTER_VALIDATE_BOOLEAN));
-echo 'true'; \ No newline at end of file
+echo 'true';
diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php
index 300e8642515..91c342d5d07 100644
--- a/settings/ajax/updateapp.php
+++ b/settings/ajax/updateapp.php
@@ -12,4 +12,4 @@ if($result !== false) {
} else {
$l = OC_L10N::get('settings');
OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") )));
-} \ No newline at end of file
+}