]> source.dussan.org Git - nextcloud-server.git/commitdiff
add the option to disable file encryption while still being able to decrypt existing...
authorRobin Appelman <icewind@owncloud.com>
Thu, 19 Apr 2012 14:36:07 +0000 (16:36 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sun, 22 Apr 2012 19:27:20 +0000 (21:27 +0200)
apps/files_encryption/js/settings.js
apps/files_encryption/lib/proxy.php
apps/files_encryption/settings.php
apps/files_encryption/templates/settings.php

index adbf0c8724582e5cabaa9fde98c523eb9d262d82..37d62265c9439b9991ab8d9ee5f1b20604b00260 100644 (file)
@@ -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
index a0de411a7b692b468caf9074385d35375cf91c0e..e3a106d0d04ac67aef8bbe7619a5e82440fe21ca 100644 (file)
@@ -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)){
index 396ad1ba78d7f28e9374110664dfb07169b2c699..01caefd12490ef632e039f0ab68cde2323941295 100644 (file)
@@ -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');
index 724a03836a8ea37767c8aee32155a4e5d8d19bfc..25b5a06f56ca8a02b76037df690e376f3e5d94a9 100644 (file)
@@ -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>