@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | public function fixupStatement($statement) { |
44 | 44 | $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement); |
45 | - $statement = str_replace( '`', '"', $statement ); |
|
46 | - $statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement ); |
|
45 | + $statement = str_replace('`', '"', $statement); |
|
46 | + $statement = str_ireplace('NOW()', 'datetime(\'now\')', $statement); |
|
47 | 47 | $statement = str_ireplace('GREATEST(', 'MAX(', $statement); |
48 | - $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement ); |
|
48 | + $statement = str_ireplace('UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement); |
|
49 | 49 | return $statement; |
50 | 50 | } |
51 | 51 | |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | if (empty($compare)) { |
65 | 65 | $compare = array_keys($input); |
66 | 66 | } |
67 | - $fieldList = '`' . implode('`,`', array_keys($input)) . '`'; |
|
67 | + $fieldList = '`'.implode('`,`', array_keys($input)).'`'; |
|
68 | 68 | $query = "INSERT INTO `$table` ($fieldList) SELECT " |
69 | - . str_repeat('?,', count($input)-1).'? ' |
|
69 | + . str_repeat('?,', count($input) - 1).'? ' |
|
70 | 70 | . " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE "; |
71 | 71 | |
72 | 72 | $inserts = array_values($input); |
73 | - foreach($compare as $key) { |
|
74 | - $query .= '`' . $key . '`'; |
|
73 | + foreach ($compare as $key) { |
|
74 | + $query .= '`'.$key.'`'; |
|
75 | 75 | if (is_null($input[$key])) { |
76 | 76 | $query .= ' IS NULL AND '; |
77 | 77 | } else { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | <div class="warning title"> |
19 | 19 | <?php p($l->t('Please renew your password.')); ?><br> |
20 | 20 | </div> |
21 | - <?php foreach($_['messages'] as $message): ?> |
|
21 | + <?php foreach ($_['messages'] as $message): ?> |
|
22 | 22 | <div class="warning"> |
23 | 23 | <?php p($message); ?><br> |
24 | 24 | </div> |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | <?php endif; ?> |
32 | 32 | <div id="message" class="hidden"> |
33 | 33 | <img class="float-spinner" alt="" |
34 | - src="<?php p(image_path('core', 'loading-dark.gif'));?>"> |
|
34 | + src="<?php p(image_path('core', 'loading-dark.gif')); ?>"> |
|
35 | 35 | <span id="messageText"></span> |
36 | 36 | <!-- the following div ensures that the spinner is always inside the #message div --> |
37 | 37 | <div style="clear: both;"></div> |
38 | 38 | </div> |
39 | 39 | <p class="grouptop"> |
40 | 40 | <input type="password" id="oldPassword" name="oldPassword" |
41 | - placeholder="<?php echo $l->t('Current password');?>" |
|
41 | + placeholder="<?php echo $l->t('Current password'); ?>" |
|
42 | 42 | autofocus autocomplete="off" autocapitalize="off" autocorrect="off" required/> |
43 | 43 | <label for="oldPassword" class="infield"><?php p($l->t('Current password')); ?></label> |
44 | 44 | </p> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <input type="checkbox" id="personal-show" name="show" /><label for="personal-show"></label> |
48 | 48 | <label id="newPassword-label" for="newPassword" class="infield"><?php p($l->t('New password')); ?></label> |
49 | 49 | <input type="password" id="newPassword" name="newPassword" |
50 | - placeholder="<?php echo $l->t('New password');?>" |
|
50 | + placeholder="<?php echo $l->t('New password'); ?>" |
|
51 | 51 | data-typetoggle="#personal-show" autofocus autocomplete="off" autocapitalize="off" autocorrect="off" required/> |
52 | 52 | </p> |
53 | 53 |
@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | //pass in app.php we do add here, except something else is passed e.g. |
81 | 81 | //in tests. |
82 | 82 | |
83 | - if(isset($arguments['helper'])) { |
|
83 | + if (isset($arguments['helper'])) { |
|
84 | 84 | $this->ldapHelper = $arguments['helper']; |
85 | 85 | } else { |
86 | 86 | $this->ldapHelper = new Helper(\OC::$server->getConfig()); |
87 | 87 | } |
88 | 88 | |
89 | - if(isset($arguments['ocConfig'])) { |
|
89 | + if (isset($arguments['ocConfig'])) { |
|
90 | 90 | $this->ocConfig = $arguments['ocConfig']; |
91 | 91 | } else { |
92 | 92 | $this->ocConfig = \OC::$server->getConfig(); |
93 | 93 | } |
94 | 94 | |
95 | - if(isset($arguments['userBackend'])) { |
|
95 | + if (isset($arguments['userBackend'])) { |
|
96 | 96 | $this->userBackend = $arguments['userBackend']; |
97 | 97 | } else { |
98 | - $this->userBackend = new User_Proxy( |
|
98 | + $this->userBackend = new User_Proxy( |
|
99 | 99 | $this->ldapHelper->getServerConfigurationPrefixes(true), |
100 | 100 | new LDAP(), |
101 | 101 | $this->ocConfig, |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - if(isset($arguments['db'])) { |
|
106 | + if (isset($arguments['db'])) { |
|
107 | 107 | $this->db = $arguments['db']; |
108 | 108 | } else { |
109 | 109 | $this->db = \OC::$server->getDatabaseConnection(); |
110 | 110 | } |
111 | 111 | |
112 | - if(isset($arguments['mapping'])) { |
|
112 | + if (isset($arguments['mapping'])) { |
|
113 | 113 | $this->mapping = $arguments['mapping']; |
114 | 114 | } else { |
115 | 115 | $this->mapping = new UserMapping($this->db); |
116 | 116 | } |
117 | 117 | |
118 | - if(isset($arguments['deletedUsersIndex'])) { |
|
118 | + if (isset($arguments['deletedUsersIndex'])) { |
|
119 | 119 | $this->dui = $arguments['deletedUsersIndex']; |
120 | 120 | } else { |
121 | 121 | $this->dui = new DeletedUsersIndex( |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | public function run($argument) { |
131 | 131 | $this->setArguments($argument); |
132 | 132 | |
133 | - if(!$this->isCleanUpAllowed()) { |
|
133 | + if (!$this->isCleanUpAllowed()) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | $users = $this->mapping->getList($this->getOffset(), $this->limit); |
137 | - if(!is_array($users)) { |
|
137 | + if (!is_array($users)) { |
|
138 | 138 | //something wrong? Let's start from the beginning next time and |
139 | 139 | //abort |
140 | 140 | $this->setOffset(true); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function isCleanUpAllowed() { |
162 | 162 | try { |
163 | - if($this->ldapHelper->haveDisabledConfigurations()) { |
|
163 | + if ($this->ldapHelper->haveDisabledConfigurations()) { |
|
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | } catch (\Exception $e) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @return bool |
178 | 178 | */ |
179 | 179 | private function isCleanUpEnabled() { |
180 | - return (bool)$this->ocConfig->getSystemValue( |
|
180 | + return (bool) $this->ocConfig->getSystemValue( |
|
181 | 181 | 'ldapUserCleanupInterval', strval($this->defaultIntervalMin)); |
182 | 182 | } |
183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param array $users result from getMappedUsers() |
187 | 187 | */ |
188 | 188 | private function checkUsers(array $users) { |
189 | - foreach($users as $user) { |
|
189 | + foreach ($users as $user) { |
|
190 | 190 | $this->checkUser($user); |
191 | 191 | } |
192 | 192 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param string[] $user |
197 | 197 | */ |
198 | 198 | private function checkUser(array $user) { |
199 | - if($this->userBackend->userExistsOnLDAP($user['name'])) { |
|
199 | + if ($this->userBackend->userExistsOnLDAP($user['name'])) { |
|
200 | 200 | //still available, all good |
201 | 201 | |
202 | 202 | return; |
@@ -218,8 +218,7 @@ discard block |
||
218 | 218 | * @param bool $reset whether the offset should be set to 0 |
219 | 219 | */ |
220 | 220 | public function setOffset($reset = false) { |
221 | - $newOffset = $reset ? 0 : |
|
222 | - $this->getOffset() + $this->limit; |
|
221 | + $newOffset = $reset ? 0 : $this->getOffset() + $this->limit; |
|
223 | 222 | $this->ocConfig->setAppValue('user_ldap', 'cleanUpJobOffset', $newOffset); |
224 | 223 | } |
225 | 224 |
@@ -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 |