diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2012-10-29 12:35:12 -0700 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2012-10-29 12:35:12 -0700 |
commit | 2e1199acb8ea9505cdc876bf72c9ff4df1903f4b (patch) | |
tree | 41caf4db5bd84cba98cbb5f6843a6544732b18c2 /lib | |
parent | 629d33967cd25e22c5654f8631744892b6e2ad86 (diff) | |
parent | dfc8228fb47220e9fe107368da2ebd5da79e780a (diff) | |
download | nextcloud-server-2e1199acb8ea9505cdc876bf72c9ff4df1903f4b.tar.gz nextcloud-server-2e1199acb8ea9505cdc876bf72c9ff4df1903f4b.zip |
Merge pull request #133 from fmms/checkstyle02
NoSpaceAfterComma -- checkstyle cleanup
Diffstat (limited to 'lib')
-rw-r--r-- | lib/filestorage/common.php | 36 | ||||
-rw-r--r-- | lib/filesystemview.php | 28 | ||||
-rw-r--r-- | lib/helper.php | 20 | ||||
-rw-r--r-- | lib/image.php | 20 |
4 files changed, 52 insertions, 52 deletions
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php index f24a5704913..cf09ea71e8c 100644 --- a/lib/filestorage/common.php +++ b/lib/filestorage/common.php @@ -95,16 +95,16 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { } // abstract public function unlink($path); public function rename($path1,$path2) { - if($this->copy($path1,$path2)) { + if($this->copy($path1, $path2)) { return $this->unlink($path1); }else{ return false; } } public function copy($path1,$path2) { - $source=$this->fopen($path1,'r'); - $target=$this->fopen($path2,'w'); - $count=OC_Helper::streamCopy($source,$target); + $source=$this->fopen($path1, 'r'); + $target=$this->fopen($path2, 'w'); + $count=OC_Helper::streamCopy($source, $target); return $count>0; } // abstract public function fopen($path,$mode); @@ -188,25 +188,25 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { if($this->is_dir($path)) { return 'httpd/unix-directory'; } - $source=$this->fopen($path,'r'); + $source=$this->fopen($path, 'r'); if(!$source) { return false; } - $head=fread($source,8192);//8kb should suffice to determine a mimetype - if($pos=strrpos($path,'.')) { - $extension=substr($path,$pos); + $head=fread($source, 8192);//8kb should suffice to determine a mimetype + if($pos=strrpos($path, '.')) { + $extension=substr($path, $pos); }else{ $extension=''; } $tmpFile=OC_Helper::tmpFile($extension); - file_put_contents($tmpFile,$head); + file_put_contents($tmpFile, $head); $mime=OC_Helper::getMimeType($tmpFile); unlink($tmpFile); return $mime; } public function hash($type,$path,$raw = false) { $tmpFile=$this->getLocalFile(); - $hash=hash($type,$tmpFile,$raw); + $hash=hash($type, $tmpFile, $raw); unlink($tmpFile); return $hash; } @@ -218,23 +218,23 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { return $this->toTmpFile($path); } private function toTmpFile($path) {//no longer in the storage api, still usefull here - $source=$this->fopen($path,'r'); + $source=$this->fopen($path, 'r'); if(!$source) { return false; } - if($pos=strrpos($path,'.')) { - $extension=substr($path,$pos); + if($pos=strrpos($path, '.')) { + $extension=substr($path, $pos); }else{ $extension=''; } $tmpFile=OC_Helper::tmpFile($extension); - $target=fopen($tmpFile,'w'); - OC_Helper::streamCopy($source,$target); + $target=fopen($tmpFile, 'w'); + OC_Helper::streamCopy($source, $target); return $tmpFile; } public function getLocalFolder($path) { $baseDir=OC_Helper::tmpFolder(); - $this->addLocalFolder($path,$baseDir); + $this->addLocalFolder($path, $baseDir); return $baseDir; } private function addLocalFolder($path,$target) { @@ -243,10 +243,10 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { if($file!=='.' and $file!=='..') { if($this->is_dir($path.'/'.$file)) { mkdir($target.'/'.$file); - $this->addLocalFolder($path.'/'.$file,$target.'/'.$file); + $this->addLocalFolder($path.'/'.$file, $target.'/'.$file); }else{ $tmp=$this->toTmpFile($path.'/'.$file); - rename($tmp,$target.'/'.$file); + rename($tmp, $target.'/'.$file); } } } diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 872da992fab..dbb6681656f 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -142,7 +142,7 @@ class OC_FilesystemView { * @return string */ public function getLocalFile($path) { - $parent=substr($path, 0, strrpos($path,'/')); + $parent=substr($path, 0, strrpos($path, '/')); if(OC_Filesystem::isValidPath($parent) and $storage=$this->getStorage($path)) { return $storage->getLocalFile($this->getInternalPath($path)); } @@ -152,7 +152,7 @@ class OC_FilesystemView { * @return string */ public function getLocalFolder($path) { - $parent=substr($path, 0, strrpos($path,'/')); + $parent=substr($path, 0, strrpos($path, '/')); if(OC_Filesystem::isValidPath($parent) and $storage=$this->getStorage($path)) { return $storage->getLocalFolder($this->getInternalPath($path)); } @@ -215,13 +215,13 @@ class OC_FilesystemView { * @deprecated Replaced by isReadable() as part of CRUDS */ public function is_readable($path) { - return $this->basicOperation('isReadable',$path); + return $this->basicOperation('isReadable', $path); } /** * @deprecated Replaced by isCreatable(), isUpdatable(), isDeletable() as part of CRUDS */ public function is_writable($path) { - return $this->basicOperation('isUpdatable',$path); + return $this->basicOperation('isUpdatable', $path); } public function isCreatable($path) { return $this->basicOperation('isCreatable', $path); @@ -325,8 +325,8 @@ class OC_FilesystemView { return $this->basicOperation( 'deleteAll', $directory, array('delete'), $empty ); } public function rename($path1, $path2) { - $postFix1=(substr($path1,-1,1)==='/')?'/':''; - $postFix2=(substr($path2,-1,1)==='/')?'/':''; + $postFix1=(substr($path1, -1, 1)==='/')?'/':''; + $postFix2=(substr($path2, -1, 1)==='/')?'/':''; $absolutePath1 = OC_Filesystem::normalizePath($this->getAbsolutePath($path1)); $absolutePath2 = OC_Filesystem::normalizePath($this->getAbsolutePath($path2)); if(OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) { @@ -377,8 +377,8 @@ class OC_FilesystemView { } } public function copy($path1, $path2) { - $postFix1=(substr($path1,-1,1)==='/')?'/':''; - $postFix2=(substr($path2,-1,1)==='/')?'/':''; + $postFix1=(substr($path1, -1, 1)==='/')?'/':''; + $postFix2=(substr($path2, -1, 1)==='/')?'/':''; $absolutePath1 = OC_Filesystem::normalizePath($this->getAbsolutePath($path1)); $absolutePath2 = OC_Filesystem::normalizePath($this->getAbsolutePath($path2)); if(OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) { @@ -489,7 +489,7 @@ class OC_FilesystemView { $hooks[]='write'; break; default: - OC_Log::write('core','invalid mode ('.$mode.') for '.$path,OC_Log::ERROR); + OC_Log::write('core', 'invalid mode ('.$mode.') for '.$path,OC_Log::ERROR); } return $this->basicOperation('fopen', $path, $hooks, $mode); @@ -501,7 +501,7 @@ class OC_FilesystemView { $extension=''; $extOffset=strpos($path, '.'); if($extOffset !== false) { - $extension=substr($path, strrpos($path,'.')); + $extension=substr($path, strrpos($path, '.')); } $tmpFile = OC_Helper::tmpFile($extension); file_put_contents($tmpFile, $source); @@ -530,7 +530,7 @@ class OC_FilesystemView { return $this->basicOperation('getMimeType', $path); } public function hash($type, $path, $raw = false) { - $postFix=(substr($path,-1,1)==='/')?'/':''; + $postFix=(substr($path, -1, 1)==='/')?'/':''; $absolutePath = OC_Filesystem::normalizePath($this->getAbsolutePath($path)); if (OC_FileProxy::runPreProxies('hash', $absolutePath) && OC_Filesystem::isValidPath($path)) { $path = $this->getRelativePath($absolutePath); @@ -570,7 +570,7 @@ class OC_FilesystemView { * OC_Filestorage for delegation to a storage backend for execution */ private function basicOperation($operation, $path, $hooks=array(), $extraParam=null) { - $postFix=(substr($path,-1,1)==='/')?'/':''; + $postFix=(substr($path, -1, 1)==='/')?'/':''; $absolutePath = OC_Filesystem::normalizePath($this->getAbsolutePath($path)); if(OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and OC_Filesystem::isValidPath($path)) { $path = $this->getRelativePath($absolutePath); @@ -578,7 +578,7 @@ class OC_FilesystemView { return false; } $internalPath = $this->getInternalPath($path.$postFix); - $run=$this->runHooks($hooks,$path); + $run=$this->runHooks($hooks, $path); if($run and $storage = $this->getStorage($path.$postFix)) { if(!is_null($extraParam)) { $result = $storage->$operation($internalPath, $extraParam); @@ -588,7 +588,7 @@ class OC_FilesystemView { $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result); if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()) { if($operation!='fopen') {//no post hooks for fopen, the file stream is still open - $this->runHooks($hooks,$path, true); + $this->runHooks($hooks, $path, true); } } return $result; diff --git a/lib/helper.php b/lib/helper.php index 060d887fd67..9843f5b1dc2 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -203,7 +203,7 @@ class OC_Helper { return OC::$WEBROOT."/core/img/filetypes/$mimetype.png"; } //try only the first part of the filetype - $mimetype=substr($mimetype,0, strpos($mimetype,'-')); + $mimetype=substr($mimetype, 0, strpos($mimetype, '-')); if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.png" )) { return OC::$WEBROOT."/core/img/filetypes/$mimetype.png"; } @@ -355,29 +355,29 @@ class OC_Helper { * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead */ static function getMimeType($path) { - $isWrapped=(strpos($path,'://')!==false) and (substr($path,0,7)=='file://'); + $isWrapped=(strpos($path, '://')!==false) and (substr($path, 0, 7)=='file://'); if (@is_dir($path)) { // directories are easy return "httpd/unix-directory"; } - if(strpos($path,'.')) { + if(strpos($path, '.')) { //try to guess the type by the file extension if(!self::$mimetypes || self::$mimetypes != include 'mimetypes.list.php') { self::$mimetypes=include 'mimetypes.list.php'; } $extension=strtolower(strrchr(basename($path), ".")); - $extension=substr($extension,1);//remove leading . + $extension=substr($extension, 1);//remove leading . $mimeType=(isset(self::$mimetypes[$extension]))?self::$mimetypes[$extension]:'application/octet-stream'; }else{ $mimeType='application/octet-stream'; } if($mimeType=='application/octet-stream' and function_exists('finfo_open') and function_exists('finfo_file') and $finfo=finfo_open(FILEINFO_MIME)) { - $info = @strtolower(finfo_file($finfo,$path)); + $info = @strtolower(finfo_file($finfo, $path)); if($info) { - $mimeType=substr($info,0, strpos($info,';')); + $mimeType=substr($info,0, strpos($info, ';')); } finfo_close($finfo); } @@ -412,8 +412,8 @@ class OC_Helper { return finfo_buffer($finfo, $data); }else{ $tmpFile=OC_Helper::tmpFile(); - $fh=fopen($tmpFile,'wb'); - fwrite($fh,$data,8024); + $fh=fopen($tmpFile, 'wb'); + fwrite($fh, $data, 8024); fclose($fh); $mime=self::getMimeType($tmpFile); unset($tmpFile); @@ -504,7 +504,7 @@ class OC_Helper { } $count=0; while(!feof($source)) { - $count+=fwrite($target, fread($source,8192)); + $count+=fwrite($target, fread($source, 8192)); } return $count; } @@ -518,7 +518,7 @@ class OC_Helper { */ public static function tmpFile($postfix='') { $file=get_temp_dir().'/'.md5(time().rand()).$postfix; - $fh=fopen($file,'w'); + $fh=fopen($file, 'w'); fclose($fh); self::$tmpFiles[]=$file; return $file; diff --git a/lib/image.php b/lib/image.php index 13460a13eb5..38acf00d9fe 100644 --- a/lib/image.php +++ b/lib/image.php @@ -244,7 +244,7 @@ class OC_Image { ob_start(); $res = imagepng($this->resource); if (!$res) { - OC_Log::write('core','OC_Image->data. Error getting image data.',OC_Log::ERROR); + OC_Log::write('core', 'OC_Image->data. Error getting image data.', OC_Log::ERROR); } return ob_get_clean(); } @@ -263,11 +263,11 @@ class OC_Image { */ public function getOrientation() { if(!is_callable('exif_read_data')) { - OC_Log::write('core','OC_Image->fixOrientation() Exif module not enabled.', OC_Log::DEBUG); + OC_Log::write('core', 'OC_Image->fixOrientation() Exif module not enabled.', OC_Log::DEBUG); return -1; } if(!$this->valid()) { - OC_Log::write('core','OC_Image->fixOrientation() No image loaded.', OC_Log::DEBUG); + OC_Log::write('core', 'OC_Image->fixOrientation() No image loaded.', OC_Log::DEBUG); return -1; } if(is_null($this->filepath) || !is_readable($this->filepath)) { @@ -549,7 +549,7 @@ class OC_Image { public function preciseResize($width, $height) { if (!$this->valid()) { - OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR); + OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR); return false; } $width_orig=imageSX($this->resource); @@ -557,14 +557,14 @@ class OC_Image { $process = imagecreatetruecolor($width, $height); if ($process == false) { - OC_Log::write('core', __METHOD__.'(): Error creating true color image',OC_Log::ERROR); + OC_Log::write('core', __METHOD__.'(): Error creating true color image', OC_Log::ERROR); imagedestroy($process); return false; } imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); if ($process == false) { - OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$width.'x'.$height,OC_Log::ERROR); + OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$width.'x'.$height, OC_Log::ERROR); imagedestroy($process); return false; } @@ -607,13 +607,13 @@ class OC_Image { } $process = imagecreatetruecolor($targetWidth, $targetHeight); if ($process == false) { - OC_Log::write('core', 'OC_Image->centerCrop. Error creating true color image',OC_Log::ERROR); + OC_Log::write('core', 'OC_Image->centerCrop. Error creating true color image', OC_Log::ERROR); imagedestroy($process); return false; } imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); if ($process == false) { - OC_Log::write('core', 'OC_Image->centerCrop. Error resampling process image '.$width.'x'.$height,OC_Log::ERROR); + OC_Log::write('core', 'OC_Image->centerCrop. Error resampling process image '.$width.'x'.$height, OC_Log::ERROR); imagedestroy($process); return false; } @@ -637,13 +637,13 @@ class OC_Image { } $process = imagecreatetruecolor($w, $h); if ($process == false) { - OC_Log::write('core', __METHOD__.'(): Error creating true color image',OC_Log::ERROR); + OC_Log::write('core', __METHOD__.'(): Error creating true color image', OC_Log::ERROR); imagedestroy($process); return false; } imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); if ($process == false) { - OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$w.'x'.$h,OC_Log::ERROR); + OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$w.'x'.$h, OC_Log::ERROR); imagedestroy($process); return false; } |