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_encryption/lib/proxy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files_encryption/lib') 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; } } -- 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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 @@