fix checkstyle for files_encryption app, add whitespace for readability

This commit is contained in:
Jörn Friedrich Dreyer 2012-11-29 18:41:32 +01:00
parent 3b83fe1530
commit df21ebeaf7
8 changed files with 76 additions and 64 deletions

View File

@ -10,7 +10,9 @@ OCP\Util::connectHook('OC_User', 'post_login', 'OC_Crypt', 'loginListener');
stream_wrapper_register('crypt', 'OC_CryptStream');
if(!isset($_SESSION['enckey']) and OCP\User::isLoggedIn()) {//force the user to re-loggin if the encryption key isn't unlocked (happens when a user is logged in before the encryption app is enabled)
// force the user to re-loggin if the encryption key isn't unlocked
// (happens when a user is logged in before the encryption app is enabled)
if ( ! isset($_SESSION['enckey']) and OCP\User::isLoggedIn()) {
OCP\User::logout();
header("Location: ".OC::$WEBROOT.'/');
exit();

View File

@ -27,7 +27,8 @@
// - Setting if crypto should be on by default
// - Add a setting "Don´t encrypt files larger than xx because of performance reasons"
// - Transparent decrypt/encrypt in filesystem.php. Autodetect if a file is encrypted (.encrypted extension)
// - Don't use a password directly as encryption key. but a key which is stored on the server and encrypted with the user password. -> password change faster
// - Don't use a password directly as encryption key, but a key which is stored on the server and encrypted with the
// user password. -> password change faster
// - IMPORTANT! Check if the block lenght of the encrypted data stays the same

View File

@ -23,7 +23,8 @@
/**
* transparently encrypted filestream
*
* you can use it as wrapper around an existing stream by setting OC_CryptStream::$sourceStreams['foo']=array('path'=>$path, 'stream'=>$stream)
* you can use it as wrapper around an existing stream by setting
* OC_CryptStream::$sourceStreams['foo']=array('path'=>$path, 'stream'=>$stream)
* and then fopen('crypt://streams/foo');
*/
@ -79,7 +80,9 @@ class OC_CryptStream{
//This makes this function a lot simpler but will breake everything the moment it's fixed
$this->writeCache='';
if ($count!=8192) {
OCP\Util::writeLog('files_encryption', 'php bug 21641 no longer holds, decryption will not work', OCP\Util::FATAL);
OCP\Util::writeLog('files_encryption',
'php bug 21641 no longer holds, decryption will not work',
OCP\Util::FATAL);
die();
}
$pos=ftell($this->source);

View File

@ -42,7 +42,9 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
return false;
}
if (is_null(self::$blackList)) {
self::$blackList=explode(',', OCP\Config::getAppValue('files_encryption', 'type_blacklist', 'jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
self::$blackList=explode(',', OCP\Config::getAppValue('files_encryption',
'type_blacklist',
'jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
}
if (self::isEncrypted($path)) {
return true;

View File

@ -7,7 +7,9 @@
*/
$tmpl = new OCP\Template( 'files_encryption', 'settings');
$blackList=explode(',', OCP\Config::getAppValue('files_encryption', 'type_blacklist', 'jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
$blackList=explode(',', OCP\Config::getAppValue('files_encryption',
'type_blacklist',
'jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg'));
$enabled=(OCP\Config::getAppValue('files_encryption', 'enable_encryption', 'true')=='true');
$tmpl->assign('blacklist', $blackList);
$tmpl->assign('encryption_enabled', $enabled);

View File

@ -1,12 +1,14 @@
<form id="calendar">
<fieldset class="personalblock">
<strong><?php echo $l->t('Encryption'); ?></strong>
<?php echo $l->t("Exclude the following file types from encryption"); ?>
<?php echo $l->t('Exclude the following file types from encryption'); ?>
<select id='encryption_blacklist' title="<?php echo $l->t('None')?>" multiple="multiple">
<?php foreach($_["blacklist"] as $type): ?>
<?php foreach ($_['blacklist'] as $type): ?>
<option selected="selected" value="<?php echo $type;?>"><?php echo $type;?></option>
<?php endforeach;?>
</select>
<input type='checkbox' id='enable_encryption' <?php if($_['encryption_enabled']) {echo 'checked="checked"';} ?>></input><label for='enable_encryption'><?php echo $l->t('Enable Encryption')?></label>
<input type='checkbox'<?php if ($_['encryption_enabled']): ?> checked="checked"<?php endif; ?>
id='enable_encryption' ></input>
<label for='enable_encryption'><?php echo $l->t('Enable Encryption')?></label>
</fieldset>
</form>