Completed
Push — stable10 ( e55881...b0ab3b )
by Joas
36:13 queued 35:48
created
lib/private/Mail/Message.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@
 block discarded – undo
55 55
 
56 56
 		$convertedAddresses = array();
57 57
 
58
-		foreach($addresses as $email => $readableName) {
59
-			if(!is_numeric($email)) {
58
+		foreach ($addresses as $email => $readableName) {
59
+			if (!is_numeric($email)) {
60 60
 				list($name, $domain) = explode('@', $email, 2);
61 61
 				$domain = idn_to_ascii($domain);
62 62
 				$convertedAddresses[$name.'@'.$domain] = $readableName;
Please login to merge, or discard this patch.
lib/private/Mail/Mailer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$mailer = $this->getInstance();
99 99
 
100 100
 		// Enable logger if debug mode is enabled
101
-		if($debugMode) {
101
+		if ($debugMode) {
102 102
 			$mailLogger = new \Swift_Plugins_Loggers_ArrayLogger();
103 103
 			$mailer->registerPlugin(new \Swift_Plugins_LoggerPlugin($mailLogger));
104 104
 		}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		// Debugging logging
109 109
 		$logMessage = sprintf('Sent mail to "%s" with subject "%s"', print_r($message->getTo(), true), $message->getSubject());
110 110
 		$this->logger->debug($logMessage, ['app' => 'core']);
111
-		if($debugMode && isset($mailLogger)) {
111
+		if ($debugMode && isset($mailLogger)) {
112 112
 			$this->logger->debug($mailLogger->dump(), ['app' => 'core']);
113 113
 		}
114 114
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				break;
210 210
 		}
211 211
 
212
-		return \Swift_SendmailTransport::newInstance($binaryPath . ' -bs');
212
+		return \Swift_SendmailTransport::newInstance($binaryPath.' -bs');
213 213
 	}
214 214
 
215 215
 	/**
Please login to merge, or discard this patch.
lib/private/NavigationManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 		}
83 83
 
84 84
 		$entry['active'] = false;
85
-		if(!isset($entry['icon'])) {
85
+		if (!isset($entry['icon'])) {
86 86
 			$entry['icon'] = '';
87 87
 		}
88 88
 		$this->entries[] = $entry;
Please login to merge, or discard this patch.
lib/private/Share/Helper.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 			$params = array();
94 94
 			if (count($ids) == 1 && isset($uidOwner)) {
95 95
 				// FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach
96
-				$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
97
-					'`item_target`, `file_target`, `parent` ' .
98
-					'FROM `*PREFIX*share` ' .
96
+				$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '.
97
+					'`item_target`, `file_target`, `parent` '.
98
+					'FROM `*PREFIX*share` '.
99 99
 					'WHERE `parent` IN ('.$parents.') AND `uid_owner` = ? ';
100 100
 				$params[] = $uidOwner;
101 101
 			} else {
102
-				$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
103
-					'`item_target`, `file_target`, `parent`, `uid_owner` ' .
102
+				$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '.
103
+					'`item_target`, `file_target`, `parent`, `uid_owner` '.
104 104
 					'FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') ';
105 105
 			}
106 106
 			if ($excludeGroupChildren) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 					'shareWith' => $item['share_with'],
118 118
 					'itemTarget' => $item['item_target'],
119 119
 					'itemType' => $item['item_type'],
120
-					'shareType' => (int)$item['share_type'],
120
+					'shareType' => (int) $item['share_type'],
121 121
 				);
122 122
 				if (isset($item['file_target'])) {
123 123
 					$tmpItem['fileTarget'] = $item['file_target'];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		if ($defaultExpireDate === 'yes') {
169 169
 			$enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no');
170 170
 			$defaultExpireSettings['defaultExpireDateSet'] = true;
171
-			$defaultExpireSettings['expireAfterDays'] = (int)($config->getAppValue('core', 'shareapi_expire_after_n_days', '7'));
171
+			$defaultExpireSettings['expireAfterDays'] = (int) ($config->getAppValue('core', 'shareapi_expire_after_n_days', '7'));
172 172
 			$defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes' ? true : false;
173 173
 		}
174 174
 
Please login to merge, or discard this patch.
lib/private/Share/SearchResultSorter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	 * Callback function for usort. http://php.net/usort
52 52
 	 */
53 53
 	public function sort($a, $b) {
54
-		if(!isset($a[$this->key]) || !isset($b[$this->key])) {
55
-			if(!is_null($this->log)) {
56
-				$this->log->error('Sharing dialogue: cannot sort due to ' .
54
+		if (!isset($a[$this->key]) || !isset($b[$this->key])) {
55
+			if (!is_null($this->log)) {
56
+				$this->log->error('Sharing dialogue: cannot sort due to '.
57 57
 								  'missing array key', array('app' => 'core'));
58 58
 			}
59 59
 			return 0;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		$i = mb_strpos($nameA, $this->search, 0, $this->encoding);
64 64
 		$j = mb_strpos($nameB, $this->search, 0, $this->encoding);
65 65
 
66
-		if($i === $j || $i > 0 && $j > 0) {
66
+		if ($i === $j || $i > 0 && $j > 0) {
67 67
 			return strcmp(mb_strtolower($nameA, $this->encoding),
68 68
 						  mb_strtolower($nameB, $this->encoding));
69 69
 		} elseif ($i === 0) {
Please login to merge, or discard this patch.
lib/private/Share/Share.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 					'collectionOf' => $collectionOf,
92 92
 					'supportedFileExtensions' => $supportedFileExtensions
93 93
 				);
94
-				if(count(self::$backendTypes) === 1) {
94
+				if (count(self::$backendTypes) === 1) {
95 95
 					\OC_Util::addScript('core', 'shareconfigmodel');
96 96
 					\OC_Util::addScript('core', 'shareitemmodel');
97 97
 					\OC_Util::addScript('core', 'sharedialogresharerinfoview');
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
 		$source = -1;
171 171
 		$cache = $mountPath = false;
172 172
 
173
-		$view = new \OC\Files\View('/' . $ownerUser . '/files');
173
+		$view = new \OC\Files\View('/'.$ownerUser.'/files');
174 174
 		$meta = $view->getFileInfo($path);
175 175
 		if ($meta) {
176
-			$path = substr($meta->getPath(), strlen('/' . $ownerUser . '/files'));
176
+			$path = substr($meta->getPath(), strlen('/'.$ownerUser.'/files'));
177 177
 		} else {
178 178
 			// if the file doesn't exists yet we start with the parent folder
179 179
 			$meta = $view->getFileInfo(dirname($path));
180 180
 		}
181 181
 
182
-		if($meta !== false) {
182
+		if ($meta !== false) {
183 183
 			$source = $meta['fileid'];
184 184
 			$cache = new \OC\Files\Cache\Cache($meta['storage']);
185 185
 
186 186
 			$mountPath = $meta->getMountPoint()->getMountPoint();
187 187
 			if ($mountPath !== false) {
188
-				$mountPath = substr($mountPath, strlen('/' . $ownerUser . '/files'));
188
+				$mountPath = substr($mountPath, strlen('/'.$ownerUser.'/files'));
189 189
 			}
190 190
 		}
191 191
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 			}
293 293
 
294 294
 			// let's get the parent for the next round
295
-			$meta = $cache->get((int)$source);
295
+			$meta = $cache->get((int) $source);
296 296
 			if ($recursive === true && $meta !== false) {
297 297
 				$paths[$source] = $meta['path'];
298
-				$source = (int)$meta['parent'];
298
+				$source = (int) $meta['parent'];
299 299
 			} else {
300 300
 				$source = -1;
301 301
 			}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 				$query = \OC_DB::prepare(
315 315
 					'SELECT `fileid`, `path`
316 316
 					FROM `*PREFIX*filecache`
317
-					WHERE `fileid` IN (' . implode(',', $fileTargetIDs) . ')'
317
+					WHERE `fileid` IN (' . implode(',', $fileTargetIDs).')'
318 318
 				);
319 319
 				$result = $query->execute();
320 320
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 								$sharePaths[$uid] = $sharedPath;
330 330
 							} else {
331 331
 								$sharedPath = $shareData['file_target'];
332
-								$sharedPath .= substr($path, strlen($row['path']) -5);
332
+								$sharedPath .= substr($path, strlen($row['path']) - 5);
333 333
 								$sharePaths[$uid] = $sharedPath;
334 334
 							}
335 335
 						}
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 		$select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent);
423 423
 
424
-		$where .= ' `' . $column . '` = ? AND `item_type` = ? ';
424
+		$where .= ' `'.$column.'` = ? AND `item_type` = ? ';
425 425
 		$arguments = array($itemSource, $itemType);
426 426
 		// for link shares $user === null
427 427
 		if ($user !== null) {
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 			$arguments[] = $owner;
440 440
 		}
441 441
 
442
-		$query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where);
442
+		$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where);
443 443
 
444 444
 		$result = \OC_DB::executeAudited($query, $arguments);
445 445
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) {
448 448
 				continue;
449 449
 			}
450
-			if ($fileDependent && (int)$row['file_parent'] === -1) {
450
+			if ($fileDependent && (int) $row['file_parent'] === -1) {
451 451
 				// if it is a mount point we need to get the path from the mount manager
452 452
 				$mountManager = \OC\Files\Filesystem::getMountManager();
453 453
 				$mountPoint = $mountManager->findByStorageId($row['storage_id']);
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 					$row['path'] = $path;
459 459
 				} else {
460 460
 					\OC::$server->getLogger()->warning(
461
-						'Could not resolve mount point for ' . $row['storage_id'],
461
+						'Could not resolve mount point for '.$row['storage_id'],
462 462
 						['app' => 'OCP\Share']
463 463
 					);
464 464
 				}
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 
469 469
 		//if didn't found a result than let's look for a group share.
470
-		if(empty($shares) && $user !== null) {
470
+		if (empty($shares) && $user !== null) {
471 471
 			$groups = \OC_Group::getUserGroups($user);
472 472
 
473 473
 			if (!empty($groups)) {
474
-				$where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
474
+				$where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)';
475 475
 				$arguments = array($itemSource, $itemType, $groups);
476 476
 				$types = array(null, null, IQueryBuilder::PARAM_STR_ARRAY);
477 477
 
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 				// class isn't static anymore...
486 486
 				$conn = \OC::$server->getDatabaseConnection();
487 487
 				$result = $conn->executeQuery(
488
-					'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where,
488
+					'SELECT '.$select.' FROM `*PREFIX*share` '.$where,
489 489
 					$arguments,
490 490
 					$types
491 491
 				);
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 		$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
540 540
 		$result = $query->execute(array($token));
541 541
 		if ($result === false) {
542
-			\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
542
+			\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage().', token='.$token, \OCP\Util::ERROR);
543 543
 		}
544 544
 		$row = $result->fetchRow();
545 545
 		if ($row === false) {
@@ -625,9 +625,9 @@  discard block
 block discarded – undo
625 625
 		$items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections, false, $checkExpireDate);
626 626
 		if ($items) {
627 627
 			foreach ($items as $item) {
628
-				if ((int)$item['share_type'] === self::SHARE_TYPE_USER) {
628
+				if ((int) $item['share_type'] === self::SHARE_TYPE_USER) {
629 629
 					$users[] = $item['share_with'];
630
-				} else if ((int)$item['share_type'] === self::SHARE_TYPE_GROUP) {
630
+				} else if ((int) $item['share_type'] === self::SHARE_TYPE_GROUP) {
631 631
 					$users = array_merge($users, \OC_Group::usersInGroup($item['share_with']));
632 632
 				}
633 633
 			}
@@ -692,12 +692,12 @@  discard block
 block discarded – undo
692 692
 
693 693
 		//verify that we don't share a folder which already contains a share mount point
694 694
 		if ($itemType === 'folder') {
695
-			$path = '/' . $uidOwner . '/files' . \OC\Files\Filesystem::getPath($itemSource) . '/';
695
+			$path = '/'.$uidOwner.'/files'.\OC\Files\Filesystem::getPath($itemSource).'/';
696 696
 			$mountManager = \OC\Files\Filesystem::getMountManager();
697 697
 			$mounts = $mountManager->findIn($path);
698 698
 			foreach ($mounts as $mount) {
699 699
 				if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
700
-					$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
700
+					$message = 'Sharing "'.$itemSourceName.'" failed, because it contains files shared with you!';
701 701
 					\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
702 702
 					throw new \Exception($message);
703 703
 				}
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
 		// single file shares should never have delete permissions
709 709
 		if ($itemType === 'file') {
710
-			$permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE;
710
+			$permissions = (int) $permissions & ~\OCP\Constants::PERMISSION_DELETE;
711 711
 		}
712 712
 
713 713
 		//Validate expirationDate
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 					} else {
835 835
 						// reuse the already set password, but only if we change permissions
836 836
 						// otherwise the user disabled the password protection
837
-						if ($checkExists && (int)$permissions !== (int)$oldPermissions) {
837
+						if ($checkExists && (int) $permissions !== (int) $oldPermissions) {
838 838
 							$shareWith = $checkExists['share_with'];
839 839
 						}
840 840
 					}
@@ -907,10 +907,10 @@  discard block
 block discarded – undo
907 907
 				throw new \Exception($message_t);
908 908
 			}
909 909
 
910
-			$token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER .
910
+			$token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER.
911 911
 				\OCP\Security\ISecureRandom::CHAR_DIGITS);
912 912
 
913
-			$shareWith = $user . '@' . $remote;
913
+			$shareWith = $user.'@'.$remote;
914 914
 			$shareId = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, $token, $itemSourceName);
915 915
 
916 916
 			$send = false;
@@ -961,12 +961,12 @@  discard block
 block discarded – undo
961 961
 		$currentUser = $owner ? $owner : \OC_User::getUser();
962 962
 		foreach ($items as $item) {
963 963
 			// delete the item with the expected share_type and owner
964
-			if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) {
964
+			if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) {
965 965
 				$toDelete = $item;
966 966
 				// if there is more then one result we don't have to delete the children
967 967
 				// but update their parent. For group shares the new parent should always be
968 968
 				// the original group share and not the db entry with the unique name
969
-			} else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) {
969
+			} else if ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) {
970 970
 				$newParent = $item['parent'];
971 971
 			} else {
972 972
 				$newParent = $item['id'];
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 	 */
989 989
 	public static function unshareAll($itemType, $itemSource) {
990 990
 		// Get all of the owners of shares of this item.
991
-		$query = \OC_DB::prepare( 'SELECT `uid_owner` from `*PREFIX*share` WHERE `item_type`=? AND `item_source`=?' );
991
+		$query = \OC_DB::prepare('SELECT `uid_owner` from `*PREFIX*share` WHERE `item_type`=? AND `item_source`=?');
992 992
 		$result = $query->execute(array($itemType, $itemSource));
993 993
 		$shares = array();
994 994
 		// Add each owner's shares to the array of all shares for this item.
@@ -1026,9 +1026,9 @@  discard block
 block discarded – undo
1026 1026
 		$uid = \OCP\User::getUser();
1027 1027
 
1028 1028
 		if ($itemType === 'file' || $itemType === 'folder') {
1029
-			$statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_' . $originType . '` = ?';
1029
+			$statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_'.$originType.'` = ?';
1030 1030
 		} else {
1031
-			$statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `item_' . $originType . '` = ?';
1031
+			$statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `item_'.$originType.'` = ?';
1032 1032
 		}
1033 1033
 
1034 1034
 		$query = \OCP\DB::prepare($statement);
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
 		$itemUnshared = false;
1042 1042
 		foreach ($shares as $share) {
1043
-			if ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_USER &&
1043
+			if ((int) $share['share_type'] === \OCP\Share::SHARE_TYPE_USER &&
1044 1044
 				$share['share_with'] === $uid) {
1045 1045
 				$deletedShares = Helper::delete($share['id']);
1046 1046
 				$shareTmp = array(
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 					'shareWith' => $share['share_with'],
1049 1049
 					'itemTarget' => $share['item_target'],
1050 1050
 					'itemType' => $share['item_type'],
1051
-					'shareType' => (int)$share['share_type'],
1051
+					'shareType' => (int) $share['share_type'],
1052 1052
 				);
1053 1053
 				if (isset($share['file_target'])) {
1054 1054
 					$shareTmp['fileTarget'] = $share['file_target'];
@@ -1056,11 +1056,11 @@  discard block
 block discarded – undo
1056 1056
 				$listOfUnsharedItems = array_merge($listOfUnsharedItems, $deletedShares, array($shareTmp));
1057 1057
 				$itemUnshared = true;
1058 1058
 				break;
1059
-			} elseif ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
1059
+			} elseif ((int) $share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
1060 1060
 				if (\OC_Group::inGroup($uid, $share['share_with'])) {
1061 1061
 					$groupShare = $share;
1062 1062
 				}
1063
-			} elseif ((int)$share['share_type'] === self::$shareTypeGroupUserUnique &&
1063
+			} elseif ((int) $share['share_type'] === self::$shareTypeGroupUserUnique &&
1064 1064
 				$share['share_with'] === $uid) {
1065 1065
 				$uniqueGroupShare = $share;
1066 1066
 			}
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 				'shareWith' => $groupShare['share_with'],
1081 1081
 				'itemTarget' => $groupShare['item_target'],
1082 1082
 				'itemType' => $groupShare['item_type'],
1083
-				'shareType' => (int)$groupShare['share_type'],
1083
+				'shareType' => (int) $groupShare['share_type'],
1084 1084
 			);
1085 1085
 			if (isset($groupShare['file_target'])) {
1086 1086
 				$shareTmp['fileTarget'] = $groupShare['file_target'];
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 				'shareWith' => $uniqueGroupShare['share_with'],
1096 1096
 				'itemTarget' => $uniqueGroupShare['item_target'],
1097 1097
 				'itemType' => $uniqueGroupShare['item_type'],
1098
-				'shareType' => (int)$uniqueGroupShare['share_type'],
1098
+				'shareType' => (int) $uniqueGroupShare['share_type'],
1099 1099
 			);
1100 1100
 			if (isset($uniqueGroupShare['file_target'])) {
1101 1101
 				$shareTmp['fileTarget'] = $uniqueGroupShare['file_target'];
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 		$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient));
1132 1132
 
1133
-		if($result === false) {
1133
+		if ($result === false) {
1134 1134
 			\OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', \OCP\Util::ERROR);
1135 1135
 		}
1136 1136
 	}
@@ -1151,12 +1151,12 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
 		$intArrayToLiteralArray = function($intArray, $eb) {
1153 1153
 			return array_map(function($int) use ($eb) {
1154
-				return $eb->literal((int)$int, 'integer');
1154
+				return $eb->literal((int) $int, 'integer');
1155 1155
 			}, $intArray);
1156 1156
 		};
1157 1157
 		$sanitizeItem = function($item) {
1158
-			$item['id'] = (int)$item['id'];
1159
-			$item['premissions'] = (int)$item['permissions'];
1158
+			$item['id'] = (int) $item['id'];
1159
+			$item['premissions'] = (int) $item['permissions'];
1160 1160
 			return $item;
1161 1161
 		};
1162 1162
 
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 
1175 1175
 				$result = $dbresult->fetch();
1176 1176
 				$dbresult->closeCursor();
1177
-				if (~(int)$result['permissions'] & $permissions) {
1177
+				if (~(int) $result['permissions'] & $permissions) {
1178 1178
 					$message = 'Setting permissions for %s failed,'
1179 1179
 						.' because the permissions exceed permissions granted to %s';
1180 1180
 					$message_t = $l->t('Setting permissions for %s failed, because the permissions exceed permissions granted to %s', array($itemSource, \OC_User::getUser()));
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 			$items = [];
1208 1208
 
1209 1209
 			// Check if permissions were removed
1210
-			if ((int)$rootItem['permissions'] & ~$permissions) {
1210
+			if ((int) $rootItem['permissions'] & ~$permissions) {
1211 1211
 				// If share permission is removed all reshares must be deleted
1212 1212
 				if (($rootItem['permissions'] & \OCP\Constants::PERMISSION_SHARE) && (~$permissions & \OCP\Constants::PERMISSION_SHARE)) {
1213 1213
 					// delete all shares, keep parent and group children
@@ -1260,14 +1260,14 @@  discard block
 block discarded – undo
1260 1260
 			 * Permissions were added
1261 1261
 			 * Update all USERGROUP shares. (So group shares where the user moved their mountpoint).
1262 1262
 			 */
1263
-			if ($permissions & ~(int)$rootItem['permissions']) {
1263
+			if ($permissions & ~(int) $rootItem['permissions']) {
1264 1264
 				$qb = $connection->getQueryBuilder();
1265 1265
 				$qb->select('id', 'permissions', 'item_type')
1266 1266
 					->from('share')
1267 1267
 					->where($qb->expr()->eq('parent', $qb->createParameter('parent')))
1268 1268
 					->andWhere($qb->expr()->eq('share_type', $qb->createParameter('share_type')))
1269 1269
 					->andWhere($qb->expr()->neq('permissions', $qb->createParameter('shareDeleted')))
1270
-					->setParameter(':parent', (int)$rootItem['id'])
1270
+					->setParameter(':parent', (int) $rootItem['id'])
1271 1271
 					->setParameter(':share_type', 2)
1272 1272
 					->setParameter(':shareDeleted', 0);
1273 1273
 				$result = $qb->execute();
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 		if ($defaultExpireDateEnforced && $shareTime === null) {
1328 1328
 			$items = self::getItemShared($itemType, $itemSource);
1329 1329
 			$firstItem = reset($items);
1330
-			$shareTime = (int)$firstItem['stime'];
1330
+			$shareTime = (int) $firstItem['stime'];
1331 1331
 		}
1332 1332
 
1333 1333
 		if ($defaultExpireDateEnforced) {
@@ -1335,9 +1335,9 @@  discard block
 block discarded – undo
1335 1335
 			$maxDate = new \DateTime();
1336 1336
 			$maxDate->setTimestamp($shareTime);
1337 1337
 			$maxDays = \OCP\Config::getAppValue('core', 'shareapi_expire_after_n_days', '7');
1338
-			$maxDate->add(new \DateInterval('P' . $maxDays . 'D'));
1338
+			$maxDate->add(new \DateInterval('P'.$maxDays.'D'));
1339 1339
 			if ($date > $maxDate) {
1340
-				$warning = 'Cannot set expiration date. Shares cannot expire later than ' . $maxDays . ' after they have been shared';
1340
+				$warning = 'Cannot set expiration date. Shares cannot expire later than '.$maxDays.' after they have been shared';
1341 1341
 				$warning_t = $l->t('Cannot set expiration date. Shares cannot expire later than %s after they have been shared', array($maxDays));
1342 1342
 				\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
1343 1343
 				throw new \Exception($warning_t);
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
 	 */
1518 1518
 	protected static function unshareItem(array $item, $newParent = null) {
1519 1519
 
1520
-		$shareType = (int)$item['share_type'];
1520
+		$shareType = (int) $item['share_type'];
1521 1521
 		$shareWith = null;
1522 1522
 		if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) {
1523 1523
 			$shareWith = $item['share_with'];
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 			'itemParent'    => $item['parent'],
1534 1534
 			'uidOwner'      => $item['uid_owner'],
1535 1535
 		);
1536
-		if($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
1536
+		if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
1537 1537
 			$hookParams['fileSource'] = $item['file_source'];
1538 1538
 			$hookParams['fileTarget'] = $item['file_target'];
1539 1539
 		}
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 		$deletedShares[] = $hookParams;
1544 1544
 		$hookParams['deletedShares'] = $deletedShares;
1545 1545
 		\OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
1546
-		if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
1546
+		if ((int) $item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
1547 1547
 			list(, $remote) = Helper::splitUserRemote($item['share_with']);
1548 1548
 			self::sendRemoteUnshare($remote, $item['id'], $item['token']);
1549 1549
 		}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		// Get filesystem root to add it to the file target and remove from the
1705 1705
 		// file source, match file_source with the file cache
1706 1706
 		if ($itemType == 'file' || $itemType == 'folder') {
1707
-			if(!is_null($uidOwner)) {
1707
+			if (!is_null($uidOwner)) {
1708 1708
 				$root = \OC\Files\Filesystem::getRoot();
1709 1709
 			} else {
1710 1710
 				$root = '';
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 		$result = $query->execute($queryArgs);
1845 1845
 		if ($result === false) {
1846 1846
 			\OCP\Util::writeLog('OCP\Share',
1847
-				\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
1847
+				\OC_DB::getErrorMessage().', select='.$select.' where=',
1848 1848
 				\OCP\Util::ERROR);
1849 1849
 		}
1850 1850
 		$items = array();
@@ -1886,14 +1886,14 @@  discard block
 block discarded – undo
1886 1886
 						}
1887 1887
 						// Switch ids if sharing permission is granted on only
1888 1888
 						// one share to ensure correct parent is used if resharing
1889
-						if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
1890
-							&& (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1889
+						if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
1890
+							&& (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1891 1891
 							$items[$row['id']] = $items[$id];
1892 1892
 							$switchedItems[$id] = $row['id'];
1893 1893
 							unset($items[$id]);
1894 1894
 							$id = $row['id'];
1895 1895
 						}
1896
-						$items[$id]['permissions'] |= (int)$row['permissions'];
1896
+						$items[$id]['permissions'] |= (int) $row['permissions'];
1897 1897
 
1898 1898
 					}
1899 1899
 					continue;
@@ -1907,8 +1907,8 @@  discard block
 block discarded – undo
1907 1907
 					$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
1908 1908
 					$parentResult = $query->execute(array($row['parent']));
1909 1909
 					if ($result === false) {
1910
-						\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
1911
-							\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
1910
+						\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '.
1911
+							\OC_DB::getErrorMessage().', select='.$select.' where='.$where,
1912 1912
 							\OCP\Util::ERROR);
1913 1913
 					} else {
1914 1914
 						$parentRow = $parentResult->fetchRow();
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 						$subPath = substr($row['path'], $pos);
1919 1919
 						$splitPath = explode('/', $subPath);
1920 1920
 						foreach (array_slice($splitPath, 2) as $pathPart) {
1921
-							$tmpPath = $tmpPath . '/' . $pathPart;
1921
+							$tmpPath = $tmpPath.'/'.$pathPart;
1922 1922
 						}
1923 1923
 						$row['path'] = $tmpPath;
1924 1924
 					}
@@ -1937,7 +1937,7 @@  discard block
 block discarded – undo
1937 1937
 				}
1938 1938
 			}
1939 1939
 
1940
-			if($checkExpireDate) {
1940
+			if ($checkExpireDate) {
1941 1941
 				if (self::expireItem($row)) {
1942 1942
 					continue;
1943 1943
 				}
@@ -1948,10 +1948,10 @@  discard block
 block discarded – undo
1948 1948
 			}
1949 1949
 			// Add display names to result
1950 1950
 			$row['share_with_displayname'] = $row['share_with'];
1951
-			if ( isset($row['share_with']) && $row['share_with'] != '' &&
1951
+			if (isset($row['share_with']) && $row['share_with'] != '' &&
1952 1952
 				$row['share_type'] === self::SHARE_TYPE_USER) {
1953 1953
 				$row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']);
1954
-			} else if(isset($row['share_with']) && $row['share_with'] != '' &&
1954
+			} else if (isset($row['share_with']) && $row['share_with'] != '' &&
1955 1955
 				$row['share_type'] === self::SHARE_TYPE_REMOTE) {
1956 1956
 				$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']);
1957 1957
 				foreach ($addressBookEntries as $entry) {
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
 					}
1963 1963
 				}
1964 1964
 			}
1965
-			if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
1965
+			if (isset($row['uid_owner']) && $row['uid_owner'] != '') {
1966 1966
 				$row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
1967 1967
 			}
1968 1968
 
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 				// for file/folder shares we need to compare file_source, otherwise we compare item_source
2111 2111
 				// only group shares if they already point to the same target, otherwise the file where shared
2112 2112
 				// before grouping of shares was added. In this case we don't group them toi avoid confusions
2113
-				if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
2113
+				if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
2114 2114
 					(!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) {
2115 2115
 					// add the first item to the list of grouped shares
2116 2116
 					if (!isset($result[$key]['grouped'])) {
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 		$groupItemTarget = $itemTarget = $fileSource = $parent = 0;
2157 2157
 
2158 2158
 		$result = self::checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate);
2159
-		if(!empty($result)) {
2159
+		if (!empty($result)) {
2160 2160
 			$parent = $result['parent'];
2161 2161
 			$itemSource = $result['itemSource'];
2162 2162
 			$fileSource = $result['fileSource'];
@@ -2240,11 +2240,11 @@  discard block
 block discarded – undo
2240 2240
 				$itemTarget = $sourceExists['item_target'];
2241 2241
 
2242 2242
 				// for group shares we don't need a additional entry if the target is the same
2243
-				if($isGroupShare && $groupItemTarget === $itemTarget) {
2243
+				if ($isGroupShare && $groupItemTarget === $itemTarget) {
2244 2244
 					continue;
2245 2245
 				}
2246 2246
 
2247
-			} elseif(!$sourceExists && !$isGroupShare)  {
2247
+			} elseif (!$sourceExists && !$isGroupShare) {
2248 2248
 
2249 2249
 				$itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user,
2250 2250
 					$uidOwner, $suggestedItemTarget, $parent);
@@ -2375,8 +2375,8 @@  discard block
 block discarded – undo
2375 2375
 
2376 2376
 		if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) {
2377 2377
 			// Check if share permissions is granted
2378
-			if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
2379
-				if (~(int)$checkReshare['permissions'] & $permissions) {
2378
+			if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
2379
+				if (~(int) $checkReshare['permissions'] & $permissions) {
2380 2380
 					$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
2381 2381
 					$message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
2382 2382
 
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
 
2389 2389
 					$result['expirationDate'] = $expirationDate;
2390 2390
 					// $checkReshare['expiration'] could be null and then is always less than any value
2391
-					if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
2391
+					if (isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
2392 2392
 						$result['expirationDate'] = $checkReshare['expiration'];
2393 2393
 					}
2394 2394
 
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
 
2481 2481
 		$id = false;
2482 2482
 		if ($result) {
2483
-			$id =  \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
2483
+			$id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
2484 2484
 		}
2485 2485
 
2486 2486
 		return $id;
@@ -2520,8 +2520,8 @@  discard block
 block discarded – undo
2520 2520
 			return true;
2521 2521
 		}
2522 2522
 
2523
-		if ( \OC::$server->getSession()->exists('public_link_authenticated')
2524
-			&& \OC::$server->getSession()->get('public_link_authenticated') === (string)$linkItem['id'] ) {
2523
+		if (\OC::$server->getSession()->exists('public_link_authenticated')
2524
+			&& \OC::$server->getSession()->get('public_link_authenticated') === (string) $linkItem['id']) {
2525 2525
 			return true;
2526 2526
 		}
2527 2527
 
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 	 * @param array $parameters additional format parameters
2624 2624
 	 * @return array format result
2625 2625
 	 */
2626
-	private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) {
2626
+	private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) {
2627 2627
 		if ($format === self::FORMAT_NONE) {
2628 2628
 			return $items;
2629 2629
 		} else if ($format === self::FORMAT_STATUSES) {
@@ -2683,8 +2683,8 @@  discard block
 block discarded – undo
2683 2683
 			\OC::$server->getHTTPClientService()
2684 2684
 		);
2685 2685
 		while ($result['success'] === false && $try < 2) {
2686
-			$endpoint = $discoveryManager->getShareEndpoint($protocol . $remoteDomain);
2687
-			$result = \OC::$server->getHTTPHelper()->post($protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, $fields);
2686
+			$endpoint = $discoveryManager->getShareEndpoint($protocol.$remoteDomain);
2687
+			$result = \OC::$server->getHTTPHelper()->post($protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, $fields);
2688 2688
 			$try++;
2689 2689
 			$protocol = 'http://';
2690 2690
 		}
@@ -2781,7 +2781,7 @@  discard block
 block discarded – undo
2781 2781
 	 * @return int
2782 2782
 	 */
2783 2783
 	public static function getExpireInterval() {
2784
-		return (int)\OCP\Config::getAppValue('core', 'shareapi_expire_after_n_days', '7');
2784
+		return (int) \OCP\Config::getAppValue('core', 'shareapi_expire_after_n_days', '7');
2785 2785
 	}
2786 2786
 
2787 2787
 	/**
Please login to merge, or discard this patch.
lib/private/Repair/AssetCache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	public function run(IOutput $output) {
38
-		$assetDir = \OC::$server->getConfig()->getSystemValue('assetdirectory', \OC::$SERVERROOT) . '/assets';
38
+		$assetDir = \OC::$server->getConfig()->getSystemValue('assetdirectory', \OC::$SERVERROOT).'/assets';
39 39
 		\OC_Helper::rmdirr($assetDir, false);
40 40
 		$output->info('Asset cache cleared.');
41 41
 	}
Please login to merge, or discard this patch.
lib/private/Repair/DropOldTables.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 		$tables = $this->oldDatabaseTables();
62 62
 		$output->startProgress(count($tables));
63 63
 		foreach ($this->oldDatabaseTables() as $tableName) {
64
-			if ($this->connection->tableExists($tableName)){
64
+			if ($this->connection->tableExists($tableName)) {
65 65
 				$this->connection->dropTable($tableName);
66 66
 			}
67 67
 			$output->advance(1, "Drop old database table: $tableName");
Please login to merge, or discard this patch.
lib/private/Repair/RepairUnmergedShares.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		$pickedShare = null;
174 174
 		// sort by stime, this also properly sorts the direct user share if any
175 175
 		@usort($subShares, function($a, $b) {
176
-			return ((int)$a['stime'] - (int)$b['stime']);
176
+			return ((int) $a['stime'] - (int) $b['stime']);
177 177
 		});
178 178
 
179 179
 		foreach ($subShares as $subShare) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		// check whether the user opted out completely of all subshares
223 223
 		$optedOut = true;
224 224
 		foreach ($subShares as $subShare) {
225
-			if ((int)$subShare['permissions'] !== 0) {
225
+			if ((int) $subShare['permissions'] !== 0) {
226 226
 				$optedOut = false;
227 227
 				break;
228 228
 			}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$shareIds = [];
232 232
 		foreach ($subShares as $subShare) {
233 233
 			// only if the user deleted some subshares but not all, adjust the permissions of that subshare
234
-			if (!$optedOut && (int)$subShare['permissions'] === 0 && (int)$subShare['share_type'] === DefaultShareProvider::SHARE_TYPE_USERGROUP) {
234
+			if (!$optedOut && (int) $subShare['permissions'] === 0 && (int) $subShare['share_type'] === DefaultShareProvider::SHARE_TYPE_USERGROUP) {
235 235
 				// set permissions from parent group share
236 236
 				$permissions = $groupSharesById[$subShare['parent']]['permissions'];
237 237
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			} else {
245 245
 				// gather share ids for bulk target update
246 246
 				if ($subShare['file_target'] !== $targetPath) {
247
-					$shareIds[] = (int)$subShare['id'];
247
+					$shareIds[] = (int) $subShare['id'];
248 248
 				}
249 249
 			}
250 250
 		}
Please login to merge, or discard this patch.