@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\Files_Versions\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\Files_Versions\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | |
38 | 38 | public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) { |
39 | 39 | $type = $type->getLabel(); |
40 | - if(!isset($this->result[$type])) { |
|
40 | + if (!isset($this->result[$type])) { |
|
41 | 41 | $this->result[$type] = []; |
42 | 42 | $this->result['exact'][$type] = []; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $this->result[$type] = array_merge($this->result[$type], $matches); |
46 | - if(is_array($exactMatches)) { |
|
46 | + if (is_array($exactMatches)) { |
|
47 | 47 | $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches); |
48 | 48 | } |
49 | 49 | } |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | |
59 | 59 | public function hasResult(SearchResultType $type, $collaboratorId) { |
60 | 60 | $type = $type->getLabel(); |
61 | - if(!isset($this->result[$type])) { |
|
61 | + if (!isset($this->result[$type])) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
65 | 65 | $resultArrays = [$this->result['exact'][$type], $this->result[$type]]; |
66 | - foreach($resultArrays as $resultArray) { |
|
66 | + foreach ($resultArrays as $resultArray) { |
|
67 | 67 | foreach ($resultArray as $result) { |
68 | 68 | if ($result['value']['shareWith'] === $collaboratorId) { |
69 | 69 | return true; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function unsetResult(SearchResultType $type) { |
82 | 82 | $type = $type->getLabel(); |
83 | 83 | $this->result[$type] = []; |
84 | - if(isset($this->result['exact'][$type])) { |
|
84 | + if (isset($this->result['exact'][$type])) { |
|
85 | 85 | $this->result['exact'][$type] = []; |
86 | 86 | } |
87 | 87 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); |
40 | 40 | $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
41 | -if(count($configPrefixes) > 0) { |
|
41 | +if (count($configPrefixes) > 0) { |
|
42 | 42 | $ldapWrapper = new OCA\User_LDAP\LDAP(); |
43 | 43 | $ocConfig = \OC::$server->getConfig(); |
44 | 44 | $notificationManager = \OC::$server->getNotificationManager(); |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | $userPluginManager = \OC::$server->query('LDAPUserPluginManager'); |
59 | 59 | $groupPluginManager = \OC::$server->query('LDAPGroupPluginManager'); |
60 | 60 | |
61 | - $userBackend = new OCA\User_LDAP\User_Proxy( |
|
61 | + $userBackend = new OCA\User_LDAP\User_Proxy( |
|
62 | 62 | $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager |
63 | 63 | ); |
64 | - $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager); |
|
64 | + $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager); |
|
65 | 65 | // register user backend |
66 | 66 | OC_User::useBackend($userBackend); |
67 | 67 |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | INotificationManager $notificationManager, IUserSession $userSession, |
54 | 54 | UserPluginManager $userPluginManager) { |
55 | 55 | parent::__construct($ldap); |
56 | - foreach($serverConfigPrefixes as $configPrefix) { |
|
56 | + foreach ($serverConfigPrefixes as $configPrefix) { |
|
57 | 57 | $this->backends[$configPrefix] = |
58 | 58 | new User_LDAP($this->getAccess($configPrefix), $ocConfig, $notificationManager, $userSession, $userPluginManager); |
59 | 59 | |
60 | - if(is_null($this->refBackend)) { |
|
60 | + if (is_null($this->refBackend)) { |
|
61 | 61 | $this->refBackend = &$this->backends[$configPrefix]; |
62 | 62 | } |
63 | 63 | } |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function walkBackends($uid, $method, $parameters) { |
74 | 74 | $cacheKey = $this->getUserCacheKey($uid); |
75 | - foreach($this->backends as $configPrefix => $backend) { |
|
75 | + foreach ($this->backends as $configPrefix => $backend) { |
|
76 | 76 | $instance = $backend; |
77 | - if(!method_exists($instance, $method) |
|
77 | + if (!method_exists($instance, $method) |
|
78 | 78 | && method_exists($this->getAccess($configPrefix), $method)) { |
79 | 79 | $instance = $this->getAccess($configPrefix); |
80 | 80 | } |
81 | - if($result = call_user_func_array(array($instance, $method), $parameters)) { |
|
81 | + if ($result = call_user_func_array(array($instance, $method), $parameters)) { |
|
82 | 82 | $this->writeToCache($cacheKey, $configPrefix); |
83 | 83 | return $result; |
84 | 84 | } |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | $cacheKey = $this->getUserCacheKey($uid); |
99 | 99 | $prefix = $this->getFromCache($cacheKey); |
100 | 100 | //in case the uid has been found in the past, try this stored connection first |
101 | - if(!is_null($prefix)) { |
|
102 | - if(isset($this->backends[$prefix])) { |
|
101 | + if (!is_null($prefix)) { |
|
102 | + if (isset($this->backends[$prefix])) { |
|
103 | 103 | $instance = $this->backends[$prefix]; |
104 | - if(!method_exists($instance, $method) |
|
104 | + if (!method_exists($instance, $method) |
|
105 | 105 | && method_exists($this->getAccess($prefix), $method)) { |
106 | 106 | $instance = $this->getAccess($prefix); |
107 | 107 | } |
108 | 108 | $result = call_user_func_array(array($instance, $method), $parameters); |
109 | - if($result === $passOnWhen) { |
|
109 | + if ($result === $passOnWhen) { |
|
110 | 110 | //not found here, reset cache to null if user vanished |
111 | 111 | //because sometimes methods return false with a reason |
112 | 112 | $userExists = call_user_func_array( |
113 | 113 | array($this->backends[$prefix], 'userExists'), |
114 | 114 | array($uid) |
115 | 115 | ); |
116 | - if(!$userExists) { |
|
116 | + if (!$userExists) { |
|
117 | 117 | $this->writeToCache($cacheKey, null); |
118 | 118 | } |
119 | 119 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function getUsers($search = '', $limit = 10, $offset = 0) { |
156 | 156 | //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends |
157 | 157 | $users = array(); |
158 | - foreach($this->backends as $backend) { |
|
158 | + foreach ($this->backends as $backend) { |
|
159 | 159 | $backendUsers = $backend->getUsers($search, $limit, $offset); |
160 | 160 | if (is_array($backendUsers)) { |
161 | 161 | $users = array_merge($users, $backendUsers); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string|false |
204 | 204 | */ |
205 | 205 | public function loginName2UserName($loginName) { |
206 | - $id = 'LOGINNAME,' . $loginName; |
|
206 | + $id = 'LOGINNAME,'.$loginName; |
|
207 | 207 | return $this->handleRequest($id, 'loginName2UserName', array($loginName)); |
208 | 208 | } |
209 | 209 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return string|false with the username |
215 | 215 | */ |
216 | 216 | public function dn2UserName($dn) { |
217 | - $id = 'DN,' . $dn; |
|
217 | + $id = 'DN,'.$dn; |
|
218 | 218 | return $this->handleRequest($id, 'dn2UserName', array($dn)); |
219 | 219 | } |
220 | 220 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | public function getDisplayNames($search = '', $limit = null, $offset = null) { |
267 | 267 | //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends |
268 | 268 | $users = array(); |
269 | - foreach($this->backends as $backend) { |
|
269 | + foreach ($this->backends as $backend) { |
|
270 | 270 | $backendUsers = $backend->getDisplayNames($search, $limit, $offset); |
271 | 271 | if (is_array($backendUsers)) { |
272 | 272 | $users = $users + $backendUsers; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function countUsers() { |
312 | 312 | $users = false; |
313 | - foreach($this->backends as $backend) { |
|
313 | + foreach ($this->backends as $backend) { |
|
314 | 314 | $backendUsers = $backend->countUsers(); |
315 | 315 | if ($backendUsers !== false) { |
316 | 316 | $users += $backendUsers; |
@@ -345,6 +345,6 @@ discard block |
||
345 | 345 | * @return bool |
346 | 346 | */ |
347 | 347 | public function createUser($username, $password) { |
348 | - return $this->handleRequest($username, 'createUser', array($username,$password)); |
|
348 | + return $this->handleRequest($username, 'createUser', array($username, $password)); |
|
349 | 349 | } |
350 | 350 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | public function extend(array $settings) { |
38 | 38 | $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
39 | 39 | |
40 | - $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
40 | + $value = (int) $this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
41 | 41 | $appConfig['comments']['maxAutoCompleteResults'] = $value; |
42 | 42 | |
43 | 43 | $settings['array']['oc_appconfig'] = json_encode($appConfig); |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | public function sort(array &$sortArray, array $context) { |
54 | 54 | // let's be tolerant. Comments uses "files" by default, other usages are often singular |
55 | - if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
55 | + if ($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | $user = $this->userSession->getUser(); |
59 | - if($user === null) { |
|
59 | + if ($user === null) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
63 | 63 | /** @var Node[] $nodes */ |
64 | - $nodes = $userFolder->getById((int)$context['itemId']); |
|
65 | - if(count($nodes) === 0) { |
|
64 | + $nodes = $userFolder->getById((int) $context['itemId']); |
|
65 | + if (count($nodes) === 0) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | $al = $this->shareManager->getAccessList($nodes[0]); |
69 | 69 | |
70 | 70 | foreach ($sortArray as $type => &$byType) { |
71 | - if(!isset($al[$type]) || !is_array($al[$type])) { |
|
71 | + if (!isset($al[$type]) || !is_array($al[$type])) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | return [$i++, $element]; |
80 | 80 | }, $byType); |
81 | 81 | |
82 | - usort($workArray, function ($a, $b) use ($al, $type) { |
|
82 | + usort($workArray, function($a, $b) use ($al, $type) { |
|
83 | 83 | $result = $this->compare($a[1], $b[1], $al[$type]); |
84 | - if($result === 0) { |
|
84 | + if ($result === 0) { |
|
85 | 85 | $result = $a[0] - $b[0]; |
86 | 86 | } |
87 | 87 | return $result; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | $a = $a['value']['shareWith']; |
103 | 103 | $b = $b['value']['shareWith']; |
104 | 104 | |
105 | - $valueA = (int)in_array($a, $al, true); |
|
106 | - $valueB = (int)in_array($b, $al, true); |
|
105 | + $valueA = (int) in_array($a, $al, true); |
|
106 | + $valueB = (int) in_array($b, $al, true); |
|
107 | 107 | |
108 | 108 | return $valueB - $valueA; |
109 | 109 | } |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function sort(array &$sortArray, array $context) { |
51 | 51 | $commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']); |
52 | - if(count($commenters) === 0) { |
|
52 | + if (count($commenters) === 0) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | 56 | foreach ($sortArray as $type => &$byType) { |
57 | - if(!isset($commenters[$type])) { |
|
57 | + if (!isset($commenters[$type])) { |
|
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | return [$i++, $element]; |
66 | 66 | }, $byType); |
67 | 67 | |
68 | - usort($workArray, function ($a, $b) use ($commenters, $type) { |
|
68 | + usort($workArray, function($a, $b) use ($commenters, $type) { |
|
69 | 69 | $r = $this->compare($a[1], $b[1], $commenters[$type]); |
70 | - if($r === 0) { |
|
70 | + if ($r === 0) { |
|
71 | 71 | $r = $a[0] - $b[0]; |
72 | 72 | } |
73 | 73 | return $r; |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function retrieveCommentsInformation($type, $id) { |
87 | 87 | $comments = $this->commentsManager->getForObject($type, $id); |
88 | - if(count($comments) === 0) { |
|
88 | + if (count($comments) === 0) { |
|
89 | 89 | return []; |
90 | 90 | } |
91 | 91 | |
92 | 92 | $actors = []; |
93 | 93 | foreach ($comments as $comment) { |
94 | - if(!isset($actors[$comment->getActorType()])) { |
|
94 | + if (!isset($actors[$comment->getActorType()])) { |
|
95 | 95 | $actors[$comment->getActorType()] = []; |
96 | 96 | } |
97 | - if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
97 | + if (!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
98 | 98 | $actors[$comment->getActorType()][$comment->getActorId()] = 1; |
99 | 99 | } else { |
100 | 100 | $actors[$comment->getActorType()][$comment->getActorId()]++; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $column->changedProperties = array_diff($column->changedProperties, ['autoincrement', 'unsigned']); |
155 | 155 | } |
156 | 156 | // remove columns that no longer have changed (because autoincrement and unsigned are not supported) |
157 | - $tableDiff->changedColumns = array_filter($tableDiff->changedColumns, function (ColumnDiff $column) { |
|
157 | + $tableDiff->changedColumns = array_filter($tableDiff->changedColumns, function(ColumnDiff $column) { |
|
158 | 158 | return count($column->changedProperties) > 0; |
159 | 159 | }); |
160 | 160 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | */ |
205 | 205 | protected function generateTemporaryTableName($name) { |
206 | - return 'oc_' . uniqid(); |
|
206 | + return 'oc_'.uniqid(); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function convertStatementToScript($statement) { |
214 | 214 | if (substr($statement, -1) === ';') { |
215 | - return $statement . PHP_EOL . '/' . PHP_EOL; |
|
215 | + return $statement.PHP_EOL.'/'.PHP_EOL; |
|
216 | 216 | } |
217 | - $script = $statement . ';'; |
|
217 | + $script = $statement.';'; |
|
218 | 218 | $script .= PHP_EOL; |
219 | 219 | $script .= PHP_EOL; |
220 | 220 | return $script; |
221 | 221 | } |
222 | 222 | |
223 | 223 | protected function getFilterExpression() { |
224 | - return '/^"' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; |
|
224 | + return '/^"'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/'; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function updateMimetypes($updatedMimetypes) { |
90 | 90 | if (empty($this->folderMimeTypeId)) { |
91 | 91 | $result = \OC_DB::executeAudited(self::getIdStmt(), array('httpd/unix-directory')); |
92 | - $this->folderMimeTypeId = (int)$result->fetchOne(); |
|
92 | + $this->folderMimeTypeId = (int) $result->fetchOne(); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $count = 0; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $mimetypeId = $result->fetchOne(); |
108 | 108 | |
109 | 109 | // change mimetype for files with x extension |
110 | - $count += \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.' . $extension)); |
|
110 | + $count += \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.'.$extension)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $count; |