@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->logger = $serverContainer->getLogger(); |
| 48 | 48 | $this->helper = $helper; |
| 49 | 49 | $this->deletedUsersIndex = $deletedUsersIndex; |
| 50 | - foreach ($serverContainer->getUserManager()->getBackends() as $backend){ |
|
| 50 | + foreach ($serverContainer->getUserManager()->getBackends() as $backend) { |
|
| 51 | 51 | $this->logger->debug('instance '.get_class($backend).' backend.', ['app' => 'user_ldap']); |
| 52 | 52 | if ($backend instanceof IUserLDAP) { |
| 53 | 53 | $this->backend = $backend; |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * @throws \Exception if translation was unsuccessful |
| 65 | 65 | */ |
| 66 | 66 | public function getUserDN($uid) { |
| 67 | - if(!$this->backend->userExists($uid)){ |
|
| 67 | + if (!$this->backend->userExists($uid)) { |
|
| 68 | 68 | throw new \Exception('User id not found in LDAP'); |
| 69 | 69 | } |
| 70 | 70 | $result = $this->backend->getLDAPAccess($uid)->username2dn($uid); |
| 71 | - if(!$result){ |
|
| 71 | + if (!$result) { |
|
| 72 | 72 | throw new \Exception('Translation to LDAP DN unsuccessful'); |
| 73 | 73 | } |
| 74 | 74 | return $result; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getUserName($dn) { |
| 85 | 85 | $result = $this->backend->dn2UserName($dn); |
| 86 | - if(!$result){ |
|
| 86 | + if (!$result) { |
|
| 87 | 87 | throw new \Exception('Translation to internal user name unsuccessful'); |
| 88 | 88 | } |
| 89 | 89 | return $result; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @throws \Exception if user id was not found in LDAP |
| 116 | 116 | */ |
| 117 | 117 | public function getLDAPConnection($uid) { |
| 118 | - if(!$this->backend->userExists($uid)){ |
|
| 118 | + if (!$this->backend->userExists($uid)) { |
|
| 119 | 119 | throw new \Exception('User id not found in LDAP'); |
| 120 | 120 | } |
| 121 | 121 | return $this->backend->getNewLDAPConnection($uid); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @throws \Exception if user id was not found in LDAP |
| 129 | 129 | */ |
| 130 | 130 | public function getLDAPBaseUsers($uid) { |
| 131 | - if(!$this->backend->userExists($uid)){ |
|
| 131 | + if (!$this->backend->userExists($uid)) { |
|
| 132 | 132 | throw new \Exception('User id not found in LDAP'); |
| 133 | 133 | } |
| 134 | 134 | return $this->backend->getLDAPAccess($uid)->getConnection()->getConfiguration()['ldap_base_users']; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @throws \Exception if user id was not found in LDAP |
| 142 | 142 | */ |
| 143 | 143 | public function getLDAPBaseGroups($uid) { |
| 144 | - if(!$this->backend->userExists($uid)){ |
|
| 144 | + if (!$this->backend->userExists($uid)) { |
|
| 145 | 145 | throw new \Exception('User id not found in LDAP'); |
| 146 | 146 | } |
| 147 | 147 | return $this->backend->getLDAPAccess($uid)->getConnection()->getConfiguration()['ldap_base_groups']; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @throws \Exception if user id was not found in LDAP |
| 154 | 154 | */ |
| 155 | 155 | public function clearCache($uid) { |
| 156 | - if(!$this->backend->userExists($uid)){ |
|
| 156 | + if (!$this->backend->userExists($uid)) { |
|
| 157 | 157 | throw new \Exception('User id not found in LDAP'); |
| 158 | 158 | } |
| 159 | 159 | $this->backend->getLDAPAccess($uid)->getConnection()->clearCache(); |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function canChangeAvatar($uid) { |
| 68 | 68 | $user = $this->access->userManager->get($uid); |
| 69 | - if(!$user instanceof User) { |
|
| 69 | + if (!$user instanceof User) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | - if($user->getAvatarImage() === false) { |
|
| 72 | + if ($user->getAvatarImage() === false) { |
|
| 73 | 73 | return true; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | public function loginName2UserName($loginName) { |
| 86 | 86 | $cacheKey = 'loginName2UserName-'.$loginName; |
| 87 | 87 | $username = $this->access->connection->getFromCache($cacheKey); |
| 88 | - if(!is_null($username)) { |
|
| 88 | + if (!is_null($username)) { |
|
| 89 | 89 | return $username; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | try { |
| 93 | 93 | $ldapRecord = $this->getLDAPUserByLoginName($loginName); |
| 94 | 94 | $user = $this->access->userManager->get($ldapRecord['dn'][0]); |
| 95 | - if($user instanceof OfflineUser) { |
|
| 95 | + if ($user instanceof OfflineUser) { |
|
| 96 | 96 | // this path is not really possible, however get() is documented |
| 97 | 97 | // to return User or OfflineUser so we are very defensive here. |
| 98 | 98 | $this->access->connection->writeToCache($cacheKey, false); |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | //find out dn of the user name |
| 129 | 129 | $attrs = $this->access->userManager->getAttributes(); |
| 130 | 130 | $users = $this->access->fetchUsersByLoginName($loginName, $attrs); |
| 131 | - if(count($users) < 1) { |
|
| 132 | - throw new NotOnLDAP('No user available for the given login name on ' . |
|
| 133 | - $this->access->connection->ldapHost . ':' . $this->access->connection->ldapPort); |
|
| 131 | + if (count($users) < 1) { |
|
| 132 | + throw new NotOnLDAP('No user available for the given login name on '. |
|
| 133 | + $this->access->connection->ldapHost.':'.$this->access->connection->ldapPort); |
|
| 134 | 134 | } |
| 135 | 135 | return $users[0]; |
| 136 | 136 | } |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | public function checkPassword($uid, $password) { |
| 146 | 146 | try { |
| 147 | 147 | $ldapRecord = $this->getLDAPUserByLoginName($uid); |
| 148 | - } catch(NotOnLDAP $e) { |
|
| 149 | - if($this->ocConfig->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
| 148 | + } catch (NotOnLDAP $e) { |
|
| 149 | + if ($this->ocConfig->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
| 150 | 150 | \OC::$server->getLogger()->logException($e, ['app' => 'user_ldap']); |
| 151 | 151 | } |
| 152 | 152 | return false; |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | $dn = $ldapRecord['dn'][0]; |
| 155 | 155 | $user = $this->access->userManager->get($dn); |
| 156 | 156 | |
| 157 | - if(!$user instanceof User) { |
|
| 157 | + if (!$user instanceof User) { |
|
| 158 | 158 | Util::writeLog('user_ldap', |
| 159 | - 'LDAP Login: Could not get user object for DN ' . $dn . |
|
| 159 | + 'LDAP Login: Could not get user object for DN '.$dn. |
|
| 160 | 160 | '. Maybe the LDAP entry has no set display name attribute?', |
| 161 | 161 | Util::WARN); |
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | - if($user->getUsername() !== false) { |
|
| 164 | + if ($user->getUsername() !== false) { |
|
| 165 | 165 | //are the credentials OK? |
| 166 | - if(!$this->access->areCredentialsValid($dn, $password)) { |
|
| 166 | + if (!$this->access->areCredentialsValid($dn, $password)) { |
|
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | public function setPassword($uid, $password) { |
| 187 | 187 | $user = $this->access->userManager->get($uid); |
| 188 | 188 | |
| 189 | - if(!$user instanceof User) { |
|
| 190 | - throw new \Exception('LDAP setPassword: Could not get user object for uid ' . $uid . |
|
| 189 | + if (!$user instanceof User) { |
|
| 190 | + throw new \Exception('LDAP setPassword: Could not get user object for uid '.$uid. |
|
| 191 | 191 | '. Maybe the LDAP entry has no set display name attribute?'); |
| 192 | 192 | } |
| 193 | - if($user->getUsername() !== false) { |
|
| 193 | + if ($user->getUsername() !== false) { |
|
| 194 | 194 | return $this->access->setPassword($user->getDN(), $password); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -211,18 +211,18 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | //check if users are cached, if so return |
| 213 | 213 | $ldap_users = $this->access->connection->getFromCache($cachekey); |
| 214 | - if(!is_null($ldap_users)) { |
|
| 214 | + if (!is_null($ldap_users)) { |
|
| 215 | 215 | return $ldap_users; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // if we'd pass -1 to LDAP search, we'd end up in a Protocol |
| 219 | 219 | // error. With a limit of 0, we get 0 results. So we pass null. |
| 220 | - if($limit <= 0) { |
|
| 220 | + if ($limit <= 0) { |
|
| 221 | 221 | $limit = null; |
| 222 | 222 | } |
| 223 | 223 | $filter = $this->access->combineFilterWithAnd(array( |
| 224 | 224 | $this->access->connection->ldapUserFilter, |
| 225 | - $this->access->connection->ldapUserDisplayName . '=*', |
|
| 225 | + $this->access->connection->ldapUserDisplayName.'=*', |
|
| 226 | 226 | $this->access->getFilterPartForUserSearch($search) |
| 227 | 227 | )); |
| 228 | 228 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $this->access->userManager->getAttributes(true), |
| 236 | 236 | $limit, $offset); |
| 237 | 237 | $ldap_users = $this->access->ownCloudUserNames($ldap_users); |
| 238 | - Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', Util::DEBUG); |
|
| 238 | + Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users).' Users found', Util::DEBUG); |
|
| 239 | 239 | |
| 240 | 240 | $this->access->connection->writeToCache($cachekey, $ldap_users); |
| 241 | 241 | return $ldap_users; |
@@ -251,29 +251,29 @@ discard block |
||
| 251 | 251 | * @throws \OC\ServerNotAvailableException |
| 252 | 252 | */ |
| 253 | 253 | public function userExistsOnLDAP($user) { |
| 254 | - if(is_string($user)) { |
|
| 254 | + if (is_string($user)) { |
|
| 255 | 255 | $user = $this->access->userManager->get($user); |
| 256 | 256 | } |
| 257 | - if(is_null($user)) { |
|
| 257 | + if (is_null($user)) { |
|
| 258 | 258 | return false; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $dn = $user->getDN(); |
| 262 | 262 | //check if user really still exists by reading its entry |
| 263 | - if(!is_array($this->access->readAttribute($dn, '', $this->access->connection->ldapUserFilter))) { |
|
| 263 | + if (!is_array($this->access->readAttribute($dn, '', $this->access->connection->ldapUserFilter))) { |
|
| 264 | 264 | $lcr = $this->access->connection->getConnectionResource(); |
| 265 | - if(is_null($lcr)) { |
|
| 266 | - throw new \Exception('No LDAP Connection to server ' . $this->access->connection->ldapHost); |
|
| 265 | + if (is_null($lcr)) { |
|
| 266 | + throw new \Exception('No LDAP Connection to server '.$this->access->connection->ldapHost); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | try { |
| 270 | 270 | $uuid = $this->access->getUserMapper()->getUUIDByDN($dn); |
| 271 | - if(!$uuid) { |
|
| 271 | + if (!$uuid) { |
|
| 272 | 272 | return false; |
| 273 | 273 | } |
| 274 | 274 | $newDn = $this->access->getUserDnByUuid($uuid); |
| 275 | 275 | //check if renamed user is still valid by reapplying the ldap filter |
| 276 | - if(!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { |
|
| 276 | + if (!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { |
|
| 277 | 277 | return false; |
| 278 | 278 | } |
| 279 | 279 | $this->access->getUserMapper()->setDNbyUUID($newDn, $uuid); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - if($user instanceof OfflineUser) { |
|
| 286 | + if ($user instanceof OfflineUser) { |
|
| 287 | 287 | $user->unmark(); |
| 288 | 288 | } |
| 289 | 289 | |
@@ -298,18 +298,18 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | public function userExists($uid) { |
| 300 | 300 | $userExists = $this->access->connection->getFromCache('userExists'.$uid); |
| 301 | - if(!is_null($userExists)) { |
|
| 302 | - return (bool)$userExists; |
|
| 301 | + if (!is_null($userExists)) { |
|
| 302 | + return (bool) $userExists; |
|
| 303 | 303 | } |
| 304 | 304 | //getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking. |
| 305 | 305 | $user = $this->access->userManager->get($uid); |
| 306 | 306 | |
| 307 | - if(is_null($user)) { |
|
| 307 | + if (is_null($user)) { |
|
| 308 | 308 | Util::writeLog('user_ldap', 'No DN found for '.$uid.' on '. |
| 309 | 309 | $this->access->connection->ldapHost, Util::DEBUG); |
| 310 | 310 | $this->access->connection->writeToCache('userExists'.$uid, false); |
| 311 | 311 | return false; |
| 312 | - } else if($user instanceof OfflineUser) { |
|
| 312 | + } else if ($user instanceof OfflineUser) { |
|
| 313 | 313 | //express check for users marked as deleted. Returning true is |
| 314 | 314 | //necessary for cleanup |
| 315 | 315 | return true; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $result = $this->userExistsOnLDAP($user); |
| 319 | 319 | $this->access->connection->writeToCache('userExists'.$uid, $result); |
| 320 | - if($result === true) { |
|
| 320 | + if ($result === true) { |
|
| 321 | 321 | $user->update(); |
| 322 | 322 | } |
| 323 | 323 | return $result; |
@@ -331,13 +331,13 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | public function deleteUser($uid) { |
| 333 | 333 | $marked = $this->ocConfig->getUserValue($uid, 'user_ldap', 'isDeleted', 0); |
| 334 | - if(intval($marked) === 0) { |
|
| 334 | + if (intval($marked) === 0) { |
|
| 335 | 335 | \OC::$server->getLogger()->notice( |
| 336 | - 'User '.$uid . ' is not marked as deleted, not cleaning up.', |
|
| 336 | + 'User '.$uid.' is not marked as deleted, not cleaning up.', |
|
| 337 | 337 | array('app' => 'user_ldap')); |
| 338 | 338 | return false; |
| 339 | 339 | } |
| 340 | - \OC::$server->getLogger()->info('Cleaning up after user ' . $uid, |
|
| 340 | + \OC::$server->getLogger()->info('Cleaning up after user '.$uid, |
|
| 341 | 341 | array('app' => 'user_ldap')); |
| 342 | 342 | |
| 343 | 343 | //Get Home Directory out of user preferences so we can return it later, |
@@ -358,27 +358,27 @@ discard block |
||
| 358 | 358 | * @throws \Exception |
| 359 | 359 | */ |
| 360 | 360 | public function getHome($uid) { |
| 361 | - if(isset($this->homesToKill[$uid]) && !empty($this->homesToKill[$uid])) { |
|
| 361 | + if (isset($this->homesToKill[$uid]) && !empty($this->homesToKill[$uid])) { |
|
| 362 | 362 | //a deleted user who needs some clean up |
| 363 | 363 | return $this->homesToKill[$uid]; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // user Exists check required as it is not done in user proxy! |
| 367 | - if(!$this->userExists($uid)) { |
|
| 367 | + if (!$this->userExists($uid)) { |
|
| 368 | 368 | return false; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $cacheKey = 'getHome'.$uid; |
| 372 | 372 | $path = $this->access->connection->getFromCache($cacheKey); |
| 373 | - if(!is_null($path)) { |
|
| 373 | + if (!is_null($path)) { |
|
| 374 | 374 | return $path; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | $user = $this->access->userManager->get($uid); |
| 378 | - if(is_null($user) || ($user instanceof OfflineUser && !$this->userExistsOnLDAP($user->getOCName()))) { |
|
| 379 | - throw new NoUserException($uid . ' is not a valid user anymore'); |
|
| 378 | + if (is_null($user) || ($user instanceof OfflineUser && !$this->userExistsOnLDAP($user->getOCName()))) { |
|
| 379 | + throw new NoUserException($uid.' is not a valid user anymore'); |
|
| 380 | 380 | } |
| 381 | - if($user instanceof OfflineUser) { |
|
| 381 | + if ($user instanceof OfflineUser) { |
|
| 382 | 382 | // apparently this user survived the userExistsOnLDAP check, |
| 383 | 383 | // we request the user instance again in order to retrieve a User |
| 384 | 384 | // instance instead |
@@ -396,12 +396,12 @@ discard block |
||
| 396 | 396 | * @return string|false display name |
| 397 | 397 | */ |
| 398 | 398 | public function getDisplayName($uid) { |
| 399 | - if(!$this->userExists($uid)) { |
|
| 399 | + if (!$this->userExists($uid)) { |
|
| 400 | 400 | return false; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | $cacheKey = 'getDisplayName'.$uid; |
| 404 | - if(!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) { |
|
| 404 | + if (!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) { |
|
| 405 | 405 | return $displayName; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -418,10 +418,10 @@ discard block |
||
| 418 | 418 | $this->access->username2dn($uid), |
| 419 | 419 | $this->access->connection->ldapUserDisplayName); |
| 420 | 420 | |
| 421 | - if($displayName && (count($displayName) > 0)) { |
|
| 421 | + if ($displayName && (count($displayName) > 0)) { |
|
| 422 | 422 | $displayName = $displayName[0]; |
| 423 | 423 | |
| 424 | - if (is_array($displayName2)){ |
|
| 424 | + if (is_array($displayName2)) { |
|
| 425 | 425 | $displayName2 = count($displayName2) > 0 ? $displayName2[0] : ''; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function getDisplayNames($search = '', $limit = null, $offset = null) { |
| 452 | 452 | $cacheKey = 'getDisplayNames-'.$search.'-'.$limit.'-'.$offset; |
| 453 | - if(!is_null($displayNames = $this->access->connection->getFromCache($cacheKey))) { |
|
| 453 | + if (!is_null($displayNames = $this->access->connection->getFromCache($cacheKey))) { |
|
| 454 | 454 | return $displayNames; |
| 455 | 455 | } |
| 456 | 456 | |
@@ -472,12 +472,12 @@ discard block |
||
| 472 | 472 | * compared with OC_USER_BACKEND_CREATE_USER etc. |
| 473 | 473 | */ |
| 474 | 474 | public function implementsActions($actions) { |
| 475 | - return (bool)((Backend::CHECK_PASSWORD |
|
| 475 | + return (bool) ((Backend::CHECK_PASSWORD |
|
| 476 | 476 | | Backend::GET_HOME |
| 477 | 477 | | Backend::GET_DISPLAYNAME |
| 478 | 478 | | Backend::PROVIDE_AVATAR |
| 479 | 479 | | Backend::COUNT_USERS |
| 480 | - | ((intval($this->access->connection->turnOnPasswordChange) === 1)?(Backend::SET_PASSWORD):0)) |
|
| 480 | + | ((intval($this->access->connection->turnOnPasswordChange) === 1) ? (Backend::SET_PASSWORD) : 0)) |
|
| 481 | 481 | & $actions); |
| 482 | 482 | } |
| 483 | 483 | |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | public function countUsers() { |
| 497 | 497 | $filter = $this->access->getFilterForUserCount(); |
| 498 | 498 | $cacheKey = 'countUsers-'.$filter; |
| 499 | - if(!is_null($entries = $this->access->connection->getFromCache($cacheKey))) { |
|
| 499 | + if (!is_null($entries = $this->access->connection->getFromCache($cacheKey))) { |
|
| 500 | 500 | return $entries; |
| 501 | 501 | } |
| 502 | 502 | $entries = $this->access->countUsers($filter); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * Backend name to be shown in user management |
| 509 | 509 | * @return string the name of the backend to be shown |
| 510 | 510 | */ |
| 511 | - public function getBackendName(){ |
|
| 511 | + public function getBackendName() { |
|
| 512 | 512 | return 'LDAP'; |
| 513 | 513 | } |
| 514 | 514 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $application->registerRoutes($this, [ |
| 42 | 42 | 'ocs' => [ |
| 43 | 43 | ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
| 44 | - ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
| 44 | + ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
| 45 | 45 | ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
| 46 | 46 | ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
| 47 | 47 | ] |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | */ |
| 24 | 24 | $state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet'); |
| 25 | -if($state === 'doSet') { |
|
| 25 | +if ($state === 'doSet') { |
|
| 26 | 26 | OCP\Config::setSystemValue('ldapIgnoreNamingRules', false); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | <div id="emptycontent" class="hidden"> |
| 8 | 8 | <div class="icon-external"></div> |
| 9 | 9 | <h2><?php p($l->t('No external storage configured')); ?></h2> |
| 10 | - <p><a href="<?php p(link_to('', 'index.php/settings/personal#files_external' )); ?>"><?php p($l->t('You can add external storages in the personal settings')); ?></a></p> |
|
| 10 | + <p><a href="<?php p(link_to('', 'index.php/settings/personal#files_external')); ?>"><?php p($l->t('You can add external storages in the personal settings')); ?></a></p> |
|
| 11 | 11 | </div> |
| 12 | 12 | |
| 13 | 13 | <input type="hidden" name="dir" value="" id="dir"> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <tr> |
| 18 | 18 | <th id='headerName' class="hidden column-name"> |
| 19 | 19 | <div id="headerName-container"> |
| 20 | - <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a> |
|
| 20 | + <a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a> |
|
| 21 | 21 | </div> |
| 22 | 22 | </th> |
| 23 | 23 | <th id="headerBackend" class="hidden column-backend"> |
@@ -87,9 +87,9 @@ |
||
| 87 | 87 | } |
| 88 | 88 | ?> |
| 89 | 89 | |
| 90 | -<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
|
| 90 | +<form data-can-create="<?php echo $canCreateMounts ? 'true' : 'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled'] ? 'true' : 'false'; ?>"> |
|
| 91 | 91 | <h2><?php p($l->t('External storage')); ?></h2> |
| 92 | - <?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
| 92 | + <?php if (isset($_['dependencies']) and ($_['dependencies'] <> '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
| 93 | 93 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
| 94 | 94 | <thead> |
| 95 | 95 | <tr> |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
| 25 | 25 | * |
| 26 | 26 | */ |
| 27 | -require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php'; |
|
| 27 | +require_once __DIR__.'/../3rdparty/Dropbox/autoload.php'; |
|
| 28 | 28 | |
| 29 | 29 | OCP\JSON::checkAppEnabled('files_external'); |
| 30 | 30 | OCP\JSON::checkLoggedIn(); |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // FIXME: currently hard-coded to Dropbox OAuth |
| 35 | 35 | if (isset($_POST['app_key']) && isset($_POST['app_secret'])) { |
| 36 | - $oauth = new Dropbox_OAuth_Curl((string)$_POST['app_key'], (string)$_POST['app_secret']); |
|
| 36 | + $oauth = new Dropbox_OAuth_Curl((string) $_POST['app_key'], (string) $_POST['app_secret']); |
|
| 37 | 37 | if (isset($_POST['step'])) { |
| 38 | 38 | switch ($_POST['step']) { |
| 39 | 39 | case 1: |
| 40 | 40 | try { |
| 41 | 41 | if (isset($_POST['callback'])) { |
| 42 | - $callback = (string)$_POST['callback']; |
|
| 42 | + $callback = (string) $_POST['callback']; |
|
| 43 | 43 | } else { |
| 44 | 44 | $callback = null; |
| 45 | 45 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | case 2: |
| 57 | 57 | if (isset($_POST['request_token']) && isset($_POST['request_token_secret'])) { |
| 58 | 58 | try { |
| 59 | - $oauth->setToken((string)$_POST['request_token'], (string)$_POST['request_token_secret']); |
|
| 59 | + $oauth->setToken((string) $_POST['request_token'], (string) $_POST['request_token_secret']); |
|
| 60 | 60 | $token = $oauth->getAccessToken(); |
| 61 | 61 | OCP\JSON::success(array('access_token' => $token['token'], |
| 62 | 62 | 'access_token_secret' => $token['token_secret'])); |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | // FIXME: currently hard-coded to Google Drive |
| 40 | 40 | if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) { |
| 41 | 41 | $client = new Google_Client(); |
| 42 | - $client->setClientId((string)$_POST['client_id']); |
|
| 43 | - $client->setClientSecret((string)$_POST['client_secret']); |
|
| 44 | - $client->setRedirectUri((string)$_POST['redirect']); |
|
| 42 | + $client->setClientId((string) $_POST['client_id']); |
|
| 43 | + $client->setClientSecret((string) $_POST['client_secret']); |
|
| 44 | + $client->setRedirectUri((string) $_POST['redirect']); |
|
| 45 | 45 | $client->setScopes(array('https://www.googleapis.com/auth/drive')); |
| 46 | 46 | $client->setApprovalPrompt('force'); |
| 47 | 47 | $client->setAccessType('offline'); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | } else if ($step == 2 && isset($_POST['code'])) { |
| 62 | 62 | try { |
| 63 | - $token = $client->authenticate((string)$_POST['code']); |
|
| 63 | + $token = $client->authenticate((string) $_POST['code']); |
|
| 64 | 64 | OCP\JSON::success(array('data' => array( |
| 65 | 65 | 'token' => $token |
| 66 | 66 | ))); |
@@ -30,13 +30,13 @@ |
||
| 30 | 30 | $limit = null; |
| 31 | 31 | $offset = null; |
| 32 | 32 | if (isset($_GET['pattern'])) { |
| 33 | - $pattern = (string)$_GET['pattern']; |
|
| 33 | + $pattern = (string) $_GET['pattern']; |
|
| 34 | 34 | } |
| 35 | 35 | if (isset($_GET['limit'])) { |
| 36 | - $limit = (int)$_GET['limit']; |
|
| 36 | + $limit = (int) $_GET['limit']; |
|
| 37 | 37 | } |
| 38 | 38 | if (isset($_GET['offset'])) { |
| 39 | - $offset = (int)$_GET['offset']; |
|
| 39 | + $offset = (int) $_GET['offset']; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $groups = []; |