@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param string $value |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | - public function executeCheck($operator, $value) { |
|
62 | + public function executeCheck($operator, $value) { |
|
63 | 63 | $actualValue = $this->getActualValue(); |
64 | 64 | return $this->executeStringCheck($operator, $value, $actualValue); |
65 | 65 | } |
@@ -109,8 +109,8 @@ |
||
109 | 109 | throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); |
110 | 110 | } |
111 | 111 | |
112 | - $regexValue = '\"' . self::REGEX_TIME . ' ' . self::REGEX_TIMEZONE . '\"'; |
|
113 | - $result = preg_match('/^\[' . $regexValue . ',' . $regexValue . '\]$/', $value, $matches); |
|
112 | + $regexValue = '\"'.self::REGEX_TIME.' '.self::REGEX_TIMEZONE.'\"'; |
|
113 | + $result = preg_match('/^\['.$regexValue.','.$regexValue.'\]$/', $value, $matches); |
|
114 | 114 | if (!$result) { |
115 | 115 | throw new \UnexpectedValueException($this->l->t('The given time span is invalid'), 2); |
116 | 116 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $value |
48 | 48 | * @return bool |
49 | 49 | */ |
50 | - public function executeCheck($operator, $value) { |
|
50 | + public function executeCheck($operator, $value) { |
|
51 | 51 | $actualValue = $this->getActualValue(); |
52 | 52 | if (in_array($operator, ['is', '!is'])) { |
53 | 53 | switch ($value) { |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | return $this->url; |
71 | 71 | } |
72 | 72 | |
73 | - $this->url = $this->request->getServerProtocol() . '://';// E.g. http(s) + :// |
|
74 | - $this->url .= $this->request->getServerHost();// E.g. localhost |
|
75 | - $this->url .= $this->request->getScriptName();// E.g. /nextcloud/index.php |
|
76 | - $this->url .= $this->request->getPathInfo();// E.g. /apps/files_texteditor/ajax/loadfile |
|
73 | + $this->url = $this->request->getServerProtocol().'://'; // E.g. http(s) + :// |
|
74 | + $this->url .= $this->request->getServerHost(); // E.g. localhost |
|
75 | + $this->url .= $this->request->getScriptName(); // E.g. /nextcloud/index.php |
|
76 | + $this->url .= $this->request->getPathInfo(); // E.g. /apps/files_texteditor/ajax/loadfile |
|
77 | 77 | |
78 | 78 | return $this->url; // E.g. https://localhost/nextcloud/index.php/apps/files_texteditor/ajax/loadfile |
79 | 79 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | * @param string $value |
45 | 45 | * @return bool |
46 | 46 | */ |
47 | - public function executeCheck($operator, $value) { |
|
47 | + public function executeCheck($operator, $value) { |
|
48 | 48 | $actualValue = $this->getActualValue(); |
49 | 49 | if (in_array($operator, ['is', '!is'])) { |
50 | 50 | switch ($value) { |
@@ -323,7 +323,7 @@ |
||
323 | 323 | * @return int Check unique ID |
324 | 324 | */ |
325 | 325 | protected function addCheck($class, $operator, $value) { |
326 | - $hash = md5($class . '::' . $operator . '::' . $value); |
|
326 | + $hash = md5($class.'::'.$operator.'::'.$value); |
|
327 | 327 | |
328 | 328 | $query = $this->connection->getQueryBuilder(); |
329 | 329 | $query->select('id') |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $node = \OC::$server->getRootFolder() |
88 | 88 | ->getUserFolder($parameters['user']) |
89 | 89 | ->get($this->request->getParam('path')); |
90 | - return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/')); |
|
90 | + return 'files/'.md5($node->getStorage()->getId().'::'.trim($node->getInternalPath(), '/')); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | try { |
122 | 122 | $lockingProvider->acquireLock($path, $type); |
123 | - $this->config->setAppValue('testing', 'locking_' . $path, $type); |
|
123 | + $this->config->setAppValue('testing', 'locking_'.$path, $type); |
|
124 | 124 | return new \OC_OCS_Result(null, 100); |
125 | 125 | } catch (LockedException $e) { |
126 | 126 | return new \OC_OCS_Result(null, Http::STATUS_LOCKED); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | try { |
147 | 147 | $lockingProvider->changeLock($path, $type); |
148 | - $this->config->setAppValue('testing', 'locking_' . $path, $type); |
|
148 | + $this->config->setAppValue('testing', 'locking_'.$path, $type); |
|
149 | 149 | return new \OC_OCS_Result(null, 100); |
150 | 150 | } catch (LockedException $e) { |
151 | 151 | return new \OC_OCS_Result(null, Http::STATUS_LOCKED); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | try { |
172 | 172 | $lockingProvider->releaseLock($path, $type); |
173 | - $this->config->deleteAppValue('testing', 'locking_' . $path); |
|
173 | + $this->config->deleteAppValue('testing', 'locking_'.$path); |
|
174 | 174 | return new \OC_OCS_Result(null, 100); |
175 | 175 | } catch (LockedException $e) { |
176 | 176 | return new \OC_OCS_Result(null, Http::STATUS_LOCKED); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return bool |
63 | 63 | */ |
64 | 64 | private function isSafeUrl($url) { |
65 | - return (bool)preg_match('/^[\/\.A-Za-z0-9]+$/', $url); |
|
65 | + return (bool) preg_match('/^[\/\.A-Za-z0-9]+$/', $url); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function discover($remote) { |
78 | 78 | // Check if something is in the cache |
79 | - if($cacheData = $this->cache->get($remote)) { |
|
79 | + if ($cacheData = $this->cache->get($remote)) { |
|
80 | 80 | return json_decode($cacheData, true); |
81 | 81 | } |
82 | 82 | |
@@ -88,22 +88,22 @@ discard block |
||
88 | 88 | |
89 | 89 | // Read the data from the response body |
90 | 90 | try { |
91 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
91 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
92 | 92 | 'timeout' => 10, |
93 | 93 | 'connect_timeout' => 10, |
94 | 94 | ]); |
95 | - if($response->getStatusCode() === 200) { |
|
95 | + if ($response->getStatusCode() === 200) { |
|
96 | 96 | $decodedService = json_decode($response->getBody(), true); |
97 | - if(is_array($decodedService)) { |
|
97 | + if (is_array($decodedService)) { |
|
98 | 98 | $endpoints = [ |
99 | 99 | 'webdav', |
100 | 100 | 'share', |
101 | 101 | ]; |
102 | 102 | |
103 | - foreach($endpoints as $endpoint) { |
|
104 | - if(isset($decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint])) { |
|
105 | - $endpointUrl = (string)$decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint]; |
|
106 | - if($this->isSafeUrl($endpointUrl)) { |
|
103 | + foreach ($endpoints as $endpoint) { |
|
104 | + if (isset($decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint])) { |
|
105 | + $endpointUrl = (string) $decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint]; |
|
106 | + if ($this->isSafeUrl($endpointUrl)) { |
|
107 | 107 | $discoveredServices[$endpoint] = $endpointUrl; |
108 | 108 | } |
109 | 109 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $token = $argument['token']; |
106 | 106 | $action = $argument['action']; |
107 | 107 | $data = json_decode($argument['data'], true); |
108 | - $try = (int)$argument['try'] + 1; |
|
108 | + $try = (int) $argument['try'] + 1; |
|
109 | 109 | |
110 | 110 | $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); |
111 | 111 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'token' => $argument['token'], |
129 | 129 | 'data' => $argument['data'], |
130 | 130 | 'action' => $argument['action'], |
131 | - 'try' => (int)$argument['try'] + 1, |
|
131 | + 'try' => (int) $argument['try'] + 1, |
|
132 | 132 | 'lastRun' => time() |
133 | 133 | ] |
134 | 134 | ); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return bool |
142 | 142 | */ |
143 | 143 | protected function shouldRun(array $argument) { |
144 | - $lastRun = (int)$argument['lastRun']; |
|
144 | + $lastRun = (int) $argument['lastRun']; |
|
145 | 145 | return ((time() - $lastRun) > $this->interval); |
146 | 146 | } |
147 | 147 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | public function generateToken() { |
56 | 56 | $token = $this->secureRandom->generate( |
57 | 57 | self::TOKEN_LENGTH, |
58 | - ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
58 | + ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); |
|
59 | 59 | return $token; |
60 | 60 | } |
61 | 61 |