summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-08-12 17:25:27 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-08-12 17:25:27 +0200
commit53bb89824deaf97095acf6bcc2997aa7141dd573 (patch)
tree8d1ef8a3d2d71295480c1da221fdf514097e9f1e
parent0bab8935c95c249405f5b12f4724d189c4ec648b (diff)
downloadnextcloud-server-53bb89824deaf97095acf6bcc2997aa7141dd573.tar.gz
nextcloud-server-53bb89824deaf97095acf6bcc2997aa7141dd573.zip
check if some encrypted files are left after the app was disabled and warn the user
-rw-r--r--apps/files/index.php1
-rw-r--r--apps/files/js/files.js14
-rw-r--r--apps/files/templates/index.php1
-rw-r--r--lib/public/util.php8
-rwxr-xr-xlib/util.php17
-rw-r--r--settings/personal.php8
6 files changed, 42 insertions, 7 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 2f005391509..57171ac3b5a 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -143,5 +143,6 @@ if ($needUpgrade) {
$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
$tmpl->assign('isPublic', false);
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
+ $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
$tmpl->printPage();
}
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 98fc53b71a9..d6886fc17e4 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -81,9 +81,23 @@ Files={
if (usedSpacePercent > 90) {
OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)', {usedSpacePercent: usedSpacePercent}));
}
+ },
+
+ displayEncryptionWarning: function() {
+
+ if (!OC.Notification.isHidden()) {
+ return;
+ }
+
+ var encryptedFiles = $('#encryptedFiles').val();
+ if (encryptedFiles === '1') {
+ OC.Notification.show(t('files_encryption', 'Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files.', "www.schiessle.org"));
+ return;
+ }
}
};
$(document).ready(function() {
+ Files.displayEncryptionWarning();
Files.bindKeyboardShortcuts(document, jQuery);
$('#fileList tr').each(function(){
//little hack to set unescape filenames in attribute
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index e0731609368..72bc1e937cc 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -121,3 +121,4 @@
<!-- config hints for javascript -->
<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php p($_['allowZipDownload']); ?>" />
<input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" />
+<input type="hidden" name="encryptedFiles" id="encryptedFiles" value="<?php $_['encryptedFiles'] ? p('1') : p('0'); ?>" />
diff --git a/lib/public/util.php b/lib/public/util.php
index 693805946ea..b33f07b55e6 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -123,6 +123,14 @@ class Util {
}
/**
+ * @brief check if some encrypted files are stored
+ * @return bool
+ */
+ public static function encryptedFiles() {
+ return \OC_Util::encryptedFiles();
+ }
+
+ /**
* @brief Creates an absolute url
* @param string $app app
* @param string $file file
diff --git a/lib/util.php b/lib/util.php
index 2586ad28320..cc432af62af 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -313,6 +313,23 @@ class OC_Util {
}
/**
+ * @brief check if there are still some encrypted files stored
+ * @return boolean
+ */
+ public static function encryptedFiles() {
+ //check if encryption was enabled in the past
+ $encryptedFiles = false;
+ if (OC_App::isEnabled('files_encryption') === false) {
+ $view = new OC\Files\View('/' . OCP\User::getUser());
+ if ($view->file_exists('/files_encryption/keyfiles')) {
+ $encryptedFiles = true;
+ }
+ }
+
+ return $encryptedFiles;
+ }
+
+ /**
* Check for correct file permissions of data directory
* @return array arrays with error messages and hints
*/
diff --git a/settings/personal.php b/settings/personal.php
index bad19ba03ce..e69898f6f8f 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -25,13 +25,7 @@ $userLang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N:
$languageCodes=OC_L10N::findAvailableLanguages();
//check if encryption was enabled in the past
-$enableDecryptAll = false;
-if (OC_App::isEnabled('files_encryption') === false) {
- $view = new OC\Files\View('/'.OCP\User::getUser());
- if($view->file_exists('/files_encryption/keyfiles')) {
- $enableDecryptAll = true;
- }
-}
+$enableDecryptAll = OC_Util::encryptedFiles();
// array of common languages
$commonlangcodes = array(