From 6a00a6b9ed49f9a9da044772e7ca7f3506672100 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Tue, 23 Oct 2012 00:28:12 +0200 Subject: Make Jenkins more happy. This is NoSpaceAfterComma --- lib/appconfig.php | 2 +- lib/base.php | 2 +- lib/eventsource.php | 6 ++-- lib/filecache.php | 78 ++++++++++++++++++++++++++-------------------------- lib/filechunking.php | 2 +- lib/fileproxy.php | 4 +-- lib/files.php | 42 ++++++++++++++-------------- lib/vobject.php | 14 +++++----- 8 files changed, 75 insertions(+), 75 deletions(-) (limited to 'lib') diff --git a/lib/appconfig.php b/lib/appconfig.php index 6604e854d55..ed0e8f1d0bd 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -123,7 +123,7 @@ class OC_Appconfig{ */ public static function setValue( $app, $key, $value ) { // Does the key exist? yes: update. No: insert - if(! self::hasKey($app,$key)) { + if(! self::hasKey($app, $key)) { $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*appconfig` ( `appid`, `configkey`, `configvalue` ) VALUES( ?, ?, ? )' ); $query->execute( array( $app, $key, $value )); } diff --git a/lib/base.php b/lib/base.php index a1ad4f6dc0a..186ed53e980 100644 --- a/lib/base.php +++ b/lib/base.php @@ -176,7 +176,7 @@ class OC{ OC::$SERVERROOT.'/lib'.PATH_SEPARATOR. OC::$SERVERROOT.'/config'.PATH_SEPARATOR. OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR. - implode($paths,PATH_SEPARATOR).PATH_SEPARATOR. + implode($paths, PATH_SEPARATOR).PATH_SEPARATOR. get_include_path().PATH_SEPARATOR. OC::$SERVERROOT ); diff --git a/lib/eventsource.php b/lib/eventsource.php index 900b5b101e6..3bada131bdd 100644 --- a/lib/eventsource.php +++ b/lib/eventsource.php @@ -38,7 +38,7 @@ class OC_EventSource{ if($this->fallback) { $this->fallBackId=$_GET['fallback_id']; header("Content-Type: text/html"); - echo str_repeat(''.PHP_EOL,10); //dummy data to keep IE happy + echo str_repeat(''.PHP_EOL, 10); //dummy data to keep IE happy }else{ header("Content-Type: text/event-stream"); } @@ -78,6 +78,6 @@ class OC_EventSource{ * close the connection of the even source */ public function close() { - $this->send('__internal__','close');//server side closing can be an issue, let the client do it + $this->send('__internal__', 'close');//server side closing can be an issue, let the client do it } -} \ No newline at end of file +} diff --git a/lib/filecache.php b/lib/filecache.php index 9e9ef606a9a..776b60abcac 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -43,14 +43,14 @@ class OC_FileCache{ * - versioned */ public static function get($path,$root=false) { - if(OC_FileCache_Update::hasUpdated($path,$root)) { + if(OC_FileCache_Update::hasUpdated($path, $root)) { if($root===false) {//filesystem hooks are only valid for the default root - OC_Hook::emit('OC_Filesystem','post_write',array('path'=>$path)); + OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$path)); }else{ - OC_FileCache_Update::update($path,$root); + OC_FileCache_Update::update($path, $root); } } - return OC_FileCache_Cached::get($path,$root); + return OC_FileCache_Cached::get($path, $root); } /** @@ -67,13 +67,13 @@ class OC_FileCache{ } $fullpath=$root.$path; $parent=self::getParentId($fullpath); - $id=self::getId($fullpath,''); + $id=self::getId($fullpath, ''); if(isset(OC_FileCache_Cached::$savedData[$fullpath])) { - $data=array_merge(OC_FileCache_Cached::$savedData[$fullpath],$data); + $data=array_merge(OC_FileCache_Cached::$savedData[$fullpath], $data); unset(OC_FileCache_Cached::$savedData[$fullpath]); } if($id!=-1) { - self::update($id,$data); + self::update($id, $data); return; } @@ -104,7 +104,7 @@ class OC_FileCache{ $query=OC_DB::prepare('INSERT INTO `*PREFIX*fscache`(`parent`, `name`, `path`, `path_hash`, `size`, `mtime`, `ctime`, `mimetype`, `mimepart`,`user`,`writable`,`encrypted`,`versioned`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'); $result=$query->execute(array($parent,basename($fullpath),$fullpath,md5($fullpath),$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable'],$data['encrypted'],$data['versioned'])); if(OC_DB::isError($result)) { - OC_Log::write('files','error while writing file('.$fullpath.') to cache',OC_Log::ERROR); + OC_Log::write('files', 'error while writing file('.$fullpath.') to cache', OC_Log::ERROR); } if($cache=OC_Cache::getUserCache(true)) { @@ -137,11 +137,11 @@ class OC_FileCache{ } $arguments[]=$id; - $sql = 'UPDATE `*PREFIX*fscache` SET '.implode(' , ',$queryParts).' WHERE `id`=?'; + $sql = 'UPDATE `*PREFIX*fscache` SET '.implode(' , ', $queryParts).' WHERE `id`=?'; $query=OC_DB::prepare($sql); $result=$query->execute($arguments); if(OC_DB::isError($result)) { - OC_Log::write('files','error while updating file('.$id.') in cache',OC_Log::ERROR); + OC_Log::write('files', 'error while updating file('.$id.') in cache', OC_Log::ERROR); } } @@ -166,7 +166,7 @@ class OC_FileCache{ $query->execute(array($newParent,basename($newPath),$newPath,md5($newPath),md5($oldPath))); if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$oldPath)) { - $cache->set('fileid/'.$newPath,$cache->get('fileid/'.$oldPath)); + $cache->set('fileid/'.$newPath, $cache->get('fileid/'.$oldPath)); $cache->remove('fileid/'.$oldPath); } @@ -175,11 +175,11 @@ class OC_FileCache{ $updateQuery=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `path`=?, `path_hash`=? WHERE `path_hash`=?'); while($row= $query->execute(array($oldPath.'/%'))->fetchRow()) { $old=$row['path']; - $new=$newPath.substr($old,$oldLength); + $new=$newPath.substr($old, $oldLength); $updateQuery->execute(array($new,md5($new),md5($old))); if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$old)) { - $cache->set('fileid/'.$new,$cache->get('fileid/'.$old)); + $cache->set('fileid/'.$new, $cache->get('fileid/'.$old)); $cache->remove('fileid/'.$old); } } @@ -231,9 +231,9 @@ class OC_FileCache{ $names=array(); while($row=$result->fetchRow()) { if(!$returnData) { - $names[]=substr($row['path'],$rootLen); + $names[]=substr($row['path'], $rootLen); }else{ - $row['path']=substr($row['path'],$rootLen); + $row['path']=substr($row['path'], $rootLen); $names[]=$row; } } @@ -256,10 +256,10 @@ class OC_FileCache{ * - versioned */ public static function getFolderContent($path,$root=false,$mimetype_filter='') { - if(OC_FileCache_Update::hasUpdated($path,$root,true)) { - OC_FileCache_Update::updateFolder($path,$root); + if(OC_FileCache_Update::hasUpdated($path, $root, true)) { + OC_FileCache_Update::updateFolder($path, $root); } - return OC_FileCache_Cached::getFolderContent($path,$root,$mimetype_filter); + return OC_FileCache_Cached::getFolderContent($path, $root, $mimetype_filter); } /** @@ -269,7 +269,7 @@ class OC_FileCache{ * @return bool */ public static function inCache($path,$root=false) { - return self::getId($path,$root)!=-1; + return self::getId($path, $root)!=-1; } /** @@ -291,7 +291,7 @@ class OC_FileCache{ $query=OC_DB::prepare('SELECT `id` FROM `*PREFIX*fscache` WHERE `path_hash`=?'); $result=$query->execute(array(md5($fullPath))); if(OC_DB::isError($result)) { - OC_Log::write('files','error while getting file id of '.$path,OC_Log::ERROR); + OC_Log::write('files', 'error while getting file id of '.$path, OC_Log::ERROR); return -1; } @@ -302,7 +302,7 @@ class OC_FileCache{ $id=-1; } if($cache=OC_Cache::getUserCache(true)) { - $cache->set('fileid/'.$fullPath,$id); + $cache->set('fileid/'.$fullPath, $id); } return $id; @@ -319,14 +319,14 @@ class OC_FileCache{ $user=OC_User::getUser(); } $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `id`=? AND `user`=?'); - $result=$query->execute(array($id,$user)); + $result=$query->execute(array($id, $user)); $row=$result->fetchRow(); $path=$row['path']; $root='/'.$user.'/files'; - if(substr($path,0,strlen($root))!=$root) { + if(substr($path, 0, strlen($root))!=$root) { return false; } - return substr($path,strlen($root)); + return substr($path, strlen($root)); } /** @@ -338,7 +338,7 @@ class OC_FileCache{ if($path=='/') { return -1; }else{ - return self::getId(dirname($path),''); + return self::getId(dirname($path), ''); } } @@ -350,7 +350,7 @@ class OC_FileCache{ */ public static function increaseSize($path,$sizeDiff, $root=false) { if($sizeDiff==0) return; - $id=self::getId($path,$root); + $id=self::getId($path, $root); while($id!=-1) {//walk up the filetree increasing the size of all parent folders $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `size`=`size`+? WHERE `id`=?'); $query->execute(array($sizeDiff,$id)); @@ -368,7 +368,7 @@ class OC_FileCache{ */ public static function scan($path,$eventSource=false,&$count=0,$root=false) { if($eventSource) { - $eventSource->send('scanning',array('file'=>$path,'count'=>$count)); + $eventSource->send('scanning', array('file'=>$path, 'count'=>$count)); } $lastSend=$count; // NOTE: Ugly hack to prevent shared files from going into the cache (the source already exists somewhere in the cache) @@ -380,7 +380,7 @@ class OC_FileCache{ }else{ $view=new OC_FilesystemView($root); } - self::scanFile($path,$root); + self::scanFile($path, $root); $dh=$view->opendir($path.'/'); $totalSize=0; if($dh) { @@ -388,13 +388,13 @@ class OC_FileCache{ if($filename != '.' and $filename != '..') { $file=$path.'/'.$filename; if($view->is_dir($file.'/')) { - self::scan($file,$eventSource,$count,$root); + self::scan($file, $eventSource, $count, $root); }else{ - $totalSize+=self::scanFile($file,$root); + $totalSize+=self::scanFile($file, $root); $count++; if($count>$lastSend+25 and $eventSource) { $lastSend=$count; - $eventSource->send('scanning',array('file'=>$path,'count'=>$count)); + $eventSource->send('scanning', array('file'=>$path, 'count'=>$count)); } } } @@ -436,7 +436,7 @@ class OC_FileCache{ if($path=='/') { $path=''; } - self::put($path,$stat,$root); + self::put($path, $stat, $root); return $stat['size']; } @@ -462,14 +462,14 @@ class OC_FileCache{ $user=OC_User::getUser(); if(!$part2) { $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `mimepart`=? AND `user`=? AND `path` LIKE ?'); - $result=$query->execute(array($part1,$user, $root)); + $result=$query->execute(array($part1, $user, $root)); }else{ $query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `mimetype`=? AND `user`=? AND `path` LIKE ? '); - $result=$query->execute(array($part1.'/'.$part2,$user, $root)); + $result=$query->execute(array($part1.'/'.$part2, $user, $root)); } $names=array(); while($row=$result->fetchRow()) { - $names[]=substr($row['path'],$rootLen); + $names[]=substr($row['path'], $rootLen); } return $names; } @@ -512,7 +512,7 @@ class OC_FileCache{ } //watch for changes and try to keep the cache up to date -OC_Hook::connect('OC_Filesystem','post_write','OC_FileCache_Update','fileSystemWatcherWrite'); -OC_Hook::connect('OC_Filesystem','post_delete','OC_FileCache_Update','fileSystemWatcherDelete'); -OC_Hook::connect('OC_Filesystem','post_rename','OC_FileCache_Update','fileSystemWatcherRename'); -OC_Hook::connect('OC_User','post_deleteUser','OC_FileCache_Update','deleteFromUser'); +OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_FileCache_Update', 'fileSystemWatcherWrite'); +OC_Hook::connect('OC_Filesystem', 'post_delete', 'OC_FileCache_Update', 'fileSystemWatcherDelete'); +OC_Hook::connect('OC_Filesystem', 'post_rename', 'OC_FileCache_Update', 'fileSystemWatcherRename'); +OC_Hook::connect('OC_User', 'post_deleteUser', 'OC_FileCache_Update', 'deleteFromUser'); diff --git a/lib/filechunking.php b/lib/filechunking.php index 5ab33c77ad7..55a4d730430 100644 --- a/lib/filechunking.php +++ b/lib/filechunking.php @@ -59,7 +59,7 @@ class OC_FileChunking { for($i=0; $i < $this->info['chunkcount']; $i++) { $chunk = $cache->get($prefix.$i); $cache->remove($prefix.$i); - $count += fwrite($f,$chunk); + $count += fwrite($f, $chunk); } return $count; } diff --git a/lib/fileproxy.php b/lib/fileproxy.php index 17380c656a3..3e7f1aa1c41 100644 --- a/lib/fileproxy.php +++ b/lib/fileproxy.php @@ -52,7 +52,7 @@ class OC_FileProxy{ * this implements a dummy proxy for all operations */ public function __call($function,$arguments) { - if(substr($function,0,3)=='pre') { + if(substr($function, 0, 3)=='pre') { return true; }else{ return $arguments[1]; @@ -70,7 +70,7 @@ class OC_FileProxy{ public static function getProxies($operation) { $proxies=array(); foreach(self::$proxies as $proxy) { - if(method_exists($proxy,$operation)) { + if(method_exists($proxy, $operation)) { $proxies[]=$proxy; } } diff --git a/lib/files.php b/lib/files.php index 2b2b8b42dc4..a08bf9c6568 100644 --- a/lib/files.php +++ b/lib/files.php @@ -136,12 +136,12 @@ class OC_Files { * @param boolean $only_header ; boolean to only send header of the request */ public static function get($dir,$files, $only_header = false) { - if(strpos($files,';')) { - $files=explode(';',$files); + if(strpos($files, ';')) { + $files=explode(';', $files); } if(is_array($files)) { - self::validateZipDownload($dir,$files); + self::validateZipDownload($dir, $files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); @@ -154,15 +154,15 @@ class OC_Files { if(OC_Filesystem::is_file($file)) { $tmpFile=OC_Filesystem::toTmpFile($file); self::$tmpFiles[]=$tmpFile; - $zip->addFile($tmpFile,basename($file)); + $zip->addFile($tmpFile, basename($file)); }elseif(OC_Filesystem::is_dir($file)) { - self::zipAddDir($file,$zip); + self::zipAddDir($file, $zip); } } $zip->close(); set_time_limit($executionTime); }elseif(OC_Filesystem::is_dir($dir.'/'.$files)) { - self::validateZipDownload($dir,$files); + self::validateZipDownload($dir, $files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); @@ -171,7 +171,7 @@ class OC_Files { exit("cannot open <$filename>\n"); } $file=$dir.'/'.$files; - self::zipAddDir($file,$zip); + self::zipAddDir($file, $zip); $zip->close(); set_time_limit($executionTime); }else{ @@ -193,7 +193,7 @@ class OC_Files { }elseif($zip or !OC_Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template( '', '404', 'guest' ); - $tmpl->assign('file',$filename); + $tmpl->assign('file', $filename); $tmpl->printPage(); }else{ header("HTTP/1.0 403 Forbidden"); @@ -205,7 +205,7 @@ class OC_Files { return ; } if($zip) { - $handle=fopen($filename,'r'); + $handle=fopen($filename, 'r'); if ($handle) { $chunkSize = 8*1024;// 1 MB chunks while (!feof($handle)) { @@ -235,9 +235,9 @@ class OC_Files { if(OC_Filesystem::is_file($file)) { $tmpFile=OC_Filesystem::toTmpFile($file); OC_Files::$tmpFiles[]=$tmpFile; - $zip->addFile($tmpFile,$internalDir.$filename); + $zip->addFile($tmpFile, $internalDir.$filename); }elseif(OC_Filesystem::is_dir($file)) { - self::zipAddDir($file,$zip,$internalDir); + self::zipAddDir($file, $zip, $internalDir); } } } @@ -253,7 +253,7 @@ class OC_Files { if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')) { $targetFile=self::normalizePath($targetDir.'/'.$target); $sourceFile=self::normalizePath($sourceDir.'/'.$source); - return OC_Filesystem::rename($sourceFile,$targetFile); + return OC_Filesystem::rename($sourceFile, $targetFile); } else { return false; } @@ -271,7 +271,7 @@ class OC_Files { if(OC_User::isLoggedIn()) { $targetFile=$targetDir.'/'.$target; $sourceFile=$sourceDir.'/'.$source; - return OC_Filesystem::copy($sourceFile,$targetFile); + return OC_Filesystem::copy($sourceFile, $targetFile); } } @@ -390,11 +390,11 @@ class OC_Files { * @return string guessed mime type */ static function pull($source,$token,$dir,$file) { - $tmpfile=tempnam(get_temp_dir(),'remoteCloudFile'); + $tmpfile=tempnam(get_temp_dir(), 'remoteCloudFile'); $fp=fopen($tmpfile,'w+'); $url=$source.="/files/pull.php?token=$token"; $ch=curl_init(); - curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); fclose($fp); @@ -402,7 +402,7 @@ class OC_Files { $httpCode=$info['http_code']; curl_close($ch); if($httpCode==200 or $httpCode==0) { - OC_Filesystem::fromTmpFile($tmpfile,$dir.'/'.$file); + OC_Filesystem::fromTmpFile($tmpfile, $dir.'/'.$file); return true; }else{ return false; @@ -423,8 +423,8 @@ class OC_Files { $size -=1; } else { $size=OC_Helper::humanFileSize($size); - $size=substr($size,0,-1);//strip the B - $size=str_replace(' ','',$size); //remove the space between the size and the postfix + $size=substr($size, 0, -1);//strip the B + $size=str_replace(' ', '', $size); //remove the space between the size and the postfix } //don't allow user to break his config -- broken or malicious size input @@ -459,7 +459,7 @@ class OC_Files { if(is_writable(OC::$SERVERROOT.'/.htaccess')) { file_put_contents(OC::$SERVERROOT.'/.htaccess', $htaccess); return OC_Helper::computerFileSize($size); - } else { OC_Log::write('files','Can\'t write upload limit to '.OC::$SERVERROOT.'/.htaccess. Please check the file permissions',OC_Log::WARN); } + } else { OC_Log::write('files', 'Can\'t write upload limit to '.OC::$SERVERROOT.'/.htaccess. Please check the file permissions', OC_Log::WARN); } return false; } @@ -474,7 +474,7 @@ class OC_Files { $old=''; while($old!=$path) {//replace any multiplicity of slashes with a single one $old=$path; - $path=str_replace('//','/',$path); + $path=str_replace('//', '/', $path); } return $path; } @@ -486,6 +486,6 @@ function fileCmp($a,$b) { }elseif($a['type']!='dir' and $b['type']=='dir') { return 1; }else{ - return strnatcasecmp($a['name'],$b['name']); + return strnatcasecmp($a['name'], $b['name']); } } diff --git a/lib/vobject.php b/lib/vobject.php index b5a04b4bf65..2ccf8eda685 100644 --- a/lib/vobject.php +++ b/lib/vobject.php @@ -62,7 +62,7 @@ class OC_VObject{ foreach($value as &$i ) { $i = implode("\\\\;", explode(';', $i)); } - return implode(';',$value); + return implode(';', $value); } /** @@ -71,15 +71,15 @@ class OC_VObject{ * @return array */ public static function unescapeSemicolons($value) { - $array = explode(';',$value); + $array = explode(';', $value); for($i=0;$ivobject->add('UID',$uid); + $uid = substr(md5(rand().time()), 0, 10); + $this->vobject->add('UID', $uid); } public function setString($name, $string) { -- cgit v1.2.3 From 2d61f0345297a92d23751d3228b74c6dca94d1e5 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Tue, 23 Oct 2012 08:01:09 +0200 Subject: More Checkstyle cleanup This is for all LowerCaseConstant warnings --- apps/files_encryption/lib/crypt.php | 4 ++-- core/ajax/requesttoken.php | 4 ++-- core/lostpassword/index.php | 2 +- core/lostpassword/resetpassword.php | 2 +- lib/files.php | 6 +++--- lib/helper.php | 10 +++++----- lib/migrate.php | 4 ++-- lib/ocsclient.php | 20 ++++++++++---------- lib/updater.php | 2 +- lib/user.php | 6 +++--- lib/util.php | 8 ++++---- public.php | 2 +- remote.php | 2 +- status.php | 2 +- 14 files changed, 37 insertions(+), 37 deletions(-) (limited to 'lib') diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 38d8edf28c3..d057c1ed194 100644 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -151,7 +151,7 @@ class OC_Crypt { */ public static function encryptFile( $source, $target, $key='') { $handleread = fopen($source, "rb"); - if($handleread!=FALSE) { + if($handleread!=false) { $handlewrite = fopen($target, "wb"); while (!feof($handleread)) { $content = fread($handleread, 8192); @@ -174,7 +174,7 @@ class OC_Crypt { */ public static function decryptFile( $source, $target, $key='') { $handleread = fopen($source, "rb"); - if($handleread!=FALSE) { + if($handleread!=false) { $handlewrite = fopen($target, "wb"); while (!feof($handleread)) { $content = fread($handleread, 8192); diff --git a/core/ajax/requesttoken.php b/core/ajax/requesttoken.php index 96d5402e621..705330b2c3e 100644 --- a/core/ajax/requesttoken.php +++ b/core/ajax/requesttoken.php @@ -29,8 +29,8 @@ require_once '../../lib/base.php'; // don't load apps or filesystem for this task -$RUNTIME_NOAPPS = TRUE; -$RUNTIME_NOSETUPFS = TRUE; +$RUNTIME_NOAPPS = true; +$RUNTIME_NOSETUPFS = true; // Sanity checks // using OCP\JSON::callCheck() below protects the token refreshing itself. diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php index 906208dcbc4..1da5bce8ea8 100644 --- a/core/lostpassword/index.php +++ b/core/lostpassword/index.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -$RUNTIME_NOAPPS = TRUE; //no apps +$RUNTIME_NOAPPS = true; //no apps require_once '../../lib/base.php'; diff --git a/core/lostpassword/resetpassword.php b/core/lostpassword/resetpassword.php index 896c8da76e0..7cd383921d7 100644 --- a/core/lostpassword/resetpassword.php +++ b/core/lostpassword/resetpassword.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -$RUNTIME_NOAPPS = TRUE; //no apps +$RUNTIME_NOAPPS = true; //no apps require_once '../../lib/base.php'; // Someone wants to reset their password: diff --git a/lib/files.php b/lib/files.php index a08bf9c6568..b4d4de1c995 100644 --- a/lib/files.php +++ b/lib/files.php @@ -146,7 +146,7 @@ class OC_Files { set_time_limit(0); $zip = new ZipArchive(); $filename = OC_Helper::tmpFile('.zip'); - if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) { + if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) { exit("cannot open <$filename>\n"); } foreach($files as $file) { @@ -167,7 +167,7 @@ class OC_Files { set_time_limit(0); $zip = new ZipArchive(); $filename = OC_Helper::tmpFile('.zip'); - if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) { + if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) { exit("cannot open <$filename>\n"); } $file=$dir.'/'.$files; @@ -447,7 +447,7 @@ class OC_Files { $setting = 'php_value '.$key.' '.$size; $hasReplaced = 0; $content = preg_replace($pattern, $setting, $htaccess, 1, $hasReplaced); - if($content !== NULL) { + if($content !== null) { $htaccess = $content; } if($hasReplaced == 0) { diff --git a/lib/helper.php b/lib/helper.php index 37a17885eee..b79955aa9bf 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -274,18 +274,18 @@ class OC_Helper { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if(is_link($fullpath)) - return FALSE; + return false; elseif(!is_dir($fullpath) && !@chmod($fullpath, $filemode)) - return FALSE; + return false; elseif(!self::chmodr($fullpath, $filemode)) - return FALSE; + return false; } } closedir($dh); if(@chmod($path, $filemode)) - return TRUE; + return true; else - return FALSE; + return false; } /** diff --git a/lib/migrate.php b/lib/migrate.php index 3694ea877a0..409d77a1a96 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -347,7 +347,7 @@ class OC_Migrate{ OC_Log::write( 'migration', 'Zip not found', OC_Log::ERROR ); return false; } - if ( self::$zip->open( $path ) != TRUE ) { + if ( self::$zip->open( $path ) != true ) { OC_Log::write( 'migration', "Failed to open zip file", OC_Log::ERROR ); return false; } @@ -576,7 +576,7 @@ class OC_Migrate{ OC_Log::write('migration', 'createZip() called but $zip and/or $zippath have not been set', OC_Log::ERROR); return false; } - if ( self::$zip->open( self::$zippath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ) !== TRUE ) { + if ( self::$zip->open( self::$zippath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ) !== true ) { OC_Log::write('migration', 'Failed to create the zip with error: '.self::$zip->getStatusString(), OC_Log::ERROR); return false; } else { diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 3c80f319662..4d4937377b3 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -76,12 +76,12 @@ class OC_OCSClient{ */ public static function getCategories() { if(OC_Config::getValue('appstoreenabled', true)==false) { - return NULL; + return null; } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; $xml=OC_OCSClient::getOCSresponse($url); if($xml==FALSE) { - return NULL; + return null; } $data=simplexml_load_string($xml); @@ -156,14 +156,14 @@ class OC_OCSClient{ */ public static function getApplication($id) { if(OC_Config::getValue('appstoreenabled', true)==false) { - return NULL; + return null; } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); - return NULL; + return null; } $data=simplexml_load_string($xml); @@ -194,14 +194,14 @@ class OC_OCSClient{ */ public static function getApplicationDownload($id,$item) { if(OC_Config::getValue('appstoreenabled', true)==false) { - return NULL; + return null; } $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); - return NULL; + return null; } $data=simplexml_load_string($xml); @@ -237,9 +237,9 @@ class OC_OCSClient{ $kbe=array(); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL); - return NULL; + return null; } $data=simplexml_load_string($xml); diff --git a/lib/updater.php b/lib/updater.php index cb22da4f906..483570b050a 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -52,7 +52,7 @@ class OC_Updater{ ) ); $xml=@file_get_contents($url, 0, $ctx); - if($xml==FALSE) { + if($xml==false) { return array(); } $data=@simplexml_load_string($xml); diff --git a/lib/user.php b/lib/user.php index 77bfe0de92a..eff93b501bb 100644 --- a/lib/user.php +++ b/lib/user.php @@ -491,8 +491,8 @@ class OC_User { unset($_COOKIE["oc_username"]); unset($_COOKIE["oc_token"]); unset($_COOKIE["oc_remember_login"]); - setcookie("oc_username", NULL, -1); - setcookie("oc_token", NULL, -1); - setcookie("oc_remember_login", NULL, -1); + setcookie("oc_username", null, -1); + setcookie("oc_token", null, -1); + setcookie("oc_remember_login", null, -1); } } diff --git a/lib/util.php b/lib/util.php index 0a824f86eb3..75991d685c6 100755 --- a/lib/util.php +++ b/lib/util.php @@ -611,14 +611,14 @@ class OC_Util { // Try to use openssl_random_pseudo_bytes if(function_exists('openssl_random_pseudo_bytes')) { $pseudo_byte = bin2hex(openssl_random_pseudo_bytes($length, $strong)); - if($strong == TRUE) { + if($strong == true) { return substr($pseudo_byte, 0, $length); // Truncate it to match the length } } // Try to use /dev/urandom $fp = @file_get_contents('/dev/urandom', false, null, 0, $length); - if ($fp !== FALSE) { + if ($fp !== false) { $string = substr(bin2hex($fp), 0, $length); return $string; } @@ -645,14 +645,14 @@ class OC_Util { // Check openssl_random_pseudo_bytes if(function_exists('openssl_random_pseudo_bytes')) { openssl_random_pseudo_bytes(1, $strong); - if($strong == TRUE) { + if($strong == true) { return true; } } // Check /dev/urandom $fp = @file_get_contents('/dev/urandom', false, null, 0, 1); - if ($fp !== FALSE) { + if ($fp !== false) { return true; } diff --git a/public.php b/public.php index db8419373ee..759e8e91619 100644 --- a/public.php +++ b/public.php @@ -1,5 +1,5 @@ Date: Tue, 23 Oct 2012 08:20:17 +0200 Subject: Checkstyle: LowerCaseConstant --- index.php | 2 +- lib/ocsclient.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/index.php b/index.php index 12b2d8f406d..bf0b287a64b 100755 --- a/index.php +++ b/index.php @@ -21,7 +21,7 @@ * */ -$RUNTIME_NOAPPS = TRUE; //no apps, yet +$RUNTIME_NOAPPS = true; //no apps, yet require_once 'lib/base.php'; diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 4d4937377b3..32c2cfe6e48 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -80,7 +80,7 @@ class OC_OCSClient{ } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { + if($xml==false) { return null; } $data=simplexml_load_string($xml); @@ -122,8 +122,8 @@ class OC_OCSClient{ $apps=array(); $xml=OC_OCSClient::getOCSresponse($url); - if($xml==FALSE) { - return NULL; + if($xml==false) { + return null; } $data=simplexml_load_string($xml); -- cgit v1.2.3 From ff5f9370c4a004f48cc036eb437a58cefb29962d Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Tue, 23 Oct 2012 08:25:30 +0200 Subject: Checkstyle: MultiLineCondition --- lib/app.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/app.php b/lib/app.php index cb68ea3ddde..2319c50950e 100755 --- a/lib/app.php +++ b/lib/app.php @@ -556,10 +556,7 @@ class OC_App{ while( $file = readdir( $dh ) ) { - if ( - $file[0] != '.' - and is_file($apps_dir['path'].'/'.$file.'/appinfo/app.php' ) - ) { + if ($file[0] != '.' and is_file($apps_dir['path'].'/'.$file.'/appinfo/app.php')) { $apps[] = $file; -- cgit v1.2.3 From 36d0d7590134f5587ab09c67927c3187e8b5c790 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Tue, 23 Oct 2012 08:35:54 +0200 Subject: Codestyle: FunctionCallArgumentSpacing --- apps/files/index.php | 2 +- apps/files_sharing/templates/public.php | 2 +- apps/user_webdavauth/user_webdavauth.php | 2 +- lib/app.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/apps/files/index.php b/apps/files/index.php index 493087d26f1..4d169757cc7 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -87,7 +87,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size); $freeSpace=OC_Filesystem::free_space('/'); $freeSpace=max($freeSpace,0); -$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace); +$maxUploadFilesize = min($maxUploadFilesize, $freeSpace); $permissions = OCP\Share::PERMISSION_READ; if (OC_Filesystem::isUpdatable($dir.'/')) { diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index ef81e296d82..35cca7c42dc 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -19,7 +19,7 @@ - +
diff --git a/apps/user_webdavauth/user_webdavauth.php b/apps/user_webdavauth/user_webdavauth.php index c36d37c1fa2..bd9f45d357b 100755 --- a/apps/user_webdavauth/user_webdavauth.php +++ b/apps/user_webdavauth/user_webdavauth.php @@ -51,7 +51,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) { - OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$this->webdavauth_url.'" ' ,3); + OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$this->webdavauth_url.'" ', 3); return false; } diff --git a/lib/app.php b/lib/app.php index 2319c50950e..28757735e04 100755 --- a/lib/app.php +++ b/lib/app.php @@ -549,7 +549,7 @@ class OC_App{ foreach ( OC::$APPSROOTS as $apps_dir ) { if(! is_readable($apps_dir['path'])) { - OC_Log::write('core', 'unable to read app folder : ' .$apps_dir['path'] , OC_Log::WARN); + OC_Log::write('core', 'unable to read app folder : ' .$apps_dir['path'], OC_Log::WARN); continue; } $dh = opendir( $apps_dir['path'] ); -- cgit v1.2.3 From 9601352d469e6c00dbc746fd72d0f3ee7f1b9e66 Mon Sep 17 00:00:00 2001 From: scambra Date: Fri, 19 Oct 2012 14:03:51 +0200 Subject: fix strftime in windows, use %#d instead of %e in windows --- lib/l10n.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/l10n.php b/lib/l10n.php index 41c89a7d4b5..f1a2523c307 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -223,7 +223,12 @@ class OC_L10N{ $locales[] = $locales[0].'_'.strtoupper($locales[0]); } setlocale(LC_TIME, $locales); - return strftime($this->localizations[$type], $data); + $format = $this->localizations[$type]; + // Check for Windows to find and replace the %e modifier correctly + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + $format = preg_replace('#(? Date: Tue, 23 Oct 2012 16:34:58 +0200 Subject: use strtotime on non-nummeric times in oc_filesystem::touch --- lib/filesystemview.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 2950ced5f9e..776c859412f 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -251,6 +251,9 @@ class OC_FilesystemView { return $this->basicOperation('filemtime', $path); } public function touch($path, $mtime=null) { + if(!is_null($mtime) and !is_numeric($mtime)){ + $mtime = strtotime($mtime); + } return $this->basicOperation('touch', $path, array('write'), $mtime); } public function file_get_contents($path) { -- cgit v1.2.3