add the option to disable file encryption while still being able to decrypt existing files

This commit is contained in:
Robin Appelman 2012-04-19 16:36:07 +02:00
parent 44fa4433bc
commit c5b31b001a
4 changed files with 11 additions and 3 deletions

View 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');
})
})

View 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)){

View 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');

View 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>