Passed
Push — master ( ff58cd...f7cca5 )
by John
17:34 queued 12s
created
apps/files/lib/Service/ViewConfig.php 1 patch
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -28,157 +28,157 @@
 block discarded – undo
28 28
 use OCP\IUserSession;
29 29
 
30 30
 class ViewConfig {
31
-	const CONFIG_KEY = 'files_views_configs';
32
-	const ALLOWED_CONFIGS = [
33
-		[
34
-			// The default sorting key for the files list view
35
-			'key' => 'sorting_mode',
36
-			// null by default as views can provide default sorting key
37
-			// and will fallback to it if user hasn't change it
38
-			'default' => null,
39
-		],
40
-		[
41
-			// The default sorting direction for the files list view
42
-			'key' => 'sorting_direction',
43
-			'default' => 'asc',
44
-			'allowed' => ['asc', 'desc'],
45
-		],
46
-		[
47
-			// If the navigation entry for this view is expanded or not
48
-			'key' => 'expanded',
49
-			'default' => true,
50
-			'allowed' => [true, false],
51
-		],
52
-	];
53
-
54
-	protected IConfig $config;
55
-	protected ?IUser $user = null;
56
-
57
-	public function __construct(IConfig $config, IUserSession $userSession) {
58
-		$this->config = $config;
59
-		$this->user = $userSession->getUser();
60
-	}
61
-
62
-	/**
63
-	 * Get the list of all allowed user config keys
64
-	 * @return string[]
65
-	 */
66
-	public function getAllowedConfigKeys(): array {
67
-		return array_map(function($config) {
68
-			return $config['key'];
69
-		}, self::ALLOWED_CONFIGS);
70
-	}
71
-
72
-	/**
73
-	 * Get the list of allowed config values for a given key
74
-	 *
75
-	 * @param string $key a valid config key
76
-	 * @return array
77
-	 */
78
-	private function getAllowedConfigValues(string $key): array {
79
-		foreach (self::ALLOWED_CONFIGS as $config) {
80
-			if ($config['key'] === $key) {
81
-				return $config['allowed'] ?? [];
82
-			}
83
-		}
84
-		return [];
85
-	}
86
-
87
-	/**
88
-	 * Get the default config value for a given key
89
-	 *
90
-	 * @param string $key a valid config key
91
-	 * @return string|bool|null
92
-	 */
93
-	private function getDefaultConfigValue(string $key) {
94
-		foreach (self::ALLOWED_CONFIGS as $config) {
95
-			if ($config['key'] === $key) {
96
-				return $config['default'];
97
-			}
98
-		}
99
-		return '';
100
-	}
101
-
102
-	/**
103
-	 * Set a user config
104
-	 *
105
-	 * @param string $view
106
-	 * @param string $key
107
-	 * @param string|bool $value
108
-	 * @throws \Exception
109
-	 * @throws \InvalidArgumentException
110
-	 */
111
-	public function setConfig(string $view, string $key, $value): void {
112
-		if ($this->user === null) {
113
-			throw new \Exception('No user logged in');
114
-		}
115
-
116
-		if (!$view) {
117
-			throw new \Exception('Unknown view');
118
-		}
119
-
120
-		if (!in_array($key, $this->getAllowedConfigKeys())) {
121
-			throw new \InvalidArgumentException('Unknown config key');
122
-		}
31
+    const CONFIG_KEY = 'files_views_configs';
32
+    const ALLOWED_CONFIGS = [
33
+        [
34
+            // The default sorting key for the files list view
35
+            'key' => 'sorting_mode',
36
+            // null by default as views can provide default sorting key
37
+            // and will fallback to it if user hasn't change it
38
+            'default' => null,
39
+        ],
40
+        [
41
+            // The default sorting direction for the files list view
42
+            'key' => 'sorting_direction',
43
+            'default' => 'asc',
44
+            'allowed' => ['asc', 'desc'],
45
+        ],
46
+        [
47
+            // If the navigation entry for this view is expanded or not
48
+            'key' => 'expanded',
49
+            'default' => true,
50
+            'allowed' => [true, false],
51
+        ],
52
+    ];
53
+
54
+    protected IConfig $config;
55
+    protected ?IUser $user = null;
56
+
57
+    public function __construct(IConfig $config, IUserSession $userSession) {
58
+        $this->config = $config;
59
+        $this->user = $userSession->getUser();
60
+    }
61
+
62
+    /**
63
+     * Get the list of all allowed user config keys
64
+     * @return string[]
65
+     */
66
+    public function getAllowedConfigKeys(): array {
67
+        return array_map(function($config) {
68
+            return $config['key'];
69
+        }, self::ALLOWED_CONFIGS);
70
+    }
71
+
72
+    /**
73
+     * Get the list of allowed config values for a given key
74
+     *
75
+     * @param string $key a valid config key
76
+     * @return array
77
+     */
78
+    private function getAllowedConfigValues(string $key): array {
79
+        foreach (self::ALLOWED_CONFIGS as $config) {
80
+            if ($config['key'] === $key) {
81
+                return $config['allowed'] ?? [];
82
+            }
83
+        }
84
+        return [];
85
+    }
86
+
87
+    /**
88
+     * Get the default config value for a given key
89
+     *
90
+     * @param string $key a valid config key
91
+     * @return string|bool|null
92
+     */
93
+    private function getDefaultConfigValue(string $key) {
94
+        foreach (self::ALLOWED_CONFIGS as $config) {
95
+            if ($config['key'] === $key) {
96
+                return $config['default'];
97
+            }
98
+        }
99
+        return '';
100
+    }
101
+
102
+    /**
103
+     * Set a user config
104
+     *
105
+     * @param string $view
106
+     * @param string $key
107
+     * @param string|bool $value
108
+     * @throws \Exception
109
+     * @throws \InvalidArgumentException
110
+     */
111
+    public function setConfig(string $view, string $key, $value): void {
112
+        if ($this->user === null) {
113
+            throw new \Exception('No user logged in');
114
+        }
115
+
116
+        if (!$view) {
117
+            throw new \Exception('Unknown view');
118
+        }
119
+
120
+        if (!in_array($key, $this->getAllowedConfigKeys())) {
121
+            throw new \InvalidArgumentException('Unknown config key');
122
+        }
123 123
 	
124
-		if (!in_array($value, $this->getAllowedConfigValues($key))
125
-			&& !empty($this->getAllowedConfigValues($key))) {
126
-			throw new \InvalidArgumentException('Invalid config value');
127
-		}
128
-
129
-		// Cast boolean values
130
-		if (is_bool($this->getDefaultConfigValue($key))) {
131
-			$value = $value === '1';
132
-		}
133
-
134
-		$config = $this->getConfigs();
135
-		$config[$view][$key] = $value;
136
-
137
-		$this->config->setUserValue($this->user->getUID(), Application::APP_ID, self::CONFIG_KEY, json_encode($config));
138
-	}
139
-
140
-	/**
141
-	 * Get the current user configs array for a given view
142
-	 *
143
-	 * @return array
144
-	 */
145
-	public function getConfig(string $view): array {
146
-		if ($this->user === null) {
147
-			throw new \Exception('No user logged in');
148
-		}
149
-
150
-		$userId = $this->user->getUID();
151
-		$configs = json_decode($this->config->getUserValue($userId, Application::APP_ID, self::CONFIG_KEY, '[]'), true);
124
+        if (!in_array($value, $this->getAllowedConfigValues($key))
125
+            && !empty($this->getAllowedConfigValues($key))) {
126
+            throw new \InvalidArgumentException('Invalid config value');
127
+        }
128
+
129
+        // Cast boolean values
130
+        if (is_bool($this->getDefaultConfigValue($key))) {
131
+            $value = $value === '1';
132
+        }
133
+
134
+        $config = $this->getConfigs();
135
+        $config[$view][$key] = $value;
136
+
137
+        $this->config->setUserValue($this->user->getUID(), Application::APP_ID, self::CONFIG_KEY, json_encode($config));
138
+    }
139
+
140
+    /**
141
+     * Get the current user configs array for a given view
142
+     *
143
+     * @return array
144
+     */
145
+    public function getConfig(string $view): array {
146
+        if ($this->user === null) {
147
+            throw new \Exception('No user logged in');
148
+        }
149
+
150
+        $userId = $this->user->getUID();
151
+        $configs = json_decode($this->config->getUserValue($userId, Application::APP_ID, self::CONFIG_KEY, '[]'), true);
152 152
 		
153
-		if (!isset($configs[$view])) {
154
-			$configs[$view] = [];
155
-		}
156
-
157
-		// Extend undefined values with defaults
158
-		return array_reduce(self::ALLOWED_CONFIGS, function($carry, $config) use ($view, $configs) {
159
-			$key = $config['key'];
160
-			$carry[$key] = $configs[$view][$key] ?? $this->getDefaultConfigValue($key);
161
-			return $carry;
162
-		}, []);
163
-	}
164
-
165
-	/**
166
-	 * Get the current user configs array
167
-	 *
168
-	 * @return array
169
-	 */
170
-	public function getConfigs(): array {
171
-		if ($this->user === null) {
172
-			throw new \Exception('No user logged in');
173
-		}
174
-
175
-		$userId = $this->user->getUID();
176
-		$configs = json_decode($this->config->getUserValue($userId, Application::APP_ID, self::CONFIG_KEY, '[]'), true);
177
-		$views = array_keys($configs);
153
+        if (!isset($configs[$view])) {
154
+            $configs[$view] = [];
155
+        }
156
+
157
+        // Extend undefined values with defaults
158
+        return array_reduce(self::ALLOWED_CONFIGS, function($carry, $config) use ($view, $configs) {
159
+            $key = $config['key'];
160
+            $carry[$key] = $configs[$view][$key] ?? $this->getDefaultConfigValue($key);
161
+            return $carry;
162
+        }, []);
163
+    }
164
+
165
+    /**
166
+     * Get the current user configs array
167
+     *
168
+     * @return array
169
+     */
170
+    public function getConfigs(): array {
171
+        if ($this->user === null) {
172
+            throw new \Exception('No user logged in');
173
+        }
174
+
175
+        $userId = $this->user->getUID();
176
+        $configs = json_decode($this->config->getUserValue($userId, Application::APP_ID, self::CONFIG_KEY, '[]'), true);
177
+        $views = array_keys($configs);
178 178
 		
179
-		return array_reduce($views, function($carry, $view) use ($configs) {
180
-			$carry[$view] = $this->getConfig($view);
181
-			return $carry;
182
-		}, []);
183
-	}
179
+        return array_reduce($views, function($carry, $view) use ($configs) {
180
+            $carry[$view] = $this->getConfig($view);
181
+            return $carry;
182
+        }, []);
183
+    }
184 184
 }
Please login to merge, or discard this patch.
apps/files/lib/AppInfo/Application.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -70,120 +70,120 @@
 block discarded – undo
70 70
 use Psr\Container\ContainerInterface;
71 71
 
72 72
 class Application extends App implements IBootstrap {
73
-	public const APP_ID = 'files';
74
-
75
-	public function __construct(array $urlParams = []) {
76
-		parent::__construct(self::APP_ID, $urlParams);
77
-	}
78
-
79
-	public function register(IRegistrationContext $context): void {
80
-		/**
81
-		 * Controllers
82
-		 */
83
-		$context->registerService('APIController', function (ContainerInterface $c) {
84
-			/** @var IServerContainer $server */
85
-			$server = $c->get(IServerContainer::class);
86
-
87
-			return new ApiController(
88
-				$c->get('AppName'),
89
-				$c->get(IRequest::class),
90
-				$c->get(IUserSession::class),
91
-				$c->get(TagService::class),
92
-				$c->get(IPreview::class),
93
-				$c->get(IShareManager::class),
94
-				$c->get(IConfig::class),
95
-				$server->getUserFolder(),
96
-				$c->get(UserConfig::class),
97
-				$c->get(ViewConfig::class),
98
-			);
99
-		});
100
-
101
-		/**
102
-		 * Services
103
-		 */
104
-		$context->registerService(TagService::class, function (ContainerInterface $c) {
105
-			/** @var IServerContainer $server */
106
-			$server = $c->get(IServerContainer::class);
107
-
108
-			return new TagService(
109
-				$c->get(IUserSession::class),
110
-				$c->get(IActivityManager::class),
111
-				$c->get(ITagManager::class)->load(self::APP_ID),
112
-				$server->getUserFolder(),
113
-				$server->getEventDispatcher()
114
-			);
115
-		});
116
-
117
-		/*
73
+    public const APP_ID = 'files';
74
+
75
+    public function __construct(array $urlParams = []) {
76
+        parent::__construct(self::APP_ID, $urlParams);
77
+    }
78
+
79
+    public function register(IRegistrationContext $context): void {
80
+        /**
81
+         * Controllers
82
+         */
83
+        $context->registerService('APIController', function (ContainerInterface $c) {
84
+            /** @var IServerContainer $server */
85
+            $server = $c->get(IServerContainer::class);
86
+
87
+            return new ApiController(
88
+                $c->get('AppName'),
89
+                $c->get(IRequest::class),
90
+                $c->get(IUserSession::class),
91
+                $c->get(TagService::class),
92
+                $c->get(IPreview::class),
93
+                $c->get(IShareManager::class),
94
+                $c->get(IConfig::class),
95
+                $server->getUserFolder(),
96
+                $c->get(UserConfig::class),
97
+                $c->get(ViewConfig::class),
98
+            );
99
+        });
100
+
101
+        /**
102
+         * Services
103
+         */
104
+        $context->registerService(TagService::class, function (ContainerInterface $c) {
105
+            /** @var IServerContainer $server */
106
+            $server = $c->get(IServerContainer::class);
107
+
108
+            return new TagService(
109
+                $c->get(IUserSession::class),
110
+                $c->get(IActivityManager::class),
111
+                $c->get(ITagManager::class)->load(self::APP_ID),
112
+                $server->getUserFolder(),
113
+                $server->getEventDispatcher()
114
+            );
115
+        });
116
+
117
+        /*
118 118
 		 * Register capabilities
119 119
 		 */
120
-		$context->registerCapability(Capabilities::class);
121
-		$context->registerCapability(DirectEditingCapabilities::class);
122
-
123
-		$context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class);
124
-		$context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class);
125
-		$context->registerEventListener(RenderReferenceEvent::class, RenderReferenceEventListener::class);
126
-
127
-		$context->registerSearchProvider(FilesSearchProvider::class);
128
-
129
-		$context->registerNotifierService(Notifier::class);
130
-	}
131
-
132
-	public function boot(IBootContext $context): void {
133
-		$context->injectFn(Closure::fromCallable([$this, 'registerCollaboration']));
134
-		$context->injectFn([Listener::class, 'register']);
135
-		$context->injectFn(Closure::fromCallable([$this, 'registerSearchProvider']));
136
-		$this->registerTemplates();
137
-		$context->injectFn(Closure::fromCallable([$this, 'registerNavigation']));
138
-		$this->registerHooks();
139
-	}
140
-
141
-	private function registerCollaboration(IProviderManager $providerManager): void {
142
-		$providerManager->registerResourceProvider(ResourceProvider::class);
143
-	}
144
-
145
-	private function registerSearchProvider(ISearch $search): void {
146
-		$search->registerProvider(File::class, ['apps' => ['files']]);
147
-	}
148
-
149
-	private function registerTemplates(): void {
150
-		$templateManager = \OC_Helper::getFileTemplateManager();
151
-		$templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp');
152
-		$templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt');
153
-		$templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
154
-	}
155
-
156
-	private function registerNavigation(IL10N $l10n): void {
157
-		\OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
158
-			return [
159
-				'id' => 'files',
160
-				'appname' => 'files',
161
-				'script' => 'list.php',
162
-				'order' => 0,
163
-				'name' => $l10n->t('All files')
164
-			];
165
-		});
166
-		\OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
167
-			return [
168
-				'id' => 'recent',
169
-				'appname' => 'files',
170
-				'script' => 'recentlist.php',
171
-				'order' => 2,
172
-				'name' => $l10n->t('Recent')
173
-			];
174
-		});
175
-		\OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
176
-			return [
177
-				'id' => 'favorites',
178
-				'appname' => 'files',
179
-				'script' => 'simplelist.php',
180
-				'order' => 5,
181
-				'name' => $l10n->t('Favorites'),
182
-			];
183
-		});
184
-	}
185
-
186
-	private function registerHooks(): void {
187
-		Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig');
188
-	}
120
+        $context->registerCapability(Capabilities::class);
121
+        $context->registerCapability(DirectEditingCapabilities::class);
122
+
123
+        $context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class);
124
+        $context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class);
125
+        $context->registerEventListener(RenderReferenceEvent::class, RenderReferenceEventListener::class);
126
+
127
+        $context->registerSearchProvider(FilesSearchProvider::class);
128
+
129
+        $context->registerNotifierService(Notifier::class);
130
+    }
131
+
132
+    public function boot(IBootContext $context): void {
133
+        $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration']));
134
+        $context->injectFn([Listener::class, 'register']);
135
+        $context->injectFn(Closure::fromCallable([$this, 'registerSearchProvider']));
136
+        $this->registerTemplates();
137
+        $context->injectFn(Closure::fromCallable([$this, 'registerNavigation']));
138
+        $this->registerHooks();
139
+    }
140
+
141
+    private function registerCollaboration(IProviderManager $providerManager): void {
142
+        $providerManager->registerResourceProvider(ResourceProvider::class);
143
+    }
144
+
145
+    private function registerSearchProvider(ISearch $search): void {
146
+        $search->registerProvider(File::class, ['apps' => ['files']]);
147
+    }
148
+
149
+    private function registerTemplates(): void {
150
+        $templateManager = \OC_Helper::getFileTemplateManager();
151
+        $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp');
152
+        $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt');
153
+        $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
154
+    }
155
+
156
+    private function registerNavigation(IL10N $l10n): void {
157
+        \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
158
+            return [
159
+                'id' => 'files',
160
+                'appname' => 'files',
161
+                'script' => 'list.php',
162
+                'order' => 0,
163
+                'name' => $l10n->t('All files')
164
+            ];
165
+        });
166
+        \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
167
+            return [
168
+                'id' => 'recent',
169
+                'appname' => 'files',
170
+                'script' => 'recentlist.php',
171
+                'order' => 2,
172
+                'name' => $l10n->t('Recent')
173
+            ];
174
+        });
175
+        \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
176
+            return [
177
+                'id' => 'favorites',
178
+                'appname' => 'files',
179
+                'script' => 'simplelist.php',
180
+                'order' => 5,
181
+                'name' => $l10n->t('Favorites'),
182
+            ];
183
+        });
184
+    }
185
+
186
+    private function registerHooks(): void {
187
+        Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig');
188
+    }
189 189
 }
Please login to merge, or discard this patch.
apps/files/lib/Controller/ViewController.php 1 patch
Indentation   +350 added lines, -350 removed lines patch added patch discarded remove patch
@@ -68,354 +68,354 @@
 block discarded – undo
68 68
  * @package OCA\Files\Controller
69 69
  */
70 70
 class ViewController extends Controller {
71
-	private IURLGenerator $urlGenerator;
72
-	private IL10N $l10n;
73
-	private IConfig $config;
74
-	private IEventDispatcher $eventDispatcher;
75
-	private IUserSession $userSession;
76
-	private IAppManager $appManager;
77
-	private IRootFolder $rootFolder;
78
-	private Helper $activityHelper;
79
-	private IInitialState $initialState;
80
-	private ITemplateManager $templateManager;
81
-	private IManager $shareManager;
82
-	private UserConfig $userConfig;
83
-	private ViewConfig $viewConfig;
84
-
85
-	public function __construct(string $appName,
86
-		IRequest $request,
87
-		IURLGenerator $urlGenerator,
88
-		IL10N $l10n,
89
-		IConfig $config,
90
-		IEventDispatcher $eventDispatcher,
91
-		IUserSession $userSession,
92
-		IAppManager $appManager,
93
-		IRootFolder $rootFolder,
94
-		Helper $activityHelper,
95
-		IInitialState $initialState,
96
-		ITemplateManager $templateManager,
97
-		IManager $shareManager,
98
-		UserConfig $userConfig,
99
-		ViewConfig $viewConfig
100
-	) {
101
-		parent::__construct($appName, $request);
102
-		$this->urlGenerator = $urlGenerator;
103
-		$this->l10n = $l10n;
104
-		$this->config = $config;
105
-		$this->eventDispatcher = $eventDispatcher;
106
-		$this->userSession = $userSession;
107
-		$this->appManager = $appManager;
108
-		$this->rootFolder = $rootFolder;
109
-		$this->activityHelper = $activityHelper;
110
-		$this->initialState = $initialState;
111
-		$this->templateManager = $templateManager;
112
-		$this->shareManager = $shareManager;
113
-		$this->userConfig = $userConfig;
114
-		$this->viewConfig = $viewConfig;
115
-	}
116
-
117
-	/**
118
-	 * @param string $appName
119
-	 * @param string $scriptName
120
-	 * @return string
121
-	 */
122
-	protected function renderScript($appName, $scriptName) {
123
-		$content = '';
124
-		$appPath = \OC_App::getAppPath($appName);
125
-		$scriptPath = $appPath . '/' . $scriptName;
126
-		if (file_exists($scriptPath)) {
127
-			// TODO: sanitize path / script name ?
128
-			ob_start();
129
-			include $scriptPath;
130
-			$content = ob_get_contents();
131
-			@ob_end_clean();
132
-		}
133
-
134
-		return $content;
135
-	}
136
-
137
-	/**
138
-	 * FIXME: Replace with non static code
139
-	 *
140
-	 * @return array
141
-	 * @throws \OCP\Files\NotFoundException
142
-	 */
143
-	protected function getStorageInfo(string $dir = '/') {
144
-		$rootInfo = \OC\Files\Filesystem::getFileInfo('/', false);
145
-
146
-		return \OC_Helper::getStorageInfo($dir, $rootInfo ?: null);
147
-	}
148
-
149
-	/**
150
-	 * @NoCSRFRequired
151
-	 * @NoAdminRequired
152
-	 *
153
-	 * @param string $fileid
154
-	 * @return TemplateResponse|RedirectResponse
155
-	 * @throws NotFoundException
156
-	 */
157
-	public function showFile(string $fileid = null, int $openfile = 1): Response {
158
-		// This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server.
159
-		try {
160
-			return $this->redirectToFile($fileid, $openfile !== 0);
161
-		} catch (NotFoundException $e) {
162
-			return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
163
-		}
164
-	}
165
-
166
-	/**
167
-	 * @NoCSRFRequired
168
-	 * @NoAdminRequired
169
-	 * @UseSession
170
-	 *
171
-	 * @param string $dir
172
-	 * @param string $view
173
-	 * @param string $fileid
174
-	 * @param bool $fileNotFound
175
-	 * @param string $openfile - the openfile URL parameter if it was present in the initial request
176
-	 * @return TemplateResponse|RedirectResponse
177
-	 * @throws NotFoundException
178
-	 */
179
-	public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false, $openfile = null) {
180
-
181
-		if ($fileid !== null && $dir === '') {
182
-			try {
183
-				return $this->redirectToFile($fileid);
184
-			} catch (NotFoundException $e) {
185
-				return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
186
-			}
187
-		}
188
-
189
-		$nav = new \OCP\Template('files', 'appnavigation', '');
190
-
191
-		// Load the files we need
192
-		\OCP\Util::addStyle('files', 'merged');
193
-		\OCP\Util::addScript('files', 'merged-index', 'files');
194
-		\OCP\Util::addScript('files', 'main');
195
-
196
-		$userId = $this->userSession->getUser()->getUID();
197
-
198
-		// Get all the user favorites to create a submenu
199
-		try {
200
-			$favElements = $this->activityHelper->getFavoriteFilePaths($userId);
201
-		} catch (\RuntimeException $e) {
202
-			$favElements['folders'] = [];
203
-		}
204
-
205
-		$collapseClasses = '';
206
-		if (count($favElements['folders']) > 0) {
207
-			$collapseClasses = 'collapsible';
208
-		}
209
-
210
-		$favoritesSublistArray = [];
211
-
212
-		$navBarPositionPosition = 6;
213
-		foreach ($favElements['folders'] as $favElement) {
214
-			$element = [
215
-				'id' => str_replace('/', '-', $favElement),
216
-				'dir' => $favElement,
217
-				'order' => $navBarPositionPosition,
218
-				'name' => basename($favElement),
219
-				'icon' => 'folder',
220
-				'params' => [
221
-					'view' => 'files',
222
-					'dir' => $favElement,
223
-				],
224
-			];
225
-
226
-			array_push($favoritesSublistArray, $element);
227
-			$navBarPositionPosition++;
228
-		}
229
-
230
-		$navItems = \OCA\Files\App::getNavigationManager()->getAll();
231
-
232
-		// add the favorites entry in menu
233
-		$navItems['favorites']['sublist'] = $favoritesSublistArray;
234
-		$navItems['favorites']['classes'] = $collapseClasses;
235
-
236
-		// parse every menu and add the expanded user value
237
-		foreach ($navItems as $key => $item) {
238
-			$navItems[$key]['expanded'] = $this->config->getUserValue($userId, 'files', 'show_' . $item['id'], '0') === '1';
239
-		}
240
-
241
-		$nav->assign('navigationItems', $navItems);
242
-
243
-		$contentItems = [];
244
-
245
-		try {
246
-			// If view is files, we use the directory, otherwise we use the root storage
247
-			$storageInfo =  $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/');
248
-		} catch(\Exception $e) {
249
-			$storageInfo = $this->getStorageInfo();
250
-		}
251
-
252
-		$this->initialState->provideInitialState('storageStats', $storageInfo);
253
-		$this->initialState->provideInitialState('navigation', $navItems);
254
-		$this->initialState->provideInitialState('config', $this->userConfig->getConfigs());
255
-		$this->initialState->provideInitialState('viewConfigs', $this->viewConfig->getConfigs());
256
-
257
-		// File sorting user config
258
-		$filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true);
259
-		$this->initialState->provideInitialState('filesSortingConfig', $filesSortingConfig);
260
-
261
-		// render the container content for every navigation item
262
-		foreach ($navItems as $item) {
263
-			$content = '';
264
-			if (isset($item['script'])) {
265
-				$content = $this->renderScript($item['appname'], $item['script']);
266
-			}
267
-			// parse submenus
268
-			if (isset($item['sublist'])) {
269
-				foreach ($item['sublist'] as $subitem) {
270
-					$subcontent = '';
271
-					if (isset($subitem['script'])) {
272
-						$subcontent = $this->renderScript($subitem['appname'], $subitem['script']);
273
-					}
274
-					$contentItems[$subitem['id']] = [
275
-						'id' => $subitem['id'],
276
-						'content' => $subcontent
277
-					];
278
-				}
279
-			}
280
-			$contentItems[$item['id']] = [
281
-				'id' => $item['id'],
282
-				'content' => $content
283
-			];
284
-		}
285
-
286
-		$this->eventDispatcher->dispatchTyped(new ResourcesLoadAdditionalScriptsEvent());
287
-		$event = new LoadAdditionalScriptsEvent();
288
-		$this->eventDispatcher->dispatchTyped($event);
289
-		$this->eventDispatcher->dispatchTyped(new LoadSidebar());
290
-		// Load Viewer scripts
291
-		if (class_exists(LoadViewer::class)) {
292
-			$this->eventDispatcher->dispatchTyped(new LoadViewer());
293
-		}
294
-
295
-		$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
296
-		$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
297
-
298
-		$params = [];
299
-		$params['usedSpacePercent'] = (int) $storageInfo['relative'];
300
-		$params['owner'] = $storageInfo['owner'] ?? '';
301
-		$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? '';
302
-		$params['isPublic'] = false;
303
-		$params['allowShareWithLink'] = $this->shareManager->shareApiAllowLinks() ? 'yes' : 'no';
304
-		$params['defaultFileSorting'] = $filesSortingConfig['files']['mode'] ?? 'basename';
305
-		$params['defaultFileSortingDirection'] = $filesSortingConfig['files']['direction'] ?? 'asc';
306
-		$params['showgridview'] = $this->config->getUserValue($userId, 'files', 'show_grid', false);
307
-		$showHidden = (bool) $this->config->getUserValue($userId, 'files', 'show_hidden', false);
308
-		$params['showHiddenFiles'] = $showHidden ? 1 : 0;
309
-		$cropImagePreviews = (bool) $this->config->getUserValue($userId, 'files', 'crop_image_previews', true);
310
-		$params['cropImagePreviews'] = $cropImagePreviews ? 1 : 0;
311
-		$params['fileNotFound'] = $fileNotFound ? 1 : 0;
312
-		$params['appNavigation'] = $nav;
313
-		$params['appContents'] = $contentItems;
314
-		$params['hiddenFields'] = $event->getHiddenFields();
315
-
316
-		$response = new TemplateResponse(
317
-			Application::APP_ID,
318
-			'index',
319
-			$params
320
-		);
321
-		$policy = new ContentSecurityPolicy();
322
-		$policy->addAllowedFrameDomain('\'self\'');
323
-		$response->setContentSecurityPolicy($policy);
324
-
325
-		$this->provideInitialState($dir, $openfile);
326
-
327
-		return $response;
328
-	}
329
-
330
-	/**
331
-	 * Add openFileInfo in initialState if $openfile is set.
332
-	 * @param string $dir - the ?dir= URL param
333
-	 * @param string $openfile - the ?openfile= URL param
334
-	 * @return void
335
-	 */
336
-	private function provideInitialState(string $dir, ?string $openfile): void {
337
-		if ($openfile === null) {
338
-			return;
339
-		}
340
-
341
-		$user = $this->userSession->getUser();
342
-
343
-		if ($user === null) {
344
-			return;
345
-		}
346
-
347
-		$uid = $user->getUID();
348
-		$userFolder = $this->rootFolder->getUserFolder($uid);
349
-		$nodes = $userFolder->getById((int) $openfile);
350
-		$node = array_shift($nodes);
351
-
352
-		if ($node === null) {
353
-			return;
354
-		}
355
-
356
-		// properly format full path and make sure
357
-		// we're relative to the user home folder
358
-		$isRoot = $node === $userFolder;
359
-		$path = $userFolder->getRelativePath($node->getPath());
360
-		$directory = $userFolder->getRelativePath($node->getParent()->getPath());
361
-
362
-		// Prevent opening a file from another folder.
363
-		if ($dir !== $directory) {
364
-			return;
365
-		}
366
-
367
-		$this->initialState->provideInitialState(
368
-			'openFileInfo', [
369
-				'id' => $node->getId(),
370
-				'name' => $isRoot ? '' : $node->getName(),
371
-				'path' => $path,
372
-				'directory' => $directory,
373
-				'mime' => $node->getMimetype(),
374
-				'type' => $node->getType(),
375
-				'permissions' => $node->getPermissions(),
376
-			]
377
-		);
378
-	}
379
-
380
-	/**
381
-	 * Redirects to the file list and highlight the given file id
382
-	 *
383
-	 * @param string $fileId file id to show
384
-	 * @param bool $setOpenfile - whether or not to set the openfile URL parameter
385
-	 * @return RedirectResponse redirect response or not found response
386
-	 * @throws \OCP\Files\NotFoundException
387
-	 */
388
-	private function redirectToFile($fileId, bool $setOpenfile = false) {
389
-		$uid = $this->userSession->getUser()->getUID();
390
-		$baseFolder = $this->rootFolder->getUserFolder($uid);
391
-		$files = $baseFolder->getById($fileId);
392
-		$params = [];
393
-
394
-		if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
395
-			$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
396
-			$files = $baseFolder->getById($fileId);
397
-			$params['view'] = 'trashbin';
398
-		}
399
-
400
-		if (!empty($files)) {
401
-			$file = current($files);
402
-			if ($file instanceof Folder) {
403
-				// set the full path to enter the folder
404
-				$params['dir'] = $baseFolder->getRelativePath($file->getPath());
405
-			} else {
406
-				// set parent path as dir
407
-				$params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
408
-				// and scroll to the entry
409
-				$params['scrollto'] = $file->getName();
410
-
411
-				if ($setOpenfile) {
412
-					// forward the openfile URL parameter.
413
-					$params['openfile'] = $fileId;
414
-				}
415
-			}
416
-
417
-			return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
418
-		}
419
-		throw new \OCP\Files\NotFoundException();
420
-	}
71
+    private IURLGenerator $urlGenerator;
72
+    private IL10N $l10n;
73
+    private IConfig $config;
74
+    private IEventDispatcher $eventDispatcher;
75
+    private IUserSession $userSession;
76
+    private IAppManager $appManager;
77
+    private IRootFolder $rootFolder;
78
+    private Helper $activityHelper;
79
+    private IInitialState $initialState;
80
+    private ITemplateManager $templateManager;
81
+    private IManager $shareManager;
82
+    private UserConfig $userConfig;
83
+    private ViewConfig $viewConfig;
84
+
85
+    public function __construct(string $appName,
86
+        IRequest $request,
87
+        IURLGenerator $urlGenerator,
88
+        IL10N $l10n,
89
+        IConfig $config,
90
+        IEventDispatcher $eventDispatcher,
91
+        IUserSession $userSession,
92
+        IAppManager $appManager,
93
+        IRootFolder $rootFolder,
94
+        Helper $activityHelper,
95
+        IInitialState $initialState,
96
+        ITemplateManager $templateManager,
97
+        IManager $shareManager,
98
+        UserConfig $userConfig,
99
+        ViewConfig $viewConfig
100
+    ) {
101
+        parent::__construct($appName, $request);
102
+        $this->urlGenerator = $urlGenerator;
103
+        $this->l10n = $l10n;
104
+        $this->config = $config;
105
+        $this->eventDispatcher = $eventDispatcher;
106
+        $this->userSession = $userSession;
107
+        $this->appManager = $appManager;
108
+        $this->rootFolder = $rootFolder;
109
+        $this->activityHelper = $activityHelper;
110
+        $this->initialState = $initialState;
111
+        $this->templateManager = $templateManager;
112
+        $this->shareManager = $shareManager;
113
+        $this->userConfig = $userConfig;
114
+        $this->viewConfig = $viewConfig;
115
+    }
116
+
117
+    /**
118
+     * @param string $appName
119
+     * @param string $scriptName
120
+     * @return string
121
+     */
122
+    protected function renderScript($appName, $scriptName) {
123
+        $content = '';
124
+        $appPath = \OC_App::getAppPath($appName);
125
+        $scriptPath = $appPath . '/' . $scriptName;
126
+        if (file_exists($scriptPath)) {
127
+            // TODO: sanitize path / script name ?
128
+            ob_start();
129
+            include $scriptPath;
130
+            $content = ob_get_contents();
131
+            @ob_end_clean();
132
+        }
133
+
134
+        return $content;
135
+    }
136
+
137
+    /**
138
+     * FIXME: Replace with non static code
139
+     *
140
+     * @return array
141
+     * @throws \OCP\Files\NotFoundException
142
+     */
143
+    protected function getStorageInfo(string $dir = '/') {
144
+        $rootInfo = \OC\Files\Filesystem::getFileInfo('/', false);
145
+
146
+        return \OC_Helper::getStorageInfo($dir, $rootInfo ?: null);
147
+    }
148
+
149
+    /**
150
+     * @NoCSRFRequired
151
+     * @NoAdminRequired
152
+     *
153
+     * @param string $fileid
154
+     * @return TemplateResponse|RedirectResponse
155
+     * @throws NotFoundException
156
+     */
157
+    public function showFile(string $fileid = null, int $openfile = 1): Response {
158
+        // This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server.
159
+        try {
160
+            return $this->redirectToFile($fileid, $openfile !== 0);
161
+        } catch (NotFoundException $e) {
162
+            return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
163
+        }
164
+    }
165
+
166
+    /**
167
+     * @NoCSRFRequired
168
+     * @NoAdminRequired
169
+     * @UseSession
170
+     *
171
+     * @param string $dir
172
+     * @param string $view
173
+     * @param string $fileid
174
+     * @param bool $fileNotFound
175
+     * @param string $openfile - the openfile URL parameter if it was present in the initial request
176
+     * @return TemplateResponse|RedirectResponse
177
+     * @throws NotFoundException
178
+     */
179
+    public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false, $openfile = null) {
180
+
181
+        if ($fileid !== null && $dir === '') {
182
+            try {
183
+                return $this->redirectToFile($fileid);
184
+            } catch (NotFoundException $e) {
185
+                return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
186
+            }
187
+        }
188
+
189
+        $nav = new \OCP\Template('files', 'appnavigation', '');
190
+
191
+        // Load the files we need
192
+        \OCP\Util::addStyle('files', 'merged');
193
+        \OCP\Util::addScript('files', 'merged-index', 'files');
194
+        \OCP\Util::addScript('files', 'main');
195
+
196
+        $userId = $this->userSession->getUser()->getUID();
197
+
198
+        // Get all the user favorites to create a submenu
199
+        try {
200
+            $favElements = $this->activityHelper->getFavoriteFilePaths($userId);
201
+        } catch (\RuntimeException $e) {
202
+            $favElements['folders'] = [];
203
+        }
204
+
205
+        $collapseClasses = '';
206
+        if (count($favElements['folders']) > 0) {
207
+            $collapseClasses = 'collapsible';
208
+        }
209
+
210
+        $favoritesSublistArray = [];
211
+
212
+        $navBarPositionPosition = 6;
213
+        foreach ($favElements['folders'] as $favElement) {
214
+            $element = [
215
+                'id' => str_replace('/', '-', $favElement),
216
+                'dir' => $favElement,
217
+                'order' => $navBarPositionPosition,
218
+                'name' => basename($favElement),
219
+                'icon' => 'folder',
220
+                'params' => [
221
+                    'view' => 'files',
222
+                    'dir' => $favElement,
223
+                ],
224
+            ];
225
+
226
+            array_push($favoritesSublistArray, $element);
227
+            $navBarPositionPosition++;
228
+        }
229
+
230
+        $navItems = \OCA\Files\App::getNavigationManager()->getAll();
231
+
232
+        // add the favorites entry in menu
233
+        $navItems['favorites']['sublist'] = $favoritesSublistArray;
234
+        $navItems['favorites']['classes'] = $collapseClasses;
235
+
236
+        // parse every menu and add the expanded user value
237
+        foreach ($navItems as $key => $item) {
238
+            $navItems[$key]['expanded'] = $this->config->getUserValue($userId, 'files', 'show_' . $item['id'], '0') === '1';
239
+        }
240
+
241
+        $nav->assign('navigationItems', $navItems);
242
+
243
+        $contentItems = [];
244
+
245
+        try {
246
+            // If view is files, we use the directory, otherwise we use the root storage
247
+            $storageInfo =  $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/');
248
+        } catch(\Exception $e) {
249
+            $storageInfo = $this->getStorageInfo();
250
+        }
251
+
252
+        $this->initialState->provideInitialState('storageStats', $storageInfo);
253
+        $this->initialState->provideInitialState('navigation', $navItems);
254
+        $this->initialState->provideInitialState('config', $this->userConfig->getConfigs());
255
+        $this->initialState->provideInitialState('viewConfigs', $this->viewConfig->getConfigs());
256
+
257
+        // File sorting user config
258
+        $filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true);
259
+        $this->initialState->provideInitialState('filesSortingConfig', $filesSortingConfig);
260
+
261
+        // render the container content for every navigation item
262
+        foreach ($navItems as $item) {
263
+            $content = '';
264
+            if (isset($item['script'])) {
265
+                $content = $this->renderScript($item['appname'], $item['script']);
266
+            }
267
+            // parse submenus
268
+            if (isset($item['sublist'])) {
269
+                foreach ($item['sublist'] as $subitem) {
270
+                    $subcontent = '';
271
+                    if (isset($subitem['script'])) {
272
+                        $subcontent = $this->renderScript($subitem['appname'], $subitem['script']);
273
+                    }
274
+                    $contentItems[$subitem['id']] = [
275
+                        'id' => $subitem['id'],
276
+                        'content' => $subcontent
277
+                    ];
278
+                }
279
+            }
280
+            $contentItems[$item['id']] = [
281
+                'id' => $item['id'],
282
+                'content' => $content
283
+            ];
284
+        }
285
+
286
+        $this->eventDispatcher->dispatchTyped(new ResourcesLoadAdditionalScriptsEvent());
287
+        $event = new LoadAdditionalScriptsEvent();
288
+        $this->eventDispatcher->dispatchTyped($event);
289
+        $this->eventDispatcher->dispatchTyped(new LoadSidebar());
290
+        // Load Viewer scripts
291
+        if (class_exists(LoadViewer::class)) {
292
+            $this->eventDispatcher->dispatchTyped(new LoadViewer());
293
+        }
294
+
295
+        $this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
296
+        $this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
297
+
298
+        $params = [];
299
+        $params['usedSpacePercent'] = (int) $storageInfo['relative'];
300
+        $params['owner'] = $storageInfo['owner'] ?? '';
301
+        $params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? '';
302
+        $params['isPublic'] = false;
303
+        $params['allowShareWithLink'] = $this->shareManager->shareApiAllowLinks() ? 'yes' : 'no';
304
+        $params['defaultFileSorting'] = $filesSortingConfig['files']['mode'] ?? 'basename';
305
+        $params['defaultFileSortingDirection'] = $filesSortingConfig['files']['direction'] ?? 'asc';
306
+        $params['showgridview'] = $this->config->getUserValue($userId, 'files', 'show_grid', false);
307
+        $showHidden = (bool) $this->config->getUserValue($userId, 'files', 'show_hidden', false);
308
+        $params['showHiddenFiles'] = $showHidden ? 1 : 0;
309
+        $cropImagePreviews = (bool) $this->config->getUserValue($userId, 'files', 'crop_image_previews', true);
310
+        $params['cropImagePreviews'] = $cropImagePreviews ? 1 : 0;
311
+        $params['fileNotFound'] = $fileNotFound ? 1 : 0;
312
+        $params['appNavigation'] = $nav;
313
+        $params['appContents'] = $contentItems;
314
+        $params['hiddenFields'] = $event->getHiddenFields();
315
+
316
+        $response = new TemplateResponse(
317
+            Application::APP_ID,
318
+            'index',
319
+            $params
320
+        );
321
+        $policy = new ContentSecurityPolicy();
322
+        $policy->addAllowedFrameDomain('\'self\'');
323
+        $response->setContentSecurityPolicy($policy);
324
+
325
+        $this->provideInitialState($dir, $openfile);
326
+
327
+        return $response;
328
+    }
329
+
330
+    /**
331
+     * Add openFileInfo in initialState if $openfile is set.
332
+     * @param string $dir - the ?dir= URL param
333
+     * @param string $openfile - the ?openfile= URL param
334
+     * @return void
335
+     */
336
+    private function provideInitialState(string $dir, ?string $openfile): void {
337
+        if ($openfile === null) {
338
+            return;
339
+        }
340
+
341
+        $user = $this->userSession->getUser();
342
+
343
+        if ($user === null) {
344
+            return;
345
+        }
346
+
347
+        $uid = $user->getUID();
348
+        $userFolder = $this->rootFolder->getUserFolder($uid);
349
+        $nodes = $userFolder->getById((int) $openfile);
350
+        $node = array_shift($nodes);
351
+
352
+        if ($node === null) {
353
+            return;
354
+        }
355
+
356
+        // properly format full path and make sure
357
+        // we're relative to the user home folder
358
+        $isRoot = $node === $userFolder;
359
+        $path = $userFolder->getRelativePath($node->getPath());
360
+        $directory = $userFolder->getRelativePath($node->getParent()->getPath());
361
+
362
+        // Prevent opening a file from another folder.
363
+        if ($dir !== $directory) {
364
+            return;
365
+        }
366
+
367
+        $this->initialState->provideInitialState(
368
+            'openFileInfo', [
369
+                'id' => $node->getId(),
370
+                'name' => $isRoot ? '' : $node->getName(),
371
+                'path' => $path,
372
+                'directory' => $directory,
373
+                'mime' => $node->getMimetype(),
374
+                'type' => $node->getType(),
375
+                'permissions' => $node->getPermissions(),
376
+            ]
377
+        );
378
+    }
379
+
380
+    /**
381
+     * Redirects to the file list and highlight the given file id
382
+     *
383
+     * @param string $fileId file id to show
384
+     * @param bool $setOpenfile - whether or not to set the openfile URL parameter
385
+     * @return RedirectResponse redirect response or not found response
386
+     * @throws \OCP\Files\NotFoundException
387
+     */
388
+    private function redirectToFile($fileId, bool $setOpenfile = false) {
389
+        $uid = $this->userSession->getUser()->getUID();
390
+        $baseFolder = $this->rootFolder->getUserFolder($uid);
391
+        $files = $baseFolder->getById($fileId);
392
+        $params = [];
393
+
394
+        if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
395
+            $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
396
+            $files = $baseFolder->getById($fileId);
397
+            $params['view'] = 'trashbin';
398
+        }
399
+
400
+        if (!empty($files)) {
401
+            $file = current($files);
402
+            if ($file instanceof Folder) {
403
+                // set the full path to enter the folder
404
+                $params['dir'] = $baseFolder->getRelativePath($file->getPath());
405
+            } else {
406
+                // set parent path as dir
407
+                $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
408
+                // and scroll to the entry
409
+                $params['scrollto'] = $file->getName();
410
+
411
+                if ($setOpenfile) {
412
+                    // forward the openfile URL parameter.
413
+                    $params['openfile'] = $fileId;
414
+                }
415
+            }
416
+
417
+            return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
418
+        }
419
+        throw new \OCP\Files\NotFoundException();
420
+    }
421 421
 }
Please login to merge, or discard this patch.
apps/files/lib/Controller/ApiController.php 2 patches
Indentation   +330 added lines, -330 removed lines patch added patch discarded remove patch
@@ -65,363 +65,363 @@
 block discarded – undo
65 65
  * @package OCA\Files\Controller
66 66
  */
67 67
 class ApiController extends Controller {
68
-	private TagService $tagService;
69
-	private IManager $shareManager;
70
-	private IPreview $previewManager;
71
-	private IUserSession $userSession;
72
-	private IConfig $config;
73
-	private Folder $userFolder;
74
-	private UserConfig $userConfig;
75
-	private ViewConfig $viewConfig;
68
+    private TagService $tagService;
69
+    private IManager $shareManager;
70
+    private IPreview $previewManager;
71
+    private IUserSession $userSession;
72
+    private IConfig $config;
73
+    private Folder $userFolder;
74
+    private UserConfig $userConfig;
75
+    private ViewConfig $viewConfig;
76 76
 
77
-	/**
78
-	 * @param string $appName
79
-	 * @param IRequest $request
80
-	 * @param IUserSession $userSession
81
-	 * @param TagService $tagService
82
-	 * @param IPreview $previewManager
83
-	 * @param IManager $shareManager
84
-	 * @param IConfig $config
85
-	 * @param Folder $userFolder
86
-	 */
87
-	public function __construct($appName,
88
-								IRequest $request,
89
-								IUserSession $userSession,
90
-								TagService $tagService,
91
-								IPreview $previewManager,
92
-								IManager $shareManager,
93
-								IConfig $config,
94
-								Folder $userFolder,
95
-								UserConfig $userConfig,
96
-								ViewConfig $viewConfig) {
97
-		parent::__construct($appName, $request);
98
-		$this->userSession = $userSession;
99
-		$this->tagService = $tagService;
100
-		$this->previewManager = $previewManager;
101
-		$this->shareManager = $shareManager;
102
-		$this->config = $config;
103
-		$this->userFolder = $userFolder;
104
-		$this->userConfig = $userConfig;
105
-		$this->viewConfig = $viewConfig;
106
-	}
77
+    /**
78
+     * @param string $appName
79
+     * @param IRequest $request
80
+     * @param IUserSession $userSession
81
+     * @param TagService $tagService
82
+     * @param IPreview $previewManager
83
+     * @param IManager $shareManager
84
+     * @param IConfig $config
85
+     * @param Folder $userFolder
86
+     */
87
+    public function __construct($appName,
88
+                                IRequest $request,
89
+                                IUserSession $userSession,
90
+                                TagService $tagService,
91
+                                IPreview $previewManager,
92
+                                IManager $shareManager,
93
+                                IConfig $config,
94
+                                Folder $userFolder,
95
+                                UserConfig $userConfig,
96
+                                ViewConfig $viewConfig) {
97
+        parent::__construct($appName, $request);
98
+        $this->userSession = $userSession;
99
+        $this->tagService = $tagService;
100
+        $this->previewManager = $previewManager;
101
+        $this->shareManager = $shareManager;
102
+        $this->config = $config;
103
+        $this->userFolder = $userFolder;
104
+        $this->userConfig = $userConfig;
105
+        $this->viewConfig = $viewConfig;
106
+    }
107 107
 
108
-	/**
109
-	 * Gets a thumbnail of the specified file
110
-	 *
111
-	 * @since API version 1.0
112
-	 *
113
-	 * @NoAdminRequired
114
-	 * @NoCSRFRequired
115
-	 * @StrictCookieRequired
116
-	 *
117
-	 * @param int $x
118
-	 * @param int $y
119
-	 * @param string $file URL-encoded filename
120
-	 * @return DataResponse|FileDisplayResponse
121
-	 */
122
-	public function getThumbnail($x, $y, $file) {
123
-		if ($x < 1 || $y < 1) {
124
-			return new DataResponse(['message' => 'Requested size must be numeric and a positive value.'], Http::STATUS_BAD_REQUEST);
125
-		}
108
+    /**
109
+     * Gets a thumbnail of the specified file
110
+     *
111
+     * @since API version 1.0
112
+     *
113
+     * @NoAdminRequired
114
+     * @NoCSRFRequired
115
+     * @StrictCookieRequired
116
+     *
117
+     * @param int $x
118
+     * @param int $y
119
+     * @param string $file URL-encoded filename
120
+     * @return DataResponse|FileDisplayResponse
121
+     */
122
+    public function getThumbnail($x, $y, $file) {
123
+        if ($x < 1 || $y < 1) {
124
+            return new DataResponse(['message' => 'Requested size must be numeric and a positive value.'], Http::STATUS_BAD_REQUEST);
125
+        }
126 126
 
127
-		try {
128
-			$file = $this->userFolder->get($file);
129
-			if ($file instanceof Folder) {
130
-				throw new NotFoundException();
131
-			}
127
+        try {
128
+            $file = $this->userFolder->get($file);
129
+            if ($file instanceof Folder) {
130
+                throw new NotFoundException();
131
+            }
132 132
 
133
-			/** @var File $file */
134
-			$preview = $this->previewManager->getPreview($file, $x, $y, true);
133
+            /** @var File $file */
134
+            $preview = $this->previewManager->getPreview($file, $x, $y, true);
135 135
 
136
-			return new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => $preview->getMimeType()]);
137
-		} catch (NotFoundException $e) {
138
-			return new DataResponse(['message' => 'File not found.'], Http::STATUS_NOT_FOUND);
139
-		} catch (\Exception $e) {
140
-			return new DataResponse([], Http::STATUS_BAD_REQUEST);
141
-		}
142
-	}
136
+            return new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => $preview->getMimeType()]);
137
+        } catch (NotFoundException $e) {
138
+            return new DataResponse(['message' => 'File not found.'], Http::STATUS_NOT_FOUND);
139
+        } catch (\Exception $e) {
140
+            return new DataResponse([], Http::STATUS_BAD_REQUEST);
141
+        }
142
+    }
143 143
 
144
-	/**
145
-	 * Updates the info of the specified file path
146
-	 * The passed tags are absolute, which means they will
147
-	 * replace the actual tag selection.
148
-	 *
149
-	 * @NoAdminRequired
150
-	 *
151
-	 * @param string $path path
152
-	 * @param array|string $tags array of tags
153
-	 * @return DataResponse
154
-	 */
155
-	public function updateFileTags($path, $tags = null) {
156
-		$result = [];
157
-		// if tags specified or empty array, update tags
158
-		if (!is_null($tags)) {
159
-			try {
160
-				$this->tagService->updateFileTags($path, $tags);
161
-			} catch (\OCP\Files\NotFoundException $e) {
162
-				return new DataResponse([
163
-					'message' => $e->getMessage()
164
-				], Http::STATUS_NOT_FOUND);
165
-			} catch (\OCP\Files\StorageNotAvailableException $e) {
166
-				return new DataResponse([
167
-					'message' => $e->getMessage()
168
-				], Http::STATUS_SERVICE_UNAVAILABLE);
169
-			} catch (\Exception $e) {
170
-				return new DataResponse([
171
-					'message' => $e->getMessage()
172
-				], Http::STATUS_NOT_FOUND);
173
-			}
174
-			$result['tags'] = $tags;
175
-		}
176
-		return new DataResponse($result);
177
-	}
144
+    /**
145
+     * Updates the info of the specified file path
146
+     * The passed tags are absolute, which means they will
147
+     * replace the actual tag selection.
148
+     *
149
+     * @NoAdminRequired
150
+     *
151
+     * @param string $path path
152
+     * @param array|string $tags array of tags
153
+     * @return DataResponse
154
+     */
155
+    public function updateFileTags($path, $tags = null) {
156
+        $result = [];
157
+        // if tags specified or empty array, update tags
158
+        if (!is_null($tags)) {
159
+            try {
160
+                $this->tagService->updateFileTags($path, $tags);
161
+            } catch (\OCP\Files\NotFoundException $e) {
162
+                return new DataResponse([
163
+                    'message' => $e->getMessage()
164
+                ], Http::STATUS_NOT_FOUND);
165
+            } catch (\OCP\Files\StorageNotAvailableException $e) {
166
+                return new DataResponse([
167
+                    'message' => $e->getMessage()
168
+                ], Http::STATUS_SERVICE_UNAVAILABLE);
169
+            } catch (\Exception $e) {
170
+                return new DataResponse([
171
+                    'message' => $e->getMessage()
172
+                ], Http::STATUS_NOT_FOUND);
173
+            }
174
+            $result['tags'] = $tags;
175
+        }
176
+        return new DataResponse($result);
177
+    }
178 178
 
179
-	/**
180
-	 * @param \OCP\Files\Node[] $nodes
181
-	 * @return array
182
-	 */
183
-	private function formatNodes(array $nodes) {
184
-		$shareTypesForNodes = $this->getShareTypesForNodes($nodes);
185
-		return array_values(array_map(function (Node $node) use ($shareTypesForNodes) {
186
-			$shareTypes = $shareTypesForNodes[$node->getId()] ?? [];
187
-			$file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
188
-			$file['hasPreview'] = $this->previewManager->isAvailable($node);
189
-			$parts = explode('/', dirname($node->getPath()), 4);
190
-			if (isset($parts[3])) {
191
-				$file['path'] = '/' . $parts[3];
192
-			} else {
193
-				$file['path'] = '/';
194
-			}
195
-			if (!empty($shareTypes)) {
196
-				$file['shareTypes'] = $shareTypes;
197
-			}
198
-			return $file;
199
-		}, $nodes));
200
-	}
179
+    /**
180
+     * @param \OCP\Files\Node[] $nodes
181
+     * @return array
182
+     */
183
+    private function formatNodes(array $nodes) {
184
+        $shareTypesForNodes = $this->getShareTypesForNodes($nodes);
185
+        return array_values(array_map(function (Node $node) use ($shareTypesForNodes) {
186
+            $shareTypes = $shareTypesForNodes[$node->getId()] ?? [];
187
+            $file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
188
+            $file['hasPreview'] = $this->previewManager->isAvailable($node);
189
+            $parts = explode('/', dirname($node->getPath()), 4);
190
+            if (isset($parts[3])) {
191
+                $file['path'] = '/' . $parts[3];
192
+            } else {
193
+                $file['path'] = '/';
194
+            }
195
+            if (!empty($shareTypes)) {
196
+                $file['shareTypes'] = $shareTypes;
197
+            }
198
+            return $file;
199
+        }, $nodes));
200
+    }
201 201
 
202
-	/**
203
-	 * Get the share types for each node
204
-	 *
205
-	 * @param \OCP\Files\Node[] $nodes
206
-	 * @return array<int, int[]> list of share types for each fileid
207
-	 */
208
-	private function getShareTypesForNodes(array $nodes): array {
209
-		$userId = $this->userSession->getUser()->getUID();
210
-		$requestedShareTypes = [
211
-			IShare::TYPE_USER,
212
-			IShare::TYPE_GROUP,
213
-			IShare::TYPE_LINK,
214
-			IShare::TYPE_REMOTE,
215
-			IShare::TYPE_EMAIL,
216
-			IShare::TYPE_ROOM,
217
-			IShare::TYPE_DECK,
218
-			IShare::TYPE_SCIENCEMESH,
219
-		];
220
-		$shareTypes = [];
202
+    /**
203
+     * Get the share types for each node
204
+     *
205
+     * @param \OCP\Files\Node[] $nodes
206
+     * @return array<int, int[]> list of share types for each fileid
207
+     */
208
+    private function getShareTypesForNodes(array $nodes): array {
209
+        $userId = $this->userSession->getUser()->getUID();
210
+        $requestedShareTypes = [
211
+            IShare::TYPE_USER,
212
+            IShare::TYPE_GROUP,
213
+            IShare::TYPE_LINK,
214
+            IShare::TYPE_REMOTE,
215
+            IShare::TYPE_EMAIL,
216
+            IShare::TYPE_ROOM,
217
+            IShare::TYPE_DECK,
218
+            IShare::TYPE_SCIENCEMESH,
219
+        ];
220
+        $shareTypes = [];
221 221
 
222
-		$nodeIds = array_map(function (Node $node) {
223
-			return $node->getId();
224
-		}, $nodes);
222
+        $nodeIds = array_map(function (Node $node) {
223
+            return $node->getId();
224
+        }, $nodes);
225 225
 
226
-		foreach ($requestedShareTypes as $shareType) {
227
-			$nodesLeft = array_combine($nodeIds, array_fill(0, count($nodeIds), true));
228
-			$offset = 0;
226
+        foreach ($requestedShareTypes as $shareType) {
227
+            $nodesLeft = array_combine($nodeIds, array_fill(0, count($nodeIds), true));
228
+            $offset = 0;
229 229
 
230
-			// fetch shares until we've either found shares for all nodes or there are no more shares left
231
-			while (count($nodesLeft) > 0) {
232
-				$shares = $this->shareManager->getSharesBy($userId, $shareType, null, false, 100, $offset);
233
-				foreach ($shares as $share) {
234
-					$fileId = $share->getNodeId();
235
-					if (isset($nodesLeft[$fileId])) {
236
-						if (!isset($shareTypes[$fileId])) {
237
-							$shareTypes[$fileId] = [];
238
-						}
239
-						$shareTypes[$fileId][] = $shareType;
240
-						unset($nodesLeft[$fileId]);
241
-					}
242
-				}
230
+            // fetch shares until we've either found shares for all nodes or there are no more shares left
231
+            while (count($nodesLeft) > 0) {
232
+                $shares = $this->shareManager->getSharesBy($userId, $shareType, null, false, 100, $offset);
233
+                foreach ($shares as $share) {
234
+                    $fileId = $share->getNodeId();
235
+                    if (isset($nodesLeft[$fileId])) {
236
+                        if (!isset($shareTypes[$fileId])) {
237
+                            $shareTypes[$fileId] = [];
238
+                        }
239
+                        $shareTypes[$fileId][] = $shareType;
240
+                        unset($nodesLeft[$fileId]);
241
+                    }
242
+                }
243 243
 
244
-				if (count($shares) < 100) {
245
-					break;
246
-				} else {
247
-					$offset += count($shares);
248
-				}
249
-			}
250
-		}
251
-		return $shareTypes;
252
-	}
244
+                if (count($shares) < 100) {
245
+                    break;
246
+                } else {
247
+                    $offset += count($shares);
248
+                }
249
+            }
250
+        }
251
+        return $shareTypes;
252
+    }
253 253
 
254
-	/**
255
-	 * Returns a list of recently modified files.
256
-	 *
257
-	 * @NoAdminRequired
258
-	 *
259
-	 * @return DataResponse
260
-	 */
261
-	public function getRecentFiles() {
262
-		$nodes = $this->userFolder->getRecent(100);
263
-		$files = $this->formatNodes($nodes);
264
-		return new DataResponse(['files' => $files]);
265
-	}
254
+    /**
255
+     * Returns a list of recently modified files.
256
+     *
257
+     * @NoAdminRequired
258
+     *
259
+     * @return DataResponse
260
+     */
261
+    public function getRecentFiles() {
262
+        $nodes = $this->userFolder->getRecent(100);
263
+        $files = $this->formatNodes($nodes);
264
+        return new DataResponse(['files' => $files]);
265
+    }
266 266
 
267 267
 
268
-	/**
269
-	 * Returns the current logged-in user's storage stats.
270
-	 *
271
-	 * @NoAdminRequired
272
-	 *
273
-	 * @param ?string $dir the directory to get the storage stats from
274
-	 * @return JSONResponse
275
-	 */
276
-	public function getStorageStats($dir = '/'): JSONResponse {
277
-		$storageInfo = \OC_Helper::getStorageInfo($dir ?: '/');
278
-		return new JSONResponse(['message' => 'ok', 'data' => $storageInfo]);
279
-	}
268
+    /**
269
+     * Returns the current logged-in user's storage stats.
270
+     *
271
+     * @NoAdminRequired
272
+     *
273
+     * @param ?string $dir the directory to get the storage stats from
274
+     * @return JSONResponse
275
+     */
276
+    public function getStorageStats($dir = '/'): JSONResponse {
277
+        $storageInfo = \OC_Helper::getStorageInfo($dir ?: '/');
278
+        return new JSONResponse(['message' => 'ok', 'data' => $storageInfo]);
279
+    }
280 280
 
281
-	/**
282
-	 * Set a user view config
283
-	 *
284
-	 * @NoAdminRequired
285
-	 *
286
-	 * @param string $view
287
-	 * @param string $key
288
-	 * @param string|bool $value
289
-	 * @return JSONResponse
290
-	 */
291
-	public function setViewConfig(string $view, string $key, $value): JSONResponse {
292
-		try {
293
-			$this->viewConfig->setConfig($view, $key, (string)$value);
294
-		} catch (\InvalidArgumentException $e) {
295
-			return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
296
-		}
281
+    /**
282
+     * Set a user view config
283
+     *
284
+     * @NoAdminRequired
285
+     *
286
+     * @param string $view
287
+     * @param string $key
288
+     * @param string|bool $value
289
+     * @return JSONResponse
290
+     */
291
+    public function setViewConfig(string $view, string $key, $value): JSONResponse {
292
+        try {
293
+            $this->viewConfig->setConfig($view, $key, (string)$value);
294
+        } catch (\InvalidArgumentException $e) {
295
+            return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
296
+        }
297 297
 
298
-		return new JSONResponse(['message' => 'ok', 'data' => $this->viewConfig->getConfig($view)]);
299
-	}
298
+        return new JSONResponse(['message' => 'ok', 'data' => $this->viewConfig->getConfig($view)]);
299
+    }
300 300
 
301 301
 
302
-	/**
303
-	 * Get the user view config
304
-	 *
305
-	 * @NoAdminRequired
306
-	 *
307
-	 * @return JSONResponse
308
-	 */
309
-	public function getViewConfigs(): JSONResponse {
310
-		return new JSONResponse(['message' => 'ok', 'data' => $this->viewConfig->getConfigs()]);
311
-	}
302
+    /**
303
+     * Get the user view config
304
+     *
305
+     * @NoAdminRequired
306
+     *
307
+     * @return JSONResponse
308
+     */
309
+    public function getViewConfigs(): JSONResponse {
310
+        return new JSONResponse(['message' => 'ok', 'data' => $this->viewConfig->getConfigs()]);
311
+    }
312 312
 
313
-	/**
314
-	 * Set a user config
315
-	 *
316
-	 * @NoAdminRequired
317
-	 *
318
-	 * @param string $key
319
-	 * @param string|bool $value
320
-	 * @return JSONResponse
321
-	 */
322
-	public function setConfig(string $key, $value): JSONResponse {
323
-		try {
324
-			$this->userConfig->setConfig($key, (string)$value);
325
-		} catch (\InvalidArgumentException $e) {
326
-			return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
327
-		}
313
+    /**
314
+     * Set a user config
315
+     *
316
+     * @NoAdminRequired
317
+     *
318
+     * @param string $key
319
+     * @param string|bool $value
320
+     * @return JSONResponse
321
+     */
322
+    public function setConfig(string $key, $value): JSONResponse {
323
+        try {
324
+            $this->userConfig->setConfig($key, (string)$value);
325
+        } catch (\InvalidArgumentException $e) {
326
+            return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
327
+        }
328 328
 
329
-		return new JSONResponse(['message' => 'ok', 'data' => ['key' => $key, 'value' => $value]]);
330
-	}
329
+        return new JSONResponse(['message' => 'ok', 'data' => ['key' => $key, 'value' => $value]]);
330
+    }
331 331
 
332 332
 
333
-	/**
334
-	 * Get the user config
335
-	 *
336
-	 * @NoAdminRequired
337
-	 *
338
-	 * @return JSONResponse
339
-	 */
340
-	public function getConfigs(): JSONResponse {
341
-		return new JSONResponse(['message' => 'ok', 'data' => $this->userConfig->getConfigs()]);
342
-	}
333
+    /**
334
+     * Get the user config
335
+     *
336
+     * @NoAdminRequired
337
+     *
338
+     * @return JSONResponse
339
+     */
340
+    public function getConfigs(): JSONResponse {
341
+        return new JSONResponse(['message' => 'ok', 'data' => $this->userConfig->getConfigs()]);
342
+    }
343 343
 
344
-	/**
345
-	 * Toggle default for showing/hiding hidden files
346
-	 *
347
-	 * @NoAdminRequired
348
-	 *
349
-	 * @param bool $value
350
-	 * @return Response
351
-	 * @throws \OCP\PreConditionNotMetException
352
-	 */
353
-	public function showHiddenFiles(bool $value): Response {
354
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', $value ? '1' : '0');
355
-		return new Response();
356
-	}
344
+    /**
345
+     * Toggle default for showing/hiding hidden files
346
+     *
347
+     * @NoAdminRequired
348
+     *
349
+     * @param bool $value
350
+     * @return Response
351
+     * @throws \OCP\PreConditionNotMetException
352
+     */
353
+    public function showHiddenFiles(bool $value): Response {
354
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', $value ? '1' : '0');
355
+        return new Response();
356
+    }
357 357
 
358
-	/**
359
-	 * Toggle default for cropping preview images
360
-	 *
361
-	 * @NoAdminRequired
362
-	 *
363
-	 * @param bool $value
364
-	 * @return Response
365
-	 * @throws \OCP\PreConditionNotMetException
366
-	 */
367
-	public function cropImagePreviews(bool $value): Response {
368
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', $value ? '1' : '0');
369
-		return new Response();
370
-	}
358
+    /**
359
+     * Toggle default for cropping preview images
360
+     *
361
+     * @NoAdminRequired
362
+     *
363
+     * @param bool $value
364
+     * @return Response
365
+     * @throws \OCP\PreConditionNotMetException
366
+     */
367
+    public function cropImagePreviews(bool $value): Response {
368
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', $value ? '1' : '0');
369
+        return new Response();
370
+    }
371 371
 
372
-	/**
373
-	 * Toggle default for files grid view
374
-	 *
375
-	 * @NoAdminRequired
376
-	 *
377
-	 * @param bool $show
378
-	 * @return Response
379
-	 * @throws \OCP\PreConditionNotMetException
380
-	 */
381
-	public function showGridView(bool $show): Response {
382
-		$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', $show ? '1' : '0');
383
-		return new Response();
384
-	}
372
+    /**
373
+     * Toggle default for files grid view
374
+     *
375
+     * @NoAdminRequired
376
+     *
377
+     * @param bool $show
378
+     * @return Response
379
+     * @throws \OCP\PreConditionNotMetException
380
+     */
381
+    public function showGridView(bool $show): Response {
382
+        $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', $show ? '1' : '0');
383
+        return new Response();
384
+    }
385 385
 
386
-	/**
387
-	 * Get default settings for the grid view
388
-	 *
389
-	 * @NoAdminRequired
390
-	 */
391
-	public function getGridView() {
392
-		$status = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', '0') === '1';
393
-		return new JSONResponse(['gridview' => $status]);
394
-	}
386
+    /**
387
+     * Get default settings for the grid view
388
+     *
389
+     * @NoAdminRequired
390
+     */
391
+    public function getGridView() {
392
+        $status = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', '0') === '1';
393
+        return new JSONResponse(['gridview' => $status]);
394
+    }
395 395
 
396
-	/**
397
-	 * Get sorting-order for custom sorting
398
-	 *
399
-	 * @NoAdminRequired
400
-	 *
401
-	 * @param string $folderpath
402
-	 * @return string
403
-	 * @throws \OCP\Files\NotFoundException
404
-	 */
405
-	public function getNodeType($folderpath) {
406
-		$node = $this->userFolder->get($folderpath);
407
-		return $node->getType();
408
-	}
396
+    /**
397
+     * Get sorting-order for custom sorting
398
+     *
399
+     * @NoAdminRequired
400
+     *
401
+     * @param string $folderpath
402
+     * @return string
403
+     * @throws \OCP\Files\NotFoundException
404
+     */
405
+    public function getNodeType($folderpath) {
406
+        $node = $this->userFolder->get($folderpath);
407
+        return $node->getType();
408
+    }
409 409
 	
410
-	/**
411
-	 * @NoAdminRequired
412
-	 * @NoCSRFRequired
413
-	 */
414
-	public function serviceWorker(): StreamResponse {
415
-		$response = new StreamResponse(__DIR__ . '/../../../../dist/preview-service-worker.js');
416
-		$response->setHeaders([
417
-			'Content-Type' => 'application/javascript',
418
-			'Service-Worker-Allowed' => '/'
419
-		]);
420
-		$policy = new ContentSecurityPolicy();
421
-		$policy->addAllowedWorkerSrcDomain("'self'");
422
-		$policy->addAllowedScriptDomain("'self'");
423
-		$policy->addAllowedConnectDomain("'self'");
424
-		$response->setContentSecurityPolicy($policy);
425
-		return $response;
426
-	}
410
+    /**
411
+     * @NoAdminRequired
412
+     * @NoCSRFRequired
413
+     */
414
+    public function serviceWorker(): StreamResponse {
415
+        $response = new StreamResponse(__DIR__ . '/../../../../dist/preview-service-worker.js');
416
+        $response->setHeaders([
417
+            'Content-Type' => 'application/javascript',
418
+            'Service-Worker-Allowed' => '/'
419
+        ]);
420
+        $policy = new ContentSecurityPolicy();
421
+        $policy->addAllowedWorkerSrcDomain("'self'");
422
+        $policy->addAllowedScriptDomain("'self'");
423
+        $policy->addAllowedConnectDomain("'self'");
424
+        $response->setContentSecurityPolicy($policy);
425
+        return $response;
426
+    }
427 427
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	private function formatNodes(array $nodes) {
184 184
 		$shareTypesForNodes = $this->getShareTypesForNodes($nodes);
185
-		return array_values(array_map(function (Node $node) use ($shareTypesForNodes) {
185
+		return array_values(array_map(function(Node $node) use ($shareTypesForNodes) {
186 186
 			$shareTypes = $shareTypesForNodes[$node->getId()] ?? [];
187 187
 			$file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
188 188
 			$file['hasPreview'] = $this->previewManager->isAvailable($node);
189 189
 			$parts = explode('/', dirname($node->getPath()), 4);
190 190
 			if (isset($parts[3])) {
191
-				$file['path'] = '/' . $parts[3];
191
+				$file['path'] = '/'.$parts[3];
192 192
 			} else {
193 193
 				$file['path'] = '/';
194 194
 			}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		];
220 220
 		$shareTypes = [];
221 221
 
222
-		$nodeIds = array_map(function (Node $node) {
222
+		$nodeIds = array_map(function(Node $node) {
223 223
 			return $node->getId();
224 224
 		}, $nodes);
225 225
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 */
291 291
 	public function setViewConfig(string $view, string $key, $value): JSONResponse {
292 292
 		try {
293
-			$this->viewConfig->setConfig($view, $key, (string)$value);
293
+			$this->viewConfig->setConfig($view, $key, (string) $value);
294 294
 		} catch (\InvalidArgumentException $e) {
295 295
 			return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
296 296
 		}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function setConfig(string $key, $value): JSONResponse {
323 323
 		try {
324
-			$this->userConfig->setConfig($key, (string)$value);
324
+			$this->userConfig->setConfig($key, (string) $value);
325 325
 		} catch (\InvalidArgumentException $e) {
326 326
 			return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
327 327
 		}
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @NoCSRFRequired
413 413
 	 */
414 414
 	public function serviceWorker(): StreamResponse {
415
-		$response = new StreamResponse(__DIR__ . '/../../../../dist/preview-service-worker.js');
415
+		$response = new StreamResponse(__DIR__.'/../../../../dist/preview-service-worker.js');
416 416
 		$response->setHeaders([
417 417
 			'Content-Type' => 'application/javascript',
418 418
 			'Service-Worker-Allowed' => '/'
Please login to merge, or discard this patch.
apps/files/composer/composer/autoload_static.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -6,81 +6,81 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitFiles
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\Files\\' => 10,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\Files\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25
-        'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__ . '/..' . '/../lib/Activity/FavoriteProvider.php',
26
-        'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__ . '/..' . '/../lib/Activity/Filter/Favorites.php',
27
-        'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__ . '/..' . '/../lib/Activity/Filter/FileChanges.php',
28
-        'OCA\\Files\\Activity\\Helper' => __DIR__ . '/..' . '/../lib/Activity/Helper.php',
29
-        'OCA\\Files\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php',
30
-        'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__ . '/..' . '/../lib/Activity/Settings/FavoriteAction.php',
31
-        'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileActivitySettings.php',
32
-        'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php',
33
-        'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileFavoriteChanged.php',
34
-        'OCA\\Files\\App' => __DIR__ . '/..' . '/../lib/App.php',
35
-        'OCA\\Files\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
36
-        'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php',
37
-        'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupFileLocks.php',
38
-        'OCA\\Files\\BackgroundJob\\DeleteExpiredOpenLocalEditor' => __DIR__ . '/..' . '/../lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php',
39
-        'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__ . '/..' . '/../lib/BackgroundJob/DeleteOrphanedItems.php',
40
-        'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__ . '/..' . '/../lib/BackgroundJob/ScanFiles.php',
41
-        'OCA\\Files\\BackgroundJob\\TransferOwnership' => __DIR__ . '/..' . '/../lib/BackgroundJob/TransferOwnership.php',
42
-        'OCA\\Files\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
43
-        'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/Listener.php',
44
-        'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/ResourceProvider.php',
45
-        'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__ . '/..' . '/../lib/Command/DeleteOrphanedFiles.php',
46
-        'OCA\\Files\\Command\\RepairTree' => __DIR__ . '/..' . '/../lib/Command/RepairTree.php',
47
-        'OCA\\Files\\Command\\Scan' => __DIR__ . '/..' . '/../lib/Command/Scan.php',
48
-        'OCA\\Files\\Command\\ScanAppData' => __DIR__ . '/..' . '/../lib/Command/ScanAppData.php',
49
-        'OCA\\Files\\Command\\TransferOwnership' => __DIR__ . '/..' . '/../lib/Command/TransferOwnership.php',
50
-        'OCA\\Files\\Controller\\ApiController' => __DIR__ . '/..' . '/../lib/Controller/ApiController.php',
51
-        'OCA\\Files\\Controller\\DirectEditingController' => __DIR__ . '/..' . '/../lib/Controller/DirectEditingController.php',
52
-        'OCA\\Files\\Controller\\DirectEditingViewController' => __DIR__ . '/..' . '/../lib/Controller/DirectEditingViewController.php',
53
-        'OCA\\Files\\Controller\\OpenLocalEditorController' => __DIR__ . '/..' . '/../lib/Controller/OpenLocalEditorController.php',
54
-        'OCA\\Files\\Controller\\TemplateController' => __DIR__ . '/..' . '/../lib/Controller/TemplateController.php',
55
-        'OCA\\Files\\Controller\\TransferOwnershipController' => __DIR__ . '/..' . '/../lib/Controller/TransferOwnershipController.php',
56
-        'OCA\\Files\\Controller\\ViewController' => __DIR__ . '/..' . '/../lib/Controller/ViewController.php',
57
-        'OCA\\Files\\Db\\OpenLocalEditor' => __DIR__ . '/..' . '/../lib/Db/OpenLocalEditor.php',
58
-        'OCA\\Files\\Db\\OpenLocalEditorMapper' => __DIR__ . '/..' . '/../lib/Db/OpenLocalEditorMapper.php',
59
-        'OCA\\Files\\Db\\TransferOwnership' => __DIR__ . '/..' . '/../lib/Db/TransferOwnership.php',
60
-        'OCA\\Files\\Db\\TransferOwnershipMapper' => __DIR__ . '/..' . '/../lib/Db/TransferOwnershipMapper.php',
61
-        'OCA\\Files\\DirectEditingCapabilities' => __DIR__ . '/..' . '/../lib/DirectEditingCapabilities.php',
62
-        'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => __DIR__ . '/..' . '/../lib/Event/LoadAdditionalScriptsEvent.php',
63
-        'OCA\\Files\\Event\\LoadSidebar' => __DIR__ . '/..' . '/../lib/Event/LoadSidebar.php',
64
-        'OCA\\Files\\Exception\\TransferOwnershipException' => __DIR__ . '/..' . '/../lib/Exception/TransferOwnershipException.php',
65
-        'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
66
-        'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__ . '/..' . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
67
-        'OCA\\Files\\Listener\\LoadSidebarListener' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarListener.php',
68
-        'OCA\\Files\\Listener\\RenderReferenceEventListener' => __DIR__ . '/..' . '/../lib/Listener/RenderReferenceEventListener.php',
69
-        'OCA\\Files\\Migration\\Version11301Date20191205150729' => __DIR__ . '/..' . '/../lib/Migration/Version11301Date20191205150729.php',
70
-        'OCA\\Files\\Migration\\Version12101Date20221011153334' => __DIR__ . '/..' . '/../lib/Migration/Version12101Date20221011153334.php',
71
-        'OCA\\Files\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
72
-        'OCA\\Files\\Search\\FilesSearchProvider' => __DIR__ . '/..' . '/../lib/Search/FilesSearchProvider.php',
73
-        'OCA\\Files\\Service\\DirectEditingService' => __DIR__ . '/..' . '/../lib/Service/DirectEditingService.php',
74
-        'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__ . '/..' . '/../lib/Service/OwnershipTransferService.php',
75
-        'OCA\\Files\\Service\\TagService' => __DIR__ . '/..' . '/../lib/Service/TagService.php',
76
-        'OCA\\Files\\Service\\UserConfig' => __DIR__ . '/..' . '/../lib/Service/UserConfig.php',
77
-        'OCA\\Files\\Service\\ViewConfig' => __DIR__ . '/..' . '/../lib/Service/ViewConfig.php',
78
-        'OCA\\Files\\Settings\\PersonalSettings' => __DIR__ . '/..' . '/../lib/Settings/PersonalSettings.php',
23
+    public static $classMap = array(
24
+        'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php',
25
+        'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__.'/..'.'/../lib/Activity/FavoriteProvider.php',
26
+        'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__.'/..'.'/../lib/Activity/Filter/Favorites.php',
27
+        'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__.'/..'.'/../lib/Activity/Filter/FileChanges.php',
28
+        'OCA\\Files\\Activity\\Helper' => __DIR__.'/..'.'/../lib/Activity/Helper.php',
29
+        'OCA\\Files\\Activity\\Provider' => __DIR__.'/..'.'/../lib/Activity/Provider.php',
30
+        'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__.'/..'.'/../lib/Activity/Settings/FavoriteAction.php',
31
+        'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => __DIR__.'/..'.'/../lib/Activity/Settings/FileActivitySettings.php',
32
+        'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__.'/..'.'/../lib/Activity/Settings/FileChanged.php',
33
+        'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => __DIR__.'/..'.'/../lib/Activity/Settings/FileFavoriteChanged.php',
34
+        'OCA\\Files\\App' => __DIR__.'/..'.'/../lib/App.php',
35
+        'OCA\\Files\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
36
+        'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupDirectEditingTokens.php',
37
+        'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupFileLocks.php',
38
+        'OCA\\Files\\BackgroundJob\\DeleteExpiredOpenLocalEditor' => __DIR__.'/..'.'/../lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php',
39
+        'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__.'/..'.'/../lib/BackgroundJob/DeleteOrphanedItems.php',
40
+        'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__.'/..'.'/../lib/BackgroundJob/ScanFiles.php',
41
+        'OCA\\Files\\BackgroundJob\\TransferOwnership' => __DIR__.'/..'.'/../lib/BackgroundJob/TransferOwnership.php',
42
+        'OCA\\Files\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php',
43
+        'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__.'/..'.'/../lib/Collaboration/Resources/Listener.php',
44
+        'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__.'/..'.'/../lib/Collaboration/Resources/ResourceProvider.php',
45
+        'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__.'/..'.'/../lib/Command/DeleteOrphanedFiles.php',
46
+        'OCA\\Files\\Command\\RepairTree' => __DIR__.'/..'.'/../lib/Command/RepairTree.php',
47
+        'OCA\\Files\\Command\\Scan' => __DIR__.'/..'.'/../lib/Command/Scan.php',
48
+        'OCA\\Files\\Command\\ScanAppData' => __DIR__.'/..'.'/../lib/Command/ScanAppData.php',
49
+        'OCA\\Files\\Command\\TransferOwnership' => __DIR__.'/..'.'/../lib/Command/TransferOwnership.php',
50
+        'OCA\\Files\\Controller\\ApiController' => __DIR__.'/..'.'/../lib/Controller/ApiController.php',
51
+        'OCA\\Files\\Controller\\DirectEditingController' => __DIR__.'/..'.'/../lib/Controller/DirectEditingController.php',
52
+        'OCA\\Files\\Controller\\DirectEditingViewController' => __DIR__.'/..'.'/../lib/Controller/DirectEditingViewController.php',
53
+        'OCA\\Files\\Controller\\OpenLocalEditorController' => __DIR__.'/..'.'/../lib/Controller/OpenLocalEditorController.php',
54
+        'OCA\\Files\\Controller\\TemplateController' => __DIR__.'/..'.'/../lib/Controller/TemplateController.php',
55
+        'OCA\\Files\\Controller\\TransferOwnershipController' => __DIR__.'/..'.'/../lib/Controller/TransferOwnershipController.php',
56
+        'OCA\\Files\\Controller\\ViewController' => __DIR__.'/..'.'/../lib/Controller/ViewController.php',
57
+        'OCA\\Files\\Db\\OpenLocalEditor' => __DIR__.'/..'.'/../lib/Db/OpenLocalEditor.php',
58
+        'OCA\\Files\\Db\\OpenLocalEditorMapper' => __DIR__.'/..'.'/../lib/Db/OpenLocalEditorMapper.php',
59
+        'OCA\\Files\\Db\\TransferOwnership' => __DIR__.'/..'.'/../lib/Db/TransferOwnership.php',
60
+        'OCA\\Files\\Db\\TransferOwnershipMapper' => __DIR__.'/..'.'/../lib/Db/TransferOwnershipMapper.php',
61
+        'OCA\\Files\\DirectEditingCapabilities' => __DIR__.'/..'.'/../lib/DirectEditingCapabilities.php',
62
+        'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => __DIR__.'/..'.'/../lib/Event/LoadAdditionalScriptsEvent.php',
63
+        'OCA\\Files\\Event\\LoadSidebar' => __DIR__.'/..'.'/../lib/Event/LoadSidebar.php',
64
+        'OCA\\Files\\Exception\\TransferOwnershipException' => __DIR__.'/..'.'/../lib/Exception/TransferOwnershipException.php',
65
+        'OCA\\Files\\Helper' => __DIR__.'/..'.'/../lib/Helper.php',
66
+        'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__.'/..'.'/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
67
+        'OCA\\Files\\Listener\\LoadSidebarListener' => __DIR__.'/..'.'/../lib/Listener/LoadSidebarListener.php',
68
+        'OCA\\Files\\Listener\\RenderReferenceEventListener' => __DIR__.'/..'.'/../lib/Listener/RenderReferenceEventListener.php',
69
+        'OCA\\Files\\Migration\\Version11301Date20191205150729' => __DIR__.'/..'.'/../lib/Migration/Version11301Date20191205150729.php',
70
+        'OCA\\Files\\Migration\\Version12101Date20221011153334' => __DIR__.'/..'.'/../lib/Migration/Version12101Date20221011153334.php',
71
+        'OCA\\Files\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php',
72
+        'OCA\\Files\\Search\\FilesSearchProvider' => __DIR__.'/..'.'/../lib/Search/FilesSearchProvider.php',
73
+        'OCA\\Files\\Service\\DirectEditingService' => __DIR__.'/..'.'/../lib/Service/DirectEditingService.php',
74
+        'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__.'/..'.'/../lib/Service/OwnershipTransferService.php',
75
+        'OCA\\Files\\Service\\TagService' => __DIR__.'/..'.'/../lib/Service/TagService.php',
76
+        'OCA\\Files\\Service\\UserConfig' => __DIR__.'/..'.'/../lib/Service/UserConfig.php',
77
+        'OCA\\Files\\Service\\ViewConfig' => __DIR__.'/..'.'/../lib/Service/ViewConfig.php',
78
+        'OCA\\Files\\Settings\\PersonalSettings' => __DIR__.'/..'.'/../lib/Settings/PersonalSettings.php',
79 79
     );
80 80
 
81 81
     public static function getInitializer(ClassLoader $loader)
82 82
     {
83
-        return \Closure::bind(function () use ($loader) {
83
+        return \Closure::bind(function() use ($loader) {
84 84
             $loader->prefixLengthsPsr4 = ComposerStaticInitFiles::$prefixLengthsPsr4;
85 85
             $loader->prefixDirsPsr4 = ComposerStaticInitFiles::$prefixDirsPsr4;
86 86
             $loader->classMap = ComposerStaticInitFiles::$classMap;
Please login to merge, or discard this patch.
apps/files/composer/composer/autoload_classmap.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -6,59 +6,59 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
-    'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir . '/../lib/Activity/FavoriteProvider.php',
11
-    'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir . '/../lib/Activity/Filter/Favorites.php',
12
-    'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir . '/../lib/Activity/Filter/FileChanges.php',
13
-    'OCA\\Files\\Activity\\Helper' => $baseDir . '/../lib/Activity/Helper.php',
14
-    'OCA\\Files\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php',
15
-    'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir . '/../lib/Activity/Settings/FavoriteAction.php',
16
-    'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => $baseDir . '/../lib/Activity/Settings/FileActivitySettings.php',
17
-    'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php',
18
-    'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => $baseDir . '/../lib/Activity/Settings/FileFavoriteChanged.php',
19
-    'OCA\\Files\\App' => $baseDir . '/../lib/App.php',
20
-    'OCA\\Files\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
21
-    'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => $baseDir . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php',
22
-    'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir . '/../lib/BackgroundJob/CleanupFileLocks.php',
23
-    'OCA\\Files\\BackgroundJob\\DeleteExpiredOpenLocalEditor' => $baseDir . '/../lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php',
24
-    'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir . '/../lib/BackgroundJob/DeleteOrphanedItems.php',
25
-    'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir . '/../lib/BackgroundJob/ScanFiles.php',
26
-    'OCA\\Files\\BackgroundJob\\TransferOwnership' => $baseDir . '/../lib/BackgroundJob/TransferOwnership.php',
27
-    'OCA\\Files\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
28
-    'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir . '/../lib/Collaboration/Resources/Listener.php',
29
-    'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir . '/../lib/Collaboration/Resources/ResourceProvider.php',
30
-    'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir . '/../lib/Command/DeleteOrphanedFiles.php',
31
-    'OCA\\Files\\Command\\RepairTree' => $baseDir . '/../lib/Command/RepairTree.php',
32
-    'OCA\\Files\\Command\\Scan' => $baseDir . '/../lib/Command/Scan.php',
33
-    'OCA\\Files\\Command\\ScanAppData' => $baseDir . '/../lib/Command/ScanAppData.php',
34
-    'OCA\\Files\\Command\\TransferOwnership' => $baseDir . '/../lib/Command/TransferOwnership.php',
35
-    'OCA\\Files\\Controller\\ApiController' => $baseDir . '/../lib/Controller/ApiController.php',
36
-    'OCA\\Files\\Controller\\DirectEditingController' => $baseDir . '/../lib/Controller/DirectEditingController.php',
37
-    'OCA\\Files\\Controller\\DirectEditingViewController' => $baseDir . '/../lib/Controller/DirectEditingViewController.php',
38
-    'OCA\\Files\\Controller\\OpenLocalEditorController' => $baseDir . '/../lib/Controller/OpenLocalEditorController.php',
39
-    'OCA\\Files\\Controller\\TemplateController' => $baseDir . '/../lib/Controller/TemplateController.php',
40
-    'OCA\\Files\\Controller\\TransferOwnershipController' => $baseDir . '/../lib/Controller/TransferOwnershipController.php',
41
-    'OCA\\Files\\Controller\\ViewController' => $baseDir . '/../lib/Controller/ViewController.php',
42
-    'OCA\\Files\\Db\\OpenLocalEditor' => $baseDir . '/../lib/Db/OpenLocalEditor.php',
43
-    'OCA\\Files\\Db\\OpenLocalEditorMapper' => $baseDir . '/../lib/Db/OpenLocalEditorMapper.php',
44
-    'OCA\\Files\\Db\\TransferOwnership' => $baseDir . '/../lib/Db/TransferOwnership.php',
45
-    'OCA\\Files\\Db\\TransferOwnershipMapper' => $baseDir . '/../lib/Db/TransferOwnershipMapper.php',
46
-    'OCA\\Files\\DirectEditingCapabilities' => $baseDir . '/../lib/DirectEditingCapabilities.php',
47
-    'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => $baseDir . '/../lib/Event/LoadAdditionalScriptsEvent.php',
48
-    'OCA\\Files\\Event\\LoadSidebar' => $baseDir . '/../lib/Event/LoadSidebar.php',
49
-    'OCA\\Files\\Exception\\TransferOwnershipException' => $baseDir . '/../lib/Exception/TransferOwnershipException.php',
50
-    'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php',
51
-    'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
52
-    'OCA\\Files\\Listener\\LoadSidebarListener' => $baseDir . '/../lib/Listener/LoadSidebarListener.php',
53
-    'OCA\\Files\\Listener\\RenderReferenceEventListener' => $baseDir . '/../lib/Listener/RenderReferenceEventListener.php',
54
-    'OCA\\Files\\Migration\\Version11301Date20191205150729' => $baseDir . '/../lib/Migration/Version11301Date20191205150729.php',
55
-    'OCA\\Files\\Migration\\Version12101Date20221011153334' => $baseDir . '/../lib/Migration/Version12101Date20221011153334.php',
56
-    'OCA\\Files\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
57
-    'OCA\\Files\\Search\\FilesSearchProvider' => $baseDir . '/../lib/Search/FilesSearchProvider.php',
58
-    'OCA\\Files\\Service\\DirectEditingService' => $baseDir . '/../lib/Service/DirectEditingService.php',
59
-    'OCA\\Files\\Service\\OwnershipTransferService' => $baseDir . '/../lib/Service/OwnershipTransferService.php',
60
-    'OCA\\Files\\Service\\TagService' => $baseDir . '/../lib/Service/TagService.php',
61
-    'OCA\\Files\\Service\\UserConfig' => $baseDir . '/../lib/Service/UserConfig.php',
62
-    'OCA\\Files\\Service\\ViewConfig' => $baseDir . '/../lib/Service/ViewConfig.php',
63
-    'OCA\\Files\\Settings\\PersonalSettings' => $baseDir . '/../lib/Settings/PersonalSettings.php',
9
+    'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php',
10
+    'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir.'/../lib/Activity/FavoriteProvider.php',
11
+    'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir.'/../lib/Activity/Filter/Favorites.php',
12
+    'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir.'/../lib/Activity/Filter/FileChanges.php',
13
+    'OCA\\Files\\Activity\\Helper' => $baseDir.'/../lib/Activity/Helper.php',
14
+    'OCA\\Files\\Activity\\Provider' => $baseDir.'/../lib/Activity/Provider.php',
15
+    'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir.'/../lib/Activity/Settings/FavoriteAction.php',
16
+    'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => $baseDir.'/../lib/Activity/Settings/FileActivitySettings.php',
17
+    'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir.'/../lib/Activity/Settings/FileChanged.php',
18
+    'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => $baseDir.'/../lib/Activity/Settings/FileFavoriteChanged.php',
19
+    'OCA\\Files\\App' => $baseDir.'/../lib/App.php',
20
+    'OCA\\Files\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
21
+    'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => $baseDir.'/../lib/BackgroundJob/CleanupDirectEditingTokens.php',
22
+    'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir.'/../lib/BackgroundJob/CleanupFileLocks.php',
23
+    'OCA\\Files\\BackgroundJob\\DeleteExpiredOpenLocalEditor' => $baseDir.'/../lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php',
24
+    'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir.'/../lib/BackgroundJob/DeleteOrphanedItems.php',
25
+    'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir.'/../lib/BackgroundJob/ScanFiles.php',
26
+    'OCA\\Files\\BackgroundJob\\TransferOwnership' => $baseDir.'/../lib/BackgroundJob/TransferOwnership.php',
27
+    'OCA\\Files\\Capabilities' => $baseDir.'/../lib/Capabilities.php',
28
+    'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir.'/../lib/Collaboration/Resources/Listener.php',
29
+    'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir.'/../lib/Collaboration/Resources/ResourceProvider.php',
30
+    'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir.'/../lib/Command/DeleteOrphanedFiles.php',
31
+    'OCA\\Files\\Command\\RepairTree' => $baseDir.'/../lib/Command/RepairTree.php',
32
+    'OCA\\Files\\Command\\Scan' => $baseDir.'/../lib/Command/Scan.php',
33
+    'OCA\\Files\\Command\\ScanAppData' => $baseDir.'/../lib/Command/ScanAppData.php',
34
+    'OCA\\Files\\Command\\TransferOwnership' => $baseDir.'/../lib/Command/TransferOwnership.php',
35
+    'OCA\\Files\\Controller\\ApiController' => $baseDir.'/../lib/Controller/ApiController.php',
36
+    'OCA\\Files\\Controller\\DirectEditingController' => $baseDir.'/../lib/Controller/DirectEditingController.php',
37
+    'OCA\\Files\\Controller\\DirectEditingViewController' => $baseDir.'/../lib/Controller/DirectEditingViewController.php',
38
+    'OCA\\Files\\Controller\\OpenLocalEditorController' => $baseDir.'/../lib/Controller/OpenLocalEditorController.php',
39
+    'OCA\\Files\\Controller\\TemplateController' => $baseDir.'/../lib/Controller/TemplateController.php',
40
+    'OCA\\Files\\Controller\\TransferOwnershipController' => $baseDir.'/../lib/Controller/TransferOwnershipController.php',
41
+    'OCA\\Files\\Controller\\ViewController' => $baseDir.'/../lib/Controller/ViewController.php',
42
+    'OCA\\Files\\Db\\OpenLocalEditor' => $baseDir.'/../lib/Db/OpenLocalEditor.php',
43
+    'OCA\\Files\\Db\\OpenLocalEditorMapper' => $baseDir.'/../lib/Db/OpenLocalEditorMapper.php',
44
+    'OCA\\Files\\Db\\TransferOwnership' => $baseDir.'/../lib/Db/TransferOwnership.php',
45
+    'OCA\\Files\\Db\\TransferOwnershipMapper' => $baseDir.'/../lib/Db/TransferOwnershipMapper.php',
46
+    'OCA\\Files\\DirectEditingCapabilities' => $baseDir.'/../lib/DirectEditingCapabilities.php',
47
+    'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => $baseDir.'/../lib/Event/LoadAdditionalScriptsEvent.php',
48
+    'OCA\\Files\\Event\\LoadSidebar' => $baseDir.'/../lib/Event/LoadSidebar.php',
49
+    'OCA\\Files\\Exception\\TransferOwnershipException' => $baseDir.'/../lib/Exception/TransferOwnershipException.php',
50
+    'OCA\\Files\\Helper' => $baseDir.'/../lib/Helper.php',
51
+    'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir.'/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
52
+    'OCA\\Files\\Listener\\LoadSidebarListener' => $baseDir.'/../lib/Listener/LoadSidebarListener.php',
53
+    'OCA\\Files\\Listener\\RenderReferenceEventListener' => $baseDir.'/../lib/Listener/RenderReferenceEventListener.php',
54
+    'OCA\\Files\\Migration\\Version11301Date20191205150729' => $baseDir.'/../lib/Migration/Version11301Date20191205150729.php',
55
+    'OCA\\Files\\Migration\\Version12101Date20221011153334' => $baseDir.'/../lib/Migration/Version12101Date20221011153334.php',
56
+    'OCA\\Files\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php',
57
+    'OCA\\Files\\Search\\FilesSearchProvider' => $baseDir.'/../lib/Search/FilesSearchProvider.php',
58
+    'OCA\\Files\\Service\\DirectEditingService' => $baseDir.'/../lib/Service/DirectEditingService.php',
59
+    'OCA\\Files\\Service\\OwnershipTransferService' => $baseDir.'/../lib/Service/OwnershipTransferService.php',
60
+    'OCA\\Files\\Service\\TagService' => $baseDir.'/../lib/Service/TagService.php',
61
+    'OCA\\Files\\Service\\UserConfig' => $baseDir.'/../lib/Service/UserConfig.php',
62
+    'OCA\\Files\\Service\\ViewConfig' => $baseDir.'/../lib/Service/ViewConfig.php',
63
+    'OCA\\Files\\Settings\\PersonalSettings' => $baseDir.'/../lib/Settings/PersonalSettings.php',
64 64
 );
Please login to merge, or discard this patch.
apps/files/appinfo/routes.php 1 patch
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -42,183 +42,183 @@
 block discarded – undo
42 42
 // Legacy routes above
43 43
 /** @var \OC\Route\Router $this */
44 44
 $this->create('files_ajax_download', 'apps/files/ajax/download.php')
45
-	->actionInclude('files/ajax/download.php');
45
+    ->actionInclude('files/ajax/download.php');
46 46
 
47 47
 /** @var Application $application */
48 48
 $application = \OC::$server->get(Application::class);
49 49
 $application->registerRoutes(
50
-	$this,
51
-	[
52
-		'routes' => [
53
-			[
54
-				'name' => 'view#index',
55
-				'url' => '/',
56
-				'verb' => 'GET',
57
-			],
58
-			[
59
-				'name' => 'View#showFile',
60
-				'url' => '/f/{fileid}',
61
-				'verb' => 'GET',
62
-				'root' => '',
63
-			],
64
-			[
65
-				'name' => 'API#getThumbnail',
66
-				'url' => '/api/v1/thumbnail/{x}/{y}/{file}',
67
-				'verb' => 'GET',
68
-				'requirements' => ['file' => '.+']
69
-			],
70
-			[
71
-				'name' => 'API#updateFileTags',
72
-				'url' => '/api/v1/files/{path}',
73
-				'verb' => 'POST',
74
-				'requirements' => ['path' => '.+'],
75
-			],
76
-			[
77
-				'name' => 'API#getRecentFiles',
78
-				'url' => '/api/v1/recent/',
79
-				'verb' => 'GET'
80
-			],
81
-			[
82
-				'name' => 'API#getStorageStats',
83
-				'url' => '/api/v1/stats',
84
-				'verb' => 'GET'
85
-			],
86
-			[
87
-				'name' => 'API#setViewConfig',
88
-				'url' => '/api/v1/views/{view}/{key}',
89
-				'verb' => 'PUT'
90
-			],
91
-			[
92
-				'name' => 'API#getViewConfigs',
93
-				'url' => '/api/v1/views',
94
-				'verb' => 'GET'
95
-			],
96
-			[
97
-				'name' => 'API#getViewConfig',
98
-				'url' => '/api/v1/views/{view}',
99
-				'verb' => 'GET'
100
-			],
101
-			[
102
-				'name' => 'API#setConfig',
103
-				'url' => '/api/v1/config/{key}',
104
-				'verb' => 'PUT'
105
-			],
106
-			[
107
-				'name' => 'API#getConfigs',
108
-				'url' => '/api/v1/configs',
109
-				'verb' => 'GET'
110
-			],
111
-			[
112
-				'name' => 'API#showHiddenFiles',
113
-				'url' => '/api/v1/showhidden',
114
-				'verb' => 'POST'
115
-			],
116
-			[
117
-				'name' => 'API#cropImagePreviews',
118
-				'url' => '/api/v1/cropimagepreviews',
119
-				'verb' => 'POST'
120
-			],
121
-			[
122
-				'name' => 'API#showGridView',
123
-				'url' => '/api/v1/showgridview',
124
-				'verb' => 'POST'
125
-			],
126
-			[
127
-				'name' => 'API#getGridView',
128
-				'url' => '/api/v1/showgridview',
129
-				'verb' => 'GET'
130
-			],
131
-			[
132
-				'name' => 'API#getNodeType',
133
-				'url' => '/api/v1/quickaccess/get/NodeType',
134
-				'verb' => 'GET',
135
-			],
136
-			[
137
-				'name' => 'DirectEditingView#edit',
138
-				'url' => '/directEditing/{token}',
139
-				'verb' => 'GET'
140
-			],
141
-			[
142
-				'name' => 'api#serviceWorker',
143
-				'url' => '/preview-service-worker.js',
144
-				'verb' => 'GET'
145
-			],
146
-			[
147
-				'name' => 'view#index',
148
-				'url' => '/{view}',
149
-				'verb' => 'GET',
150
-				'postfix' => 'view',
151
-			],
152
-			[
153
-				'name' => 'view#index',
154
-				'url' => '/{view}/{fileid}',
155
-				'verb' => 'GET',
156
-				'postfix' => 'fileid',
157
-			],
158
-		],
159
-		'ocs' => [
160
-			[
161
-				'name' => 'DirectEditing#info',
162
-				'url' => '/api/v1/directEditing',
163
-				'verb' => 'GET'
164
-			],
165
-			[
166
-				'name' => 'DirectEditing#templates',
167
-				'url' => '/api/v1/directEditing/templates/{editorId}/{creatorId}',
168
-				'verb' => 'GET'
169
-			],
170
-			[
171
-				'name' => 'DirectEditing#open',
172
-				'url' => '/api/v1/directEditing/open',
173
-				'verb' => 'POST'
174
-			],
175
-			[
176
-				'name' => 'DirectEditing#create',
177
-				'url' => '/api/v1/directEditing/create',
178
-				'verb' => 'POST'
179
-			],
180
-			[
181
-				'name' => 'Template#list',
182
-				'url' => '/api/v1/templates',
183
-				'verb' => 'GET'
184
-			],
185
-			[
186
-				'name' => 'Template#create',
187
-				'url' => '/api/v1/templates/create',
188
-				'verb' => 'POST'
189
-			],
190
-			[
191
-				'name' => 'Template#path',
192
-				'url' => '/api/v1/templates/path',
193
-				'verb' => 'POST'
194
-			],
195
-			[
196
-				'name' => 'TransferOwnership#transfer',
197
-				'url' => '/api/v1/transferownership',
198
-				'verb' => 'POST',
199
-			],
200
-			[
201
-				'name' => 'TransferOwnership#accept',
202
-				'url' => '/api/v1/transferownership/{id}',
203
-				'verb' => 'POST',
204
-			],
205
-			[
206
-				'name' => 'TransferOwnership#reject',
207
-				'url' => '/api/v1/transferownership/{id}',
208
-				'verb' => 'DELETE',
209
-			],
210
-			[
211
-				/** @see OpenLocalEditorController::create() */
212
-				'name' => 'OpenLocalEditor#create',
213
-				'url' => '/api/v1/openlocaleditor',
214
-				'verb' => 'POST',
215
-			],
216
-			[
217
-				/** @see OpenLocalEditorController::validate() */
218
-				'name' => 'OpenLocalEditor#validate',
219
-				'url' => '/api/v1/openlocaleditor/{token}',
220
-				'verb' => 'POST',
221
-			],
222
-		],
223
-	]
50
+    $this,
51
+    [
52
+        'routes' => [
53
+            [
54
+                'name' => 'view#index',
55
+                'url' => '/',
56
+                'verb' => 'GET',
57
+            ],
58
+            [
59
+                'name' => 'View#showFile',
60
+                'url' => '/f/{fileid}',
61
+                'verb' => 'GET',
62
+                'root' => '',
63
+            ],
64
+            [
65
+                'name' => 'API#getThumbnail',
66
+                'url' => '/api/v1/thumbnail/{x}/{y}/{file}',
67
+                'verb' => 'GET',
68
+                'requirements' => ['file' => '.+']
69
+            ],
70
+            [
71
+                'name' => 'API#updateFileTags',
72
+                'url' => '/api/v1/files/{path}',
73
+                'verb' => 'POST',
74
+                'requirements' => ['path' => '.+'],
75
+            ],
76
+            [
77
+                'name' => 'API#getRecentFiles',
78
+                'url' => '/api/v1/recent/',
79
+                'verb' => 'GET'
80
+            ],
81
+            [
82
+                'name' => 'API#getStorageStats',
83
+                'url' => '/api/v1/stats',
84
+                'verb' => 'GET'
85
+            ],
86
+            [
87
+                'name' => 'API#setViewConfig',
88
+                'url' => '/api/v1/views/{view}/{key}',
89
+                'verb' => 'PUT'
90
+            ],
91
+            [
92
+                'name' => 'API#getViewConfigs',
93
+                'url' => '/api/v1/views',
94
+                'verb' => 'GET'
95
+            ],
96
+            [
97
+                'name' => 'API#getViewConfig',
98
+                'url' => '/api/v1/views/{view}',
99
+                'verb' => 'GET'
100
+            ],
101
+            [
102
+                'name' => 'API#setConfig',
103
+                'url' => '/api/v1/config/{key}',
104
+                'verb' => 'PUT'
105
+            ],
106
+            [
107
+                'name' => 'API#getConfigs',
108
+                'url' => '/api/v1/configs',
109
+                'verb' => 'GET'
110
+            ],
111
+            [
112
+                'name' => 'API#showHiddenFiles',
113
+                'url' => '/api/v1/showhidden',
114
+                'verb' => 'POST'
115
+            ],
116
+            [
117
+                'name' => 'API#cropImagePreviews',
118
+                'url' => '/api/v1/cropimagepreviews',
119
+                'verb' => 'POST'
120
+            ],
121
+            [
122
+                'name' => 'API#showGridView',
123
+                'url' => '/api/v1/showgridview',
124
+                'verb' => 'POST'
125
+            ],
126
+            [
127
+                'name' => 'API#getGridView',
128
+                'url' => '/api/v1/showgridview',
129
+                'verb' => 'GET'
130
+            ],
131
+            [
132
+                'name' => 'API#getNodeType',
133
+                'url' => '/api/v1/quickaccess/get/NodeType',
134
+                'verb' => 'GET',
135
+            ],
136
+            [
137
+                'name' => 'DirectEditingView#edit',
138
+                'url' => '/directEditing/{token}',
139
+                'verb' => 'GET'
140
+            ],
141
+            [
142
+                'name' => 'api#serviceWorker',
143
+                'url' => '/preview-service-worker.js',
144
+                'verb' => 'GET'
145
+            ],
146
+            [
147
+                'name' => 'view#index',
148
+                'url' => '/{view}',
149
+                'verb' => 'GET',
150
+                'postfix' => 'view',
151
+            ],
152
+            [
153
+                'name' => 'view#index',
154
+                'url' => '/{view}/{fileid}',
155
+                'verb' => 'GET',
156
+                'postfix' => 'fileid',
157
+            ],
158
+        ],
159
+        'ocs' => [
160
+            [
161
+                'name' => 'DirectEditing#info',
162
+                'url' => '/api/v1/directEditing',
163
+                'verb' => 'GET'
164
+            ],
165
+            [
166
+                'name' => 'DirectEditing#templates',
167
+                'url' => '/api/v1/directEditing/templates/{editorId}/{creatorId}',
168
+                'verb' => 'GET'
169
+            ],
170
+            [
171
+                'name' => 'DirectEditing#open',
172
+                'url' => '/api/v1/directEditing/open',
173
+                'verb' => 'POST'
174
+            ],
175
+            [
176
+                'name' => 'DirectEditing#create',
177
+                'url' => '/api/v1/directEditing/create',
178
+                'verb' => 'POST'
179
+            ],
180
+            [
181
+                'name' => 'Template#list',
182
+                'url' => '/api/v1/templates',
183
+                'verb' => 'GET'
184
+            ],
185
+            [
186
+                'name' => 'Template#create',
187
+                'url' => '/api/v1/templates/create',
188
+                'verb' => 'POST'
189
+            ],
190
+            [
191
+                'name' => 'Template#path',
192
+                'url' => '/api/v1/templates/path',
193
+                'verb' => 'POST'
194
+            ],
195
+            [
196
+                'name' => 'TransferOwnership#transfer',
197
+                'url' => '/api/v1/transferownership',
198
+                'verb' => 'POST',
199
+            ],
200
+            [
201
+                'name' => 'TransferOwnership#accept',
202
+                'url' => '/api/v1/transferownership/{id}',
203
+                'verb' => 'POST',
204
+            ],
205
+            [
206
+                'name' => 'TransferOwnership#reject',
207
+                'url' => '/api/v1/transferownership/{id}',
208
+                'verb' => 'DELETE',
209
+            ],
210
+            [
211
+                /** @see OpenLocalEditorController::create() */
212
+                'name' => 'OpenLocalEditor#create',
213
+                'url' => '/api/v1/openlocaleditor',
214
+                'verb' => 'POST',
215
+            ],
216
+            [
217
+                /** @see OpenLocalEditorController::validate() */
218
+                'name' => 'OpenLocalEditor#validate',
219
+                'url' => '/api/v1/openlocaleditor/{token}',
220
+                'verb' => 'POST',
221
+            ],
222
+        ],
223
+    ]
224 224
 );
Please login to merge, or discard this patch.