@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $var_dk = ''; // Derived key |
| 108 | 108 | |
| 109 | 109 | for ($block = 1; $block <= $var_kb; ++$block) { // Create key |
| 110 | - $var_ib = $var_h = hash_hmac($var_a, $var_s . pack('N', $block), $var_p, true); // Initial hash for this block |
|
| 110 | + $var_ib = $var_h = hash_hmac($var_a, $var_s.pack('N', $block), $var_p, true); // Initial hash for this block |
|
| 111 | 111 | for ($var_i = 1; $var_i < $var_c; ++$var_i) { // Perform block iterations |
| 112 | 112 | $var_ib ^= ($var_h = hash_hmac($var_a, $var_h, $var_p, true)); // XOR each iterate |
| 113 | 113 | } |
@@ -341,25 +341,25 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | function cryption($message, $ascii_key, $type, $SETTINGS) |
| 343 | 343 | { |
| 344 | - $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key; |
|
| 344 | + $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key; |
|
| 345 | 345 | $err = false; |
| 346 | 346 | |
| 347 | 347 | // load PhpEncryption library |
| 348 | 348 | if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) { |
| 349 | 349 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 350 | 350 | } else { |
| 351 | - $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/'; |
|
| 351 | + $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - include_once $path . 'Crypto.php'; |
|
| 355 | - include_once $path . 'Encoding.php'; |
|
| 356 | - include_once $path . 'DerivedKeys.php'; |
|
| 357 | - include_once $path . 'Key.php'; |
|
| 358 | - include_once $path . 'KeyOrPassword.php'; |
|
| 359 | - include_once $path . 'File.php'; |
|
| 360 | - include_once $path . 'RuntimeTests.php'; |
|
| 361 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 362 | - include_once $path . 'Core.php'; |
|
| 354 | + include_once $path.'Crypto.php'; |
|
| 355 | + include_once $path.'Encoding.php'; |
|
| 356 | + include_once $path.'DerivedKeys.php'; |
|
| 357 | + include_once $path.'Key.php'; |
|
| 358 | + include_once $path.'KeyOrPassword.php'; |
|
| 359 | + include_once $path.'File.php'; |
|
| 360 | + include_once $path.'RuntimeTests.php'; |
|
| 361 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 362 | + include_once $path.'Core.php'; |
|
| 363 | 363 | |
| 364 | 364 | // convert KEY |
| 365 | 365 | $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
@@ -405,15 +405,15 @@ discard block |
||
| 405 | 405 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - include_once $path . 'Crypto.php'; |
|
| 409 | - include_once $path . 'Encoding.php'; |
|
| 410 | - include_once $path . 'DerivedKeys.php'; |
|
| 411 | - include_once $path . 'Key.php'; |
|
| 412 | - include_once $path . 'KeyOrPassword.php'; |
|
| 413 | - include_once $path . 'File.php'; |
|
| 414 | - include_once $path . 'RuntimeTests.php'; |
|
| 415 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 416 | - include_once $path . 'Core.php'; |
|
| 408 | + include_once $path.'Crypto.php'; |
|
| 409 | + include_once $path.'Encoding.php'; |
|
| 410 | + include_once $path.'DerivedKeys.php'; |
|
| 411 | + include_once $path.'Key.php'; |
|
| 412 | + include_once $path.'KeyOrPassword.php'; |
|
| 413 | + include_once $path.'File.php'; |
|
| 414 | + include_once $path.'RuntimeTests.php'; |
|
| 415 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 416 | + include_once $path.'Core.php'; |
|
| 417 | 417 | |
| 418 | 418 | $key = \Defuse\Crypto\Key::createNewRandomKey(); |
| 419 | 419 | $key = $key->saveToAsciiSafeString(); |
@@ -439,15 +439,15 @@ discard block |
||
| 439 | 439 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - include_once $path . 'Crypto.php'; |
|
| 443 | - include_once $path . 'Encoding.php'; |
|
| 444 | - include_once $path . 'DerivedKeys.php'; |
|
| 445 | - include_once $path . 'Key.php'; |
|
| 446 | - include_once $path . 'KeyOrPassword.php'; |
|
| 447 | - include_once $path . 'File.php'; |
|
| 448 | - include_once $path . 'RuntimeTests.php'; |
|
| 449 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 450 | - include_once $path . 'Core.php'; |
|
| 442 | + include_once $path.'Crypto.php'; |
|
| 443 | + include_once $path.'Encoding.php'; |
|
| 444 | + include_once $path.'DerivedKeys.php'; |
|
| 445 | + include_once $path.'Key.php'; |
|
| 446 | + include_once $path.'KeyOrPassword.php'; |
|
| 447 | + include_once $path.'File.php'; |
|
| 448 | + include_once $path.'RuntimeTests.php'; |
|
| 449 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 450 | + include_once $path.'Core.php'; |
|
| 451 | 451 | |
| 452 | 452 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk); |
| 453 | 453 | $protected_key_encoded = $protected_key->saveToAsciiSafeString(); |
@@ -474,15 +474,15 @@ discard block |
||
| 474 | 474 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - include_once $path . 'Crypto.php'; |
|
| 478 | - include_once $path . 'Encoding.php'; |
|
| 479 | - include_once $path . 'DerivedKeys.php'; |
|
| 480 | - include_once $path . 'Key.php'; |
|
| 481 | - include_once $path . 'KeyOrPassword.php'; |
|
| 482 | - include_once $path . 'File.php'; |
|
| 483 | - include_once $path . 'RuntimeTests.php'; |
|
| 484 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 485 | - include_once $path . 'Core.php'; |
|
| 477 | + include_once $path.'Crypto.php'; |
|
| 478 | + include_once $path.'Encoding.php'; |
|
| 479 | + include_once $path.'DerivedKeys.php'; |
|
| 480 | + include_once $path.'Key.php'; |
|
| 481 | + include_once $path.'KeyOrPassword.php'; |
|
| 482 | + include_once $path.'File.php'; |
|
| 483 | + include_once $path.'RuntimeTests.php'; |
|
| 484 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 485 | + include_once $path.'Core.php'; |
|
| 486 | 486 | |
| 487 | 487 | try { |
| 488 | 488 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); |
@@ -569,8 +569,8 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | function db_error_handler($params) |
| 571 | 571 | { |
| 572 | - echo 'Error: ' . $params['error'] . "<br>\n"; |
|
| 573 | - echo 'Query: ' . $params['query'] . "<br>\n"; |
|
| 572 | + echo 'Error: '.$params['error']."<br>\n"; |
|
| 573 | + echo 'Query: '.$params['query']."<br>\n"; |
|
| 574 | 574 | throw new Exception('Error - Query', 1); |
| 575 | 575 | } |
| 576 | 576 | |
@@ -592,14 +592,14 @@ discard block |
||
| 592 | 592 | $SETTINGS |
| 593 | 593 | ) { |
| 594 | 594 | //load ClassLoader |
| 595 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 595 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 596 | 596 | |
| 597 | 597 | // Load superglobal |
| 598 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 598 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 599 | 599 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 600 | 600 | |
| 601 | 601 | //Connect to DB |
| 602 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 602 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 603 | 603 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 604 | 604 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 605 | 605 | } |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | DB::$encoding = DB_ENCODING; |
| 612 | 612 | |
| 613 | 613 | //Build tree |
| 614 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 614 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 615 | 615 | $tree->register(); |
| 616 | 616 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 617 | 617 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | function identAdmin($idFonctions, $SETTINGS, $tree) |
| 654 | 654 | { |
| 655 | 655 | // Load superglobal |
| 656 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 656 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 657 | 657 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 658 | 658 | |
| 659 | 659 | // Init |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION'); |
| 676 | 676 | |
| 677 | 677 | // Get list of Folders |
| 678 | - $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
| 678 | + $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
| 679 | 679 | foreach ($rows as $record) { |
| 680 | 680 | array_push($groupesVisibles, $record['id']); |
| 681 | 681 | } |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | } |
| 695 | 695 | // Get ID of personal folder |
| 696 | 696 | $persfld = DB::queryfirstrow( |
| 697 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', |
|
| 697 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s', |
|
| 698 | 698 | $globalsUserId |
| 699 | 699 | ); |
| 700 | 700 | if (empty($persfld['id']) === false) { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | // get complete list of ROLES |
| 716 | 716 | $tmp = explode(';', $idFonctions); |
| 717 | 717 | $rows = DB::query( |
| 718 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 718 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 719 | 719 | ORDER BY title ASC' |
| 720 | 720 | ); |
| 721 | 721 | foreach ($rows as $record) { |
@@ -727,9 +727,9 @@ discard block |
||
| 727 | 727 | $superGlobal->put('is_admin', 1, 'SESSION'); |
| 728 | 728 | |
| 729 | 729 | // Check if admin has created Folders and Roles |
| 730 | - DB::query('SELECT * FROM ' . prefixTable('nested_tree') . ''); |
|
| 730 | + DB::query('SELECT * FROM '.prefixTable('nested_tree').''); |
|
| 731 | 731 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 732 | - DB::query('SELECT * FROM ' . prefixTable('roles_title')); |
|
| 732 | + DB::query('SELECT * FROM '.prefixTable('roles_title')); |
|
| 733 | 733 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 734 | 734 | } |
| 735 | 735 | |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | $tree |
| 774 | 774 | ) { |
| 775 | 775 | // Load superglobal |
| 776 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 776 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 777 | 777 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 778 | 778 | |
| 779 | 779 | // Init |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | // Get list of folders depending on Roles |
| 807 | 807 | $rows = DB::query( |
| 808 | 808 | 'SELECT * |
| 809 | - FROM ' . prefixTable('roles_values') . ' |
|
| 809 | + FROM ' . prefixTable('roles_values').' |
|
| 810 | 810 | WHERE role_id IN %li AND type IN %ls', |
| 811 | 811 | $userRoles, |
| 812 | 812 | array('W', 'ND', 'NE', 'NDNE', 'R') |
@@ -831,9 +831,9 @@ discard block |
||
| 831 | 831 | // Does this user is allowed to see other items |
| 832 | 832 | $inc = 0; |
| 833 | 833 | $rows = DB::query( |
| 834 | - 'SELECT id, id_tree FROM ' . prefixTable('items') . ' |
|
| 834 | + 'SELECT id, id_tree FROM '.prefixTable('items').' |
|
| 835 | 835 | WHERE restricted_to LIKE %ss AND inactif = %s', |
| 836 | - $globalsUserId . ';', |
|
| 836 | + $globalsUserId.';', |
|
| 837 | 837 | '0' |
| 838 | 838 | ); |
| 839 | 839 | foreach ($rows as $record) { |
@@ -847,8 +847,8 @@ discard block |
||
| 847 | 847 | // Check for the users roles if some specific rights exist on items |
| 848 | 848 | $rows = DB::query( |
| 849 | 849 | 'SELECT i.id_tree, r.item_id |
| 850 | - FROM ' . prefixTable('items') . ' as i |
|
| 851 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id) |
|
| 850 | + FROM ' . prefixTable('items').' as i |
|
| 851 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id) |
|
| 852 | 852 | WHERE r.role_id IN %li |
| 853 | 853 | ORDER BY i.id_tree ASC', |
| 854 | 854 | $userRoles |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | ) { |
| 870 | 870 | $persoFld = DB::queryfirstrow( |
| 871 | 871 | 'SELECT id |
| 872 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 872 | + FROM ' . prefixTable('nested_tree').' |
|
| 873 | 873 | WHERE title = %s AND personal_folder = %i', |
| 874 | 874 | $globalsUserId, |
| 875 | 875 | 1 |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | $persoFlds = DB::query( |
| 905 | 905 | 'SELECT id |
| 906 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 906 | + FROM ' . prefixTable('nested_tree').' |
|
| 907 | 907 | WHERE %l', |
| 908 | 908 | $where |
| 909 | 909 | ); |
@@ -946,17 +946,17 @@ discard block |
||
| 946 | 946 | ); |
| 947 | 947 | |
| 948 | 948 | // Folders and Roles numbers |
| 949 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
| 949 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
| 950 | 950 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 951 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
| 951 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
| 952 | 952 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 953 | 953 | |
| 954 | 954 | // check if change proposals on User's items |
| 955 | 955 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
| 956 | 956 | DB::query( |
| 957 | 957 | 'SELECT * |
| 958 | - FROM ' . prefixTable('items_change') . ' AS c |
|
| 959 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
| 958 | + FROM ' . prefixTable('items_change').' AS c |
|
| 959 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
| 960 | 960 | WHERE i.action = %s AND i.id_user = %i', |
| 961 | 961 | 'at_creation', |
| 962 | 962 | $globalsUserId |
@@ -1000,10 +1000,10 @@ discard block |
||
| 1000 | 1000 | */ |
| 1001 | 1001 | function cacheTableRefresh($SETTINGS) |
| 1002 | 1002 | { |
| 1003 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1003 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1004 | 1004 | |
| 1005 | 1005 | //Connect to DB |
| 1006 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1006 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1007 | 1007 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1008 | 1008 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1009 | 1009 | } |
@@ -1020,13 +1020,13 @@ discard block |
||
| 1020 | 1020 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1021 | 1021 | |
| 1022 | 1022 | // truncate table |
| 1023 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
| 1023 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
| 1024 | 1024 | |
| 1025 | 1025 | // reload date |
| 1026 | 1026 | $rows = DB::query( |
| 1027 | 1027 | 'SELECT * |
| 1028 | - FROM ' . prefixTable('items') . ' as i |
|
| 1029 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1028 | + FROM ' . prefixTable('items').' as i |
|
| 1029 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1030 | 1030 | AND l.action = %s |
| 1031 | 1031 | AND i.inactif = %i', |
| 1032 | 1032 | 'at_creation', |
@@ -1038,18 +1038,18 @@ discard block |
||
| 1038 | 1038 | $tags = ''; |
| 1039 | 1039 | $itemTags = DB::query( |
| 1040 | 1040 | 'SELECT tag |
| 1041 | - FROM ' . prefixTable('tags') . ' |
|
| 1041 | + FROM ' . prefixTable('tags').' |
|
| 1042 | 1042 | WHERE item_id = %i AND tag != ""', |
| 1043 | 1043 | $record['id'] |
| 1044 | 1044 | ); |
| 1045 | 1045 | foreach ($itemTags as $itemTag) { |
| 1046 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1046 | + $tags .= $itemTag['tag'].' '; |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | // Get renewal period |
| 1050 | 1050 | $resNT = DB::queryfirstrow( |
| 1051 | 1051 | 'SELECT renewal_period |
| 1052 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 1052 | + FROM ' . prefixTable('nested_tree').' |
|
| 1053 | 1053 | WHERE id = %i', |
| 1054 | 1054 | $record['id_tree'] |
| 1055 | 1055 | ); |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | // Is this a User id? |
| 1064 | 1064 | $user = DB::queryfirstrow( |
| 1065 | 1065 | 'SELECT id, login |
| 1066 | - FROM ' . prefixTable('users') . ' |
|
| 1066 | + FROM ' . prefixTable('users').' |
|
| 1067 | 1067 | WHERE id = %i', |
| 1068 | 1068 | $elem->title |
| 1069 | 1069 | ); |
@@ -1105,14 +1105,14 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | function cacheTableUpdate($SETTINGS, $ident = null) |
| 1107 | 1107 | { |
| 1108 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1108 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1109 | 1109 | |
| 1110 | 1110 | // Load superglobal |
| 1111 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1111 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1112 | 1112 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1113 | 1113 | |
| 1114 | 1114 | //Connect to DB |
| 1115 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1115 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1116 | 1116 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1117 | 1117 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1118 | 1118 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | // get new value from db |
| 1132 | 1132 | $data = DB::queryfirstrow( |
| 1133 | 1133 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
| 1134 | - FROM ' . prefixTable('items') . ' |
|
| 1134 | + FROM ' . prefixTable('items').' |
|
| 1135 | 1135 | WHERE id=%i', |
| 1136 | 1136 | $ident |
| 1137 | 1137 | ); |
@@ -1139,12 +1139,12 @@ discard block |
||
| 1139 | 1139 | $tags = ''; |
| 1140 | 1140 | $itemTags = DB::query( |
| 1141 | 1141 | 'SELECT tag |
| 1142 | - FROM ' . prefixTable('tags') . ' |
|
| 1142 | + FROM ' . prefixTable('tags').' |
|
| 1143 | 1143 | WHERE item_id = %i AND tag != ""', |
| 1144 | 1144 | $ident |
| 1145 | 1145 | ); |
| 1146 | 1146 | foreach ($itemTags as $itemTag) { |
| 1147 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1147 | + $tags .= $itemTag['tag'].' '; |
|
| 1148 | 1148 | } |
| 1149 | 1149 | // form id_tree to full foldername |
| 1150 | 1150 | $folder = array(); |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | // Is this a User id? |
| 1156 | 1156 | $user = DB::queryfirstrow( |
| 1157 | 1157 | 'SELECT id, login |
| 1158 | - FROM ' . prefixTable('users') . ' |
|
| 1158 | + FROM ' . prefixTable('users').' |
|
| 1159 | 1159 | WHERE id = %i', |
| 1160 | 1160 | $elem->title |
| 1161 | 1161 | ); |
@@ -1194,17 +1194,17 @@ discard block |
||
| 1194 | 1194 | */ |
| 1195 | 1195 | function cacheTableAdd($SETTINGS, $ident = null) |
| 1196 | 1196 | { |
| 1197 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1197 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1198 | 1198 | |
| 1199 | 1199 | // Load superglobal |
| 1200 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1200 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1201 | 1201 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1202 | 1202 | |
| 1203 | 1203 | // Get superglobals |
| 1204 | 1204 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
| 1205 | 1205 | |
| 1206 | 1206 | //Connect to DB |
| 1207 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1207 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1208 | 1208 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1209 | 1209 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1210 | 1210 | } |
@@ -1223,8 +1223,8 @@ discard block |
||
| 1223 | 1223 | // get new value from db |
| 1224 | 1224 | $data = DB::queryFirstRow( |
| 1225 | 1225 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
| 1226 | - FROM ' . prefixTable('items') . ' as i |
|
| 1227 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1226 | + FROM ' . prefixTable('items').' as i |
|
| 1227 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1228 | 1228 | WHERE i.id = %i |
| 1229 | 1229 | AND l.action = %s', |
| 1230 | 1230 | $ident, |
@@ -1234,12 +1234,12 @@ discard block |
||
| 1234 | 1234 | $tags = ''; |
| 1235 | 1235 | $itemTags = DB::query( |
| 1236 | 1236 | 'SELECT tag |
| 1237 | - FROM ' . prefixTable('tags') . ' |
|
| 1237 | + FROM ' . prefixTable('tags').' |
|
| 1238 | 1238 | WHERE item_id = %i AND tag != ""', |
| 1239 | 1239 | $ident |
| 1240 | 1240 | ); |
| 1241 | 1241 | foreach ($itemTags as $itemTag) { |
| 1242 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1242 | + $tags .= $itemTag['tag'].' '; |
|
| 1243 | 1243 | } |
| 1244 | 1244 | // form id_tree to full foldername |
| 1245 | 1245 | $folder = array(); |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | // Is this a User id? |
| 1251 | 1251 | $user = DB::queryfirstrow( |
| 1252 | 1252 | 'SELECT id, login |
| 1253 | - FROM ' . prefixTable('users') . ' |
|
| 1253 | + FROM ' . prefixTable('users').' |
|
| 1254 | 1254 | WHERE id = %i', |
| 1255 | 1255 | $elem->title |
| 1256 | 1256 | ); |
@@ -1291,48 +1291,48 @@ discard block |
||
| 1291 | 1291 | function getStatisticsData($SETTINGS) |
| 1292 | 1292 | { |
| 1293 | 1293 | DB::query( |
| 1294 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1294 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1295 | 1295 | 0 |
| 1296 | 1296 | ); |
| 1297 | 1297 | $counter_folders = DB::count(); |
| 1298 | 1298 | |
| 1299 | 1299 | DB::query( |
| 1300 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1300 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1301 | 1301 | 1 |
| 1302 | 1302 | ); |
| 1303 | 1303 | $counter_folders_perso = DB::count(); |
| 1304 | 1304 | |
| 1305 | 1305 | DB::query( |
| 1306 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1306 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1307 | 1307 | 0 |
| 1308 | 1308 | ); |
| 1309 | 1309 | $counter_items = DB::count(); |
| 1310 | 1310 | |
| 1311 | 1311 | DB::query( |
| 1312 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1312 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1313 | 1313 | 1 |
| 1314 | 1314 | ); |
| 1315 | 1315 | $counter_items_perso = DB::count(); |
| 1316 | 1316 | |
| 1317 | 1317 | DB::query( |
| 1318 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
| 1318 | + 'SELECT id FROM '.prefixTable('users').'' |
|
| 1319 | 1319 | ); |
| 1320 | 1320 | $counter_users = DB::count(); |
| 1321 | 1321 | |
| 1322 | 1322 | DB::query( |
| 1323 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
| 1323 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
| 1324 | 1324 | 1 |
| 1325 | 1325 | ); |
| 1326 | 1326 | $admins = DB::count(); |
| 1327 | 1327 | |
| 1328 | 1328 | DB::query( |
| 1329 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
| 1329 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
| 1330 | 1330 | 1 |
| 1331 | 1331 | ); |
| 1332 | 1332 | $managers = DB::count(); |
| 1333 | 1333 | |
| 1334 | 1334 | DB::query( |
| 1335 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
| 1335 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
| 1336 | 1336 | 1 |
| 1337 | 1337 | ); |
| 1338 | 1338 | $readOnly = DB::count(); |
@@ -1340,11 +1340,11 @@ discard block |
||
| 1340 | 1340 | // list the languages |
| 1341 | 1341 | $usedLang = []; |
| 1342 | 1342 | $tp_languages = DB::query( |
| 1343 | - 'SELECT name FROM ' . prefixTable('languages') |
|
| 1343 | + 'SELECT name FROM '.prefixTable('languages') |
|
| 1344 | 1344 | ); |
| 1345 | 1345 | foreach ($tp_languages as $tp_language) { |
| 1346 | 1346 | DB::query( |
| 1347 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
| 1347 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
| 1348 | 1348 | $tp_language['name'] |
| 1349 | 1349 | ); |
| 1350 | 1350 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | // get list of ips |
| 1354 | 1354 | $usedIp = []; |
| 1355 | 1355 | $tp_ips = DB::query( |
| 1356 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
| 1356 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
| 1357 | 1357 | ); |
| 1358 | 1358 | foreach ($tp_ips as $ip) { |
| 1359 | 1359 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
@@ -1415,21 +1415,21 @@ discard block |
||
| 1415 | 1415 | ) { |
| 1416 | 1416 | // CAse where email not defined |
| 1417 | 1417 | if ($email === 'none' || empty($email) === true) { |
| 1418 | - return '"error":"" , "message":"' . langHdl('forgot_my_pw_email_sent') . '"'; |
|
| 1418 | + return '"error":"" , "message":"'.langHdl('forgot_my_pw_email_sent').'"'; |
|
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | // Load settings |
| 1422 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 1422 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 1423 | 1423 | |
| 1424 | 1424 | // Load superglobal |
| 1425 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1425 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1426 | 1426 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1427 | 1427 | |
| 1428 | 1428 | // Get user language |
| 1429 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php'; |
|
| 1429 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php'; |
|
| 1430 | 1430 | |
| 1431 | 1431 | // Load library |
| 1432 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1432 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1433 | 1433 | |
| 1434 | 1434 | // load PHPMailer |
| 1435 | 1435 | $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries'); |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | $mail = new PHPMailer\PHPMailer\PHPMailer(true); |
| 1438 | 1438 | try { |
| 1439 | 1439 | // send to user |
| 1440 | - $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1440 | + $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1441 | 1441 | $mail->SMTPDebug = 0; //value 1 can be used to debug - 4 for debuging connections |
| 1442 | 1442 | $mail->Port = $SETTINGS['email_port']; //COULD BE USED |
| 1443 | 1443 | $mail->CharSet = 'utf-8'; |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;"> |
| 1524 | 1524 | <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;"> |
| 1525 | 1525 | <br><div style="float:right;">' . |
| 1526 | - $textMail . |
|
| 1526 | + $textMail. |
|
| 1527 | 1527 | '<br><br></td></tr></table> |
| 1528 | 1528 | </td></tr></table> |
| 1529 | 1529 | <br></body></html>'; |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | function generateKey() |
| 1538 | 1538 | { |
| 1539 | - return substr(md5(rand() . rand()), 0, 15); |
|
| 1539 | + return substr(md5(rand().rand()), 0, 15); |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | /** |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | { |
| 1607 | 1607 | array_walk_recursive( |
| 1608 | 1608 | $array, |
| 1609 | - function (&$item) { |
|
| 1609 | + function(&$item) { |
|
| 1610 | 1610 | if (mb_detect_encoding($item, 'utf-8', true) === false) { |
| 1611 | 1611 | $item = utf8_encode($item); |
| 1612 | 1612 | } |
@@ -1642,7 +1642,7 @@ discard block |
||
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | // Load superglobal |
| 1645 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1645 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1646 | 1646 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1647 | 1647 | |
| 1648 | 1648 | // Get superglobals |
@@ -1654,9 +1654,9 @@ discard block |
||
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | 1656 | //load ClassLoader |
| 1657 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1657 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1658 | 1658 | //Load AES |
| 1659 | - $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1659 | + $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1660 | 1660 | $aes->register(); |
| 1661 | 1661 | |
| 1662 | 1662 | if ($type === 'encode' && is_array($data) === true) { |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | function makeThumbnail($src, $dest, $desired_width) |
| 1712 | 1712 | { |
| 1713 | 1713 | /* read the source image */ |
| 1714 | - if(is_file($src) === true && mime_content_type($src) === 'image/png'){ |
|
| 1714 | + if (is_file($src) === true && mime_content_type($src) === 'image/png') { |
|
| 1715 | 1715 | $source_image = imagecreatefrompng($src); |
| 1716 | 1716 | if ($source_image === false) { |
| 1717 | 1717 | return "Error: Not a valid PNG file! It's type is ".mime_content_type($src); |
@@ -1748,7 +1748,7 @@ discard block |
||
| 1748 | 1748 | */ |
| 1749 | 1749 | function prefixTable($table) |
| 1750 | 1750 | { |
| 1751 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
| 1751 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
| 1752 | 1752 | if (!empty($safeTable)) { |
| 1753 | 1753 | // sanitize string |
| 1754 | 1754 | return $safeTable; |
@@ -1780,14 +1780,14 @@ discard block |
||
| 1780 | 1780 | $lowercase = false, |
| 1781 | 1781 | $SETTINGS = array() |
| 1782 | 1782 | ) { |
| 1783 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1784 | - $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1783 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1784 | + $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1785 | 1785 | $generator->register(); |
| 1786 | 1786 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
| 1787 | 1787 | |
| 1788 | 1788 | // Is PHP7 being used? |
| 1789 | 1789 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
| 1790 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1790 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1791 | 1791 | $php7generator->register(); |
| 1792 | 1792 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
| 1793 | 1793 | } |
@@ -1818,7 +1818,7 @@ discard block |
||
| 1818 | 1818 | function send_syslog($message, $host, $port, $component = 'teampass') |
| 1819 | 1819 | { |
| 1820 | 1820 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
| 1821 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
| 1821 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
| 1822 | 1822 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
| 1823 | 1823 | socket_close($sock); |
| 1824 | 1824 | } |
@@ -1842,7 +1842,7 @@ discard block |
||
| 1842 | 1842 | } |
| 1843 | 1843 | |
| 1844 | 1844 | // include librairies & connect to DB |
| 1845 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1845 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1846 | 1846 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1847 | 1847 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1848 | 1848 | } |
@@ -1868,14 +1868,14 @@ discard block |
||
| 1868 | 1868 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
| 1869 | 1869 | if ($type === 'user_mngt') { |
| 1870 | 1870 | send_syslog( |
| 1871 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
| 1871 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
| 1872 | 1872 | $SETTINGS['syslog_host'], |
| 1873 | 1873 | $SETTINGS['syslog_port'], |
| 1874 | 1874 | 'teampass' |
| 1875 | 1875 | ); |
| 1876 | 1876 | } else { |
| 1877 | 1877 | send_syslog( |
| 1878 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
| 1878 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
| 1879 | 1879 | $SETTINGS['syslog_host'], |
| 1880 | 1880 | $SETTINGS['syslog_port'], |
| 1881 | 1881 | 'teampass' |
@@ -1907,7 +1907,7 @@ discard block |
||
| 1907 | 1907 | $encryption_type = null |
| 1908 | 1908 | ) { |
| 1909 | 1909 | // include librairies & connect to DB |
| 1910 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1910 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1911 | 1911 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1912 | 1912 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1913 | 1913 | } |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | if (empty($item_label) === true) { |
| 1954 | 1954 | $dataItem = DB::queryfirstrow( |
| 1955 | 1955 | 'SELECT id, id_tree, label |
| 1956 | - FROM ' . prefixTable('items') . ' |
|
| 1956 | + FROM ' . prefixTable('items').' |
|
| 1957 | 1957 | WHERE id = %i', |
| 1958 | 1958 | $item_id |
| 1959 | 1959 | ); |
@@ -1962,11 +1962,11 @@ discard block |
||
| 1962 | 1962 | } |
| 1963 | 1963 | |
| 1964 | 1964 | send_syslog( |
| 1965 | - 'action=' . str_replace('at_', '', $action) . |
|
| 1966 | - ' attribute=' . str_replace('at_', '', $attribute[0]) . |
|
| 1967 | - ' itemno=' . $item_id . |
|
| 1968 | - ' user=' . is_null($login) === true ? '' : addslashes((string) $login) . |
|
| 1969 | - ' itemname="' . addslashes($item_label) . '"', |
|
| 1965 | + 'action='.str_replace('at_', '', $action). |
|
| 1966 | + ' attribute='.str_replace('at_', '', $attribute[0]). |
|
| 1967 | + ' itemno='.$item_id. |
|
| 1968 | + ' user='.is_null($login) === true ? '' : addslashes((string) $login). |
|
| 1969 | + ' itemname="'.addslashes($item_label).'"', |
|
| 1970 | 1970 | $SETTINGS['syslog_host'], |
| 1971 | 1971 | $SETTINGS['syslog_port'], |
| 1972 | 1972 | 'teampass' |
@@ -1992,7 +1992,7 @@ discard block |
||
| 1992 | 1992 | && $action === 'at_shown' |
| 1993 | 1993 | ) { |
| 1994 | 1994 | // Load superglobal |
| 1995 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1995 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1996 | 1996 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1997 | 1997 | |
| 1998 | 1998 | // Get superglobals |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | // Get info about item |
| 2004 | 2004 | $dataItem = DB::queryfirstrow( |
| 2005 | 2005 | 'SELECT id, id_tree, label |
| 2006 | - FROM ' . prefixTable('items') . ' |
|
| 2006 | + FROM ' . prefixTable('items').' |
|
| 2007 | 2007 | WHERE id = %i', |
| 2008 | 2008 | $item_id |
| 2009 | 2009 | ); |
@@ -2018,9 +2018,9 @@ discard block |
||
| 2018 | 2018 | 'body' => str_replace( |
| 2019 | 2019 | array('#tp_user#', '#tp_item#', '#tp_link#'), |
| 2020 | 2020 | array( |
| 2021 | - addslashes($globalsName . ' ' . $globalsLastname), |
|
| 2021 | + addslashes($globalsName.' '.$globalsLastname), |
|
| 2022 | 2022 | addslashes($item_label), |
| 2023 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id, |
|
| 2023 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id, |
|
| 2024 | 2024 | ), |
| 2025 | 2025 | langHdl('email_on_open_notification_mail') |
| 2026 | 2026 | ), |
@@ -2042,7 +2042,7 @@ discard block |
||
| 2042 | 2042 | function notifyChangesToSubscribers($item_id, $label, $changes, $SETTINGS) |
| 2043 | 2043 | { |
| 2044 | 2044 | // Load superglobal |
| 2045 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2045 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2046 | 2046 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2047 | 2047 | |
| 2048 | 2048 | // Get superglobals |
@@ -2054,8 +2054,8 @@ discard block |
||
| 2054 | 2054 | $notification = DB::queryOneColumn( |
| 2055 | 2055 | 'email', |
| 2056 | 2056 | 'SELECT * |
| 2057 | - FROM ' . prefixTable('notification') . ' AS n |
|
| 2058 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
| 2057 | + FROM ' . prefixTable('notification').' AS n |
|
| 2058 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
| 2059 | 2059 | WHERE n.item_id = %i AND n.user_id != %i', |
| 2060 | 2060 | $item_id, |
| 2061 | 2061 | $globalsUserId |
@@ -2068,7 +2068,7 @@ discard block |
||
| 2068 | 2068 | // Get list of changes |
| 2069 | 2069 | $htmlChanges = '<ul>'; |
| 2070 | 2070 | foreach ($changes as $change) { |
| 2071 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
| 2071 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
| 2072 | 2072 | } |
| 2073 | 2073 | $htmlChanges .= '</ul>'; |
| 2074 | 2074 | |
@@ -2102,7 +2102,7 @@ discard block |
||
| 2102 | 2102 | function geItemReadablePath($id_tree, $label, $SETTINGS) |
| 2103 | 2103 | { |
| 2104 | 2104 | // Class loader |
| 2105 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 2105 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 2106 | 2106 | |
| 2107 | 2107 | //Load Tree |
| 2108 | 2108 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
@@ -2113,15 +2113,15 @@ discard block |
||
| 2113 | 2113 | $path = ''; |
| 2114 | 2114 | foreach ($arbo as $elem) { |
| 2115 | 2115 | if (empty($path) === true) { |
| 2116 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 2116 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 2117 | 2117 | } else { |
| 2118 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2118 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2119 | 2119 | } |
| 2120 | 2120 | } |
| 2121 | 2121 | |
| 2122 | 2122 | // Build text to show user |
| 2123 | 2123 | if (empty($label) === false) { |
| 2124 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
| 2124 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
| 2125 | 2125 | } else { |
| 2126 | 2126 | return empty($path) === true ? '' : $path; |
| 2127 | 2127 | } |
@@ -2180,10 +2180,10 @@ discard block |
||
| 2180 | 2180 | */ |
| 2181 | 2181 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
| 2182 | 2182 | { |
| 2183 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
| 2183 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
| 2184 | 2184 | |
| 2185 | 2185 | // include librairies & connect to DB |
| 2186 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2186 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2187 | 2187 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2188 | 2188 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2189 | 2189 | } |
@@ -2197,8 +2197,8 @@ discard block |
||
| 2197 | 2197 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
| 2198 | 2198 | // perform a copy |
| 2199 | 2199 | if (file_exists($tp_config_file)) { |
| 2200 | - if (!copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
| 2201 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
| 2200 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
| 2201 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
| 2202 | 2202 | } |
| 2203 | 2203 | } |
| 2204 | 2204 | |
@@ -2209,11 +2209,11 @@ discard block |
||
| 2209 | 2209 | $data[1] = "global \$SETTINGS;\n"; |
| 2210 | 2210 | $data[2] = "\$SETTINGS = array (\n"; |
| 2211 | 2211 | $rows = DB::query( |
| 2212 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
| 2212 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
| 2213 | 2213 | 'admin' |
| 2214 | 2214 | ); |
| 2215 | 2215 | foreach ($rows as $record) { |
| 2216 | - array_push($data, " '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n"); |
|
| 2216 | + array_push($data, " '".$record['intitule']."' => '".$record['valeur']."',\n"); |
|
| 2217 | 2217 | } |
| 2218 | 2218 | array_push($data, ");\n"); |
| 2219 | 2219 | $data = array_unique($data); |
@@ -2227,15 +2227,15 @@ discard block |
||
| 2227 | 2227 | break; |
| 2228 | 2228 | } |
| 2229 | 2229 | |
| 2230 | - if (stristr($line, "'" . $field . "' => '")) { |
|
| 2231 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n"; |
|
| 2230 | + if (stristr($line, "'".$field."' => '")) { |
|
| 2231 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n"; |
|
| 2232 | 2232 | $bFound = true; |
| 2233 | 2233 | break; |
| 2234 | 2234 | } |
| 2235 | 2235 | ++$inc; |
| 2236 | 2236 | } |
| 2237 | 2237 | if ($bFound === false) { |
| 2238 | - $data[($inc)] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n"; |
|
| 2238 | + $data[($inc)] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n"; |
|
| 2239 | 2239 | } |
| 2240 | 2240 | } |
| 2241 | 2241 | |
@@ -2273,7 +2273,7 @@ discard block |
||
| 2273 | 2273 | $settings = array(); |
| 2274 | 2274 | |
| 2275 | 2275 | $rows = DB::query( |
| 2276 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
| 2276 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
| 2277 | 2277 | array( |
| 2278 | 2278 | 'type' => 'admin', |
| 2279 | 2279 | 'type2' => 'settings', |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | $source_cf = array(); |
| 2301 | 2301 | $rows = DB::QUERY( |
| 2302 | 2302 | 'SELECT id_category |
| 2303 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2303 | + FROM ' . prefixTable('categories_folders').' |
|
| 2304 | 2304 | WHERE id_folder = %i', |
| 2305 | 2305 | $source_id |
| 2306 | 2306 | ); |
@@ -2311,7 +2311,7 @@ discard block |
||
| 2311 | 2311 | $target_cf = array(); |
| 2312 | 2312 | $rows = DB::QUERY( |
| 2313 | 2313 | 'SELECT id_category |
| 2314 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2314 | + FROM ' . prefixTable('categories_folders').' |
|
| 2315 | 2315 | WHERE id_folder = %i', |
| 2316 | 2316 | $target_id |
| 2317 | 2317 | ); |
@@ -2346,9 +2346,9 @@ discard block |
||
| 2346 | 2346 | $password = null |
| 2347 | 2347 | ) { |
| 2348 | 2348 | // Load AntiXSS |
| 2349 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2350 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2351 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2349 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2350 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2351 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2352 | 2352 | $antiXss = new voku\helper\AntiXSS(); |
| 2353 | 2353 | |
| 2354 | 2354 | // Protect against bad inputs |
@@ -2362,7 +2362,7 @@ discard block |
||
| 2362 | 2362 | |
| 2363 | 2363 | if (empty($password) === true || is_null($password) === true) { |
| 2364 | 2364 | // get KEY to define password |
| 2365 | - $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
| 2365 | + $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
| 2366 | 2366 | $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
| 2367 | 2367 | } |
| 2368 | 2368 | |
@@ -2408,15 +2408,15 @@ discard block |
||
| 2408 | 2408 | ) { |
| 2409 | 2409 | // load PhpEncryption library |
| 2410 | 2410 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2411 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2412 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2413 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2414 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2415 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2416 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2417 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2418 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2419 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2411 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2412 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2413 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2414 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2415 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2416 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2417 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2418 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2419 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2420 | 2420 | |
| 2421 | 2421 | try { |
| 2422 | 2422 | \Defuse\Crypto\File::encryptFileWithPassword( |
@@ -2454,15 +2454,15 @@ discard block |
||
| 2454 | 2454 | ) { |
| 2455 | 2455 | // load PhpEncryption library |
| 2456 | 2456 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2457 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2458 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2459 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2460 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2461 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2462 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2463 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2464 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2465 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2457 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2458 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2459 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2460 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2461 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2462 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2463 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2464 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2465 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2466 | 2466 | |
| 2467 | 2467 | try { |
| 2468 | 2468 | \Defuse\Crypto\File::decryptFileWithPassword( |
@@ -2508,9 +2508,9 @@ discard block |
||
| 2508 | 2508 | function fileDelete($file, $SETTINGS) |
| 2509 | 2509 | { |
| 2510 | 2510 | // Load AntiXSS |
| 2511 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2512 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2513 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2511 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2512 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2513 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2514 | 2514 | $antiXss = new voku\helper\AntiXSS(); |
| 2515 | 2515 | |
| 2516 | 2516 | $file = $antiXss->xss_clean($file); |
@@ -2553,7 +2553,7 @@ discard block |
||
| 2553 | 2553 | More info at: http://php.net/chmod. |
| 2554 | 2554 | */ |
| 2555 | 2555 | |
| 2556 | -function recursiveChmod($path, $filePerm=0644, $dirPerm=0755) { |
|
| 2556 | +function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) { |
|
| 2557 | 2557 | // Check if the path exists |
| 2558 | 2558 | if (!file_exists($path)) { |
| 2559 | 2559 | return(false); |
@@ -2593,7 +2593,7 @@ discard block |
||
| 2593 | 2593 | */ |
| 2594 | 2594 | function accessToItemIsGranted($item_id, $SETTINGS) |
| 2595 | 2595 | { |
| 2596 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2596 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2597 | 2597 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2598 | 2598 | |
| 2599 | 2599 | // Prepare superGlobal variables |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | // Load item data |
| 2604 | 2604 | $data = DB::queryFirstRow( |
| 2605 | 2605 | 'SELECT id_tree |
| 2606 | - FROM ' . prefixTable('items') . ' |
|
| 2606 | + FROM ' . prefixTable('items').' |
|
| 2607 | 2607 | WHERE id = %i', |
| 2608 | 2608 | $item_id |
| 2609 | 2609 | ); |
@@ -2685,8 +2685,8 @@ discard block |
||
| 2685 | 2685 | function performDBQuery($SETTINGS, $fields, $table) |
| 2686 | 2686 | { |
| 2687 | 2687 | // include librairies & connect to DB |
| 2688 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2689 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2688 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2689 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2690 | 2690 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2691 | 2691 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2692 | 2692 | } |
@@ -2699,7 +2699,7 @@ discard block |
||
| 2699 | 2699 | |
| 2700 | 2700 | // Insert log in DB |
| 2701 | 2701 | return DB::query( |
| 2702 | - 'SELECT ' . $fields . ' |
|
| 2702 | + 'SELECT '.$fields.' |
|
| 2703 | 2703 | FROM ' . prefixTable($table) |
| 2704 | 2704 | ); |
| 2705 | 2705 | } |
@@ -2714,15 +2714,15 @@ discard block |
||
| 2714 | 2714 | function formatSizeUnits($bytes) |
| 2715 | 2715 | { |
| 2716 | 2716 | if ($bytes >= 1073741824) { |
| 2717 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
| 2717 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
| 2718 | 2718 | } elseif ($bytes >= 1048576) { |
| 2719 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
| 2719 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
| 2720 | 2720 | } elseif ($bytes >= 1024) { |
| 2721 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
| 2721 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
| 2722 | 2722 | } elseif ($bytes > 1) { |
| 2723 | - $bytes = $bytes . ' bytes'; |
|
| 2723 | + $bytes = $bytes.' bytes'; |
|
| 2724 | 2724 | } elseif ($bytes == 1) { |
| 2725 | - $bytes = $bytes . ' byte'; |
|
| 2725 | + $bytes = $bytes.' byte'; |
|
| 2726 | 2726 | } else { |
| 2727 | 2727 | $bytes = '0 bytes'; |
| 2728 | 2728 | } |
@@ -2902,7 +2902,7 @@ discard block |
||
| 2902 | 2902 | // Decrypt |
| 2903 | 2903 | try { |
| 2904 | 2904 | $ret = base64_encode($rsa->decrypt(base64_decode($key))); |
| 2905 | - } catch(Exception $e) { |
|
| 2905 | + } catch (Exception $e) { |
|
| 2906 | 2906 | return $e; |
| 2907 | 2907 | } |
| 2908 | 2908 | |
@@ -2944,16 +2944,16 @@ discard block |
||
| 2944 | 2944 | |
| 2945 | 2945 | // Encrypt the file content |
| 2946 | 2946 | $plaintext = file_get_contents( |
| 2947 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
| 2947 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
| 2948 | 2948 | ); |
| 2949 | 2949 | |
| 2950 | 2950 | $ciphertext = $cipher->encrypt($plaintext); |
| 2951 | 2951 | |
| 2952 | 2952 | // Save new file |
| 2953 | 2953 | $hash = md5($plaintext); |
| 2954 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
| 2954 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
| 2955 | 2955 | file_put_contents($fileOut, $ciphertext); |
| 2956 | - unlink($fileInPath . '/' . $fileInName); |
|
| 2956 | + unlink($fileInPath.'/'.$fileInName); |
|
| 2957 | 2957 | |
| 2958 | 2958 | return array( |
| 2959 | 2959 | 'fileHash' => base64_encode($hash), |
@@ -2996,7 +2996,7 @@ discard block |
||
| 2996 | 2996 | $cipher->disablePadding(); |
| 2997 | 2997 | |
| 2998 | 2998 | // Get file content |
| 2999 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
| 2999 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
| 3000 | 3000 | |
| 3001 | 3001 | // Decrypt file content and return |
| 3002 | 3002 | return base64_encode($cipher->decrypt($ciphertext)); |
@@ -3052,8 +3052,8 @@ discard block |
||
| 3052 | 3052 | $SETTINGS |
| 3053 | 3053 | ) { |
| 3054 | 3054 | // include librairies & connect to DB |
| 3055 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 3056 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3055 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 3056 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3057 | 3057 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3058 | 3058 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3059 | 3059 | } |
@@ -3072,7 +3072,7 @@ discard block |
||
| 3072 | 3072 | ); |
| 3073 | 3073 | |
| 3074 | 3074 | // Superglobals |
| 3075 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 3075 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 3076 | 3076 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 3077 | 3077 | |
| 3078 | 3078 | // Prepare superGlobal variables |
@@ -3099,8 +3099,8 @@ discard block |
||
| 3099 | 3099 | // Create sharekey for each user |
| 3100 | 3100 | $users = DB::query( |
| 3101 | 3101 | 'SELECT id, public_key |
| 3102 | - FROM ' . prefixTable('users') . ' |
|
| 3103 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
| 3102 | + FROM ' . prefixTable('users').' |
|
| 3103 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
| 3104 | 3104 | AND public_key != ""' |
| 3105 | 3105 | ); |
| 3106 | 3106 | foreach ($users as $user) { |
@@ -3201,13 +3201,13 @@ discard block |
||
| 3201 | 3201 | ]; |
| 3202 | 3202 | |
| 3203 | 3203 | // Load expected libraries |
| 3204 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 3205 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 3206 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 3207 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 3208 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 3209 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 3210 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 3204 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 3205 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 3206 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 3207 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 3208 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 3209 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 3210 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 3211 | 3211 | |
| 3212 | 3212 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 3213 | 3213 | $ad->register(); |
@@ -3220,7 +3220,7 @@ discard block |
||
| 3220 | 3220 | } catch (\LdapRecord\Auth\BindException $e) { |
| 3221 | 3221 | $error = $e->getDetailedError(); |
| 3222 | 3222 | |
| 3223 | - echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(); |
|
| 3223 | + echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(); |
|
| 3224 | 3224 | return false; |
| 3225 | 3225 | } |
| 3226 | 3226 | |
@@ -3231,7 +3231,7 @@ discard block |
||
| 3231 | 3231 | } catch (\LdapRecord\Auth\BindException $e) { |
| 3232 | 3232 | $error = $e->getDetailedError(); |
| 3233 | 3233 | |
| 3234 | - echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(); |
|
| 3234 | + echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(); |
|
| 3235 | 3235 | return false; |
| 3236 | 3236 | } |
| 3237 | 3237 | |
@@ -3252,8 +3252,8 @@ discard block |
||
| 3252 | 3252 | function deleteUserObjetsKeys($userId, $SETTINGS) |
| 3253 | 3253 | { |
| 3254 | 3254 | // include librairies & connect to DB |
| 3255 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 3256 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3255 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 3256 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3257 | 3257 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3258 | 3258 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3259 | 3259 | } |
@@ -3314,7 +3314,7 @@ discard block |
||
| 3314 | 3314 | foreach (DateTimeZone::listIdentifiers() as $timezone) { |
| 3315 | 3315 | $now->setTimezone(new DateTimeZone($timezone)); |
| 3316 | 3316 | $offsets[] = $offset = $now->getOffset(); |
| 3317 | - $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); |
|
| 3317 | + $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone); |
|
| 3318 | 3318 | } |
| 3319 | 3319 | |
| 3320 | 3320 | array_multisort($offsets, $timezones); |
@@ -3326,7 +3326,7 @@ discard block |
||
| 3326 | 3326 | function format_GMT_offset($offset) { |
| 3327 | 3327 | $hours = intval($offset / 3600); |
| 3328 | 3328 | $minutes = abs(intval($offset % 3600 / 60)); |
| 3329 | - return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
| 3329 | + return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
| 3330 | 3330 | } |
| 3331 | 3331 | |
| 3332 | 3332 | function format_timezone_name($name) { |
@@ -3352,7 +3352,7 @@ discard block |
||
| 3352 | 3352 | } |
| 3353 | 3353 | |
| 3354 | 3354 | $mfaRoles = array_values(json_decode($mfaRoles, true)); |
| 3355 | - $userRolesIds = array_filter(explode(';' , $userRolesIds)); |
|
| 3355 | + $userRolesIds = array_filter(explode(';', $userRolesIds)); |
|
| 3356 | 3356 | |
| 3357 | 3357 | if (count($mfaRoles) === 0 || count($mfaRoles) === 0) { |
| 3358 | 3358 | return true; |