Merge pull request #133 from fmms/checkstyle02

NoSpaceAfterComma -- checkstyle cleanup
This commit is contained in:
Lukas Reschke 2012-10-29 12:35:12 -07:00
commit 2e1199acb8
7 changed files with 102 additions and 102 deletions

View File

@ -40,7 +40,7 @@ class OC_Crypt {
static private $bf = null;
public static function loginListener($params) {
self::init($params['uid'],$params['password']);
self::init($params['uid'], $params['password']);
}
public static function init($login,$password) {
@ -51,7 +51,7 @@ class OC_Crypt {
OC_FileProxy::$enabled=false;
if(!$view->file_exists('/'.$login.'/encryption.key')) {// does key exist?
OC_Crypt::createkey($login,$password);
OC_Crypt::createkey($login, $password);
}
$key=$view->file_get_contents('/'.$login.'/encryption.key');
OC_FileProxy::$enabled=true;
@ -82,16 +82,16 @@ class OC_Crypt {
public static function createkey($username,$passcode) {
// generate a random key
$key=mt_rand(10000,99999).mt_rand(10000,99999).mt_rand(10000,99999).mt_rand(10000,99999);
$key=mt_rand(10000, 99999).mt_rand(10000, 99999).mt_rand(10000, 99999).mt_rand(10000, 99999);
// encrypt the key with the passcode of the user
$enckey=OC_Crypt::encrypt($key,$passcode);
$enckey=OC_Crypt::encrypt($key, $passcode);
// Write the file
$proxyEnabled=OC_FileProxy::$enabled;
OC_FileProxy::$enabled=false;
$view=new OC_FilesystemView('/'.$username);
$view->file_put_contents('/encryption.key',$enckey);
$view->file_put_contents('/encryption.key', $enckey);
OC_FileProxy::$enabled=$proxyEnabled;
}
@ -195,8 +195,8 @@ class OC_Crypt {
public static function blockEncrypt($data, $key='') {
$result='';
while(strlen($data)) {
$result.=self::encrypt(substr($data,0,8192),$key);
$data=substr($data,8192);
$result.=self::encrypt(substr($data, 0, 8192),$key);
$data=substr($data, 8192);
}
return $result;
}
@ -207,11 +207,11 @@ class OC_Crypt {
public static function blockDecrypt($data, $key='',$maxLength=0) {
$result='';
while(strlen($data)) {
$result.=self::decrypt(substr($data,0,8192),$key);
$data=substr($data,8192);
$result.=self::decrypt(substr($data, 0, 8192),$key);
$data=substr($data, 8192);
}
if($maxLength>0) {
return substr($result,0,$maxLength);
return substr($result, 0, $maxLength);
}else{
return rtrim($result, "\0");
}

View File

@ -40,7 +40,7 @@ class OC_CryptStream{
if(!self::$rootView) {
self::$rootView=new OC_FilesystemView('');
}
$path=str_replace('crypt://','',$path);
$path=str_replace('crypt://', '', $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'];
@ -50,13 +50,13 @@ class OC_CryptStream{
if($mode=='w' or $mode=='w+' or $mode=='wb' or $mode=='wb+') {
$this->size=0;
}else{
$this->size=self::$rootView->filesize($path,$mode);
$this->size=self::$rootView->filesize($path, $mode);
}
OC_FileProxy::$enabled=false;//disable fileproxies so we can open the source file
$this->source=self::$rootView->fopen($path,$mode);
$this->source=self::$rootView->fopen($path, $mode);
OC_FileProxy::$enabled=true;
if(!is_resource($this->source)) {
OCP\Util::writeLog('files_encryption','failed to open '.$path,OCP\Util::ERROR);
OCP\Util::writeLog('files_encryption', 'failed to open '.$path, OCP\Util::ERROR);
}
}
if(is_resource($this->source)) {
@ -67,7 +67,7 @@ class OC_CryptStream{
public function stream_seek($offset, $whence=SEEK_SET) {
$this->flush();
fseek($this->source,$offset,$whence);
fseek($this->source, $offset, $whence);
}
public function stream_tell() {
@ -79,11 +79,11 @@ class OC_CryptStream{
//This makes this function a lot simpler but will breake everything the moment it's fixed
$this->writeCache='';
if($count!=8192) {
OCP\Util::writeLog('files_encryption','php bug 21641 no longer holds, decryption will not work',OCP\Util::FATAL);
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);
$data=fread($this->source, 8192);
if(strlen($data)) {
$result=OC_Crypt::decrypt($data);
}else{
@ -91,7 +91,7 @@ class OC_CryptStream{
}
$length=$this->size-$pos;
if($length<8192) {
$result=substr($result,0,$length);
$result=substr($result, 0, $length);
}
return $result;
}
@ -105,12 +105,12 @@ class OC_CryptStream{
}
if($currentPos%8192!=0) {
//make sure we always start on a block start
fseek($this->source,-($currentPos%8192),SEEK_CUR);
fseek($this->source, -($currentPos%8192), SEEK_CUR);
$encryptedBlock=fread($this->source,8192);
fseek($this->source,-($currentPos%8192),SEEK_CUR);
fseek($this->source, -($currentPos%8192), SEEK_CUR);
$block=OC_Crypt::decrypt($encryptedBlock);
$data=substr($block,0,$currentPos%8192).$data;
fseek($this->source,-($currentPos%8192),SEEK_CUR);
$data=substr($block, 0, $currentPos%8192).$data;
fseek($this->source, -($currentPos%8192), SEEK_CUR);
}
$currentPos=ftell($this->source);
while($remainingLength=strlen($data)>0) {
@ -118,9 +118,9 @@ class OC_CryptStream{
$this->writeCache=$data;
$data='';
}else{
$encrypted=OC_Crypt::encrypt(substr($data,0,8192));
fwrite($this->source,$encrypted);
$data=substr($data,8192);
$encrypted=OC_Crypt::encrypt(substr($data, 0, 8192));
fwrite($this->source, $encrypted);
$data=substr($data, 8192);
}
}
$this->size=max($this->size,$currentPos+$length);
@ -130,13 +130,13 @@ class OC_CryptStream{
public function stream_set_option($option,$arg1,$arg2) {
switch($option) {
case STREAM_OPTION_BLOCKING:
stream_set_blocking($this->source,$arg1);
stream_set_blocking($this->source, $arg1);
break;
case STREAM_OPTION_READ_TIMEOUT:
stream_set_timeout($this->source,$arg1,$arg2);
stream_set_timeout($this->source, $arg1, $arg2);
break;
case STREAM_OPTION_WRITE_BUFFER:
stream_set_write_buffer($this->source,$arg1,$arg2);
stream_set_write_buffer($this->source, $arg1, $arg2);
}
}
@ -145,7 +145,7 @@ class OC_CryptStream{
}
public function stream_lock($mode) {
flock($this->source,$mode);
flock($this->source, $mode);
}
public function stream_flush() {
@ -159,7 +159,7 @@ class OC_CryptStream{
private function flush() {
if($this->writeCache) {
$encrypted=OC_Crypt::encrypt($this->writeCache);
fwrite($this->source,$encrypted);
fwrite($this->source, $encrypted);
$this->writeCache='';
}
}
@ -167,7 +167,7 @@ class OC_CryptStream{
public function stream_close() {
$this->flush();
if($this->meta['mode']!='r' and $this->meta['mode']!='rb') {
OC_FileCache::put($this->path, array('encrypted'=>true,'size'=>$this->size),'');
OC_FileCache::put($this->path, array('encrypted'=>true, 'size'=>$this->size), '');
}
return fclose($this->source);
}

View File

@ -22,8 +22,8 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
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);
else if (substr($host,0,7) == "http://") $host = substr($host, 7);
if (substr($host, 0, 8) == "https://") $host = substr($host, 8);
else if (substr($host, 0, 7) == "http://") $host = substr($host, 7);
$this->host=$host;
$this->user=$params['user'];
$this->password=$params['password'];
@ -32,7 +32,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
if(!$this->root || $this->root[0]!='/') {
$this->root='/'.$this->root;
}
if(substr($this->root,-1,1)!='/') {
if(substr($this->root, -1, 1)!='/') {
$this->root.='/';
}
@ -65,18 +65,18 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
public function mkdir($path) {
$path=$this->cleanPath($path);
return $this->simpleResponse('MKCOL',$path, null,201);
return $this->simpleResponse('MKCOL', $path, null, 201);
}
public function rmdir($path) {
$path=$this->cleanPath($path);
return $this->simpleResponse('DELETE',$path, null,204);
return $this->simpleResponse('DELETE', $path, null, 204);
}
public function opendir($path) {
$path=$this->cleanPath($path);
try{
$response=$this->client->propfind($path, array(),1);
$response=$this->client->propfind($path, array(), 1);
$id=md5('webdav'.$this->root.$path);
OC_FakeDirStream::$dirs[$id]=array();
$files=array_keys($response);
@ -123,7 +123,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}
public function unlink($path) {
return $this->simpleResponse('DELETE',$path, null,204);
return $this->simpleResponse('DELETE', $path, null, 204);
}
public function fopen($path,$mode) {
@ -137,7 +137,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
//straight up curl instead of sabredav here, sabredav put's the entire get result in memory
$curl = curl_init();
$fp = fopen('php://temp', 'r+');
curl_setopt($curl,CURLOPT_USERPWD,$this->user.':'.$this->password);
curl_setopt($curl, CURLOPT_USERPWD, $this->user.':'.$this->password);
curl_setopt($curl, CURLOPT_URL, $this->createBaseUri().$path);
curl_setopt($curl, CURLOPT_FILE, $fp);
@ -158,18 +158,18 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
case 'c':
case 'c+':
//emulate these
if(strrpos($path,'.')!==false) {
$ext=substr($path, strrpos($path,'.'));
if(strrpos($path, '.')!==false) {
$ext=substr($path, strrpos($path, '.'));
}else{
$ext='';
}
$tmpFile=OCP\Files::tmpFile($ext);
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack');
if($this->file_exists($path)) {
$this->getFile($path,$tmpFile);
$this->getFile($path, $tmpFile);
}
self::$tempFiles[$tmpFile]=$path;
return fopen('close://'.$tmpFile,$mode);
return fopen('close://'.$tmpFile, $mode);
}
}
@ -203,15 +203,15 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}
public function getFile($path,$target) {
$source=$this->fopen($path,'r');
file_put_contents($target,$source);
$source=$this->fopen($path, 'r');
file_put_contents($target, $source);
}
public function uploadFile($path,$target) {
$source=fopen($path,'r');
$source=fopen($path, 'r');
$curl = curl_init();
curl_setopt($curl,CURLOPT_USERPWD,$this->user.':'.$this->password);
curl_setopt($curl, CURLOPT_USERPWD, $this->user.':'.$this->password);
curl_setopt($curl, CURLOPT_URL, $this->createBaseUri().$target);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
curl_setopt($curl, CURLOPT_INFILE, $source); // file pointer
@ -283,7 +283,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
private function cleanPath($path) {
if(!$path || $path[0]=='/') {
return substr($path,1);
return substr($path, 1);
}else{
return $path;
}
@ -292,7 +292,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
private function simpleResponse($method,$path,$body,$expected) {
$path=$this->cleanPath($path);
try{
$response=$this->client->request($method,$path,$body);
$response=$this->client->request($method, $path, $body);
return $response['statusCode']==$expected;
}catch(Exception $e) {
return false;

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}