Checkstyle fixes for SpaceBeforeOpenBrace

This commit is contained in:
Felix Moeller 2012-11-04 10:46:32 +01:00
parent 17d466b03b
commit f8d1d7787e
23 changed files with 46 additions and 46 deletions

View File

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

View File

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

View File

@ -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"] ));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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'])) {

View File

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

View File

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

View File

@ -13,7 +13,7 @@ abstract class Test_Cache extends UnitTestCase {
protected $instance;
public function tearDown() {
if($this->instance){
if($this->instance) {
$this->instance->clear();
}
}

View File

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

View File

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

View File

@ -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 = "<script>alert('xss');</script>";
ob_start();
@ -35,7 +35,7 @@ class Test_TemplateFunctions extends UnitTestCase {
$this->assertEqual("&lt;script&gt;alert(&#039;xss&#039;);&lt;/script&gt;", $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 = "<script>alert('xss');</script>";
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);