@@ -443,6 +443,7 @@ |
||
443 | 443 | * @param int $id The ID of the current node to process |
444 | 444 | * @param int $level The nlevel to assign to the current node |
445 | 445 | * @param int &$n A reference to the running tally for the n-value |
446 | + * @param integer $n |
|
446 | 447 | */ |
447 | 448 | public function generateTreeData(&$arr, $id, $level, &$n) |
448 | 449 | { |
@@ -50,6 +50,7 @@ |
||
50 | 50 | * genHash() |
51 | 51 | * |
52 | 52 | * Generate a hash for user login |
53 | + * @param string $password |
|
53 | 54 | */ |
54 | 55 | function bCrypt($password, $cost) |
55 | 56 | { |
@@ -40,6 +40,10 @@ discard block |
||
40 | 40 | return $output; |
41 | 41 | } |
42 | 42 | |
43 | + /** |
|
44 | + * @param integer $rnd |
|
45 | + * @param integer $Nb |
|
46 | + */ |
|
43 | 47 | private static function addRoundKey($state, $w, $rnd, $Nb) { // xor Round Key into state S [é5.1.4] |
44 | 48 | for ($r=0; $r<4; $r++) { |
45 | 49 | for ($c=0; $c<$Nb; $c++) $state[$r][$c] ^= $w[$rnd*4+$c][$r]; |
@@ -48,6 +52,9 @@ discard block |
||
48 | 52 | return $state; |
49 | 53 | } |
50 | 54 | |
55 | + /** |
|
56 | + * @param integer $Nb |
|
57 | + */ |
|
51 | 58 | private static function subBytes($s, $Nb) { // apply SBox to state S [é5.1.1] |
52 | 59 | for ($r=0; $r<4; $r++) { |
53 | 60 | for ($c=0; $c<$Nb; $c++) $s[$r][$c] = self::$sBox[$s[$r][$c]]; |
@@ -56,6 +63,9 @@ discard block |
||
56 | 63 | return $s; |
57 | 64 | } |
58 | 65 | |
66 | + /** |
|
67 | + * @param integer $Nb |
|
68 | + */ |
|
59 | 69 | private static function shiftRows($s, $Nb) { // shift row r of state S left by r bytes [é5.1.2] |
60 | 70 | $t = array(4); |
61 | 71 | for ($r=1; $r<4; $r++) { |
@@ -65,6 +75,9 @@ discard block |
||
65 | 75 | return $s; // see fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.311.pdf |
66 | 76 | } |
67 | 77 | |
78 | + /** |
|
79 | + * @param integer $Nb |
|
80 | + */ |
|
68 | 81 | private static function mixColumns($s, $Nb) { // combine bytes of each col of state S [é5.1.3] |
69 | 82 | for ($c=0; $c<4; $c++) { |
70 | 83 | $a = array(4); // 'a' is a copy of the current column from 's' |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param plaintext source text to be encrypted |
17 | 17 | * @param password the password to use to generate a key |
18 | 18 | * @param nBits number of bits to be used in the key (128, 192, or 256) |
19 | - * @return encrypted text |
|
19 | + * @return string text |
|
20 | 20 | */ |
21 | 21 | public static function encrypt($plaintext, $password, $nBits) |
22 | 22 | { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param ciphertext source text to be decrypted |
85 | 85 | * @param password the password to use to generate a key |
86 | 86 | * @param nBits number of bits to be used in the key (128, 192, or 256) |
87 | - * @return decrypted text |
|
87 | + * @return string text |
|
88 | 88 | */ |
89 | 89 | public static function decrypt($ciphertext, $password, $nBits) |
90 | 90 | { |
@@ -7,6 +7,9 @@ |
||
7 | 7 | ################ |
8 | 8 | ## Function permits to get the value from a line |
9 | 9 | ################ |
10 | +/** |
|
11 | + * @param string $val |
|
12 | + */ |
|
10 | 13 | function getSettingValue($val) |
11 | 14 | { |
12 | 15 | $val = trim(strstr($val, "=")); |
@@ -39,6 +39,9 @@ |
||
39 | 39 | * |
40 | 40 | * Used to format the string ready for insertion in to the database |
41 | 41 | */ |
42 | +/** |
|
43 | + * @param string $crLFReplacement |
|
44 | + */ |
|
42 | 45 | function sanitiseString($str, $crLFReplacement) { |
43 | 46 | $str = preg_replace('#[\r\n]#', $crLFReplacement, $str); |
44 | 47 | $str = str_replace('\\', '\', $str); |
@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | use \Defuse\Crypto\Exception as Ex; |
34 | 34 | |
35 | 35 | //Generate N# of random bits for use as salt |
36 | +/** |
|
37 | + * @param integer $n |
|
38 | + */ |
|
36 | 39 | function getBits($n) |
37 | 40 | { |
38 | 41 | $str = ''; |
@@ -73,6 +76,7 @@ discard block |
||
73 | 76 | * encryptOld() |
74 | 77 | * |
75 | 78 | * crypt a string |
79 | + * @param string $text |
|
76 | 80 | */ |
77 | 81 | function encryptOld($text, $personalSalt = "") |
78 | 82 | { |
@@ -149,6 +153,7 @@ discard block |
||
149 | 153 | * encrypt() |
150 | 154 | * |
151 | 155 | * crypt a string |
156 | + * @param string $decrypted |
|
152 | 157 | */ |
153 | 158 | function encrypt($decrypted, $personalSalt = "") |
154 | 159 | { |
@@ -235,6 +240,7 @@ discard block |
||
235 | 240 | * genHash() |
236 | 241 | * |
237 | 242 | * Generate a hash for user login |
243 | + * @param string $password |
|
238 | 244 | */ |
239 | 245 | function bCrypt($password, $cost) |
240 | 246 | { |
@@ -349,6 +355,10 @@ discard block |
||
349 | 355 | return hex2bin($val); |
350 | 356 | } |
351 | 357 | |
358 | +/** |
|
359 | + * @param string $ascii_key |
|
360 | + * @param string $type |
|
361 | + */ |
|
352 | 362 | function cryption($message, $ascii_key, $type) //defuse_crypto |
353 | 363 | { |
354 | 364 | // load PhpEncryption library |
@@ -439,6 +449,9 @@ discard block |
||
439 | 449 | return $protected_key_encoded; // save this in user table |
440 | 450 | } |
441 | 451 | |
452 | +/** |
|
453 | + * @param string $psk |
|
454 | + */ |
|
442 | 455 | function defuse_validate_personal_key($psk, $protected_key_encoded) { |
443 | 456 | require_once '../includes/libraries/Encryption/Encryption/Crypto.php'; |
444 | 457 | require_once '../includes/libraries/Encryption/Encryption/Encoding.php'; |
@@ -469,6 +482,8 @@ discard block |
||
469 | 482 | * trimElement() |
470 | 483 | * |
471 | 484 | * trim a string depending on a specific string |
485 | + * @param string $element |
|
486 | + * @return string |
|
472 | 487 | */ |
473 | 488 | function trimElement($chaine, $element) |
474 | 489 | { |
@@ -514,6 +529,7 @@ discard block |
||
514 | 529 | * identifyUserRights() |
515 | 530 | * |
516 | 531 | * @return |
532 | + * @param boolean $refresh |
|
517 | 533 | */ |
518 | 534 | function identifyUserRights($groupesVisiblesUser, $groupesInterditsUser, $isAdmin, $idFonctions, $refresh) |
519 | 535 | { |
@@ -818,6 +834,7 @@ discard block |
||
818 | 834 | * updateCacheTable() |
819 | 835 | * |
820 | 836 | * Update the CACHE table |
837 | + * @param string $action |
|
821 | 838 | */ |
822 | 839 | function updateCacheTable($action, $id = "") |
823 | 840 | { |
@@ -1190,7 +1207,7 @@ discard block |
||
1190 | 1207 | /** |
1191 | 1208 | * isUTF8() |
1192 | 1209 | * |
1193 | - * @return string is the string in UTF8 format. |
|
1210 | + * @return integer is the string in UTF8 format. |
|
1194 | 1211 | */ |
1195 | 1212 | |
1196 | 1213 | function isUTF8($string) |
@@ -1215,6 +1232,9 @@ discard block |
||
1215 | 1232 | * FUNCTION |
1216 | 1233 | * permits to prepare data to be exchanged |
1217 | 1234 | */ |
1235 | +/** |
|
1236 | + * @param string $type |
|
1237 | + */ |
|
1218 | 1238 | function prepareExchangedData($data, $type) |
1219 | 1239 | { |
1220 | 1240 | //load ClassLoader |
@@ -1287,6 +1307,9 @@ discard block |
||
1287 | 1307 | /* |
1288 | 1308 | ** check table prefix in SQL query |
1289 | 1309 | */ |
1310 | +/** |
|
1311 | + * @param string $table |
|
1312 | + */ |
|
1290 | 1313 | function prefix_table($table) |
1291 | 1314 | { |
1292 | 1315 | global $pre; |
@@ -1325,6 +1348,9 @@ discard block |
||
1325 | 1348 | /* |
1326 | 1349 | * Send sysLOG message |
1327 | 1350 | */ |
1351 | +/** |
|
1352 | + * @param string $message |
|
1353 | + */ |
|
1328 | 1354 | function send_syslog($message, $component = "teampass", $program = "php", $host , $port) |
1329 | 1355 | { |
1330 | 1356 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
@@ -1340,6 +1366,9 @@ discard block |
||
1340 | 1366 | * logEvents() |
1341 | 1367 | * |
1342 | 1368 | * permits to log events into DB |
1369 | + * @param string $type |
|
1370 | + * @param string $label |
|
1371 | + * @param string $field_1 |
|
1343 | 1372 | */ |
1344 | 1373 | function logEvents($type, $label, $who, $login="", $field_1 = NULL) |
1345 | 1374 | { |
@@ -1378,6 +1407,10 @@ discard block |
||
1378 | 1407 | } |
1379 | 1408 | } |
1380 | 1409 | |
1410 | +/** |
|
1411 | + * @param string $item |
|
1412 | + * @param string $action |
|
1413 | + */ |
|
1381 | 1414 | function logItems($id, $item, $id_user, $action, $login = "", $raison = NULL, $raison_iv = NULL, $encryption_type = "") |
1382 | 1415 | { |
1383 | 1416 | global $server, $user, $pass, $database, $pre, $port, $encoding; |
@@ -49,6 +49,10 @@ discard block |
||
49 | 49 | return $output; |
50 | 50 | } |
51 | 51 | |
52 | + /** |
|
53 | + * @param integer $rnd |
|
54 | + * @param integer $Nb |
|
55 | + */ |
|
52 | 56 | private static function addRoundKey($state, $w, $rnd, $Nb) |
53 | 57 | { |
54 | 58 | // xor Round Key into state S [é5.1.4] |
@@ -61,6 +65,9 @@ discard block |
||
61 | 65 | return $state; |
62 | 66 | } |
63 | 67 | |
68 | + /** |
|
69 | + * @param integer $Nb |
|
70 | + */ |
|
64 | 71 | private static function subBytes($s, $Nb) |
65 | 72 | { |
66 | 73 | // apply SBox to state S [é5.1.1] |
@@ -73,6 +80,9 @@ discard block |
||
73 | 80 | return $s; |
74 | 81 | } |
75 | 82 | |
83 | + /** |
|
84 | + * @param integer $Nb |
|
85 | + */ |
|
76 | 86 | private static function shiftRows($s, $Nb) |
77 | 87 | { |
78 | 88 | // shift row r of state S left by r bytes [é5.1.2] |
@@ -88,6 +98,9 @@ discard block |
||
88 | 98 | return $s; // see fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.311.pdf |
89 | 99 | } |
90 | 100 | |
101 | + /** |
|
102 | + * @param integer $Nb |
|
103 | + */ |
|
91 | 104 | private static function mixColumns($s, $Nb) |
92 | 105 | { |
93 | 106 | // combine bytes of each col of state S [é5.1.3] |
@@ -219,10 +232,10 @@ discard block |
||
219 | 232 | * |
220 | 233 | * Unicode multi-byte character safe |
221 | 234 | * |
222 | - * @param plaintext source text to be encrypted |
|
235 | + * @param plaintext string text to be encrypted |
|
223 | 236 | * @param password the password to use to generate a key |
224 | - * @param nBits number of bits to be used in the key (128, 192, or 256) |
|
225 | - * @return encrypted text |
|
237 | + * @param nBits integer of bits to be used in the key (128, 192, or 256) |
|
238 | + * @return string text |
|
226 | 239 | */ |
227 | 240 | public static function encrypt($plaintext, $password, $nBits) |
228 | 241 | { |
@@ -302,8 +315,8 @@ discard block |
||
302 | 315 | * |
303 | 316 | * @param ciphertext source text to be decrypted |
304 | 317 | * @param password the password to use to generate a key |
305 | - * @param nBits number of bits to be used in the key (128, 192, or 256) |
|
306 | - * @return decrypted text |
|
318 | + * @param nBits integer of bits to be used in the key (128, 192, or 256) |
|
319 | + * @return string text |
|
307 | 320 | */ |
308 | 321 | public static function decrypt($ciphertext, $password, $nBits) |
309 | 322 | { |
@@ -7,6 +7,9 @@ |
||
7 | 7 | ################ |
8 | 8 | ## Function permits to get the value from a line |
9 | 9 | ################ |
10 | +/** |
|
11 | + * @param string $val |
|
12 | + */ |
|
10 | 13 | function getSettingValue($val) |
11 | 14 | { |
12 | 15 | $val = trim(strstr($val, "=")); |