Checkstyle: NoSpaceAfterComma

This commit is contained in:
Felix Moeller 2012-10-23 22:53:54 +02:00
parent 36d0d75901
commit e73b817a38
30 changed files with 83 additions and 83 deletions

View File

@ -14,9 +14,9 @@
$relative_modified_date = OCP\relative_modified_date($file['mtime']); $relative_modified_date = OCP\relative_modified_date($file['mtime']);
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14 $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
if($relative_date_color>200) $relative_date_color = 200; if($relative_date_color>200) $relative_date_color = 200;
$name = str_replace('+','%20',urlencode($file['name'])); $name = str_replace('+','%20', urlencode($file['name']));
$name = str_replace('%2F','/', $name); $name = str_replace('%2F','/', $name);
$directory = str_replace('+','%20',urlencode($file['directory'])); $directory = str_replace('+','%20', urlencode($file['directory']));
$directory = str_replace('%2F','/', $directory); ?> $directory = str_replace('%2F','/', $directory); ?>
<tr data-id="<?php echo $file['id']; ?>" data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-permissions='<?php echo $file['permissions']; ?>'> <tr data-id="<?php echo $file['id']; ?>" data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-permissions='<?php echo $file['permissions']; ?>'>
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo OCP\mimetype_icon('dir'); else echo OCP\mimetype_icon($file['mimetype']); ?>)"> <td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo OCP\mimetype_icon('dir'); else echo OCP\mimetype_icon($file['mimetype']); ?>)">

View File

@ -167,7 +167,7 @@ class OC_CryptStream{
public function stream_close() { public function stream_close() {
$this->flush(); $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),''); OC_FileCache::put($this->path, array('encrypted'=>true,'size'=>$this->size),'');
} }
return fclose($this->source); return fclose($this->source);
} }

View File

@ -68,7 +68,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
if (!is_resource($data)) {//stream put contents should have been converter to fopen if (!is_resource($data)) {//stream put contents should have been converter to fopen
$size=strlen($data); $size=strlen($data);
$data=OC_Crypt::blockEncrypt($data); $data=OC_Crypt::blockEncrypt($data);
OC_FileCache::put($path,array('encrypted'=>true,'size'=>$size),''); OC_FileCache::put($path, array('encrypted'=>true,'size'=>$size),'');
} }
} }
} }

View File

@ -19,7 +19,7 @@ class Test_Encryption extends UnitTestCase {
$chunk=substr($source,0,8192); $chunk=substr($source,0,8192);
$encrypted=OC_Crypt::encrypt($chunk,$key); $encrypted=OC_Crypt::encrypt($chunk,$key);
$this->assertEqual(strlen($chunk),strlen($encrypted)); $this->assertEqual(strlen($chunk), strlen($encrypted));
$decrypted=OC_Crypt::decrypt($encrypted,$key); $decrypted=OC_Crypt::decrypt($encrypted,$key);
$decrypted=rtrim($decrypted, "\0"); $decrypted=rtrim($decrypted, "\0");
$this->assertEqual($decrypted,$chunk); $this->assertEqual($decrypted,$chunk);
@ -66,7 +66,7 @@ class Test_Encryption extends UnitTestCase {
$this->assertEqual($decrypted,$source); $this->assertEqual($decrypted,$source);
$encrypted=OC_Crypt::blockEncrypt($source,$key); $encrypted=OC_Crypt::blockEncrypt($source,$key);
$decrypted=OC_Crypt::blockDecrypt($encrypted,$key,strlen($source)); $decrypted=OC_Crypt::blockDecrypt($encrypted,$key, strlen($source));
$this->assertEqual($decrypted,$source); $this->assertEqual($decrypted,$source);
} }
} }

View File

@ -30,7 +30,7 @@ class Test_CryptProxy extends UnitTestCase {
//set up temporary storage //set up temporary storage
OC_Filesystem::clearMounts(); OC_Filesystem::clearMounts();
OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/'); OC_Filesystem::mount('OC_Filestorage_Temporary', array(),'/');
OC_Filesystem::init('/'.$user.'/files'); OC_Filesystem::init('/'.$user.'/files');
@ -59,7 +59,7 @@ class Test_CryptProxy extends UnitTestCase {
$fromFile=OC_Filesystem::file_get_contents('/file'); $fromFile=OC_Filesystem::file_get_contents('/file');
$this->assertNotEqual($original,$stored); $this->assertNotEqual($original,$stored);
$this->assertEqual(strlen($original),strlen($fromFile)); $this->assertEqual(strlen($original), strlen($fromFile));
$this->assertEqual($original,$fromFile); $this->assertEqual($original,$fromFile);
} }
@ -98,7 +98,7 @@ class Test_CryptProxy extends UnitTestCase {
$fromFile=OC_Filesystem::file_get_contents('/file'); $fromFile=OC_Filesystem::file_get_contents('/file');
$this->assertNotEqual($original,$stored); $this->assertNotEqual($original,$stored);
$this->assertEqual(strlen($original),strlen($fromFile)); $this->assertEqual(strlen($original), strlen($fromFile));
$this->assertEqual($original,$fromFile); $this->assertEqual($original,$fromFile);
$file=__DIR__.'/zeros'; $file=__DIR__.'/zeros';
@ -112,6 +112,6 @@ class Test_CryptProxy extends UnitTestCase {
$fromFile=OC_Filesystem::file_get_contents('/file'); $fromFile=OC_Filesystem::file_get_contents('/file');
$this->assertNotEqual($original,$stored); $this->assertNotEqual($original,$stored);
$this->assertEqual(strlen($original),strlen($fromFile)); $this->assertEqual(strlen($original), strlen($fromFile));
} }
} }

View File

@ -10,11 +10,11 @@ class Test_CryptStream extends UnitTestCase {
private $tmpFiles=array(); private $tmpFiles=array();
function testStream() { function testStream() {
$stream=$this->getStream('test1','w',strlen('foobar')); $stream=$this->getStream('test1','w', strlen('foobar'));
fwrite($stream,'foobar'); fwrite($stream,'foobar');
fclose($stream); fclose($stream);
$stream=$this->getStream('test1','r',strlen('foobar')); $stream=$this->getStream('test1','r', strlen('foobar'));
$data=fread($stream,6); $data=fread($stream,6);
fclose($stream); fclose($stream);
$this->assertEqual('foobar',$data); $this->assertEqual('foobar',$data);
@ -26,10 +26,10 @@ class Test_CryptStream extends UnitTestCase {
fclose($target); fclose($target);
fclose($source); fclose($source);
$stream=$this->getStream('test2','r',filesize($file)); $stream=$this->getStream('test2','r', filesize($file));
$data=stream_get_contents($stream); $data=stream_get_contents($stream);
$original=file_get_contents($file); $original=file_get_contents($file);
$this->assertEqual(strlen($original),strlen($data)); $this->assertEqual(strlen($original), strlen($data));
$this->assertEqual($original,$data); $this->assertEqual($original,$data);
} }
@ -59,27 +59,27 @@ class Test_CryptStream extends UnitTestCase {
$file=__DIR__.'/binary'; $file=__DIR__.'/binary';
$source=file_get_contents($file); $source=file_get_contents($file);
$stream=$this->getStream('test','w',strlen($source)); $stream=$this->getStream('test','w', strlen($source));
fwrite($stream,$source); fwrite($stream,$source);
fclose($stream); fclose($stream);
$stream=$this->getStream('test','r',strlen($source)); $stream=$this->getStream('test','r', strlen($source));
$data=stream_get_contents($stream); $data=stream_get_contents($stream);
fclose($stream); fclose($stream);
$this->assertEqual(strlen($data),strlen($source)); $this->assertEqual(strlen($data), strlen($source));
$this->assertEqual($source,$data); $this->assertEqual($source,$data);
$file=__DIR__.'/zeros'; $file=__DIR__.'/zeros';
$source=file_get_contents($file); $source=file_get_contents($file);
$stream=$this->getStream('test2','w',strlen($source)); $stream=$this->getStream('test2','w', strlen($source));
fwrite($stream,$source); fwrite($stream,$source);
fclose($stream); fclose($stream);
$stream=$this->getStream('test2','r',strlen($source)); $stream=$this->getStream('test2','r', strlen($source));
$data=stream_get_contents($stream); $data=stream_get_contents($stream);
fclose($stream); fclose($stream);
$this->assertEqual(strlen($data),strlen($source)); $this->assertEqual(strlen($data), strlen($source));
$this->assertEqual($source,$data); $this->assertEqual($source,$data);
} }
} }

View File

@ -53,7 +53,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
case 'ab': case 'ab':
//these are supported by the wrapper //these are supported by the wrapper
$context = stream_context_create(array('ftp' => array('overwrite' => true))); $context = stream_context_create(array('ftp' => array('overwrite' => true)));
return fopen($this->constructUrl($path),$mode,false,$context); return fopen($this->constructUrl($path),$mode, false,$context);
case 'r+': case 'r+':
case 'w+': case 'w+':
case 'wb+': case 'wb+':
@ -64,7 +64,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
case 'c+': case 'c+':
//emulate these //emulate these
if(strrpos($path,'.')!==false) { if(strrpos($path,'.')!==false) {
$ext=substr($path,strrpos($path,'.')); $ext=substr($path, strrpos($path,'.'));
}else{ }else{
$ext=''; $ext='';
} }
@ -80,7 +80,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
public function writeBack($tmpFile) { public function writeBack($tmpFile) {
if(isset(self::$tempFiles[$tmpFile])) { if(isset(self::$tempFiles[$tmpFile])) {
$this->uploadFile($tmpFile,self::$tempFiles[$tmpFile]); $this->uploadFile($tmpFile, self::$tempFiles[$tmpFile]);
unlink($tmpFile); unlink($tmpFile);
} }
} }

View File

@ -395,7 +395,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
case 'c': case 'c':
case 'c+': case 'c+':
if (strrpos($path,'.') !== false) { if (strrpos($path,'.') !== false) {
$ext = substr($path,strrpos($path,'.')); $ext = substr($path, strrpos($path,'.'));
} else { } else {
$ext = ''; $ext = '';
} }

View File

@ -83,7 +83,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$parentContainer=$this->getContainer($parent); $parentContainer=$this->getContainer($parent);
} }
} }
$this->addSubContainer($parentContainer,basename($path)); $this->addSubContainer($parentContainer, basename($path));
return $this->conn->create_container($this->getContainerName($path)); return $this->conn->create_container($this->getContainerName($path));
} }
@ -245,7 +245,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
return false; return false;
}else{ }else{
unset($containers[$i]); unset($containers[$i]);
file_put_contents($tmpFile,implode("\n",$containers)."\n"); file_put_contents($tmpFile, implode("\n",$containers)."\n");
} }
$obj->load_from_filename($tmpFile); $obj->load_from_filename($tmpFile);
@ -304,7 +304,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$this->emptyContainer($path); $this->emptyContainer($path);
if($path!='' and $path!='/') { if($path!='' and $path!='/') {
$parentContainer=$this->getContainer(dirname($path)); $parentContainer=$this->getContainer(dirname($path));
$this->removeSubContainer($parentContainer,basename($path)); $this->removeSubContainer($parentContainer, basename($path));
} }
$this->conn->delete_container($this->getContainerName($path)); $this->conn->delete_container($this->getContainerName($path));
@ -440,7 +440,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
public function writeBack($tmpFile) { public function writeBack($tmpFile) {
if(isset(self::$tempFiles[$tmpFile])) { if(isset(self::$tempFiles[$tmpFile])) {
$this->fromTmpFile($tmpFile,self::$tempFiles[$tmpFile]); $this->fromTmpFile($tmpFile, self::$tempFiles[$tmpFile]);
unlink($tmpFile); unlink($tmpFile);
} }
} }
@ -466,7 +466,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
public function rename($path1,$path2) { public function rename($path1,$path2) {
$sourceContainer=$this->getContainer(dirname($path1)); $sourceContainer=$this->getContainer(dirname($path1));
$targetContainer=$this->getContainer(dirname($path2)); $targetContainer=$this->getContainer(dirname($path2));
$result=$sourceContainer->move_object_to(basename($path1),$targetContainer,basename($path2)); $result=$sourceContainer->move_object_to(basename($path1),$targetContainer, basename($path2));
unset($this->objects[$path1]); unset($this->objects[$path1]);
if($result) { if($result) {
$targetObj=$this->getObject($path2); $targetObj=$this->getObject($path2);
@ -478,7 +478,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
public function copy($path1,$path2) { public function copy($path1,$path2) {
$sourceContainer=$this->getContainer(dirname($path1)); $sourceContainer=$this->getContainer(dirname($path1));
$targetContainer=$this->getContainer(dirname($path2)); $targetContainer=$this->getContainer(dirname($path2));
$result=$sourceContainer->copy_object_to(basename($path1),$targetContainer,basename($path2)); $result=$sourceContainer->copy_object_to(basename($path1),$targetContainer, basename($path2));
if($result) { if($result) {
$targetObj=$this->getObject($path2); $targetObj=$this->getObject($path2);
$this->resetMTime($targetObj); $this->resetMTime($targetObj);

View File

@ -65,12 +65,12 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
public function mkdir($path) { public function mkdir($path) {
$path=$this->cleanPath($path); $path=$this->cleanPath($path);
return $this->simpleResponse('MKCOL',$path,null,201); return $this->simpleResponse('MKCOL',$path, null,201);
} }
public function rmdir($path) { public function rmdir($path) {
$path=$this->cleanPath($path); $path=$this->cleanPath($path);
return $this->simpleResponse('DELETE',$path,null,204); return $this->simpleResponse('DELETE',$path, null,204);
} }
public function opendir($path) { public function opendir($path) {
@ -123,7 +123,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
} }
public function unlink($path) { public function unlink($path) {
return $this->simpleResponse('DELETE',$path,null,204); return $this->simpleResponse('DELETE',$path, null,204);
} }
public function fopen($path,$mode) { public function fopen($path,$mode) {
@ -159,7 +159,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
case 'c+': case 'c+':
//emulate these //emulate these
if(strrpos($path,'.')!==false) { if(strrpos($path,'.')!==false) {
$ext=substr($path,strrpos($path,'.')); $ext=substr($path, strrpos($path,'.'));
}else{ }else{
$ext=''; $ext='';
} }
@ -175,7 +175,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
public function writeBack($tmpFile) { public function writeBack($tmpFile) {
if(isset(self::$tempFiles[$tmpFile])) { if(isset(self::$tempFiles[$tmpFile])) {
$this->uploadFile($tmpFile,self::$tempFiles[$tmpFile]); $this->uploadFile($tmpFile, self::$tempFiles[$tmpFile]);
unlink($tmpFile); unlink($tmpFile);
} }
} }
@ -225,7 +225,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$path1=$this->cleanPath($path1); $path1=$this->cleanPath($path1);
$path2=$this->root.$this->cleanPath($path2); $path2=$this->root.$this->cleanPath($path2);
try{ try{
$response=$this->client->request('MOVE',$path1,null,array('Destination'=>$path2)); $response=$this->client->request('MOVE',$path1,null, array('Destination'=>$path2));
return true; return true;
}catch(Exception $e) { }catch(Exception $e) {
echo $e; echo $e;
@ -239,7 +239,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$path1=$this->cleanPath($path1); $path1=$this->cleanPath($path1);
$path2=$this->root.$this->cleanPath($path2); $path2=$this->root.$this->cleanPath($path2);
try{ try{
$response=$this->client->request('COPY',$path1,null,array('Destination'=>$path2)); $response=$this->client->request('COPY',$path1,null, array('Destination'=>$path2));
return true; return true;
}catch(Exception $e) { }catch(Exception $e) {
echo $e; echo $e;

View File

@ -64,7 +64,7 @@ class Hooks {
$abs_newpath = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('').$params['newpath'].'.v'; $abs_newpath = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('').$params['newpath'].'.v';
if(Storage::isversioned($rel_oldpath)) { if(Storage::isversioned($rel_oldpath)) {
$info=pathinfo($abs_newpath); $info=pathinfo($abs_newpath);
if(!file_exists($info['dirname'])) mkdir($info['dirname'],0750,true); if(!file_exists($info['dirname'])) mkdir($info['dirname'],0750, true);
$versions = Storage::getVersions($rel_oldpath); $versions = Storage::getVersions($rel_oldpath);
foreach ($versions as $v) { foreach ($versions as $v) {
rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']); rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']);

View File

@ -99,7 +99,7 @@ class Storage {
$versionsFolderName=\OCP\Config::getSystemValue('datadirectory'). $versions_fileview->getAbsolutePath(''); $versionsFolderName=\OCP\Config::getSystemValue('datadirectory'). $versions_fileview->getAbsolutePath('');
$matches=glob($versionsFolderName.'/'.$filename.'.v*'); $matches=glob($versionsFolderName.'/'.$filename.'.v*');
sort($matches); sort($matches);
$parts=explode('.v',end($matches)); $parts=explode('.v', end($matches));
if((end($parts)+Storage::DEFAULTMININTERVAL)>time()) { if((end($parts)+Storage::DEFAULTMININTERVAL)>time()) {
return false; return false;
} }
@ -109,7 +109,7 @@ class Storage {
// create all parent folders // create all parent folders
$info=pathinfo($filename); $info=pathinfo($filename);
if(!file_exists($versionsFolderName.'/'.$info['dirname'])) { if(!file_exists($versionsFolderName.'/'.$info['dirname'])) {
mkdir($versionsFolderName.'/'.$info['dirname'],0750,true); mkdir($versionsFolderName.'/'.$info['dirname'],0750, true);
} }
// store a new version of a file // store a new version of a file

View File

@ -657,7 +657,7 @@ abstract class Access {
$this->connection->ldapUuidAttribute = $attribute; $this->connection->ldapUuidAttribute = $attribute;
return true; return true;
} }
\OCP\Util::writeLog('user_ldap', 'The looked for uuid attr is not '.$attribute.', result was '.print_r($value,true), \OCP\Util::DEBUG); \OCP\Util::writeLog('user_ldap', 'The looked for uuid attr is not '.$attribute.', result was '.print_r($value, true), \OCP\Util::DEBUG);
} }
return false; return false;

View File

@ -29,18 +29,18 @@ class Test_Group_Ldap extends UnitTestCase {
OC_Group::useBackend(new OCA\user_ldap\GROUP_LDAP()); OC_Group::useBackend(new OCA\user_ldap\GROUP_LDAP());
$group_ldap = new OCA\user_ldap\GROUP_LDAP(); $group_ldap = new OCA\user_ldap\GROUP_LDAP();
$this->assertIsA(OC_Group::getGroups(),gettype(array())); $this->assertIsA(OC_Group::getGroups(), gettype(array()));
$this->assertIsA($group_ldap->getGroups(),gettype(array())); $this->assertIsA($group_ldap->getGroups(), gettype(array()));
$this->assertFalse(OC_Group::inGroup('john','dosers'),gettype(false)); $this->assertFalse(OC_Group::inGroup('john','dosers'), gettype(false));
$this->assertFalse($group_ldap->inGroup('john','dosers'),gettype(false)); $this->assertFalse($group_ldap->inGroup('john','dosers'), gettype(false));
//TODO: check also for expected true result. This backend won't be able to do any modifications, maybe use a dummy for this. //TODO: check also for expected true result. This backend won't be able to do any modifications, maybe use a dummy for this.
$this->assertIsA(OC_Group::getUserGroups('john doe'),gettype(array())); $this->assertIsA(OC_Group::getUserGroups('john doe'), gettype(array()));
$this->assertIsA($group_ldap->getUserGroups('john doe'),gettype(array())); $this->assertIsA($group_ldap->getUserGroups('john doe'), gettype(array()));
$this->assertIsA(OC_Group::usersInGroup('campers'),gettype(array())); $this->assertIsA(OC_Group::usersInGroup('campers'), gettype(array()));
$this->assertIsA($group_ldap->usersInGroup('campers'),gettype(array())); $this->assertIsA($group_ldap->usersInGroup('campers'), gettype(array()));
} }
} }

View File

@ -109,7 +109,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
$lockInfo->created = time(); $lockInfo->created = time();
$lockInfo->uri = $uri; $lockInfo->uri = $uri;
$locks = $this->getLocks($uri,false); $locks = $this->getLocks($uri, false);
$exists = false; $exists = false;
foreach($locks as $lock) { foreach($locks as $lock) {
if ($lock->token == $lockInfo->token) $exists = true; if ($lock->token == $lockInfo->token) $exists = true;

View File

@ -102,7 +102,7 @@ class OC_FileCache{
$data['versioned']=(int)$data['versioned']; $data['versioned']=(int)$data['versioned'];
$user=OC_User::getUser(); $user=OC_User::getUser();
$query=OC_DB::prepare('INSERT INTO `*PREFIX*fscache`(`parent`, `name`, `path`, `path_hash`, `size`, `mtime`, `ctime`, `mimetype`, `mimepart`,`user`,`writable`,`encrypted`,`versioned`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'); $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'])); $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)) { 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);
} }
@ -163,7 +163,7 @@ class OC_FileCache{
$newPath=$root.$newPath; $newPath=$root.$newPath;
$newParent=self::getParentId($newPath); $newParent=self::getParentId($newPath);
$query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `parent`=? ,`name`=?, `path`=?, `path_hash`=? WHERE `path_hash`=?'); $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `parent`=? ,`name`=?, `path`=?, `path_hash`=? WHERE `path_hash`=?');
$query->execute(array($newParent,basename($newPath),$newPath,md5($newPath),md5($oldPath))); $query->execute(array($newParent,basename($newPath),$newPath,md5($newPath), md5($oldPath)));
if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$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));
@ -176,7 +176,7 @@ class OC_FileCache{
while($row= $query->execute(array($oldPath.'/%'))->fetchRow()) { while($row= $query->execute(array($oldPath.'/%'))->fetchRow()) {
$old=$row['path']; $old=$row['path'];
$new=$newPath.substr($old, $oldLength); $new=$newPath.substr($old, $oldLength);
$updateQuery->execute(array($new,md5($new),md5($old))); $updateQuery->execute(array($new,md5($new), md5($old)));
if(($cache=OC_Cache::getUserCache(true)) && $cache->hasKey('fileid/'.$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));

View File

@ -260,7 +260,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
if($dh) { if($dh) {
while($item=readdir($dh)) { while($item=readdir($dh)) {
if ($item == '.' || $item == '..') continue; if ($item == '.' || $item == '..') continue;
if(strstr(strtolower($item),strtolower($query))!==false) { if(strstr(strtolower($item), strtolower($query))!==false) {
$files[]=$dir.'/'.$item; $files[]=$dir.'/'.$item;
} }
if($this->is_dir($dir.'/'.$item)) { if($this->is_dir($dir.'/'.$item)) {

View File

@ -103,7 +103,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
if(!$this->file_exists($path2)) { if(!$this->file_exists($path2)) {
$this->mkdir($path2); $this->mkdir($path2);
} }
$source=substr($path1,strrpos($path1,'/')+1); $source=substr($path1, strrpos($path1,'/')+1);
$path2.=$source; $path2.=$source;
} }
return copy($this->datadir.$path1,$this->datadir.$path2); return copy($this->datadir.$path1,$this->datadir.$path2);
@ -178,7 +178,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
$files=array(); $files=array();
foreach (scandir($this->datadir.$dir) as $item) { foreach (scandir($this->datadir.$dir) as $item) {
if ($item == '.' || $item == '..') continue; if ($item == '.' || $item == '..') continue;
if(strstr(strtolower($item),strtolower($query))!==false) { if(strstr(strtolower($item), strtolower($query))!==false) {
$files[]=$dir.'/'.$item; $files[]=$dir.'/'.$item;
} }
if(is_dir($this->datadir.$dir.'/'.$item)) { if(is_dir($this->datadir.$dir.'/'.$item)) {

View File

@ -148,7 +148,7 @@ class OC_Filesystem{
* @return string * @return string
*/ */
static public function getMountPoint($path) { static public function getMountPoint($path) {
OC_Hook::emit(self::CLASSNAME,'get_mountpoint',array('path'=>$path)); OC_Hook::emit(self::CLASSNAME,'get_mountpoint', array('path'=>$path));
if(!$path) { if(!$path) {
$path='/'; $path='/';
} }
@ -176,7 +176,7 @@ class OC_Filesystem{
*/ */
static public function getInternalPath($path) { static public function getInternalPath($path) {
$mountPoint=self::getMountPoint($path); $mountPoint=self::getMountPoint($path);
$internalPath=substr($path,strlen($mountPoint)); $internalPath=substr($path, strlen($mountPoint));
return $internalPath; return $internalPath;
} }

View File

@ -585,7 +585,7 @@ class OC_FilesystemView {
$result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result); $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()) { if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()) {
if($operation!='fopen') {//no post hooks for fopen, the file stream is still open 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; return $result;

View File

@ -189,7 +189,7 @@ class OC_Helper {
return OC::$WEBROOT."/core/img/filetypes/$mimetype.png"; return OC::$WEBROOT."/core/img/filetypes/$mimetype.png";
} }
//try only the first part of the filetype //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" )) { if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.png" )) {
return OC::$WEBROOT."/core/img/filetypes/$mimetype.png"; return OC::$WEBROOT."/core/img/filetypes/$mimetype.png";
} }
@ -363,7 +363,7 @@ class OC_Helper {
if($mimeType=='application/octet-stream' and function_exists('finfo_open') and function_exists('finfo_file') and $finfo=finfo_open(FILEINFO_MIME)) { 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) { if($info) {
$mimeType=substr($info,0,strpos($info,';')); $mimeType=substr($info,0, strpos($info,';'));
} }
finfo_close($finfo); finfo_close($finfo);
} }
@ -380,8 +380,8 @@ class OC_Helper {
pclose($fp); pclose($fp);
//trim the character set from the end of the response //trim the character set from the end of the response
$mimeType=substr($reply,0,strrpos($reply,' ')); $mimeType=substr($reply,0, strrpos($reply,' '));
$mimeType=substr($mimeType,0,strrpos($mimeType,"\n")); $mimeType=substr($mimeType,0, strrpos($mimeType,"\n"));
//trim ; //trim ;
if (strpos($mimeType, ';') !== false) { if (strpos($mimeType, ';') !== false) {
@ -495,7 +495,7 @@ class OC_Helper {
} }
$count=0; $count=0;
while(!feof($source)) { while(!feof($source)) {
$count+=fwrite($target,fread($source,8192)); $count+=fwrite($target, fread($source,8192));
} }
return $count; return $count;
} }

View File

@ -125,7 +125,7 @@ class OC_Installer{
} }
return false; return false;
} }
$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml',true); $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true);
// check the code for not allowed calls // check the code for not allowed calls
if(!OC_Installer::checkCode($info['id'],$extractDir)) { if(!OC_Installer::checkCode($info['id'],$extractDir)) {
OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR); OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR);

View File

@ -2,7 +2,7 @@
class OC_Search_Provider_File extends OC_Search_Provider{ class OC_Search_Provider_File extends OC_Search_Provider{
function search($query) { function search($query) {
$files=OC_FileCache::search($query,true); $files=OC_FileCache::search($query, true);
$results=array(); $results=array();
$l=OC_L10N::get('lib'); $l=OC_L10N::get('lib');
foreach($files as $fileData) { foreach($files as $fileData) {

View File

@ -92,7 +92,7 @@ class OC_Setup {
//write the config file //write the config file
OC_Config::setValue('datadirectory', $datadir); OC_Config::setValue('datadirectory', $datadir);
OC_Config::setValue('dbtype', $dbtype); OC_Config::setValue('dbtype', $dbtype);
OC_Config::setValue('version',implode('.',OC_Util::getVersion())); OC_Config::setValue('version', implode('.',OC_Util::getVersion()));
if($dbtype == 'mysql') { if($dbtype == 'mysql') {
$dbuser = $options['dbuser']; $dbuser = $options['dbuser'];
$dbpass = $options['dbpass']; $dbpass = $options['dbpass'];
@ -376,8 +376,8 @@ class OC_Setup {
} }
if(count($error) == 0) { if(count($error) == 0) {
OC_Appconfig::setValue('core', 'installedat',microtime(true)); OC_Appconfig::setValue('core', 'installedat', microtime(true));
OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
OC_Group::createGroup('admin'); OC_Group::createGroup('admin');
OC_Group::addToGroup($username, 'admin'); OC_Group::addToGroup($username, 'admin');

View File

@ -6,7 +6,7 @@ class OC_FakeDirStream{
private $index; private $index;
public function dir_opendir($path,$options) { public function dir_opendir($path,$options) {
$this->name=substr($path,strlen('fakedir://')); $this->name=substr($path, strlen('fakedir://'));
$this->index=0; $this->index=0;
if(!isset(self::$dirs[$this->name])) { if(!isset(self::$dirs[$this->name])) {
self::$dirs[$this->name]=array(); self::$dirs[$this->name]=array();
@ -223,7 +223,7 @@ class OC_CloseStreamWrapper{
private $source; private $source;
private static $open=array(); private static $open=array();
public function stream_open($path, $mode, $options, &$opened_path) { public function stream_open($path, $mode, $options, &$opened_path) {
$path=substr($path,strlen('close://')); $path=substr($path, strlen('close://'));
$this->path=$path; $this->path=$path;
$this->source=fopen($path,$mode); $this->source=fopen($path,$mode);
if(is_resource($this->source)) { if(is_resource($this->source)) {
@ -279,7 +279,7 @@ class OC_CloseStreamWrapper{
} }
public function url_stat($path) { public function url_stat($path) {
$path=substr($path,strlen('close://')); $path=substr($path, strlen('close://'));
if(file_exists($path)) { if(file_exists($path)) {
return stat($path); return stat($path);
}else{ }else{
@ -295,7 +295,7 @@ class OC_CloseStreamWrapper{
} }
public function unlink($path) { public function unlink($path) {
$path=substr($path,strlen('close://')); $path=substr($path, strlen('close://'));
return unlink($path); return unlink($path);
} }
} }

View File

@ -12,7 +12,7 @@ class OC_TemplateLayout extends OC_Template {
if( $renderas == 'user' ) { if( $renderas == 'user' ) {
parent::__construct( 'core', 'layout.user' ); parent::__construct( 'core', 'layout.user' );
if(in_array(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false) { if(in_array(OC_APP::getCurrentApp(), array('settings','admin','help'))!==false) {
$this->assign('bodyid','body-settings', false); $this->assign('bodyid','body-settings', false);
}else{ }else{
$this->assign('bodyid','body-user', false); $this->assign('bodyid','body-user', false);
@ -38,7 +38,7 @@ class OC_TemplateLayout extends OC_Template {
foreach(OC_App::getEnabledApps() as $app) { foreach(OC_App::getEnabledApps() as $app) {
$apps_paths[$app] = OC_App::getAppWebPath($app); $apps_paths[$app] = OC_App::getAppWebPath($app);
} }
$this->assign( 'apps_paths', str_replace('\\/', '/',json_encode($apps_paths)),false ); // Ugly unescape slashes waiting for better solution $this->assign( 'apps_paths', str_replace('\\/', '/',json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution
if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) { if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) {
OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');

View File

@ -29,8 +29,8 @@ class OC_Updater{
* Check if a new version is available * Check if a new version is available
*/ */
public static function check() { public static function check() {
OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
if(OC_Appconfig::getValue('core', 'installedat','')=='') OC_Appconfig::setValue('core', 'installedat',microtime(true)); if(OC_Appconfig::getValue('core', 'installedat','')=='') OC_Appconfig::setValue('core', 'installedat', microtime(true));
$updaterurl='http://apps.owncloud.com/updater.php'; $updaterurl='http://apps.owncloud.com/updater.php';
$version=OC_Util::getVersion(); $version=OC_Util::getVersion();
@ -72,7 +72,7 @@ class OC_Updater{
if(OC_Config::getValue('updatechecker', true)==true) { if(OC_Config::getValue('updatechecker', true)==true) {
$data=OC_Updater::check(); $data=OC_Updater::check();
if(isset($data['version']) and $data['version']<>'') { if(isset($data['version']) and $data['version']<>'') {
$txt='<span style="color:#AA0000; font-weight:bold;">'.$l->t('%s is available. Get <a href="%s">more information</a>',array($data['versionstring'], $data['web'])).'</span>'; $txt='<span style="color:#AA0000; font-weight:bold;">'.$l->t('%s is available. Get <a href="%s">more information</a>', array($data['versionstring'], $data['web'])).'</span>';
}else{ }else{
$txt=$l->t('up to date'); $txt=$l->t('up to date');
} }

View File

@ -120,11 +120,11 @@ class OC_User {
* setup the configured backends in config.php * setup the configured backends in config.php
*/ */
public static function setupBackends() { public static function setupBackends() {
$backends=OC_Config::getValue('user_backends',array()); $backends=OC_Config::getValue('user_backends', array());
foreach($backends as $i=>$config) { foreach($backends as $i=>$config) {
$class=$config['class']; $class=$config['class'];
$arguments=$config['arguments']; $arguments=$config['arguments'];
if(class_exists($class) and array_search($i,self::$_setupedBackends)===false) { if(class_exists($class) and array_search($i, self::$_setupedBackends)===false) {
// make a reflection object // make a reflection object
$reflectionObj = new ReflectionClass($class); $reflectionObj = new ReflectionClass($class);

View File

@ -34,7 +34,7 @@ class OC_Util {
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ); $CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//first set up the local "root" storage //first set up the local "root" storage
if(!self::$rootMounted) { if(!self::$rootMounted) {
OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$CONFIG_DATADIRECTORY),'/'); OC_Filesystem::mount('OC_Filestorage_Local', array('datadir'=>$CONFIG_DATADIRECTORY),'/');
self::$rootMounted=true; self::$rootMounted=true;
} }
@ -456,7 +456,7 @@ class OC_Util {
* @return string * @return string
*/ */
public static function getInstanceId() { public static function getInstanceId() {
$id=OC_Config::getValue('instanceid',null); $id=OC_Config::getValue('instanceid', null);
if(is_null($id)) { if(is_null($id)) {
$id=uniqid(); $id=uniqid();
OC_Config::setValue('instanceid',$id); OC_Config::setValue('instanceid',$id);

View File

@ -222,7 +222,7 @@ class OC_VCategories {
if(!is_array($haystack)) { if(!is_array($haystack)) {
return false; return false;
} }
return array_search(strtolower($needle),array_map('strtolower',$haystack)); return array_search(strtolower($needle), array_map('strtolower',$haystack));
} }
} }