@@ -31,390 +31,390 @@ |
||
31 | 31 | use OCP\Files\ObjectStore\IObjectStore; |
32 | 32 | |
33 | 33 | class ObjectStoreStorage extends \OC\Files\Storage\Common { |
34 | - /** |
|
35 | - * @var \OCP\Files\ObjectStore\IObjectStore $objectStore |
|
36 | - */ |
|
37 | - protected $objectStore; |
|
38 | - /** |
|
39 | - * @var string $id |
|
40 | - */ |
|
41 | - protected $id; |
|
42 | - /** |
|
43 | - * @var \OC\User\User $user |
|
44 | - */ |
|
45 | - protected $user; |
|
46 | - |
|
47 | - private $objectPrefix = 'urn:oid:'; |
|
48 | - |
|
49 | - private $logger; |
|
50 | - |
|
51 | - public function __construct($params) { |
|
52 | - if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) { |
|
53 | - $this->objectStore = $params['objectstore']; |
|
54 | - } else { |
|
55 | - throw new \Exception('missing IObjectStore instance'); |
|
56 | - } |
|
57 | - if (isset($params['storageid'])) { |
|
58 | - $this->id = 'object::store:' . $params['storageid']; |
|
59 | - } else { |
|
60 | - $this->id = 'object::store:' . $this->objectStore->getStorageId(); |
|
61 | - } |
|
62 | - if (isset($params['objectPrefix'])) { |
|
63 | - $this->objectPrefix = $params['objectPrefix']; |
|
64 | - } |
|
65 | - //initialize cache with root directory in cache |
|
66 | - if (!$this->is_dir('/')) { |
|
67 | - $this->mkdir('/'); |
|
68 | - } |
|
69 | - |
|
70 | - $this->logger = \OC::$server->getLogger(); |
|
71 | - } |
|
72 | - |
|
73 | - public function mkdir($path) { |
|
74 | - $path = $this->normalizePath($path); |
|
75 | - |
|
76 | - if ($this->file_exists($path)) { |
|
77 | - return false; |
|
78 | - } |
|
79 | - |
|
80 | - $mTime = time(); |
|
81 | - $data = [ |
|
82 | - 'mimetype' => 'httpd/unix-directory', |
|
83 | - 'size' => 0, |
|
84 | - 'mtime' => $mTime, |
|
85 | - 'storage_mtime' => $mTime, |
|
86 | - 'permissions' => \OCP\Constants::PERMISSION_ALL, |
|
87 | - ]; |
|
88 | - if ($path === '') { |
|
89 | - //create root on the fly |
|
90 | - $data['etag'] = $this->getETag(''); |
|
91 | - $this->getCache()->put('', $data); |
|
92 | - return true; |
|
93 | - } else { |
|
94 | - // if parent does not exist, create it |
|
95 | - $parent = $this->normalizePath(dirname($path)); |
|
96 | - $parentType = $this->filetype($parent); |
|
97 | - if ($parentType === false) { |
|
98 | - if (!$this->mkdir($parent)) { |
|
99 | - // something went wrong |
|
100 | - return false; |
|
101 | - } |
|
102 | - } else if ($parentType === 'file') { |
|
103 | - // parent is a file |
|
104 | - return false; |
|
105 | - } |
|
106 | - // finally create the new dir |
|
107 | - $mTime = time(); // update mtime |
|
108 | - $data['mtime'] = $mTime; |
|
109 | - $data['storage_mtime'] = $mTime; |
|
110 | - $data['etag'] = $this->getETag($path); |
|
111 | - $this->getCache()->put($path, $data); |
|
112 | - return true; |
|
113 | - } |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @param string $path |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - private function normalizePath($path) { |
|
121 | - $path = trim($path, '/'); |
|
122 | - //FIXME why do we sometimes get a path like 'files//username'? |
|
123 | - $path = str_replace('//', '/', $path); |
|
124 | - |
|
125 | - // dirname('/folder') returns '.' but internally (in the cache) we store the root as '' |
|
126 | - if (!$path || $path === '.') { |
|
127 | - $path = ''; |
|
128 | - } |
|
129 | - |
|
130 | - return $path; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Object Stores use a NoopScanner because metadata is directly stored in |
|
135 | - * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. |
|
136 | - * |
|
137 | - * @param string $path |
|
138 | - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner |
|
139 | - * @return \OC\Files\ObjectStore\NoopScanner |
|
140 | - */ |
|
141 | - public function getScanner($path = '', $storage = null) { |
|
142 | - if (!$storage) { |
|
143 | - $storage = $this; |
|
144 | - } |
|
145 | - if (!isset($this->scanner)) { |
|
146 | - $this->scanner = new NoopScanner($storage); |
|
147 | - } |
|
148 | - return $this->scanner; |
|
149 | - } |
|
150 | - |
|
151 | - public function getId() { |
|
152 | - return $this->id; |
|
153 | - } |
|
154 | - |
|
155 | - public function rmdir($path) { |
|
156 | - $path = $this->normalizePath($path); |
|
157 | - |
|
158 | - if (!$this->is_dir($path)) { |
|
159 | - return false; |
|
160 | - } |
|
161 | - |
|
162 | - $this->rmObjects($path); |
|
163 | - |
|
164 | - $this->getCache()->remove($path); |
|
165 | - |
|
166 | - return true; |
|
167 | - } |
|
168 | - |
|
169 | - private function rmObjects($path) { |
|
170 | - $children = $this->getCache()->getFolderContents($path); |
|
171 | - foreach ($children as $child) { |
|
172 | - if ($child['mimetype'] === 'httpd/unix-directory') { |
|
173 | - $this->rmObjects($child['path']); |
|
174 | - } else { |
|
175 | - $this->unlink($child['path']); |
|
176 | - } |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - public function unlink($path) { |
|
181 | - $path = $this->normalizePath($path); |
|
182 | - $stat = $this->stat($path); |
|
183 | - |
|
184 | - if ($stat && isset($stat['fileid'])) { |
|
185 | - if ($stat['mimetype'] === 'httpd/unix-directory') { |
|
186 | - return $this->rmdir($path); |
|
187 | - } |
|
188 | - try { |
|
189 | - $this->objectStore->deleteObject($this->getURN($stat['fileid'])); |
|
190 | - } catch (\Exception $ex) { |
|
191 | - if ($ex->getCode() !== 404) { |
|
192 | - $this->logger->logException($ex, [ |
|
193 | - 'app' => 'objectstore', |
|
194 | - 'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path, |
|
195 | - ]); |
|
196 | - return false; |
|
197 | - } else { |
|
198 | - //removing from cache is ok as it does not exist in the objectstore anyway |
|
199 | - } |
|
200 | - } |
|
201 | - $this->getCache()->remove($path); |
|
202 | - return true; |
|
203 | - } |
|
204 | - return false; |
|
205 | - } |
|
206 | - |
|
207 | - public function stat($path) { |
|
208 | - $path = $this->normalizePath($path); |
|
209 | - $cacheEntry = $this->getCache()->get($path); |
|
210 | - if ($cacheEntry instanceof CacheEntry) { |
|
211 | - return $cacheEntry->getData(); |
|
212 | - } else { |
|
213 | - return false; |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * Override this method if you need a different unique resource identifier for your object storage implementation. |
|
219 | - * The default implementations just appends the fileId to 'urn:oid:'. Make sure the URN is unique over all users. |
|
220 | - * You may need a mapping table to store your URN if it cannot be generated from the fileid. |
|
221 | - * |
|
222 | - * @param int $fileId the fileid |
|
223 | - * @return null|string the unified resource name used to identify the object |
|
224 | - */ |
|
225 | - protected function getURN($fileId) { |
|
226 | - if (is_numeric($fileId)) { |
|
227 | - return $this->objectPrefix . $fileId; |
|
228 | - } |
|
229 | - return null; |
|
230 | - } |
|
231 | - |
|
232 | - public function opendir($path) { |
|
233 | - $path = $this->normalizePath($path); |
|
234 | - |
|
235 | - try { |
|
236 | - $files = array(); |
|
237 | - $folderContents = $this->getCache()->getFolderContents($path); |
|
238 | - foreach ($folderContents as $file) { |
|
239 | - $files[] = $file['name']; |
|
240 | - } |
|
241 | - |
|
242 | - return IteratorDirectory::wrap($files); |
|
243 | - } catch (\Exception $e) { |
|
244 | - $this->logger->logException($e); |
|
245 | - return false; |
|
246 | - } |
|
247 | - } |
|
248 | - |
|
249 | - public function filetype($path) { |
|
250 | - $path = $this->normalizePath($path); |
|
251 | - $stat = $this->stat($path); |
|
252 | - if ($stat) { |
|
253 | - if ($stat['mimetype'] === 'httpd/unix-directory') { |
|
254 | - return 'dir'; |
|
255 | - } |
|
256 | - return 'file'; |
|
257 | - } else { |
|
258 | - return false; |
|
259 | - } |
|
260 | - } |
|
261 | - |
|
262 | - public function fopen($path, $mode) { |
|
263 | - $path = $this->normalizePath($path); |
|
264 | - |
|
265 | - switch ($mode) { |
|
266 | - case 'r': |
|
267 | - case 'rb': |
|
268 | - $stat = $this->stat($path); |
|
269 | - if (is_array($stat)) { |
|
270 | - try { |
|
271 | - return $this->objectStore->readObject($this->getURN($stat['fileid'])); |
|
272 | - } catch (\Exception $ex) { |
|
273 | - $this->logger->logException($ex, [ |
|
274 | - 'app' => 'objectstore', |
|
275 | - 'message' => 'Count not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
276 | - ]); |
|
277 | - return false; |
|
278 | - } |
|
279 | - } else { |
|
280 | - return false; |
|
281 | - } |
|
282 | - case 'w': |
|
283 | - case 'wb': |
|
284 | - case 'a': |
|
285 | - case 'ab': |
|
286 | - case 'r+': |
|
287 | - case 'w+': |
|
288 | - case 'wb+': |
|
289 | - case 'a+': |
|
290 | - case 'x': |
|
291 | - case 'x+': |
|
292 | - case 'c': |
|
293 | - case 'c+': |
|
294 | - if (strrpos($path, '.') !== false) { |
|
295 | - $ext = substr($path, strrpos($path, '.')); |
|
296 | - } else { |
|
297 | - $ext = ''; |
|
298 | - } |
|
299 | - $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); |
|
300 | - if ($this->file_exists($path)) { |
|
301 | - $source = $this->fopen($path, 'r'); |
|
302 | - file_put_contents($tmpFile, $source); |
|
303 | - } |
|
304 | - $handle = fopen($tmpFile, $mode); |
|
305 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
306 | - $this->writeBack($tmpFile, $path); |
|
307 | - }); |
|
308 | - } |
|
309 | - return false; |
|
310 | - } |
|
311 | - |
|
312 | - public function file_exists($path) { |
|
313 | - $path = $this->normalizePath($path); |
|
314 | - return (bool)$this->stat($path); |
|
315 | - } |
|
316 | - |
|
317 | - public function rename($source, $target) { |
|
318 | - $source = $this->normalizePath($source); |
|
319 | - $target = $this->normalizePath($target); |
|
320 | - $this->remove($target); |
|
321 | - $this->getCache()->move($source, $target); |
|
322 | - $this->touch(dirname($target)); |
|
323 | - return true; |
|
324 | - } |
|
325 | - |
|
326 | - public function getMimeType($path) { |
|
327 | - $path = $this->normalizePath($path); |
|
328 | - $stat = $this->stat($path); |
|
329 | - if (is_array($stat)) { |
|
330 | - return $stat['mimetype']; |
|
331 | - } else { |
|
332 | - return false; |
|
333 | - } |
|
334 | - } |
|
335 | - |
|
336 | - public function touch($path, $mtime = null) { |
|
337 | - if (is_null($mtime)) { |
|
338 | - $mtime = time(); |
|
339 | - } |
|
340 | - |
|
341 | - $path = $this->normalizePath($path); |
|
342 | - $dirName = dirname($path); |
|
343 | - $parentExists = $this->is_dir($dirName); |
|
344 | - if (!$parentExists) { |
|
345 | - return false; |
|
346 | - } |
|
347 | - |
|
348 | - $stat = $this->stat($path); |
|
349 | - if (is_array($stat)) { |
|
350 | - // update existing mtime in db |
|
351 | - $stat['mtime'] = $mtime; |
|
352 | - $this->getCache()->update($stat['fileid'], $stat); |
|
353 | - } else { |
|
354 | - $mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path); |
|
355 | - // create new file |
|
356 | - $stat = array( |
|
357 | - 'etag' => $this->getETag($path), |
|
358 | - 'mimetype' => $mimeType, |
|
359 | - 'size' => 0, |
|
360 | - 'mtime' => $mtime, |
|
361 | - 'storage_mtime' => $mtime, |
|
362 | - 'permissions' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, |
|
363 | - ); |
|
364 | - $fileId = $this->getCache()->put($path, $stat); |
|
365 | - try { |
|
366 | - //read an empty file from memory |
|
367 | - $this->objectStore->writeObject($this->getURN($fileId), fopen('php://memory', 'r')); |
|
368 | - } catch (\Exception $ex) { |
|
369 | - $this->getCache()->remove($path); |
|
370 | - $this->logger->logException($ex, [ |
|
371 | - 'app' => 'objectstore', |
|
372 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
373 | - ]); |
|
374 | - return false; |
|
375 | - } |
|
376 | - } |
|
377 | - return true; |
|
378 | - } |
|
379 | - |
|
380 | - public function writeBack($tmpFile, $path) { |
|
381 | - $stat = $this->stat($path); |
|
382 | - if (empty($stat)) { |
|
383 | - // create new file |
|
384 | - $stat = array( |
|
385 | - 'permissions' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, |
|
386 | - ); |
|
387 | - } |
|
388 | - // update stat with new data |
|
389 | - $mTime = time(); |
|
390 | - $stat['size'] = filesize($tmpFile); |
|
391 | - $stat['mtime'] = $mTime; |
|
392 | - $stat['storage_mtime'] = $mTime; |
|
393 | - $stat['mimetype'] = \OC::$server->getMimeTypeDetector()->detect($tmpFile); |
|
394 | - $stat['etag'] = $this->getETag($path); |
|
395 | - |
|
396 | - $fileId = $this->getCache()->put($path, $stat); |
|
397 | - try { |
|
398 | - //upload to object storage |
|
399 | - $this->objectStore->writeObject($this->getURN($fileId), fopen($tmpFile, 'r')); |
|
400 | - } catch (\Exception $ex) { |
|
401 | - $this->getCache()->remove($path); |
|
402 | - $this->logger->logException($ex, [ |
|
403 | - 'app' => 'objectstore', |
|
404 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
405 | - ]); |
|
406 | - throw $ex; // make this bubble up |
|
407 | - } |
|
408 | - } |
|
409 | - |
|
410 | - /** |
|
411 | - * external changes are not supported, exclusive access to the object storage is assumed |
|
412 | - * |
|
413 | - * @param string $path |
|
414 | - * @param int $time |
|
415 | - * @return false |
|
416 | - */ |
|
417 | - public function hasUpdated($path, $time) { |
|
418 | - return false; |
|
419 | - } |
|
34 | + /** |
|
35 | + * @var \OCP\Files\ObjectStore\IObjectStore $objectStore |
|
36 | + */ |
|
37 | + protected $objectStore; |
|
38 | + /** |
|
39 | + * @var string $id |
|
40 | + */ |
|
41 | + protected $id; |
|
42 | + /** |
|
43 | + * @var \OC\User\User $user |
|
44 | + */ |
|
45 | + protected $user; |
|
46 | + |
|
47 | + private $objectPrefix = 'urn:oid:'; |
|
48 | + |
|
49 | + private $logger; |
|
50 | + |
|
51 | + public function __construct($params) { |
|
52 | + if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) { |
|
53 | + $this->objectStore = $params['objectstore']; |
|
54 | + } else { |
|
55 | + throw new \Exception('missing IObjectStore instance'); |
|
56 | + } |
|
57 | + if (isset($params['storageid'])) { |
|
58 | + $this->id = 'object::store:' . $params['storageid']; |
|
59 | + } else { |
|
60 | + $this->id = 'object::store:' . $this->objectStore->getStorageId(); |
|
61 | + } |
|
62 | + if (isset($params['objectPrefix'])) { |
|
63 | + $this->objectPrefix = $params['objectPrefix']; |
|
64 | + } |
|
65 | + //initialize cache with root directory in cache |
|
66 | + if (!$this->is_dir('/')) { |
|
67 | + $this->mkdir('/'); |
|
68 | + } |
|
69 | + |
|
70 | + $this->logger = \OC::$server->getLogger(); |
|
71 | + } |
|
72 | + |
|
73 | + public function mkdir($path) { |
|
74 | + $path = $this->normalizePath($path); |
|
75 | + |
|
76 | + if ($this->file_exists($path)) { |
|
77 | + return false; |
|
78 | + } |
|
79 | + |
|
80 | + $mTime = time(); |
|
81 | + $data = [ |
|
82 | + 'mimetype' => 'httpd/unix-directory', |
|
83 | + 'size' => 0, |
|
84 | + 'mtime' => $mTime, |
|
85 | + 'storage_mtime' => $mTime, |
|
86 | + 'permissions' => \OCP\Constants::PERMISSION_ALL, |
|
87 | + ]; |
|
88 | + if ($path === '') { |
|
89 | + //create root on the fly |
|
90 | + $data['etag'] = $this->getETag(''); |
|
91 | + $this->getCache()->put('', $data); |
|
92 | + return true; |
|
93 | + } else { |
|
94 | + // if parent does not exist, create it |
|
95 | + $parent = $this->normalizePath(dirname($path)); |
|
96 | + $parentType = $this->filetype($parent); |
|
97 | + if ($parentType === false) { |
|
98 | + if (!$this->mkdir($parent)) { |
|
99 | + // something went wrong |
|
100 | + return false; |
|
101 | + } |
|
102 | + } else if ($parentType === 'file') { |
|
103 | + // parent is a file |
|
104 | + return false; |
|
105 | + } |
|
106 | + // finally create the new dir |
|
107 | + $mTime = time(); // update mtime |
|
108 | + $data['mtime'] = $mTime; |
|
109 | + $data['storage_mtime'] = $mTime; |
|
110 | + $data['etag'] = $this->getETag($path); |
|
111 | + $this->getCache()->put($path, $data); |
|
112 | + return true; |
|
113 | + } |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @param string $path |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + private function normalizePath($path) { |
|
121 | + $path = trim($path, '/'); |
|
122 | + //FIXME why do we sometimes get a path like 'files//username'? |
|
123 | + $path = str_replace('//', '/', $path); |
|
124 | + |
|
125 | + // dirname('/folder') returns '.' but internally (in the cache) we store the root as '' |
|
126 | + if (!$path || $path === '.') { |
|
127 | + $path = ''; |
|
128 | + } |
|
129 | + |
|
130 | + return $path; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Object Stores use a NoopScanner because metadata is directly stored in |
|
135 | + * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. |
|
136 | + * |
|
137 | + * @param string $path |
|
138 | + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner |
|
139 | + * @return \OC\Files\ObjectStore\NoopScanner |
|
140 | + */ |
|
141 | + public function getScanner($path = '', $storage = null) { |
|
142 | + if (!$storage) { |
|
143 | + $storage = $this; |
|
144 | + } |
|
145 | + if (!isset($this->scanner)) { |
|
146 | + $this->scanner = new NoopScanner($storage); |
|
147 | + } |
|
148 | + return $this->scanner; |
|
149 | + } |
|
150 | + |
|
151 | + public function getId() { |
|
152 | + return $this->id; |
|
153 | + } |
|
154 | + |
|
155 | + public function rmdir($path) { |
|
156 | + $path = $this->normalizePath($path); |
|
157 | + |
|
158 | + if (!$this->is_dir($path)) { |
|
159 | + return false; |
|
160 | + } |
|
161 | + |
|
162 | + $this->rmObjects($path); |
|
163 | + |
|
164 | + $this->getCache()->remove($path); |
|
165 | + |
|
166 | + return true; |
|
167 | + } |
|
168 | + |
|
169 | + private function rmObjects($path) { |
|
170 | + $children = $this->getCache()->getFolderContents($path); |
|
171 | + foreach ($children as $child) { |
|
172 | + if ($child['mimetype'] === 'httpd/unix-directory') { |
|
173 | + $this->rmObjects($child['path']); |
|
174 | + } else { |
|
175 | + $this->unlink($child['path']); |
|
176 | + } |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + public function unlink($path) { |
|
181 | + $path = $this->normalizePath($path); |
|
182 | + $stat = $this->stat($path); |
|
183 | + |
|
184 | + if ($stat && isset($stat['fileid'])) { |
|
185 | + if ($stat['mimetype'] === 'httpd/unix-directory') { |
|
186 | + return $this->rmdir($path); |
|
187 | + } |
|
188 | + try { |
|
189 | + $this->objectStore->deleteObject($this->getURN($stat['fileid'])); |
|
190 | + } catch (\Exception $ex) { |
|
191 | + if ($ex->getCode() !== 404) { |
|
192 | + $this->logger->logException($ex, [ |
|
193 | + 'app' => 'objectstore', |
|
194 | + 'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path, |
|
195 | + ]); |
|
196 | + return false; |
|
197 | + } else { |
|
198 | + //removing from cache is ok as it does not exist in the objectstore anyway |
|
199 | + } |
|
200 | + } |
|
201 | + $this->getCache()->remove($path); |
|
202 | + return true; |
|
203 | + } |
|
204 | + return false; |
|
205 | + } |
|
206 | + |
|
207 | + public function stat($path) { |
|
208 | + $path = $this->normalizePath($path); |
|
209 | + $cacheEntry = $this->getCache()->get($path); |
|
210 | + if ($cacheEntry instanceof CacheEntry) { |
|
211 | + return $cacheEntry->getData(); |
|
212 | + } else { |
|
213 | + return false; |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * Override this method if you need a different unique resource identifier for your object storage implementation. |
|
219 | + * The default implementations just appends the fileId to 'urn:oid:'. Make sure the URN is unique over all users. |
|
220 | + * You may need a mapping table to store your URN if it cannot be generated from the fileid. |
|
221 | + * |
|
222 | + * @param int $fileId the fileid |
|
223 | + * @return null|string the unified resource name used to identify the object |
|
224 | + */ |
|
225 | + protected function getURN($fileId) { |
|
226 | + if (is_numeric($fileId)) { |
|
227 | + return $this->objectPrefix . $fileId; |
|
228 | + } |
|
229 | + return null; |
|
230 | + } |
|
231 | + |
|
232 | + public function opendir($path) { |
|
233 | + $path = $this->normalizePath($path); |
|
234 | + |
|
235 | + try { |
|
236 | + $files = array(); |
|
237 | + $folderContents = $this->getCache()->getFolderContents($path); |
|
238 | + foreach ($folderContents as $file) { |
|
239 | + $files[] = $file['name']; |
|
240 | + } |
|
241 | + |
|
242 | + return IteratorDirectory::wrap($files); |
|
243 | + } catch (\Exception $e) { |
|
244 | + $this->logger->logException($e); |
|
245 | + return false; |
|
246 | + } |
|
247 | + } |
|
248 | + |
|
249 | + public function filetype($path) { |
|
250 | + $path = $this->normalizePath($path); |
|
251 | + $stat = $this->stat($path); |
|
252 | + if ($stat) { |
|
253 | + if ($stat['mimetype'] === 'httpd/unix-directory') { |
|
254 | + return 'dir'; |
|
255 | + } |
|
256 | + return 'file'; |
|
257 | + } else { |
|
258 | + return false; |
|
259 | + } |
|
260 | + } |
|
261 | + |
|
262 | + public function fopen($path, $mode) { |
|
263 | + $path = $this->normalizePath($path); |
|
264 | + |
|
265 | + switch ($mode) { |
|
266 | + case 'r': |
|
267 | + case 'rb': |
|
268 | + $stat = $this->stat($path); |
|
269 | + if (is_array($stat)) { |
|
270 | + try { |
|
271 | + return $this->objectStore->readObject($this->getURN($stat['fileid'])); |
|
272 | + } catch (\Exception $ex) { |
|
273 | + $this->logger->logException($ex, [ |
|
274 | + 'app' => 'objectstore', |
|
275 | + 'message' => 'Count not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
276 | + ]); |
|
277 | + return false; |
|
278 | + } |
|
279 | + } else { |
|
280 | + return false; |
|
281 | + } |
|
282 | + case 'w': |
|
283 | + case 'wb': |
|
284 | + case 'a': |
|
285 | + case 'ab': |
|
286 | + case 'r+': |
|
287 | + case 'w+': |
|
288 | + case 'wb+': |
|
289 | + case 'a+': |
|
290 | + case 'x': |
|
291 | + case 'x+': |
|
292 | + case 'c': |
|
293 | + case 'c+': |
|
294 | + if (strrpos($path, '.') !== false) { |
|
295 | + $ext = substr($path, strrpos($path, '.')); |
|
296 | + } else { |
|
297 | + $ext = ''; |
|
298 | + } |
|
299 | + $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); |
|
300 | + if ($this->file_exists($path)) { |
|
301 | + $source = $this->fopen($path, 'r'); |
|
302 | + file_put_contents($tmpFile, $source); |
|
303 | + } |
|
304 | + $handle = fopen($tmpFile, $mode); |
|
305 | + return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
306 | + $this->writeBack($tmpFile, $path); |
|
307 | + }); |
|
308 | + } |
|
309 | + return false; |
|
310 | + } |
|
311 | + |
|
312 | + public function file_exists($path) { |
|
313 | + $path = $this->normalizePath($path); |
|
314 | + return (bool)$this->stat($path); |
|
315 | + } |
|
316 | + |
|
317 | + public function rename($source, $target) { |
|
318 | + $source = $this->normalizePath($source); |
|
319 | + $target = $this->normalizePath($target); |
|
320 | + $this->remove($target); |
|
321 | + $this->getCache()->move($source, $target); |
|
322 | + $this->touch(dirname($target)); |
|
323 | + return true; |
|
324 | + } |
|
325 | + |
|
326 | + public function getMimeType($path) { |
|
327 | + $path = $this->normalizePath($path); |
|
328 | + $stat = $this->stat($path); |
|
329 | + if (is_array($stat)) { |
|
330 | + return $stat['mimetype']; |
|
331 | + } else { |
|
332 | + return false; |
|
333 | + } |
|
334 | + } |
|
335 | + |
|
336 | + public function touch($path, $mtime = null) { |
|
337 | + if (is_null($mtime)) { |
|
338 | + $mtime = time(); |
|
339 | + } |
|
340 | + |
|
341 | + $path = $this->normalizePath($path); |
|
342 | + $dirName = dirname($path); |
|
343 | + $parentExists = $this->is_dir($dirName); |
|
344 | + if (!$parentExists) { |
|
345 | + return false; |
|
346 | + } |
|
347 | + |
|
348 | + $stat = $this->stat($path); |
|
349 | + if (is_array($stat)) { |
|
350 | + // update existing mtime in db |
|
351 | + $stat['mtime'] = $mtime; |
|
352 | + $this->getCache()->update($stat['fileid'], $stat); |
|
353 | + } else { |
|
354 | + $mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path); |
|
355 | + // create new file |
|
356 | + $stat = array( |
|
357 | + 'etag' => $this->getETag($path), |
|
358 | + 'mimetype' => $mimeType, |
|
359 | + 'size' => 0, |
|
360 | + 'mtime' => $mtime, |
|
361 | + 'storage_mtime' => $mtime, |
|
362 | + 'permissions' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, |
|
363 | + ); |
|
364 | + $fileId = $this->getCache()->put($path, $stat); |
|
365 | + try { |
|
366 | + //read an empty file from memory |
|
367 | + $this->objectStore->writeObject($this->getURN($fileId), fopen('php://memory', 'r')); |
|
368 | + } catch (\Exception $ex) { |
|
369 | + $this->getCache()->remove($path); |
|
370 | + $this->logger->logException($ex, [ |
|
371 | + 'app' => 'objectstore', |
|
372 | + 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
373 | + ]); |
|
374 | + return false; |
|
375 | + } |
|
376 | + } |
|
377 | + return true; |
|
378 | + } |
|
379 | + |
|
380 | + public function writeBack($tmpFile, $path) { |
|
381 | + $stat = $this->stat($path); |
|
382 | + if (empty($stat)) { |
|
383 | + // create new file |
|
384 | + $stat = array( |
|
385 | + 'permissions' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, |
|
386 | + ); |
|
387 | + } |
|
388 | + // update stat with new data |
|
389 | + $mTime = time(); |
|
390 | + $stat['size'] = filesize($tmpFile); |
|
391 | + $stat['mtime'] = $mTime; |
|
392 | + $stat['storage_mtime'] = $mTime; |
|
393 | + $stat['mimetype'] = \OC::$server->getMimeTypeDetector()->detect($tmpFile); |
|
394 | + $stat['etag'] = $this->getETag($path); |
|
395 | + |
|
396 | + $fileId = $this->getCache()->put($path, $stat); |
|
397 | + try { |
|
398 | + //upload to object storage |
|
399 | + $this->objectStore->writeObject($this->getURN($fileId), fopen($tmpFile, 'r')); |
|
400 | + } catch (\Exception $ex) { |
|
401 | + $this->getCache()->remove($path); |
|
402 | + $this->logger->logException($ex, [ |
|
403 | + 'app' => 'objectstore', |
|
404 | + 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
405 | + ]); |
|
406 | + throw $ex; // make this bubble up |
|
407 | + } |
|
408 | + } |
|
409 | + |
|
410 | + /** |
|
411 | + * external changes are not supported, exclusive access to the object storage is assumed |
|
412 | + * |
|
413 | + * @param string $path |
|
414 | + * @param int $time |
|
415 | + * @return false |
|
416 | + */ |
|
417 | + public function hasUpdated($path, $time) { |
|
418 | + return false; |
|
419 | + } |
|
420 | 420 | } |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | throw new \Exception('missing IObjectStore instance'); |
56 | 56 | } |
57 | 57 | if (isset($params['storageid'])) { |
58 | - $this->id = 'object::store:' . $params['storageid']; |
|
58 | + $this->id = 'object::store:'.$params['storageid']; |
|
59 | 59 | } else { |
60 | - $this->id = 'object::store:' . $this->objectStore->getStorageId(); |
|
60 | + $this->id = 'object::store:'.$this->objectStore->getStorageId(); |
|
61 | 61 | } |
62 | 62 | if (isset($params['objectPrefix'])) { |
63 | 63 | $this->objectPrefix = $params['objectPrefix']; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if ($ex->getCode() !== 404) { |
192 | 192 | $this->logger->logException($ex, [ |
193 | 193 | 'app' => 'objectstore', |
194 | - 'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path, |
|
194 | + 'message' => 'Could not delete object '.$this->getURN($stat['fileid']).' for '.$path, |
|
195 | 195 | ]); |
196 | 196 | return false; |
197 | 197 | } else { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | protected function getURN($fileId) { |
226 | 226 | if (is_numeric($fileId)) { |
227 | - return $this->objectPrefix . $fileId; |
|
227 | + return $this->objectPrefix.$fileId; |
|
228 | 228 | } |
229 | 229 | return null; |
230 | 230 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } catch (\Exception $ex) { |
273 | 273 | $this->logger->logException($ex, [ |
274 | 274 | 'app' => 'objectstore', |
275 | - 'message' => 'Count not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
275 | + 'message' => 'Count not get object '.$this->getURN($stat['fileid']).' for file '.$path, |
|
276 | 276 | ]); |
277 | 277 | return false; |
278 | 278 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | file_put_contents($tmpFile, $source); |
303 | 303 | } |
304 | 304 | $handle = fopen($tmpFile, $mode); |
305 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
305 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
306 | 306 | $this->writeBack($tmpFile, $path); |
307 | 307 | }); |
308 | 308 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | public function file_exists($path) { |
313 | 313 | $path = $this->normalizePath($path); |
314 | - return (bool)$this->stat($path); |
|
314 | + return (bool) $this->stat($path); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | public function rename($source, $target) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->getCache()->remove($path); |
370 | 370 | $this->logger->logException($ex, [ |
371 | 371 | 'app' => 'objectstore', |
372 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
372 | + 'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path, |
|
373 | 373 | ]); |
374 | 374 | return false; |
375 | 375 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $this->getCache()->remove($path); |
402 | 402 | $this->logger->logException($ex, [ |
403 | 403 | 'app' => 'objectstore', |
404 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
404 | + 'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path, |
|
405 | 405 | ]); |
406 | 406 | throw $ex; // make this bubble up |
407 | 407 | } |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | <div id="app-navigation"> |
12 | 12 | <ul class="with-icon"> |
13 | 13 | <?php foreach($_['forms'] as $form) { |
14 | - if (isset($form['anchor'])) { |
|
15 | - $anchor = '#' . $form['anchor']; |
|
16 | - $class = 'nav-icon-' . $form['anchor']; |
|
17 | - $sectionName = $form['section-name']; |
|
18 | - print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
|
19 | - \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
|
20 | - } |
|
21 | - }?> |
|
14 | + if (isset($form['anchor'])) { |
|
15 | + $anchor = '#' . $form['anchor']; |
|
16 | + $class = 'nav-icon-' . $form['anchor']; |
|
17 | + $sectionName = $form['section-name']; |
|
18 | + print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
|
19 | + \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
|
20 | + } |
|
21 | + }?> |
|
22 | 22 | </ul> |
23 | 23 | </div> |
24 | 24 | |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | <p id="quotatext"> |
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | - [$_['usage'], $_['total_space']]));?> |
|
33 | + [$_['usage'], $_['total_space']]));?> |
|
34 | 34 | <?php else: ?> |
35 | 35 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
36 | + [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
37 | 37 | <?php endif ?> |
38 | 38 | </p> |
39 | 39 | </div> |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>"> |
100 | 100 | <img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src=" |
101 | 101 | <?php |
102 | - switch($_['emailVerification']) { |
|
103 | - case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
104 | - p(image_path('core', 'actions/verifying.svg')); |
|
105 | - break; |
|
106 | - case \OC\Accounts\AccountManager::VERIFIED: |
|
107 | - p(image_path('core', 'actions/verified.svg')); |
|
108 | - break; |
|
109 | - default: |
|
110 | - p(image_path('core', 'actions/verify.svg')); |
|
111 | - } |
|
112 | - ?>"> |
|
102 | + switch($_['emailVerification']) { |
|
103 | + case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
104 | + p(image_path('core', 'actions/verifying.svg')); |
|
105 | + break; |
|
106 | + case \OC\Accounts\AccountManager::VERIFIED: |
|
107 | + p(image_path('core', 'actions/verified.svg')); |
|
108 | + break; |
|
109 | + default: |
|
110 | + p(image_path('core', 'actions/verify.svg')); |
|
111 | + } |
|
112 | + ?>"> |
|
113 | 113 | </div> |
114 | 114 | <input type="email" name="email" id="email" value="<?php if(!$_['displayNameChangeSupported'] && empty($_['email'])) p($l->t('No email address set')); else p($_['email']); ?>" |
115 | 115 | <?php if(!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?> |
@@ -172,17 +172,17 @@ discard block |
||
172 | 172 | <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>"> |
173 | 173 | <img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src=" |
174 | 174 | <?php |
175 | - switch($_['websiteVerification']) { |
|
176 | - case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
177 | - p(image_path('core', 'actions/verifying.svg')); |
|
178 | - break; |
|
179 | - case \OC\Accounts\AccountManager::VERIFIED: |
|
180 | - p(image_path('core', 'actions/verified.svg')); |
|
181 | - break; |
|
182 | - default: |
|
183 | - p(image_path('core', 'actions/verify.svg')); |
|
184 | - } |
|
185 | - ?>" |
|
175 | + switch($_['websiteVerification']) { |
|
176 | + case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
177 | + p(image_path('core', 'actions/verifying.svg')); |
|
178 | + break; |
|
179 | + case \OC\Accounts\AccountManager::VERIFIED: |
|
180 | + p(image_path('core', 'actions/verified.svg')); |
|
181 | + break; |
|
182 | + default: |
|
183 | + p(image_path('core', 'actions/verify.svg')); |
|
184 | + } |
|
185 | + ?>" |
|
186 | 186 | <?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
187 | 187 | > |
188 | 188 | <div class="verification-dialog popovermenu bubble menu"> |
@@ -217,17 +217,17 @@ discard block |
||
217 | 217 | <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>"> |
218 | 218 | <img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src=" |
219 | 219 | <?php |
220 | - switch($_['twitterVerification']) { |
|
221 | - case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
222 | - p(image_path('core', 'actions/verifying.svg')); |
|
223 | - break; |
|
224 | - case \OC\Accounts\AccountManager::VERIFIED: |
|
225 | - p(image_path('core', 'actions/verified.svg')); |
|
226 | - break; |
|
227 | - default: |
|
228 | - p(image_path('core', 'actions/verify.svg')); |
|
229 | - } |
|
230 | - ?>" |
|
220 | + switch($_['twitterVerification']) { |
|
221 | + case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
222 | + p(image_path('core', 'actions/verifying.svg')); |
|
223 | + break; |
|
224 | + case \OC\Accounts\AccountManager::VERIFIED: |
|
225 | + p(image_path('core', 'actions/verified.svg')); |
|
226 | + break; |
|
227 | + default: |
|
228 | + p(image_path('core', 'actions/verify.svg')); |
|
229 | + } |
|
230 | + ?>" |
|
231 | 231 | <?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
232 | 232 | > |
233 | 233 | <div class="verification-dialog popovermenu bubble menu"> |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | </div> |
293 | 293 | <div class="personal-settings-setting-box personal-settings-password-box"> |
294 | 294 | <?php |
295 | - if($_['passwordChangeSupported']) { |
|
296 | - script('jquery-showpassword'); |
|
297 | - ?> |
|
295 | + if($_['passwordChangeSupported']) { |
|
296 | + script('jquery-showpassword'); |
|
297 | + ?> |
|
298 | 298 | <form id="passwordform" class="section"> |
299 | 299 | <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
300 | 300 | <div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div> |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | <br/> |
318 | 318 | </form> |
319 | 319 | <?php |
320 | - } |
|
321 | - ?> |
|
320 | + } |
|
321 | + ?> |
|
322 | 322 | </div> |
323 | 323 | <span class="msg"></span> |
324 | 324 | </div> |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | |
345 | 345 | <p> |
346 | 346 | <?php print_unescaped(str_replace( |
347 | - [ |
|
348 | - '{contributeopen}', |
|
349 | - '{linkclose}', |
|
350 | - ], |
|
351 | - [ |
|
352 | - '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', |
|
353 | - '</a>', |
|
354 | - ], |
|
355 | - $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
|
347 | + [ |
|
348 | + '{contributeopen}', |
|
349 | + '{linkclose}', |
|
350 | + ], |
|
351 | + [ |
|
352 | + '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', |
|
353 | + '</a>', |
|
354 | + ], |
|
355 | + $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
|
356 | 356 | </p> |
357 | 357 | |
358 | 358 | <?php if(OC_APP::isEnabled('firstrunwizard')) {?> |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | </div> |
402 | 402 | |
403 | 403 | <?php foreach($_['forms'] as $form) { |
404 | - if (isset($form['form'])) {?> |
|
404 | + if (isset($form['form'])) {?> |
|
405 | 405 | <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
406 | 406 | <?php } |
407 | 407 | };?> |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | <div id="app-navigation"> |
12 | 12 | <ul class="with-icon"> |
13 | - <?php foreach($_['forms'] as $form) { |
|
13 | + <?php foreach ($_['forms'] as $form) { |
|
14 | 14 | if (isset($form['anchor'])) { |
15 | - $anchor = '#' . $form['anchor']; |
|
16 | - $class = 'nav-icon-' . $form['anchor']; |
|
15 | + $anchor = '#'.$form['anchor']; |
|
16 | + $class = 'nav-icon-'.$form['anchor']; |
|
17 | 17 | $sectionName = $form['section-name']; |
18 | 18 | print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
19 | 19 | \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | <div id="app-content"> |
26 | 26 | |
27 | 27 | <div id="quota" class="section"> |
28 | - <div style="width:<?php p($_['usage_relative']);?>%" |
|
29 | - <?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> |
|
28 | + <div style="width:<?php p($_['usage_relative']); ?>%" |
|
29 | + <?php if ($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> |
|
30 | 30 | <p id="quotatext"> |
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | - [$_['usage'], $_['total_space']]));?> |
|
33 | + [$_['usage'], $_['total_space']])); ?> |
|
34 | 34 | <?php else: ?> |
35 | 35 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
36 | + [$_['usage'], $_['total_space'], $_['usage_relative']])); ?> |
|
37 | 37 | <?php endif ?> |
38 | 38 | </p> |
39 | 39 | </div> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </div> |
68 | 68 | </div> |
69 | 69 | <span class="icon-checkmark hidden"/> |
70 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
70 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
71 | 71 | <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>"> |
72 | 72 | <?php } ?> |
73 | 73 | </form> |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | <span class="icon-federation-menu icon-password">▾<span/> |
82 | 82 | </h2> |
83 | 83 | <input type="text" id="displayname" name="displayname" |
84 | - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?> |
|
84 | + <?php if (!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?> |
|
85 | 85 | value="<?php p($_['displayName']) ?>" |
86 | 86 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
87 | 87 | <span class="icon-checkmark hidden"/> |
88 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
88 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
89 | 89 | <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>"> |
90 | 90 | <?php } ?> |
91 | 91 | </form> |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | <label for="email"><?php p($l->t('Email')); ?></label> |
97 | 97 | <span class="icon-federation-menu icon-password">▾<span/> |
98 | 98 | </h2> |
99 | - <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>"> |
|
99 | + <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>"> |
|
100 | 100 | <img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src=" |
101 | 101 | <?php |
102 | - switch($_['emailVerification']) { |
|
102 | + switch ($_['emailVerification']) { |
|
103 | 103 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
104 | 104 | p(image_path('core', 'actions/verifying.svg')); |
105 | 105 | break; |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | } |
112 | 112 | ?>"> |
113 | 113 | </div> |
114 | - <input type="email" name="email" id="email" value="<?php if(!$_['displayNameChangeSupported'] && empty($_['email'])) p($l->t('No email address set')); else p($_['email']); ?>" |
|
115 | - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?> |
|
114 | + <input type="email" name="email" id="email" value="<?php if (!$_['displayNameChangeSupported'] && empty($_['email'])) p($l->t('No email address set')); else p($_['email']); ?>" |
|
115 | + <?php if (!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?> |
|
116 | 116 | placeholder="<?php p($l->t('Your email address')) ?>" |
117 | 117 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
118 | - <?php if($_['displayNameChangeSupported']) { ?> |
|
118 | + <?php if ($_['displayNameChangeSupported']) { ?> |
|
119 | 119 | <br /> |
120 | 120 | <em><?php p($l->t('For password reset and notifications')); ?></em> |
121 | 121 | <?php } ?> |
122 | 122 | <span class="icon-checkmark hidden"/> |
123 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
123 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
124 | 124 | <input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>"> |
125 | 125 | <?php } ?> |
126 | 126 | </form> |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | <label for="phone"><?php p($l->t('Phone number')); ?></label> |
133 | 133 | <span class="icon-federation-menu icon-password">▾<span/> |
134 | 134 | </h2> |
135 | - <input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
135 | + <input type="tel" id="phone" name="phone" <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
136 | 136 | value="<?php p($_['phone']) ?>" |
137 | 137 | placeholder="<?php p($l->t('Your phone number')); ?>" |
138 | 138 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
139 | 139 | <span class="icon-checkmark hidden"/> |
140 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
140 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
141 | 141 | <input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>"> |
142 | 142 | <?php } ?> |
143 | 143 | </form> |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | <label for="address"><?php p($l->t('Address')); ?></label> |
151 | 151 | <span class="icon-federation-menu icon-password">▾<span/> |
152 | 152 | </h2> |
153 | - <input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
153 | + <input type="text" id="address" name="address" <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
154 | 154 | placeholder="<?php p($l->t('Your postal address')); ?>" |
155 | 155 | value="<?php p($_['address']) ?>" |
156 | 156 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
157 | 157 | <span class="icon-checkmark hidden"/> |
158 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
158 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
159 | 159 | <input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>"> |
160 | 160 | <?php } ?> |
161 | 161 | </form> |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | <label for="website"><?php p($l->t('Website')); ?></label> |
169 | 169 | <span class="icon-federation-menu icon-password">▾<span/> |
170 | 170 | </h2> |
171 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
172 | - <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>"> |
|
171 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
172 | + <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>"> |
|
173 | 173 | <img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src=" |
174 | 174 | <?php |
175 | - switch($_['websiteVerification']) { |
|
175 | + switch ($_['websiteVerification']) { |
|
176 | 176 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
177 | 177 | p(image_path('core', 'actions/verifying.svg')); |
178 | 178 | break; |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | p(image_path('core', 'actions/verify.svg')); |
184 | 184 | } |
185 | 185 | ?>" |
186 | - <?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
|
186 | + <?php if ($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
|
187 | 187 | > |
188 | 188 | <div class="verification-dialog popovermenu bubble menu"> |
189 | 189 | <div class="verification-dialog-content"> |
190 | 190 | <p class="explainVerification"></p> |
191 | 191 | <p class="verificationCode"></p> |
192 | - <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p> |
|
192 | + <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p> |
|
193 | 193 | </div> |
194 | 194 | </div> |
195 | 195 | </div> |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | <input type="text" name="website" id="website" value="<?php p($_['website']); ?>" |
198 | 198 | placeholder="<?php p($l->t('Link https://…')); ?>" |
199 | 199 | autocomplete="on" autocapitalize="none" autocorrect="off" |
200 | - <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
200 | + <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
201 | 201 | /> |
202 | 202 | <span class="icon-checkmark hidden"/> |
203 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
203 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
204 | 204 | <input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>"> |
205 | 205 | <?php } ?> |
206 | 206 | </form> |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | <label for="twitter"><?php p($l->t('Twitter')); ?></label> |
214 | 214 | <span class="icon-federation-menu icon-password">▾<span/> |
215 | 215 | </h2> |
216 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
217 | - <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>"> |
|
216 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
217 | + <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>"> |
|
218 | 218 | <img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src=" |
219 | 219 | <?php |
220 | - switch($_['twitterVerification']) { |
|
220 | + switch ($_['twitterVerification']) { |
|
221 | 221 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
222 | 222 | p(image_path('core', 'actions/verifying.svg')); |
223 | 223 | break; |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | p(image_path('core', 'actions/verify.svg')); |
229 | 229 | } |
230 | 230 | ?>" |
231 | - <?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
|
231 | + <?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
|
232 | 232 | > |
233 | 233 | <div class="verification-dialog popovermenu bubble menu"> |
234 | 234 | <div class="verification-dialog-content"> |
235 | 235 | <p class="explainVerification"></p> |
236 | 236 | <p class="verificationCode"></p> |
237 | - <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p> |
|
237 | + <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p> |
|
238 | 238 | </div> |
239 | 239 | </div> |
240 | 240 | </div> |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | <input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>" |
243 | 243 | placeholder="<?php p($l->t('Twitter handle @…')); ?>" |
244 | 244 | autocomplete="on" autocapitalize="none" autocorrect="off" |
245 | - <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
245 | + <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
246 | 246 | /> |
247 | 247 | <span class="icon-checkmark hidden"/> |
248 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
248 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
249 | 249 | <input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>"> |
250 | 250 | <?php } ?> |
251 | 251 | </form> |
@@ -264,48 +264,48 @@ discard block |
||
264 | 264 | <?php if (isset($_['activelanguage'])) { ?> |
265 | 265 | <form id="language" class="section"> |
266 | 266 | <h2> |
267 | - <label for="languageinput"><?php p($l->t('Language'));?></label> |
|
267 | + <label for="languageinput"><?php p($l->t('Language')); ?></label> |
|
268 | 268 | </h2> |
269 | - <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>"> |
|
270 | - <option value="<?php p($_['activelanguage']['code']);?>"> |
|
271 | - <?php p($_['activelanguage']['name']);?> |
|
269 | + <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>"> |
|
270 | + <option value="<?php p($_['activelanguage']['code']); ?>"> |
|
271 | + <?php p($_['activelanguage']['name']); ?> |
|
272 | 272 | </option> |
273 | - <?php foreach($_['commonlanguages'] as $language):?> |
|
274 | - <option value="<?php p($language['code']);?>"> |
|
275 | - <?php p($language['name']);?> |
|
273 | + <?php foreach ($_['commonlanguages'] as $language):?> |
|
274 | + <option value="<?php p($language['code']); ?>"> |
|
275 | + <?php p($language['name']); ?> |
|
276 | 276 | </option> |
277 | - <?php endforeach;?> |
|
277 | + <?php endforeach; ?> |
|
278 | 278 | <optgroup label="––––––––––"></optgroup> |
279 | - <?php foreach($_['languages'] as $language):?> |
|
280 | - <option value="<?php p($language['code']);?>"> |
|
281 | - <?php p($language['name']);?> |
|
279 | + <?php foreach ($_['languages'] as $language):?> |
|
280 | + <option value="<?php p($language['code']); ?>"> |
|
281 | + <?php p($language['name']); ?> |
|
282 | 282 | </option> |
283 | - <?php endforeach;?> |
|
283 | + <?php endforeach; ?> |
|
284 | 284 | </select> |
285 | 285 | <br> |
286 | 286 | <a href="https://www.transifex.com/nextcloud/nextcloud/" |
287 | 287 | target="_blank" rel="noreferrer"> |
288 | - <em><?php p($l->t('Help translate'));?></em> |
|
288 | + <em><?php p($l->t('Help translate')); ?></em> |
|
289 | 289 | </a> |
290 | 290 | </form> |
291 | 291 | <?php } ?> |
292 | 292 | </div> |
293 | 293 | <div class="personal-settings-setting-box personal-settings-password-box"> |
294 | 294 | <?php |
295 | - if($_['passwordChangeSupported']) { |
|
295 | + if ($_['passwordChangeSupported']) { |
|
296 | 296 | script('jquery-showpassword'); |
297 | 297 | ?> |
298 | 298 | <form id="passwordform" class="section"> |
299 | - <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
|
299 | + <h2 class="inlineblock"><?php p($l->t('Password')); ?></h2> |
|
300 | 300 | <div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div> |
301 | 301 | <br> |
302 | 302 | <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label> |
303 | 303 | <input type="password" id="pass1" name="oldpassword" |
304 | - placeholder="<?php p($l->t('Current password'));?>" |
|
304 | + placeholder="<?php p($l->t('Current password')); ?>" |
|
305 | 305 | autocomplete="off" autocapitalize="none" autocorrect="off" /> |
306 | 306 | <br> |
307 | 307 | <div class="personal-show-container"> |
308 | - <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label> |
|
308 | + <label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label> |
|
309 | 309 | <input type="password" id="pass2" name="newpassword" |
310 | 310 | placeholder="<?php p($l->t('New password')); ?>" |
311 | 311 | data-typetoggle="#personal-show" |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | |
329 | 329 | |
330 | 330 | <div id="clientsbox" class="section clientsbox"> |
331 | - <h2><?php p($l->t('Get the apps to sync your files'));?></h2> |
|
331 | + <h2><?php p($l->t('Get the apps to sync your files')); ?></h2> |
|
332 | 332 | <a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank"> |
333 | 333 | <img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>" |
334 | - alt="<?php p($l->t('Desktop client'));?>" /> |
|
334 | + alt="<?php p($l->t('Desktop client')); ?>" /> |
|
335 | 335 | </a> |
336 | 336 | <a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank"> |
337 | 337 | <img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>" |
338 | - alt="<?php p($l->t('Android app'));?>" /> |
|
338 | + alt="<?php p($l->t('Android app')); ?>" /> |
|
339 | 339 | </a> |
340 | 340 | <a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank"> |
341 | 341 | <img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>" |
342 | - alt="<?php p($l->t('iOS app'));?>" /> |
|
342 | + alt="<?php p($l->t('iOS app')); ?>" /> |
|
343 | 343 | </a> |
344 | 344 | |
345 | 345 | <p> |
@@ -355,19 +355,19 @@ discard block |
||
355 | 355 | $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
356 | 356 | </p> |
357 | 357 | |
358 | - <?php if(OC_APP::isEnabled('firstrunwizard')) {?> |
|
359 | - <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p> |
|
358 | + <?php if (OC_APP::isEnabled('firstrunwizard')) {?> |
|
359 | + <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again')); ?></a></p> |
|
360 | 360 | <?php }?> |
361 | 361 | </div> |
362 | 362 | |
363 | 363 | <div id="security" class="section"> |
364 | - <h2><?php p($l->t('Security'));?></h2> |
|
365 | - <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop, mobile clients and app specific passwords that currently have access to your account.'));?></p> |
|
364 | + <h2><?php p($l->t('Security')); ?></h2> |
|
365 | + <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop, mobile clients and app specific passwords that currently have access to your account.')); ?></p> |
|
366 | 366 | <table class="icon-loading"> |
367 | 367 | <thead class="token-list-header"> |
368 | 368 | <tr> |
369 | - <th><?php p($l->t('Device'));?></th> |
|
370 | - <th><?php p($l->t('Last activity'));?></th> |
|
369 | + <th><?php p($l->t('Device')); ?></th> |
|
370 | + <th><?php p($l->t('Last activity')); ?></th> |
|
371 | 371 | <th></th> |
372 | 372 | </tr> |
373 | 373 | </thead> |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | </tbody> |
376 | 376 | </table> |
377 | 377 | |
378 | - <h3><?php p($l->t('App passwords'));?></h3> |
|
379 | - <p class="settings-hint"><?php p($l->t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.'));?></p> |
|
378 | + <h3><?php p($l->t('App passwords')); ?></h3> |
|
379 | + <p class="settings-hint"><?php p($l->t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.')); ?></p> |
|
380 | 380 | |
381 | 381 | <div id="app-password-form"> |
382 | 382 | <input id="app-password-name" type="text" placeholder="<?php p($l->t('App name')); ?>"> |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | </div> |
401 | 401 | </div> |
402 | 402 | |
403 | -<?php foreach($_['forms'] as $form) { |
|
403 | +<?php foreach ($_['forms'] as $form) { |
|
404 | 404 | if (isset($form['form'])) {?> |
405 | - <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
|
405 | + <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p(''); ?>"><?php print_unescaped($form['form']); ?></div> |
|
406 | 406 | <?php } |
407 | 407 | };?> |
408 | 408 | |
409 | 409 | <div class="section"> |
410 | - <h2><?php p($l->t('Version'));?></h2> |
|
410 | + <h2><?php p($l->t('Version')); ?></h2> |
|
411 | 411 | <p><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" target="_blank"><?php p($theme->getTitle()); ?></a> <?php p(OC_Util::getHumanVersion()) ?></p> |
412 | 412 | <p><?php include('settings.development.notice.php'); ?></p> |
413 | 413 | </div> |
@@ -31,9 +31,12 @@ discard block |
||
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | 33 | [$_['usage'], $_['total_space']]));?> |
34 | - <?php else: ?> |
|
34 | + <?php else { |
|
35 | + : ?> |
|
35 | 36 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
37 | + [$_['usage'], $_['total_space'], $_['usage_relative']])); |
|
38 | +} |
|
39 | +?> |
|
37 | 40 | <?php endif ?> |
38 | 41 | </p> |
39 | 42 | </div> |
@@ -55,8 +58,11 @@ discard block |
||
55 | 58 | <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div> |
56 | 59 | <input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield"> |
57 | 60 | <p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p> |
58 | - <?php else: ?> |
|
59 | - <?php p($l->t('Picture provided by original account')); ?> |
|
61 | + <?php else { |
|
62 | + : ?> |
|
63 | + <?php p($l->t('Picture provided by original account')); |
|
64 | +} |
|
65 | +?> |
|
60 | 66 | <?php endif; ?> |
61 | 67 | </div> |
62 | 68 | |
@@ -96,7 +102,10 @@ discard block |
||
96 | 102 | <label for="email"><?php p($l->t('Email')); ?></label> |
97 | 103 | <span class="icon-federation-menu icon-password">▾<span/> |
98 | 104 | </h2> |
99 | - <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>"> |
|
105 | + <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') { |
|
106 | + p('hidden'); |
|
107 | +} |
|
108 | +?>"> |
|
100 | 109 | <img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src=" |
101 | 110 | <?php |
102 | 111 | switch($_['emailVerification']) { |
@@ -111,7 +120,12 @@ discard block |
||
111 | 120 | } |
112 | 121 | ?>"> |
113 | 122 | </div> |
114 | - <input type="email" name="email" id="email" value="<?php if(!$_['displayNameChangeSupported'] && empty($_['email'])) p($l->t('No email address set')); else p($_['email']); ?>" |
|
123 | + <input type="email" name="email" id="email" value="<?php if(!$_['displayNameChangeSupported'] && empty($_['email'])) { |
|
124 | + p($l->t('No email address set')); |
|
125 | +} else { |
|
126 | + p($_['email']); |
|
127 | +} |
|
128 | +?>" |
|
115 | 129 | <?php if(!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?> |
116 | 130 | placeholder="<?php p($l->t('Your email address')) ?>" |
117 | 131 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
@@ -132,7 +146,10 @@ discard block |
||
132 | 146 | <label for="phone"><?php p($l->t('Phone number')); ?></label> |
133 | 147 | <span class="icon-federation-menu icon-password">▾<span/> |
134 | 148 | </h2> |
135 | - <input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
149 | + <input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) { |
|
150 | + print_unescaped('disabled="1"'); |
|
151 | +} |
|
152 | +?> |
|
136 | 153 | value="<?php p($_['phone']) ?>" |
137 | 154 | placeholder="<?php p($l->t('Your phone number')); ?>" |
138 | 155 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
@@ -150,7 +167,10 @@ discard block |
||
150 | 167 | <label for="address"><?php p($l->t('Address')); ?></label> |
151 | 168 | <span class="icon-federation-menu icon-password">▾<span/> |
152 | 169 | </h2> |
153 | - <input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
170 | + <input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) { |
|
171 | + print_unescaped('disabled="1"'); |
|
172 | +} |
|
173 | +?> |
|
154 | 174 | placeholder="<?php p($l->t('Your postal address')); ?>" |
155 | 175 | value="<?php p($_['address']) ?>" |
156 | 176 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
@@ -169,7 +189,10 @@ discard block |
||
169 | 189 | <span class="icon-federation-menu icon-password">▾<span/> |
170 | 190 | </h2> |
171 | 191 | <?php if($_['lookupServerUploadEnabled']) { ?> |
172 | - <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>"> |
|
192 | + <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') { |
|
193 | + p('hidden'); |
|
194 | +} |
|
195 | +?>"> |
|
173 | 196 | <img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src=" |
174 | 197 | <?php |
175 | 198 | switch($_['websiteVerification']) { |
@@ -183,13 +206,16 @@ discard block |
||
183 | 206 | p(image_path('core', 'actions/verify.svg')); |
184 | 207 | } |
185 | 208 | ?>" |
186 | - <?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
|
209 | + <?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) { |
|
210 | + print_unescaped(' class="verify-action"') ?> |
|
187 | 211 | > |
188 | 212 | <div class="verification-dialog popovermenu bubble menu"> |
189 | 213 | <div class="verification-dialog-content"> |
190 | 214 | <p class="explainVerification"></p> |
191 | 215 | <p class="verificationCode"></p> |
192 | - <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p> |
|
216 | + <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); |
|
217 | +} |
|
218 | +?></p> |
|
193 | 219 | </div> |
194 | 220 | </div> |
195 | 221 | </div> |
@@ -197,7 +223,10 @@ discard block |
||
197 | 223 | <input type="text" name="website" id="website" value="<?php p($_['website']); ?>" |
198 | 224 | placeholder="<?php p($l->t('Link https://…')); ?>" |
199 | 225 | autocomplete="on" autocapitalize="none" autocorrect="off" |
200 | - <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
226 | + <?php if(!$_['lookupServerUploadEnabled']) { |
|
227 | + print_unescaped('disabled="1"'); |
|
228 | +} |
|
229 | +?> |
|
201 | 230 | /> |
202 | 231 | <span class="icon-checkmark hidden"/> |
203 | 232 | <?php if($_['lookupServerUploadEnabled']) { ?> |
@@ -214,7 +243,10 @@ discard block |
||
214 | 243 | <span class="icon-federation-menu icon-password">▾<span/> |
215 | 244 | </h2> |
216 | 245 | <?php if($_['lookupServerUploadEnabled']) { ?> |
217 | - <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>"> |
|
246 | + <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') { |
|
247 | + p('hidden'); |
|
248 | +} |
|
249 | +?>"> |
|
218 | 250 | <img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src=" |
219 | 251 | <?php |
220 | 252 | switch($_['twitterVerification']) { |
@@ -228,13 +260,16 @@ discard block |
||
228 | 260 | p(image_path('core', 'actions/verify.svg')); |
229 | 261 | } |
230 | 262 | ?>" |
231 | - <?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> |
|
263 | + <?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) { |
|
264 | + print_unescaped(' class="verify-action"') ?> |
|
232 | 265 | > |
233 | 266 | <div class="verification-dialog popovermenu bubble menu"> |
234 | 267 | <div class="verification-dialog-content"> |
235 | 268 | <p class="explainVerification"></p> |
236 | 269 | <p class="verificationCode"></p> |
237 | - <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p> |
|
270 | + <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); |
|
271 | +} |
|
272 | +?></p> |
|
238 | 273 | </div> |
239 | 274 | </div> |
240 | 275 | </div> |
@@ -242,7 +277,10 @@ discard block |
||
242 | 277 | <input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>" |
243 | 278 | placeholder="<?php p($l->t('Twitter handle @…')); ?>" |
244 | 279 | autocomplete="on" autocapitalize="none" autocorrect="off" |
245 | - <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> |
|
280 | + <?php if(!$_['lookupServerUploadEnabled']) { |
|
281 | + print_unescaped('disabled="1"'); |
|
282 | +} |
|
283 | +?> |
|
246 | 284 | /> |
247 | 285 | <span class="icon-checkmark hidden"/> |
248 | 286 | <?php if($_['lookupServerUploadEnabled']) { ?> |