summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-04-19 16:36:07 +0200
committerRobin Appelman <icewind@owncloud.com>2012-04-22 21:27:20 +0200
commitc5b31b001a12e4035555c6b507b6347bce90e272 (patch)
treed3e4e4cc1b22c171e4a2362cd97b8c2aa7f605bc
parent44fa4433bc4bda437bf6c88a5020af075fb797d8 (diff)
downloadnextcloud-server-c5b31b001a12e4035555c6b507b6347bce90e272.tar.gz
nextcloud-server-c5b31b001a12e4035555c6b507b6347bce90e272.zip
add the option to disable file encryption while still being able to decrypt existing files
-rw-r--r--apps/files_encryption/js/settings.js5
-rw-r--r--apps/files_encryption/lib/proxy.php6
-rw-r--r--apps/files_encryption/settings.php2
-rw-r--r--apps/files_encryption/templates/settings.php1
4 files changed, 11 insertions, 3 deletions
diff --git a/apps/files_encryption/js/settings.js b/apps/files_encryption/js/settings.js
index adbf0c87245..37d62265c94 100644
--- a/apps/files_encryption/js/settings.js
+++ b/apps/files_encryption/js/settings.js
@@ -16,4 +16,9 @@ $(document).ready(function(){
var blackList=$('#encryption_blacklist').val().join(',');
OC.AppConfig.setValue('files_encryption','type_blacklist',blackList);
}
+
+ $('#enbale_encryption').change(function(){
+ var checked=$('#enbale_encryption').is(':checked');
+ OC.AppConfig.setValue('files_encryption','enable_encryption',(checked)?'true':'false');
+ })
}) \ No newline at end of file
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index a0de411a7b6..e3a106d0d04 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -36,10 +36,10 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
* @return bool
*/
private static function shouldEncrypt($path){
- if(is_null($this->enableEncryption)){
- $this->enableEncryption=(OC_Appconfig::getValue('files_encryption','enabled','true')=='true');
+ if(is_null(self::$enableEncryption)){
+ self::$enableEncryption=(OC_Appconfig::getValue('files_encryption','enable_encryption','true')=='true');
}
- if(!$this->enableEncryption){
+ if(!self::$enableEncryption){
return false;
}
if(is_null(self::$blackList)){
diff --git a/apps/files_encryption/settings.php b/apps/files_encryption/settings.php
index 396ad1ba78d..01caefd1249 100644
--- a/apps/files_encryption/settings.php
+++ b/apps/files_encryption/settings.php
@@ -8,7 +8,9 @@
$tmpl = new OC_Template( 'files_encryption', 'settings');
$blackList=explode(',',OC_Appconfig::getValue('files_encryption','type_blacklist','jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
+$enabled=(OC_Appconfig::getValue('files_encryption','enable_encryption','true')=='true');
$tmpl->assign('blacklist',$blackList);
+$tmpl->assign('encryption_enabled',$enabled);
OC_Util::addScript('files_encryption','settings');
OC_Util::addScript('core','multiselect');
diff --git a/apps/files_encryption/templates/settings.php b/apps/files_encryption/templates/settings.php
index 724a03836a8..25b5a06f56c 100644
--- a/apps/files_encryption/templates/settings.php
+++ b/apps/files_encryption/templates/settings.php
@@ -7,5 +7,6 @@
<option selected="selected" value="<?php echo $type;?>"><?php echo $type;?></option>
<?php endforeach;?>
</select>
+ <input type='checkbox' id='enbale_encryption' <?php if($_['encryption_enabled']){echo 'checked="checked"';} ?>></input><label for='enbale_encryption'><?php echo $l->t('Enable Encryption')?></label>
</fieldset>
</form>