diff options
Diffstat (limited to 'apps/files_encryption')
-rw-r--r-- | apps/files_encryption/lib/crypt.php | 4 | ||||
-rw-r--r-- | apps/files_encryption/lib/cryptstream.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/proxy.php | 8 | ||||
-rw-r--r-- | apps/files_encryption/settings.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/tests/encryption.php | 4 | ||||
-rw-r--r-- | apps/files_encryption/tests/proxy.php | 8 | ||||
-rw-r--r-- | apps/files_encryption/tests/stream.php | 20 |
7 files changed, 24 insertions, 24 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 38d8edf28c3..d057c1ed194 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -151,7 +151,7 @@ class OC_Crypt { */ public static function encryptFile( $source, $target, $key='') { $handleread = fopen($source, "rb"); - if($handleread!=FALSE) { + if($handleread!=false) { $handlewrite = fopen($target, "wb"); while (!feof($handleread)) { $content = fread($handleread, 8192); @@ -174,7 +174,7 @@ class OC_Crypt { */ public static function decryptFile( $source, $target, $key='') { $handleread = fopen($source, "rb"); - if($handleread!=FALSE) { + if($handleread!=false) { $handlewrite = fopen($target, "wb"); while (!feof($handleread)) { $content = fread($handleread, 8192); diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php index 721a1b955df..95b58b8cce7 100644 --- a/apps/files_encryption/lib/cryptstream.php +++ b/apps/files_encryption/lib/cryptstream.php @@ -167,7 +167,7 @@ class OC_CryptStream{ public function stream_close() { $this->flush(); if($this->meta['mode']!='r' and $this->meta['mode']!='rb') { - OC_FileCache::put($this->path,array('encrypted'=>true,'size'=>$this->size),''); + OC_FileCache::put($this->path, array('encrypted'=>true,'size'=>$this->size),''); } return fclose($this->source); } diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index f61cd1e3773..61b87ab5463 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -42,13 +42,13 @@ 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; } - $extension=substr($path,strrpos($path,'.')+1); - if(array_search($extension,self::$blackList)===false) { + $extension=substr($path, strrpos($path, '.')+1); + if(array_search($extension, self::$blackList)===false) { return true; } } @@ -68,7 +68,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ if (!is_resource($data)) {//stream put contents should have been converter to fopen $size=strlen($data); $data=OC_Crypt::blockEncrypt($data); - OC_FileCache::put($path,array('encrypted'=>true,'size'=>$size),''); + OC_FileCache::put($path, array('encrypted'=>true,'size'=>$size),''); } } } diff --git a/apps/files_encryption/settings.php b/apps/files_encryption/settings.php index 0a0d4d1abba..168124a8d22 100644 --- a/apps/files_encryption/settings.php +++ b/apps/files_encryption/settings.php @@ -7,7 +7,7 @@ */ $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); diff --git a/apps/files_encryption/tests/encryption.php b/apps/files_encryption/tests/encryption.php index 89397f6ef2c..a7bc2df0e12 100644 --- a/apps/files_encryption/tests/encryption.php +++ b/apps/files_encryption/tests/encryption.php @@ -19,7 +19,7 @@ class Test_Encryption extends UnitTestCase { $chunk=substr($source,0,8192); $encrypted=OC_Crypt::encrypt($chunk,$key); - $this->assertEqual(strlen($chunk),strlen($encrypted)); + $this->assertEqual(strlen($chunk), strlen($encrypted)); $decrypted=OC_Crypt::decrypt($encrypted,$key); $decrypted=rtrim($decrypted, "\0"); $this->assertEqual($decrypted,$chunk); @@ -66,7 +66,7 @@ class Test_Encryption extends UnitTestCase { $this->assertEqual($decrypted,$source); $encrypted=OC_Crypt::blockEncrypt($source,$key); - $decrypted=OC_Crypt::blockDecrypt($encrypted,$key,strlen($source)); + $decrypted=OC_Crypt::blockDecrypt($encrypted,$key, strlen($source)); $this->assertEqual($decrypted,$source); } } diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php index 042011a6c87..c3c8f4a2db0 100644 --- a/apps/files_encryption/tests/proxy.php +++ b/apps/files_encryption/tests/proxy.php @@ -30,7 +30,7 @@ class Test_CryptProxy extends UnitTestCase { //set up temporary storage OC_Filesystem::clearMounts(); - OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/'); + OC_Filesystem::mount('OC_Filestorage_Temporary', array(),'/'); OC_Filesystem::init('/'.$user.'/files'); @@ -59,7 +59,7 @@ class Test_CryptProxy extends UnitTestCase { $fromFile=OC_Filesystem::file_get_contents('/file'); $this->assertNotEqual($original,$stored); - $this->assertEqual(strlen($original),strlen($fromFile)); + $this->assertEqual(strlen($original), strlen($fromFile)); $this->assertEqual($original,$fromFile); } @@ -98,7 +98,7 @@ class Test_CryptProxy extends UnitTestCase { $fromFile=OC_Filesystem::file_get_contents('/file'); $this->assertNotEqual($original,$stored); - $this->assertEqual(strlen($original),strlen($fromFile)); + $this->assertEqual(strlen($original), strlen($fromFile)); $this->assertEqual($original,$fromFile); $file=__DIR__.'/zeros'; @@ -112,6 +112,6 @@ class Test_CryptProxy extends UnitTestCase { $fromFile=OC_Filesystem::file_get_contents('/file'); $this->assertNotEqual($original,$stored); - $this->assertEqual(strlen($original),strlen($fromFile)); + $this->assertEqual(strlen($original), strlen($fromFile)); } } diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php index 39b13620782..5ea0da48017 100644 --- a/apps/files_encryption/tests/stream.php +++ b/apps/files_encryption/tests/stream.php @@ -10,11 +10,11 @@ class Test_CryptStream extends UnitTestCase { private $tmpFiles=array(); function testStream() { - $stream=$this->getStream('test1','w',strlen('foobar')); + $stream=$this->getStream('test1','w', strlen('foobar')); fwrite($stream,'foobar'); fclose($stream); - $stream=$this->getStream('test1','r',strlen('foobar')); + $stream=$this->getStream('test1','r', strlen('foobar')); $data=fread($stream,6); fclose($stream); $this->assertEqual('foobar',$data); @@ -26,10 +26,10 @@ class Test_CryptStream extends UnitTestCase { fclose($target); fclose($source); - $stream=$this->getStream('test2','r',filesize($file)); + $stream=$this->getStream('test2','r', filesize($file)); $data=stream_get_contents($stream); $original=file_get_contents($file); - $this->assertEqual(strlen($original),strlen($data)); + $this->assertEqual(strlen($original), strlen($data)); $this->assertEqual($original,$data); } @@ -59,27 +59,27 @@ class Test_CryptStream extends UnitTestCase { $file=__DIR__.'/binary'; $source=file_get_contents($file); - $stream=$this->getStream('test','w',strlen($source)); + $stream=$this->getStream('test','w', strlen($source)); fwrite($stream,$source); fclose($stream); - $stream=$this->getStream('test','r',strlen($source)); + $stream=$this->getStream('test','r', strlen($source)); $data=stream_get_contents($stream); fclose($stream); - $this->assertEqual(strlen($data),strlen($source)); + $this->assertEqual(strlen($data), strlen($source)); $this->assertEqual($source,$data); $file=__DIR__.'/zeros'; $source=file_get_contents($file); - $stream=$this->getStream('test2','w',strlen($source)); + $stream=$this->getStream('test2','w', strlen($source)); fwrite($stream,$source); fclose($stream); - $stream=$this->getStream('test2','r',strlen($source)); + $stream=$this->getStream('test2','r', strlen($source)); $data=stream_get_contents($stream); fclose($stream); - $this->assertEqual(strlen($data),strlen($source)); + $this->assertEqual(strlen($data), strlen($source)); $this->assertEqual($source,$data); } } |