From 3829460ab8cbb6de65c53583a20fd04cbe7927dd Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Fri, 7 Sep 2012 15:22:01 +0200 Subject: adding space between) and { --- apps/files/admin.php | 2 +- apps/files/ajax/list.php | 4 +- apps/files/ajax/upload.php | 4 +- apps/files/appinfo/filesync.php | 6 +- apps/files/appinfo/update.php | 2 +- apps/files/download.php | 2 +- apps/files/index.php | 12 +- apps/files/settings.php | 6 +- apps/files_encryption/appinfo/app.php | 2 +- apps/files_encryption/lib/crypt.php | 28 ++--- apps/files_encryption/lib/cryptstream.php | 54 ++++----- apps/files_encryption/lib/proxy.php | 44 +++---- apps/files_encryption/templates/settings.php | 2 +- apps/files_encryption/tests/encryption.php | 4 +- apps/files_encryption/tests/proxy.php | 12 +- apps/files_encryption/tests/stream.php | 10 +- apps/files_external/lib/ftp.php | 20 +-- apps/files_external/lib/smb.php | 34 +++--- apps/files_external/lib/streamwrapper.php | 34 +++--- apps/files_external/lib/swift.php | 170 +++++++++++++------------- apps/files_external/lib/webdav.php | 88 +++++++------- apps/files_external/tests/ftp.php | 6 +- apps/files_external/tests/google.php | 6 +- apps/files_external/tests/smb.php | 6 +- apps/files_external/tests/swift.php | 6 +- apps/files_external/tests/webdav.php | 6 +- apps/files_sharing/lib/sharedstorage.php | 2 +- apps/files_versions/ajax/expireAll.php | 2 +- apps/files_versions/ajax/rollbackVersion.php | 2 +- apps/files_versions/lib/hooks.php | 4 +- apps/files_versions/lib/versions.php | 8 +- apps/user_ldap/appinfo/install.php | 2 +- apps/user_ldap/appinfo/update.php | 2 +- apps/user_ldap/group_ldap.php | 2 +- apps/user_ldap/settings.php | 6 +- apps/user_ldap/tests/group_ldap.php | 4 +- apps/user_ldap/user_ldap.php | 10 +- apps/user_webdavauth/settings.php | 4 +- apps/user_webdavauth/user_webdavauth.php | 6 +- core/ajax/appconfig.php | 2 +- core/minimizer.php | 4 +- core/templates/403.php | 2 +- core/templates/404.php | 2 +- core/templates/exception.php | 2 +- core/templates/layout.guest.php | 2 +- core/templates/layout.user.php | 6 +- cron.php | 2 +- lib/MDB2/Driver/Datatype/sqlite3.php | 2 +- lib/MDB2/Driver/Manager/sqlite3.php | 2 +- lib/MDB2/Driver/sqlite3.php | 28 ++--- lib/app.php | 82 ++++++------- lib/appconfig.php | 30 ++--- lib/archive.php | 16 +-- lib/archive/tar.php | 100 +++++++-------- lib/archive/zip.php | 58 ++++----- lib/backgroundjob/queuedtask.php | 14 +-- lib/backgroundjob/regulartask.php | 4 +- lib/backgroundjob/worker.php | 20 +-- lib/base.php | 8 +- lib/cache/apc.php | 2 +- lib/cache/broker.php | 2 +- lib/cache/file.php | 12 +- lib/cache/fileglobal.php | 10 +- lib/cache/xcache.php | 4 +- lib/config.php | 12 +- lib/connector/sabre/auth.php | 4 +- lib/connector/sabre/directory.php | 2 +- lib/connector/sabre/locks.php | 2 +- lib/connector/sabre/node.php | 8 +- lib/connector/sabre/principal.php | 4 +- lib/db.php | 60 ++++----- lib/eventsource.php | 16 +-- lib/filecache.php | 128 ++++++++++---------- lib/filecache/cached.php | 18 +-- lib/filecache/update.php | 62 +++++----- lib/fileproxy.php | 32 ++--- lib/fileproxy/quota.php | 24 ++-- lib/files.php | 84 ++++++------- lib/filestorage/common.php | 62 +++++----- lib/filestorage/commontest.php | 26 ++-- lib/filestorage/local.php | 96 +++++++-------- lib/filestorage/temporary.php | 6 +- lib/filesystem.php | 156 ++++++++++++------------ lib/filesystemview.php | 22 ++-- lib/geo.php | 4 +- lib/group.php | 62 +++++----- lib/group/backend.php | 12 +- lib/group/database.php | 18 +-- lib/group/dummy.php | 32 ++--- lib/helper.php | 112 ++++++++--------- lib/hook.php | 20 +-- lib/image.php | 10 +- lib/installer.php | 92 +++++++------- lib/json.php | 34 +++--- lib/l10n.php | 70 +++++------ lib/l10n/string.php | 6 +- lib/log/owncloud.php | 4 +- lib/mail.php | 4 +- lib/migrate.php | 174 +++++++++++++-------------- lib/migration/content.php | 42 +++---- lib/migration/provider.php | 8 +- lib/minimizer.php | 2 +- lib/minimizer/css.php | 2 +- lib/minimizer/js.php | 2 +- lib/ocs.php | 66 +++++----- lib/ocsclient.php | 34 +++--- lib/preferences.php | 28 ++--- lib/public/app.php | 18 +-- lib/public/backgroundjob.php | 14 +-- lib/public/config.php | 12 +- lib/public/db.php | 10 +- lib/public/files.php | 12 +- lib/public/json.php | 16 +-- lib/public/template.php | 6 +- lib/public/user.php | 14 +-- lib/public/util.php | 30 ++--- lib/request.php | 4 +- lib/search.php | 14 +-- lib/search/provider.php | 2 +- lib/search/provider/file.php | 10 +- lib/search/result.php | 2 +- lib/setup.php | 10 +- lib/streamwrappers.php | 40 +++--- lib/subadmin.php | 40 +++--- lib/template.php | 80 ++++++------ lib/templatelayout.php | 18 +-- lib/updater.php | 10 +- lib/user.php | 104 ++++++++-------- lib/user/backend.php | 12 +- lib/user/database.php | 30 ++--- lib/user/dummy.php | 18 +-- lib/user/http.php | 18 +-- lib/util.php | 116 +++++++++--------- lib/vcategories.php | 4 +- lib/vobject.php | 64 +++++----- search/ajax/search.php | 2 +- search/index.php | 2 +- settings/admin.php | 4 +- settings/ajax/apps/ocs.php | 4 +- settings/ajax/createuser.php | 4 +- settings/ajax/togglesubadmins.php | 2 +- settings/apps.php | 2 +- settings/personal.php | 6 +- settings/settings.php | 2 +- settings/templates/admin.php | 8 +- settings/templates/personal.php | 2 +- settings/templates/settings.php | 2 +- settings/users.php | 6 +- tests/index.php | 28 ++--- tests/lib/archive.php | 24 ++-- tests/lib/archive/tar.php | 6 +- tests/lib/archive/zip.php | 6 +- tests/lib/cache.php | 8 +- tests/lib/cache/apc.php | 4 +- tests/lib/cache/file.php | 6 +- tests/lib/cache/xcache.php | 4 +- tests/lib/filestorage.php | 28 ++--- tests/lib/filestorage/commontest.php | 6 +- tests/lib/filestorage/local.php | 4 +- tests/lib/filesystem.php | 14 +-- tests/lib/group.php | 6 +- tests/lib/group/backend.php | 8 +- tests/lib/group/database.php | 10 +- tests/lib/group/dummy.php | 2 +- tests/lib/streamwrappers.php | 12 +- tests/lib/user/backend.php | 6 +- tests/lib/user/database.php | 8 +- tests/lib/user/dummy.php | 2 +- 168 files changed, 1834 insertions(+), 1834 deletions(-) diff --git a/apps/files/admin.php b/apps/files/admin.php index b49c0f61a0c..a8f2deffc92 100644 --- a/apps/files/admin.php +++ b/apps/files/admin.php @@ -33,7 +33,7 @@ $upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize') $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size')); $maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size)); if($_POST) { - if(isset($_POST['maxUploadSize'])){ + if(isset($_POST['maxUploadSize'])) { if(($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) { $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize); } diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 2254526231e..568fe754c02 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -17,7 +17,7 @@ $data = array(); if($doBreadcrumb) { $breadcrumb = array(); $pathtohere = "/"; - foreach( explode( "/", $dir ) as $i ){ + foreach( explode( "/", $dir ) as $i ) { if( $i != "" ) { $pathtohere .= "$i/"; $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); @@ -32,7 +32,7 @@ if($doBreadcrumb) { // make filelist $files = array(); -foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ +foreach( OC_Files::getdirectorycontent( $dir ) as $i ) { $i["date"] = OCP\Util::formatDate($i["mtime"] ); $files[] = $i; } diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 813a6c67b5c..7709becc6a8 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -35,7 +35,7 @@ $dir = $_POST['dir']; $error=''; $totalSize=0; -foreach($files['size'] as $size){ +foreach($files['size'] as $size) { $totalSize+=$size; } if($totalSize>OC_Filesystem::free_space('/')) { @@ -46,7 +46,7 @@ if($totalSize>OC_Filesystem::free_space('/')) { $result=array(); if(strpos($dir, '..') === false) { $fileCount=count($files['name']); - for($i=0;$i<$fileCount;$i++){ + for($i=0;$i<$fileCount;$i++) { $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { $meta=OC_FileCache_Cached::get($target); diff --git a/apps/files/appinfo/filesync.php b/apps/files/appinfo/filesync.php index 707ee2435c0..c1fe444cec7 100644 --- a/apps/files/appinfo/filesync.php +++ b/apps/files/appinfo/filesync.php @@ -23,14 +23,14 @@ // only need filesystem apps $RUNTIME_APPTYPES=array('filesystem','authentication'); OC_App::loadApps($RUNTIME_APPTYPES); -if(!OC_User::isLoggedIn()){ - if(!isset($_SERVER['PHP_AUTH_USER'])){ +if(!OC_User::isLoggedIn()) { + if(!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="ownCloud Server"'); header('HTTP/1.0 401 Unauthorized'); echo 'Valid credentials must be supplied'; exit(); } else { - if(!OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])){ + if(!OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { exit(); } } diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php index 32ac89f0061..35008e345b9 100644 --- a/apps/files/appinfo/update.php +++ b/apps/files/appinfo/update.php @@ -5,7 +5,7 @@ $installedVersion=OCP\Config::getAppValue('files', 'installed_version'); if (version_compare($installedVersion, '1.1.4', '<')) { $query = OC_DB::prepare( "SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`" ); $result = $query->execute(); - while( $row = $result->fetchRow()){ + while( $row = $result->fetchRow()) { $query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyname` = ? WHERE `userid` = ? AND `propertypath` = ?' ); $query->execute( array( preg_replace("/^{.*}/", "", $row["propertyname"]),$row["userid"], $row["propertypath"] )); } diff --git a/apps/files/download.php b/apps/files/download.php index 44a328e25db..ff6aefbbe0f 100644 --- a/apps/files/download.php +++ b/apps/files/download.php @@ -29,7 +29,7 @@ OCP\User::checkLoggedIn(); $filename = $_GET["file"]; -if(!OC_Filesystem::file_exists($filename)){ +if(!OC_Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OCP\Template( '', '404', 'guest' ); $tmpl->assign('file',$filename); diff --git a/apps/files/index.php b/apps/files/index.php index ba785f7d6bc..493087d26f1 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -31,7 +31,7 @@ OCP\Util::addscript( 'files', 'jquery.fileupload' ); OCP\Util::addscript( 'files', 'files' ); OCP\Util::addscript( 'files', 'filelist' ); OCP\Util::addscript( 'files', 'fileactions' ); -if(!isset($_SESSION['timezone'])){ +if(!isset($_SESSION['timezone'])) { OCP\Util::addscript( 'files', 'timezone' ); } OCP\App::setActiveNavigationEntry( 'files_index' ); @@ -44,9 +44,9 @@ if(!OC_Filesystem::is_dir($dir.'/')) { } $files = array(); -foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ +foreach( OC_Files::getdirectorycontent( $dir ) as $i ) { $i['date'] = OCP\Util::formatDate($i['mtime'] ); - if($i['type']=='file'){ + if($i['type']=='file') { $fileinfo=pathinfo($i['name']); $i['basename']=$fileinfo['filename']; if (!empty($fileinfo['extension'])) { @@ -56,7 +56,7 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ $i['extension']=''; } } - if($i['directory']=='/'){ + if($i['directory']=='/') { $i['directory']=''; } $files[] = $i; @@ -65,8 +65,8 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ // Make breadcrumb $breadcrumb = array(); $pathtohere = ''; -foreach( explode( '/', $dir ) as $i ){ - if( $i != '' ){ +foreach( explode( '/', $dir ) as $i ) { + if( $i != '' ) { $pathtohere .= '/'.str_replace('+','%20', urlencode($i)); $breadcrumb[] = array( 'dir' => $pathtohere, 'name' => $i ); } diff --git a/apps/files/settings.php b/apps/files/settings.php index b02c3738c6e..52ec9fd0fe3 100644 --- a/apps/files/settings.php +++ b/apps/files/settings.php @@ -36,7 +36,7 @@ OCP\Util::addscript( "files", "files" ); $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); -foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ +foreach( OC_Files::getdirectorycontent( $dir ) as $i ) { $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); $files[] = $i; } @@ -44,8 +44,8 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ // Make breadcrumb $breadcrumb = array(); $pathtohere = "/"; -foreach( explode( "/", $dir ) as $i ){ - if( $i != "" ){ +foreach( explode( "/", $dir ) as $i ) { + if( $i != "" ) { $pathtohere .= "$i/"; $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); } diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index 679d0b95edc..bb130a366be 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -10,7 +10,7 @@ OCP\Util::connectHook('OC_User','post_login','OC_Crypt','loginListener'); stream_wrapper_register('crypt','OC_CryptStream'); -if(!isset($_SESSION['enckey']) and OCP\User::isLoggedIn()){//force the user to re-loggin if the encryption key isn't unlocked (happens when a user is logged in before the encryption app is enabled) +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) OCP\User::logout(); header("Location: ".OC::$WEBROOT.'/'); exit(); diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index ebc09e78961..38d8edf28c3 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -39,18 +39,18 @@ require_once 'Crypt_Blowfish/Blowfish.php'; class OC_Crypt { static private $bf = null; - public static function loginListener($params){ + public static function loginListener($params) { self::init($params['uid'],$params['password']); } public static function init($login,$password) { $view=new OC_FilesystemView('/'); - if(!$view->file_exists('/'.$login)){ + if(!$view->file_exists('/'.$login)) { $view->mkdir('/'.$login); } OC_FileProxy::$enabled=false; - if(!$view->file_exists('/'.$login.'/encryption.key')){// does key exist? + if(!$view->file_exists('/'.$login.'/encryption.key')) {// does key exist? OC_Crypt::createkey($login,$password); } $key=$view->file_get_contents('/'.$login.'/encryption.key'); @@ -66,14 +66,14 @@ class OC_Crypt { * * if the key is left out, the default handeler will be used */ - public static function getBlowfish($key=''){ - if($key){ + public static function getBlowfish($key='') { + if($key) { return new Crypt_Blowfish($key); }else{ - if(!isset($_SESSION['enckey'])){ + if(!isset($_SESSION['enckey'])) { return false; } - if(!self::$bf){ + if(!self::$bf) { self::$bf=new Crypt_Blowfish($_SESSION['enckey']); } return self::$bf; @@ -96,7 +96,7 @@ class OC_Crypt { } public static function changekeypasscode($oldPassword, $newPassword) { - if(OCP\User::isLoggedIn()){ + if(OCP\User::isLoggedIn()) { $username=OCP\USER::getUser(); $view=new OC_FilesystemView('/'.$username); @@ -179,7 +179,7 @@ class OC_Crypt { while (!feof($handleread)) { $content = fread($handleread, 8192); $enccontent=OC_CRYPT::decrypt( $content, $key); - if(feof($handleread)){ + if(feof($handleread)) { $enccontent=rtrim($enccontent, "\0"); } fwrite($handlewrite, $enccontent); @@ -192,9 +192,9 @@ class OC_Crypt { /** * encrypt data in 8192b sized blocks */ - public static function blockEncrypt($data, $key=''){ + public static function blockEncrypt($data, $key='') { $result=''; - while(strlen($data)){ + while(strlen($data)) { $result.=self::encrypt(substr($data,0,8192),$key); $data=substr($data,8192); } @@ -204,13 +204,13 @@ class OC_Crypt { /** * decrypt data in 8192b sized blocks */ - public static function blockDecrypt($data, $key='',$maxLength=0){ + public static function blockDecrypt($data, $key='',$maxLength=0) { $result=''; - while(strlen($data)){ + while(strlen($data)) { $result.=self::decrypt(substr($data,0,8192),$key); $data=substr($data,8192); } - if($maxLength>0){ + if($maxLength>0) { return substr($result,0,$maxLength); }else{ return rtrim($result, "\0"); diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php index 75ad62659d7..721a1b955df 100644 --- a/apps/files_encryption/lib/cryptstream.php +++ b/apps/files_encryption/lib/cryptstream.php @@ -36,18 +36,18 @@ class OC_CryptStream{ private $size; private static $rootView; - public function stream_open($path, $mode, $options, &$opened_path){ - if(!self::$rootView){ + public function stream_open($path, $mode, $options, &$opened_path) { + if(!self::$rootView) { self::$rootView=new OC_FilesystemView(''); } $path=str_replace('crypt://','',$path); - if(dirname($path)=='streams' and isset(self::$sourceStreams[basename($path)])){ + if(dirname($path)=='streams' and isset(self::$sourceStreams[basename($path)])) { $this->source=self::$sourceStreams[basename($path)]['stream']; $this->path=self::$sourceStreams[basename($path)]['path']; $this->size=self::$sourceStreams[basename($path)]['size']; }else{ $this->path=$path; - if($mode=='w' or $mode=='w+' or $mode=='wb' or $mode=='wb+'){ + if($mode=='w' or $mode=='w+' or $mode=='wb' or $mode=='wb+') { $this->size=0; }else{ $this->size=self::$rootView->filesize($path,$mode); @@ -55,55 +55,55 @@ class OC_CryptStream{ OC_FileProxy::$enabled=false;//disable fileproxies so we can open the source file $this->source=self::$rootView->fopen($path,$mode); OC_FileProxy::$enabled=true; - if(!is_resource($this->source)){ + if(!is_resource($this->source)) { OCP\Util::writeLog('files_encryption','failed to open '.$path,OCP\Util::ERROR); } } - if(is_resource($this->source)){ + if(is_resource($this->source)) { $this->meta=stream_get_meta_data($this->source); } return is_resource($this->source); } - public function stream_seek($offset, $whence=SEEK_SET){ + public function stream_seek($offset, $whence=SEEK_SET) { $this->flush(); fseek($this->source,$offset,$whence); } - public function stream_tell(){ + public function stream_tell() { return ftell($this->source); } - public function stream_read($count){ + public function stream_read($count) { //$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 $this->writeCache=''; - if($count!=8192){ + if($count!=8192) { OCP\Util::writeLog('files_encryption','php bug 21641 no longer holds, decryption will not work',OCP\Util::FATAL); die(); } $pos=ftell($this->source); $data=fread($this->source,8192); - if(strlen($data)){ + if(strlen($data)) { $result=OC_Crypt::decrypt($data); }else{ $result=''; } $length=$this->size-$pos; - if($length<8192){ + if($length<8192) { $result=substr($result,0,$length); } return $result; } - public function stream_write($data){ + public function stream_write($data) { $length=strlen($data); $currentPos=ftell($this->source); - if($this->writeCache){ + if($this->writeCache) { $data=$this->writeCache.$data; $this->writeCache=''; } - if($currentPos%8192!=0){ + if($currentPos%8192!=0) { //make sure we always start on a block start fseek($this->source,-($currentPos%8192),SEEK_CUR); $encryptedBlock=fread($this->source,8192); @@ -113,8 +113,8 @@ class OC_CryptStream{ fseek($this->source,-($currentPos%8192),SEEK_CUR); } $currentPos=ftell($this->source); - while($remainingLength=strlen($data)>0){ - if($remainingLength<8192){ + while($remainingLength=strlen($data)>0) { + if($remainingLength<8192) { $this->writeCache=$data; $data=''; }else{ @@ -127,8 +127,8 @@ class OC_CryptStream{ return $length; } - public function stream_set_option($option,$arg1,$arg2){ - switch($option){ + public function stream_set_option($option,$arg1,$arg2) { + switch($option) { case STREAM_OPTION_BLOCKING: stream_set_blocking($this->source,$arg1); break; @@ -140,33 +140,33 @@ class OC_CryptStream{ } } - public function stream_stat(){ + public function stream_stat() { return fstat($this->source); } - public function stream_lock($mode){ + public function stream_lock($mode) { flock($this->source,$mode); } - public function stream_flush(){ + public function stream_flush() { return fflush($this->source); } - public function stream_eof(){ + public function stream_eof() { return feof($this->source); } - private function flush(){ - if($this->writeCache){ + private function flush() { + if($this->writeCache) { $encrypted=OC_Crypt::encrypt($this->writeCache); fwrite($this->source,$encrypted); $this->writeCache=''; } } - public function stream_close(){ + public function stream_close() { $this->flush(); - if($this->meta['mode']!='r' and $this->meta['mode']!='rb'){ + if($this->meta['mode']!='r' and $this->meta['mode']!='rb') { OC_FileCache::put($this->path,array('encrypted'=>true,'size'=>$this->size),''); } return fclose($this->source); diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 247924b2aaf..f61cd1e3773 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -34,21 +34,21 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ * @param string $path * @return bool */ - private static function shouldEncrypt($path){ - if(is_null(self::$enableEncryption)){ + private static function shouldEncrypt($path) { + if(is_null(self::$enableEncryption)) { self::$enableEncryption=(OCP\Config::getAppValue('files_encryption','enable_encryption','true')=='true'); } - if(!self::$enableEncryption){ + if(!self::$enableEncryption) { return false; } - if(is_null(self::$blackList)){ + if(is_null(self::$blackList)) { self::$blackList=explode(',',OCP\Config::getAppValue('files_encryption','type_blacklist','jpg,png,jpeg,avi,mpg,mpeg,mkv,mp3,oga,ogv,ogg')); } - if(self::isEncrypted($path)){ + if(self::isEncrypted($path)) { return true; } $extension=substr($path,strrpos($path,'.')+1); - if(array_search($extension,self::$blackList)===false){ + if(array_search($extension,self::$blackList)===false) { return true; } } @@ -58,13 +58,13 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ * @param string $path * @return bool */ - private static function isEncrypted($path){ + private static function isEncrypted($path) { $metadata=OC_FileCache_Cached::get($path,''); return isset($metadata['encrypted']) and (bool)$metadata['encrypted']; } - public function preFile_put_contents($path,&$data){ - if(self::shouldEncrypt($path)){ + public function preFile_put_contents($path,&$data) { + if(self::shouldEncrypt($path)) { if (!is_resource($data)) {//stream put contents should have been converter to fopen $size=strlen($data); $data=OC_Crypt::blockEncrypt($data); @@ -73,24 +73,24 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ } } - public function postFile_get_contents($path,$data){ - if(self::isEncrypted($path)){ + public function postFile_get_contents($path,$data) { + if(self::isEncrypted($path)) { $cached=OC_FileCache_Cached::get($path,''); $data=OC_Crypt::blockDecrypt($data,'',$cached['size']); } return $data; } - public function postFopen($path,&$result){ - if(!$result){ + public function postFopen($path,&$result) { + if(!$result) { return $result; } $meta=stream_get_meta_data($result); - if(self::isEncrypted($path)){ + if(self::isEncrypted($path)) { fclose($result); $result=fopen('crypt://'.$path,$meta['mode']); - }elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb'){ - if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0){ + }elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb') { + if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0) { //first encrypt the target file so we don't end up with a half encrypted file OCP\Util::writeLog('files_encryption','Decrypting '.$path.' before writing',OCP\Util::DEBUG); $tmp=fopen('php://temp'); @@ -104,23 +104,23 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ return $result; } - public function postGetMimeType($path,$mime){ - if(self::isEncrypted($path)){ + public function postGetMimeType($path,$mime) { + if(self::isEncrypted($path)) { $mime=OCP\Files::getMimeType('crypt://'.$path,'w'); } return $mime; } - public function postStat($path,$data){ - if(self::isEncrypted($path)){ + public function postStat($path,$data) { + if(self::isEncrypted($path)) { $cached=OC_FileCache_Cached::get($path,''); $data['size']=$cached['size']; } return $data; } - public function postFileSize($path,$size){ - if(self::isEncrypted($path)){ + public function postFileSize($path,$size) { + if(self::isEncrypted($path)) { $cached=OC_FileCache_Cached::get($path,''); return $cached['size']; }else{ diff --git a/apps/files_encryption/templates/settings.php b/apps/files_encryption/templates/settings.php index 79780d694cf..55e8cf1542c 100644 --- a/apps/files_encryption/templates/settings.php +++ b/apps/files_encryption/templates/settings.php @@ -7,6 +7,6 @@ - > + > diff --git a/apps/files_encryption/tests/encryption.php b/apps/files_encryption/tests/encryption.php index f70411ed63c..89397f6ef2c 100644 --- a/apps/files_encryption/tests/encryption.php +++ b/apps/files_encryption/tests/encryption.php @@ -7,7 +7,7 @@ */ class Test_Encryption extends UnitTestCase { - function testEncryption(){ + function testEncryption() { $key=uniqid(); $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; $source=file_get_contents($file); //nice large text file @@ -54,7 +54,7 @@ class Test_Encryption extends UnitTestCase { } - function testBinary(){ + function testBinary() { $key=uniqid(); $file=__DIR__.'/binary'; diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php index c4952d13d39..042011a6c87 100644 --- a/apps/files_encryption/tests/proxy.php +++ b/apps/files_encryption/tests/proxy.php @@ -10,7 +10,7 @@ class Test_CryptProxy extends UnitTestCase { private $oldConfig; private $oldKey; - public function setUp(){ + public function setUp() { $user=OC_User::getUser(); $this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true'); @@ -40,14 +40,14 @@ class Test_CryptProxy extends UnitTestCase { $rootView->mkdir('/'.$user.'/files'); } - public function tearDown(){ + public function tearDown() { OCP\Config::setAppValue('files_encryption','enable_encryption',$this->oldConfig); - if(!is_null($this->oldKey)){ + if(!is_null($this->oldKey)) { $_SESSION['enckey']=$this->oldKey; } } - public function testSimple(){ + public function testSimple() { $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; $original=file_get_contents($file); @@ -64,7 +64,7 @@ class Test_CryptProxy extends UnitTestCase { } - public function testView(){ + public function testView() { $file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; $original=file_get_contents($file); @@ -86,7 +86,7 @@ class Test_CryptProxy extends UnitTestCase { $this->assertEqual($original,$fromFile); } - public function testBinary(){ + public function testBinary() { $file=__DIR__.'/binary'; $original=file_get_contents($file); diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php index 517d497344e..39b13620782 100644 --- a/apps/files_encryption/tests/stream.php +++ b/apps/files_encryption/tests/stream.php @@ -9,7 +9,7 @@ class Test_CryptStream extends UnitTestCase { private $tmpFiles=array(); - function testStream(){ + function testStream() { $stream=$this->getStream('test1','w',strlen('foobar')); fwrite($stream,'foobar'); fclose($stream); @@ -40,11 +40,11 @@ class Test_CryptStream extends UnitTestCase { * @param int size * @return resource */ - function getStream($id,$mode,$size){ - if($id===''){ + function getStream($id,$mode,$size) { + if($id==='') { $id=uniqid(); } - if(!isset($this->tmpFiles[$id])){ + if(!isset($this->tmpFiles[$id])) { $file=OCP\Files::tmpFile(); $this->tmpFiles[$id]=$file; }else{ @@ -55,7 +55,7 @@ class Test_CryptStream extends UnitTestCase { return fopen('crypt://streams/'.$id,$mode); } - function testBinary(){ + function testBinary() { $file=__DIR__.'/binary'; $source=file_get_contents($file); diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php index 818273f6c2d..261141455cc 100644 --- a/apps/files_external/lib/ftp.php +++ b/apps/files_external/lib/ftp.php @@ -15,13 +15,13 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{ private static $tempFiles=array(); - public function __construct($params){ + public function __construct($params) { $this->host=$params['host']; $this->user=$params['user']; $this->password=$params['password']; $this->secure=isset($params['secure'])?(bool)$params['secure']:false; $this->root=isset($params['root'])?$params['root']:'/'; - if(!$this->root || $this->root[0]!='/'){ + if(!$this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } //create the root folder if necesary @@ -35,16 +35,16 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{ * @param string path * @return string */ - public function constructUrl($path){ + public function constructUrl($path) { $url='ftp'; - if($this->secure){ + if($this->secure) { $url.='s'; } $url.='://'.$this->user.':'.$this->password.'@'.$this->host.$this->root.$path; return $url; } - public function fopen($path,$mode){ - switch($mode){ + public function fopen($path,$mode) { + switch($mode) { case 'r': case 'rb': case 'w': @@ -63,14 +63,14 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{ case 'c': case 'c+': //emulate these - if(strrpos($path,'.')!==false){ + if(strrpos($path,'.')!==false) { $ext=substr($path,strrpos($path,'.')); }else{ $ext=''; } $tmpFile=OCP\Files::tmpFile($ext); OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack'); - if($this->file_exists($path)){ + if($this->file_exists($path)) { $this->getFile($path,$tmpFile); } self::$tempFiles[$tmpFile]=$path; @@ -78,8 +78,8 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{ } } - public function writeBack($tmpFile){ - if(isset(self::$tempFiles[$tmpFile])){ + public function writeBack($tmpFile) { + if(isset(self::$tempFiles[$tmpFile])) { $this->uploadFile($tmpFile,self::$tempFiles[$tmpFile]); unlink($tmpFile); } diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 91c0f16c1f6..e5ba7a17743 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -15,40 +15,40 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ private $root; private $share; - public function __construct($params){ + public function __construct($params) { $this->host=$params['host']; $this->user=$params['user']; $this->password=$params['password']; $this->share=$params['share']; $this->root=isset($params['root'])?$params['root']:'/'; - if(!$this->root || $this->root[0]!='/'){ + if(!$this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } - if(substr($this->root,-1,1)!='/'){ + if(substr($this->root,-1,1)!='/') { $this->root.='/'; } - if(!$this->share || $this->share[0]!='/'){ + if(!$this->share || $this->share[0]!='/') { $this->share='/'.$this->share; } - if(substr($this->share,-1,1)=='/'){ + if(substr($this->share,-1,1)=='/') { $this->share=substr($this->share,0,-1); } //create the root folder if necesary - if(!$this->is_dir('')){ + if(!$this->is_dir('')) { $this->mkdir(''); } } - public function constructUrl($path){ - if(substr($path,-1)=='/'){ + public function constructUrl($path) { + if(substr($path,-1)=='/') { $path=substr($path,0,-1); } return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path; } - public function stat($path){ - if(!$path and $this->root=='/'){//mtime doesn't work for shares + public function stat($path) { + if(!$path and $this->root=='/') {//mtime doesn't work for shares $mtime=$this->shareMTime(); $stat=stat($this->constructUrl($path)); $stat['mtime']=$mtime; @@ -58,7 +58,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ } } - public function filetype($path){ + public function filetype($path) { return (bool)@$this->opendir($path);//using opendir causes the same amount of requests and caches the content of the folder in one go } @@ -67,8 +67,8 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ * @param int $time * @return bool */ - public function hasUpdated($path,$time){ - if(!$path and $this->root=='/'){ + public function hasUpdated($path,$time) { + if(!$path and $this->root=='/') { //mtime doesn't work for shares, but giving the nature of the backend, doing a full update is still just fast enough return true; }else{ @@ -80,13 +80,13 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ /** * get the best guess for the modification time of the share */ - private function shareMTime(){ + private function shareMTime() { $dh=$this->opendir(''); $lastCtime=0; - while($file=readdir($dh)){ - if($file!='.' and $file!='..'){ + while($file=readdir($dh)) { + if($file!='.' and $file!='..') { $ctime=$this->filemtime($file); - if($ctime>$lastCtime){ + if($ctime>$lastCtime) { $lastCtime=$ctime; } } diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index 467c5a5b845..7263ef23253 100644 --- a/apps/files_external/lib/streamwrapper.php +++ b/apps/files_external/lib/streamwrapper.php @@ -10,12 +10,12 @@ abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{ abstract public function constructUrl($path); - public function mkdir($path){ + public function mkdir($path) { return mkdir($this->constructUrl($path)); } - public function rmdir($path){ - if($this->file_exists($path)){ + public function rmdir($path) { + if($this->file_exists($path)) { $succes=rmdir($this->constructUrl($path)); clearstatcache(); return $succes; @@ -24,42 +24,42 @@ abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{ } } - public function opendir($path){ + public function opendir($path) { return opendir($this->constructUrl($path)); } - public function filetype($path){ + public function filetype($path) { return filetype($this->constructUrl($path)); } - public function isReadable($path){ + public function isReadable($path) { return true;//not properly supported } - public function isUpdatable($path){ + public function isUpdatable($path) { return true;//not properly supported } - public function file_exists($path){ + public function file_exists($path) { return file_exists($this->constructUrl($path)); } - public function unlink($path){ + public function unlink($path) { $succes=unlink($this->constructUrl($path)); clearstatcache(); return $succes; } - public function fopen($path,$mode){ + public function fopen($path,$mode) { return fopen($this->constructUrl($path),$mode); } - public function free_space($path){ + public function free_space($path) { return 0; } - public function touch($path,$mtime=null){ - if(is_null($mtime)){ + public function touch($path,$mtime=null) { + if(is_null($mtime)) { $fh=$this->fopen($path,'a'); fwrite($fh,''); fclose($fh); @@ -68,19 +68,19 @@ abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{ } } - public function getFile($path,$target){ + public function getFile($path,$target) { return copy($this->constructUrl($path),$target); } - public function uploadFile($path,$target){ + public function uploadFile($path,$target) { return copy($path,$this->constructUrl($target)); } - public function rename($path1,$path2){ + public function rename($path1,$path2) { return rename($this->constructUrl($path1),$this->constructUrl($path2)); } - public function stat($path){ + public function stat($path) { return stat($this->constructUrl($path)); } diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php index 9a4b5c6dd2b..c29d28b44c1 100644 --- a/apps/files_external/lib/swift.php +++ b/apps/files_external/lib/swift.php @@ -38,7 +38,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string path * @return string */ - private function getContainerName($path){ + private function getContainerName($path) { $path=trim($this->root.$path,'/'); return str_replace('/','\\',$path); } @@ -48,18 +48,18 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string path * @return CF_Container */ - private function getContainer($path){ - if($path=='' or $path=='/'){ + private function getContainer($path) { + if($path=='' or $path=='/') { return $this->rootContainer; } - if(isset($this->containers[$path])){ + if(isset($this->containers[$path])) { return $this->containers[$path]; } try{ $container=$this->conn->get_container($this->getContainerName($path)); $this->containers[$path]=$container; return $container; - }catch(NoSuchContainerException $e){ + }catch(NoSuchContainerException $e) { return null; } } @@ -69,15 +69,15 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string path * @return CF_Container */ - private function createContainer($path){ - if($path=='' or $path=='/'){ + private function createContainer($path) { + if($path=='' or $path=='/') { return $this->conn->create_container($this->getContainerName($path)); } $parent=dirname($path); - if($parent=='' or $parent=='/'){ + if($parent=='' or $parent=='/') { $parentContainer=$this->rootContainer; }else{ - if(!$this->containerExists($parent)){ + if(!$this->containerExists($parent)) { $parentContainer=$this->createContainer($parent); }else{ $parentContainer=$this->getContainer($parent); @@ -92,19 +92,19 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string path * @return CF_Object */ - private function getObject($path){ - if(isset($this->objects[$path])){ + private function getObject($path) { + if(isset($this->objects[$path])) { return $this->objects[$path]; } $container=$this->getContainer(dirname($path)); - if(is_null($container)){ + if(is_null($container)) { return null; }else{ try{ $obj=$container->get_object(basename($path)); $this->objects[$path]=$obj; return $obj; - }catch(NoSuchObjectException $e){ + }catch(NoSuchObjectException $e) { return null; } } @@ -115,12 +115,12 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param CF_Container * @return array */ - private function getObjects($container){ - if(is_null($container)){ + private function getObjects($container) { + if(is_null($container)) { return array(); }else{ $files=$container->get_objects(); - foreach($files as &$file){ + foreach($files as &$file) { $file=$file->name; } return $files; @@ -132,9 +132,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string path * @return CF_Object */ - private function createObject($path){ + private function createObject($path) { $container=$this->getContainer(dirname($path)); - if(!is_null($container)){ + if(!is_null($container)) { $container=$this->createContainer($path); } return $container->create_object(basename($path)); @@ -145,7 +145,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string * @return bool */ - private function objectExists($path){ + private function objectExists($path) { return !is_null($this->getObject($path)); } @@ -154,7 +154,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string path * @return bool */ - private function containerExists($path){ + private function containerExists($path) { return !is_null($this->getContainer($path)); } @@ -163,18 +163,18 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param CF_Container container * @return array */ - private function getSubContainers($container){ + private function getSubContainers($container) { $tmpFile=OCP\Files::tmpFile(); $obj=$this->getSubContainerFile($container); try{ $obj->save_to_filename($tmpFile); - }catch(Exception $e){ + }catch(Exception $e) { return array(); } $obj->save_to_filename($tmpFile); $containers=file($tmpFile); unlink($tmpFile); - foreach($containers as &$sub){ + foreach($containers as &$sub) { $sub=trim($sub); } return $containers; @@ -186,8 +186,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string name * @return bool */ - private function addSubContainer($container,$name){ - if(!$name){ + private function addSubContainer($container,$name) { + if(!$name) { return false; } $tmpFile=OCP\Files::tmpFile(); @@ -195,17 +195,17 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ try{ $obj->save_to_filename($tmpFile); $containers=file($tmpFile); - foreach($containers as &$sub){ + foreach($containers as &$sub) { $sub=trim($sub); } - if(array_search($name,$containers)!==false){ + if(array_search($name,$containers)!==false) { unlink($tmpFile); return false; }else{ $fh=fopen($tmpFile,'a'); fwrite($fh,$name."\n"); } - }catch(Exception $e){ + }catch(Exception $e) { $containers=array(); file_put_contents($tmpFile,$name."\n"); } @@ -221,8 +221,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string name * @return bool */ - private function removeSubContainer($container,$name){ - if(!$name){ + private function removeSubContainer($container,$name) { + if(!$name) { return false; } $tmpFile=OCP\Files::tmpFile(); @@ -230,14 +230,14 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ try{ $obj->save_to_filename($tmpFile); $containers=file($tmpFile); - }catch(Exception $e){ + }catch(Exception $e) { return false; } - foreach($containers as &$sub){ + foreach($containers as &$sub) { $sub=trim($sub); } $i=array_search($name,$containers); - if($i===false){ + if($i===false) { unlink($tmpFile); return false; }else{ @@ -255,21 +255,21 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param CF_Container container * @return CF_Object */ - private function getSubContainerFile($container){ + private function getSubContainerFile($container) { try{ return $container->get_object(self::SUBCONTAINER_FILE); - }catch(NoSuchObjectException $e){ + }catch(NoSuchObjectException $e) { return $container->create_object(self::SUBCONTAINER_FILE); } } - public function __construct($params){ + public function __construct($params) { $this->token=$params['token']; $this->host=$params['host']; $this->user=$params['user']; $this->root=isset($params['root'])?$params['root']:'/'; $this->secure=isset($params['secure'])?(bool)$params['secure']:true; - if(!$this->root || $this->root[0]!='/'){ + if(!$this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } $this->auth = new CF_Authentication($this->user, $this->token, null, $this->host); @@ -277,7 +277,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ $this->conn = new CF_Connection($this->auth); - if(!$this->containerExists($this->root)){ + if(!$this->containerExists($this->root)) { $this->rootContainer=$this->createContainer('/'); }else{ $this->rootContainer=$this->getContainer('/'); @@ -285,8 +285,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } - public function mkdir($path){ - if($this->containerExists($path)){ + public function mkdir($path) { + if($this->containerExists($path)) { return false; }else{ $this->createContainer($path); @@ -294,12 +294,12 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - public function rmdir($path){ - if(!$this->containerExists($path)){ + public function rmdir($path) { + if(!$this->containerExists($path)) { return false; }else{ $this->emptyContainer($path); - if($path!='' and $path!='/'){ + if($path!='' and $path!='/') { $parentContainer=$this->getContainer(dirname($path)); $this->removeSubContainer($parentContainer,basename($path)); } @@ -310,14 +310,14 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - private function emptyContainer($path){ + private function emptyContainer($path) { $container=$this->getContainer($path); - if(is_null($container)){ + if(is_null($container)) { return; } $subContainers=$this->getSubContainers($container); - foreach($subContainers as $sub){ - if($sub){ + foreach($subContainers as $sub) { + if($sub) { $this->emptyContainer($path.'/'.$sub); $this->conn->delete_container($this->getContainerName($path.'/'.$sub)); unset($this->containers[$path.'/'.$sub]); @@ -325,17 +325,17 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } $objects=$this->getObjects($container); - foreach($objects as $object){ + foreach($objects as $object) { $container->delete_object($object); unset($this->objects[$path.'/'.$object]); } } - public function opendir($path){ + public function opendir($path) { $container=$this->getContainer($path); $files=$this->getObjects($container); $i=array_search(self::SUBCONTAINER_FILE,$files); - if($i!==false){ + if($i!==false) { unset($files[$i]); } $subContainers=$this->getSubContainers($container); @@ -345,43 +345,43 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ return opendir('fakedir://'.$id); } - public function filetype($path){ - if($this->containerExists($path)){ + public function filetype($path) { + if($this->containerExists($path)) { return 'dir'; }else{ return 'file'; } } - public function isReadable($path){ + public function isReadable($path) { return true; } - public function isUpdatable($path){ + public function isUpdatable($path) { return true; } - public function file_exists($path){ - if($this->is_dir($path)){ + public function file_exists($path) { + if($this->is_dir($path)) { return true; }else{ return $this->objectExists($path); } } - public function file_get_contents($path){ + public function file_get_contents($path) { $obj=$this->getObject($path); - if(is_null($obj)){ + if(is_null($obj)) { return false; } return $obj->read(); } - public function file_put_contents($path,$content){ + public function file_put_contents($path,$content) { $obj=$this->getObject($path); - if(is_null($obj)){ + if(is_null($obj)) { $container=$this->getContainer(dirname($path)); - if(is_null($container)){ + if(is_null($container)) { return false; } $obj=$container->create_object(basename($path)); @@ -390,8 +390,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ return $obj->write($content); } - public function unlink($path){ - if($this->objectExists($path)){ + public function unlink($path) { + if($this->objectExists($path)) { $container=$this->getContainer(dirname($path)); $container->delete_object(basename($path)); unset($this->objects[$path]); @@ -400,12 +400,12 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - public function fopen($path,$mode){ + public function fopen($path,$mode) { $obj=$this->getObject($path); - if(is_null($obj)){ + if(is_null($obj)) { return false; } - switch($mode){ + switch($mode) { case 'r': case 'rb': $fp = fopen('php://temp', 'r+'); @@ -432,23 +432,23 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - public function writeBack($tmpFile){ - if(isset(self::$tempFiles[$tmpFile])){ + public function writeBack($tmpFile) { + if(isset(self::$tempFiles[$tmpFile])) { $this->fromTmpFile($tmpFile,self::$tempFiles[$tmpFile]); unlink($tmpFile); } } - public function free_space($path){ + public function free_space($path) { return 0; } - public function touch($path,$mtime=null){ + public function touch($path,$mtime=null) { $obj=$this->getObject($path); - if(is_null($obj)){ + if(is_null($obj)) { return false; } - if(is_null($mtime)){ + if(is_null($mtime)) { $mtime=time(); } @@ -457,36 +457,36 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ $obj->sync_metadata(); } - public function rename($path1,$path2){ + public function rename($path1,$path2) { $sourceContainer=$this->getContainer(dirname($path1)); $targetContainer=$this->getContainer(dirname($path2)); $result=$sourceContainer->move_object_to(basename($path1),$targetContainer,basename($path2)); unset($this->objects[$path1]); - if($result){ + if($result) { $targetObj=$this->getObject($path2); $this->resetMTime($targetObj); } return $result; } - public function copy($path1,$path2){ + public function copy($path1,$path2) { $sourceContainer=$this->getContainer(dirname($path1)); $targetContainer=$this->getContainer(dirname($path2)); $result=$sourceContainer->copy_object_to(basename($path1),$targetContainer,basename($path2)); - if($result){ + if($result) { $targetObj=$this->getObject($path2); $this->resetMTime($targetObj); } return $result; } - public function stat($path){ + public function stat($path) { $obj=$this->getObject($path); - if(is_null($obj)){ + if(is_null($obj)) { return false; } - if(isset($obj->metadata['Mtime']) and $obj->metadata['Mtime']>-1){ + if(isset($obj->metadata['Mtime']) and $obj->metadata['Mtime']>-1) { $mtime=$obj->metadata['Mtime']; }else{ $mtime=strtotime($obj->last_modified); @@ -498,9 +498,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ ); } - private function getTmpFile($path){ + private function getTmpFile($path) { $obj=$this->getObject($path); - if(!is_null($obj)){ + if(!is_null($obj)) { $tmpFile=OCP\Files::tmpFile(); $obj->save_to_filename($tmpFile); return $tmpFile; @@ -509,9 +509,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - private function fromTmpFile($tmpFile,$path){ + private function fromTmpFile($tmpFile,$path) { $obj=$this->getObject($path); - if(is_null($obj)){ + if(is_null($obj)) { $obj=$this->createObject($path); } $obj->load_from_filename($tmpFile); @@ -522,8 +522,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * remove custom mtime metadata * @param CF_Object obj */ - private function resetMTime($obj){ - if(isset($obj->metadata['Mtime'])){ + private function resetMTime($obj) { + if(isset($obj->metadata['Mtime'])) { $obj->metadata['Mtime']=-1; $obj->sync_metadata(); } diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 1b9c3e3333b..3c18b227fa6 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -19,7 +19,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ private static $tempFiles=array(); - public function __construct($params){ + public function __construct($params) { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() if (substr($host,0,8) == "https://") $host = substr($host, 8); @@ -29,10 +29,10 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $this->password=$params['password']; $this->secure=(isset($params['secure']) && $params['secure'] == 'true')?true:false; $this->root=isset($params['root'])?$params['root']:'/'; - if(!$this->root || $this->root[0]!='/'){ + if(!$this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } - if(substr($this->root,-1,1)!='/'){ + if(substr($this->root,-1,1)!='/') { $this->root.='/'; } @@ -54,26 +54,26 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $this->mkdir(''); } - private function createBaseUri(){ + private function createBaseUri() { $baseUri='http'; - if($this->secure){ + if($this->secure) { $baseUri.='s'; } $baseUri.='://'.$this->host.$this->root; return $baseUri; } - public function mkdir($path){ + public function mkdir($path) { $path=$this->cleanPath($path); return $this->simpleResponse('MKCOL',$path,null,201); } - public function rmdir($path){ + public function rmdir($path) { $path=$this->cleanPath($path); return $this->simpleResponse('DELETE',$path,null,204); } - public function opendir($path){ + public function opendir($path) { $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array(),1); @@ -81,54 +81,54 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ OC_FakeDirStream::$dirs[$id]=array(); $files=array_keys($response); array_shift($files);//the first entry is the current directory - foreach($files as $file){ + foreach($files as $file) { $file = urldecode(basename($file)); OC_FakeDirStream::$dirs[$id][]=$file; } return opendir('fakedir://'.$id); - }catch(Exception $e){ + }catch(Exception $e) { return false; } } - public function filetype($path){ + public function filetype($path) { $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array('{DAV:}resourcetype')); $responseType=$response["{DAV:}resourcetype"]->resourceType; return (count($responseType)>0 and $responseType[0]=="{DAV:}collection")?'dir':'file'; - }catch(Exception $e){ + }catch(Exception $e) { error_log($e->getMessage()); \OCP\Util::writeLog("webdav client", \OCP\Util::sanitizeHTML($e->getMessage()), \OCP\Util::ERROR); return false; } } - public function isReadable($path){ + public function isReadable($path) { return true;//not properly supported } - public function isUpdatable($path){ + public function isUpdatable($path) { return true;//not properly supported } - public function file_exists($path){ + public function file_exists($path) { $path=$this->cleanPath($path); try{ $this->client->propfind($path, array('{DAV:}resourcetype')); return true;//no 404 exception - }catch(Exception $e){ + }catch(Exception $e) { return false; } } - public function unlink($path){ + public function unlink($path) { return $this->simpleResponse('DELETE',$path,null,204); } - public function fopen($path,$mode){ + public function fopen($path,$mode) { $path=$this->cleanPath($path); - switch($mode){ + switch($mode) { case 'r': case 'rb': //straight up curl instead of sabredav here, sabredav put's the entire get result in memory @@ -155,14 +155,14 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ case 'c': case 'c+': //emulate these - if(strrpos($path,'.')!==false){ + if(strrpos($path,'.')!==false) { $ext=substr($path,strrpos($path,'.')); }else{ $ext=''; } $tmpFile=OCP\Files::tmpFile($ext); OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack'); - if($this->file_exists($path)){ + if($this->file_exists($path)) { $this->getFile($path,$tmpFile); } self::$tempFiles[$tmpFile]=$path; @@ -170,41 +170,41 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ } } - public function writeBack($tmpFile){ - if(isset(self::$tempFiles[$tmpFile])){ + public function writeBack($tmpFile) { + if(isset(self::$tempFiles[$tmpFile])) { $this->uploadFile($tmpFile,self::$tempFiles[$tmpFile]); unlink($tmpFile); } } - public function free_space($path){ + public function free_space($path) { $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array('{DAV:}quota-available-bytes')); - if(isset($response['{DAV:}quota-available-bytes'])){ + if(isset($response['{DAV:}quota-available-bytes'])) { return (int)$response['{DAV:}quota-available-bytes']; }else{ return 0; } - }catch(Exception $e){ + }catch(Exception $e) { return 0; } } - public function touch($path,$mtime=null){ - if(is_null($mtime)){ + public function touch($path,$mtime=null) { + if(is_null($mtime)) { $mtime=time(); } $path=$this->cleanPath($path); $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime)); } - public function getFile($path,$target){ + public function getFile($path,$target) { $source=$this->fopen($path,'r'); file_put_contents($target,$source); } - public function uploadFile($path,$target){ + public function uploadFile($path,$target) { $source=fopen($path,'r'); $curl = curl_init(); @@ -218,13 +218,13 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ curl_close ($curl); } - public function rename($path1,$path2){ + public function rename($path1,$path2) { $path1=$this->cleanPath($path1); $path2=$this->root.$this->cleanPath($path2); try{ $response=$this->client->request('MOVE',$path1,null,array('Destination'=>$path2)); return true; - }catch(Exception $e){ + }catch(Exception $e) { echo $e; echo 'fail'; var_dump($response); @@ -232,13 +232,13 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ } } - public function copy($path1,$path2){ + public function copy($path1,$path2) { $path1=$this->cleanPath($path1); $path2=$this->root.$this->cleanPath($path2); try{ $response=$this->client->request('COPY',$path1,null,array('Destination'=>$path2)); return true; - }catch(Exception $e){ + }catch(Exception $e) { echo $e; echo 'fail'; var_dump($response); @@ -246,7 +246,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ } } - public function stat($path){ + public function stat($path) { $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array('{DAV:}getlastmodified','{DAV:}getcontentlength')); @@ -255,43 +255,43 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ 'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, 'ctime'=>-1, ); - }catch(Exception $e){ + }catch(Exception $e) { return array(); } } - public function getMimeType($path){ + public function getMimeType($path) { $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array('{DAV:}getcontenttype','{DAV:}resourcetype')); $responseType=$response["{DAV:}resourcetype"]->resourceType; $type=(count($responseType)>0 and $responseType[0]=="{DAV:}collection")?'dir':'file'; - if($type=='dir'){ + if($type=='dir') { return 'httpd/unix-directory'; - }elseif(isset($response['{DAV:}getcontenttype'])){ + }elseif(isset($response['{DAV:}getcontenttype'])) { return $response['{DAV:}getcontenttype']; }else{ return false; } - }catch(Exception $e){ + }catch(Exception $e) { return false; } } - private function cleanPath($path){ - if(!$path || $path[0]=='/'){ + private function cleanPath($path) { + if(!$path || $path[0]=='/') { return substr($path,1); }else{ return $path; } } - private function simpleResponse($method,$path,$body,$expected){ + private function simpleResponse($method,$path,$body,$expected) { $path=$this->cleanPath($path); try{ $response=$this->client->request($method,$path,$body); return $response['statusCode']==$expected; - }catch(Exception $e){ + }catch(Exception $e) { return false; } } diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php index 3548880e834..12f3ec3908d 100644 --- a/apps/files_external/tests/ftp.php +++ b/apps/files_external/tests/ftp.php @@ -7,21 +7,21 @@ */ $config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){ +if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']) { abstract class Test_Filestorage_FTP extends Test_FileStorage{} return; }else{ class Test_Filestorage_FTP extends Test_FileStorage { private $config; - public function setUp(){ + public function setUp() { $id=uniqid(); $this->config=include('apps/files_external/tests/config.php'); $this->config['ftp']['root'].='/'.$id;//make sure we have an new empty folder to work in $this->instance=new OC_Filestorage_FTP($this->config['ftp']); } - public function tearDown(){ + public function tearDown() { OCP\Files::rmdirr($this->instance->constructUrl('')); } } diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php index b0bd9cbbeaf..d2a6358ade4 100644 --- a/apps/files_external/tests/google.php +++ b/apps/files_external/tests/google.php @@ -21,7 +21,7 @@ */ $config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['google']) or !$config['google']['run']){ +if(!is_array($config) or !isset($config['google']) or !$config['google']['run']) { abstract class Test_Filestorage_Google extends Test_FileStorage{} return; }else{ @@ -29,14 +29,14 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run']) private $config; - public function setUp(){ + public function setUp() { $id=uniqid(); $this->config=include('apps/files_external/tests/config.php'); $this->config['google']['root'].='/'.$id;//make sure we have an new empty folder to work in $this->instance=new OC_Filestorage_Google($this->config['google']); } - public function tearDown(){ + public function tearDown() { $this->instance->rmdir('/'); } } diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php index 001ef842276..7de4fddbb34 100644 --- a/apps/files_external/tests/smb.php +++ b/apps/files_external/tests/smb.php @@ -8,21 +8,21 @@ $config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']){ +if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']) { abstract class Test_Filestorage_SMB extends Test_FileStorage{} return; }else{ class Test_Filestorage_SMB extends Test_FileStorage { private $config; - public function setUp(){ + public function setUp() { $id=uniqid(); $this->config=include('apps/files_external/tests/config.php'); $this->config['smb']['root'].=$id;//make sure we have an new empty folder to work in $this->instance=new OC_Filestorage_SMB($this->config['smb']); } - public function tearDown(){ + public function tearDown() { OCP\Files::rmdirr($this->instance->constructUrl('')); } } diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php index bfe7b77aac5..a6f5eace1c8 100644 --- a/apps/files_external/tests/swift.php +++ b/apps/files_external/tests/swift.php @@ -7,14 +7,14 @@ */ $config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']){ +if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']) { abstract class Test_Filestorage_SWIFT extends Test_FileStorage{} return; }else{ class Test_Filestorage_SWIFT extends Test_FileStorage { private $config; - public function setUp(){ + public function setUp() { $id=uniqid(); $this->config=include('apps/files_external/tests/config.php'); $this->config['swift']['root'].='/'.$id;//make sure we have an new empty folder to work in @@ -22,7 +22,7 @@ if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']){ } - public function tearDown(){ + public function tearDown() { $this->instance->rmdir(''); } diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php index 49c44124f3c..74d980aa3f1 100644 --- a/apps/files_external/tests/webdav.php +++ b/apps/files_external/tests/webdav.php @@ -7,21 +7,21 @@ */ $config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run']){ +if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run']) { abstract class Test_Filestorage_DAV extends Test_FileStorage{} return; }else{ class Test_Filestorage_DAV extends Test_FileStorage { private $config; - public function setUp(){ + public function setUp() { $id=uniqid(); $this->config=include('apps/files_external/tests/config.php'); $this->config['webdav']['root'].='/'.$id;//make sure we have an new empty folder to work in $this->instance=new OC_Filestorage_DAV($this->config['webdav']); } - public function tearDown(){ + public function tearDown() { $this->instance->rmdir('/'); } } diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 4530ce87777..6dba76955a0 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -443,7 +443,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { * @param int $time * @return bool */ - public function hasUpdated($path,$time){ + public function hasUpdated($path,$time) { //TODO return false; } diff --git a/apps/files_versions/ajax/expireAll.php b/apps/files_versions/ajax/expireAll.php index f76da3da986..5c95885ffbd 100644 --- a/apps/files_versions/ajax/expireAll.php +++ b/apps/files_versions/ajax/expireAll.php @@ -31,7 +31,7 @@ OCP\JSON::callCheck(); $versions = new OCA_Versions\Storage(); -if( $versions->expireAll() ){ +if( $versions->expireAll() ) { OCP\JSON::success(); die(); diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php index 24d71a914a4..f1b02eb4b92 100644 --- a/apps/files_versions/ajax/rollbackVersion.php +++ b/apps/files_versions/ajax/rollbackVersion.php @@ -9,7 +9,7 @@ $file = $_GET['file']; $revision=(int)$_GET['revision']; if( OCA_Versions\Storage::isversioned( $file ) ) { - if(OCA_Versions\Storage::rollback( $file, $revision )){ + if(OCA_Versions\Storage::rollback( $file, $revision )) { OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file ))); }else{ OCP\JSON::error(array("data" => array( "message" => "Could not revert:" . $file ))); diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php index 330f10afb59..9ec0b01a7f9 100644 --- a/apps/files_versions/lib/hooks.php +++ b/apps/files_versions/lib/hooks.php @@ -44,7 +44,7 @@ class Hooks { $abs_path = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('').$rel_path.'.v'; if(Storage::isversioned($rel_path)) { $versions = Storage::getVersions($rel_path); - foreach ($versions as $v){ + foreach ($versions as $v) { unlink($abs_path . $v['version']); } } @@ -66,7 +66,7 @@ class Hooks { $info=pathinfo($abs_newpath); if(!file_exists($info['dirname'])) mkdir($info['dirname'],0700,true); $versions = Storage::getVersions($rel_oldpath); - foreach ($versions as $v){ + foreach ($versions as $v) { rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']); } } diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 4ea1a07b942..dedd83fc25a 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -82,7 +82,7 @@ class Storage { } // check if filename is a directory - if($files_view->is_dir($filename)){ + if($files_view->is_dir($filename)) { return false; } @@ -97,7 +97,7 @@ class Storage { } // check filesize - if($files_view->filesize($filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){ + if($files_view->filesize($filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)) { return false; } @@ -107,7 +107,7 @@ class Storage { $matches=glob($versionsFolderName.'/'.$filename.'.v*'); sort($matches); $parts=explode('.v',end($matches)); - if((end($parts)+Storage::DEFAULTMININTERVAL)>time()){ + if((end($parts)+Storage::DEFAULTMININTERVAL)>time()) { return false; } } @@ -175,7 +175,7 @@ class Storage { // check for old versions $matches=glob($versionsFolderName.$filename.'.v*'); - if(count($matches)>0){ + if(count($matches)>0) { return true; }else{ return false; diff --git a/apps/user_ldap/appinfo/install.php b/apps/user_ldap/appinfo/install.php index 9efc3bb24d2..378957ec409 100644 --- a/apps/user_ldap/appinfo/install.php +++ b/apps/user_ldap/appinfo/install.php @@ -1,6 +1,6 @@ connection->isCached('groupExists'.$gid)) { return $this->connection->getFromCache('groupExists'.$gid); } diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index 23018890eac..f765151456a 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -26,8 +26,8 @@ OCP\Util::addscript('user_ldap', 'settings'); OCP\Util::addstyle('user_ldap', 'settings'); if ($_POST) { - foreach($params as $param){ - if(isset($_POST[$param])){ + foreach($params as $param) { + if(isset($_POST[$param])) { if('ldap_agent_password' == $param) { OCP\Config::setAppValue('user_ldap', $param, base64_encode($_POST[$param])); } elseif('ldap_cache_ttl' == $param) { @@ -58,7 +58,7 @@ if ($_POST) { // fill template $tmpl = new OCP\Template( 'user_ldap', 'settings'); -foreach($params as $param){ +foreach($params as $param) { $value = OCP\Config::getAppValue('user_ldap', $param,''); $tmpl->assign($param, $value); } diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php index ac66a608b76..b953127d86e 100644 --- a/apps/user_ldap/tests/group_ldap.php +++ b/apps/user_ldap/tests/group_ldap.php @@ -21,11 +21,11 @@ */ class Test_Group_Ldap extends UnitTestCase { - function setUp(){ + function setUp() { OC_Group::clearBackends(); } - function testSingleBackend(){ + function testSingleBackend() { OC_Group::useBackend(new OCA\user_ldap\GROUP_LDAP()); $group_ldap = new OCA\user_ldap\GROUP_LDAP(); diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index d297374600a..bacdb8b9ae1 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -65,7 +65,7 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { * * Check if the password is correct without logging in the user */ - public function checkPassword($uid, $password){ + public function checkPassword($uid, $password) { //find out dn of the user name $filter = \OCP\Util::mb_str_replace('%uid', $uid, $this->connection->ldapLoginFilter, 'UTF-8'); $ldap_users = $this->fetchListOfUsers($filter, 'dn'); @@ -82,7 +82,7 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { //do we have a username for him/her? $ocname = $this->dn2username($dn); - if($ocname){ + if($ocname) { //update some settings, if necessary $this->updateQuota($dn); $this->updateEmail($dn); @@ -100,7 +100,7 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { * * Get a list of all users. */ - public function getUsers($search = '', $limit = 10, $offset = 0){ + public function getUsers($search = '', $limit = 10, $offset = 0) { $ldap_users = $this->connection->getFromCache('getUsers'); if(is_null($ldap_users)) { $ldap_users = $this->fetchListOfUsers($this->connection->ldapUserFilter, array($this->connection->ldapUserDisplayName, 'dn')); @@ -126,7 +126,7 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { * @param string $uid the username * @return boolean */ - public function userExists($uid){ + public function userExists($uid) { if($this->connection->isCached('userExists'.$uid)) { return $this->connection->getFromCache('userExists'.$uid); } @@ -187,7 +187,7 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { * @param string $uid the username * @return boolean */ - public function getHome($uid){ + public function getHome($uid) { if($this->userExists($uid)) { $homedir = \OCP\Config::getUserValue($uid, 'user_ldap', 'homedir', false); if(!$homedir) { diff --git a/apps/user_webdavauth/settings.php b/apps/user_webdavauth/settings.php index 1b80b1bba34..4f1ddbbefda 100755 --- a/apps/user_webdavauth/settings.php +++ b/apps/user_webdavauth/settings.php @@ -22,9 +22,9 @@ */ print_r($_POST); -if($_POST){ +if($_POST) { - if(isset($_POST['webdav_url'])){ + if(isset($_POST['webdav_url'])) { OC_CONFIG::setValue('user_webdavauth_url', strip_tags($_POST['webdav_url'])); } } diff --git a/apps/user_webdavauth/user_webdavauth.php b/apps/user_webdavauth/user_webdavauth.php index 571aca2f70f..c36d37c1fa2 100755 --- a/apps/user_webdavauth/user_webdavauth.php +++ b/apps/user_webdavauth/user_webdavauth.php @@ -50,7 +50,7 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend { $url= 'http://'.urlencode($uid).':'.urlencode($password).'@'.$this->webdavauth_url; $headers = get_headers($url); - if($headers==false){ + if($headers==false) { OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$this->webdavauth_url.'" ' ,3); return false; @@ -68,14 +68,14 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend { /* * we don´t know if a user exists without the password. so we have to return false all the time */ - public function userExists( $uid ){ + public function userExists( $uid ) { return false; } /* * we don´t know the users so all we can do it return an empty array here */ - public function getUsers(){ + public function getUsers() { $returnArray = array(); return $returnArray; diff --git a/core/ajax/appconfig.php b/core/ajax/appconfig.php index 3ad9e2326c3..1b43afa74fb 100644 --- a/core/ajax/appconfig.php +++ b/core/ajax/appconfig.php @@ -11,7 +11,7 @@ OCP\JSON::callCheck(); $action=isset($_POST['action'])?$_POST['action']:$_GET['action']; $result=false; -switch($action){ +switch($action) { case 'getValue': $result=OC_Appconfig::getValue($_GET['app'], $_GET['key'], $_GET['defaultValue']); break; diff --git a/core/minimizer.php b/core/minimizer.php index 0abbca75027..4da9037c413 100644 --- a/core/minimizer.php +++ b/core/minimizer.php @@ -3,12 +3,12 @@ session_write_close(); OC_App::loadApps(); -if ($service == 'core.css'){ +if ($service == 'core.css') { $minimizer = new OC_Minimizer_CSS(); $files = OC_TemplateLayout::findStylesheetFiles(OC_Util::$core_styles); $minimizer->output($files, $service); } -else if ($service == 'core.js'){ +else if ($service == 'core.js') { $minimizer = new OC_Minimizer_JS(); $files = OC_TemplateLayout::findJavascriptFiles(OC_Util::$core_scripts); $minimizer->output($files, $service); diff --git a/core/templates/403.php b/core/templates/403.php index cdfef08ac76..fbf0e64fdb6 100644 --- a/core/templates/403.php +++ b/core/templates/403.php @@ -1,5 +1,5 @@ We're sorry, but something went terribly wrong.

Bugtracker, please copy the following informations into the description.