1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Björn Schießle <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc. |
6
|
|
|
* @license AGPL-3.0 |
7
|
|
|
* |
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
10
|
|
|
* as published by the Free Software Foundation. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
namespace OCA\FilesTextEditor\AppInfo; |
24
|
|
|
|
25
|
|
|
use OCA\FilesTextEditor\Controller\FileHandlingController; |
26
|
|
|
use OCP\AppFramework\App; |
27
|
|
|
use OCP\AppFramework\IAppContainer; |
28
|
|
|
|
29
|
|
|
class Application extends App { |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param array $urlParams |
33
|
|
|
*/ |
34
|
|
|
public function __construct(array $urlParams = array()) { |
35
|
|
|
parent::__construct('files_texteditor', $urlParams); |
36
|
|
|
|
37
|
|
|
$container = $this->getContainer(); |
38
|
|
|
$server = $container->getServer(); |
39
|
|
|
|
40
|
|
|
$container->registerService('FileHandlingController', function (IAppContainer $c) use ($server) { |
41
|
|
|
$user = $server->getUserSession()->getUser(); |
42
|
|
|
if ($user) { |
43
|
|
|
$uid = $user->getUID(); |
44
|
|
|
} else { |
45
|
|
|
throw new \BadMethodCallException('no user logged in'); |
46
|
|
|
} |
47
|
|
|
return new FileHandlingController( |
48
|
|
|
$c->getAppName(), |
49
|
|
|
$server->getRequest(), |
50
|
|
|
$server->getL10N($c->getAppName()), |
51
|
|
|
$server->getLogger(), |
52
|
|
|
$server->getUserFolder($uid) |
53
|
|
|
); |
54
|
|
|
}); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|