@@ -27,7 +27,7 @@ |
||
27 | 27 | use OCP\AppFramework\IAppContainer; |
28 | 28 | |
29 | 29 | class Application extends App { |
30 | - public function __construct () { |
|
30 | + public function __construct() { |
|
31 | 31 | parent::__construct('user_ldap'); |
32 | 32 | $container = $this->getContainer(); |
33 | 33 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $keys = $this->getServersConfig($referenceConfigkey); |
97 | 97 | |
98 | 98 | $result = array(); |
99 | - foreach($keys as $key) { |
|
99 | + foreach ($keys as $key) { |
|
100 | 100 | $len = strlen($key) - strlen($referenceConfigkey); |
101 | 101 | $prefix = substr($key, 0, $len); |
102 | 102 | $result[$prefix] = $this->config->getAppValue('user_ldap', $key); |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | public function getNextServerConfigurationPrefix() { |
114 | 114 | $serverConnections = $this->getServerConfigurationPrefixes(); |
115 | 115 | |
116 | - if(count($serverConnections) === 0) { |
|
116 | + if (count($serverConnections) === 0) { |
|
117 | 117 | return 's01'; |
118 | 118 | } |
119 | 119 | |
120 | 120 | sort($serverConnections); |
121 | 121 | $lastKey = array_pop($serverConnections); |
122 | 122 | $lastNumber = intval(str_replace('s', '', $lastKey)); |
123 | - $nextPrefix = 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
123 | + $nextPrefix = 's'.str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
124 | 124 | return $nextPrefix; |
125 | 125 | } |
126 | 126 | |
127 | 127 | private function getServersConfig($value) { |
128 | - $regex = '/' . $value . '$/S'; |
|
128 | + $regex = '/'.$value.'$/S'; |
|
129 | 129 | |
130 | 130 | $keys = $this->config->getAppKeys('user_ldap'); |
131 | 131 | $result = []; |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | * @return bool true on success, false otherwise |
145 | 145 | */ |
146 | 146 | public function deleteServerConfiguration($prefix) { |
147 | - if(!in_array($prefix, self::getServerConfigurationPrefixes())) { |
|
147 | + if (!in_array($prefix, self::getServerConfigurationPrefixes())) { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $saveOtherConfigurations = ''; |
152 | - if(empty($prefix)) { |
|
152 | + if (empty($prefix)) { |
|
153 | 153 | $saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\''; |
154 | 154 | } |
155 | 155 | |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | '); |
164 | 164 | $delRows = $query->execute(array($prefix.'%')); |
165 | 165 | |
166 | - if(\OCP\DB::isError($delRows)) { |
|
166 | + if (\OCP\DB::isError($delRows)) { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
170 | - if($delRows === 0) { |
|
170 | + if ($delRows === 0) { |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $all = $this->getServerConfigurationPrefixes(false); |
184 | 184 | $active = $this->getServerConfigurationPrefixes(true); |
185 | 185 | |
186 | - if(!is_array($all) || !is_array($active)) { |
|
186 | + if (!is_array($all) || !is_array($active)) { |
|
187 | 187 | throw new \Exception('Unexpected Return Value'); |
188 | 188 | } |
189 | 189 | |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function getDomainFromURL($url) { |
199 | 199 | $uinfo = parse_url($url); |
200 | - if(!is_array($uinfo)) { |
|
200 | + if (!is_array($uinfo)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $domain = false; |
205 | - if(isset($uinfo['host'])) { |
|
205 | + if (isset($uinfo['host'])) { |
|
206 | 206 | $domain = $uinfo['host']; |
207 | - } else if(isset($uinfo['path'])) { |
|
207 | + } else if (isset($uinfo['path'])) { |
|
208 | 208 | $domain = $uinfo['path']; |
209 | 209 | } |
210 | 210 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function setLDAPProvider() { |
220 | 220 | $current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null); |
221 | - if(is_null($current)) { |
|
221 | + if (is_null($current)) { |
|
222 | 222 | \OC::$server->getConfig()->setSystemValue('ldapProviderFactory', '\\OCA\\User_LDAP\\LDAPProviderFactory'); |
223 | 223 | } |
224 | 224 | } |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function sanitizeDN($dn) { |
232 | 232 | //treating multiple base DNs |
233 | - if(is_array($dn)) { |
|
233 | + if (is_array($dn)) { |
|
234 | 234 | $result = array(); |
235 | - foreach($dn as $singleDN) { |
|
235 | + foreach ($dn as $singleDN) { |
|
236 | 236 | $result[] = $this->sanitizeDN($singleDN); |
237 | 237 | } |
238 | 238 | return $result; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @throws \Exception |
284 | 284 | */ |
285 | 285 | public static function loginName2UserName($param) { |
286 | - if(!isset($param['uid'])) { |
|
286 | + if (!isset($param['uid'])) { |
|
287 | 287 | throw new \Exception('key uid is expected to be set in $param'); |
288 | 288 | } |
289 | 289 | |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | $ocConfig = \OC::$server->getConfig(); |
296 | 296 | $notificationManager = \OC::$server->getNotificationManager(); |
297 | 297 | |
298 | - $userBackend = new User_Proxy( |
|
298 | + $userBackend = new User_Proxy( |
|
299 | 299 | $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager |
300 | 300 | ); |
301 | - $uid = $userBackend->loginName2UserName($param['uid'] ); |
|
302 | - if($uid !== false) { |
|
301 | + $uid = $userBackend->loginName2UserName($param['uid']); |
|
302 | + if ($uid !== false) { |
|
303 | 303 | $param['uid'] = $uid; |
304 | 304 | } |
305 | 305 | } |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | public function __construct(array $serverConfigPrefixes, ILDAPWrapper $ldap, IConfig $ocConfig, |
45 | 45 | INotificationManager $notificationManager) { |
46 | 46 | parent::__construct($ldap); |
47 | - foreach($serverConfigPrefixes as $configPrefix) { |
|
47 | + foreach ($serverConfigPrefixes as $configPrefix) { |
|
48 | 48 | $this->backends[$configPrefix] = |
49 | 49 | new User_LDAP($this->getAccess($configPrefix), $ocConfig, $notificationManager); |
50 | - if(is_null($this->refBackend)) { |
|
50 | + if (is_null($this->refBackend)) { |
|
51 | 51 | $this->refBackend = &$this->backends[$configPrefix]; |
52 | 52 | } |
53 | 53 | } |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function walkBackends($uid, $method, $parameters) { |
64 | 64 | $cacheKey = $this->getUserCacheKey($uid); |
65 | - foreach($this->backends as $configPrefix => $backend) { |
|
65 | + foreach ($this->backends as $configPrefix => $backend) { |
|
66 | 66 | $instance = $backend; |
67 | - if(!method_exists($instance, $method) |
|
67 | + if (!method_exists($instance, $method) |
|
68 | 68 | && method_exists($this->getAccess($configPrefix), $method)) { |
69 | 69 | $instance = $this->getAccess($configPrefix); |
70 | 70 | } |
71 | - if($result = call_user_func_array(array($instance, $method), $parameters)) { |
|
71 | + if ($result = call_user_func_array(array($instance, $method), $parameters)) { |
|
72 | 72 | $this->writeToCache($cacheKey, $configPrefix); |
73 | 73 | return $result; |
74 | 74 | } |
@@ -88,22 +88,22 @@ discard block |
||
88 | 88 | $cacheKey = $this->getUserCacheKey($uid); |
89 | 89 | $prefix = $this->getFromCache($cacheKey); |
90 | 90 | //in case the uid has been found in the past, try this stored connection first |
91 | - if(!is_null($prefix)) { |
|
92 | - if(isset($this->backends[$prefix])) { |
|
91 | + if (!is_null($prefix)) { |
|
92 | + if (isset($this->backends[$prefix])) { |
|
93 | 93 | $instance = $this->backends[$prefix]; |
94 | - if(!method_exists($instance, $method) |
|
94 | + if (!method_exists($instance, $method) |
|
95 | 95 | && method_exists($this->getAccess($prefix), $method)) { |
96 | 96 | $instance = $this->getAccess($prefix); |
97 | 97 | } |
98 | 98 | $result = call_user_func_array(array($instance, $method), $parameters); |
99 | - if($result === $passOnWhen) { |
|
99 | + if ($result === $passOnWhen) { |
|
100 | 100 | //not found here, reset cache to null if user vanished |
101 | 101 | //because sometimes methods return false with a reason |
102 | 102 | $userExists = call_user_func_array( |
103 | 103 | array($this->backends[$prefix], 'userExists'), |
104 | 104 | array($uid) |
105 | 105 | ); |
106 | - if(!$userExists) { |
|
106 | + if (!$userExists) { |
|
107 | 107 | $this->writeToCache($cacheKey, null); |
108 | 108 | } |
109 | 109 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function getUsers($search = '', $limit = 10, $offset = 0) { |
146 | 146 | //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends |
147 | 147 | $users = array(); |
148 | - foreach($this->backends as $backend) { |
|
148 | + foreach ($this->backends as $backend) { |
|
149 | 149 | $backendUsers = $backend->getUsers($search, $limit, $offset); |
150 | 150 | if (is_array($backendUsers)) { |
151 | 151 | $users = array_merge($users, $backendUsers); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @return string|false |
194 | 194 | */ |
195 | 195 | public function loginName2UserName($loginName) { |
196 | - $id = 'LOGINNAME,' . $loginName; |
|
196 | + $id = 'LOGINNAME,'.$loginName; |
|
197 | 197 | return $this->handleRequest($id, 'loginName2UserName', array($loginName)); |
198 | 198 | } |
199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string|false with the username |
205 | 205 | */ |
206 | 206 | public function dn2UserName($dn) { |
207 | - $id = 'DN,' . $dn; |
|
207 | + $id = 'DN,'.$dn; |
|
208 | 208 | return $this->handleRequest($id, 'dn2UserName', array($dn)); |
209 | 209 | } |
210 | 210 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function getDisplayNames($search = '', $limit = null, $offset = null) { |
246 | 246 | //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends |
247 | 247 | $users = array(); |
248 | - foreach($this->backends as $backend) { |
|
248 | + foreach ($this->backends as $backend) { |
|
249 | 249 | $backendUsers = $backend->getDisplayNames($search, $limit, $offset); |
250 | 250 | if (is_array($backendUsers)) { |
251 | 251 | $users = $users + $backendUsers; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function countUsers() { |
291 | 291 | $users = false; |
292 | - foreach($this->backends as $backend) { |
|
292 | + foreach ($this->backends as $backend) { |
|
293 | 293 | $backendUsers = $backend->countUsers(); |
294 | 294 | if ($backendUsers !== false) { |
295 | 295 | $users += $backendUsers; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function __construct(ILDAPWrapper $ldap) { |
48 | 48 | $this->ldap = $ldap; |
49 | 49 | $memcache = \OC::$server->getMemCacheFactory(); |
50 | - if($memcache->isAvailable()) { |
|
50 | + if ($memcache->isAvailable()) { |
|
51 | 51 | $this->cache = $memcache->create(); |
52 | 52 | } |
53 | 53 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | static $db; |
66 | 66 | static $coreUserManager; |
67 | 67 | static $coreNotificationManager; |
68 | - if(is_null($fs)) { |
|
68 | + if (is_null($fs)) { |
|
69 | 69 | $ocConfig = \OC::$server->getConfig(); |
70 | 70 | $fs = new FilesystemHelper(); |
71 | 71 | $log = new LogWrapper(); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return mixed |
92 | 92 | */ |
93 | 93 | protected function getAccess($configPrefix) { |
94 | - if(!isset(self::$accesses[$configPrefix])) { |
|
94 | + if (!isset(self::$accesses[$configPrefix])) { |
|
95 | 95 | $this->addAccess($configPrefix); |
96 | 96 | } |
97 | 97 | return self::$accesses[$configPrefix]; |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | * @return mixed, the result of the specified method |
146 | 146 | */ |
147 | 147 | protected function handleRequest($id, $method, $parameters, $passOnWhen = false) { |
148 | - $result = $this->callOnLastSeenOn($id, $method, $parameters, $passOnWhen); |
|
149 | - if($result === $passOnWhen) { |
|
148 | + $result = $this->callOnLastSeenOn($id, $method, $parameters, $passOnWhen); |
|
149 | + if ($result === $passOnWhen) { |
|
150 | 150 | $result = $this->walkBackends($id, $method, $parameters); |
151 | 151 | } |
152 | 152 | return $result; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function getCacheKey($key) { |
160 | 160 | $prefix = 'LDAP-Proxy-'; |
161 | - if(is_null($key)) { |
|
161 | + if (is_null($key)) { |
|
162 | 162 | return $prefix; |
163 | 163 | } |
164 | 164 | return $prefix.md5($key); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @return mixed|null |
170 | 170 | */ |
171 | 171 | public function getFromCache($key) { |
172 | - if(is_null($this->cache) || !$this->isCached($key)) { |
|
172 | + if (is_null($this->cache) || !$this->isCached($key)) { |
|
173 | 173 | return null; |
174 | 174 | } |
175 | 175 | $key = $this->getCacheKey($key); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @return bool |
183 | 183 | */ |
184 | 184 | public function isCached($key) { |
185 | - if(is_null($this->cache)) { |
|
185 | + if (is_null($this->cache)) { |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | $key = $this->getCacheKey($key); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param mixed $value |
195 | 195 | */ |
196 | 196 | public function writeToCache($key, $value) { |
197 | - if(is_null($this->cache)) { |
|
197 | + if (is_null($this->cache)) { |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | $key = $this->getCacheKey($key); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | public function clearCache() { |
206 | - if(is_null($this->cache)) { |
|
206 | + if (is_null($this->cache)) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | $this->cache->clear($this->getCacheKey(null)); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function __construct($storage, array $mountpoints, $arguments = null, $loader = null) { |
67 | 67 | $this->user = $arguments['user']; |
68 | - $this->recipientView = new View('/' . $this->user . '/files'); |
|
68 | + $this->recipientView = new View('/'.$this->user.'/files'); |
|
69 | 69 | |
70 | 70 | $this->superShare = $arguments['superShare']; |
71 | 71 | $this->groupedShares = $arguments['groupedShares']; |
72 | 72 | |
73 | 73 | $newMountPoint = $this->verifyMountPoint($this->superShare, $mountpoints); |
74 | - $absMountPoint = '/' . $this->user . '/files' . $newMountPoint; |
|
75 | - $arguments['ownerView'] = new View('/' . $this->superShare->getShareOwner() . '/files'); |
|
74 | + $absMountPoint = '/'.$this->user.'/files'.$newMountPoint; |
|
75 | + $arguments['ownerView'] = new View('/'.$this->superShare->getShareOwner().'/files'); |
|
76 | 76 | parent::__construct($storage, $absMountPoint, $arguments, $loader); |
77 | 77 | } |
78 | 78 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | $newMountPoint = $this->generateUniqueTarget( |
96 | - \OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), |
|
96 | + \OC\Files\Filesystem::normalizePath($parent.'/'.$mountPoint), |
|
97 | 97 | $this->recipientView, |
98 | 98 | $mountpoints |
99 | 99 | ); |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function generateUniqueTarget($path, $view, array $mountpoints) { |
132 | 132 | $pathinfo = pathinfo($path); |
133 | - $ext = (isset($pathinfo['extension'])) ? '.' . $pathinfo['extension'] : ''; |
|
133 | + $ext = (isset($pathinfo['extension'])) ? '.'.$pathinfo['extension'] : ''; |
|
134 | 134 | $name = $pathinfo['filename']; |
135 | 135 | $dir = $pathinfo['dirname']; |
136 | 136 | |
137 | 137 | // Helper function to find existing mount points |
138 | - $mountpointExists = function ($path) use ($mountpoints) { |
|
138 | + $mountpointExists = function($path) use ($mountpoints) { |
|
139 | 139 | foreach ($mountpoints as $mountpoint) { |
140 | 140 | if ($mountpoint->getShare()->getTarget() === $path) { |
141 | 141 | return true; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $i = 2; |
148 | 148 | while ($view->file_exists($path) || $mountpointExists($path)) { |
149 | - $path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext); |
|
149 | + $path = Filesystem::normalizePath($dir.'/'.$name.' ('.$i.')'.$ext); |
|
150 | 150 | $i++; |
151 | 151 | } |
152 | 152 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // it is not a file relative to data/user/files |
168 | 168 | if (count($split) < 3 || $split[1] !== 'files') { |
169 | 169 | \OCP\Util::writeLog('file sharing', |
170 | - 'Can not strip userid and "files/" from path: ' . $path, |
|
170 | + 'Can not strip userid and "files/" from path: '.$path, |
|
171 | 171 | \OCP\Util::ERROR); |
172 | 172 | throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10); |
173 | 173 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $sliced = array_slice($split, 2); |
177 | 177 | $relPath = implode('/', $sliced); |
178 | 178 | |
179 | - return '/' . $relPath; |
|
179 | + return '/'.$relPath; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $this->storage->setMountPoint($relTargetPath); |
199 | 199 | } catch (\Exception $e) { |
200 | 200 | \OCP\Util::writeLog('file sharing', |
201 | - 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"', |
|
201 | + 'Could not rename mount point for shared folder "'.$this->getMountPoint().'" to "'.$target.'"', |
|
202 | 202 | \OCP\Util::ERROR); |
203 | 203 | } |
204 | 204 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $row = $result->fetch(); |
254 | 254 | $result->closeCursor(); |
255 | 255 | if ($row) { |
256 | - return (int)$row['storage']; |
|
256 | + return (int) $row['storage']; |
|
257 | 257 | } |
258 | 258 | return -1; |
259 | 259 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $updatedEntries = $builder->execute(); |
73 | 73 | if ($updatedEntries > 0) { |
74 | - $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares'); |
|
74 | + $out->info('Fixed file share permissions for '.$updatedEntries.' shares'); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | if ($deletedEntries) { |
110 | - $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist'); |
|
110 | + $out->info('Removed '.$deletedEntries.' shares where the parent did not exist'); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'www.google.com', |
105 | 105 | 'www.github.com']; |
106 | 106 | |
107 | - foreach($siteArray as $site) { |
|
107 | + foreach ($siteArray as $site) { |
|
108 | 108 | if ($this->isSiteReachable($site)) { |
109 | 109 | return true; |
110 | 110 | } |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @return bool |
118 | 118 | */ |
119 | 119 | private function isSiteReachable($sitename) { |
120 | - $httpSiteName = 'http://' . $sitename . '/'; |
|
121 | - $httpsSiteName = 'https://' . $sitename . '/'; |
|
120 | + $httpSiteName = 'http://'.$sitename.'/'; |
|
121 | + $httpsSiteName = 'https://'.$sitename.'/'; |
|
122 | 122 | |
123 | 123 | try { |
124 | 124 | $client = $this->clientService->newClient(); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * @return bool |
146 | 146 | */ |
147 | 147 | private function isUrandomAvailable() { |
148 | - if(@file_exists('/dev/urandom')) { |
|
148 | + if (@file_exists('/dev/urandom')) { |
|
149 | 149 | $file = fopen('/dev/urandom', 'rb'); |
150 | - if($file) { |
|
150 | + if ($file) { |
|
151 | 151 | fclose($file); |
152 | 152 | return true; |
153 | 153 | } |
@@ -178,40 +178,40 @@ discard block |
||
178 | 178 | // Don't run check when: |
179 | 179 | // 1. Server has `has_internet_connection` set to false |
180 | 180 | // 2. AppStore AND S2S is disabled |
181 | - if(!$this->config->getSystemValue('has_internet_connection', true)) { |
|
181 | + if (!$this->config->getSystemValue('has_internet_connection', true)) { |
|
182 | 182 | return ''; |
183 | 183 | } |
184 | - if(!$this->config->getSystemValue('appstoreenabled', true) |
|
184 | + if (!$this->config->getSystemValue('appstoreenabled', true) |
|
185 | 185 | && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' |
186 | 186 | && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { |
187 | 187 | return ''; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $versionString = $this->getCurlVersion(); |
191 | - if(isset($versionString['ssl_version'])) { |
|
191 | + if (isset($versionString['ssl_version'])) { |
|
192 | 192 | $versionString = $versionString['ssl_version']; |
193 | 193 | } else { |
194 | 194 | return ''; |
195 | 195 | } |
196 | 196 | |
197 | - $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
198 | - if(!$this->config->getSystemValue('appstoreenabled', true)) { |
|
199 | - $features = (string)$this->l10n->t('Federated Cloud Sharing'); |
|
197 | + $features = (string) $this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
198 | + if (!$this->config->getSystemValue('appstoreenabled', true)) { |
|
199 | + $features = (string) $this->l10n->t('Federated Cloud Sharing'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Check if at least OpenSSL after 1.01d or 1.0.2b |
203 | - if(strpos($versionString, 'OpenSSL/') === 0) { |
|
203 | + if (strpos($versionString, 'OpenSSL/') === 0) { |
|
204 | 204 | $majorVersion = substr($versionString, 8, 5); |
205 | 205 | $patchRelease = substr($versionString, 13, 6); |
206 | 206 | |
207 | - if(($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
207 | + if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
208 | 208 | ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { |
209 | 209 | return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['OpenSSL', $versionString, $features]); |
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | 213 | // Check if NSS and perform heuristic check |
214 | - if(strpos($versionString, 'NSS/') === 0) { |
|
214 | + if (strpos($versionString, 'NSS/') === 0) { |
|
215 | 215 | try { |
216 | 216 | $firstClient = $this->clientService->newClient(); |
217 | 217 | $firstClient->get('https://www.owncloud.org/'); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $secondClient = $this->clientService->newClient(); |
220 | 220 | $secondClient->get('https://owncloud.org/'); |
221 | 221 | } catch (ClientException $e) { |
222 | - if($e->getResponse()->getStatusCode() === 400) { |
|
222 | + if ($e->getResponse()->getStatusCode() === 400) { |
|
223 | 223 | return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['NSS', $versionString, $features]); |
224 | 224 | } |
225 | 225 | } |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | * @return DataResponse |
301 | 301 | */ |
302 | 302 | public function getFailedIntegrityCheckFiles() { |
303 | - if(!$this->checker->isCodeCheckEnforced()) { |
|
303 | + if (!$this->checker->isCodeCheckEnforced()) { |
|
304 | 304 | return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); |
305 | 305 | } |
306 | 306 | |
307 | 307 | $completeResults = $this->checker->getResults(); |
308 | 308 | |
309 | - if(!empty($completeResults)) { |
|
309 | + if (!empty($completeResults)) { |
|
310 | 310 | $formattedTextResponse = 'Technical information |
311 | 311 | ===================== |
312 | 312 | The following list covers which files have failed the integrity check. Please read |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | Results |
317 | 317 | ======= |
318 | 318 | '; |
319 | - foreach($completeResults as $context => $contextResult) { |
|
319 | + foreach ($completeResults as $context => $contextResult) { |
|
320 | 320 | $formattedTextResponse .= "- $context\n"; |
321 | 321 | |
322 | - foreach($contextResult as $category => $result) { |
|
322 | + foreach ($contextResult as $category => $result) { |
|
323 | 323 | $formattedTextResponse .= "\t- $category\n"; |
324 | - if($category !== 'EXCEPTION') { |
|
324 | + if ($category !== 'EXCEPTION') { |
|
325 | 325 | foreach ($result as $key => $results) { |
326 | 326 | $formattedTextResponse .= "\t\t- $key\n"; |
327 | 327 | } |
@@ -364,27 +364,27 @@ discard block |
||
364 | 364 | |
365 | 365 | $isOpcacheProperlySetUp = true; |
366 | 366 | |
367 | - if(!$iniWrapper->getBool('opcache.enable')) { |
|
367 | + if (!$iniWrapper->getBool('opcache.enable')) { |
|
368 | 368 | $isOpcacheProperlySetUp = false; |
369 | 369 | } |
370 | 370 | |
371 | - if(!$iniWrapper->getBool('opcache.save_comments')) { |
|
371 | + if (!$iniWrapper->getBool('opcache.save_comments')) { |
|
372 | 372 | $isOpcacheProperlySetUp = false; |
373 | 373 | } |
374 | 374 | |
375 | - if(!$iniWrapper->getBool('opcache.enable_cli')) { |
|
375 | + if (!$iniWrapper->getBool('opcache.enable_cli')) { |
|
376 | 376 | $isOpcacheProperlySetUp = false; |
377 | 377 | } |
378 | 378 | |
379 | - if($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
379 | + if ($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
380 | 380 | $isOpcacheProperlySetUp = false; |
381 | 381 | } |
382 | 382 | |
383 | - if($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
383 | + if ($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
384 | 384 | $isOpcacheProperlySetUp = false; |
385 | 385 | } |
386 | 386 | |
387 | - if($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
387 | + if ($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
388 | 388 | $isOpcacheProperlySetUp = false; |
389 | 389 | } |
390 | 390 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | public function getACL() { |
102 | - $acl = [ |
|
102 | + $acl = [ |
|
103 | 103 | [ |
104 | 104 | 'privilege' => '{DAV:}read', |
105 | 105 | 'principal' => $this->getOwner(), |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'protected' => true, |
112 | 112 | ]; |
113 | 113 | if ($this->getOwner() !== parent::getOwner()) { |
114 | - $acl[] = [ |
|
114 | + $acl[] = [ |
|
115 | 115 | 'privilege' => '{DAV:}read', |
116 | 116 | 'principal' => parent::getOwner(), |
117 | 117 | 'protected' => true, |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | public function delete() { |
172 | 172 | if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { |
173 | - $principal = 'principal:' . parent::getOwner(); |
|
173 | + $principal = 'principal:'.parent::getOwner(); |
|
174 | 174 | $shares = $this->carddavBackend->getShares($this->getResourceId()); |
175 | 175 | $shares = array_filter($shares, function($share) use ($principal){ |
176 | 176 | return $share['href'] === $principal; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ], |
55 | 55 | ]; |
56 | 56 | |
57 | - if($this->appManager->isEnabledForUser('files_sharing')) { |
|
57 | + if ($this->appManager->isEnabledForUser('files_sharing')) { |
|
58 | 58 | $services['SHARING'] = [ |
59 | 59 | 'version' => 1, |
60 | 60 | 'endpoints' => [ |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if($this->appManager->isEnabledForUser('activity')) { |
|
88 | + if ($this->appManager->isEnabledForUser('activity')) { |
|
89 | 89 | $services['ACTIVITY'] = [ |
90 | 90 | 'version' => 1, |
91 | 91 | 'endpoints' => [ |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ]; |
95 | 95 | } |
96 | 96 | |
97 | - if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
97 | + if ($this->appManager->isEnabledForUser('provisioning_api')) { |
|
98 | 98 | $services['PROVISIONING'] = [ |
99 | 99 | 'version' => 1, |
100 | 100 | 'endpoints' => [ |