Completed
Push — stable10 ( d1b390...0bd063 )
by Lukas
27:03 queued 26:40
created
apps/dav/lib/DAV/Sharing/Plugin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	function initialize(Server $server) {
101 101
 		$this->server = $server;
102
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest';
103
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite';
102
+		$this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest';
103
+		$this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite';
104 104
 
105 105
 		$this->server->on('method:POST', [$this, 'httpPost']);
106
-		$this->server->on('propFind',    [$this, 'propFind']);
106
+		$this->server->on('propFind', [$this, 'propFind']);
107 107
 	}
108 108
 
109 109
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 			// Dealing with the 'share' document, which modified invitees on a
148 148
 			// calendar.
149
-			case '{' . self::NS_OWNCLOUD . '}share' :
149
+			case '{'.self::NS_OWNCLOUD.'}share' :
150 150
 
151 151
 				// We can only deal with IShareableCalendar objects
152 152
 				if (!$node instanceof IShareable) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	function propFind(PropFind $propFind, INode $node) {
190 190
 		if ($node instanceof IShareable) {
191 191
 
192
-			$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function() use ($node) {
192
+			$propFind->handle('{'.Plugin::NS_OWNCLOUD.'}invite', function() use ($node) {
193 193
 				return new Invite(
194 194
 					$node->getShares()
195 195
 				);
Please login to merge, or discard this patch.
apps/dav/lib/DAV/Sharing/Backend.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	 * @param string[] $remove
58 58
 	 */
59 59
 	public function updateShares($shareable, $add, $remove) {
60
-		foreach($add as $element) {
60
+		foreach ($add as $element) {
61 61
 			$this->shareWith($shareable, $element);
62 62
 		}
63
-		foreach($remove as $element) {
63
+		foreach ($remove as $element) {
64 64
 			$this->unshare($shareable, $element);
65 65
 		}
66 66
 	}
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			->execute();
165 165
 
166 166
 		$shares = [];
167
-		while($row = $result->fetch()) {
167
+		while ($row = $result->fetch()) {
168 168
 			$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
169
-			$shares[]= [
169
+			$shares[] = [
170 170
 				'href' => "principal:${row['principaluri']}",
171 171
 				'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
172 172
 				'status' => 1,
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 		foreach ($shares as $share) {
193 193
 			$acl[] = [
194 194
 				'privilege' => '{DAV:}read',
195
-				'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
195
+				'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'],
196 196
 				'protected' => true,
197 197
 			];
198 198
 			if (!$share['readOnly']) {
199 199
 				$acl[] = [
200 200
 					'privilege' => '{DAV:}write',
201
-					'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
201
+					'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'],
202 202
 					'protected' => true,
203 203
 				];
204 204
 			} else if ($this->resourceType === 'calendar') {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 				// so users can change the visibility.
207 207
 				$acl[] = [
208 208
 					'privilege' => '{DAV:}write-properties',
209
-					'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
209
+					'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'],
210 210
 					'protected' => true,
211 211
 				];
212 212
 			}
Please login to merge, or discard this patch.
apps/dav/lib/Comments/EntityTypeCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		\Closure $childExistsFunction
70 70
 	) {
71 71
 		$name = trim($name);
72
-		if(empty($name) || !is_string($name)) {
72
+		if (empty($name) || !is_string($name)) {
73 73
 			throw new \InvalidArgumentException('"name" parameter must be non-empty string');
74 74
 		}
75 75
 		$this->name = $name;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @throws NotFound
92 92
 	 */
93 93
 	function getChild($name) {
94
-		if(!$this->childExists($name)) {
94
+		if (!$this->childExists($name)) {
95 95
 			throw new NotFound('Entity does not exist or is not available');
96 96
 		}
97 97
 		return new EntityCollection(
Please login to merge, or discard this patch.
apps/dav/lib/Comments/RootCollection.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	 * @throws NotAuthenticated
87 87
 	 */
88 88
 	protected function initCollections() {
89
-		if($this->entityTypeCollections !== null) {
89
+		if ($this->entityTypeCollections !== null) {
90 90
 			return;
91 91
 		}
92 92
 		$user = $this->userSession->getUser();
93
-		if(is_null($user)) {
93
+		if (is_null($user)) {
94 94
 			throw new NotAuthenticated();
95 95
 		}
96 96
 
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	function getChild($name) {
146 146
 		$this->initCollections();
147
-		if(isset($this->entityTypeCollections[$name])) {
147
+		if (isset($this->entityTypeCollections[$name])) {
148 148
 			return $this->entityTypeCollections[$name];
149 149
 		}
150
-		throw new NotFound('Entity type "' . $name . '" not found."');
150
+		throw new NotFound('Entity type "'.$name.'" not found."');
151 151
 	}
152 152
 
153 153
 	/**
Please login to merge, or discard this patch.
apps/dav/lib/Comments/CommentsPlugin.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	function initialize(Server $server) {
86 86
 		$this->server = $server;
87
-		if(strpos($this->server->getRequestUri(), 'comments/') !== 0) {
87
+		if (strpos($this->server->getRequestUri(), 'comments/') !== 0) {
88 88
 			return;
89 89
 		}
90 90
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		// having their own comments marked as unread
125 125
 		$node->setReadMarker(null);
126 126
 
127
-		$url = rtrim($request->getUrl(), '/') . '/' . urlencode($comment->getId());
127
+		$url = rtrim($request->getUrl(), '/').'/'.urlencode($comment->getId());
128 128
 
129 129
 		$response->setHeader('Content-Location', $url);
130 130
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function onReport($reportName, $report, $uri) {
159 159
 		$node = $this->server->tree->getNodeForPath($uri);
160
-		if(!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
160
+		if (!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
161 161
 			throw new ReportNotSupported();
162 162
 		}
163 163
 		$args = ['limit' => 0, 'offset' => 0, 'datetime' => null];
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 			$this::REPORT_PARAM_OFFSET,
167 167
 			$this::REPORT_PARAM_TIMESTAMP
168 168
 		];
169
-		$ns = '{' . $this::NS_OWNCLOUD . '}';
170
-		foreach($report as $parameter) {
171
-			if(!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) {
169
+		$ns = '{'.$this::NS_OWNCLOUD.'}';
170
+		foreach ($report as $parameter) {
171
+			if (!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) {
172 172
 				continue;
173 173
 			}
174 174
 			$args[str_replace($ns, '', $parameter['name'])] = $parameter['value'];
175 175
 		}
176 176
 
177
-		if(!is_null($args['datetime'])) {
177
+		if (!is_null($args['datetime'])) {
178 178
 			$args['datetime'] = new \DateTime($args['datetime']);
179 179
 		}
180 180
 
181 181
 		$results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']);
182 182
 
183 183
 		$responses = [];
184
-		foreach($results as $node) {
185
-			$nodePath = $this->server->getRequestUri() . '/' . $node->comment->getId();
184
+		foreach ($results as $node) {
185
+			$nodePath = $this->server->getRequestUri().'/'.$node->comment->getId();
186 186
 			$resultSet = $this->server->getPropertiesForPath($nodePath, CommentNode::getPropertyNames());
187
-			if(isset($resultSet[0]) && isset($resultSet[0][200])) {
187
+			if (isset($resultSet[0]) && isset($resultSet[0][200])) {
188 188
 				$responses[] = new Response(
189
-					$this->server->getBaseUri() . $nodePath,
189
+					$this->server->getBaseUri().$nodePath,
190 190
 					[200 => $resultSet[0][200]],
191 191
 					200
192 192
 				);
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$actorType = $data['actorType'];
229 229
 		$actorId = null;
230
-		if($actorType === 'users') {
230
+		if ($actorType === 'users') {
231 231
 			$user = $this->userSession->getUser();
232
-			if(!is_null($user)) {
232
+			if (!is_null($user)) {
233 233
 				$actorId = $user->getUID();
234 234
 			}
235 235
 		}
236
-		if(is_null($actorId)) {
237
-			throw new BadRequest('Invalid actor "' .  $actorType .'"');
236
+		if (is_null($actorId)) {
237
+			throw new BadRequest('Invalid actor "'.$actorType.'"');
238 238
 		}
239 239
 
240 240
 		try {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			throw new BadRequest('Invalid input values', 0, $e);
248 248
 		} catch (\OCP\Comments\MessageTooLongException $e) {
249 249
 			$msg = 'Message exceeds allowed character limit of ';
250
-			throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0,	$e);
250
+			throw new BadRequest($msg.\OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
apps/dav/lib/Comments/EntityCollection.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  * @package OCA\DAV\Comments
42 42
  */
43 43
 class EntityCollection extends RootCollection implements IProperties {
44
-	const PROPERTY_NAME_READ_MARKER  = '{http://owncloud.org/ns}readMarker';
44
+	const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
45 45
 
46 46
 	/** @var  string */
47 47
 	protected $id;
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 		IUserSession $userSession,
66 66
 		ILogger $logger
67 67
 	) {
68
-		foreach(['id', 'name'] as $property) {
68
+		foreach (['id', 'name'] as $property) {
69 69
 			$$property = trim($$property);
70
-			if(empty($$property) || !is_string($$property)) {
71
-				throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string');
70
+			if (empty($$property) || !is_string($$property)) {
71
+				throw new \InvalidArgumentException('"'.$property.'" parameter must be non-empty string');
72 72
 			}
73 73
 		}
74 74
 		$this->id = $id;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
135 135
 		$comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
136 136
 		$result = [];
137
-		foreach($comments as $comment) {
137
+		foreach ($comments as $comment) {
138 138
 			$result[] = new CommentNode(
139 139
 				$this->commentsManager,
140 140
 				$comment,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	function getProperties($properties) {
188 188
 		$marker = null;
189 189
 		$user = $this->userSession->getUser();
190
-		if(!is_null($user)) {
190
+		if (!is_null($user)) {
191 191
 			$marker = $this->commentsManager->getReadMark($this->name, $this->id, $user);
192 192
 		}
193 193
 		return [self::PROPERTY_NAME_READ_MARKER => $marker];
Please login to merge, or discard this patch.
apps/dav/lib/Connector/PublicAuth.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,13 +100,13 @@
 block discarded – undo
100 100
 				if ($this->shareManager->checkPassword($share, $password)) {
101 101
 					return true;
102 102
 				} else if ($this->session->exists('public_link_authenticated')
103
-					&& $this->session->get('public_link_authenticated') === (string)$share->getId()) {
103
+					&& $this->session->get('public_link_authenticated') === (string) $share->getId()) {
104 104
 					return true;
105 105
 				} else {
106 106
 					if (in_array('XMLHttpRequest', explode(',', $this->request->getHeader('X-Requested-With')))) {
107 107
 						// do not re-authenticate over ajax, use dummy auth name to prevent browser popup
108 108
 						http_response_code(401);
109
-						header('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"');
109
+						header('WWW-Authenticate', 'DummyBasic realm="'.$this->realm.'"');
110 110
 						throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
111 111
 					}
112 112
 					return false;
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@
 block discarded – undo
102 102
 	 * @param array $conditions
103 103
 	 */
104 104
 	public function validateTokens(RequestInterface $request, &$conditions) {
105
-		foreach($conditions as &$fileCondition) {
106
-			if(isset($fileCondition['tokens'])) {
107
-				foreach($fileCondition['tokens'] as &$token) {
108
-					if(isset($token['token'])) {
109
-						if(substr($token['token'], 0, 16) === 'opaquelocktoken:') {
105
+		foreach ($conditions as &$fileCondition) {
106
+			if (isset($fileCondition['tokens'])) {
107
+				foreach ($fileCondition['tokens'] as &$token) {
108
+					if (isset($token['token'])) {
109
+						if (substr($token['token'], 0, 16) === 'opaquelocktoken:') {
110 110
 							$token['validToken'] = true;
111 111
 						}
112 112
 					}
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/DummyGetResponsePlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@
 block discarded – undo
57 57
 	 * @return false
58 58
 	 */
59 59
 	function httpGet(RequestInterface $request, ResponseInterface $response) {
60
-		$string = 'This is the WebDAV interface. It can only be accessed by ' .
60
+		$string = 'This is the WebDAV interface. It can only be accessed by '.
61 61
 			'WebDAV clients such as the ownCloud desktop sync client.';
62
-		$stream = fopen('php://memory','r+');
62
+		$stream = fopen('php://memory', 'r+');
63 63
 		fwrite($stream, $string);
64 64
 		rewind($stream);
65 65
 
Please login to merge, or discard this patch.