From 1205749f8cec19c30c9f58f7f97832fac9a4c502 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:18:03 +0100 Subject: Checkstyle: Fix the last two SpaceBeforeOpenBrace --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index d16424ce4e1..40b44bf9d6e 100755 --- a/lib/util.php +++ b/lib/util.php @@ -559,7 +559,7 @@ class OC_Util { // creating a test file $testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename; - if(file_exists($testfile)){// already running this test, possible recursive call + if(file_exists($testfile)) {// already running this test, possible recursive call return false; } -- cgit v1.2.3 From 0e70ea9d8baa449ee3c8309f2b6a59ce06a55926 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:28:29 +0100 Subject: Checkstyle: Fix the last 25 NoSpaceAfterComma --- apps/files_encryption/lib/proxy.php | 2 +- apps/files_external/lib/smb.php | 4 ++-- apps/user_ldap/templates/settings.php | 2 +- lib/MDB2/Driver/Reverse/sqlite3.php | 2 +- lib/fileproxy/quota.php | 4 ++-- lib/filestorage/local.php | 8 ++++---- lib/filesystem.php | 4 ++-- lib/installer.php | 8 ++++---- lib/migrate.php | 2 +- lib/migration/content.php | 2 +- lib/ocsclient.php | 6 +++--- lib/template.php | 2 +- lib/user.php | 2 +- settings/users.php | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) (limited to 'lib') diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index cacf7d7920a..4a390013d20 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -92,7 +92,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ }elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb') { if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0) { //first encrypt the target file so we don't end up with a half encrypted file - OCP\Util::writeLog('files_encryption','Decrypting '.$path.' before writing', OCP\Util::DEBUG); + OCP\Util::writeLog('files_encryption', 'Decrypting '.$path.' before writing', OCP\Util::DEBUG); $tmp=fopen('php://temp'); OCP\Files::streamCopy($result, $tmp); fclose($result); diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index d7636894347..802d80d8d1f 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -24,7 +24,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ if(!$this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } - if(substr($this->root,-1, 1)!='/') { + if(substr($this->root, -1, 1)!='/') { $this->root.='/'; } if(!$this->share || $this->share[0]!='/') { @@ -41,7 +41,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ } public function constructUrl($path) { - if(substr($path,-1)=='/') { + if(substr($path, -1)=='/') { $path=substr($path, 0, -1); } return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path; diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 3a653ad7208..d10062c1d9d 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -29,7 +29,7 @@

- t('Help');?> + t('Help');?> diff --git a/lib/MDB2/Driver/Reverse/sqlite3.php b/lib/MDB2/Driver/Reverse/sqlite3.php index 36626478ce8..97037809549 100644 --- a/lib/MDB2/Driver/Reverse/sqlite3.php +++ b/lib/MDB2/Driver/Reverse/sqlite3.php @@ -476,7 +476,7 @@ class MDB2_Driver_Reverse_sqlite3 extends MDB2_Driver_Reverse_Common $definition['unique'] = true; $count = count($column_names); for ($i=0; $i<$count; ++$i) { - $column_name = strtok($column_names[$i]," "); + $column_name = strtok($column_names[$i], " "); $collation = strtok(" "); $definition['fields'][$column_name] = array( 'position' => $i+1 diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 81376fb6fca..46bc8dc16d8 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -38,9 +38,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{ if(in_array($user, $this->userQuota)) { return $this->userQuota[$user]; } - $userQuota=OC_Preferences::getValue($user,'files','quota', 'default'); + $userQuota=OC_Preferences::getValue($user, 'files', 'quota', 'default'); if($userQuota=='default') { - $userQuota=OC_AppConfig::getValue('files','default_quota', 'none'); + $userQuota=OC_AppConfig::getValue('files', 'default_quota', 'none'); } if($userQuota=='none') { $this->userQuota[$user]=0; diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 2dde0093d4b..6fe45acf8c5 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -6,7 +6,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ protected $datadir; public function __construct($arguments) { $this->datadir=$arguments['datadir']; - if(substr($this->datadir,-1)!=='/') { + if(substr($this->datadir, -1)!=='/') { $this->datadir.='/'; } } @@ -20,7 +20,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ return opendir($this->datadir.$path); } public function is_dir($path) { - if(substr($path,-1)=='/') { + if(substr($path, -1)=='/') { $path=substr($path, 0, -1); } return is_dir($this->datadir.$path); @@ -86,11 +86,11 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ } public function rename($path1, $path2) { if (!$this->isUpdatable($path1)) { - OC_Log::write('core','unable to rename, file is not writable : '.$path1, OC_Log::ERROR); + OC_Log::write('core', 'unable to rename, file is not writable : '.$path1, OC_Log::ERROR); return false; } if(! $this->file_exists($path1)) { - OC_Log::write('core','unable to rename, file does not exists : '.$path1, OC_Log::ERROR); + OC_Log::write('core', 'unable to rename, file does not exists : '.$path1, OC_Log::ERROR); return false; } diff --git a/lib/filesystem.php b/lib/filesystem.php index aeafb149395..e4c0e2e1eb5 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -246,7 +246,7 @@ class OC_Filesystem{ } $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php'); - $previousMTime=OC_Appconfig::getValue('files','mountconfigmtime', 0); + $previousMTime=OC_Appconfig::getValue('files', 'mountconfigmtime', 0); if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated OC_FileCache::triggerUpdate(); OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime); @@ -312,7 +312,7 @@ class OC_Filesystem{ return false; } }else{ - OC_Log::write('core','storage backend '.$class.' not found', OC_Log::ERROR); + OC_Log::write('core', 'storage backend '.$class.' not found', OC_Log::ERROR); return false; } } diff --git a/lib/installer.php b/lib/installer.php index 266c07d5c2b..7dc8b0cef8d 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -57,7 +57,7 @@ class OC_Installer{ */ public static function installApp( $data = array()) { if(!isset($data['source'])) { - OC_Log::write('core','No source specified when installing app', OC_Log::ERROR); + OC_Log::write('core', 'No source specified when installing app', OC_Log::ERROR); return false; } @@ -65,13 +65,13 @@ class OC_Installer{ if($data['source']=='http') { $path=OC_Helper::tmpFile(); if(!isset($data['href'])) { - OC_Log::write('core','No href specified when installing app from http', OC_Log::ERROR); + OC_Log::write('core', 'No href specified when installing app from http', OC_Log::ERROR); return false; } copy($data['href'], $path); }else{ if(!isset($data['path'])) { - OC_Log::write('core','No path specified when installing app from local file', OC_Log::ERROR); + OC_Log::write('core', 'No path specified when installing app from local file', OC_Log::ERROR); return false; } $path=$data['path']; @@ -86,7 +86,7 @@ class OC_Installer{ rename($path, $path.'.tgz'); $path.='.tgz'; }else{ - OC_Log::write('core','Archives of type '.$mime.' are not supported', OC_Log::ERROR); + OC_Log::write('core', 'Archives of type '.$mime.' are not supported', OC_Log::ERROR); return false; } diff --git a/lib/migrate.php b/lib/migrate.php index 616417a2271..96f5a0001f7 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -611,7 +611,7 @@ class OC_Migrate{ if( file_exists( $db ) ) { // Connect to the db if(!self::connectDB( $db )) { - OC_Log::write('migration','Failed to connect to migration.db', OC_Log::ERROR); + OC_Log::write('migration', 'Failed to connect to migration.db', OC_Log::ERROR); return false; } } else { diff --git a/lib/migration/content.php b/lib/migration/content.php index 54982b3c847..00df62f0c7f 100644 --- a/lib/migration/content.php +++ b/lib/migration/content.php @@ -205,7 +205,7 @@ class OC_Migration_Content{ } closedir($dirhandle); } else { - OC_Log::write('admin_export',"Was not able to open directory: " . $dir, OC_Log::ERROR); + OC_Log::write('admin_export', "Was not able to open directory: " . $dir, OC_Log::ERROR); return false; } return true; diff --git a/lib/ocsclient.php b/lib/ocsclient.php index ceeb78570fd..b6b5ad8f0a9 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -162,7 +162,7 @@ class OC_OCSClient{ $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { - OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL); + OC_Log::write('core', 'Unable to parse OCS content', OC_Log::FATAL); return null; } $data=simplexml_load_string($xml); @@ -200,7 +200,7 @@ class OC_OCSClient{ $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { - OC_Log::write('core','Unable to parse OCS content', OC_Log::FATAL); + OC_Log::write('core', 'Unable to parse OCS content', OC_Log::FATAL); return null; } $data=simplexml_load_string($xml); @@ -238,7 +238,7 @@ class OC_OCSClient{ $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { - OC_Log::write('core','Unable to parse knowledgebase content', OC_Log::FATAL); + OC_Log::write('core', 'Unable to parse knowledgebase content', OC_Log::FATAL); return null; } $data=simplexml_load_string($xml); diff --git a/lib/template.php b/lib/template.php index efcc6e82c4c..3d3589abd1e 100644 --- a/lib/template.php +++ b/lib/template.php @@ -199,7 +199,7 @@ class OC_Template{ $mode='tablet'; }elseif(stripos($_SERVER['HTTP_USER_AGENT'], 'iphone')>0) { $mode='mobile'; - }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'], 'nokia')>0)) { + }elseif((stripos($_SERVER['HTTP_USER_AGENT'], 'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'], 'nokia')>0)) { $mode='mobile'; }else{ $mode='default'; diff --git a/lib/user.php b/lib/user.php index be0e525d868..801ab7f608d 100644 --- a/lib/user.php +++ b/lib/user.php @@ -133,7 +133,7 @@ class OC_User { self::useBackend($backend); $_setupedBackends[]=$i; }else{ - OC_Log::write('core','User backend '.$class.' not found.', OC_Log::ERROR); + OC_Log::write('core', 'User backend '.$class.' not found.', OC_Log::ERROR); } } } diff --git a/settings/users.php b/settings/users.php index 6eaae474538..395712dbd59 100644 --- a/settings/users.php +++ b/settings/users.php @@ -42,7 +42,7 @@ foreach( $accessiblegroups as $i ) { $groups[] = array( "name" => $i ); } $quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', 'default,none,1 GB, 5 GB, 10 GB'); -$quotaPreset=explode(',',$quotaPreset); +$quotaPreset=explode(',', $quotaPreset); foreach($quotaPreset as &$preset) { $preset=trim($preset); } -- cgit v1.2.3 From bc4382c5c5649c3ad0e9e3be18a747815473f9fe Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:31:44 +0100 Subject: Checkstyle: fix the last NoSpaceAfterEquals --- lib/public/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/public/util.php b/lib/public/util.php index 6ce79715b6f..7b5b1abbded 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -61,7 +61,7 @@ class Util { */ public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc='') { // call the internal mail class - \OC_MAIL::send( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc=''); + \OC_MAIL::send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = ''); } /** -- cgit v1.2.3 From 27ab0357ae00541bbcff52453c2d86e723a992e0 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 18:36:16 +0100 Subject: Checkstyle: Fix last six NewlineBeforeOpenBrace --- lib/MDB2/Driver/sqlite3.php | 3 +-- lib/archive/tar.php | 3 +-- lib/base.php | 6 ++---- settings/ajax/changepassword.php | 3 +-- settings/templates/help.php | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php index bccb8cbbf01..fa4c91c1269 100644 --- a/lib/MDB2/Driver/sqlite3.php +++ b/lib/MDB2/Driver/sqlite3.php @@ -397,8 +397,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common } if ($this->fix_assoc_fields_names || - $this->options['portability'] & MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES) - { + $this->options['portability'] & MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES) { $this->connection->exec("PRAGMA short_column_names = 1"); $this->fix_assoc_fields_names = true; } diff --git a/lib/archive/tar.php b/lib/archive/tar.php index 6c264686991..0fa633c6038 100644 --- a/lib/archive/tar.php +++ b/lib/archive/tar.php @@ -130,8 +130,7 @@ class OC_Archive_TAR extends OC_Archive{ if( $file == $header['filename'] or $file.'/' == $header['filename'] or '/'.$file.'/' == $header['filename'] - or '/'.$file == $header['filename']) - { + or '/'.$file == $header['filename']) { return $header; } } diff --git a/lib/base.php b/lib/base.php index f494716bd87..084cca92e8d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -524,8 +524,7 @@ class OC{ } $file_ext = substr($param['file'], -3); if ($file_ext != 'php' - || !self::loadAppScriptFile($param)) - { + || !self::loadAppScriptFile($param)) { header('HTTP/1.0 404 Not Found'); } } @@ -595,8 +594,7 @@ class OC{ if(!isset($_COOKIE["oc_remember_login"]) || !isset($_COOKIE["oc_token"]) || !isset($_COOKIE["oc_username"]) - || !$_COOKIE["oc_remember_login"]) - { + || !$_COOKIE["oc_remember_login"]) { return false; } OC_App::loadApps(array('authentication')); diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php index a0fe5947b6d..b2db2611518 100644 --- a/settings/ajax/changepassword.php +++ b/settings/ajax/changepassword.php @@ -16,8 +16,7 @@ if(OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) { $userstatus = 'subadmin'; } if(OC_User::getUser() === $username) { - if (OC_User::checkPassword($username, $oldPassword)) - { + if (OC_User::checkPassword($username, $oldPassword)) { $userstatus = 'user'; } else { if (!OC_Util::isUserVerified()) { diff --git a/settings/templates/help.php b/settings/templates/help.php index b2a78ff8512..56d43853444 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -12,8 +12,7 @@ printPage(); } ?> -- cgit v1.2.3 From 1e33ad9cbcd2282db5cb64b933bfe8844d582acf Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 19:11:53 +0100 Subject: Style: Different line endings in one file are bad for sure I think Checkstyle did not find this occurence, however consistant line endings are preferred. @DeepDiver can Checkstyle find this? --- lib/filesystem.php | 84 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'lib') diff --git a/lib/filesystem.php b/lib/filesystem.php index e4c0e2e1eb5..4635f8b4f30 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -209,48 +209,48 @@ class OC_Filesystem{ } static private function loadSystemMountPoints($user) { - if(is_file(OC::$SERVERROOT.'/config/mount.php')) { - $mountConfig=include OC::$SERVERROOT.'/config/mount.php'; - if(isset($mountConfig['global'])) { - foreach($mountConfig['global'] as $mountPoint=>$options) { - self::mount($options['class'], $options['options'], $mountPoint); - } - } - - if(isset($mountConfig['group'])) { - foreach($mountConfig['group'] as $group=>$mounts) { - if(OC_Group::inGroup($user, $group)) { - foreach($mounts as $mountPoint=>$options) { - $mountPoint=self::setUserVars($mountPoint, $user); - foreach($options as &$option) { - $option=self::setUserVars($option, $user); - } - self::mount($options['class'], $options['options'], $mountPoint); - } - } - } - } - - if(isset($mountConfig['user'])) { - foreach($mountConfig['user'] as $user=>$mounts) { - if($user==='all' or strtolower($user)===strtolower($user)) { - foreach($mounts as $mountPoint=>$options) { - $mountPoint=self::setUserVars($mountPoint, $user); - foreach($options as &$option) { - $option=self::setUserVars($option, $user); - } - self::mount($options['class'], $options['options'], $mountPoint); - } - } - } - } - - $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php'); - $previousMTime=OC_Appconfig::getValue('files', 'mountconfigmtime', 0); - if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated - OC_FileCache::triggerUpdate(); - OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime); - } + if(is_file(OC::$SERVERROOT.'/config/mount.php')) { + $mountConfig=include OC::$SERVERROOT.'/config/mount.php'; + if(isset($mountConfig['global'])) { + foreach($mountConfig['global'] as $mountPoint=>$options) { + self::mount($options['class'], $options['options'], $mountPoint); + } + } + + if(isset($mountConfig['group'])) { + foreach($mountConfig['group'] as $group=>$mounts) { + if(OC_Group::inGroup($user, $group)) { + foreach($mounts as $mountPoint=>$options) { + $mountPoint=self::setUserVars($mountPoint, $user); + foreach($options as &$option) { + $option=self::setUserVars($option, $user); + } + self::mount($options['class'], $options['options'], $mountPoint); + } + } + } + } + + if(isset($mountConfig['user'])) { + foreach($mountConfig['user'] as $user=>$mounts) { + if($user==='all' or strtolower($user)===strtolower($user)) { + foreach($mounts as $mountPoint=>$options) { + $mountPoint=self::setUserVars($mountPoint, $user); + foreach($options as &$option) { + $option=self::setUserVars($option, $user); + } + self::mount($options['class'], $options['options'], $mountPoint); + } + } + } + } + + $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php'); + $previousMTime=OC_Appconfig::getValue('files', 'mountconfigmtime', 0); + if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated + OC_FileCache::triggerUpdate(); + OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime); + } } } -- cgit v1.2.3 From a4b2ea586dea5e02a91a873d16a20144db7292a0 Mon Sep 17 00:00:00 2001 From: Felix Moeller Date: Sun, 4 Nov 2012 22:16:04 +0100 Subject: Style: Remove all the dangling white spaces --- apps/files_sharing/public.php | 2 +- lib/backgroundjob.php | 2 +- lib/base.php | 4 ++-- lib/connector/sabre/quotaplugin.php | 16 ++++++++-------- lib/log.php | 2 +- lib/public/backgroundjob.php | 2 +- lib/public/share.php | 2 +- ocs/providers.php | 16 ++++++++-------- ocs/v1.php | 16 ++++++++-------- settings/ajax/createuser.php | 6 +++--- settings/ajax/getlog.php | 2 +- settings/ajax/userlist.php | 10 +++++----- settings/apps.php | 8 ++++---- settings/languageCodes.php | 2 +- settings/templates/help.php | 2 +- settings/templates/users.php | 2 +- settings/users.php | 2 +- tests/lib/share/share.php | 4 ++-- tests/lib/user/backend.php | 4 ++-- tests/lib/util.php | 6 +++--- tests/preseed-config.php | 6 +++--- 21 files changed, 58 insertions(+), 58 deletions(-) (limited to 'lib') diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index dca87cd6876..295273d842b 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -22,7 +22,7 @@ if (isset($_GET['token'])) { // Enf of backward compatibility function getID($path) { - // use the share table from the db to find the item source if the file was reshared because shared files + // use the share table from the db to find the item source if the file was reshared because shared files //are not stored in the file cache. if (substr(OC_Filesystem::getMountPoint($path), -7, 6) == "Shared") { $path_parts = explode('/', $path, 5); diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php index f486519bf09..28b5ce3af20 100644 --- a/lib/backgroundjob.php +++ b/lib/backgroundjob.php @@ -40,7 +40,7 @@ class OC_BackgroundJob{ * @param $type execution type * @return boolean * - * This method sets the execution type of the background jobs. Possible types + * This method sets the execution type of the background jobs. Possible types * are "none", "ajax", "webcron", "cron" */ public static function setExecutionType( $type ) { diff --git a/lib/base.php b/lib/base.php index 084cca92e8d..d4eeac82daa 100644 --- a/lib/base.php +++ b/lib/base.php @@ -619,9 +619,9 @@ class OC{ OC_Util::redirectToDefaultPage(); // doesn't return } - // if you reach this point you have changed your password + // if you reach this point you have changed your password // or you are an attacker - // we can not delete tokens here because users may reach + // we can not delete tokens here because users may reach // this point multiple times after a password change OC_Log::write('core', 'Authentication cookie rejected for user '.$_COOKIE['oc_username'], OC_Log::WARN); } diff --git a/lib/connector/sabre/quotaplugin.php b/lib/connector/sabre/quotaplugin.php index 5b8ef941710..a56a65ad863 100644 --- a/lib/connector/sabre/quotaplugin.php +++ b/lib/connector/sabre/quotaplugin.php @@ -2,7 +2,7 @@ /** * This plugin check user quota and deny creating files when they exceeds the quota. - * + * * @copyright Copyright (C) 2012 entreCables S.L. All rights reserved. * @author Sergio Cambra * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License @@ -10,9 +10,9 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { /** - * Reference to main server object - * - * @var Sabre_DAV_Server + * Reference to main server object + * + * @var Sabre_DAV_Server */ private $server; @@ -23,8 +23,8 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { * addPlugin is called. * * This method should set up the requires event subscriptions. - * - * @param Sabre_DAV_Server $server + * + * @param Sabre_DAV_Server $server * @return void */ public function initialize(Sabre_DAV_Server $server) { @@ -37,10 +37,10 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { /** * This method is called before any HTTP method and forces users to be authenticated - * + * * @param string $method * @throws Sabre_DAV_Exception - * @return bool + * @return bool */ public function checkQuota($uri, $data = null) { $expected = $this->server->httpRequest->getHeader('X-Expected-Entity-Length'); diff --git a/lib/log.php b/lib/log.php index b5e8e1b06a1..e9cededa5c0 100644 --- a/lib/log.php +++ b/lib/log.php @@ -47,7 +47,7 @@ class OC_Log { //ob_end_clean(); self::write('PHP', $error['message'] . ' at ' . $error['file'] . '#' . $error['line'], self::FATAL); } else { - return true; + return true; } } diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index 24a17836f7f..601046fe691 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -62,7 +62,7 @@ class BackgroundJob { * @param $type execution type * @return boolean * - * This method sets the execution type of the background jobs. Possible types + * This method sets the execution type of the background jobs. Possible types * are "none", "ajax", "webcron", "cron" */ public static function setExecutionType( $type ) { diff --git a/lib/public/share.php b/lib/public/share.php index da1c0616390..071304ec249 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -28,7 +28,7 @@ namespace OCP; /** * This class provides the ability for apps to share their content between users. * Apps must create a backend class that implements OCP\Share_Backend and register it with this class. -* +* * It provides the following hooks: * - post_shared */ diff --git a/ocs/providers.php b/ocs/providers.php index 4c68ded914e..bdbfe0c4ee7 100644 --- a/ocs/providers.php +++ b/ocs/providers.php @@ -3,22 +3,22 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2012 Frank Karlitschek frank@owncloud.org -* +* @author Frank Karlitschek +* @copyright 2012 Frank Karlitschek frank@owncloud.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see . * +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see . +* */ require_once '../lib/base.php'; diff --git a/ocs/v1.php b/ocs/v1.php index b12ea5ef18d..3593f1822cf 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -3,22 +3,22 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2012 Frank Karlitschek frank@owncloud.org -* +* @author Frank Karlitschek +* @copyright 2012 Frank Karlitschek frank@owncloud.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see . * +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see . +* */ require_once '../lib/base.php'; diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index c87ff422f61..16b48c8a9ca 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -43,9 +43,9 @@ try { } OC_Group::addToGroup( $username, $i ); } - OC_JSON::success(array("data" => - array( - "username" => $username, + OC_JSON::success(array("data" => + array( + "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username ))))); } catch (Exception $exception) { OC_JSON::error(array("data" => array( "message" => $exception->getMessage()))); diff --git a/settings/ajax/getlog.php b/settings/ajax/getlog.php index 273b02e3822..043124fa175 100644 --- a/settings/ajax/getlog.php +++ b/settings/ajax/getlog.php @@ -12,5 +12,5 @@ $offset=(isset($_GET['offset']))?$_GET['offset']:0; $entries=OC_Log_Owncloud::getEntries($count, $offset); OC_JSON::success(array( - "data" => OC_Util::sanitizeHTML($entries), + "data" => OC_Util::sanitizeHTML($entries), "remain"=>(count(OC_Log_Owncloud::getEntries(1, $offset + $offset)) != 0) ? true : false)); diff --git a/settings/ajax/userlist.php b/settings/ajax/userlist.php index 61b1a388fc3..eaeade60a39 100644 --- a/settings/ajax/userlist.php +++ b/settings/ajax/userlist.php @@ -32,9 +32,9 @@ if (OC_Group::inGroup(OC_User::getUser(), 'admin')) { $batch = OC_User::getUsers('', 10, $offset); foreach ($batch as $user) { $users[] = array( - 'name' => $user, - 'groups' => join(', ', OC_Group::getUserGroups($user)), - 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), + 'name' => $user, + 'groups' => join(', ', OC_Group::getUserGroups($user)), + 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); } } else { @@ -42,8 +42,8 @@ if (OC_Group::inGroup(OC_User::getUser(), 'admin')) { $batch = OC_Group::usersInGroups($groups, '', 10, $offset); foreach ($batch as $user) { $users[] = array( - 'name' => $user, - 'groups' => join(', ', OC_Group::getUserGroups($user)), + 'name' => $user, + 'groups' => join(', ', OC_Group::getUserGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); } } diff --git a/settings/apps.php b/settings/apps.php index 8134b44143a..155291333f3 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -95,11 +95,11 @@ if ( $remoteApps ) { foreach ( $remoteApps AS $key => $remote ) { - if ( + if ( $app['name'] == $remote['name'] - // To set duplicate detection to use OCS ID instead of string name, - // enable this code, remove the line of code above, - // and add [ID] to info.xml of each 3rd party app: + // To set duplicate detection to use OCS ID instead of string name, + // enable this code, remove the line of code above, + // and add [ID] to info.xml of each 3rd party app: // OR $app['ocs_id'] == $remote['ocs_id'] ) { diff --git a/settings/languageCodes.php b/settings/languageCodes.php index 221aa13cf6a..71655800856 100644 --- a/settings/languageCodes.php +++ b/settings/languageCodes.php @@ -3,7 +3,7 @@ * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ - + return array( 'bg_BG'=>'български език', 'ca'=>'Català', diff --git a/settings/templates/help.php b/settings/templates/help.php index 56d43853444..9bb46740f5b 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -1,4 +1,4 @@ -; - + diff --git a/settings/users.php b/settings/users.php index 395712dbd59..93a259f1cd8 100644 --- a/settings/users.php +++ b/settings/users.php @@ -31,7 +31,7 @@ if($isadmin) { foreach($accessibleusers as $i) { $users[] = array( - "name" => $i, + "name" => $i, "groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($i)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/), 'quota'=>OC_Preferences::getValue($i, 'files', 'quota', 'default'), 'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($i))); diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 3cad3a28680..2cb6f7417d2 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -181,7 +181,7 @@ class Test_Share extends UnitTestCase { $this->assertEquals($message, $exception->getMessage()); } - // Owner grants share and update permission + // Owner grants share and update permission OC_User::setUserId($this->user1); $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_SHARE)); @@ -375,7 +375,7 @@ class Test_Share extends UnitTestCase { $this->assertTrue(in_array('test.txt', $to_test)); $this->assertTrue(in_array('test1.txt', $to_test)); - // Valid reshare + // Valid reshare $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE)); OC_User::setUserId($this->user4); $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php index 79653481f90..0b744770ea2 100644 --- a/tests/lib/user/backend.php +++ b/tests/lib/user/backend.php @@ -23,10 +23,10 @@ /** * Abstract class to provide the basis of backend-specific unit test classes. * - * All subclasses MUST assign a backend property in setUp() which implements + * All subclasses MUST assign a backend property in setUp() which implements * user operations (add, remove, etc.). Test methods in this class will then be * run on each separate subclass and backend therein. - * + * * For an example see /tests/lib/user/dummy.php */ diff --git a/tests/lib/util.php b/tests/lib/util.php index a8e5b810265..27635cb8055 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -10,7 +10,7 @@ class Test_Util extends UnitTestCase { // Constructor function Test_Util() { - date_default_timezone_set("UTC"); + date_default_timezone_set("UTC"); } function testFormatDate() { @@ -36,10 +36,10 @@ class Test_Util extends UnitTestCase { $goodString = "This is an harmless string."; $result = OC_Util::sanitizeHTML($goodString); $this->assertEquals("This is an harmless string.", $result); - } + } function testGenerate_random_bytes() { $result = strlen(OC_Util::generate_random_bytes(59)); $this->assertEquals(59, $result); - } + } } \ No newline at end of file diff --git a/tests/preseed-config.php b/tests/preseed-config.php index 7eadccbe769..9791e713dac 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -1,15 +1,15 @@ false, - 'apps_paths' => + 'apps_paths' => array ( - 0 => + 0 => array ( 'path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => false, ), - 1 => + 1 => array ( 'path' => OC::$SERVERROOT.'/apps2', 'url' => '/apps2', -- cgit v1.2.3 From 3d13c9db700522854a2fd6e4af624b921f062c8f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 5 Nov 2012 17:54:23 -0500 Subject: Return empty array if file does not exist inside Shared folder, fixes issue #91 --- lib/files.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/files.php b/lib/files.php index 5a14083c285..3e15c68d885 100644 --- a/lib/files.php +++ b/lib/files.php @@ -45,13 +45,16 @@ class OC_Files { if (($path == '/Shared' || substr($path, 0, 8) == '/Shared/') && OC_App::isEnabled('files_sharing')) { if ($path == '/Shared') { list($info) = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_File::FORMAT_FILE_APP_ROOT); - }else{ - $info['size'] = OC_Filesystem::filesize($path); - $info['mtime'] = OC_Filesystem::filemtime($path); - $info['ctime'] = OC_Filesystem::filectime($path); - $info['mimetype'] = OC_Filesystem::getMimeType($path); - $info['encrypted'] = false; - $info['versioned'] = false; + } else { + $info = array(); + if (OC_Filesystem::file_exists($path)) { + $info['size'] = OC_Filesystem::filesize($path); + $info['mtime'] = OC_Filesystem::filemtime($path); + $info['ctime'] = OC_Filesystem::filectime($path); + $info['mimetype'] = OC_Filesystem::getMimeType($path); + $info['encrypted'] = false; + $info['versioned'] = false; + } } } else { $info = OC_FileCache::get($path); -- cgit v1.2.3 From 012a907a8ac4044f6f9e6472deb8cb401a1b5f60 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 7 Nov 2012 14:05:45 +0100 Subject: fix user specific mount configuration --- lib/filesystem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/filesystem.php b/lib/filesystem.php index 4635f8b4f30..aa03593908d 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -232,8 +232,8 @@ class OC_Filesystem{ } if(isset($mountConfig['user'])) { - foreach($mountConfig['user'] as $user=>$mounts) { - if($user==='all' or strtolower($user)===strtolower($user)) { + foreach($mountConfig['user'] as $mountUser=>$mounts) { + if($user==='all' or strtolower($mountUser)===strtolower($user)) { foreach($mounts as $mountPoint=>$options) { $mountPoint=self::setUserVars($mountPoint, $user); foreach($options as &$option) { -- cgit v1.2.3 From 99aa972a404a76837152109541f0fdf71f8b376d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 7 Nov 2012 14:21:34 +0100 Subject: Allow changing the way etags are generated --- lib/connector/sabre/node.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 5fc106b85ed..9fffa108d2a 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -25,6 +25,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr const GETETAG_PROPERTYNAME = '{DAV:}getetag'; const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified'; + /** + * Allow configuring the method used to generate Etags + * + * @var array(class_name, function_name) + */ + public static $ETagFunction = null; + /** * The path to the current node * @@ -178,7 +185,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * If the array is empty, all properties should be returned * * @param array $properties - * @return void + * @return array */ public function getProperties($properties) { if (is_null($this->property_cache)) { @@ -209,7 +216,12 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @return string|null Returns null if the ETag can not effectively be determined */ static protected function createETag($path) { - return uniqid('', true); + if(self::$ETagFunction) { + $hash = call_user_func(self::$ETagFunction, $path); + return $hash; + }else{ + return uniqid('', true); + } } /** -- cgit v1.2.3 From ba62d8dea73b768afcf41b53d0dd6eb463907dee Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Tue, 6 Nov 2012 18:40:45 +0000 Subject: Fix quoting problem in fs mount. give Big DB error at least in PG --- lib/filecache.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/filecache.php b/lib/filecache.php index 6263e03fc64..4a7dbd0250d 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -502,11 +502,11 @@ class OC_FileCache{ */ 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)); + $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 WHERE `user`=? AND `mimetype`= ? '); + $query->execute(array($user,'httpd/unix-directory')); }else{ - $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 AND `mimetype`="httpd/unix-directory"'); - $query->execute(); + $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 AND `mimetype`= ? '); + $query->execute(array('httpd/unix-directory')); } } } -- cgit v1.2.3 From 311b04f6098674897e78ff0223cacbbfe381d044 Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Wed, 7 Nov 2012 16:53:56 +0100 Subject: backport from approved patch in stable45: make root the default parameter for getAbsolutePath() --- lib/filesystemview.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 936e1feb412..ccaa040fe88 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -47,10 +47,7 @@ class OC_FilesystemView { $this->fakeRoot=$root; } - public function getAbsolutePath($path) { - if(!$path) { - $path='/'; - } + public function getAbsolutePath($path = '/') { if($path[0]!=='/') { $path='/'.$path; } -- cgit v1.2.3