@@ -505,6 +505,7 @@ discard block |
||
505 | 505 | * |
506 | 506 | * trim a string depending on a specific string |
507 | 507 | * @param string $element |
508 | + * @param string $chaine |
|
508 | 509 | * @return string |
509 | 510 | */ |
510 | 511 | function trimElement($chaine, $element) |
@@ -1562,6 +1563,9 @@ discard block |
||
1562 | 1563 | * |
1563 | 1564 | * permits to handle the Teampass config file |
1564 | 1565 | * $action accepts "rebuild" and "update" |
1566 | + * @param string $action |
|
1567 | + * @param string $field |
|
1568 | + * @param integer $value |
|
1565 | 1569 | */ |
1566 | 1570 | function handleConfigFile($action, $field = null, $value = null) |
1567 | 1571 | { |
@@ -2056,7 +2060,6 @@ discard block |
||
2056 | 2060 | |
2057 | 2061 | /** |
2058 | 2062 | * Permits to clean and sanitize text to be displayed |
2059 | - * @param string $text text to clean |
|
2060 | 2063 | * @param string $type what clean to perform |
2061 | 2064 | * @return string text cleaned up |
2062 | 2065 | */ |
@@ -1414,7 +1414,7 @@ |
||
1414 | 1414 | // Can we use PHP7 random_int function? |
1415 | 1415 | if (version_compare(phpversion(), '7.0', '>=')) { |
1416 | 1416 | require_once $SETTINGS['cpassman_dir'].'/includes/libraries/PasswordGenerator/RandomGenerator/Php7RandomGenerator.php'; |
1417 | - $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
|
1417 | + $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
|
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | // init |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | } |
770 | 770 | // Get IDs of personal folders |
771 | 771 | if (isset($SETTINGS['enable_pf_feature']) === true && $SETTINGS['enable_pf_feature'] === '1' |
772 | - && isset($_SESSION['personal_folder']) === true && $_SESSION['personal_folder'] === '1' |
|
772 | + && isset($_SESSION['personal_folder']) === true && $_SESSION['personal_folder'] === '1' |
|
773 | 773 | ) { |
774 | 774 | $persoFld = DB::queryfirstrow( |
775 | 775 | "SELECT id |
@@ -1925,7 +1925,7 @@ discard block |
||
1925 | 1925 | $antiXss = new protect\AntiXSS\AntiXSS(); |
1926 | 1926 | |
1927 | 1927 | // Protect against bad inputs |
1928 | - if (is_array($source_file) ||is_array($target_file)) { |
|
1928 | + if (is_array($source_file) || is_array($target_file)) { |
|
1929 | 1929 | return 'error_cannot_be_array'; |
1930 | 1930 | } |
1931 | 1931 | |
@@ -2082,7 +2082,7 @@ discard block |
||
2082 | 2082 | $newArr = array(); |
2083 | 2083 | |
2084 | 2084 | foreach ($arr as $key => $value) { |
2085 | - $newArr[ $key ] = (is_array($value) ? array_map_r($func, $value) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ))); |
|
2085 | + $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value))); |
|
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | return $newArr; |
@@ -711,7 +711,7 @@ |
||
711 | 711 | utf8_encode( |
712 | 712 | "<?php |
713 | 713 | global \$SETTINGS; |
714 | -\$SETTINGS = array (" . $config_text . " |
|
714 | +\$SETTINGS = array (" . $config_text." |
|
715 | 715 | );" |
716 | 716 | ) |
717 | 717 | ); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $objects = explode(",", $post_object); |
765 | 765 | |
766 | 766 | // Allowed values for $_POST['object'] : "items,logs,files,categories" |
767 | - if (in_array($objects[0], array("items","logs","files","categories")) === false) { |
|
767 | + if (in_array($objects[0], array("items", "logs", "files", "categories")) === false) { |
|
768 | 768 | echo '[{"nextAction":"" , "error":"Input `'.$objects[0].'` is not allowed" , "nbOfItems":""}]'; |
769 | 769 | break; |
770 | 770 | } |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | foreach ($rows as $record) { |
1330 | 1330 | if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
1331 | 1331 | $addFile = 0; |
1332 | - if ($post_option== "decrypt" && $record['status'] === 'encrypted') { |
|
1332 | + if ($post_option == "decrypt" && $record['status'] === 'encrypted') { |
|
1333 | 1333 | $addFile = 1; |
1334 | 1334 | } elseif ($post_option == "encrypt" && $record['status'] === 'clear') { |
1335 | 1335 | $addFile = 1; |
@@ -632,7 +632,7 @@ |
||
632 | 632 | $json[$inc]['nlevel'] = mb_convert_encoding($folder->nlevel, mb_detect_encoding($folder->nlevel), 'UTF-8'); |
633 | 633 | $json[$inc]['personal'] = mb_convert_encoding($folder->personal_folder, mb_detect_encoding($folder->personal_folder), 'UTF-8'); |
634 | 634 | |
635 | - $inc ++; |
|
635 | + $inc++; |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } |
@@ -3125,7 +3125,7 @@ |
||
3125 | 3125 | if ((isset($_SESSION['user_settings']['session_psk']) === false || empty($_SESSION['user_settings']['session_psk']) === true) |
3126 | 3126 | && ($dataSource['personal_folder'] === '1' || $dataDestination['personal_folder'] === '1') |
3127 | 3127 | ) { |
3128 | - echo '[{"error" : "ERR_PSK_REQUIRED"}]'; |
|
3128 | + echo '[{"error" : "ERR_PSK_REQUIRED"}]'; |
|
3129 | 3129 | break; |
3130 | 3130 | } |
3131 | 3131 |
@@ -886,7 +886,7 @@ |
||
886 | 886 | /*FOLDER */ |
887 | 887 | if ($data['id_tree'] != $dataReceived['categorie']) { |
888 | 888 | // Get name of folders |
889 | - $dataTmp = DB::query("SELECT title FROM ".prefix_table("nested_tree")." WHERE id IN %li", array($data['id_tree'],$dataReceived['categorie'])); |
|
889 | + $dataTmp = DB::query("SELECT title FROM ".prefix_table("nested_tree")." WHERE id IN %li", array($data['id_tree'], $dataReceived['categorie'])); |
|
890 | 890 | |
891 | 891 | logItems($dataReceived['id'], $label, $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']); |
892 | 892 | // ask for page reloading |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | private static function signVals($key, $vals, $prefix, $expire, $time = null) |
28 | 28 | { |
29 | 29 | $exp = ($time ? $time : time()) + $expire; |
30 | - $val = $vals . '|' . $exp; |
|
30 | + $val = $vals.'|'.$exp; |
|
31 | 31 | $b64 = base64_encode($val); |
32 | - $cookie = $prefix . '|' . $b64; |
|
32 | + $cookie = $prefix.'|'.$b64; |
|
33 | 33 | |
34 | 34 | $sig = hash_hmac("sha1", $cookie, $key); |
35 | - return $cookie . '|' . $sig; |
|
35 | + return $cookie.'|'.$sig; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | private static function parseVals($key, $val, $prefix, $ikey, $time = null) |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | list($u_prefix, $u_b64, $u_sig) = $parts; |
47 | 47 | |
48 | - $sig = hash_hmac("sha1", $u_prefix . '|' . $u_b64, $key); |
|
48 | + $sig = hash_hmac("sha1", $u_prefix.'|'.$u_b64, $key); |
|
49 | 49 | if (hash_hmac("sha1", $sig, $key) !== hash_hmac("sha1", $u_sig, $key)) { |
50 | 50 | return null; |
51 | 51 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | return self::ERR_AKEY; |
89 | 89 | } |
90 | 90 | |
91 | - $vals = $username . '|' . $ikey; |
|
91 | + $vals = $username.'|'.$ikey; |
|
92 | 92 | |
93 | 93 | $duo_sig = self::signVals($skey, $vals, self::DUO_PREFIX, self::DUO_EXPIRE, $time); |
94 | 94 | $app_sig = self::signVals($akey, $vals, self::APP_PREFIX, self::APP_EXPIRE, $time); |
95 | 95 | |
96 | - return $duo_sig . ':' . $app_sig; |
|
96 | + return $duo_sig.':'.$app_sig; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public static function verifyResponse($ikey, $skey, $akey, $sig_response, $time = null) |
@@ -227,15 +227,15 @@ |
||
227 | 227 | } |
228 | 228 | $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = 'url_path'")); |
229 | 229 | if (intval($tmp) === 0) { |
230 | - mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('url_path', '". empty($session_url_path) ? $db['url_path'] : $session_url_path. "');"); |
|
230 | + mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('url_path', '".empty($session_url_path) ? $db['url_path'] : $session_url_path."');"); |
|
231 | 231 | } else { |
232 | 232 | mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '", empty($session_url_path) ? $db['url_path'] : $session_url_path, "' WHERE `key` = 'url_path';"); |
233 | 233 | } |
234 | 234 | $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = 'abspath'")); |
235 | 235 | if (intval($tmp) === 0) { |
236 | - mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('abspath', '". empty($session_abspath) ? $db['abspath'] : $session_abspath. "');"); |
|
236 | + mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('abspath', '".empty($session_abspath) ? $db['abspath'] : $session_abspath."');"); |
|
237 | 237 | } else { |
238 | - mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '". empty($session_abspath) ? $db['abspath'] : $session_abspath. "' WHERE `key` = 'abspath';"); |
|
238 | + mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '".empty($session_abspath) ? $db['abspath'] : $session_abspath."' WHERE `key` = 'abspath';"); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | echo '[{"error" : "", "result" : "Connection is successful", "multiple" : ""}]'; |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | if (val[4] !== "") { |
212 | 212 | newList += '<span id="encryt_data_'+val[1]+'" style="margin-left:4px; cursor:pointer;">'; |
213 | 213 | if (val[4] === "1") { |
214 | - newList += '<i class="fa fa-key tip" title="<?php echo $LANG['encrypted_data'];?>" onclick="changeEncrypMode('+val[1]+', 1)"></i>'; |
|
214 | + newList += '<i class="fa fa-key tip" title="<?php echo $LANG['encrypted_data']; ?>" onclick="changeEncrypMode('+val[1]+', 1)"></i>'; |
|
215 | 215 | } else if (val[4] === "0") { |
216 | - newList += '<span class="fa-stack" title="<?php echo $LANG['not_encrypted_data'];?>" onclick="changeEncrypMode('+val[1]+', 0)"><i class="fa fa-key fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x fa-lg" style="color:red;"></i></span>'; |
|
216 | + newList += '<span class="fa-stack" title="<?php echo $LANG['not_encrypted_data']; ?>" onclick="changeEncrypMode('+val[1]+', 0)"><i class="fa fa-key fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x fa-lg" style="color:red;"></i></span>'; |
|
217 | 217 | } |
218 | 218 | newList += '</span>' |
219 | 219 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | if (val[6] !== "") { |
222 | 222 | newList += '<span style="margin-left:4px;">'; |
223 | 223 | if (val[6] === "text") { |
224 | - newList += '<i class="fa fa-paragraph tip" title="<?php echo $LANG['data_is_text'];?>"></i>'; |
|
224 | + newList += '<i class="fa fa-paragraph tip" title="<?php echo $LANG['data_is_text']; ?>"></i>'; |
|
225 | 225 | } else if (val[6] === "masked") { |
226 | - newList += '<i class="fa fa-eye-slash tip" title="<?php echo $LANG['data_is_masked'];?>"></i>'; |
|
226 | + newList += '<i class="fa fa-eye-slash tip" title="<?php echo $LANG['data_is_masked']; ?>"></i>'; |
|
227 | 227 | } |
228 | 228 | newList += '</span>' |
229 | 229 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | function(data) { |
1020 | 1020 | data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key']; ?>"); |
1021 | 1021 | |
1022 | - var html = '<option value="">-- <?php echo addslashes($LANG['select']);?> --</option>', |
|
1022 | + var html = '<option value="">-- <?php echo addslashes($LANG['select']); ?> --</option>', |
|
1023 | 1023 | selected = 0; |
1024 | 1024 | |
1025 | 1025 | for (var i=0; i<data.length; i++) { |
@@ -759,7 +759,7 @@ |
||
759 | 759 | utf8_encode( |
760 | 760 | "<?php |
761 | 761 | global \$SETTINGS; |
762 | -\$SETTINGS = array (" . $config_text . " |
|
762 | +\$SETTINGS = array (" . $config_text." |
|
763 | 763 | );" |
764 | 764 | ) |
765 | 765 | ); |