@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->output = $output; |
87 | 87 | |
88 | 88 | if ($user !== '' && $this->userManager->userExists($user) === false) { |
89 | - $this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again'); |
|
89 | + $this->output->writeln('User "'.$user.'" does not exist. Please check the username and try again'); |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $this->output->writeln('Files for following users couldn\'t be decrypted, '); |
105 | 105 | $this->output->writeln('maybe the user is not set up in a way that supports this operation: '); |
106 | 106 | foreach ($this->failed as $uid => $paths) { |
107 | - $this->output->writeln(' ' . $uid); |
|
107 | + $this->output->writeln(' '.$uid); |
|
108 | 108 | foreach ($paths as $path) { |
109 | - $this->output->writeln(' ' . $path); |
|
109 | + $this->output->writeln(' '.$path); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | $this->output->writeln(''); |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | /** @var IEncryptionModule $module */ |
129 | 129 | $module = call_user_func($moduleDesc['callback']); |
130 | 130 | $this->output->writeln(''); |
131 | - $this->output->writeln('Prepare "' . $module->getDisplayName() . '"'); |
|
131 | + $this->output->writeln('Prepare "'.$module->getDisplayName().'"'); |
|
132 | 132 | $this->output->writeln(''); |
133 | 133 | if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) { |
134 | - $this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!'); |
|
134 | + $this->output->writeln('Module "'.$moduleDesc['displayName'].'" does not support the functionality to decrypt all files again or the initialization of the module failed!'); |
|
135 | 135 | return false; |
136 | 136 | } |
137 | 137 | } |
@@ -209,16 +209,16 @@ discard block |
||
209 | 209 | |
210 | 210 | $this->setupUserFS($uid); |
211 | 211 | $directories = array(); |
212 | - $directories[] = '/' . $uid . '/files'; |
|
212 | + $directories[] = '/'.$uid.'/files'; |
|
213 | 213 | |
214 | 214 | while ($root = array_pop($directories)) { |
215 | 215 | $content = $this->rootView->getDirectoryContent($root); |
216 | 216 | foreach ($content as $file) { |
217 | 217 | // only decrypt files owned by the user |
218 | - if($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { |
|
218 | + if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { |
|
219 | 219 | continue; |
220 | 220 | } |
221 | - $path = $root . '/' . $file['name']; |
|
221 | + $path = $root.'/'.$file['name']; |
|
222 | 222 | if ($this->rootView->is_dir($path)) { |
223 | 223 | $directories[] = $path; |
224 | 224 | continue; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | $source = $path; |
265 | - $target = $path . '.decrypted.' . $this->getTimestamp(); |
|
265 | + $target = $path.'.decrypted.'.$this->getTimestamp(); |
|
266 | 266 | |
267 | 267 | try { |
268 | 268 | $this->rootView->copy($source, $target); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | */ |
31 | 31 | |
32 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
32 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
33 | 33 | |
34 | 34 | use OC\Console\Application; |
35 | 35 | use Symfony\Component\Console\Input\ArgvInput; |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | define('OC_CONSOLE', 1); |
39 | 39 | |
40 | 40 | function exceptionHandler($exception) { |
41 | - echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
41 | + echo "An unhandled exception has been thrown:".PHP_EOL; |
|
42 | 42 | echo $exception; |
43 | 43 | exit(1); |
44 | 44 | } |
45 | 45 | try { |
46 | - require_once __DIR__ . '/lib/base.php'; |
|
46 | + require_once __DIR__.'/lib/base.php'; |
|
47 | 47 | |
48 | 48 | // set to run indefinitely if needed |
49 | 49 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
@@ -51,39 +51,39 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | if (!OC::$CLI) { |
54 | - echo "This script can be run from the command line only" . PHP_EOL; |
|
54 | + echo "This script can be run from the command line only".PHP_EOL; |
|
55 | 55 | exit(1); |
56 | 56 | } |
57 | 57 | |
58 | 58 | set_exception_handler('exceptionHandler'); |
59 | 59 | |
60 | 60 | if (!function_exists('posix_getuid')) { |
61 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
61 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php".PHP_EOL; |
|
62 | 62 | exit(1); |
63 | 63 | } |
64 | 64 | $user = posix_getpwuid(posix_getuid()); |
65 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
65 | + $configUser = posix_getpwuid(fileowner(OC::$configDir.'config.php')); |
|
66 | 66 | if ($user['name'] !== $configUser['name']) { |
67 | - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
68 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
69 | - echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
70 | - echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
71 | - echo "If running with 'docker exec' try adding the option '-u " . $configUser['name'] . "' to the docker command (without the single quotes)" . PHP_EOL; |
|
67 | + echo "Console has to be executed with the user that owns the file config/config.php".PHP_EOL; |
|
68 | + echo "Current user: ".$user['name'].PHP_EOL; |
|
69 | + echo "Owner of config.php: ".$configUser['name'].PHP_EOL; |
|
70 | + echo "Try adding 'sudo -u ".$configUser['name']." ' to the beginning of the command (without the single quotes)".PHP_EOL; |
|
71 | + echo "If running with 'docker exec' try adding the option '-u ".$configUser['name']."' to the docker command (without the single quotes)".PHP_EOL; |
|
72 | 72 | exit(1); |
73 | 73 | } |
74 | 74 | |
75 | 75 | $oldWorkingDir = getcwd(); |
76 | 76 | if ($oldWorkingDir === false) { |
77 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
78 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
77 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
78 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact.".PHP_EOL; |
|
79 | 79 | } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
80 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
81 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
80 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
81 | + echo "Can't change to Nextcloud root directory.".PHP_EOL; |
|
82 | 82 | exit(1); |
83 | 83 | } |
84 | 84 | |
85 | 85 | if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
86 | - echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
86 | + echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php".PHP_EOL; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $application = new Application( |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | * |
29 | 29 | */ |
30 | 30 | |
31 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
31 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
32 | 32 | |
33 | 33 | try { |
34 | 34 | |
35 | - require_once __DIR__ . '/lib/base.php'; |
|
35 | + require_once __DIR__.'/lib/base.php'; |
|
36 | 36 | if (\OCP\Util::needUpgrade()) { |
37 | 37 | // since the behavior of apps or remotes are unpredictable during |
38 | 38 | // an upgrade, return a 503 directly |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $pathInfo = trim($pathInfo, '/'); |
54 | 54 | list($service) = explode('/', $pathInfo); |
55 | 55 | } |
56 | - $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
56 | + $file = \OC::$server->getConfig()->getAppValue('core', 'public_'.strip_tags($service)); |
|
57 | 57 | if ($file === '') { |
58 | 58 | http_response_code(404); |
59 | 59 | exit; |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | OC_App::loadApp($app); |
75 | 75 | OC_User::setIncognitoMode(true); |
76 | 76 | |
77 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
77 | + $baseuri = OC::$WEBROOT.'/public.php/'.$service.'/'; |
|
78 | 78 | |
79 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
79 | + require_once OC_App::getAppPath($app).'/'.$parts[1]; |
|
80 | 80 | |
81 | 81 | } catch (Exception $ex) { |
82 | 82 | $status = 500; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <h2><?php p($l->t('Connect to your account')) ?></h2> |
32 | 32 | <p class="info"> |
33 | 33 | <?php print_unescaped($l->t('Please log in before granting %1$s access to your %2$s account.', [ |
34 | - '<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>', |
|
34 | + '<strong>'.\OCP\Util::sanitizeHTML($_['client']).'</strong>', |
|
35 | 35 | \OCP\Util::sanitizeHTML($_['instanceName']) |
36 | 36 | ])) ?> |
37 | 37 | </p> |
@@ -59,6 +59,6 @@ discard block |
||
59 | 59 | </form> |
60 | 60 | </div> |
61 | 61 | |
62 | -<?php if(empty($_['oauthState'])): ?> |
|
62 | +<?php if (empty($_['oauthState'])): ?> |
|
63 | 63 | <a id="app-token-login" class="warning" href="#"><?php p($l->t('Alternative log in using app token')) ?></a> |
64 | 64 | <?php endif; ?> |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | private function isValidToken($stateToken) { |
126 | 126 | $currentToken = $this->session->get(self::stateName); |
127 | - if(!is_string($stateToken) || !is_string($currentToken)) { |
|
127 | + if (!is_string($stateToken) || !is_string($currentToken)) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | return hash_equals($currentToken, $stateToken); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | public function showAuthPickerPage($clientIdentifier = '') { |
159 | 159 | $clientName = $this->getClientName(); |
160 | 160 | $client = null; |
161 | - if($clientIdentifier !== '') { |
|
161 | + if ($clientIdentifier !== '') { |
|
162 | 162 | $client = $this->clientMapper->getByIdentifier($clientIdentifier); |
163 | 163 | $clientName = $client->getName(); |
164 | 164 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function grantPage($stateToken = '', |
218 | 218 | $clientIdentifier = '') { |
219 | - if(!$this->isValidToken($stateToken)) { |
|
219 | + if (!$this->isValidToken($stateToken)) { |
|
220 | 220 | return $this->stateTokenForbiddenResponse(); |
221 | 221 | } |
222 | 222 | |
223 | 223 | $clientName = $this->getClientName(); |
224 | 224 | $client = null; |
225 | - if($clientIdentifier !== '') { |
|
225 | + if ($clientIdentifier !== '') { |
|
226 | 226 | $client = $this->clientMapper->getByIdentifier($clientIdentifier); |
227 | 227 | $clientName = $client->getName(); |
228 | 228 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function generateAppPassword($stateToken, |
255 | 255 | $clientIdentifier = '') { |
256 | - if(!$this->isValidToken($stateToken)) { |
|
256 | + if (!$this->isValidToken($stateToken)) { |
|
257 | 257 | $this->session->remove(self::stateName); |
258 | 258 | return $this->stateTokenForbiddenResponse(); |
259 | 259 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $clientName = $this->getClientName(); |
286 | 286 | $client = false; |
287 | - if($clientIdentifier !== '') { |
|
287 | + if ($clientIdentifier !== '') { |
|
288 | 288 | $client = $this->clientMapper->getByIdentifier($clientIdentifier); |
289 | 289 | $clientName = $client->getName(); |
290 | 290 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | IToken::DO_NOT_REMEMBER |
302 | 302 | ); |
303 | 303 | |
304 | - if($client) { |
|
304 | + if ($client) { |
|
305 | 305 | $code = $this->random->generate(128, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
306 | 306 | $accessToken = new AccessToken(); |
307 | 307 | $accessToken->setClientId($client->getId()); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | ); |
319 | 319 | $this->session->remove('oauth.state'); |
320 | 320 | } else { |
321 | - $redirectUri = 'nc://login/server:' . $this->getServerPath() . '&user:' . urlencode($loginName) . '&password:' . urlencode($token); |
|
321 | + $redirectUri = 'nc://login/server:'.$this->getServerPath().'&user:'.urlencode($loginName).'&password:'.urlencode($token); |
|
322 | 322 | |
323 | 323 | // Clear the token from the login here |
324 | 324 | $this->tokenProvider->invalidateToken($sessionId); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | return $this->stateTokenForbiddenResponse(); |
336 | 336 | } |
337 | 337 | |
338 | - $redirectUri = 'nc://login/server:' . $this->getServerPath() . '&user:' . urlencode($user) . '&password:' . urlencode($password); |
|
338 | + $redirectUri = 'nc://login/server:'.$this->getServerPath().'&user:'.urlencode($user).'&password:'.urlencode($password); |
|
339 | 339 | return new Http\RedirectResponse($redirectUri); |
340 | 340 | } |
341 | 341 | |
@@ -358,6 +358,6 @@ discard block |
||
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
361 | - return $protocol . "://" . $this->request->getServerHost() . $serverPostfix; |
|
361 | + return $protocol."://".$this->request->getServerHost().$serverPostfix; |
|
362 | 362 | } |
363 | 363 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'user_ldap', 'isDeleted', '1'); |
72 | 72 | |
73 | 73 | $userObjects = []; |
74 | - foreach($deletedUsers as $user) { |
|
74 | + foreach ($deletedUsers as $user) { |
|
75 | 75 | $userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping); |
76 | 76 | } |
77 | 77 | $this->deletedUsers = $userObjects; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return \OCA\User_LDAP\User\OfflineUser[] |
85 | 85 | */ |
86 | 86 | public function getUsers() { |
87 | - if(is_array($this->deletedUsers)) { |
|
87 | + if (is_array($this->deletedUsers)) { |
|
88 | 88 | return $this->deletedUsers; |
89 | 89 | } |
90 | 90 | return $this->fetchDeletedUsers(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return bool |
96 | 96 | */ |
97 | 97 | public function hasUsers() { |
98 | - if(!is_array($this->deletedUsers)) { |
|
98 | + if (!is_array($this->deletedUsers)) { |
|
99 | 99 | $this->fetchDeletedUsers(); |
100 | 100 | } |
101 | 101 | return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function markUser($ocName) { |
111 | 111 | $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
112 | - if($curValue === '1') { |
|
112 | + if ($curValue === '1') { |
|
113 | 113 | // the user is already marked, do not write to DB again |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
117 | - $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
117 | + $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string) time()); |
|
118 | 118 | $this->deletedUsers = null; |
119 | 119 | } |
120 | 120 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return int |
172 | 172 | */ |
173 | 173 | public function getLastLogin() { |
174 | - return (int)$this->lastLogin; |
|
174 | + return (int) $this->lastLogin; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return int |
180 | 180 | */ |
181 | 181 | public function getDetectedOn() { |
182 | - return (int)$this->foundDeleted; |
|
182 | + return (int) $this->foundDeleted; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'email' => 'settings', |
203 | 203 | 'lastLogin' => 'login', |
204 | 204 | ]; |
205 | - foreach($properties as $property => $app) { |
|
205 | + foreach ($properties as $property => $app) { |
|
206 | 206 | $this->$property = $this->config->getUserValue($this->ocName, $app, $property, ''); |
207 | 207 | } |
208 | 208 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ', 1); |
226 | 226 | $query->execute(array($this->ocName)); |
227 | 227 | $sResult = $query->fetchColumn(0); |
228 | - if((int)$sResult === 1) { |
|
228 | + if ((int) $sResult === 1) { |
|
229 | 229 | $this->hasActiveShares = true; |
230 | 230 | return; |
231 | 231 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ', 1); |
238 | 238 | $query->execute(array($this->ocName)); |
239 | 239 | $sResult = $query->fetchColumn(0); |
240 | - if((int)$sResult === 1) { |
|
240 | + if ((int) $sResult === 1) { |
|
241 | 241 | $this->hasActiveShares = true; |
242 | 242 | return; |
243 | 243 | } |
@@ -89,8 +89,8 @@ |
||
89 | 89 | 'displayName' => $user->getDisplayName(), |
90 | 90 | 'uid' => $user->getUID(), |
91 | 91 | 'dn' => $user->getDN(), |
92 | - 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
93 | - 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
92 | + 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool) $input->getOption('short-date')), |
|
93 | + 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool) $input->getOption('short-date')), |
|
94 | 94 | 'homePath' => $user->getHomePath(), |
95 | 95 | 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
96 | 96 | ]; |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $this->jobList = $jobList; |
47 | 47 | |
48 | 48 | // Run once a day |
49 | - $this->setInterval(60*60*24); |
|
49 | + $this->setInterval(60 * 60 * 24); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | protected function run($argument) { |