@@ -213,6 +213,10 @@ discard block |
||
213 | 213 | return array($cipherKey, $macKey, $iv); |
214 | 214 | } |
215 | 215 | |
216 | + /** |
|
217 | + * @param string $a |
|
218 | + * @param string $b |
|
219 | + */ |
|
216 | 220 | function hash_equals($a, $b) { |
217 | 221 | $key = openssl_random_pseudo_bytes(128); |
218 | 222 | return hash_hmac('sha512', $a, $key) === hash_hmac('sha512', $b, $key); |
@@ -250,7 +254,7 @@ discard block |
||
250 | 254 | /** |
251 | 255 | * Pad the data with a random char chosen by the pad amount. |
252 | 256 | * |
253 | - * @param $data |
|
257 | + * @param string $data |
|
254 | 258 | * @return string |
255 | 259 | */ |
256 | 260 | protected function pad($data) { |
@@ -266,8 +270,8 @@ discard block |
||
266 | 270 | /** |
267 | 271 | * Unpad the the data |
268 | 272 | * |
269 | - * @param $data |
|
270 | - * @return bool|string |
|
273 | + * @param string $data |
|
274 | + * @return false|string |
|
271 | 275 | */ |
272 | 276 | protected function unpad($data) { |
273 | 277 | $length = $this->getKeySize(); |
@@ -284,7 +288,7 @@ discard block |
||
284 | 288 | * Encrypt a credential |
285 | 289 | * |
286 | 290 | * @param array|Credential $credential the credential to decrypt |
287 | - * @return Credential|array |
|
291 | + * @return string |
|
288 | 292 | */ |
289 | 293 | public function decryptCredential($credential) { |
290 | 294 | |
@@ -380,7 +384,7 @@ discard block |
||
380 | 384 | /** |
381 | 385 | * Decrypt a file |
382 | 386 | * |
383 | - * @param File|array $file |
|
387 | + * @param File $file |
|
384 | 388 | * @return File|array |
385 | 389 | */ |
386 | 390 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - private function fetchAll($sql){ |
|
86 | + private function fetchAll($sql) { |
|
87 | 87 | return $this->db->executeQuery($sql)->fetchAll(); |
88 | 88 | } |
89 | 89 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * Get a app setting |
74 | 74 | * |
75 | 75 | * @param $key string |
76 | - * @param null $default_value The default value if key does not exist |
|
76 | + * @param string|false $default_value The default value if key does not exist |
|
77 | 77 | * @return mixed |
78 | 78 | */ |
79 | 79 | public function getAppSetting($key, $default_value = null) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * Check if an setting is enabled (value of 1) |
112 | 112 | * |
113 | - * @param $setting |
|
113 | + * @param string $setting |
|
114 | 114 | * @return bool |
115 | 115 | */ |
116 | 116 | public function isEnabled($setting) { |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | $activity . '_self', array($label, $this->userId, $revision_created), |
168 | 168 | '', array(), |
169 | 169 | $link, $this->userId, Activity::TYPE_ITEM_ACTION); |
170 | - } else if (($storedCredential->getDeleteTime() === 0) && (int)$delete_time > 0) { |
|
170 | + } else if (($storedCredential->getDeleteTime() === 0) && (int) $delete_time > 0) { |
|
171 | 171 | $activity = 'item_deleted'; |
172 | 172 | $this->activityService->add( |
173 | 173 | $activity . '_self', array($label, $this->userId), |
174 | 174 | '', array(), |
175 | 175 | $link, $this->userId, Activity::TYPE_ITEM_ACTION); |
176 | - } else if (($storedCredential->getDeleteTime() > 0) && (int)$delete_time === 0) { |
|
176 | + } else if (($storedCredential->getDeleteTime() > 0) && (int) $delete_time === 0) { |
|
177 | 177 | $activity = 'item_recovered'; |
178 | 178 | $this->activityService->add( |
179 | 179 | $activity . '_self', array($label, $this->userId), |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $credential['shared_key'] = ''; |
242 | 242 | } |
243 | 243 | |
244 | - if(!isset($credential['shared_key'])){ |
|
244 | + if (!isset($credential['shared_key'])) { |
|
245 | 245 | $credential['shared_key'] = $storedCredential->getSharedKey(); |
246 | 246 | } |
247 | 247 |