@@ -427,7 +427,7 @@ |
||
427 | 427 | } elseif (substr_count($val, '$pre') > 0) { |
428 | 428 | $pre = getSettingValue($val); |
429 | 429 | } elseif (substr_count($val, "define('SECUREPATH',") > 0) { |
430 | - $superGlobal->put("sk_file", substr($val, 23, strpos($val, ');')-24)."/sk.php", "SESSION"); |
|
430 | + $superGlobal->put("sk_file", substr($val, 23, strpos($val, ');') - 24)."/sk.php", "SESSION"); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | } |
@@ -85,8 +85,8 @@ |
||
85 | 85 | ); |
86 | 86 | if ($row['valeur'] === "true") { |
87 | 87 | /** |
88 | - * Permits to delete files and folders recursively |
|
89 | - */ |
|
88 | + * Permits to delete files and folders recursively |
|
89 | + */ |
|
90 | 90 | function delTree($dir) |
91 | 91 | { |
92 | 92 | $files = array_diff(scandir($dir), array('.', '..')); |
@@ -13,8 +13,9 @@ |
||
13 | 13 | |
14 | 14 | public function getRandomBytes($bytecount) { |
15 | 15 | $result = mcrypt_create_iv($bytecount, $this->source); |
16 | - if ($result === false) |
|
17 | - throw new \RNGException('mcrypt_create_iv returned an invalid value'); |
|
16 | + if ($result === false) { |
|
17 | + throw new \RNGException('mcrypt_create_iv returned an invalid value'); |
|
18 | + } |
|
18 | 19 | return $result; |
19 | 20 | } |
20 | 21 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | private $algorithm; |
8 | 8 | |
9 | - function __construct($algorithm = 'sha256' ) { |
|
9 | + function __construct($algorithm = 'sha256') { |
|
10 | 10 | $algos = array_values(hash_algos()); |
11 | 11 | if (!in_array($algorithm, $algos, true)) |
12 | 12 | throw new \RNGException('Unsupported algorithm specified'); |
@@ -8,8 +8,9 @@ |
||
8 | 8 | |
9 | 9 | function __construct($algorithm = 'sha256' ) { |
10 | 10 | $algos = array_values(hash_algos()); |
11 | - if (!in_array($algorithm, $algos, true)) |
|
12 | - throw new \RNGException('Unsupported algorithm specified'); |
|
11 | + if (!in_array($algorithm, $algos, true)) { |
|
12 | + throw new \RNGException('Unsupported algorithm specified'); |
|
13 | + } |
|
13 | 14 | $this->algorithm = $algorithm; |
14 | 15 | } |
15 | 16 |
@@ -13,10 +13,12 @@ |
||
13 | 13 | |
14 | 14 | public function getRandomBytes($bytecount) { |
15 | 15 | $result = openssl_random_pseudo_bytes($bytecount, $crypto_strong); |
16 | - if ($this->requirestrong && ($crypto_strong === false)) |
|
17 | - throw new \RNGException('openssl_random_pseudo_bytes returned non-cryptographically strong value'); |
|
18 | - if ($result === false) |
|
19 | - throw new \RNGException('openssl_random_pseudo_bytes returned an invalid value'); |
|
16 | + if ($this->requirestrong && ($crypto_strong === false)) { |
|
17 | + throw new \RNGException('openssl_random_pseudo_bytes returned non-cryptographically strong value'); |
|
18 | + } |
|
19 | + if ($result === false) { |
|
20 | + throw new \RNGException('openssl_random_pseudo_bytes returned an invalid value'); |
|
21 | + } |
|
20 | 22 | return $result; |
21 | 23 | } |
22 | 24 |
@@ -33,8 +33,8 @@ |
||
33 | 33 | public function getUrl($qrtext, $size) |
34 | 34 | { |
35 | 35 | return 'https://chart.googleapis.com/chart?cht=qr' |
36 | - . '&chs=' . $size . 'x' . $size |
|
37 | - . '&chld=' . $this->errorcorrectionlevel . '|' . $this->margin |
|
38 | - . '&chl=' . rawurlencode($qrtext); |
|
36 | + . '&chs='.$size.'x'.$size |
|
37 | + . '&chld='.$this->errorcorrectionlevel.'|'.$this->margin |
|
38 | + . '&chl='.rawurlencode($qrtext); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -11,8 +11,9 @@ |
||
11 | 11 | |
12 | 12 | function __construct($verifyssl = false, $errorcorrectionlevel = 'L', $margin = 1) |
13 | 13 | { |
14 | - if (!is_bool($verifyssl)) |
|
15 | - throw new \QRException('VerifySSL must be bool'); |
|
14 | + if (!is_bool($verifyssl)) { |
|
15 | + throw new \QRException('VerifySSL must be bool'); |
|
16 | + } |
|
16 | 17 | |
17 | 18 | $this->verifyssl = $verifyssl; |
18 | 19 |
@@ -201,7 +201,7 @@ |
||
201 | 201 | logEvents('user_mngt', 'at_user_pwd_changed', $_SESSION['user_id'], $_SESSION['login'], $_SESSION['user_id']); |
202 | 202 | echo '[ { "error" : "none" } ]'; |
203 | 203 | } else { |
204 | - echo '[ { "error" : "pwd_hash_not_correct" } ]'; |
|
204 | + echo '[ { "error" : "pwd_hash_not_correct" } ]'; |
|
205 | 205 | } |
206 | 206 | break; |
207 | 207 |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } elseif (null !== filter_input(INPUT_POST, 'change_pw_origine', FILTER_SANITIZE_STRING) |
209 | 209 | && ((filter_input(INPUT_POST, 'change_pw_origine', FILTER_SANITIZE_STRING) === "admin_change" |
210 | 210 | || filter_input(INPUT_POST, 'change_pw_origine', FILTER_SANITIZE_STRING) === "user_change" |
211 | - ) && ($_SESSION['user_admin'] === "1"|| $_SESSION['user_manager'] === "1" |
|
211 | + ) && ($_SESSION['user_admin'] === "1" || $_SESSION['user_manager'] === "1" |
|
212 | 212 | || $_SESSION['user_can_manage_all_users'] === "1") |
213 | 213 | ) |
214 | 214 | ) { |
@@ -1249,10 +1249,10 @@ discard block |
||
1249 | 1249 | |
1250 | 1250 | // Identify url to anonymize it |
1251 | 1251 | if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) { |
1252 | - $url_found = substr($line, 19, strlen($line) - 22);//echo $url_found." ; "; |
|
1252 | + $url_found = substr($line, 19, strlen($line) - 22); //echo $url_found." ; "; |
|
1253 | 1253 | $tmp = parse_url($url_found); |
1254 | - $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path']; |
|
1255 | - $line = "'cpassman_url' => '" . $anonym_url . "\n"; |
|
1254 | + $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path']; |
|
1255 | + $line = "'cpassman_url' => '".$anonym_url."\n"; |
|
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | // Anonymize all urls |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | **Teampass configuration file:** |
1321 | 1321 | ``` |
1322 | -" . $list_of_options . " |
|
1322 | +" . $list_of_options." |
|
1323 | 1323 | ``` |
1324 | 1324 | |
1325 | 1325 | **Updated from an older Teampass or fresh install:** |
@@ -1334,12 +1334,12 @@ discard block |
||
1334 | 1334 | |
1335 | 1335 | #### Web server error log |
1336 | 1336 | ``` |
1337 | -" . $err['message']." - ".$err['file']." (".$err['line'] .") |
|
1337 | +" . $err['message']." - ".$err['file']." (".$err['line'].") |
|
1338 | 1338 | ``` |
1339 | 1339 | |
1340 | 1340 | #### Teampass 10 last system errors |
1341 | 1341 | ``` |
1342 | -" . $teampass_errors ." |
|
1342 | +" . $teampass_errors." |
|
1343 | 1343 | ``` |
1344 | 1344 | |
1345 | 1345 | #### Log from the web-browser developer console (CTRL + SHIFT + i) |
@@ -36,14 +36,14 @@ |
||
36 | 36 | |
37 | 37 | public function getTime() { |
38 | 38 | try { |
39 | - $context = stream_context_create($this->options); |
|
39 | + $context = stream_context_create($this->options); |
|
40 | 40 | $fd = fopen($this->url, 'rb', false, $context); |
41 | 41 | $headers = stream_get_meta_data($fd); |
42 | 42 | fclose($fd); |
43 | 43 | |
44 | 44 | foreach ($headers['wrapper_data'] as $h) { |
45 | 45 | if (strcasecmp(substr($h, 0, 5), 'Date:') === 0) |
46 | - return \DateTime::createFromFormat($this->expectedtimeformat, trim(substr($h,5)))->getTimestamp(); |
|
46 | + return \DateTime::createFromFormat($this->expectedtimeformat, trim(substr($h, 5)))->getTimestamp(); |
|
47 | 47 | } |
48 | 48 | throw new \TimeException(sprintf('Unable to retrieve time from %s (Invalid or no "Date:" header found)', $this->url)); |
49 | 49 | } |
@@ -42,12 +42,12 @@ |
||
42 | 42 | fclose($fd); |
43 | 43 | |
44 | 44 | foreach ($headers['wrapper_data'] as $h) { |
45 | - if (strcasecmp(substr($h, 0, 5), 'Date:') === 0) |
|
46 | - return \DateTime::createFromFormat($this->expectedtimeformat, trim(substr($h,5)))->getTimestamp(); |
|
45 | + if (strcasecmp(substr($h, 0, 5), 'Date:') === 0) { |
|
46 | + return \DateTime::createFromFormat($this->expectedtimeformat, trim(substr($h,5)))->getTimestamp(); |
|
47 | + } |
|
47 | 48 | } |
48 | 49 | throw new \TimeException(sprintf('Unable to retrieve time from %s (Invalid or no "Date:" header found)', $this->url)); |
49 | - } |
|
50 | - catch (Exception $ex) { |
|
50 | + } catch (Exception $ex) { |
|
51 | 51 | throw new \TimeException(sprintf('Unable to retrieve time from %s (%s)', $this->url, $ex->getMessage())); |
52 | 52 | } |
53 | 53 | } |
@@ -9,8 +9,9 @@ |
||
9 | 9 | $json = @json_decode( |
10 | 10 | @file_get_contents('http://www.convert-unix-time.com/api?timestamp=now') |
11 | 11 | ); |
12 | - if ($json === null || !is_int($json->timestamp)) |
|
13 | - throw new \TimeException('Unable to retrieve time from convert-unix-time.com'); |
|
12 | + if ($json === null || !is_int($json->timestamp)) { |
|
13 | + throw new \TimeException('Unable to retrieve time from convert-unix-time.com'); |
|
14 | + } |
|
14 | 15 | return $json->timestamp; |
15 | 16 | } |
16 | 17 | } |
17 | 18 | \ No newline at end of file |