1 | <?php |
||
24 | class SettingsController extends Controller{ |
||
25 | |||
26 | private $userId; |
||
27 | private $l10n; |
||
28 | private $appConfig; |
||
29 | |||
30 | public function __construct($appName, IRequest $request, IL10N $l10n, AppConfig $appConfig, $userId){ |
||
36 | |||
37 | /** |
||
38 | * @NoAdminRequired |
||
39 | */ |
||
40 | public function getSupportedMimes(){ |
||
41 | return array( |
||
42 | 'status' => 'success', |
||
43 | 'mimes' => Filter::getAll() |
||
44 | ); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @NoAdminRequired |
||
49 | * @NoCSRFRequired |
||
50 | */ |
||
51 | public function personalIndex(){ |
||
59 | |||
60 | /** |
||
61 | * @NoCSRFRequired |
||
62 | */ |
||
63 | public function settingsIndex(){ |
||
71 | |||
72 | /** |
||
73 | * @NoCSRFRequired |
||
74 | */ |
||
75 | public function adminIndex(){ |
||
86 | |||
87 | /** |
||
88 | * @NoAdminRequired |
||
89 | */ |
||
90 | public function savePersonal($savePath){ |
||
91 | if (is_null($savePath)){ |
||
92 | $savePath = '/'; |
||
93 | } |
||
94 | $status = true; |
||
95 | if (\OC\Files\Filesystem::file_exists($savePath) === false ){ |
||
96 | $status = \OC\Files\Filesystem::mkdir($savePath); |
||
97 | } |
||
98 | |||
99 | if ($status){ |
||
100 | $this->appConfig->setUserValue($this->userId, 'save_path', $savePath); |
||
101 | $response = array( |
||
102 | 'status' => 'success', |
||
103 | 'data' => array('message'=> $this->l10n->t('Directory saved successfully.')) |
||
104 | ); |
||
105 | } else { |
||
106 | $response = array( |
||
107 | 'status' => 'error', |
||
108 | 'data' => array( |
||
109 | 'message'=> $this->l10n->t('An error occurred while changing directory.') |
||
110 | ) |
||
111 | ); |
||
112 | } |
||
113 | return $response; |
||
114 | } |
||
115 | |||
116 | public function setUnstable($unstable){ |
||
117 | if (!is_null($unstable)){ |
||
118 | $this->appConfig->setAppValue('unstable', $unstable); |
||
119 | } |
||
120 | return array('status' => 'success'); |
||
121 | } |
||
122 | |||
123 | public function setConverter($converter, $url){ |
||
169 | } |
||
170 |