From 926b2b78fe444f5facfb21a625a6cd01123d2fb2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 14 Apr 2012 16:27:58 +0200 Subject: keep version numbers in their own files for faster reading --- apps/files_encryption/appinfo/info.xml | 1 - apps/files_encryption/appinfo/version | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 apps/files_encryption/appinfo/version (limited to 'apps/files_encryption') diff --git a/apps/files_encryption/appinfo/info.xml b/apps/files_encryption/appinfo/info.xml index 691b265bf60..c2e1aa96043 100644 --- a/apps/files_encryption/appinfo/info.xml +++ b/apps/files_encryption/appinfo/info.xml @@ -3,7 +3,6 @@ files_encryption Encryption Server side encryption of files - 0.1 AGPL Robin Appelman 3 diff --git a/apps/files_encryption/appinfo/version b/apps/files_encryption/appinfo/version new file mode 100644 index 00000000000..ceab6e11ece --- /dev/null +++ b/apps/files_encryption/appinfo/version @@ -0,0 +1 @@ +0.1 \ No newline at end of file -- cgit v1.2.3 From 7ddd0434270fa1cc51769e812f257cf63b0ec92f Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sun, 15 Apr 2012 13:32:45 +0200 Subject: renamed extention to extension, also now only showing lowercase --- apps/files_archive/lib/tar.php | 4 ++-- apps/files_encryption/lib/proxy.php | 4 ++-- apps/files_sharing/get.php | 2 +- apps/media/js/loader.js | 6 +++--- apps/media/js/music.js | 6 +++--- apps/media/lib_scanner.php | 2 +- core/js/js.js | 4 ++-- files/css/files.css | 6 +++--- files/index.php | 4 ++-- files/js/filelist.js | 10 +++++----- files/templates/part.list.php | 2 +- lib/filestorage/common.php | 12 ++++++------ lib/helper.php | 12 ++++++------ lib/mimetypes.list.php | 2 +- lib/template.php | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) (limited to 'apps/files_encryption') diff --git a/apps/files_archive/lib/tar.php b/apps/files_archive/lib/tar.php index a5d54004788..1eed11a762d 100644 --- a/apps/files_archive/lib/tar.php +++ b/apps/files_archive/lib/tar.php @@ -30,8 +30,8 @@ class OC_Archive_TAR extends OC_Archive{ */ static public function getTarType($file){ if(strpos($file,'.')){ - $extention=substr($file,strrpos($file,'.')); - switch($extention){ + $extension=substr($file,strrpos($file,'.')); + switch($extension){ case 'gz': case 'tgz': return self::GZIP; diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index c1c26d7754f..c68df06f9fa 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -41,8 +41,8 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ if(self::isEncrypted($path)){ return true; } - $extention=substr($path,strrpos($path,'.')+1); - if(array_search($extention,self::$blackList)===false){ + $extension=substr($path,strrpos($path,'.')+1); + if(array_search($extension,self::$blackList)===false){ return true; } } diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index fa3535fd144..3e42bf6a6c7 100644 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -31,7 +31,7 @@ if ($source !== false) { if ($i['type'] == 'file') { $fileinfo = pathinfo($i['name']); $i['basename'] = $fileinfo['filename']; - $i['extention'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; + $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; } $i['directory'] = substr($i['directory'], $rootLength); if ($i['directory'] == "/") { diff --git a/apps/media/js/loader.js b/apps/media/js/loader.js index 514965666fa..393f8ba914e 100644 --- a/apps/media/js/loader.js +++ b/apps/media/js/loader.js @@ -1,10 +1,10 @@ function musicTypeFromFile(file){ - var extention=file.substr(file.indexOf('.')+1).toLowerCase(); - if(extention=='ogg'){ + var extension=file.substr(file.indexOf('.')+1).toLowerCase(); + if(extension=='ogg'){ return 'oga'; } //TODO check for more specific cases - return extention; + return extension; } function playAudio(filename){ diff --git a/apps/media/js/music.js b/apps/media/js/music.js index f93f0fded62..db129227626 100644 --- a/apps/media/js/music.js +++ b/apps/media/js/music.js @@ -48,10 +48,10 @@ function getUrlVars(){ } function musicTypeFromFile(file){ - var extention=file.split('.').pop().toLowerCase(); - if(extention=='ogg'){ + var extension=file.split('.').pop().toLowerCase(); + if(extension=='ogg'){ return 'oga'; } //TODO check for more specific cases - return extention; + return extension; } diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php index 341f411bdb8..78c6ad491da 100644 --- a/apps/media/lib_scanner.php +++ b/apps/media/lib_scanner.php @@ -127,7 +127,7 @@ class OC_MEDIA_SCANNER{ } /** - * quick check if a song is a music file by checking the extention, not as good as a proper mimetype check but way faster + * quick check if a song is a music file by checking the extension, not as good as a proper mimetype check but way faster * @param string $filename * @return bool */ diff --git a/core/js/js.js b/core/js/js.js index 2e65dfac507..51dcbe5413e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -69,10 +69,10 @@ OC={ * @param file the name of the image file * @return string * - * if no extention is given for the image, it will automatically decide between .png and .svg based on what the browser supports + * if no extension is given for the image, it will automatically decide between .png and .svg based on what the browser supports */ imagePath:function(app,file){ - if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support + if(file.indexOf('.')==-1){//if no extension is given, use png or svg depending on browser support file+=(SVGSupport())?'.svg':'.png'; } return OC.filePath(app,'img',file); diff --git a/files/css/files.css b/files/css/files.css index 03945f030b2..e103f0a7a6c 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -40,9 +40,9 @@ tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#f8f8f8; h tbody tr { background-color:#fff; } tbody tr.selected { background-color:#eee; } tbody a { color:#000; } -span.extention, td.date { color:#999; } -span.extention { opacity:0; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; } -tr:hover span.extention { opacity:1; } +span.extension, td.date { color:#999; } +span.extension { text-transform:lowercase; opacity:0; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; } +tr:hover span.extension { opacity:1; } div.crumb { float:left; display:block; background:no-repeat right 0; padding:.75em 1.5em 0 1em; height:2.9em; } div.crumb:first-child { padding-left:1em; } div.crumb.last { font-weight:bold; } diff --git a/files/index.php b/files/index.php index 82d09608924..aea91542db6 100644 --- a/files/index.php +++ b/files/index.php @@ -51,10 +51,10 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ $fileinfo=pathinfo($i['name']); $i['basename']=$fileinfo['filename']; if (!empty($fileinfo['extension'])) { - $i['extention']='.' . $fileinfo['extension']; + $i['extension']='.' . $fileinfo['extension']; } else { - $i['extention']=''; + $i['extension']=''; } } if($i['directory']=='/'){ diff --git a/files/js/filelist.js b/files/js/filelist.js index 35847e06dfe..533e03b43cd 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -7,15 +7,15 @@ FileList={ var html=''; if(name.indexOf('.')!=-1){ var basename=name.substr(0,name.lastIndexOf('.')); - var extention=name.substr(name.lastIndexOf('.')); + var extension=name.substr(name.lastIndexOf('.')); }else{ var basename=name; - var extention=false; + var extension=false; } html+=''; html+=''+basename - if(extention){ - html+=''+extention+''; + if(extension){ + html+=''+extension+''; } html+=''; if(size!='Pending'){ @@ -147,7 +147,7 @@ FileList={ span.text(basename); td.children('a.name').append(span); if(newname.indexOf('.')>0){ - span.append($(''+newname.substr(newname.lastIndexOf('.'))+'')); + span.append($(''+newname.substr(newname.lastIndexOf('.'))+'')); } $.get(OC.filePath('files','ajax','rename.php'), { dir : $('#dir').val(), newname: newname, file: name },function(){ tr.data('renaming',false); diff --git a/files/templates/part.list.php b/files/templates/part.list.php index b117d81a1a5..5a5941fc7ae 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -18,7 +18,7 @@ - + diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php index f632474df01..f0bfc064cb5 100644 --- a/lib/filestorage/common.php +++ b/lib/filestorage/common.php @@ -100,11 +100,11 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { } $head=fread($source,8192);//8kb should suffice to determine a mimetype if($pos=strrpos($path,'.')){ - $extention=substr($path,$pos); + $extension=substr($path,$pos); }else{ - $extention=''; + $extension=''; } - $tmpFile=OC_Helper::tmpFile($extention); + $tmpFile=OC_Helper::tmpFile($extension); file_put_contents($tmpFile,$head); $mime=OC_Helper::getMimeType($tmpFile); unlink($tmpFile); @@ -129,11 +129,11 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { return false; } if($pos=strrpos($path,'.')){ - $extention=substr($path,$pos); + $extension=substr($path,$pos); }else{ - $extention=''; + $extension=''; } - $tmpFile=OC_Helper::tmpFile($extention); + $tmpFile=OC_Helper::tmpFile($extension); $target=fopen($tmpFile,'w'); $count=OC_Helper::streamCopy($source,$target); return $tmpFile; diff --git a/lib/helper.php b/lib/helper.php index 2026286352a..c33db5f10fe 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -310,9 +310,9 @@ class OC_Helper { $mimeType='application/octet-stream'; if ($mimeType=='application/octet-stream') { self::$mimetypes = include('mimetypes.fixlist.php'); - $extention=strtolower(strrchr(basename($path), ".")); - $extention=substr($extention,1);//remove leading . - $mimeType=(isset(self::$mimetypes[$extention]))?self::$mimetypes[$extention]:'application/octet-stream'; + $extension=strtolower(strrchr(basename($path), ".")); + $extension=substr($extension,1);//remove leading . + $mimeType=(isset(self::$mimetypes[$extension]))?self::$mimetypes[$extension]:'application/octet-stream'; } if (@is_dir($path)) { @@ -346,9 +346,9 @@ class OC_Helper { if(!self::$mimetypes || self::$mimetypes != include('mimetypes.list.php')){ self::$mimetypes=include('mimetypes.list.php'); } - $extention=strtolower(strrchr(basename($path), ".")); - $extention=substr($extention,1);//remove leading . - $mimeType=(isset(self::$mimetypes[$extention]))?self::$mimetypes[$extention]:'application/octet-stream'; + $extension=strtolower(strrchr(basename($path), ".")); + $extension=substr($extension,1);//remove leading . + $mimeType=(isset(self::$mimetypes[$extension]))?self::$mimetypes[$extension]:'application/octet-stream'; } return $mimeType; } diff --git a/lib/mimetypes.list.php b/lib/mimetypes.list.php index e0570e84ea5..ccf47999b1c 100644 --- a/lib/mimetypes.list.php +++ b/lib/mimetypes.list.php @@ -21,7 +21,7 @@ */ /** - * list of mimetypes by extention + * list of mimetypes by extension */ return array( diff --git a/lib/template.php b/lib/template.php index cb39a10df31..eeba2410b68 100644 --- a/lib/template.php +++ b/lib/template.php @@ -161,7 +161,7 @@ class OC_Template{ } /** - * @brief Returns the formfactor extention for current formfactor + * @brief Returns the formfactor extension for current formfactor */ protected function getFormFactorExtension() { -- cgit v1.2.3 From 26e9a0dd139a94d6876df0be49a8d40b8976d65a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 17 Apr 2012 20:56:53 +0200 Subject: bugfixes for encryption library and test cases --- apps/files_encryption/lib/crypt.php | 55 +++++++++++++++--------------- apps/files_encryption/tests/encryption.php | 36 +++++++++++++++++++ 2 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 apps/files_encryption/tests/encryption.php (limited to 'apps/files_encryption') diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 246d4f672db..8cf9451c63c 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -119,7 +119,7 @@ class OC_Crypt { */ public static function encrypt( $content, $key='') { $bf = self::getBlowfish($key); - return($bf->encrypt($content)); + return $bf->encrypt($content); } /** @@ -132,61 +132,62 @@ class OC_Crypt { */ public static function decrypt( $content, $key='') { $bf = self::getBlowfish($key); - return($bf->decrypt($content)); + $data=$bf->decrypt($content); + return rtrim($data, "\0"); } /** * @brief encryption of a file - * @param $filename - * @param $key the encryption key + * @param string $source + * @param string $target + * @param string $key the decryption key * * This function encrypts a file */ - public static function encryptfile( $filename, $key) { - $handleread = fopen($filename, "rb"); - if($handleread<>FALSE) { - $handlewrite = fopen($filename.OC_Crypt::$encription_extension, "wb"); + public static function encryptFile( $source, $target, $key='') { + $handleread = fopen($source, "rb"); + if($handleread!=FALSE) { + $handlewrite = fopen($target, "wb"); while (!feof($handleread)) { $content = fread($handleread, 8192); $enccontent=OC_CRYPT::encrypt( $content, $key); fwrite($handlewrite, $enccontent); } fclose($handlewrite); - unlink($filename); + fclose($handleread); } - fclose($handleread); } - /** - * @brief decryption of a file - * @param $filename - * @param $key the decryption key - * - * This function decrypts a file - */ - public static function decryptfile( $filename, $key) { - $handleread = fopen($filename.OC_Crypt::$encription_extension, "rb"); - if($handleread<>FALSE) { - $handlewrite = fopen($filename, "wb"); + /** + * @brief decryption of a file + * @param string $source + * @param string $target + * @param string $key the decryption key + * + * This function decrypts a file + */ + public static function decryptFile( $source, $target, $key='') { + $handleread = fopen($source, "rb"); + if($handleread!=FALSE) { + $handlewrite = fopen($target, "wb"); while (!feof($handleread)) { $content = fread($handleread, 8192); $enccontent=OC_CRYPT::decrypt( $content, $key); fwrite($handlewrite, $enccontent); } fclose($handlewrite); - unlink($filename.OC_Crypt::$encription_extension); + fclose($handleread); } - fclose($handleread); } /** * encrypt data in 8192b sized blocks */ - public static function blockEncrypt($data){ + public static function blockEncrypt($data, $key=''){ $result=''; while(strlen($data)){ - $result=self::encrypt(substr($data,0,8192)); + $result.=self::encrypt(substr($data,0,8192),$key); $data=substr($data,8192); } return $result; @@ -195,10 +196,10 @@ class OC_Crypt { /** * decrypt data in 8192b sized blocks */ - public static function blockDecrypt($data){ + public static function blockDecrypt($data, $key=''){ $result=''; while(strlen($data)){ - $result=self::decrypt(substr($data,0,8192)); + $result.=self::decrypt(substr($data,0,8192),$key); $data=substr($data,8192); } return $result; diff --git a/apps/files_encryption/tests/encryption.php b/apps/files_encryption/tests/encryption.php new file mode 100644 index 00000000000..140fe6b126d --- /dev/null +++ b/apps/files_encryption/tests/encryption.php @@ -0,0 +1,36 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class Test_Encryption extends UnitTestCase { + function testEncryption(){ + $key=uniqid(); + $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; + $source=file_get_contents($file); //nice large text file + $encrypted=OC_Crypt::encrypt($source,$key); + $decrypted=OC_Crypt::decrypt($encrypted,$key); + $this->assertNotEqual($encrypted,$source); + $this->assertEqual($decrypted,$source); + + $encrypted=OC_Crypt::blockEncrypt($source,$key); + $decrypted=OC_Crypt::blockDecrypt($encrypted,$key); + $this->assertNotEqual($encrypted,$source); + $this->assertEqual($decrypted,$source); + + $tmpFileEncrypted=OC_Helper::tmpFile(); + OC_Crypt::encryptfile($file,$tmpFileEncrypted,$key); + $encrypted=file_get_contents($tmpFileEncrypted); + $decrypted=OC_Crypt::blockDecrypt($encrypted,$key); + $this->assertNotEqual($encrypted,$source); + $this->assertEqual($decrypted,$source); + + $tmpFileDecrypted=OC_Helper::tmpFile(); + OC_Crypt::decryptfile($tmpFileEncrypted,$tmpFileDecrypted,$key); + $decrypted=file_get_contents($tmpFileDecrypted); + $this->assertEqual($decrypted,$source); + } +} -- cgit v1.2.3 From b39c3d4c4edbb9a7fd2be22e2d2684e4185ca0e5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 17 Apr 2012 23:10:14 +0200 Subject: make use of the fact that stream_read will always read 8192 bytes for encryption stream https://bugs.php.net/bug.php?id=21641 --- apps/files_encryption/lib/cryptstream.php | 38 +++++++++------------ apps/files_encryption/tests/stream.php | 56 +++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 apps/files_encryption/tests/stream.php (limited to 'apps/files_encryption') diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php index 86583096f1d..21fa38e4b59 100644 --- a/apps/files_encryption/lib/cryptstream.php +++ b/apps/files_encryption/lib/cryptstream.php @@ -64,29 +64,19 @@ class OC_CryptStream{ } public function stream_read($count){ - $pos=0; - $currentPos=ftell($this->source); - $offset=$currentPos%8192; - $result=''; - if($offset>0){ - if($this->meta['seekable']){ - fseek($this->source,-$offset,SEEK_CUR);//if seeking isnt supported the internal read buffer will be used - }else{ - $pos=strlen($this->readBuffer); - $result=$this->readBuffer; - } + //$count will always be 8192 https://bugs.php.net/bug.php?id=21641 + //This makes this function a lot simpler but will breake everything the moment it's fixed + if($count!=8192){ + OC_Log::write('files_encryption','php bug 21641 no longer holds, decryption will not work',OC_Log::FATAL); + die(); } - while($count>$pos){ - $data=fread($this->source,8192); - $pos+=8192; - if(strlen($data)){ - $result.=OC_Crypt::decrypt($data); - } - } - if(!$this->meta['seekable']){ - $this->readBuffer=substr($result,$count); + $data=fread($this->source,8192); + if(strlen($data)){ + $result=OC_Crypt::decrypt($data); + }else{ + $result=''; } - return substr($result,0,$count); + return $result; } public function stream_write($data){ @@ -107,8 +97,10 @@ class OC_CryptStream{ $oldPos=ftell($this->source); $encryptedBlock=fread($this->source,8192); fseek($this->source,$oldPos); - $block=OC_Crypt::decrypt($encryptedBlock); - $data.=substr($block,strlen($data)); + if($encryptedBlock){ + $block=OC_Crypt::decrypt($encryptedBlock); + $data.=substr($block,strlen($data)); + } } $encrypted=OC_Crypt::encrypt(substr($data,0,8192)); fwrite($this->source,$encrypted); diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php new file mode 100644 index 00000000000..578b091a36c --- /dev/null +++ b/apps/files_encryption/tests/stream.php @@ -0,0 +1,56 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class Test_CryptStream extends UnitTestCase { + private $tmpFiles=array(); + + function testStream(){ + $stream=$this->getStream('test1','w'); + fwrite($stream,'foobar'); + fclose($stream); + + $stream=$this->getStream('test1','r'); + $data=fread($stream,6); + fclose($stream); + $this->assertEqual('foobar',$data); + + $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; + $source=fopen($file,'r'); + $target=$this->getStream('test2','w'); + OC_Helper::streamCopy($source,$target); + fclose($target); + fclose($source); + + $stream=$this->getStream('test2','r'); + $data=stream_get_contents($stream); + $original=file_get_contents($file); + $this->assertEqual(strlen($original),strlen($data)); + $this->assertEqual($original,$data); + } + + /** + * get a cryptstream to a temporary file + * @param string $id + * @param string $mode + * @return resource + */ + function getStream($id,$mode){ + if($id===''){ + $id=uniqid(); + } + if(!isset($this->tmpFiles[$id])){ + $file=OC_Helper::tmpFile(); + $this->tmpFiles[$id]=$file; + }else{ + $file=$this->tmpFiles[$id]; + } + $stream=fopen($file,$mode); + OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy','stream'=>$stream); + return fopen('crypt://streams/'.$id,$mode); + } +} -- cgit v1.2.3 From d1ad4dc8d60a656606b6c237df9f4c931f828c73 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 18 Apr 2012 16:02:35 +0200 Subject: add test cases for cryptstream --- apps/files_encryption/lib/proxy.php | 7 +++++++ apps/files_encryption/tests/encryption.php | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'apps/files_encryption') diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index c68df06f9fa..a0de411a7b6 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -28,6 +28,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ private static $blackList=null; //mimetypes blacklisted from encryption private static $metaData=array(); //metadata cache + private static $enableEncryption=null; /** * check if a file should be encrypted during write @@ -35,6 +36,12 @@ 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(!$this->enableEncryption){ + return false; + } if(is_null(self::$blackList)){ self::$blackList=explode(',',OC_Appconfig::getValue('files_encryption','type_blacklist','jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg')); } diff --git a/apps/files_encryption/tests/encryption.php b/apps/files_encryption/tests/encryption.php index 140fe6b126d..13093256717 100644 --- a/apps/files_encryption/tests/encryption.php +++ b/apps/files_encryption/tests/encryption.php @@ -15,6 +15,12 @@ class Test_Encryption extends UnitTestCase { $decrypted=OC_Crypt::decrypt($encrypted,$key); $this->assertNotEqual($encrypted,$source); $this->assertEqual($decrypted,$source); + + $chunk=substr($source,0,8192); + $encrypted=OC_Crypt::encrypt($chunk,$key); + $this->assertEqual(strlen($chunk),strlen($encrypted)); + $decrypted=OC_Crypt::decrypt($encrypted,$key); + $this->assertEqual($decrypted,$chunk); $encrypted=OC_Crypt::blockEncrypt($source,$key); $decrypted=OC_Crypt::blockDecrypt($encrypted,$key); -- cgit v1.2.3 From c5b31b001a12e4035555c6b507b6347bce90e272 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 19 Apr 2012 16:36:07 +0200 Subject: add the option to disable file encryption while still being able to decrypt existing files --- apps/files_encryption/js/settings.js | 5 +++++ apps/files_encryption/lib/proxy.php | 6 +++--- apps/files_encryption/settings.php | 2 ++ apps/files_encryption/templates/settings.php | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'apps/files_encryption') 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 @@ + > -- cgit v1.2.3 From 5c3ea148197c20b9754a539261d4b0fa1540a3c7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 25 Apr 2012 00:10:29 +0200 Subject: fix mimetypes of encrypted files --- apps/files_encryption/lib/cryptstream.php | 15 ++++----------- apps/files_encryption/lib/proxy.php | 17 +++-------------- 2 files changed, 7 insertions(+), 25 deletions(-) (limited to 'apps/files_encryption') diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php index 21fa38e4b59..07a2e523a42 100644 --- a/apps/files_encryption/lib/cryptstream.php +++ b/apps/files_encryption/lib/cryptstream.php @@ -33,6 +33,7 @@ class OC_CryptStream{ private $path; private $readBuffer;//for streams that dont support seeking private $meta=array();//header/meta for source stream + private $count; public function stream_open($path, $mode, $options, &$opened_path){ $path=str_replace('crypt://','',$path); @@ -92,16 +93,6 @@ class OC_CryptStream{ $data=substr($block,0,$currentPos%8192).$data; } while(strlen($data)>0){ - if(strlen($data)<8192){ - //fetch the current data in that block and append it to the input so we always write entire blocks - $oldPos=ftell($this->source); - $encryptedBlock=fread($this->source,8192); - fseek($this->source,$oldPos); - if($encryptedBlock){ - $block=OC_Crypt::decrypt($encryptedBlock); - $data.=substr($block,strlen($data)); - } - } $encrypted=OC_Crypt::encrypt(substr($data,0,8192)); fwrite($this->source,$encrypted); $data=substr($data,8192); @@ -139,7 +130,9 @@ class OC_CryptStream{ } public function stream_close(){ - OC_FileCache::put($this->path,array('encrypted'=>true)); + if($this->meta['mode']!='r' and $this->meta['mode']!='rb'){ + OC_FileCache::put($this->path,array('encrypted'=>true)); + } return fclose($this->source); } } \ No newline at end of file diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index e3a106d0d04..d65bcba8bfa 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -27,7 +27,6 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ private static $blackList=null; //mimetypes blacklisted from encryption - private static $metaData=array(); //metadata cache private static $enableEncryption=null; /** @@ -60,13 +59,8 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ * @return bool */ private static function isEncrypted($path){ - if(isset(self::$metaData[$path])){ - $metadata=self::$metaData[$path]; - }else{ - $metadata=OC_FileCache::getCached($path); - self::$metaData[$path]=$metadata; - } - return (bool)$metadata['encrypted']; + $metadata=OC_FileCache::getCached($path); + return isset($metadata['encrypted']) and (bool)$metadata['encrypted']; } public function preFile_put_contents($path,&$data){ @@ -98,12 +92,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ //first encrypt the target file so we don't end up with a half encrypted file OC_Log::write('files_encryption','Decrypting '.$path.' before writing',OC_Log::DEBUG); $tmp=fopen('php://temp'); - while(!feof($result)){ - $chunk=fread($result,8192); - if($chunk){ - fwrite($tmp,$chunk); - } - } + OC_Helper::streamCopy($result,$tmp); fclose($result); OC_Filesystem::file_put_contents($path,$tmp); fclose($tmp); -- cgit v1.2.3 From e8ec999090d06127861bf51bf77c9ab2a50647ce Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Tue, 1 May 2012 09:49:22 +0200 Subject: port to use the new public api --- apps/admin_dependencies_chk/settings.php | 2 +- apps/bookmarks/index.php | 2 +- apps/calendar/appinfo/app.php | 4 ++-- apps/calendar/index.php | 8 ++++---- apps/contacts/index.php | 8 ++++---- apps/external/appinfo/app.php | 4 ++-- apps/files/index.php | 2 +- apps/files/settings.php | 2 +- apps/files_encryption/lib/crypt.php | 2 +- apps/files_imageviewer/appinfo/app.php | 2 +- apps/files_pdfviewer/appinfo/app.php | 2 +- apps/files_sharing/appinfo/app.php | 6 +++--- apps/files_sharing/get.php | 2 +- apps/files_texteditor/appinfo/app.php | 4 ++-- apps/files_versions/history.php | 2 +- apps/gallery/templates/index.php | 6 +++--- apps/gallery/templates/view_album.php | 4 ++-- apps/media/index.php | 2 +- apps/user_ldap/settings.php | 2 +- 19 files changed, 33 insertions(+), 33 deletions(-) (limited to 'apps/files_encryption') diff --git a/apps/admin_dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php index ea1ce9fb3dc..0cebc10198f 100644 --- a/apps/admin_dependencies_chk/settings.php +++ b/apps/admin_dependencies_chk/settings.php @@ -84,7 +84,7 @@ foreach($modules as $key => $module) { if($enabled == false) unset($modules[$key]); } -OC_UTIL::addStyle('admin_dependencies_chk', 'style'); +OCP\UTIL::addStyle('admin_dependencies_chk', 'style'); $tmpl->assign( 'items', $modules ); return $tmpl->fetchPage(); diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php index 4d604a4fd55..d36321a1ef9 100644 --- a/apps/bookmarks/index.php +++ b/apps/bookmarks/index.php @@ -30,7 +30,7 @@ OC_Util::checkAppEnabled('bookmarks'); OC_App::setActiveNavigationEntry( 'bookmarks_index' ); OC_Util::addScript('bookmarks','bookmarks'); -OC_Util::addStyle('bookmarks', 'bookmarks'); +OCP\Util::addStyle('bookmarks', 'bookmarks'); $tmpl = new OC_Template( 'bookmarks', 'list', 'user' ); diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 21d128e7b8a..ccd7ff4c1a0 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -10,7 +10,7 @@ OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php'; OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); OC_Util::addScript('calendar','loader'); OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min"); -OC_Util::addStyle("3rdparty", "chosen/chosen"); +OCP\Util::addStyle("3rdparty", "chosen/chosen"); OC_App::register( array( 'order' => 10, 'id' => 'calendar', @@ -22,4 +22,4 @@ OC_App::addNavigationEntry( array( 'icon' => OC_Helper::imagePath( 'calendar', 'icon.svg' ), 'name' => $l->t('Calendar'))); OC_App::registerPersonal('calendar', 'settings'); -OC_Search::registerProvider('OC_Search_Provider_Calendar'); \ No newline at end of file +OC_Search::registerProvider('OC_Search_Provider_Calendar'); diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 417d2b6c225..6bb7cfd6865 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -40,16 +40,16 @@ if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'mont } OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); -OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); +OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker'); -OC_Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker'); +OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker'); if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection') == 'true'){ OC_UTIL::addScript('calendar', 'geo'); } OC_Util::addScript('calendar', 'calendar'); -OC_Util::addStyle('calendar', 'style'); +OCP\Util::addStyle('calendar', 'style'); OC_Util::addScript('', 'jquery.multiselect'); -OC_Util::addStyle('', 'jquery.multiselect'); +OCP\Util::addStyle('', 'jquery.multiselect'); OC_Util::addScript('contacts','jquery.multi-autocomplete'); OC_Util::addScript('','oc-vcategories'); OC_App::setActiveNavigationEntry('calendar_index'); diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 61cec6c24a8..0abec096e7f 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -52,10 +52,10 @@ OC_Util::addScript('contacts','jquery.combobox'); OC_Util::addScript('contacts','jquery.inview'); OC_Util::addScript('contacts','jquery.Jcrop'); OC_Util::addScript('contacts','jquery.multi-autocomplete'); -OC_Util::addStyle('','jquery.multiselect'); -OC_Util::addStyle('contacts','jquery.combobox'); -OC_Util::addStyle('contacts','jquery.Jcrop'); -OC_Util::addStyle('contacts','contacts'); +OCP\Util::addStyle('','jquery.multiselect'); +OCP\Util::addStyle('contacts','jquery.combobox'); +OCP\Util::addStyle('contacts','jquery.Jcrop'); +OCP\Util::addStyle('contacts','contacts'); $tmpl = new OC_Template( "contacts", "index", "user" ); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); diff --git a/apps/external/appinfo/app.php b/apps/external/appinfo/app.php index 74e6d5c94c6..7f8ef3043bc 100644 --- a/apps/external/appinfo/app.php +++ b/apps/external/appinfo/app.php @@ -22,7 +22,7 @@ */ OC::$CLASSPATH['OC_External'] = 'apps/external/lib/external.php'; -OC_Util::addStyle( 'external', 'style'); +OCP\Util::addStyle( 'external', 'style'); OC_APP::registerAdmin('external', 'settings'); @@ -32,4 +32,4 @@ $sites = OC_External::getSites(); for ($i = 0; $i < sizeof($sites); $i++) { OC_App::addNavigationEntry( array('id' => 'external_index' . ($i + 1), 'order' => 80 + $i, 'href' => OC_Helper::linkTo('external', 'index.php') . '?id=' . ($i + 1), 'icon' => OC_Helper::imagePath('external', 'external.png'), 'name' => $sites[$i][0])); -} \ No newline at end of file +} diff --git a/apps/files/index.php b/apps/files/index.php index 8464db30f01..65a428a6c9d 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -25,7 +25,7 @@ OC_Util::checkLoggedIn(); // Load the files we need -OC_Util::addStyle( "files", "files" ); +OCP\Util::addStyle( "files", "files" ); OC_Util::addScript( "files", "jquery.iframe-transport" ); OC_Util::addScript( "files", "jquery.fileupload" ); OC_Util::addScript( "files", "files" ); diff --git a/apps/files/settings.php b/apps/files/settings.php index 41017c064ef..5016630d192 100644 --- a/apps/files/settings.php +++ b/apps/files/settings.php @@ -29,7 +29,7 @@ OC_Util::checkLoggedIn(); // Load the files we need -OC_Util::addStyle( "files", "files" ); +OCP\Util::addStyle( "files", "files" ); OC_Util::addScript( "files", "files" ); // Load the files diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 8cf9451c63c..3968a2836a2 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -91,7 +91,7 @@ class OC_Crypt { } public static function changekeypasscode($oldPassword, $newPassword) { - if(OC_User::isLoggedIn()){ + if(OCP\User::isLoggedIn()){ $username=OC_USER::getUser(); $view=new OC_FilesystemView('/'.$username); diff --git a/apps/files_imageviewer/appinfo/app.php b/apps/files_imageviewer/appinfo/app.php index 0f77076b79b..cf357d2e318 100644 --- a/apps/files_imageviewer/appinfo/app.php +++ b/apps/files_imageviewer/appinfo/app.php @@ -3,6 +3,6 @@ OC_Util::addScript( 'files_imageviewer', 'lightbox' ); OC_Util::addScript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack'); OC_Util::addScript('files_imageviewer', 'jquery.fancybox-1.3.4.pack'); -OC_Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' ); +OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' ); ?> diff --git a/apps/files_pdfviewer/appinfo/app.php b/apps/files_pdfviewer/appinfo/app.php index 0f0b40764d9..fbcb30bb973 100644 --- a/apps/files_pdfviewer/appinfo/app.php +++ b/apps/files_pdfviewer/appinfo/app.php @@ -1,7 +1,7 @@ diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 645f4f5e4f2..7c547be3ca1 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -15,7 +15,7 @@ if ($dir != '/Shared' || OC_Appconfig::getValue('files_sharing', 'resharing', 'y OC_Util::addScript("files_sharing", "share"); } OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min"); -OC_Util::addStyle( 'files_sharing', 'sharing' ); -OC_Util::addStyle("3rdparty", "chosen/chosen"); +OCP\Util::addStyle( 'files_sharing', 'sharing' ); +OCP\Util::addStyle("3rdparty", "chosen/chosen"); -?> \ No newline at end of file +?> diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index 3e42bf6a6c7..fbcb265fc03 100644 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -49,7 +49,7 @@ if ($source !== false) { } } // Load the files we need - OC_Util::addStyle("files", "files"); + OCP\Util::addStyle("files", "files"); $breadcrumbNav = new OC_Template("files", "part.breadcrumb", ""); $breadcrumbNav->assign("breadcrumb", $breadcrumb); $breadcrumbNav->assign("baseURL", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&path="); diff --git a/apps/files_texteditor/appinfo/app.php b/apps/files_texteditor/appinfo/app.php index 1bf09b5da2a..b3937236ecd 100644 --- a/apps/files_texteditor/appinfo/app.php +++ b/apps/files_texteditor/appinfo/app.php @@ -1,6 +1,6 @@ \ No newline at end of file +?> diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php index 5e1949bf540..16ad92b90da 100644 --- a/apps/files_versions/history.php +++ b/apps/files_versions/history.php @@ -23,7 +23,7 @@ require_once( '../../lib/base.php' ); OC_Util::checkLoggedIn( ); -OC_Util::addStyle('files_versions','versions'); +OCP\Util::addStyle('files_versions','versions'); $tmpl = new OC_Template( 'files_versions', 'history', 'user' ); if ( isset( $_GET['path'] ) ) { diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php index 43ba5131864..cf3d9188e65 100644 --- a/apps/gallery/templates/index.php +++ b/apps/gallery/templates/index.php @@ -1,12 +1,12 @@ diff --git a/apps/gallery/templates/view_album.php b/apps/gallery/templates/view_album.php index f938e487954..9abfef901d2 100644 --- a/apps/gallery/templates/view_album.php +++ b/apps/gallery/templates/view_album.php @@ -1,10 +1,10 @@ '); } OC_JSON::checkAppEnabled('calendar'); diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php index 62087e9a817..155e3dc371e 100644 --- a/apps/calendar/ajax/event/new.form.php +++ b/apps/calendar/ajax/event/new.form.php @@ -8,7 +8,7 @@ -if(!OC_USER::isLoggedIn()) { +if(!OCP\User::isLoggedIn()) { die(''); } OC_JSON::checkAppEnabled('calendar'); diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index 68c445d5d77..fda2a55234b 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -10,7 +10,7 @@ OC_Hook::connect('OC_User','post_login','OC_Crypt','loginListener'); stream_wrapper_register('crypt','OC_CryptStream'); -if(!isset($_SESSION['enckey']) and OC_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) +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) OC_User::logout(); header("Location: ".OC::$WEBROOT.'/'); exit(); -- cgit v1.2.3 From 70cea18cce0fcdb4d8118ff2d7abccc922417a6a Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Tue, 1 May 2012 18:50:31 +0200 Subject: ported getUser --- apps/bookmarks/ajax/delBookmark.php | 2 +- apps/bookmarks/ajax/recordClick.php | 2 +- apps/bookmarks/bookmarksHelper.php | 2 +- apps/bookmarks/lib/bookmarks.php | 2 +- apps/calendar/ajax/calendar/new.php | 4 +-- apps/calendar/ajax/calendar/update.php | 2 +- apps/calendar/ajax/categories/rescan.php | 2 +- apps/calendar/ajax/changeview.php | 2 +- apps/calendar/ajax/event/edit.form.php | 2 +- apps/calendar/ajax/event/new.form.php | 6 ++-- apps/calendar/ajax/import/import.php | 4 +-- apps/calendar/ajax/settings/getfirstday.php | 2 +- .../ajax/settings/gettimezonedetection.php | 2 +- apps/calendar/ajax/settings/guesstimezone.php | 4 +-- apps/calendar/ajax/settings/setfirstday.php | 2 +- apps/calendar/ajax/settings/settimeformat.php | 2 +- apps/calendar/ajax/settings/settimezone.php | 2 +- apps/calendar/ajax/settings/timeformat.php | 2 +- apps/calendar/ajax/settings/timezonedetection.php | 4 +-- apps/calendar/ajax/share/activation.php | 2 +- apps/calendar/ajax/share/dropdown.php | 2 +- apps/calendar/ajax/share/share.php | 4 +-- apps/calendar/ajax/share/unshare.php | 2 +- apps/calendar/index.php | 20 ++++++------ apps/calendar/lib/app.php | 28 ++++++++--------- apps/calendar/lib/object.php | 2 +- apps/calendar/lib/search.php | 4 +-- apps/calendar/settings.php | 2 +- apps/calendar/templates/calendar.php | 8 ++--- apps/calendar/templates/part.choosecalendar.php | 4 +-- .../templates/part.choosecalendar.rowfields.php | 6 ++-- apps/calendar/templates/part.import.php | 2 +- apps/calendar/templates/share.dropdown.php | 4 +-- apps/contacts/ajax/categories/delete.php | 2 +- apps/contacts/ajax/categories/rescan.php | 2 +- apps/contacts/ajax/contacts.php | 2 +- apps/contacts/ajax/createaddressbook.php | 2 +- apps/contacts/ajax/editname.php | 2 +- apps/contacts/import.php | 2 +- apps/contacts/index.php | 4 +-- apps/contacts/lib/addressbook.php | 4 +-- apps/contacts/lib/app.php | 6 ++-- apps/contacts/lib/hooks.php | 2 +- apps/contacts/lib/search.php | 2 +- apps/contacts/templates/index.php | 2 +- apps/contacts/templates/part.chooseaddressbook.php | 2 +- .../templates/part.chooseaddressbook.rowfields.php | 2 +- apps/contacts/templates/part.import.php | 2 +- apps/contacts/templates/part.importaddressbook.php | 2 +- apps/contacts/templates/settings.php | 2 +- apps/files_encryption/lib/crypt.php | 2 +- apps/files_sharing/ajax/email.php | 2 +- apps/files_sharing/ajax/getitem.php | 2 +- apps/files_sharing/ajax/setpermissions.php | 2 +- apps/files_sharing/ajax/share.php | 2 +- apps/files_sharing/ajax/unshare.php | 2 +- apps/files_sharing/ajax/userautocomplete.php | 2 +- apps/files_sharing/lib_share.php | 36 +++++++++++----------- apps/files_sharing/sharedstorage.php | 2 +- apps/files_versions/ajax/getVersions.php | 2 +- apps/files_versions/ajax/rollbackVersion.php | 2 +- apps/files_versions/versions.php | 16 +++++----- apps/gallery/ajax/createAlbum.php | 2 +- apps/gallery/ajax/galleryOp.php | 22 ++++++------- apps/gallery/appinfo/app.php | 2 +- apps/gallery/index.php | 8 ++--- apps/gallery/lib/album.php | 6 ++-- apps/gallery/lib/hooks_handlers.php | 28 ++++++++--------- apps/gallery/lib/photo.php | 4 +-- apps/gallery/lib/scanner.php | 8 ++--- apps/gallery/templates/index.php | 2 +- apps/media/ajax/api.php | 6 ++-- apps/media/ajax/autoupdate.php | 2 +- apps/media/lib_collection.php | 2 +- apps/remoteStorage/auth.php | 2 +- apps/remoteStorage/lib_remoteStorage.php | 8 ++--- apps/remoteStorage/templates/settings.php | 2 +- apps/user_migrate/ajax/export.php | 4 +-- apps/user_openid/settings.php | 2 +- apps/user_openid/templates/settings.php | 2 +- 80 files changed, 183 insertions(+), 183 deletions(-) mode change 100644 => 100755 apps/bookmarks/ajax/delBookmark.php mode change 100644 => 100755 apps/bookmarks/ajax/recordClick.php mode change 100644 => 100755 apps/bookmarks/bookmarksHelper.php mode change 100644 => 100755 apps/calendar/ajax/calendar/new.php mode change 100644 => 100755 apps/calendar/ajax/calendar/update.php mode change 100644 => 100755 apps/calendar/ajax/changeview.php mode change 100644 => 100755 apps/calendar/ajax/event/edit.form.php mode change 100644 => 100755 apps/calendar/ajax/event/new.form.php mode change 100644 => 100755 apps/calendar/ajax/import/import.php mode change 100644 => 100755 apps/calendar/ajax/settings/getfirstday.php mode change 100644 => 100755 apps/calendar/ajax/settings/gettimezonedetection.php mode change 100644 => 100755 apps/calendar/ajax/settings/guesstimezone.php mode change 100644 => 100755 apps/calendar/ajax/settings/setfirstday.php mode change 100644 => 100755 apps/calendar/ajax/settings/settimeformat.php mode change 100644 => 100755 apps/calendar/ajax/settings/settimezone.php mode change 100644 => 100755 apps/calendar/ajax/settings/timeformat.php mode change 100644 => 100755 apps/calendar/ajax/settings/timezonedetection.php mode change 100644 => 100755 apps/calendar/ajax/share/activation.php mode change 100644 => 100755 apps/calendar/ajax/share/dropdown.php mode change 100644 => 100755 apps/calendar/ajax/share/share.php mode change 100644 => 100755 apps/calendar/ajax/share/unshare.php mode change 100644 => 100755 apps/calendar/index.php mode change 100644 => 100755 apps/calendar/lib/app.php mode change 100644 => 100755 apps/calendar/lib/object.php mode change 100644 => 100755 apps/calendar/lib/search.php mode change 100644 => 100755 apps/calendar/settings.php mode change 100644 => 100755 apps/calendar/templates/calendar.php mode change 100644 => 100755 apps/calendar/templates/part.choosecalendar.php mode change 100644 => 100755 apps/calendar/templates/part.choosecalendar.rowfields.php mode change 100644 => 100755 apps/calendar/templates/part.import.php mode change 100644 => 100755 apps/calendar/templates/share.dropdown.php mode change 100644 => 100755 apps/contacts/ajax/contacts.php mode change 100644 => 100755 apps/contacts/index.php mode change 100644 => 100755 apps/contacts/lib/hooks.php mode change 100644 => 100755 apps/contacts/lib/search.php mode change 100644 => 100755 apps/contacts/templates/index.php mode change 100644 => 100755 apps/contacts/templates/part.chooseaddressbook.php mode change 100644 => 100755 apps/contacts/templates/part.chooseaddressbook.rowfields.php mode change 100644 => 100755 apps/contacts/templates/part.import.php mode change 100644 => 100755 apps/contacts/templates/part.importaddressbook.php mode change 100644 => 100755 apps/contacts/templates/settings.php mode change 100644 => 100755 apps/files_encryption/lib/crypt.php mode change 100644 => 100755 apps/files_sharing/ajax/email.php mode change 100644 => 100755 apps/files_sharing/ajax/getitem.php mode change 100644 => 100755 apps/files_sharing/ajax/setpermissions.php mode change 100644 => 100755 apps/files_sharing/ajax/unshare.php mode change 100644 => 100755 apps/files_sharing/ajax/userautocomplete.php mode change 100644 => 100755 apps/files_sharing/sharedstorage.php mode change 100644 => 100755 apps/files_versions/ajax/getVersions.php mode change 100644 => 100755 apps/files_versions/ajax/rollbackVersion.php mode change 100644 => 100755 apps/files_versions/versions.php mode change 100644 => 100755 apps/gallery/ajax/createAlbum.php mode change 100644 => 100755 apps/gallery/ajax/galleryOp.php mode change 100644 => 100755 apps/gallery/appinfo/app.php mode change 100644 => 100755 apps/gallery/index.php mode change 100644 => 100755 apps/gallery/lib/album.php mode change 100644 => 100755 apps/gallery/lib/photo.php mode change 100644 => 100755 apps/gallery/lib/scanner.php mode change 100644 => 100755 apps/gallery/templates/index.php mode change 100644 => 100755 apps/media/ajax/api.php mode change 100644 => 100755 apps/media/ajax/autoupdate.php mode change 100644 => 100755 apps/media/lib_collection.php mode change 100644 => 100755 apps/remoteStorage/auth.php mode change 100644 => 100755 apps/remoteStorage/lib_remoteStorage.php mode change 100644 => 100755 apps/remoteStorage/templates/settings.php mode change 100644 => 100755 apps/user_migrate/ajax/export.php mode change 100644 => 100755 apps/user_openid/settings.php mode change 100644 => 100755 apps/user_openid/templates/settings.php (limited to 'apps/files_encryption') diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php old mode 100644 new mode 100755 index 655d9f825d9..984a8593169 --- a/apps/bookmarks/ajax/delBookmark.php +++ b/apps/bookmarks/ajax/delBookmark.php @@ -32,7 +32,7 @@ OC_JSON::checkAppEnabled('bookmarks'); $params=array( htmlspecialchars_decode($_GET["url"]), - OC_User::getUser() + OCP\USER::getUser() ); $query = OC_DB::prepare(" diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php old mode 100644 new mode 100755 index a542f636d8c..6519de241b6 --- a/apps/bookmarks/ajax/recordClick.php +++ b/apps/bookmarks/ajax/recordClick.php @@ -37,7 +37,7 @@ $query = OC_DB::prepare(" AND url LIKE ? "); -$params=array(OC_User::getUser(), htmlspecialchars_decode($_GET["url"])); +$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_GET["url"])); $bookmarks = $query->execute($params); header( "HTTP/1.1 204 No Content" ); diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php old mode 100644 new mode 100755 index f1464be79de..25c9b4cc7f2 --- a/apps/bookmarks/bookmarksHelper.php +++ b/apps/bookmarks/bookmarksHelper.php @@ -101,7 +101,7 @@ function addBookmark($url, $title, $tags='') { $params=array( htmlspecialchars_decode($url), htmlspecialchars_decode($title), - OC_User::getUser() + OCP\USER::getUser() ); $query->execute($params); diff --git a/apps/bookmarks/lib/bookmarks.php b/apps/bookmarks/lib/bookmarks.php index b1ff1f411f2..3f27af09557 100755 --- a/apps/bookmarks/lib/bookmarks.php +++ b/apps/bookmarks/lib/bookmarks.php @@ -37,7 +37,7 @@ class OC_Bookmarks_Bookmarks{ //OCP\Util::writeLog('bookmarks', 'findBookmarks ' .$offset. ' '.$sqlSortColumn.' '. $filter.' '. $filterTagOnly ,OCP\Util::DEBUG); $CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' ); - $params=array(OC_User::getUser()); + $params=array(OCP\USER::getUser()); if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ $_gc_separator = ', \' \''; diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php old mode 100644 new mode 100755 index ada28a9fc07..b7136981633 --- a/apps/calendar/ajax/calendar/new.php +++ b/apps/calendar/ajax/calendar/new.php @@ -16,7 +16,7 @@ if(trim($_POST['name']) == ''){ OC_JSON::error(array('message'=>'empty')); exit; } -$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); foreach($calendars as $cal){ if($cal['displayname'] == $_POST['name']){ OC_JSON::error(array('message'=>'namenotavailable')); @@ -24,7 +24,7 @@ foreach($calendars as $cal){ } } -$userid = OC_User::getUser(); +$userid = OCP\USER::getUser(); $calendarid = OC_Calendar_Calendar::addCalendar($userid, strip_tags($_POST['name']), 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']); OC_Calendar_Calendar::setCalendarActive($calendarid, 1); diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php old mode 100644 new mode 100755 index 9bb1307a845..1e35035fa48 --- a/apps/calendar/ajax/calendar/update.php +++ b/apps/calendar/ajax/calendar/update.php @@ -16,7 +16,7 @@ if(trim($_POST['name']) == ''){ OC_JSON::error(array('message'=>'empty')); exit; } -$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); foreach($calendars as $cal){ if($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']){ OC_JSON::error(array('message'=>'namenotavailable')); diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php index e1b276312a5..a8e62f64a5b 100755 --- a/apps/calendar/ajax/categories/rescan.php +++ b/apps/calendar/ajax/categories/rescan.php @@ -23,7 +23,7 @@ function debug($msg) { OCP\Util::writeLog('calendar','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG); } -$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); if(count($calendars) == 0) { bailOut(OC_Calendar_App::$l10n->t('No calendars found.')); } diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php old mode 100644 new mode 100755 index 736a5625530..f53eb288b79 --- a/apps/calendar/ajax/changeview.php +++ b/apps/calendar/ajax/changeview.php @@ -17,6 +17,6 @@ switch($view){ OC_JSON::error(array('message'=>'unexspected parameter: ' . $view)); exit; } -OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'currentview', $view); +OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'currentview', $view); OC_JSON::success(); ?> diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php old mode 100644 new mode 100755 index e2b23d71f9b..675a417eba8 --- a/apps/calendar/ajax/event/edit.form.php +++ b/apps/calendar/ajax/event/edit.form.php @@ -189,7 +189,7 @@ if($data['repeating'] == 1){ $repeat['repeat'] = 'doesnotrepeat'; } if($access == 'owner'){ - $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); + $calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); }else{ $calendar_options = array(OC_Calendar_App::getCalendar($data['calendarid'], false)); } diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php old mode 100644 new mode 100755 index 155e3dc371e..a2fa48edf8a --- a/apps/calendar/ajax/event/new.form.php +++ b/apps/calendar/ajax/event/new.form.php @@ -22,16 +22,16 @@ $end = $_POST['end']; $allday = $_POST['allday']; if (!$end){ - $duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', '60'); + $duration = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'duration', '60'); $end = $start + ($duration * 60); } $start = new DateTime('@'.$start); $end = new DateTime('@'.$end); -$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); +$timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $start->setTimezone(new DateTimeZone($timezone)); $end->setTimezone(new DateTimeZone($timezone)); -$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); $repeat_options = OC_Calendar_App::getRepeatOptions(); $repeat_end_options = OC_Calendar_App::getEndOptions(); $repeat_month_options = OC_Calendar_App::getMonthOptions(); diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php old mode 100644 new mode 100755 index 5848cac448d..eda34099aba --- a/apps/calendar/ajax/import/import.php +++ b/apps/calendar/ajax/import/import.php @@ -19,11 +19,11 @@ if(is_writable('import_tmp/')){ } $file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']); if($_POST['method'] == 'new'){ - $id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']); + $id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), $_POST['calname']); OC_Calendar_Calendar::setCalendarActive($id, 1); }else{ $calendar = OC_Calendar_App::getCalendar($_POST['id']); - if($calendar['userid'] != OC_USER::getUser()){ + if($calendar['userid'] != OCP\USER::getUser()){ OC_JSON::error(); exit(); } diff --git a/apps/calendar/ajax/settings/getfirstday.php b/apps/calendar/ajax/settings/getfirstday.php old mode 100644 new mode 100755 index 63218dcd028..3fe89c5bc56 --- a/apps/calendar/ajax/settings/getfirstday.php +++ b/apps/calendar/ajax/settings/getfirstday.php @@ -7,6 +7,6 @@ */ OC_JSON::checkLoggedIn(); -$firstday = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstday', 'mo'); +$firstday = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo'); OC_JSON::encodedPrint(array('firstday' => $firstday)); ?> diff --git a/apps/calendar/ajax/settings/gettimezonedetection.php b/apps/calendar/ajax/settings/gettimezonedetection.php old mode 100644 new mode 100755 index b9555900a0e..a5a71670ca9 --- a/apps/calendar/ajax/settings/gettimezonedetection.php +++ b/apps/calendar/ajax/settings/gettimezonedetection.php @@ -8,4 +8,4 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); -OC_JSON::success(array('detection' => OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file +OC_JSON::success(array('detection' => OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file diff --git a/apps/calendar/ajax/settings/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php old mode 100644 new mode 100755 index c0b4ef65263..9b86c305e44 --- a/apps/calendar/ajax/settings/guesstimezone.php +++ b/apps/calendar/ajax/settings/guesstimezone.php @@ -17,11 +17,11 @@ $lng = $_GET['long']; $timezone = OC_Geo::timezone($lat, $lng); -if($timezone == OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone')){ +if($timezone == OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone')){ OC_JSON::success(); exit; } -OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $timezone); +OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone); $message = array('message'=> $l->t('New Timezone:') . $timezone); OC_JSON::success($message); ?> \ No newline at end of file diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php old mode 100644 new mode 100755 index 3b1b5481db4..232a51733ba --- a/apps/calendar/ajax/settings/setfirstday.php +++ b/apps/calendar/ajax/settings/setfirstday.php @@ -8,7 +8,7 @@ OC_JSON::checkLoggedIn(); if(isset($_POST["firstday"])){ - OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstday', $_POST["firstday"]); + OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]); OC_JSON::success(); }else{ OC_JSON::error(); diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php old mode 100644 new mode 100755 index 374825a5d40..428cb4220a1 --- a/apps/calendar/ajax/settings/settimeformat.php +++ b/apps/calendar/ajax/settings/settimeformat.php @@ -8,7 +8,7 @@ OC_JSON::checkLoggedIn(); if(isset($_POST["timeformat"])){ - OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]); + OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]); OC_JSON::success(); }else{ OC_JSON::error(); diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php old mode 100644 new mode 100755 index b0ca9dcd944..efc23c0f979 --- a/apps/calendar/ajax/settings/settimezone.php +++ b/apps/calendar/ajax/settings/settimezone.php @@ -18,7 +18,7 @@ OC_JSON::checkAppEnabled('calendar'); // Get data if( isset( $_POST['timezone'] ) ){ $timezone=$_POST['timezone']; - OC_Preferences::setValue( OC_User::getUser(), 'calendar', 'timezone', $timezone ); + OC_Preferences::setValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone ); OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') ))); }else{ OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') ))); diff --git a/apps/calendar/ajax/settings/timeformat.php b/apps/calendar/ajax/settings/timeformat.php old mode 100644 new mode 100755 index 728b7155efe..cec09394815 --- a/apps/calendar/ajax/settings/timeformat.php +++ b/apps/calendar/ajax/settings/timeformat.php @@ -7,6 +7,6 @@ */ OC_JSON::checkLoggedIn(); -$timeformat = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24"); +$timeformat = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24"); OC_JSON::encodedPrint(array("timeformat" => $timeformat)); ?> diff --git a/apps/calendar/ajax/settings/timezonedetection.php b/apps/calendar/ajax/settings/timezonedetection.php old mode 100644 new mode 100755 index de3bd6de4fd..17bd740beea --- a/apps/calendar/ajax/settings/timezonedetection.php +++ b/apps/calendar/ajax/settings/timezonedetection.php @@ -10,9 +10,9 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); if(array_key_exists('timezonedetection', $_POST)){ if($_POST['timezonedetection'] == 'on'){ - OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezonedetection', 'true'); + OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true'); }else{ - OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezonedetection', 'false'); + OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false'); } OC_JSON::success(); }else{ diff --git a/apps/calendar/ajax/share/activation.php b/apps/calendar/ajax/share/activation.php old mode 100644 new mode 100755 index a4a3ce48192..5c2fe8efd13 --- a/apps/calendar/ajax/share/activation.php +++ b/apps/calendar/ajax/share/activation.php @@ -8,5 +8,5 @@ require_once('../../../../lib/base.php'); $id = strip_tags($_GET['id']); $activation = strip_tags($_GET['activation']); -OC_Calendar_Share::set_active(OC_User::getUser(), $id, $activation); +OC_Calendar_Share::set_active(OCP\USER::getUser(), $id, $activation); OC_JSON::success(); \ No newline at end of file diff --git a/apps/calendar/ajax/share/dropdown.php b/apps/calendar/ajax/share/dropdown.php old mode 100644 new mode 100755 index 85530c163ed..988e18c0b03 --- a/apps/calendar/ajax/share/dropdown.php +++ b/apps/calendar/ajax/share/dropdown.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -$user = OC_USER::getUser(); +$user = OCP\USER::getUser(); $calid = $_GET['calid']; $calendar = OC_Calendar_Calendar::find($calid); if($calendar['userid'] != $user){ diff --git a/apps/calendar/ajax/share/share.php b/apps/calendar/ajax/share/share.php old mode 100644 new mode 100755 index 70f1ec26ae6..9f4dc39e524 --- a/apps/calendar/ajax/share/share.php +++ b/apps/calendar/ajax/share/share.php @@ -43,10 +43,10 @@ if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){ OC_JSON::error(array('message'=>'group not found')); exit; } -if($sharetype == 'user' && OC_User::getUser() == $sharewith){ +if($sharetype == 'user' && OCP\USER::getUser() == $sharewith){ OC_JSON::error(array('meesage'=>'you can not share with yourself')); } -$success = OC_Calendar_Share::share(OC_User::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT)); +$success = OC_Calendar_Share::share(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT)); if($success){ if($sharetype == 'public'){ OC_JSON::success(array('message'=>$success)); diff --git a/apps/calendar/ajax/share/unshare.php b/apps/calendar/ajax/share/unshare.php old mode 100644 new mode 100755 index c68fc23a6cb..1a93748982c --- a/apps/calendar/ajax/share/unshare.php +++ b/apps/calendar/ajax/share/unshare.php @@ -34,7 +34,7 @@ if($sharetype == 'user' && !OC_User::userExists($sharewith)){ OC_JSON::error(array('message'=>'group not found')); exit; } -$success = OC_Calendar_Share::unshare(OC_User::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT)); +$success = OC_Calendar_Share::unshare(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT)); if($success){ OC_JSON::success(); }else{ diff --git a/apps/calendar/index.php b/apps/calendar/index.php old mode 100644 new mode 100755 index 6bb7cfd6865..beb6ac0c372 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -11,10 +11,10 @@ OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('calendar'); // Create default calendar ... -$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); +$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1); if( count($calendars) == 0){ - OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'Default calendar'); - $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); + OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar'); + $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1); } $eventSources = array(); @@ -29,21 +29,21 @@ OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources)); $categories = OC_Calendar_App::getCategoryOptions(); //Fix currentview for fullcalendar -if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ - OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "agendaWeek"); +if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ + OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek"); } -if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ - OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); +if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ + OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month"); } -if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ - OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "list"); +if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ + OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list"); } OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker'); OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker'); -if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection') == 'true'){ +if(OC_Preferences::getValue(OCP\USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){ OC_UTIL::addScript('calendar', 'geo'); } OC_Util::addScript('calendar', 'calendar'); diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php old mode 100644 new mode 100755 index 3ce0d6fa1d4..7a52bf08dc7 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -9,7 +9,7 @@ * This class manages our app actions */ OC_Calendar_App::$l10n = new OC_L10N('calendar'); -OC_Calendar_App::$tz = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); +OC_Calendar_App::$tz = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); class OC_Calendar_App{ const CALENDAR = 'calendar'; const EVENT = 'event'; @@ -38,12 +38,12 @@ class OC_Calendar_App{ public static function getCalendar($id, $security = true, $shared = false){ $calendar = OC_Calendar_Calendar::find($id); if($shared === true){ - if(OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::CALENDAR)){ + if(OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR)){ return $calendar; } } if($security === true){ - if($calendar['userid'] != OC_User::getUser()){ + if($calendar['userid'] != OCP\USER::getUser()){ return false; } } @@ -63,13 +63,13 @@ class OC_Calendar_App{ public static function getEventObject($id, $security = true, $shared = false){ $event = OC_Calendar_Object::find($id); if($shared === true){ - if(OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::EVENT)){ + if(OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT)){ return $event; } } if($security === true){ $calendar = self::getCalendar($event['calendarid'], false); - if($calendar['userid'] != OC_User::getUser()){ + if($calendar['userid'] != OCP\USER::getUser()){ return false; } } @@ -164,7 +164,7 @@ class OC_Calendar_App{ */ public static function scanCategories($events = null) { if (is_null($events)) { - $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); + $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); if(count($calendars) > 0) { $events = array(); foreach($calendars as $calendar) { @@ -278,12 +278,12 @@ class OC_Calendar_App{ public static function getaccess($id, $type){ if($type == self::CALENDAR){ $calendar = self::getCalendar($id, false, false); - if($calendar['userid'] == OC_User::getUser()){ + if($calendar['userid'] == OCP\USER::getUser()){ return 'owner'; } - $isshared = OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::CALENDAR); + $isshared = OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR); if($isshared){ - $writeaccess = OC_Calendar_Share::is_editing_allowed(OC_User::getUser(), $id, OC_Calendar_Share::CALENDAR); + $writeaccess = OC_Calendar_Share::is_editing_allowed(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR); if($writeaccess){ return 'rw'; }else{ @@ -293,12 +293,12 @@ class OC_Calendar_App{ return false; } }elseif($type == self::EVENT){ - if(OC_Calendar_Object::getowner($id) == OC_User::getUser()){ + if(OC_Calendar_Object::getowner($id) == OCP\USER::getUser()){ return 'owner'; } - $isshared = OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::EVENT); + $isshared = OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT); if($isshared){ - $writeaccess = OC_Calendar_Share::is_editing_allowed(OC_User::getUser(), $id, OC_Calendar_Share::EVENT); + $writeaccess = OC_Calendar_Share::is_editing_allowed(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT); if($writeaccess){ return 'rw'; }else{ @@ -320,12 +320,12 @@ class OC_Calendar_App{ public static function getrequestedEvents($calendarid, $start, $end){ $events = array(); if($calendarid == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){ - $calendars = OC_Calendar_Share::allSharedwithuser(OC_USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); + $calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); foreach($calendars as $calendar){ $calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end); $events = array_merge($events, $calendarevents); } - $singleevents = OC_Calendar_Share::allSharedwithuser(OC_USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); + $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); foreach($singleevents as $singleevent){ $event = OC_Calendar_Object::find($singleevent['eventid']); $events[] = $event; diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php old mode 100644 new mode 100755 index ae6fce3c842..d8e9d5fb946 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -761,7 +761,7 @@ class OC_Calendar_Object{ $vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE); $vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE); }else{ - $timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); + $timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $timezone = new DateTimeZone($timezone); $start = new DateTime($from.' '.$fromtime, $timezone); $end = new DateTime($to.' '.$totime, $timezone); diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php old mode 100644 new mode 100755 index 0e1a9032666..fc544314359 --- a/apps/calendar/lib/search.php +++ b/apps/calendar/lib/search.php @@ -1,7 +1,7 @@ assign('timezone',$timezone); $tmpl->assign('timezones',DateTimeZone::listIdentifiers()); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php old mode 100644 new mode 100755 index ba9423a66f1..4a3c653d6f1 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -1,13 +1,13 @@