@@ -45,7 +45,7 @@ |
||
45 | 45 | /** @var $this \OCP\Route\IRouter */ |
46 | 46 | $this->create('core_ajax_public_preview', '/publicpreview')->action( |
47 | 47 | function() { |
48 | - require_once __DIR__ . '/../ajax/publicpreview.php'; |
|
48 | + require_once __DIR__.'/../ajax/publicpreview.php'; |
|
49 | 49 | }); |
50 | 50 | |
51 | 51 | $this->create('files_sharing_ajax_list', 'ajax/list.php') |
@@ -31,32 +31,32 @@ discard block |
||
31 | 31 | |
32 | 32 | $application = new Application(); |
33 | 33 | $application->registerRoutes($this, [ |
34 | - 'resources' => [ |
|
35 | - 'ExternalShares' => ['url' => '/api/externalShares'], |
|
36 | - ], |
|
37 | - 'routes' => [ |
|
38 | - [ |
|
39 | - 'name' => 'externalShares#testRemote', |
|
40 | - 'url' => '/testremote', |
|
41 | - 'verb' => 'GET' |
|
42 | - ], |
|
43 | - ], |
|
34 | + 'resources' => [ |
|
35 | + 'ExternalShares' => ['url' => '/api/externalShares'], |
|
36 | + ], |
|
37 | + 'routes' => [ |
|
38 | + [ |
|
39 | + 'name' => 'externalShares#testRemote', |
|
40 | + 'url' => '/testremote', |
|
41 | + 'verb' => 'GET' |
|
42 | + ], |
|
43 | + ], |
|
44 | 44 | ]); |
45 | 45 | |
46 | 46 | /** @var $this \OCP\Route\IRouter */ |
47 | 47 | $this->create('core_ajax_public_preview', '/publicpreview')->action( |
48 | - function() { |
|
49 | - require_once __DIR__ . '/../ajax/publicpreview.php'; |
|
50 | - }); |
|
48 | + function() { |
|
49 | + require_once __DIR__ . '/../ajax/publicpreview.php'; |
|
50 | + }); |
|
51 | 51 | |
52 | 52 | $this->create('files_sharing_ajax_list', 'ajax/list.php') |
53 | - ->actionInclude('files_sharing/ajax/list.php'); |
|
53 | + ->actionInclude('files_sharing/ajax/list.php'); |
|
54 | 54 | $this->create('files_sharing_ajax_publicpreview', 'ajax/publicpreview.php') |
55 | - ->actionInclude('files_sharing/ajax/publicpreview.php'); |
|
55 | + ->actionInclude('files_sharing/ajax/publicpreview.php'); |
|
56 | 56 | $this->create('sharing_external_shareinfo', '/shareinfo') |
57 | - ->actionInclude('files_sharing/ajax/shareinfo.php'); |
|
57 | + ->actionInclude('files_sharing/ajax/shareinfo.php'); |
|
58 | 58 | $this->create('sharing_external_add', '/external') |
59 | - ->actionInclude('files_sharing/ajax/external.php'); |
|
59 | + ->actionInclude('files_sharing/ajax/external.php'); |
|
60 | 60 | |
61 | 61 | // OCS API |
62 | 62 | |
@@ -65,73 +65,73 @@ discard block |
||
65 | 65 | $OCSShare = new \OCA\Files_Sharing\API\OCSShareWrapper(); |
66 | 66 | |
67 | 67 | API::register('get', |
68 | - '/apps/files_sharing/api/v1/shares', |
|
69 | - [$OCSShare, 'getAllShares'], |
|
70 | - 'files_sharing'); |
|
68 | + '/apps/files_sharing/api/v1/shares', |
|
69 | + [$OCSShare, 'getAllShares'], |
|
70 | + 'files_sharing'); |
|
71 | 71 | |
72 | 72 | API::register('post', |
73 | - '/apps/files_sharing/api/v1/shares', |
|
74 | - [$OCSShare, 'createShare'], |
|
75 | - 'files_sharing'); |
|
73 | + '/apps/files_sharing/api/v1/shares', |
|
74 | + [$OCSShare, 'createShare'], |
|
75 | + 'files_sharing'); |
|
76 | 76 | |
77 | 77 | API::register('get', |
78 | - '/apps/files_sharing/api/v1/shares/{id}', |
|
79 | - [$OCSShare, 'getShare'], |
|
80 | - 'files_sharing'); |
|
78 | + '/apps/files_sharing/api/v1/shares/{id}', |
|
79 | + [$OCSShare, 'getShare'], |
|
80 | + 'files_sharing'); |
|
81 | 81 | |
82 | 82 | API::register('put', |
83 | - '/apps/files_sharing/api/v1/shares/{id}', |
|
84 | - [$OCSShare, 'updateShare'], |
|
85 | - 'files_sharing'); |
|
83 | + '/apps/files_sharing/api/v1/shares/{id}', |
|
84 | + [$OCSShare, 'updateShare'], |
|
85 | + 'files_sharing'); |
|
86 | 86 | |
87 | 87 | API::register('delete', |
88 | - '/apps/files_sharing/api/v1/shares/{id}', |
|
89 | - [$OCSShare, 'deleteShare'], |
|
90 | - 'files_sharing'); |
|
88 | + '/apps/files_sharing/api/v1/shares/{id}', |
|
89 | + [$OCSShare, 'deleteShare'], |
|
90 | + 'files_sharing'); |
|
91 | 91 | |
92 | 92 | API::register('get', |
93 | - '/apps/files_sharing/api/v1/remote_shares', |
|
94 | - array('\OCA\Files_Sharing\API\Remote', 'getShares'), |
|
95 | - 'files_sharing'); |
|
93 | + '/apps/files_sharing/api/v1/remote_shares', |
|
94 | + array('\OCA\Files_Sharing\API\Remote', 'getShares'), |
|
95 | + 'files_sharing'); |
|
96 | 96 | |
97 | 97 | API::register('get', |
98 | - '/apps/files_sharing/api/v1/remote_shares/pending', |
|
99 | - array('\OCA\Files_Sharing\API\Remote', 'getOpenShares'), |
|
100 | - 'files_sharing'); |
|
98 | + '/apps/files_sharing/api/v1/remote_shares/pending', |
|
99 | + array('\OCA\Files_Sharing\API\Remote', 'getOpenShares'), |
|
100 | + 'files_sharing'); |
|
101 | 101 | |
102 | 102 | API::register('post', |
103 | - '/apps/files_sharing/api/v1/remote_shares/pending/{id}', |
|
104 | - array('\OCA\Files_Sharing\API\Remote', 'acceptShare'), |
|
105 | - 'files_sharing'); |
|
103 | + '/apps/files_sharing/api/v1/remote_shares/pending/{id}', |
|
104 | + array('\OCA\Files_Sharing\API\Remote', 'acceptShare'), |
|
105 | + 'files_sharing'); |
|
106 | 106 | |
107 | 107 | API::register('delete', |
108 | - '/apps/files_sharing/api/v1/remote_shares/pending/{id}', |
|
109 | - array('\OCA\Files_Sharing\API\Remote', 'declineShare'), |
|
110 | - 'files_sharing'); |
|
108 | + '/apps/files_sharing/api/v1/remote_shares/pending/{id}', |
|
109 | + array('\OCA\Files_Sharing\API\Remote', 'declineShare'), |
|
110 | + 'files_sharing'); |
|
111 | 111 | |
112 | 112 | API::register('get', |
113 | - '/apps/files_sharing/api/v1/remote_shares/{id}', |
|
114 | - array('\OCA\Files_Sharing\API\Remote', 'getShare'), |
|
115 | - 'files_sharing'); |
|
113 | + '/apps/files_sharing/api/v1/remote_shares/{id}', |
|
114 | + array('\OCA\Files_Sharing\API\Remote', 'getShare'), |
|
115 | + 'files_sharing'); |
|
116 | 116 | |
117 | 117 | API::register('delete', |
118 | - '/apps/files_sharing/api/v1/remote_shares/{id}', |
|
119 | - array('\OCA\Files_Sharing\API\Remote', 'unshare'), |
|
120 | - 'files_sharing'); |
|
118 | + '/apps/files_sharing/api/v1/remote_shares/{id}', |
|
119 | + array('\OCA\Files_Sharing\API\Remote', 'unshare'), |
|
120 | + 'files_sharing'); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | $sharees = new \OCA\Files_Sharing\API\Sharees(\OC::$server->getGroupManager(), |
124 | - \OC::$server->getUserManager(), |
|
125 | - \OC::$server->getContactsManager(), |
|
126 | - \OC::$server->getConfig(), |
|
127 | - \OC::$server->getUserSession(), |
|
128 | - \OC::$server->getURLGenerator(), |
|
129 | - \OC::$server->getRequest(), |
|
130 | - \OC::$server->getLogger(), |
|
131 | - \OC::$server->getShareManager()); |
|
124 | + \OC::$server->getUserManager(), |
|
125 | + \OC::$server->getContactsManager(), |
|
126 | + \OC::$server->getConfig(), |
|
127 | + \OC::$server->getUserSession(), |
|
128 | + \OC::$server->getURLGenerator(), |
|
129 | + \OC::$server->getRequest(), |
|
130 | + \OC::$server->getLogger(), |
|
131 | + \OC::$server->getShareManager()); |
|
132 | 132 | |
133 | 133 | API::register('get', |
134 | - '/apps/files_sharing/api/v1/sharees', |
|
135 | - [$sharees, 'search'], |
|
136 | - 'files_sharing', API::USER_AUTH); |
|
134 | + '/apps/files_sharing/api/v1/sharees', |
|
135 | + [$sharees, 'search'], |
|
136 | + 'files_sharing', API::USER_AUTH); |
|
137 | 137 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | - /** @var array $_ */ |
|
3 | - /** @var OC_L10N $l */ |
|
2 | + /** @var array $_ */ |
|
3 | + /** @var OC_L10N $l */ |
|
4 | 4 | |
5 | 5 | style('core', ['styles', 'header']); |
6 | 6 | ?> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | <ul> |
16 | 16 | <li><?php p($l->t('Remote Address: %s', $_['remoteAddr'])) ?></li> |
17 | 17 | <li><?php p($l->t('Request ID: %s', $_['requestID'])) ?></li> |
18 | - <?php if($_['debugMode']): ?> |
|
18 | + <?php if ($_['debugMode']): ?> |
|
19 | 19 | <li><?php p($l->t('Type: %s', $_['errorClass'])) ?></li> |
20 | 20 | <li><?php p($l->t('Code: %s', $_['errorCode'])) ?></li> |
21 | 21 | <li><?php p($l->t('Message: %s', $_['errorMsg'])) ?></li> |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | <?php endif; ?> |
25 | 25 | </ul> |
26 | 26 | |
27 | - <?php if($_['debugMode']): ?> |
|
27 | + <?php if ($_['debugMode']): ?> |
|
28 | 28 | <br /> |
29 | 29 | <h2><strong><?php p($l->t('Trace')) ?></strong></h2> |
30 | 30 | <pre><?php p($_['trace']) ?></pre> |
@@ -29,27 +29,27 @@ |
||
29 | 29 | $app->registerHooks(); |
30 | 30 | |
31 | 31 | \OC::$server->registerService('CardDAVSyncService', function() use ($app) { |
32 | - return $app->getSyncService(); |
|
32 | + return $app->getSyncService(); |
|
33 | 33 | }); |
34 | 34 | |
35 | 35 | $eventDispatcher = \OC::$server->getEventDispatcher(); |
36 | 36 | |
37 | 37 | $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', |
38 | - function(GenericEvent $event) use ($app) { |
|
39 | - /** @var \OCA\DAV\CardDAV\CardDavBackend $cardDavBackend */ |
|
40 | - $cardDavBackend = $app->getContainer()->query('CardDavBackend'); |
|
41 | - $addressBookUri = $event->getSubject(); |
|
42 | - $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); |
|
43 | - if (!is_null($addressBook)) { |
|
44 | - $cardDavBackend->deleteAddressBook($addressBook['id']); |
|
45 | - } |
|
46 | - } |
|
38 | + function(GenericEvent $event) use ($app) { |
|
39 | + /** @var \OCA\DAV\CardDAV\CardDavBackend $cardDavBackend */ |
|
40 | + $cardDavBackend = $app->getContainer()->query('CardDavBackend'); |
|
41 | + $addressBookUri = $event->getSubject(); |
|
42 | + $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); |
|
43 | + if (!is_null($addressBook)) { |
|
44 | + $cardDavBackend->deleteAddressBook($addressBook['id']); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | $cm = \OC::$server->getContactsManager(); |
50 | 50 | $cm->register(function() use ($cm, $app) { |
51 | - $user = \OC::$server->getUserSession()->getUser(); |
|
52 | - if (!is_null($user)) { |
|
53 | - $app->setupContactsProvider($cm, $user->getUID()); |
|
54 | - } |
|
51 | + $user = \OC::$server->getUserSession()->getUser(); |
|
52 | + if (!is_null($user)) { |
|
53 | + $app->setupContactsProvider($cm, $user->getUID()); |
|
54 | + } |
|
55 | 55 | }); |
@@ -23,16 +23,16 @@ |
||
23 | 23 | |
24 | 24 | /** @var $this \OCP\Route\IRouter */ |
25 | 25 | $this->create('user_ldap_ajax_clearMappings', 'ajax/clearMappings.php') |
26 | - ->actionInclude('user_ldap/ajax/clearMappings.php'); |
|
26 | + ->actionInclude('user_ldap/ajax/clearMappings.php'); |
|
27 | 27 | $this->create('user_ldap_ajax_deleteConfiguration', 'ajax/deleteConfiguration.php') |
28 | - ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); |
|
28 | + ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); |
|
29 | 29 | $this->create('user_ldap_ajax_getConfiguration', 'ajax/getConfiguration.php') |
30 | - ->actionInclude('user_ldap/ajax/getConfiguration.php'); |
|
30 | + ->actionInclude('user_ldap/ajax/getConfiguration.php'); |
|
31 | 31 | $this->create('user_ldap_ajax_getNewServerConfigPrefix', 'ajax/getNewServerConfigPrefix.php') |
32 | - ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); |
|
32 | + ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); |
|
33 | 33 | $this->create('user_ldap_ajax_setConfiguration', 'ajax/setConfiguration.php') |
34 | - ->actionInclude('user_ldap/ajax/setConfiguration.php'); |
|
34 | + ->actionInclude('user_ldap/ajax/setConfiguration.php'); |
|
35 | 35 | $this->create('user_ldap_ajax_testConfiguration', 'ajax/testConfiguration.php') |
36 | - ->actionInclude('user_ldap/ajax/testConfiguration.php'); |
|
36 | + ->actionInclude('user_ldap/ajax/testConfiguration.php'); |
|
37 | 37 | $this->create('user_ldap_ajax_wizard', 'ajax/wizard.php') |
38 | - ->actionInclude('user_ldap/ajax/wizard.php'); |
|
38 | + ->actionInclude('user_ldap/ajax/wizard.php'); |
@@ -23,26 +23,26 @@ |
||
23 | 23 | $application = new \OCA\Federation\AppInfo\Application(); |
24 | 24 | |
25 | 25 | $application->registerRoutes( |
26 | - $this, |
|
27 | - [ |
|
28 | - 'routes' => [ |
|
29 | - [ |
|
30 | - 'name' => 'Settings#addServer', |
|
31 | - 'url' => '/trusted-servers', |
|
32 | - 'verb' => 'POST' |
|
33 | - ], |
|
34 | - [ |
|
35 | - 'name' => 'Settings#removeServer', |
|
36 | - 'url' => '/trusted-servers/{id}', |
|
37 | - 'verb' => 'DELETE' |
|
38 | - ], |
|
39 | - [ |
|
40 | - 'name' => 'Settings#autoAddServers', |
|
41 | - 'url' => '/auto-add-servers', |
|
42 | - 'verb' => 'POST' |
|
43 | - ], |
|
44 | - ] |
|
45 | - ] |
|
26 | + $this, |
|
27 | + [ |
|
28 | + 'routes' => [ |
|
29 | + [ |
|
30 | + 'name' => 'Settings#addServer', |
|
31 | + 'url' => '/trusted-servers', |
|
32 | + 'verb' => 'POST' |
|
33 | + ], |
|
34 | + [ |
|
35 | + 'name' => 'Settings#removeServer', |
|
36 | + 'url' => '/trusted-servers/{id}', |
|
37 | + 'verb' => 'DELETE' |
|
38 | + ], |
|
39 | + [ |
|
40 | + 'name' => 'Settings#autoAddServers', |
|
41 | + 'url' => '/auto-add-servers', |
|
42 | + 'verb' => 'POST' |
|
43 | + ], |
|
44 | + ] |
|
45 | + ] |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | $application->registerOCSApi(); |
@@ -30,16 +30,16 @@ |
||
30 | 30 | |
31 | 31 | class Trashbin extends Action { |
32 | 32 | |
33 | - public function delete($params) { |
|
34 | - $this->log('File "%s" deleted from trash bin.', |
|
35 | - ['path' => $params['path']], ['path'] |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - public function restore($params) { |
|
40 | - $this->log('File "%s" restored from trash bin.', |
|
41 | - ['path' => $params['filePath']], ['path'] |
|
42 | - ); |
|
43 | - } |
|
33 | + public function delete($params) { |
|
34 | + $this->log('File "%s" deleted from trash bin.', |
|
35 | + ['path' => $params['path']], ['path'] |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + public function restore($params) { |
|
40 | + $this->log('File "%s" restored from trash bin.', |
|
41 | + ['path' => $params['filePath']], ['path'] |
|
42 | + ); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | if (empty($_POST['dirToken'])) { |
51 | 51 | // The standard case, files are uploaded through logged in users :) |
52 | 52 | OCP\JSON::checkLoggedIn(); |
53 | - $dir = isset($_POST['dir']) ? (string)$_POST['dir'] : ''; |
|
53 | + $dir = isset($_POST['dir']) ? (string) $_POST['dir'] : ''; |
|
54 | 54 | if (!$dir || empty($dir) || $dir === false) { |
55 | 55 | OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
56 | 56 | die(); |
57 | 57 | } |
58 | 58 | } else { |
59 | 59 | $shareManager = \OC::$server->getShareManager(); |
60 | - $share = $shareManager->getShareByToken((string)$_POST['dirToken']); |
|
60 | + $share = $shareManager->getShareByToken((string) $_POST['dirToken']); |
|
61 | 61 | |
62 | 62 | // TODO: ideally this code should be in files_sharing/ajax/upload.php |
63 | 63 | // and the upload/file transfer code needs to be refactored into a utility method |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | // If it is a write-only folder no subdirectory can be specified |
69 | 69 | $publicDirectory = ''; |
70 | 70 | if ($share->getPermissions() & \OCP\Constants::PERMISSION_READ) { |
71 | - $publicDirectory = !empty($_POST['subdir']) ? (string)$_POST['subdir'] : '/'; |
|
71 | + $publicDirectory = !empty($_POST['subdir']) ? (string) $_POST['subdir'] : '/'; |
|
72 | 72 | } else { |
73 | 73 | $_POST['file_directory'] = ''; |
74 | 74 | } |
75 | 75 | |
76 | - $linkItem = OCP\Share::getShareByToken((string)$_POST['dirToken']); |
|
76 | + $linkItem = OCP\Share::getShareByToken((string) $_POST['dirToken']); |
|
77 | 77 | if ($linkItem === false) { |
78 | 78 | OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Invalid Token'))))); |
79 | 79 | die(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | // The token defines the target directory (security reasons) |
94 | 94 | $path = \OC\Files\Filesystem::getPath($linkItem['file_source']); |
95 | - if($path === null) { |
|
95 | + if ($path === null) { |
|
96 | 96 | OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
97 | 97 | die(); |
98 | 98 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $resolution = null; |
173 | 173 | } |
174 | 174 | |
175 | - if(isset($_POST['dirToken'])) { |
|
175 | + if (isset($_POST['dirToken'])) { |
|
176 | 176 | // If it is a read only share the resolution will always be autorename |
177 | 177 | if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
178 | 178 | $resolution = 'autorename'; |
@@ -181,25 +181,25 @@ discard block |
||
181 | 181 | |
182 | 182 | // target directory for when uploading folders |
183 | 183 | $relativePath = ''; |
184 | - if(!empty($_POST['file_directory'])) { |
|
184 | + if (!empty($_POST['file_directory'])) { |
|
185 | 185 | $relativePath = '/'.$_POST['file_directory']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder |
189 | 189 | if ($resolution === 'autorename') { |
190 | 190 | // append a number in brackets like 'filename (2).ext' |
191 | - $target = OCP\Files::buildNotExistingFileName($dir . $relativePath, $files['name'][$i]); |
|
191 | + $target = OCP\Files::buildNotExistingFileName($dir.$relativePath, $files['name'][$i]); |
|
192 | 192 | } else { |
193 | - $target = \OC\Files\Filesystem::normalizePath($dir . $relativePath.'/'.$files['name'][$i]); |
|
193 | + $target = \OC\Files\Filesystem::normalizePath($dir.$relativePath.'/'.$files['name'][$i]); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // relative dir to return to the client |
197 | 197 | if (isset($publicDirectory)) { |
198 | 198 | // path relative to the public root |
199 | - $returnedDir = $publicDirectory . $relativePath; |
|
199 | + $returnedDir = $publicDirectory.$relativePath; |
|
200 | 200 | } else { |
201 | 201 | // full path |
202 | - $returnedDir = $dir . $relativePath; |
|
202 | + $returnedDir = $dir.$relativePath; |
|
203 | 203 | } |
204 | 204 | $returnedDir = \OC\Files\Filesystem::normalizePath($returnedDir); |
205 | 205 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ($exists) { |
209 | 209 | $updatable = \OC\Files\Filesystem::isUpdatable($target); |
210 | 210 | } |
211 | - if ( ! $exists || ($updatable && $resolution === 'replace' ) ) { |
|
211 | + if (!$exists || ($updatable && $resolution === 'replace')) { |
|
212 | 212 | // upload and overwrite file |
213 | 213 | try |
214 | 214 | { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $error = $l->t('Upload failed. Could not find uploaded file'); |
237 | 237 | $errorFileName = $files['name'][$i]; |
238 | 238 | } |
239 | - } catch(Exception $ex) { |
|
239 | + } catch (Exception $ex) { |
|
240 | 240 | $error = $ex->getMessage(); |
241 | 241 | } |
242 | 242 | |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | |
268 | 268 | if ($error === false) { |
269 | 269 | // Do not leak file information if it is a read-only share |
270 | - if(isset($_POST['dirToken'])) { |
|
270 | + if (isset($_POST['dirToken'])) { |
|
271 | 271 | $shareManager = \OC::$server->getShareManager(); |
272 | - $share = $shareManager->getShareByToken((string)$_POST['dirToken']); |
|
272 | + $share = $shareManager->getShareByToken((string) $_POST['dirToken']); |
|
273 | 273 | if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
274 | 274 | $newResults = []; |
275 | - foreach($result as $singleResult) { |
|
275 | + foreach ($result as $singleResult) { |
|
276 | 276 | $fileName = $singleResult['originalname']; |
277 | 277 | $newResults['filename'] = $fileName; |
278 | 278 | $newResults['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($fileName); |
@@ -48,67 +48,67 @@ discard block |
||
48 | 48 | |
49 | 49 | $l = \OC::$server->getL10N('files'); |
50 | 50 | if (empty($_POST['dirToken'])) { |
51 | - // The standard case, files are uploaded through logged in users :) |
|
52 | - OCP\JSON::checkLoggedIn(); |
|
53 | - $dir = isset($_POST['dir']) ? (string)$_POST['dir'] : ''; |
|
54 | - if (!$dir || empty($dir) || $dir === false) { |
|
55 | - OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
|
56 | - die(); |
|
57 | - } |
|
51 | + // The standard case, files are uploaded through logged in users :) |
|
52 | + OCP\JSON::checkLoggedIn(); |
|
53 | + $dir = isset($_POST['dir']) ? (string)$_POST['dir'] : ''; |
|
54 | + if (!$dir || empty($dir) || $dir === false) { |
|
55 | + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
|
56 | + die(); |
|
57 | + } |
|
58 | 58 | } else { |
59 | - $shareManager = \OC::$server->getShareManager(); |
|
60 | - $share = $shareManager->getShareByToken((string)$_POST['dirToken']); |
|
61 | - |
|
62 | - // TODO: ideally this code should be in files_sharing/ajax/upload.php |
|
63 | - // and the upload/file transfer code needs to be refactored into a utility method |
|
64 | - // that could be used there |
|
65 | - |
|
66 | - \OC_User::setIncognitoMode(true); |
|
67 | - |
|
68 | - // If it is a write-only folder no subdirectory can be specified |
|
69 | - $publicDirectory = ''; |
|
70 | - if ($share->getPermissions() & \OCP\Constants::PERMISSION_READ) { |
|
71 | - $publicDirectory = !empty($_POST['subdir']) ? (string)$_POST['subdir'] : '/'; |
|
72 | - } else { |
|
73 | - $_POST['file_directory'] = ''; |
|
74 | - } |
|
75 | - |
|
76 | - $linkItem = OCP\Share::getShareByToken((string)$_POST['dirToken']); |
|
77 | - if ($linkItem === false) { |
|
78 | - OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Invalid Token'))))); |
|
79 | - die(); |
|
80 | - } |
|
81 | - |
|
82 | - if (!($linkItem['permissions'] & \OCP\Constants::PERMISSION_CREATE)) { |
|
83 | - OCP\JSON::checkLoggedIn(); |
|
84 | - } else { |
|
85 | - // resolve reshares |
|
86 | - $rootLinkItem = OCP\Share::resolveReShare($linkItem); |
|
87 | - |
|
88 | - OCP\JSON::checkUserExists($rootLinkItem['uid_owner']); |
|
89 | - // Setup FS with owner |
|
90 | - OC_Util::tearDownFS(); |
|
91 | - OC_Util::setupFS($rootLinkItem['uid_owner']); |
|
92 | - |
|
93 | - // The token defines the target directory (security reasons) |
|
94 | - $path = \OC\Files\Filesystem::getPath($linkItem['file_source']); |
|
95 | - if($path === null) { |
|
96 | - OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
|
97 | - die(); |
|
98 | - } |
|
99 | - $dir = sprintf( |
|
100 | - "/%s/%s", |
|
101 | - $path, |
|
102 | - $publicDirectory |
|
103 | - ); |
|
104 | - |
|
105 | - if (!$dir || empty($dir) || $dir === false) { |
|
106 | - OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
|
107 | - die(); |
|
108 | - } |
|
109 | - |
|
110 | - $dir = rtrim($dir, '/'); |
|
111 | - } |
|
59 | + $shareManager = \OC::$server->getShareManager(); |
|
60 | + $share = $shareManager->getShareByToken((string)$_POST['dirToken']); |
|
61 | + |
|
62 | + // TODO: ideally this code should be in files_sharing/ajax/upload.php |
|
63 | + // and the upload/file transfer code needs to be refactored into a utility method |
|
64 | + // that could be used there |
|
65 | + |
|
66 | + \OC_User::setIncognitoMode(true); |
|
67 | + |
|
68 | + // If it is a write-only folder no subdirectory can be specified |
|
69 | + $publicDirectory = ''; |
|
70 | + if ($share->getPermissions() & \OCP\Constants::PERMISSION_READ) { |
|
71 | + $publicDirectory = !empty($_POST['subdir']) ? (string)$_POST['subdir'] : '/'; |
|
72 | + } else { |
|
73 | + $_POST['file_directory'] = ''; |
|
74 | + } |
|
75 | + |
|
76 | + $linkItem = OCP\Share::getShareByToken((string)$_POST['dirToken']); |
|
77 | + if ($linkItem === false) { |
|
78 | + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Invalid Token'))))); |
|
79 | + die(); |
|
80 | + } |
|
81 | + |
|
82 | + if (!($linkItem['permissions'] & \OCP\Constants::PERMISSION_CREATE)) { |
|
83 | + OCP\JSON::checkLoggedIn(); |
|
84 | + } else { |
|
85 | + // resolve reshares |
|
86 | + $rootLinkItem = OCP\Share::resolveReShare($linkItem); |
|
87 | + |
|
88 | + OCP\JSON::checkUserExists($rootLinkItem['uid_owner']); |
|
89 | + // Setup FS with owner |
|
90 | + OC_Util::tearDownFS(); |
|
91 | + OC_Util::setupFS($rootLinkItem['uid_owner']); |
|
92 | + |
|
93 | + // The token defines the target directory (security reasons) |
|
94 | + $path = \OC\Files\Filesystem::getPath($linkItem['file_source']); |
|
95 | + if($path === null) { |
|
96 | + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
|
97 | + die(); |
|
98 | + } |
|
99 | + $dir = sprintf( |
|
100 | + "/%s/%s", |
|
101 | + $path, |
|
102 | + $publicDirectory |
|
103 | + ); |
|
104 | + |
|
105 | + if (!$dir || empty($dir) || $dir === false) { |
|
106 | + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); |
|
107 | + die(); |
|
108 | + } |
|
109 | + |
|
110 | + $dir = rtrim($dir, '/'); |
|
111 | + } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | OCP\JSON::callCheck(); |
@@ -117,27 +117,27 @@ discard block |
||
117 | 117 | $storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir); |
118 | 118 | |
119 | 119 | if (!isset($_FILES['files'])) { |
120 | - OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('No file was uploaded. Unknown error')), $storageStats))); |
|
121 | - exit(); |
|
120 | + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('No file was uploaded. Unknown error')), $storageStats))); |
|
121 | + exit(); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | foreach ($_FILES['files']['error'] as $error) { |
125 | - if ($error != 0) { |
|
126 | - $errors = array( |
|
127 | - UPLOAD_ERR_OK => $l->t('There is no error, the file uploaded with success'), |
|
128 | - UPLOAD_ERR_INI_SIZE => $l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ') |
|
129 | - . OC::$server->getIniWrapper()->getNumeric('upload_max_filesize'), |
|
130 | - UPLOAD_ERR_FORM_SIZE => $l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), |
|
131 | - UPLOAD_ERR_PARTIAL => $l->t('The uploaded file was only partially uploaded'), |
|
132 | - UPLOAD_ERR_NO_FILE => $l->t('No file was uploaded'), |
|
133 | - UPLOAD_ERR_NO_TMP_DIR => $l->t('Missing a temporary folder'), |
|
134 | - UPLOAD_ERR_CANT_WRITE => $l->t('Failed to write to disk'), |
|
135 | - ); |
|
136 | - $errorMessage = $errors[$error]; |
|
137 | - \OC::$server->getLogger()->alert("Upload error: $error - $errorMessage", array('app' => 'files')); |
|
138 | - OCP\JSON::error(array('data' => array_merge(array('message' => $errorMessage), $storageStats))); |
|
139 | - exit(); |
|
140 | - } |
|
125 | + if ($error != 0) { |
|
126 | + $errors = array( |
|
127 | + UPLOAD_ERR_OK => $l->t('There is no error, the file uploaded with success'), |
|
128 | + UPLOAD_ERR_INI_SIZE => $l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ') |
|
129 | + . OC::$server->getIniWrapper()->getNumeric('upload_max_filesize'), |
|
130 | + UPLOAD_ERR_FORM_SIZE => $l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), |
|
131 | + UPLOAD_ERR_PARTIAL => $l->t('The uploaded file was only partially uploaded'), |
|
132 | + UPLOAD_ERR_NO_FILE => $l->t('No file was uploaded'), |
|
133 | + UPLOAD_ERR_NO_TMP_DIR => $l->t('Missing a temporary folder'), |
|
134 | + UPLOAD_ERR_CANT_WRITE => $l->t('Failed to write to disk'), |
|
135 | + ); |
|
136 | + $errorMessage = $errors[$error]; |
|
137 | + \OC::$server->getLogger()->alert("Upload error: $error - $errorMessage", array('app' => 'files')); |
|
138 | + OCP\JSON::error(array('data' => array_merge(array('message' => $errorMessage), $storageStats))); |
|
139 | + exit(); |
|
140 | + } |
|
141 | 141 | } |
142 | 142 | $files = $_FILES['files']; |
143 | 143 | |
@@ -150,142 +150,142 @@ discard block |
||
150 | 150 | $isReceivedShare = \OC::$server->getRequest()->getParam('isReceivedShare', false) === 'true'; |
151 | 151 | // defer quota check for received shares |
152 | 152 | if (!$isReceivedShare && $storageStats['freeSpace'] >= 0) { |
153 | - foreach ($files['size'] as $size) { |
|
154 | - $totalSize += $size; |
|
155 | - } |
|
153 | + foreach ($files['size'] as $size) { |
|
154 | + $totalSize += $size; |
|
155 | + } |
|
156 | 156 | } |
157 | 157 | if ($maxUploadFileSize >= 0 and $totalSize > $maxUploadFileSize) { |
158 | - OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'), |
|
159 | - 'uploadMaxFilesize' => $maxUploadFileSize, |
|
160 | - 'maxHumanFilesize' => $maxHumanFileSize))); |
|
161 | - exit(); |
|
158 | + OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'), |
|
159 | + 'uploadMaxFilesize' => $maxUploadFileSize, |
|
160 | + 'maxHumanFilesize' => $maxHumanFileSize))); |
|
161 | + exit(); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $result = array(); |
165 | 165 | if (\OC\Files\Filesystem::isValidPath($dir) === true) { |
166 | - $fileCount = count($files['name']); |
|
167 | - for ($i = 0; $i < $fileCount; $i++) { |
|
168 | - |
|
169 | - if (isset($_POST['resolution'])) { |
|
170 | - $resolution = $_POST['resolution']; |
|
171 | - } else { |
|
172 | - $resolution = null; |
|
173 | - } |
|
174 | - |
|
175 | - if(isset($_POST['dirToken'])) { |
|
176 | - // If it is a read only share the resolution will always be autorename |
|
177 | - if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
178 | - $resolution = 'autorename'; |
|
179 | - } |
|
180 | - } |
|
181 | - |
|
182 | - // target directory for when uploading folders |
|
183 | - $relativePath = ''; |
|
184 | - if(!empty($_POST['file_directory'])) { |
|
185 | - $relativePath = '/'.$_POST['file_directory']; |
|
186 | - } |
|
187 | - |
|
188 | - // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder |
|
189 | - if ($resolution === 'autorename') { |
|
190 | - // append a number in brackets like 'filename (2).ext' |
|
191 | - $target = OCP\Files::buildNotExistingFileName($dir . $relativePath, $files['name'][$i]); |
|
192 | - } else { |
|
193 | - $target = \OC\Files\Filesystem::normalizePath($dir . $relativePath.'/'.$files['name'][$i]); |
|
194 | - } |
|
195 | - |
|
196 | - // relative dir to return to the client |
|
197 | - if (isset($publicDirectory)) { |
|
198 | - // path relative to the public root |
|
199 | - $returnedDir = $publicDirectory . $relativePath; |
|
200 | - } else { |
|
201 | - // full path |
|
202 | - $returnedDir = $dir . $relativePath; |
|
203 | - } |
|
204 | - $returnedDir = \OC\Files\Filesystem::normalizePath($returnedDir); |
|
205 | - |
|
206 | - |
|
207 | - $exists = \OC\Files\Filesystem::file_exists($target); |
|
208 | - if ($exists) { |
|
209 | - $updatable = \OC\Files\Filesystem::isUpdatable($target); |
|
210 | - } |
|
211 | - if ( ! $exists || ($updatable && $resolution === 'replace' ) ) { |
|
212 | - // upload and overwrite file |
|
213 | - try |
|
214 | - { |
|
215 | - if (is_uploaded_file($files['tmp_name'][$i]) and \OC\Files\Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { |
|
216 | - |
|
217 | - // updated max file size after upload |
|
218 | - $storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir); |
|
219 | - |
|
220 | - $meta = \OC\Files\Filesystem::getFileInfo($target); |
|
221 | - if ($meta === false) { |
|
222 | - $error = $l->t('The target folder has been moved or deleted.'); |
|
223 | - $errorCode = 'targetnotfound'; |
|
224 | - } else { |
|
225 | - $data = \OCA\Files\Helper::formatFileInfo($meta); |
|
226 | - $data['status'] = 'success'; |
|
227 | - $data['originalname'] = $files['name'][$i]; |
|
228 | - $data['uploadMaxFilesize'] = $maxUploadFileSize; |
|
229 | - $data['maxHumanFilesize'] = $maxHumanFileSize; |
|
230 | - $data['permissions'] = $meta['permissions']; |
|
231 | - $data['directory'] = $returnedDir; |
|
232 | - $result[] = $data; |
|
233 | - } |
|
234 | - |
|
235 | - } else { |
|
236 | - $error = $l->t('Upload failed. Could not find uploaded file'); |
|
237 | - $errorFileName = $files['name'][$i]; |
|
238 | - } |
|
239 | - } catch(Exception $ex) { |
|
240 | - $error = $ex->getMessage(); |
|
241 | - } |
|
242 | - |
|
243 | - } else { |
|
244 | - // file already exists |
|
245 | - $meta = \OC\Files\Filesystem::getFileInfo($target); |
|
246 | - if ($meta === false) { |
|
247 | - $error = $l->t('Upload failed. Could not get file info.'); |
|
248 | - } else { |
|
249 | - $data = \OCA\Files\Helper::formatFileInfo($meta); |
|
250 | - if ($updatable) { |
|
251 | - $data['status'] = 'existserror'; |
|
252 | - } else { |
|
253 | - $data['status'] = 'readonly'; |
|
254 | - } |
|
255 | - $data['originalname'] = $files['name'][$i]; |
|
256 | - $data['uploadMaxFilesize'] = $maxUploadFileSize; |
|
257 | - $data['maxHumanFilesize'] = $maxHumanFileSize; |
|
258 | - $data['permissions'] = $meta['permissions']; |
|
259 | - $data['directory'] = $returnedDir; |
|
260 | - $result[] = $data; |
|
261 | - } |
|
262 | - } |
|
263 | - } |
|
166 | + $fileCount = count($files['name']); |
|
167 | + for ($i = 0; $i < $fileCount; $i++) { |
|
168 | + |
|
169 | + if (isset($_POST['resolution'])) { |
|
170 | + $resolution = $_POST['resolution']; |
|
171 | + } else { |
|
172 | + $resolution = null; |
|
173 | + } |
|
174 | + |
|
175 | + if(isset($_POST['dirToken'])) { |
|
176 | + // If it is a read only share the resolution will always be autorename |
|
177 | + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
178 | + $resolution = 'autorename'; |
|
179 | + } |
|
180 | + } |
|
181 | + |
|
182 | + // target directory for when uploading folders |
|
183 | + $relativePath = ''; |
|
184 | + if(!empty($_POST['file_directory'])) { |
|
185 | + $relativePath = '/'.$_POST['file_directory']; |
|
186 | + } |
|
187 | + |
|
188 | + // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder |
|
189 | + if ($resolution === 'autorename') { |
|
190 | + // append a number in brackets like 'filename (2).ext' |
|
191 | + $target = OCP\Files::buildNotExistingFileName($dir . $relativePath, $files['name'][$i]); |
|
192 | + } else { |
|
193 | + $target = \OC\Files\Filesystem::normalizePath($dir . $relativePath.'/'.$files['name'][$i]); |
|
194 | + } |
|
195 | + |
|
196 | + // relative dir to return to the client |
|
197 | + if (isset($publicDirectory)) { |
|
198 | + // path relative to the public root |
|
199 | + $returnedDir = $publicDirectory . $relativePath; |
|
200 | + } else { |
|
201 | + // full path |
|
202 | + $returnedDir = $dir . $relativePath; |
|
203 | + } |
|
204 | + $returnedDir = \OC\Files\Filesystem::normalizePath($returnedDir); |
|
205 | + |
|
206 | + |
|
207 | + $exists = \OC\Files\Filesystem::file_exists($target); |
|
208 | + if ($exists) { |
|
209 | + $updatable = \OC\Files\Filesystem::isUpdatable($target); |
|
210 | + } |
|
211 | + if ( ! $exists || ($updatable && $resolution === 'replace' ) ) { |
|
212 | + // upload and overwrite file |
|
213 | + try |
|
214 | + { |
|
215 | + if (is_uploaded_file($files['tmp_name'][$i]) and \OC\Files\Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { |
|
216 | + |
|
217 | + // updated max file size after upload |
|
218 | + $storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir); |
|
219 | + |
|
220 | + $meta = \OC\Files\Filesystem::getFileInfo($target); |
|
221 | + if ($meta === false) { |
|
222 | + $error = $l->t('The target folder has been moved or deleted.'); |
|
223 | + $errorCode = 'targetnotfound'; |
|
224 | + } else { |
|
225 | + $data = \OCA\Files\Helper::formatFileInfo($meta); |
|
226 | + $data['status'] = 'success'; |
|
227 | + $data['originalname'] = $files['name'][$i]; |
|
228 | + $data['uploadMaxFilesize'] = $maxUploadFileSize; |
|
229 | + $data['maxHumanFilesize'] = $maxHumanFileSize; |
|
230 | + $data['permissions'] = $meta['permissions']; |
|
231 | + $data['directory'] = $returnedDir; |
|
232 | + $result[] = $data; |
|
233 | + } |
|
234 | + |
|
235 | + } else { |
|
236 | + $error = $l->t('Upload failed. Could not find uploaded file'); |
|
237 | + $errorFileName = $files['name'][$i]; |
|
238 | + } |
|
239 | + } catch(Exception $ex) { |
|
240 | + $error = $ex->getMessage(); |
|
241 | + } |
|
242 | + |
|
243 | + } else { |
|
244 | + // file already exists |
|
245 | + $meta = \OC\Files\Filesystem::getFileInfo($target); |
|
246 | + if ($meta === false) { |
|
247 | + $error = $l->t('Upload failed. Could not get file info.'); |
|
248 | + } else { |
|
249 | + $data = \OCA\Files\Helper::formatFileInfo($meta); |
|
250 | + if ($updatable) { |
|
251 | + $data['status'] = 'existserror'; |
|
252 | + } else { |
|
253 | + $data['status'] = 'readonly'; |
|
254 | + } |
|
255 | + $data['originalname'] = $files['name'][$i]; |
|
256 | + $data['uploadMaxFilesize'] = $maxUploadFileSize; |
|
257 | + $data['maxHumanFilesize'] = $maxHumanFileSize; |
|
258 | + $data['permissions'] = $meta['permissions']; |
|
259 | + $data['directory'] = $returnedDir; |
|
260 | + $result[] = $data; |
|
261 | + } |
|
262 | + } |
|
263 | + } |
|
264 | 264 | } else { |
265 | - $error = $l->t('Invalid directory.'); |
|
265 | + $error = $l->t('Invalid directory.'); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | if ($error === false) { |
269 | - // Do not leak file information if it is a read-only share |
|
270 | - if(isset($_POST['dirToken'])) { |
|
271 | - $shareManager = \OC::$server->getShareManager(); |
|
272 | - $share = $shareManager->getShareByToken((string)$_POST['dirToken']); |
|
273 | - if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
274 | - $newResults = []; |
|
275 | - foreach($result as $singleResult) { |
|
276 | - $fileName = $singleResult['originalname']; |
|
277 | - $newResults['filename'] = $fileName; |
|
278 | - $newResults['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($fileName); |
|
279 | - } |
|
280 | - $result = $newResults; |
|
281 | - } |
|
282 | - } |
|
283 | - |
|
284 | - OCP\JSON::encodedPrint($result); |
|
269 | + // Do not leak file information if it is a read-only share |
|
270 | + if(isset($_POST['dirToken'])) { |
|
271 | + $shareManager = \OC::$server->getShareManager(); |
|
272 | + $share = $shareManager->getShareByToken((string)$_POST['dirToken']); |
|
273 | + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
274 | + $newResults = []; |
|
275 | + foreach($result as $singleResult) { |
|
276 | + $fileName = $singleResult['originalname']; |
|
277 | + $newResults['filename'] = $fileName; |
|
278 | + $newResults['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($fileName); |
|
279 | + } |
|
280 | + $result = $newResults; |
|
281 | + } |
|
282 | + } |
|
283 | + |
|
284 | + OCP\JSON::encodedPrint($result); |
|
285 | 285 | } else { |
286 | - OCP\JSON::error(array(array('data' => array_merge(array( |
|
287 | - 'message' => $error, |
|
288 | - 'code' => $errorCode, |
|
289 | - 'filename' => $errorFileName |
|
290 | - ), $storageStats)))); |
|
286 | + OCP\JSON::error(array(array('data' => array_merge(array( |
|
287 | + 'message' => $error, |
|
288 | + 'code' => $errorCode, |
|
289 | + 'filename' => $errorFileName |
|
290 | + ), $storageStats)))); |
|
291 | 291 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $config = \OC::$server->getConfig(); |
25 | 25 | // TODO: move this to the generated config.js |
26 | 26 | $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); |
27 | -$uploadLimit=OCP\Util::uploadLimit(); |
|
27 | +$uploadLimit = OCP\Util::uploadLimit(); |
|
28 | 28 | |
29 | 29 | // renders the controls and table headers template |
30 | 30 | $tmpl = new OCP\Template('files', 'list', ''); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | - /** @var array $_ */ |
|
3 | - /** @var OC_L10N $l */ |
|
2 | + /** @var array $_ */ |
|
3 | + /** @var OC_L10N $l */ |
|
4 | 4 | script('encryption', 'settings-personal'); |
5 | 5 | script('core', 'multiselect'); |
6 | 6 | ?> |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | <br /> |
21 | 21 | <?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?> |
22 | 22 | <?php if ( $_["recoveryEnabledForUser"] ): |
23 | - p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) ); |
|
24 | - endif; ?> |
|
23 | + p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) ); |
|
24 | + endif; ?> |
|
25 | 25 | <br /> |
26 | 26 | <input |
27 | 27 | type="password" |
@@ -7,57 +7,57 @@ discard block |
||
7 | 7 | <form id="ocDefaultEncryptionModule" class="section"> |
8 | 8 | <h2><?php p($l->t('Nextcloud basic encryption module')); ?></h2> |
9 | 9 | |
10 | - <?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED ): ?> |
|
10 | + <?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?> |
|
11 | 11 | |
12 | 12 | <?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?> |
13 | 13 | |
14 | - <?php elseif ( $_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED ): ?> |
|
14 | + <?php elseif ($_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED): ?> |
|
15 | 15 | <p> |
16 | 16 | <a name="changePKPasswd" /> |
17 | 17 | <label for="changePrivateKeyPasswd"> |
18 | - <em><?php p( $l->t( "Your private key password no longer matches your log-in password." ) ); ?></em> |
|
18 | + <em><?php p($l->t("Your private key password no longer matches your log-in password.")); ?></em> |
|
19 | 19 | </label> |
20 | 20 | <br /> |
21 | - <?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?> |
|
22 | - <?php if ( $_["recoveryEnabledForUser"] ): |
|
23 | - p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) ); |
|
21 | + <?php p($l->t("Set your old private key password to your current log-in password:")); ?> |
|
22 | + <?php if ($_["recoveryEnabledForUser"]): |
|
23 | + p($l->t(" If you don't remember your old password you can ask your administrator to recover your files.")); |
|
24 | 24 | endif; ?> |
25 | 25 | <br /> |
26 | 26 | <input |
27 | 27 | type="password" |
28 | 28 | name="changePrivateKeyPassword" |
29 | 29 | id="oldPrivateKeyPassword" /> |
30 | - <label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label> |
|
30 | + <label for="oldPrivateKeyPassword"><?php p($l->t("Old log-in password")); ?></label> |
|
31 | 31 | <br /> |
32 | 32 | <input |
33 | 33 | type="password" |
34 | 34 | name="changePrivateKeyPassword" |
35 | 35 | id="newPrivateKeyPassword" /> |
36 | - <label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label> |
|
36 | + <label for="newRecoveryPassword"><?php p($l->t("Current log-in password")); ?></label> |
|
37 | 37 | <br /> |
38 | 38 | <button |
39 | 39 | type="button" |
40 | 40 | name="submitChangePrivateKeyPassword" |
41 | - disabled><?php p($l->t( "Update Private Key Password" )); ?> |
|
41 | + disabled><?php p($l->t("Update Private Key Password")); ?> |
|
42 | 42 | </button> |
43 | 43 | <span class="msg"></span> |
44 | 44 | </p> |
45 | 45 | |
46 | - <?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?> |
|
46 | + <?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?> |
|
47 | 47 | <br /> |
48 | 48 | <p id="userEnableRecovery"> |
49 | - <label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label> |
|
49 | + <label for="userEnableRecovery"><?php p($l->t("Enable password recovery:")); ?></label> |
|
50 | 50 | <span class="msg"></span> |
51 | 51 | <br /> |
52 | - <em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em> |
|
52 | + <em><?php p($l->t("Enabling this option will allow you to reobtain access to your encrypted files in case of password loss")); ?></em> |
|
53 | 53 | <br /> |
54 | 54 | <input |
55 | 55 | type='radio' |
56 | 56 | id='userEnableRecovery' |
57 | 57 | name='userEnableRecovery' |
58 | 58 | value='1' |
59 | - <?php echo ( $_["recoveryEnabledForUser"] ? 'checked="checked"' : '' ); ?> /> |
|
60 | - <label for="userEnableRecovery"><?php p( $l->t( "Enabled" ) ); ?></label> |
|
59 | + <?php echo ($_["recoveryEnabledForUser"] ? 'checked="checked"' : ''); ?> /> |
|
60 | + <label for="userEnableRecovery"><?php p($l->t("Enabled")); ?></label> |
|
61 | 61 | <br /> |
62 | 62 | |
63 | 63 | <input |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | id='userDisableRecovery' |
66 | 66 | name='userEnableRecovery' |
67 | 67 | value='0' |
68 | - <?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> /> |
|
69 | - <label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label> |
|
68 | + <?php echo ($_["recoveryEnabledForUser"] === false ? 'checked="checked"' : ''); ?> /> |
|
69 | + <label for="userDisableRecovery"><?php p($l->t("Disabled")); ?></label> |
|
70 | 70 | </p> |
71 | 71 | <?php endif; ?> |
72 | 72 | </form> |