From f8d1d7787e1112842db81a629dfd84b586fbebda Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 10:46:32 +0100 Subject: [PATCH] Checkstyle fixes for SpaceBeforeOpenBrace --- apps/files/ajax/move.php | 2 +- apps/files/ajax/upload.php | 2 +- apps/files/appinfo/update.php | 2 +- cron.php | 4 ++-- lib/backgroundjob.php | 2 +- lib/filecache.php | 2 +- lib/filecache/update.php | 4 ++-- lib/fileproxy/fileoperations.php | 2 +- lib/fileproxy/quota.php | 2 +- lib/filesystem.php | 4 ++-- lib/filesystemview.php | 14 +++++++------- lib/helper.php | 8 ++++---- lib/log.php | 6 +++--- lib/migrate.php | 2 +- lib/migration/content.php | 2 +- lib/router.php | 2 +- lib/setup.php | 2 +- lib/template.php | 4 ++-- tests/bootstrap.php | 10 +++++----- tests/lib/cache.php | 2 +- tests/lib/cache/apc.php | 4 ++-- tests/lib/cache/xcache.php | 2 +- tests/lib/template.php | 8 ++++---- 23 files changed, 46 insertions(+), 46 deletions(-) diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php index 0541bb16062..5612716b7e4 100644 --- a/apps/files/ajax/move.php +++ b/apps/files/ajax/move.php @@ -12,7 +12,7 @@ $file = stripslashes($_GET["file"]); $target = stripslashes(rawurldecode($_GET["target"])); -if(OC_Filesystem::file_exists($target . '/' . $file)){ +if(OC_Filesystem::file_exists($target . '/' . $file)) { OCP\JSON::error(array("data" => array( "message" => "Could not move $file - File with this name already exists" ))); exit; } diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index dc830570403..7a69154677f 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -38,7 +38,7 @@ $totalSize=0; foreach($files['size'] as $size) { $totalSize+=$size; } -if($totalSize>OC_Filesystem::free_space($dir)){ +if($totalSize>OC_Filesystem::free_space($dir)) { OCP\JSON::error(array("data" => array( "message" => "Not enough space available" ))); exit(); } diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php index bcbbc6035fa..3c63ad3c7ce 100644 --- a/apps/files/appinfo/update.php +++ b/apps/files/appinfo/update.php @@ -5,7 +5,7 @@ $installedVersion=OCP\Config::getAppValue('files', 'installed_version'); if (version_compare($installedVersion, '1.1.6', '<')) { $query = OC_DB::prepare( "SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`" ); $result = $query->execute(); - while( $row = $result->fetchRow()){ + while( $row = $result->fetchRow()) { if ( $row["propertyname"][0] != '{' ) { $query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyname` = ? WHERE `userid` = ? AND `propertypath` = ?' ); $query->execute( array( '{DAV:}' + $row["propertyname"], $row["userid"], $row["propertypath"] )); diff --git a/cron.php b/cron.php index fb76c2de428..cd2e155a494 100644 --- a/cron.php +++ b/cron.php @@ -30,7 +30,7 @@ class my_temporary_cron_class { // We use this function to handle (unexpected) shutdowns function handleUnexpectedShutdown() { // Delete lockfile - if( !my_temporary_cron_class::$keeplock && file_exists( my_temporary_cron_class::$lockfile )){ + if( !my_temporary_cron_class::$keeplock && file_exists( my_temporary_cron_class::$lockfile )) { unlink( my_temporary_cron_class::$lockfile ); } @@ -80,7 +80,7 @@ if( OC::$CLI ) { } // check if backgroundjobs is still running - if( file_exists( my_temporary_cron_class::$lockfile )){ + if( file_exists( my_temporary_cron_class::$lockfile )) { my_temporary_cron_class::$keeplock = true; my_temporary_cron_class::$sent = true; echo "Another instance of cron.php is still running!"; diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php index 6415f5b84aa..f486519bf09 100644 --- a/lib/backgroundjob.php +++ b/lib/backgroundjob.php @@ -44,7 +44,7 @@ class OC_BackgroundJob{ * are "none", "ajax", "webcron", "cron" */ public static function setExecutionType( $type ) { - if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))){ + if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))) { return false; } return OC_Appconfig::setValue( 'core', 'backgroundjobs_mode', $type ); diff --git a/lib/filecache.php b/lib/filecache.php index d5f90d30233..782e742d244 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -500,7 +500,7 @@ class OC_FileCache{ * trigger an update for the cache by setting the mtimes to 0 * @param string $user (optional) */ - public static function triggerUpdate($user=''){ + public static function triggerUpdate($user='') { if($user) { $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 WHERE `user`=? AND `mimetype`="httpd/unix-directory"'); $query->execute(array($user)); diff --git a/lib/filecache/update.php b/lib/filecache/update.php index ecfa8927441..ce395bf6eda 100644 --- a/lib/filecache/update.php +++ b/lib/filecache/update.php @@ -85,7 +85,7 @@ class OC_FileCache_Update{ $file=$path.'/'.$filename; $isDir=$view->is_dir($file); if(self::hasUpdated($file, $root, $isDir)) { - if($isDir){ + if($isDir) { self::updateFolder($file, $root); }elseif($root===false) {//filesystem hooks are only valid for the default root OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$file)); @@ -174,7 +174,7 @@ class OC_FileCache_Update{ }else{ $size=OC_FileCache::scanFile($path, $root); } - if($path !== '' and $path !== '/'){ + if($path !== '' and $path !== '/') { OC_FileCache::increaseSize(dirname($path), $size-$cachedSize, $root); } } diff --git a/lib/fileproxy/fileoperations.php b/lib/fileproxy/fileoperations.php index 23fb63fcfb1..516629adaec 100644 --- a/lib/fileproxy/fileoperations.php +++ b/lib/fileproxy/fileoperations.php @@ -28,7 +28,7 @@ class OC_FileProxy_FileOperations extends OC_FileProxy{ static $rootView; public function premkdir($path) { - if(!self::$rootView){ + if(!self::$rootView) { self::$rootView = new OC_FilesystemView(''); } return !self::$rootView->file_exists($path); diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 54bda5d864e..05b617c8327 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -93,7 +93,7 @@ class OC_FileProxy_Quota extends OC_FileProxy{ } public function preCopy($path1, $path2) { - if(!self::$rootView){ + if(!self::$rootView) { self::$rootView = new OC_FilesystemView(''); } return (self::$rootView->filesize($path1)<$this->getFreeSpace($path2) or $this->getFreeSpace($path2)==0); diff --git a/lib/filesystem.php b/lib/filesystem.php index 852290e62ac..055ba66aae3 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -403,7 +403,7 @@ class OC_Filesystem{ if(strstr($path, '/../') || strrchr($path, '/') === '/..' ) { return false; } - if(self::isFileBlacklisted($path)){ + if(self::isFileBlacklisted($path)) { return false; } return true; @@ -425,7 +425,7 @@ class OC_Filesystem{ } } - static public function isFileBlacklisted($path){ + static public function isFileBlacklisted($path) { $blacklist = array('.htaccess'); $filename = strtolower(basename($path)); return in_array($filename, $blacklist); diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 9a38601acfa..ecbdb63ec54 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -251,7 +251,7 @@ class OC_FilesystemView { return $this->basicOperation('filemtime', $path); } public function touch($path, $mtime=null) { - if(!is_null($mtime) and !is_numeric($mtime)){ + if(!is_null($mtime) and !is_numeric($mtime)) { $mtime = strtotime($mtime); } return $this->basicOperation('touch', $path, array('write'), $mtime); @@ -266,7 +266,7 @@ class OC_FilesystemView { $path = $this->getRelativePath($absolutePath); $exists = $this->file_exists($path); $run = true; - if( $this->fakeRoot==OC_Filesystem::getRoot() ){ + if( $this->fakeRoot==OC_Filesystem::getRoot() ) { if(!$exists) { OC_Hook::emit( OC_Filesystem::CLASSNAME, @@ -294,7 +294,7 @@ class OC_FilesystemView { $count=OC_Helper::streamCopy($data, $target); fclose($target); fclose($data); - if( $this->fakeRoot==OC_Filesystem::getRoot() ){ + if( $this->fakeRoot==OC_Filesystem::getRoot() ) { if(!$exists) { OC_Hook::emit( OC_Filesystem::CLASSNAME, @@ -337,7 +337,7 @@ class OC_FilesystemView { return false; } $run=true; - if( $this->fakeRoot==OC_Filesystem::getRoot() ){ + if( $this->fakeRoot==OC_Filesystem::getRoot() ) { OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename, array( @@ -362,7 +362,7 @@ class OC_FilesystemView { $storage1->unlink($this->getInternalPath($path1.$postFix1)); $result = $count>0; } - if( $this->fakeRoot==OC_Filesystem::getRoot() ){ + if( $this->fakeRoot==OC_Filesystem::getRoot() ) { OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, @@ -389,7 +389,7 @@ class OC_FilesystemView { return false; } $run=true; - if( $this->fakeRoot==OC_Filesystem::getRoot() ){ + if( $this->fakeRoot==OC_Filesystem::getRoot() ) { OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_copy, @@ -433,7 +433,7 @@ class OC_FilesystemView { $target = $this->fopen($path2.$postFix2, 'w'); $result = OC_Helper::streamCopy($source, $target); } - if( $this->fakeRoot==OC_Filesystem::getRoot() ){ + if( $this->fakeRoot==OC_Filesystem::getRoot() ) { OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_copy, diff --git a/lib/helper.php b/lib/helper.php index 27e312eeb2b..ed459dab624 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -475,16 +475,16 @@ class OC_Helper { $dirs = explode(PATH_SEPARATOR, $path); // WARNING : We have to check if open_basedir is enabled : $obd = ini_get('open_basedir'); - if($obd != "none"){ + if($obd != "none") { $obd_values = explode(PATH_SEPARATOR, $obd); - if(count($obd_values) > 0 and $obd_values[0]){ + if(count($obd_values) > 0 and $obd_values[0]) { // open_basedir is in effect ! // We need to check if the program is in one of these dirs : $dirs = $obd_values; } } - foreach($dirs as $dir){ - foreach($exts as $ext){ + foreach($dirs as $dir) { + foreach($exts as $ext) { if($check_fn("$dir/$name".$ext)) return true; } diff --git a/lib/log.php b/lib/log.php index 3fc1e3976a1..b5e8e1b06a1 100644 --- a/lib/log.php +++ b/lib/log.php @@ -41,7 +41,7 @@ class OC_Log { } //Fatal errors handler - public static function onShutdown(){ + public static function onShutdown() { $error = error_get_last(); if($error) { //ob_end_clean(); @@ -52,12 +52,12 @@ class OC_Log { } // Uncaught exception handler - public static function onException($exception){ + public static function onException($exception) { self::write('PHP', $exception->getMessage() . ' at ' . $exception->getFile() . '#' . $exception->getLine(), self::FATAL); } //Recoverable errors handler - public static function onError($number, $message, $file, $line){ + public static function onError($number, $message, $file, $line) { if (error_reporting() === 0) { return; } diff --git a/lib/migrate.php b/lib/migrate.php index 409d77a1a96..e967ae06ecf 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -91,7 +91,7 @@ class OC_Migrate{ if( self::$exporttype == 'user' ) { // Check user exists self::$uid = is_null($uid) ? OC_User::getUser() : $uid; - if(!OC_User::userExists(self::$uid)){ + if(!OC_User::userExists(self::$uid)) { return json_encode( array( 'success' => false) ); } } diff --git a/lib/migration/content.php b/lib/migration/content.php index ca102b03d8f..eec475945a8 100644 --- a/lib/migration/content.php +++ b/lib/migration/content.php @@ -53,7 +53,7 @@ class OC_Migration_Content{ if( !is_null( $this->db ) ) { // Get db path $db = $this->db->getDatabase(); - if(!in_array($db, $this->tmpfiles)){ + if(!in_array($db, $this->tmpfiles)) { $this->tmpfiles[] = $db; } } diff --git a/lib/router.php b/lib/router.php index 7bbc546d757..8cb8fd4f33b 100644 --- a/lib/router.php +++ b/lib/router.php @@ -34,7 +34,7 @@ class OC_Router { public function getRoutingFiles() { if (!isset($this->routing_files)) { $this->routing_files = array(); - foreach(OC_APP::getEnabledApps() as $app){ + foreach(OC_APP::getEnabledApps() as $app) { $file = OC_App::getAppPath($app).'/appinfo/routes.php'; if(file_exists($file)) { $this->routing_files[$app] = $file; diff --git a/lib/setup.php b/lib/setup.php index d0620f814a0..c424ad6fb00 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -70,7 +70,7 @@ class OC_Setup { if(empty($options['dbname'])) { $error[] = "$dbprettyname enter the database name."; } - if(substr_count($options['dbname'], '.') >= 1){ + if(substr_count($options['dbname'], '.') >= 1) { $error[] = "$dbprettyname you may not use dots in the database name"; } if($dbtype != 'oci' && empty($options['dbhost'])) { diff --git a/lib/template.php b/lib/template.php index ed2481afba2..ad25dbcff51 100644 --- a/lib/template.php +++ b/lib/template.php @@ -25,7 +25,7 @@ * Prints an XSS escaped string * @param string $string the string which will be escaped and printed */ -function p($string){ +function p($string) { print(OC_Util::sanitizeHTML($string)); } @@ -33,7 +33,7 @@ function p($string){ * Prints an unescaped string * @param string $string the string which will be printed as it is */ -function print_unescaped($string){ +function print_unescaped($string) { print($string); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index f8364b71ef7..4080a974be7 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,25 +2,25 @@ require_once __DIR__.'/../lib/base.php'; -if(!class_exists('PHPUnit_Framework_TestCase')){ +if(!class_exists('PHPUnit_Framework_TestCase')) { require_once('PHPUnit/Autoload.php'); } //SimpleTest compatibility abstract class UnitTestCase extends PHPUnit_Framework_TestCase{ - function assertEqual($expected, $actual, $string=''){ + function assertEqual($expected, $actual, $string='') { $this->assertEquals($expected, $actual, $string); } - function assertNotEqual($expected, $actual, $string=''){ + function assertNotEqual($expected, $actual, $string='') { $this->assertNotEquals($expected, $actual, $string); } - static function assertTrue($actual, $string=''){ + static function assertTrue($actual, $string='') { parent::assertTrue((bool)$actual, $string); } - static function assertFalse($actual, $string=''){ + static function assertFalse($actual, $string='') { parent::assertFalse((bool)$actual, $string); } } diff --git a/tests/lib/cache.php b/tests/lib/cache.php index 7f3eb3ee6fa..c104460ea4d 100644 --- a/tests/lib/cache.php +++ b/tests/lib/cache.php @@ -13,7 +13,7 @@ abstract class Test_Cache extends UnitTestCase { protected $instance; public function tearDown() { - if($this->instance){ + if($this->instance) { $this->instance->clear(); } } diff --git a/tests/lib/cache/apc.php b/tests/lib/cache/apc.php index f68b97bcbd9..bb5eb483dbf 100644 --- a/tests/lib/cache/apc.php +++ b/tests/lib/cache/apc.php @@ -22,11 +22,11 @@ class Test_Cache_APC extends Test_Cache { public function setUp() { - if(!extension_loaded('apc')){ + if(!extension_loaded('apc')) { $this->markTestSkipped('The apc extension is not available.'); return; } - if(!ini_get('apc.enable_cli') && OC::$CLI){ + if(!ini_get('apc.enable_cli') && OC::$CLI) { $this->markTestSkipped('apc not available in CLI.'); return; } diff --git a/tests/lib/cache/xcache.php b/tests/lib/cache/xcache.php index c081036a31f..43bed2db037 100644 --- a/tests/lib/cache/xcache.php +++ b/tests/lib/cache/xcache.php @@ -22,7 +22,7 @@ class Test_Cache_XCache extends Test_Cache { public function setUp() { - if(!function_exists('xcache_get')){ + if(!function_exists('xcache_get')) { $this->markTestSkipped('The xcache extension is not available.'); return; } diff --git a/tests/lib/template.php b/tests/lib/template.php index dadfdba5e0c..32ae4aca590 100644 --- a/tests/lib/template.php +++ b/tests/lib/template.php @@ -24,7 +24,7 @@ require_once("lib/template.php"); class Test_TemplateFunctions extends UnitTestCase { - public function testP(){ + public function testP() { // FIXME: do we need more testcases? $htmlString = ""; ob_start(); @@ -35,7 +35,7 @@ class Test_TemplateFunctions extends UnitTestCase { $this->assertEqual("<script>alert('xss');</script>", $result); } - public function testPNormalString(){ + public function testPNormalString() { $normalString = "This is a good string!"; ob_start(); p($normalString); @@ -46,7 +46,7 @@ class Test_TemplateFunctions extends UnitTestCase { } - public function testPrintUnescaped(){ + public function testPrintUnescaped() { $htmlString = ""; ob_start(); @@ -57,7 +57,7 @@ class Test_TemplateFunctions extends UnitTestCase { $this->assertEqual($htmlString, $result); } - public function testPrintUnescapedNormalString(){ + public function testPrintUnescapedNormalString() { $normalString = "This is a good string!"; ob_start(); print_unescaped($normalString); -- 2.39.5