Completed
Push — master ( 09d5b6...052221 )
by John
19:20
created
apps/files/lib/Controller/ApiController.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,6 @@
 block discarded – undo
45 45
 use OCP\Share\IManager;
46 46
 use OC\Files\Node\Node;
47 47
 use OCP\IUserSession;
48
-use Sabre\VObject\Property\Boolean;
49 48
 
50 49
 /**
51 50
  * Class ApiController
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 	 * @return array
170 170
 	 */
171 171
 	private function formatNodes(array $nodes) {
172
-		return array_values(array_map(function (Node $node) {
172
+		return array_values(array_map(function(Node $node) {
173 173
 			/** @var \OC\Files\Node\Node $shareTypes */
174 174
 			$shareTypes = $this->getShareTypes($node);
175 175
 			$file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
176 176
 			$parts = explode('/', dirname($node->getPath()), 4);
177 177
 			if (isset($parts[3])) {
178
-				$file['path'] = '/' . $parts[3];
178
+				$file['path'] = '/'.$parts[3];
179 179
 			} else {
180 180
 				$file['path'] = '/';
181 181
 			}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @param bool $show
286 286
 	 */
287 287
 	public function showHiddenFiles($show) {
288
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show);
288
+		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int) $show);
289 289
 		return new Response();
290 290
 	}
291 291
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return Response
300 300
 	 */
301 301
 	public function showQuickAccess($show) {
302
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', (int)$show);
302
+		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', (int) $show);
303 303
 		return new Response();
304 304
 	}
305 305
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @return Response
325 325
 	 */
326 326
 	public function setSortingStrategy($strategy) {
327
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', (String)$strategy);
327
+		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', (String) $strategy);
328 328
 		return new Response();
329 329
 	}
330 330
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * @return Response
349 349
 	 */
350 350
 	public function setReverseQuickaccess($reverse) {
351
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', (int)$reverse);
351
+		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', (int) $reverse);
352 352
 		return new Response();
353 353
 	}
354 354
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @return Response
376 376
 	 */
377 377
 	public function setShowQuickaccessSettings($show) {
378
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', (int)$show);
378
+		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', (int) $show);
379 379
 		return new Response();
380 380
 	}
381 381
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @return Response
403 403
 	 */
404 404
 	public function setSortingOrder($order) {
405
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', (String)$order);
405
+		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', (String) $order);
406 406
 		return new Response();
407 407
 	}
408 408
 
Please login to merge, or discard this patch.
Indentation   +377 added lines, -377 removed lines patch added patch discarded remove patch
@@ -53,383 +53,383 @@
 block discarded – undo
53 53
  * @package OCA\Files\Controller
54 54
  */
55 55
 class ApiController extends Controller {
56
-	/** @var TagService */
57
-	private $tagService;
58
-	/** @var IManager * */
59
-	private $shareManager;
60
-	/** @var IPreview */
61
-	private $previewManager;
62
-	/** IUserSession */
63
-	private $userSession;
64
-	/** IConfig */
65
-	private $config;
66
-	/** @var Folder */
67
-	private $userFolder;
68
-
69
-	/**
70
-	 * @param string $appName
71
-	 * @param IRequest $request
72
-	 * @param IUserSession $userSession
73
-	 * @param TagService $tagService
74
-	 * @param IPreview $previewManager
75
-	 * @param IManager $shareManager
76
-	 * @param IConfig $config
77
-	 * @param Folder $userFolder
78
-	 */
79
-	public function __construct($appName,
80
-								IRequest $request,
81
-								IUserSession $userSession,
82
-								TagService $tagService,
83
-								IPreview $previewManager,
84
-								IManager $shareManager,
85
-								IConfig $config,
86
-								Folder $userFolder) {
87
-		parent::__construct($appName, $request);
88
-		$this->userSession = $userSession;
89
-		$this->tagService = $tagService;
90
-		$this->previewManager = $previewManager;
91
-		$this->shareManager = $shareManager;
92
-		$this->config = $config;
93
-		$this->userFolder = $userFolder;
94
-	}
95
-
96
-	/**
97
-	 * Gets a thumbnail of the specified file
98
-	 *
99
-	 * @since API version 1.0
100
-	 *
101
-	 * @NoAdminRequired
102
-	 * @NoCSRFRequired
103
-	 * @StrictCookieRequired
104
-	 *
105
-	 * @param int $x
106
-	 * @param int $y
107
-	 * @param string $file URL-encoded filename
108
-	 * @return DataResponse|FileDisplayResponse
109
-	 */
110
-	public function getThumbnail($x, $y, $file) {
111
-		if ($x < 1 || $y < 1) {
112
-			return new DataResponse(['message' => 'Requested size must be numeric and a positive value.'], Http::STATUS_BAD_REQUEST);
113
-		}
114
-
115
-		try {
116
-			$file = $this->userFolder->get($file);
117
-			if ($file instanceof Folder) {
118
-				throw new NotFoundException();
119
-			}
120
-
121
-			/** @var File $file */
122
-			$preview = $this->previewManager->getPreview($file, $x, $y, true);
123
-
124
-			return new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => $preview->getMimeType()]);
125
-		} catch (NotFoundException $e) {
126
-			return new DataResponse(['message' => 'File not found.'], Http::STATUS_NOT_FOUND);
127
-		} catch (\Exception $e) {
128
-			return new DataResponse([], Http::STATUS_BAD_REQUEST);
129
-		}
130
-	}
131
-
132
-	/**
133
-	 * Updates the info of the specified file path
134
-	 * The passed tags are absolute, which means they will
135
-	 * replace the actual tag selection.
136
-	 *
137
-	 * @NoAdminRequired
138
-	 *
139
-	 * @param string $path path
140
-	 * @param array|string $tags array of tags
141
-	 * @return DataResponse
142
-	 */
143
-	public function updateFileTags($path, $tags = null) {
144
-		$result = [];
145
-		// if tags specified or empty array, update tags
146
-		if (!is_null($tags)) {
147
-			try {
148
-				$this->tagService->updateFileTags($path, $tags);
149
-			} catch (\OCP\Files\NotFoundException $e) {
150
-				return new DataResponse([
151
-					'message' => $e->getMessage()
152
-				], Http::STATUS_NOT_FOUND);
153
-			} catch (\OCP\Files\StorageNotAvailableException $e) {
154
-				return new DataResponse([
155
-					'message' => $e->getMessage()
156
-				], Http::STATUS_SERVICE_UNAVAILABLE);
157
-			} catch (\Exception $e) {
158
-				return new DataResponse([
159
-					'message' => $e->getMessage()
160
-				], Http::STATUS_NOT_FOUND);
161
-			}
162
-			$result['tags'] = $tags;
163
-		}
164
-		return new DataResponse($result);
165
-	}
166
-
167
-	/**
168
-	 * @param \OCP\Files\Node[] $nodes
169
-	 * @return array
170
-	 */
171
-	private function formatNodes(array $nodes) {
172
-		return array_values(array_map(function (Node $node) {
173
-			/** @var \OC\Files\Node\Node $shareTypes */
174
-			$shareTypes = $this->getShareTypes($node);
175
-			$file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
176
-			$parts = explode('/', dirname($node->getPath()), 4);
177
-			if (isset($parts[3])) {
178
-				$file['path'] = '/' . $parts[3];
179
-			} else {
180
-				$file['path'] = '/';
181
-			}
182
-			if (!empty($shareTypes)) {
183
-				$file['shareTypes'] = $shareTypes;
184
-			}
185
-			return $file;
186
-		}, $nodes));
187
-	}
188
-
189
-	/**
190
-	 * Returns a list of recently modifed files.
191
-	 *
192
-	 * @NoAdminRequired
193
-	 *
194
-	 * @return DataResponse
195
-	 */
196
-	public function getRecentFiles() {
197
-		$nodes = $this->userFolder->getRecent(100);
198
-		$files = $this->formatNodes($nodes);
199
-		return new DataResponse(['files' => $files]);
200
-	}
201
-
202
-	/**
203
-	 * Returns a list of favorites modifed folder.
204
-	 *
205
-	 * @NoAdminRequired
206
-	 *
207
-	 * @return DataResponse
208
-	 */
209
-	public function getFavoritesFolder() {
210
-		$nodes = $this->userFolder->searchByTag('_$!<Favorite>!$_', $this->userSession->getUser()->getUID());
211
-
212
-		$favorites = [];
213
-		$i = 0;
214
-		foreach ($nodes as &$node) {
215
-
216
-			$favorites[$i]['id'] = $node->getId();
217
-			$favorites[$i]['name'] = $node->getName();
218
-			$favorites[$i]['path'] = $node->getInternalPath();
219
-			$favorites[$i]['mtime'] = $node->getMTime();
220
-			$i++;
221
-		}
222
-
223
-		return new DataResponse(['favoriteFolders' => $favorites]);
224
-	}
225
-
226
-	/**
227
-	 * Return a list of share types for outgoing shares
228
-	 *
229
-	 * @param Node $node file node
230
-	 *
231
-	 * @return int[] array of share types
232
-	 */
233
-	private function getShareTypes(Node $node) {
234
-		$userId = $this->userSession->getUser()->getUID();
235
-		$shareTypes = [];
236
-		$requestedShareTypes = [
237
-			\OCP\Share::SHARE_TYPE_USER,
238
-			\OCP\Share::SHARE_TYPE_GROUP,
239
-			\OCP\Share::SHARE_TYPE_LINK,
240
-			\OCP\Share::SHARE_TYPE_REMOTE,
241
-			\OCP\Share::SHARE_TYPE_EMAIL
242
-		];
243
-		foreach ($requestedShareTypes as $requestedShareType) {
244
-			// one of each type is enough to find out about the types
245
-			$shares = $this->shareManager->getSharesBy(
246
-				$userId,
247
-				$requestedShareType,
248
-				$node,
249
-				false,
250
-				1
251
-			);
252
-			if (!empty($shares)) {
253
-				$shareTypes[] = $requestedShareType;
254
-			}
255
-		}
256
-		return $shareTypes;
257
-	}
258
-
259
-	/**
260
-	 * Change the default sort mode
261
-	 *
262
-	 * @NoAdminRequired
263
-	 *
264
-	 * @param string $mode
265
-	 * @param string $direction
266
-	 * @return Response
267
-	 */
268
-	public function updateFileSorting($mode, $direction) {
269
-		$allowedMode = ['name', 'size', 'mtime'];
270
-		$allowedDirection = ['asc', 'desc'];
271
-		if (!in_array($mode, $allowedMode) || !in_array($direction, $allowedDirection)) {
272
-			$response = new Response();
273
-			$response->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
274
-			return $response;
275
-		}
276
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'file_sorting', $mode);
277
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'file_sorting_direction', $direction);
278
-		return new Response();
279
-	}
280
-
281
-	/**
282
-	 * Toggle default for showing/hiding hidden files
283
-	 *
284
-	 * @NoAdminRequired
285
-	 *
286
-	 * @param bool $show
287
-	 */
288
-	public function showHiddenFiles($show) {
289
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show);
290
-		return new Response();
291
-	}
292
-
293
-	/**
294
-	 * Toggle default for showing/hiding QuickAccess folder
295
-	 *
296
-	 * @NoAdminRequired
297
-	 *
298
-	 * @param bool $show
299
-	 *
300
-	 * @return Response
301
-	 */
302
-	public function showQuickAccess($show) {
303
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', (int)$show);
304
-		return new Response();
305
-	}
306
-
307
-	/**
308
-	 * Toggle default for showing/hiding QuickAccess folder
309
-	 *
310
-	 * @NoAdminRequired
311
-	 *
312
-	 * @return String
313
-	 */
314
-	public function getShowQuickAccess() {
315
-
316
-		return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 0);
317
-	}
318
-
319
-	/**
320
-	 * quickaccess-sorting-strategy
321
-	 *
322
-	 * @NoAdminRequired
323
-	 *
324
-	 * @param string $strategy
325
-	 * @return Response
326
-	 */
327
-	public function setSortingStrategy($strategy) {
328
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', (String)$strategy);
329
-		return new Response();
330
-	}
331
-
332
-	/**
333
-	 * Get reverse-state for quickaccess-list
334
-	 *
335
-	 * @NoAdminRequired
336
-	 *
337
-	 * @return String
338
-	 */
339
-	public function getSortingStrategy() {
340
-		return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', 'alphabet');
341
-	}
342
-
343
-	/**
344
-	 * Toggle for reverse quickaccess-list
345
-	 *
346
-	 * @NoAdminRequired
347
-	 *
348
-	 * @param bool $reverse
349
-	 * @return Response
350
-	 */
351
-	public function setReverseQuickaccess($reverse) {
352
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', (int)$reverse);
353
-		return new Response();
354
-	}
355
-
356
-	/**
357
-	 * Get reverse-state for quickaccess-list
358
-	 *
359
-	 * @NoAdminRequired
360
-	 *
361
-	 * @return bool
362
-	 */
363
-	public function getReverseQuickaccess() {
364
-		if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', false)) {
365
-			return true;
366
-		}
367
-		return false;
368
-	}
369
-
370
-	/**
371
-	 * Set state for show sorting menu
372
-	 *
373
-	 * @NoAdminRequired
374
-	 *
375
-	 * @param bool $show
376
-	 * @return Response
377
-	 */
378
-	public function setShowQuickaccessSettings($show) {
379
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', (int)$show);
380
-		return new Response();
381
-	}
382
-
383
-	/**
384
-	 * Get state for show sorting menu
385
-	 *
386
-	 * @NoAdminRequired
387
-	 *
388
-	 * @return bool
389
-	 */
390
-	public function getShowQuickaccessSettings() {
391
-		if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', false)) {
392
-			return true;
393
-		}
394
-		return false;
395
-	}
396
-
397
-	/**
398
-	 * Set sorting-order for custom sorting
399
-	 *
400
-	 * @NoAdminRequired
401
-	 *
402
-	 * @param String $order
403
-	 * @return Response
404
-	 */
405
-	public function setSortingOrder($order) {
406
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', (String)$order);
407
-		return new Response();
408
-	}
409
-
410
-	/**
411
-	 * Get sorting-order for custom sorting
412
-	 *
413
-	 * @NoAdminRequired
414
-	 *
415
-	 * @return String
416
-	 */
417
-	public function getSortingOrder() {
418
-		return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', "");
419
-	}
420
-
421
-	/**
422
-	 * Get sorting-order for custom sorting
423
-	 *
424
-	 * @NoAdminRequired
425
-	 *
426
-	 * @param String
427
-	 * @return String
428
-	 */
429
-	public function getNodeType($folderpath) {
430
-		$node = $this->userFolder->get($folderpath);
431
-		return $node->getType();
432
-	}
56
+    /** @var TagService */
57
+    private $tagService;
58
+    /** @var IManager * */
59
+    private $shareManager;
60
+    /** @var IPreview */
61
+    private $previewManager;
62
+    /** IUserSession */
63
+    private $userSession;
64
+    /** IConfig */
65
+    private $config;
66
+    /** @var Folder */
67
+    private $userFolder;
68
+
69
+    /**
70
+     * @param string $appName
71
+     * @param IRequest $request
72
+     * @param IUserSession $userSession
73
+     * @param TagService $tagService
74
+     * @param IPreview $previewManager
75
+     * @param IManager $shareManager
76
+     * @param IConfig $config
77
+     * @param Folder $userFolder
78
+     */
79
+    public function __construct($appName,
80
+                                IRequest $request,
81
+                                IUserSession $userSession,
82
+                                TagService $tagService,
83
+                                IPreview $previewManager,
84
+                                IManager $shareManager,
85
+                                IConfig $config,
86
+                                Folder $userFolder) {
87
+        parent::__construct($appName, $request);
88
+        $this->userSession = $userSession;
89
+        $this->tagService = $tagService;
90
+        $this->previewManager = $previewManager;
91
+        $this->shareManager = $shareManager;
92
+        $this->config = $config;
93
+        $this->userFolder = $userFolder;
94
+    }
95
+
96
+    /**
97
+     * Gets a thumbnail of the specified file
98
+     *
99
+     * @since API version 1.0
100
+     *
101
+     * @NoAdminRequired
102
+     * @NoCSRFRequired
103
+     * @StrictCookieRequired
104
+     *
105
+     * @param int $x
106
+     * @param int $y
107
+     * @param string $file URL-encoded filename
108
+     * @return DataResponse|FileDisplayResponse
109
+     */
110
+    public function getThumbnail($x, $y, $file) {
111
+        if ($x < 1 || $y < 1) {
112
+            return new DataResponse(['message' => 'Requested size must be numeric and a positive value.'], Http::STATUS_BAD_REQUEST);
113
+        }
114
+
115
+        try {
116
+            $file = $this->userFolder->get($file);
117
+            if ($file instanceof Folder) {
118
+                throw new NotFoundException();
119
+            }
120
+
121
+            /** @var File $file */
122
+            $preview = $this->previewManager->getPreview($file, $x, $y, true);
123
+
124
+            return new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => $preview->getMimeType()]);
125
+        } catch (NotFoundException $e) {
126
+            return new DataResponse(['message' => 'File not found.'], Http::STATUS_NOT_FOUND);
127
+        } catch (\Exception $e) {
128
+            return new DataResponse([], Http::STATUS_BAD_REQUEST);
129
+        }
130
+    }
131
+
132
+    /**
133
+     * Updates the info of the specified file path
134
+     * The passed tags are absolute, which means they will
135
+     * replace the actual tag selection.
136
+     *
137
+     * @NoAdminRequired
138
+     *
139
+     * @param string $path path
140
+     * @param array|string $tags array of tags
141
+     * @return DataResponse
142
+     */
143
+    public function updateFileTags($path, $tags = null) {
144
+        $result = [];
145
+        // if tags specified or empty array, update tags
146
+        if (!is_null($tags)) {
147
+            try {
148
+                $this->tagService->updateFileTags($path, $tags);
149
+            } catch (\OCP\Files\NotFoundException $e) {
150
+                return new DataResponse([
151
+                    'message' => $e->getMessage()
152
+                ], Http::STATUS_NOT_FOUND);
153
+            } catch (\OCP\Files\StorageNotAvailableException $e) {
154
+                return new DataResponse([
155
+                    'message' => $e->getMessage()
156
+                ], Http::STATUS_SERVICE_UNAVAILABLE);
157
+            } catch (\Exception $e) {
158
+                return new DataResponse([
159
+                    'message' => $e->getMessage()
160
+                ], Http::STATUS_NOT_FOUND);
161
+            }
162
+            $result['tags'] = $tags;
163
+        }
164
+        return new DataResponse($result);
165
+    }
166
+
167
+    /**
168
+     * @param \OCP\Files\Node[] $nodes
169
+     * @return array
170
+     */
171
+    private function formatNodes(array $nodes) {
172
+        return array_values(array_map(function (Node $node) {
173
+            /** @var \OC\Files\Node\Node $shareTypes */
174
+            $shareTypes = $this->getShareTypes($node);
175
+            $file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
176
+            $parts = explode('/', dirname($node->getPath()), 4);
177
+            if (isset($parts[3])) {
178
+                $file['path'] = '/' . $parts[3];
179
+            } else {
180
+                $file['path'] = '/';
181
+            }
182
+            if (!empty($shareTypes)) {
183
+                $file['shareTypes'] = $shareTypes;
184
+            }
185
+            return $file;
186
+        }, $nodes));
187
+    }
188
+
189
+    /**
190
+     * Returns a list of recently modifed files.
191
+     *
192
+     * @NoAdminRequired
193
+     *
194
+     * @return DataResponse
195
+     */
196
+    public function getRecentFiles() {
197
+        $nodes = $this->userFolder->getRecent(100);
198
+        $files = $this->formatNodes($nodes);
199
+        return new DataResponse(['files' => $files]);
200
+    }
201
+
202
+    /**
203
+     * Returns a list of favorites modifed folder.
204
+     *
205
+     * @NoAdminRequired
206
+     *
207
+     * @return DataResponse
208
+     */
209
+    public function getFavoritesFolder() {
210
+        $nodes = $this->userFolder->searchByTag('_$!<Favorite>!$_', $this->userSession->getUser()->getUID());
211
+
212
+        $favorites = [];
213
+        $i = 0;
214
+        foreach ($nodes as &$node) {
215
+
216
+            $favorites[$i]['id'] = $node->getId();
217
+            $favorites[$i]['name'] = $node->getName();
218
+            $favorites[$i]['path'] = $node->getInternalPath();
219
+            $favorites[$i]['mtime'] = $node->getMTime();
220
+            $i++;
221
+        }
222
+
223
+        return new DataResponse(['favoriteFolders' => $favorites]);
224
+    }
225
+
226
+    /**
227
+     * Return a list of share types for outgoing shares
228
+     *
229
+     * @param Node $node file node
230
+     *
231
+     * @return int[] array of share types
232
+     */
233
+    private function getShareTypes(Node $node) {
234
+        $userId = $this->userSession->getUser()->getUID();
235
+        $shareTypes = [];
236
+        $requestedShareTypes = [
237
+            \OCP\Share::SHARE_TYPE_USER,
238
+            \OCP\Share::SHARE_TYPE_GROUP,
239
+            \OCP\Share::SHARE_TYPE_LINK,
240
+            \OCP\Share::SHARE_TYPE_REMOTE,
241
+            \OCP\Share::SHARE_TYPE_EMAIL
242
+        ];
243
+        foreach ($requestedShareTypes as $requestedShareType) {
244
+            // one of each type is enough to find out about the types
245
+            $shares = $this->shareManager->getSharesBy(
246
+                $userId,
247
+                $requestedShareType,
248
+                $node,
249
+                false,
250
+                1
251
+            );
252
+            if (!empty($shares)) {
253
+                $shareTypes[] = $requestedShareType;
254
+            }
255
+        }
256
+        return $shareTypes;
257
+    }
258
+
259
+    /**
260
+     * Change the default sort mode
261
+     *
262
+     * @NoAdminRequired
263
+     *
264
+     * @param string $mode
265
+     * @param string $direction
266
+     * @return Response
267
+     */
268
+    public function updateFileSorting($mode, $direction) {
269
+        $allowedMode = ['name', 'size', 'mtime'];
270
+        $allowedDirection = ['asc', 'desc'];
271
+        if (!in_array($mode, $allowedMode) || !in_array($direction, $allowedDirection)) {
272
+            $response = new Response();
273
+            $response->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
274
+            return $response;
275
+        }
276
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'file_sorting', $mode);
277
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'file_sorting_direction', $direction);
278
+        return new Response();
279
+    }
280
+
281
+    /**
282
+     * Toggle default for showing/hiding hidden files
283
+     *
284
+     * @NoAdminRequired
285
+     *
286
+     * @param bool $show
287
+     */
288
+    public function showHiddenFiles($show) {
289
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show);
290
+        return new Response();
291
+    }
292
+
293
+    /**
294
+     * Toggle default for showing/hiding QuickAccess folder
295
+     *
296
+     * @NoAdminRequired
297
+     *
298
+     * @param bool $show
299
+     *
300
+     * @return Response
301
+     */
302
+    public function showQuickAccess($show) {
303
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', (int)$show);
304
+        return new Response();
305
+    }
306
+
307
+    /**
308
+     * Toggle default for showing/hiding QuickAccess folder
309
+     *
310
+     * @NoAdminRequired
311
+     *
312
+     * @return String
313
+     */
314
+    public function getShowQuickAccess() {
315
+
316
+        return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 0);
317
+    }
318
+
319
+    /**
320
+     * quickaccess-sorting-strategy
321
+     *
322
+     * @NoAdminRequired
323
+     *
324
+     * @param string $strategy
325
+     * @return Response
326
+     */
327
+    public function setSortingStrategy($strategy) {
328
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', (String)$strategy);
329
+        return new Response();
330
+    }
331
+
332
+    /**
333
+     * Get reverse-state for quickaccess-list
334
+     *
335
+     * @NoAdminRequired
336
+     *
337
+     * @return String
338
+     */
339
+    public function getSortingStrategy() {
340
+        return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', 'alphabet');
341
+    }
342
+
343
+    /**
344
+     * Toggle for reverse quickaccess-list
345
+     *
346
+     * @NoAdminRequired
347
+     *
348
+     * @param bool $reverse
349
+     * @return Response
350
+     */
351
+    public function setReverseQuickaccess($reverse) {
352
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', (int)$reverse);
353
+        return new Response();
354
+    }
355
+
356
+    /**
357
+     * Get reverse-state for quickaccess-list
358
+     *
359
+     * @NoAdminRequired
360
+     *
361
+     * @return bool
362
+     */
363
+    public function getReverseQuickaccess() {
364
+        if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', false)) {
365
+            return true;
366
+        }
367
+        return false;
368
+    }
369
+
370
+    /**
371
+     * Set state for show sorting menu
372
+     *
373
+     * @NoAdminRequired
374
+     *
375
+     * @param bool $show
376
+     * @return Response
377
+     */
378
+    public function setShowQuickaccessSettings($show) {
379
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', (int)$show);
380
+        return new Response();
381
+    }
382
+
383
+    /**
384
+     * Get state for show sorting menu
385
+     *
386
+     * @NoAdminRequired
387
+     *
388
+     * @return bool
389
+     */
390
+    public function getShowQuickaccessSettings() {
391
+        if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', false)) {
392
+            return true;
393
+        }
394
+        return false;
395
+    }
396
+
397
+    /**
398
+     * Set sorting-order for custom sorting
399
+     *
400
+     * @NoAdminRequired
401
+     *
402
+     * @param String $order
403
+     * @return Response
404
+     */
405
+    public function setSortingOrder($order) {
406
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', (String)$order);
407
+        return new Response();
408
+    }
409
+
410
+    /**
411
+     * Get sorting-order for custom sorting
412
+     *
413
+     * @NoAdminRequired
414
+     *
415
+     * @return String
416
+     */
417
+    public function getSortingOrder() {
418
+        return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', "");
419
+    }
420
+
421
+    /**
422
+     * Get sorting-order for custom sorting
423
+     *
424
+     * @NoAdminRequired
425
+     *
426
+     * @param String
427
+     * @return String
428
+     */
429
+    public function getNodeType($folderpath) {
430
+        $node = $this->userFolder->get($folderpath);
431
+        return $node->getType();
432
+    }
433 433
 
434 434
 
435 435
 }
Please login to merge, or discard this patch.
apps/files/lib/Controller/ViewController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	protected function renderScript($appName, $scriptName) {
111 111
 		$content = '';
112 112
 		$appPath = \OC_App::getAppPath($appName);
113
-		$scriptPath = $appPath . '/' . $scriptName;
113
+		$scriptPath = $appPath.'/'.$scriptName;
114 114
 		if (file_exists($scriptPath)) {
115 115
 			// TODO: sanitize path / script name ?
116 116
 			ob_start();
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		);
231 231
 
232 232
 		$navItems = \OCA\Files\App::getNavigationManager()->getAll();
233
-		usort($navItems, function ($item1, $item2) {
233
+		usort($navItems, function($item1, $item2) {
234 234
 			return $item1['order'] - $item2['order'];
235 235
 		});
236 236
 
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
 		$this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event);
265 265
 
266 266
 		$params = [];
267
-		$params['usedSpacePercent'] = (int)$storageInfo['relative'];
267
+		$params['usedSpacePercent'] = (int) $storageInfo['relative'];
268 268
 		$params['owner'] = $storageInfo['owner'];
269 269
 		$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'];
270 270
 		$params['isPublic'] = false;
271 271
 		$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
272 272
 		$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
273 273
 		$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
274
-		$showHidden = (bool)$this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
274
+		$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
275 275
 		$params['showHiddenFiles'] = $showHidden ? 1 : 0;
276 276
 		$params['fileNotFound'] = $fileNotFound ? 1 : 0;
277 277
 		$params['appNavigation'] = $nav;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		$params = [];
306 306
 
307 307
 		if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
308
-			$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
308
+			$baseFolder = $this->rootFolder->get($uid.'/files_trashbin/files/');
309 309
 			$files = $baseFolder->getById($fileId);
310 310
 			$params['view'] = 'trashbin';
311 311
 		}
Please login to merge, or discard this patch.
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -51,259 +51,259 @@
 block discarded – undo
51 51
  * @package OCA\Files\Controller
52 52
  */
53 53
 class ViewController extends Controller {
54
-	/** @var string */
55
-	protected $appName;
56
-	/** @var IRequest */
57
-	protected $request;
58
-	/** @var IURLGenerator */
59
-	protected $urlGenerator;
60
-	/** @var IL10N */
61
-	protected $l10n;
62
-	/** @var IConfig */
63
-	protected $config;
64
-	/** @var EventDispatcherInterface */
65
-	protected $eventDispatcher;
66
-	/** @var IUserSession */
67
-	protected $userSession;
68
-	/** @var IAppManager */
69
-	protected $appManager;
70
-	/** @var IRootFolder */
71
-	protected $rootFolder;
72
-	/** @var Helper */
73
-	protected $activityHelper;
74
-
75
-	public function __construct(string $appName,
76
-								IRequest $request,
77
-								IURLGenerator $urlGenerator,
78
-								IL10N $l10n,
79
-								IConfig $config,
80
-								EventDispatcherInterface $eventDispatcherInterface,
81
-								IUserSession $userSession,
82
-								IAppManager $appManager,
83
-								IRootFolder $rootFolder,
84
-								Helper $activityHelper
85
-	) {
86
-		parent::__construct($appName, $request);
87
-		$this->appName = $appName;
88
-		$this->request = $request;
89
-		$this->urlGenerator = $urlGenerator;
90
-		$this->l10n = $l10n;
91
-		$this->config = $config;
92
-		$this->eventDispatcher = $eventDispatcherInterface;
93
-		$this->userSession = $userSession;
94
-		$this->appManager = $appManager;
95
-		$this->rootFolder = $rootFolder;
96
-		$this->activityHelper = $activityHelper;
97
-	}
98
-
99
-	/**
100
-	 * @param string $appName
101
-	 * @param string $scriptName
102
-	 * @return string
103
-	 */
104
-	protected function renderScript($appName, $scriptName) {
105
-		$content = '';
106
-		$appPath = \OC_App::getAppPath($appName);
107
-		$scriptPath = $appPath . '/' . $scriptName;
108
-		if (file_exists($scriptPath)) {
109
-			// TODO: sanitize path / script name ?
110
-			ob_start();
111
-			include $scriptPath;
112
-			$content = ob_get_contents();
113
-			@ob_end_clean();
114
-		}
115
-		return $content;
116
-	}
117
-
118
-	/**
119
-	 * FIXME: Replace with non static code
120
-	 *
121
-	 * @return array
122
-	 * @throws \OCP\Files\NotFoundException
123
-	 */
124
-	protected function getStorageInfo() {
125
-		$dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
126
-		return \OC_Helper::getStorageInfo('/', $dirInfo);
127
-	}
128
-
129
-	/**
130
-	 * @NoCSRFRequired
131
-	 * @NoAdminRequired
132
-	 *
133
-	 * @param string $dir
134
-	 * @param string $view
135
-	 * @param string $fileid
136
-	 * @return TemplateResponse|RedirectResponse
137
-	 */
138
-	public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
139
-		if ($fileid !== null) {
140
-			try {
141
-				return $this->showFile($fileid);
142
-			} catch (NotFoundException $e) {
143
-				return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
144
-			}
145
-		}
146
-
147
-		$nav = new \OCP\Template('files', 'appnavigation', '');
148
-
149
-		// Load the files we need
150
-		\OCP\Util::addStyle('files', 'merged');
151
-		\OCP\Util::addScript('files', 'merged-index');
152
-
153
-		// mostly for the home storage's free space
154
-		// FIXME: Make non static
155
-		$storageInfo = $this->getStorageInfo();
156
-
157
-		$user = $this->userSession->getUser()->getUID();
158
-
159
-		try {
160
-			$favElements = $this->activityHelper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
161
-		} catch (\RuntimeException $e) {
162
-			$favElements['folders'] = null;
163
-		}
164
-
165
-		$collapseClasses = '';
166
-		if (count($favElements['folders']) > 0) {
167
-			$collapseClasses = 'collapsible';
168
-		}
169
-
170
-		$favoritesSublistArray = Array();
171
-
172
-		$navBarPositionPosition = 6;
173
-		$currentCount = 0;
174
-		foreach ($favElements['folders'] as $dir) {
175
-
176
-			$id = substr($dir, strrpos($dir, '/') + 1, strlen($dir));
177
-			$link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
178
-			$sortingValue = ++$currentCount;
179
-			$element = [
180
-				'id' => str_replace('/', '-', $dir),
181
-				'view' => 'files',
182
-				'href' => $link,
183
-				'dir' => $dir,
184
-				'order' => $navBarPositionPosition,
185
-				'folderPosition' => $sortingValue,
186
-				'name' => $id,
187
-				'icon' => 'files',
188
-				'quickaccesselement' => 'true'
189
-			];
190
-
191
-			array_push($favoritesSublistArray, $element);
192
-			$navBarPositionPosition++;
193
-		}
194
-
195
-
196
-		// show_Quick_Access stored as string
197
-		$defaultExpandedState = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', '0') === '1';
198
-
199
-		\OCA\Files\App::getNavigationManager()->add(
200
-			[
201
-				'id' => 'favorites',
202
-				'appname' => 'files',
203
-				'script' => 'simplelist.php',
204
-				'classes' => $collapseClasses,
205
-				'order' => 5,
206
-				'name' => $this->l10n->t('Favorites'),
207
-				'sublist' => $favoritesSublistArray,
208
-				'defaultExpandedState' => $defaultExpandedState,
209
-				'enableMenuButton' => 0,
210
-			]
211
-		);
212
-
213
-		$navItems = \OCA\Files\App::getNavigationManager()->getAll();
214
-		usort($navItems, function ($item1, $item2) {
215
-			return $item1['order'] - $item2['order'];
216
-		});
217
-
218
-		$nav->assign('navigationItems', $navItems);
219
-
220
-		$nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
221
-		if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
222
-			$totalSpace = $this->l10n->t('Unlimited');
223
-		} else {
224
-			$totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
225
-		}
226
-		$nav->assign('total_space', $totalSpace);
227
-		$nav->assign('quota', $storageInfo['quota']);
228
-		$nav->assign('usage_relative', $storageInfo['relative']);
229
-
230
-		$contentItems = [];
231
-
232
-		// render the container content for every navigation item
233
-		foreach ($navItems as $item) {
234
-			$content = '';
235
-			if (isset($item['script'])) {
236
-				$content = $this->renderScript($item['appname'], $item['script']);
237
-			}
238
-			$contentItem = [];
239
-			$contentItem['id'] = $item['id'];
240
-			$contentItem['content'] = $content;
241
-			$contentItems[] = $contentItem;
242
-		}
243
-
244
-		$event = new GenericEvent(null, ['hiddenFields' => []]);
245
-		$this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event);
246
-
247
-		$params = [];
248
-		$params['usedSpacePercent'] = (int)$storageInfo['relative'];
249
-		$params['owner'] = $storageInfo['owner'];
250
-		$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'];
251
-		$params['isPublic'] = false;
252
-		$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
253
-		$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
254
-		$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
255
-		$showHidden = (bool)$this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
256
-		$params['showHiddenFiles'] = $showHidden ? 1 : 0;
257
-		$params['fileNotFound'] = $fileNotFound ? 1 : 0;
258
-		$params['appNavigation'] = $nav;
259
-		$params['appContents'] = $contentItems;
260
-		$params['hiddenFields'] = $event->getArgument('hiddenFields');
261
-
262
-		$response = new TemplateResponse(
263
-			$this->appName,
264
-			'index',
265
-			$params
266
-		);
267
-		$policy = new ContentSecurityPolicy();
268
-		$policy->addAllowedFrameDomain('\'self\'');
269
-		$response->setContentSecurityPolicy($policy);
270
-
271
-
272
-		return $response;
273
-	}
274
-
275
-	/**
276
-	 * Redirects to the file list and highlight the given file id
277
-	 *
278
-	 * @param string $fileId file id to show
279
-	 * @return RedirectResponse redirect response or not found response
280
-	 * @throws \OCP\Files\NotFoundException
281
-	 */
282
-	private function showFile($fileId) {
283
-		$uid = $this->userSession->getUser()->getUID();
284
-		$baseFolder = $this->rootFolder->getUserFolder($uid);
285
-		$files = $baseFolder->getById($fileId);
286
-		$params = [];
287
-
288
-		if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
289
-			$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
290
-			$files = $baseFolder->getById($fileId);
291
-			$params['view'] = 'trashbin';
292
-		}
293
-
294
-		if (!empty($files)) {
295
-			$file = current($files);
296
-			if ($file instanceof Folder) {
297
-				// set the full path to enter the folder
298
-				$params['dir'] = $baseFolder->getRelativePath($file->getPath());
299
-			} else {
300
-				// set parent path as dir
301
-				$params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
302
-				// and scroll to the entry
303
-				$params['scrollto'] = $file->getName();
304
-			}
305
-			return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
306
-		}
307
-		throw new \OCP\Files\NotFoundException();
308
-	}
54
+    /** @var string */
55
+    protected $appName;
56
+    /** @var IRequest */
57
+    protected $request;
58
+    /** @var IURLGenerator */
59
+    protected $urlGenerator;
60
+    /** @var IL10N */
61
+    protected $l10n;
62
+    /** @var IConfig */
63
+    protected $config;
64
+    /** @var EventDispatcherInterface */
65
+    protected $eventDispatcher;
66
+    /** @var IUserSession */
67
+    protected $userSession;
68
+    /** @var IAppManager */
69
+    protected $appManager;
70
+    /** @var IRootFolder */
71
+    protected $rootFolder;
72
+    /** @var Helper */
73
+    protected $activityHelper;
74
+
75
+    public function __construct(string $appName,
76
+                                IRequest $request,
77
+                                IURLGenerator $urlGenerator,
78
+                                IL10N $l10n,
79
+                                IConfig $config,
80
+                                EventDispatcherInterface $eventDispatcherInterface,
81
+                                IUserSession $userSession,
82
+                                IAppManager $appManager,
83
+                                IRootFolder $rootFolder,
84
+                                Helper $activityHelper
85
+    ) {
86
+        parent::__construct($appName, $request);
87
+        $this->appName = $appName;
88
+        $this->request = $request;
89
+        $this->urlGenerator = $urlGenerator;
90
+        $this->l10n = $l10n;
91
+        $this->config = $config;
92
+        $this->eventDispatcher = $eventDispatcherInterface;
93
+        $this->userSession = $userSession;
94
+        $this->appManager = $appManager;
95
+        $this->rootFolder = $rootFolder;
96
+        $this->activityHelper = $activityHelper;
97
+    }
98
+
99
+    /**
100
+     * @param string $appName
101
+     * @param string $scriptName
102
+     * @return string
103
+     */
104
+    protected function renderScript($appName, $scriptName) {
105
+        $content = '';
106
+        $appPath = \OC_App::getAppPath($appName);
107
+        $scriptPath = $appPath . '/' . $scriptName;
108
+        if (file_exists($scriptPath)) {
109
+            // TODO: sanitize path / script name ?
110
+            ob_start();
111
+            include $scriptPath;
112
+            $content = ob_get_contents();
113
+            @ob_end_clean();
114
+        }
115
+        return $content;
116
+    }
117
+
118
+    /**
119
+     * FIXME: Replace with non static code
120
+     *
121
+     * @return array
122
+     * @throws \OCP\Files\NotFoundException
123
+     */
124
+    protected function getStorageInfo() {
125
+        $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
126
+        return \OC_Helper::getStorageInfo('/', $dirInfo);
127
+    }
128
+
129
+    /**
130
+     * @NoCSRFRequired
131
+     * @NoAdminRequired
132
+     *
133
+     * @param string $dir
134
+     * @param string $view
135
+     * @param string $fileid
136
+     * @return TemplateResponse|RedirectResponse
137
+     */
138
+    public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
139
+        if ($fileid !== null) {
140
+            try {
141
+                return $this->showFile($fileid);
142
+            } catch (NotFoundException $e) {
143
+                return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
144
+            }
145
+        }
146
+
147
+        $nav = new \OCP\Template('files', 'appnavigation', '');
148
+
149
+        // Load the files we need
150
+        \OCP\Util::addStyle('files', 'merged');
151
+        \OCP\Util::addScript('files', 'merged-index');
152
+
153
+        // mostly for the home storage's free space
154
+        // FIXME: Make non static
155
+        $storageInfo = $this->getStorageInfo();
156
+
157
+        $user = $this->userSession->getUser()->getUID();
158
+
159
+        try {
160
+            $favElements = $this->activityHelper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
161
+        } catch (\RuntimeException $e) {
162
+            $favElements['folders'] = null;
163
+        }
164
+
165
+        $collapseClasses = '';
166
+        if (count($favElements['folders']) > 0) {
167
+            $collapseClasses = 'collapsible';
168
+        }
169
+
170
+        $favoritesSublistArray = Array();
171
+
172
+        $navBarPositionPosition = 6;
173
+        $currentCount = 0;
174
+        foreach ($favElements['folders'] as $dir) {
175
+
176
+            $id = substr($dir, strrpos($dir, '/') + 1, strlen($dir));
177
+            $link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
178
+            $sortingValue = ++$currentCount;
179
+            $element = [
180
+                'id' => str_replace('/', '-', $dir),
181
+                'view' => 'files',
182
+                'href' => $link,
183
+                'dir' => $dir,
184
+                'order' => $navBarPositionPosition,
185
+                'folderPosition' => $sortingValue,
186
+                'name' => $id,
187
+                'icon' => 'files',
188
+                'quickaccesselement' => 'true'
189
+            ];
190
+
191
+            array_push($favoritesSublistArray, $element);
192
+            $navBarPositionPosition++;
193
+        }
194
+
195
+
196
+        // show_Quick_Access stored as string
197
+        $defaultExpandedState = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', '0') === '1';
198
+
199
+        \OCA\Files\App::getNavigationManager()->add(
200
+            [
201
+                'id' => 'favorites',
202
+                'appname' => 'files',
203
+                'script' => 'simplelist.php',
204
+                'classes' => $collapseClasses,
205
+                'order' => 5,
206
+                'name' => $this->l10n->t('Favorites'),
207
+                'sublist' => $favoritesSublistArray,
208
+                'defaultExpandedState' => $defaultExpandedState,
209
+                'enableMenuButton' => 0,
210
+            ]
211
+        );
212
+
213
+        $navItems = \OCA\Files\App::getNavigationManager()->getAll();
214
+        usort($navItems, function ($item1, $item2) {
215
+            return $item1['order'] - $item2['order'];
216
+        });
217
+
218
+        $nav->assign('navigationItems', $navItems);
219
+
220
+        $nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
221
+        if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
222
+            $totalSpace = $this->l10n->t('Unlimited');
223
+        } else {
224
+            $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
225
+        }
226
+        $nav->assign('total_space', $totalSpace);
227
+        $nav->assign('quota', $storageInfo['quota']);
228
+        $nav->assign('usage_relative', $storageInfo['relative']);
229
+
230
+        $contentItems = [];
231
+
232
+        // render the container content for every navigation item
233
+        foreach ($navItems as $item) {
234
+            $content = '';
235
+            if (isset($item['script'])) {
236
+                $content = $this->renderScript($item['appname'], $item['script']);
237
+            }
238
+            $contentItem = [];
239
+            $contentItem['id'] = $item['id'];
240
+            $contentItem['content'] = $content;
241
+            $contentItems[] = $contentItem;
242
+        }
243
+
244
+        $event = new GenericEvent(null, ['hiddenFields' => []]);
245
+        $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event);
246
+
247
+        $params = [];
248
+        $params['usedSpacePercent'] = (int)$storageInfo['relative'];
249
+        $params['owner'] = $storageInfo['owner'];
250
+        $params['ownerDisplayName'] = $storageInfo['ownerDisplayName'];
251
+        $params['isPublic'] = false;
252
+        $params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
253
+        $params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
254
+        $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
255
+        $showHidden = (bool)$this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
256
+        $params['showHiddenFiles'] = $showHidden ? 1 : 0;
257
+        $params['fileNotFound'] = $fileNotFound ? 1 : 0;
258
+        $params['appNavigation'] = $nav;
259
+        $params['appContents'] = $contentItems;
260
+        $params['hiddenFields'] = $event->getArgument('hiddenFields');
261
+
262
+        $response = new TemplateResponse(
263
+            $this->appName,
264
+            'index',
265
+            $params
266
+        );
267
+        $policy = new ContentSecurityPolicy();
268
+        $policy->addAllowedFrameDomain('\'self\'');
269
+        $response->setContentSecurityPolicy($policy);
270
+
271
+
272
+        return $response;
273
+    }
274
+
275
+    /**
276
+     * Redirects to the file list and highlight the given file id
277
+     *
278
+     * @param string $fileId file id to show
279
+     * @return RedirectResponse redirect response or not found response
280
+     * @throws \OCP\Files\NotFoundException
281
+     */
282
+    private function showFile($fileId) {
283
+        $uid = $this->userSession->getUser()->getUID();
284
+        $baseFolder = $this->rootFolder->getUserFolder($uid);
285
+        $files = $baseFolder->getById($fileId);
286
+        $params = [];
287
+
288
+        if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
289
+            $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
290
+            $files = $baseFolder->getById($fileId);
291
+            $params['view'] = 'trashbin';
292
+        }
293
+
294
+        if (!empty($files)) {
295
+            $file = current($files);
296
+            if ($file instanceof Folder) {
297
+                // set the full path to enter the folder
298
+                $params['dir'] = $baseFolder->getRelativePath($file->getPath());
299
+            } else {
300
+                // set parent path as dir
301
+                $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
302
+                // and scroll to the entry
303
+                $params['scrollto'] = $file->getName();
304
+            }
305
+            return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
306
+        }
307
+        throw new \OCP\Files\NotFoundException();
308
+    }
309 309
 }
Please login to merge, or discard this patch.
apps/files/lib/AppInfo/Application.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -35,69 +35,69 @@
 block discarded – undo
35 35
 use OCA\Files\Capabilities;
36 36
 
37 37
 class Application extends App {
38
-	public function __construct(array $urlParams=array()) {
39
-		parent::__construct('files', $urlParams);
40
-		$container = $this->getContainer();
41
-		$server = $container->getServer();
38
+    public function __construct(array $urlParams=array()) {
39
+        parent::__construct('files', $urlParams);
40
+        $container = $this->getContainer();
41
+        $server = $container->getServer();
42 42
 
43
-		/**
44
-		 * Controllers
45
-		 */
46
-		$container->registerService('APIController', function (IContainer $c) use ($server) {
47
-			return new ApiController(
48
-				$c->query('AppName'),
49
-				$c->query('Request'),
50
-				$server->getUserSession(),
51
-				$c->query('TagService'),
52
-				$server->getPreviewManager(),
53
-				$server->getShareManager(),
54
-				$server->getConfig(),
55
-				$server->getUserFolder()
56
-			);
57
-		});
43
+        /**
44
+         * Controllers
45
+         */
46
+        $container->registerService('APIController', function (IContainer $c) use ($server) {
47
+            return new ApiController(
48
+                $c->query('AppName'),
49
+                $c->query('Request'),
50
+                $server->getUserSession(),
51
+                $c->query('TagService'),
52
+                $server->getPreviewManager(),
53
+                $server->getShareManager(),
54
+                $server->getConfig(),
55
+                $server->getUserFolder()
56
+            );
57
+        });
58 58
 
59
-		$container->registerService('ViewController', function (IContainer $c) use ($server) {
60
-			return new ViewController(
61
-				$c->query('AppName'),
62
-				$c->query('Request'),
63
-				$server->getURLGenerator(),
64
-				$c->query('L10N'),
65
-				$server->getConfig(),
66
-				$server->getEventDispatcher(),
67
-				$server->getUserSession(),
68
-				$server->getAppManager(),
69
-				$server->getRootFolder(),
70
-				$c->query(Helper::class)
71
-			);
72
-		});
59
+        $container->registerService('ViewController', function (IContainer $c) use ($server) {
60
+            return new ViewController(
61
+                $c->query('AppName'),
62
+                $c->query('Request'),
63
+                $server->getURLGenerator(),
64
+                $c->query('L10N'),
65
+                $server->getConfig(),
66
+                $server->getEventDispatcher(),
67
+                $server->getUserSession(),
68
+                $server->getAppManager(),
69
+                $server->getRootFolder(),
70
+                $c->query(Helper::class)
71
+            );
72
+        });
73 73
 
74
-		/**
75
-		 * Core
76
-		 */
77
-		$container->registerService('L10N', function(IContainer $c) {
78
-			return $c->query('ServerContainer')->getL10N($c->query('AppName'));
79
-		});
74
+        /**
75
+         * Core
76
+         */
77
+        $container->registerService('L10N', function(IContainer $c) {
78
+            return $c->query('ServerContainer')->getL10N($c->query('AppName'));
79
+        });
80 80
 
81
-		/**
82
-		 * Services
83
-		 */
84
-		$container->registerService('Tagger', function(IContainer $c)  {
85
-			return $c->query('ServerContainer')->getTagManager()->load('files');
86
-		});
87
-		$container->registerService('TagService', function(IContainer $c) use ($server) {
88
-			$homeFolder = $c->query('ServerContainer')->getUserFolder();
89
-			return new TagService(
90
-				$c->query('ServerContainer')->getUserSession(),
91
-				$c->query('ServerContainer')->getActivityManager(),
92
-				$c->query('Tagger'),
93
-				$homeFolder,
94
-				$server->getEventDispatcher()
95
-			);
96
-		});
81
+        /**
82
+         * Services
83
+         */
84
+        $container->registerService('Tagger', function(IContainer $c)  {
85
+            return $c->query('ServerContainer')->getTagManager()->load('files');
86
+        });
87
+        $container->registerService('TagService', function(IContainer $c) use ($server) {
88
+            $homeFolder = $c->query('ServerContainer')->getUserFolder();
89
+            return new TagService(
90
+                $c->query('ServerContainer')->getUserSession(),
91
+                $c->query('ServerContainer')->getActivityManager(),
92
+                $c->query('Tagger'),
93
+                $homeFolder,
94
+                $server->getEventDispatcher()
95
+            );
96
+        });
97 97
 
98
-		/*
98
+        /*
99 99
 		 * Register capabilities
100 100
 		 */
101
-		$container->registerCapability(Capabilities::class);
102
-	}
101
+        $container->registerCapability(Capabilities::class);
102
+    }
103 103
 }
Please login to merge, or discard this patch.
apps/files/templates/appnavigation.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
3 3
 
4 4
 		<?php
5 5
 
6
-		$pinned = 0;
7
-		foreach ($_['navigationItems'] as $item) {
8
-			$pinned = NavigationListElements($item, $l, $pinned);
9
-		}
10
-		?>
6
+        $pinned = 0;
7
+        foreach ($_['navigationItems'] as $item) {
8
+            $pinned = NavigationListElements($item, $l, $pinned);
9
+        }
10
+        ?>
11 11
 
12 12
 		<li id="quota"
13 13
 			class="pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?><?php
14
-			if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
15
-			?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
16
-		} ?>">
14
+            if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
15
+            ?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
16
+        } ?>">
17 17
 			<a href="#" class="icon-quota svg">
18 18
 				<p id="quotatext"><?php
19
-					if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
20
-						p($l->t('%s of %s used', [$_['usage'], $_['total_space']]));
21
-					} else {
22
-						p($l->t('%s used', [$_['usage']]));
23
-					} ?></p>
19
+                    if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
20
+                        p($l->t('%s of %s used', [$_['usage'], $_['total_space']]));
21
+                    } else {
22
+                        p($l->t('%s used', [$_['usage']]));
23
+                    } ?></p>
24 24
 				<div class="quota-container">
25 25
 					<progress value="<?php p($_['usage_relative']); ?>"
26 26
 							  max="100"
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  * @return int Returns the pinned value
65 65
  */
66 66
 function NavigationListElements($item, $l, $pinned) {
67
-	strpos($item['classes'], 'pinned') !== false ? $pinned++ : '';
68
-	?>
67
+    strpos($item['classes'], 'pinned') !== false ? $pinned++ : '';
68
+    ?>
69 69
 	<li <?php if (isset($item['sublist'])){ ?>id="button-collapse-parent-<?php p($item['id']); ?>"<?php } ?>
70 70
 		data-id="<?php p($item['id']) ?>" data-dir="<?php p($item['dir']) ?>" data-view="<?php p($item['view']) ?>"
71 71
 		class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned === 1 ? 'first-pinned' : '') ?> <?php if ($item['defaultExpandedState']) { ?> open<?php } ?>"
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
 
77 77
 
78 78
 		<?php
79
-		NavigationElementMenu($item);
80
-		if (isset($item['sublist'])) {
81
-			?>
79
+        NavigationElementMenu($item);
80
+        if (isset($item['sublist'])) {
81
+            ?>
82 82
 			<button id="button-collapse-<?php p($item['id']); ?>"
83 83
 					class="collapse app-navigation-noclose" <?php if (sizeof($item['sublist']) == 0) { ?> style="display: none" <?php } ?>></button>
84 84
 			<ul id="sublist-<?php p($item['id']); ?>">
85 85
 				<?php
86
-				foreach ($item['sublist'] as $item) {
87
-					$pinned = NavigationListElements($item, $l, $pinned);
88
-				}
89
-				?>
86
+                foreach ($item['sublist'] as $item) {
87
+                    $pinned = NavigationListElements($item, $l, $pinned);
88
+                }
89
+                ?>
90 90
 			</ul>
91 91
 		<?php } ?>
92 92
 	</li>
93 93
 
94 94
 
95 95
 	<?php
96
-	return $pinned;
96
+    return $pinned;
97 97
 }
98 98
 
99 99
 /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
  * @return void
105 105
  */
106 106
 function NavigationElementMenu($item) {
107
-	if ($item['menubuttons'] === 'true') {
108
-		?>
107
+    if ($item['menubuttons'] === 'true') {
108
+        ?>
109 109
 		<div id="dotmenu-<?php p($item['id']); ?>"
110 110
 			 class="app-navigation-entry-utils" <?php if ($item['enableMenuButton'] === 0) { ?> style="display: none"<?php } ?>>
111 111
 			<ul>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 		<li id="quota"
13 13
 			class="pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?><?php
14 14
 			if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
15
-			?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
15
+			?>has-tooltip" title="<?php p($_['usage_relative'].'%');
16 16
 		} ?>">
17 17
 			<a href="#" class="icon-quota svg">
18 18
 				<p id="quotatext"><?php
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 function NavigationListElements($item, $l, $pinned) {
67 67
 	strpos($item['classes'], 'pinned') !== false ? $pinned++ : '';
68 68
 	?>
69
-	<li <?php if (isset($item['sublist'])){ ?>id="button-collapse-parent-<?php p($item['id']); ?>"<?php } ?>
69
+	<li <?php if (isset($item['sublist'])) { ?>id="button-collapse-parent-<?php p($item['id']); ?>"<?php } ?>
70 70
 		data-id="<?php p($item['id']) ?>" data-dir="<?php p($item['dir']) ?>" data-view="<?php p($item['view']) ?>"
71 71
 		class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned === 1 ? 'first-pinned' : '') ?> <?php if ($item['defaultExpandedState']) { ?> open<?php } ?>"
72 72
 		<?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>
Please login to merge, or discard this patch.
apps/files/appinfo/routes.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -31,118 +31,118 @@
 block discarded – undo
31 31
 
32 32
 $application = new Application();
33 33
 $application->registerRoutes(
34
-	$this,
35
-	[
36
-		'routes' => [
37
-			[
38
-				'name' => 'API#getThumbnail',
39
-				'url' => '/api/v1/thumbnail/{x}/{y}/{file}',
40
-				'verb' => 'GET',
41
-				'requirements' => ['file' => '.+']
42
-			],
43
-			[
44
-				'name' => 'API#updateFileTags',
45
-				'url' => '/api/v1/files/{path}',
46
-				'verb' => 'POST',
47
-				'requirements' => ['path' => '.+'],
48
-			],
49
-			[
50
-				'name' => 'API#getRecentFiles',
51
-				'url' => '/api/v1/recent/',
52
-				'verb' => 'GET'
53
-			],
54
-			[
55
-				'name' => 'API#updateFileSorting',
56
-				'url' => '/api/v1/sorting',
57
-				'verb' => 'POST'
58
-			],
59
-			[
60
-				'name' => 'API#showHiddenFiles',
61
-				'url' => '/api/v1/showhidden',
62
-				'verb' => 'POST'
63
-			],
64
-			[
65
-				'name' => 'view#index',
66
-				'url' => '/',
67
-				'verb' => 'GET',
68
-			],
69
-			[
70
-				'name' => 'settings#setMaxUploadSize',
71
-				'url' => '/settings/maxUpload',
72
-				'verb' => 'POST',
73
-			],
74
-			[
75
-				'name' => 'ajax#getStorageStats',
76
-				'url' => '/ajax/getstoragestats.php',
77
-				'verb' => 'GET',
78
-			],
79
-			[
80
-				'name' => 'API#showQuickAccess',
81
-				'url' => '/api/v1/quickaccess/set/showList',
82
-				'verb' => 'GET',
83
-			],
84
-			[
85
-				'name' => 'API#getShowQuickAccess',
86
-				'url' => '/api/v1/quickaccess/get/showList',
87
-				'verb' => 'GET',
88
-			],
89
-			[
90
-				'name' => 'API#getShowQuickaccessSettings',
91
-				'url' => '/api/v1/quickaccess/showsettings',
92
-				'verb' => 'GET',
93
-			],
94
-			[
95
-				'name' => 'API#setShowQuickaccessSettings',
96
-				'url' => '/api/v1/quickaccess/set/showsettings',
97
-				'verb' => 'GET',
98
-			],
99
-			[
100
-				'name' => 'API#setSortingStrategy',
101
-				'url' => '/api/v1/quickaccess/set/SortingStrategy',
102
-				'verb' => 'GET',
103
-			],
104
-			[
105
-				'name' => 'API#setReverseQuickaccess',
106
-				'url' => '/api/v1/quickaccess/set/ReverseList',
107
-				'verb' => 'GET',
108
-			],
109
-			[
110
-				'name' => 'API#getSortingStrategy',
111
-				'url' => '/api/v1/quickaccess/get/SortingStrategy',
112
-				'verb' => 'GET',
113
-			],
114
-			[
115
-				'name' => 'API#getReverseQuickaccess',
116
-				'url' => '/api/v1/quickaccess/get/ReverseList',
117
-				'verb' => 'GET',
118
-			],
119
-			[
120
-				'name' => 'API#getFavoritesFolder',
121
-				'url' => '/api/v1/quickaccess/get/FavoriteFolders/',
122
-				'verb' => 'GET'
123
-			],
124
-			[
125
-				'name' => 'API#setSortingOrder',
126
-				'url' => '/api/v1/quickaccess/set/CustomSortingOrder',
127
-				'verb' => 'GET',
128
-			],
129
-			[
130
-				'name' => 'API#getSortingOrder',
131
-				'url' => '/api/v1/quickaccess/get/CustomSortingOrder',
132
-				'verb' => 'GET',
133
-			],
134
-			[
135
-				'name' => 'API#getNodeType',
136
-				'url' => '/api/v1/quickaccess/get/NodeType',
137
-				'verb' => 'GET',
138
-			],
139
-		]
140
-	]
34
+    $this,
35
+    [
36
+        'routes' => [
37
+            [
38
+                'name' => 'API#getThumbnail',
39
+                'url' => '/api/v1/thumbnail/{x}/{y}/{file}',
40
+                'verb' => 'GET',
41
+                'requirements' => ['file' => '.+']
42
+            ],
43
+            [
44
+                'name' => 'API#updateFileTags',
45
+                'url' => '/api/v1/files/{path}',
46
+                'verb' => 'POST',
47
+                'requirements' => ['path' => '.+'],
48
+            ],
49
+            [
50
+                'name' => 'API#getRecentFiles',
51
+                'url' => '/api/v1/recent/',
52
+                'verb' => 'GET'
53
+            ],
54
+            [
55
+                'name' => 'API#updateFileSorting',
56
+                'url' => '/api/v1/sorting',
57
+                'verb' => 'POST'
58
+            ],
59
+            [
60
+                'name' => 'API#showHiddenFiles',
61
+                'url' => '/api/v1/showhidden',
62
+                'verb' => 'POST'
63
+            ],
64
+            [
65
+                'name' => 'view#index',
66
+                'url' => '/',
67
+                'verb' => 'GET',
68
+            ],
69
+            [
70
+                'name' => 'settings#setMaxUploadSize',
71
+                'url' => '/settings/maxUpload',
72
+                'verb' => 'POST',
73
+            ],
74
+            [
75
+                'name' => 'ajax#getStorageStats',
76
+                'url' => '/ajax/getstoragestats.php',
77
+                'verb' => 'GET',
78
+            ],
79
+            [
80
+                'name' => 'API#showQuickAccess',
81
+                'url' => '/api/v1/quickaccess/set/showList',
82
+                'verb' => 'GET',
83
+            ],
84
+            [
85
+                'name' => 'API#getShowQuickAccess',
86
+                'url' => '/api/v1/quickaccess/get/showList',
87
+                'verb' => 'GET',
88
+            ],
89
+            [
90
+                'name' => 'API#getShowQuickaccessSettings',
91
+                'url' => '/api/v1/quickaccess/showsettings',
92
+                'verb' => 'GET',
93
+            ],
94
+            [
95
+                'name' => 'API#setShowQuickaccessSettings',
96
+                'url' => '/api/v1/quickaccess/set/showsettings',
97
+                'verb' => 'GET',
98
+            ],
99
+            [
100
+                'name' => 'API#setSortingStrategy',
101
+                'url' => '/api/v1/quickaccess/set/SortingStrategy',
102
+                'verb' => 'GET',
103
+            ],
104
+            [
105
+                'name' => 'API#setReverseQuickaccess',
106
+                'url' => '/api/v1/quickaccess/set/ReverseList',
107
+                'verb' => 'GET',
108
+            ],
109
+            [
110
+                'name' => 'API#getSortingStrategy',
111
+                'url' => '/api/v1/quickaccess/get/SortingStrategy',
112
+                'verb' => 'GET',
113
+            ],
114
+            [
115
+                'name' => 'API#getReverseQuickaccess',
116
+                'url' => '/api/v1/quickaccess/get/ReverseList',
117
+                'verb' => 'GET',
118
+            ],
119
+            [
120
+                'name' => 'API#getFavoritesFolder',
121
+                'url' => '/api/v1/quickaccess/get/FavoriteFolders/',
122
+                'verb' => 'GET'
123
+            ],
124
+            [
125
+                'name' => 'API#setSortingOrder',
126
+                'url' => '/api/v1/quickaccess/set/CustomSortingOrder',
127
+                'verb' => 'GET',
128
+            ],
129
+            [
130
+                'name' => 'API#getSortingOrder',
131
+                'url' => '/api/v1/quickaccess/get/CustomSortingOrder',
132
+                'verb' => 'GET',
133
+            ],
134
+            [
135
+                'name' => 'API#getNodeType',
136
+                'url' => '/api/v1/quickaccess/get/NodeType',
137
+                'verb' => 'GET',
138
+            ],
139
+        ]
140
+    ]
141 141
 );
142 142
 
143 143
 /** @var $this \OC\Route\Router */
144 144
 
145 145
 $this->create('files_ajax_download', 'ajax/download.php')
146
-	->actionInclude('files/ajax/download.php');
146
+    ->actionInclude('files/ajax/download.php');
147 147
 $this->create('files_ajax_list', 'ajax/list.php')
148
-	->actionInclude('files/ajax/list.php');
148
+    ->actionInclude('files/ajax/list.php');
Please login to merge, or discard this patch.