@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $var_dk = ''; // Derived key |
| 106 | 106 | |
| 107 | 107 | for ($block = 1; $block <= $var_kb; ++$block) { // Create key |
| 108 | - $var_ib = $var_h = hash_hmac($var_a, $var_s . pack('N', $block), $var_p, true); // Initial hash for this block |
|
| 108 | + $var_ib = $var_h = hash_hmac($var_a, $var_s.pack('N', $block), $var_p, true); // Initial hash for this block |
|
| 109 | 109 | for ($var_i = 1; $var_i < $var_c; ++$var_i) { // Perform block iterations |
| 110 | 110 | $var_ib ^= ($var_h = hash_hmac($var_a, $var_h, $var_p, true)); // XOR each iterate |
| 111 | 111 | } |
@@ -339,25 +339,25 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | function cryption($message, $ascii_key, $type, $SETTINGS) |
| 341 | 341 | { |
| 342 | - $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key; |
|
| 342 | + $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key; |
|
| 343 | 343 | $err = false; |
| 344 | 344 | |
| 345 | 345 | // load PhpEncryption library |
| 346 | 346 | if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) { |
| 347 | 347 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 348 | 348 | } else { |
| 349 | - $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/'; |
|
| 349 | + $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - include_once $path . 'Crypto.php'; |
|
| 353 | - include_once $path . 'Encoding.php'; |
|
| 354 | - include_once $path . 'DerivedKeys.php'; |
|
| 355 | - include_once $path . 'Key.php'; |
|
| 356 | - include_once $path . 'KeyOrPassword.php'; |
|
| 357 | - include_once $path . 'File.php'; |
|
| 358 | - include_once $path . 'RuntimeTests.php'; |
|
| 359 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 360 | - include_once $path . 'Core.php'; |
|
| 352 | + include_once $path.'Crypto.php'; |
|
| 353 | + include_once $path.'Encoding.php'; |
|
| 354 | + include_once $path.'DerivedKeys.php'; |
|
| 355 | + include_once $path.'Key.php'; |
|
| 356 | + include_once $path.'KeyOrPassword.php'; |
|
| 357 | + include_once $path.'File.php'; |
|
| 358 | + include_once $path.'RuntimeTests.php'; |
|
| 359 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 360 | + include_once $path.'Core.php'; |
|
| 361 | 361 | |
| 362 | 362 | // convert KEY |
| 363 | 363 | $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
@@ -403,15 +403,15 @@ discard block |
||
| 403 | 403 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - include_once $path . 'Crypto.php'; |
|
| 407 | - include_once $path . 'Encoding.php'; |
|
| 408 | - include_once $path . 'DerivedKeys.php'; |
|
| 409 | - include_once $path . 'Key.php'; |
|
| 410 | - include_once $path . 'KeyOrPassword.php'; |
|
| 411 | - include_once $path . 'File.php'; |
|
| 412 | - include_once $path . 'RuntimeTests.php'; |
|
| 413 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 414 | - include_once $path . 'Core.php'; |
|
| 406 | + include_once $path.'Crypto.php'; |
|
| 407 | + include_once $path.'Encoding.php'; |
|
| 408 | + include_once $path.'DerivedKeys.php'; |
|
| 409 | + include_once $path.'Key.php'; |
|
| 410 | + include_once $path.'KeyOrPassword.php'; |
|
| 411 | + include_once $path.'File.php'; |
|
| 412 | + include_once $path.'RuntimeTests.php'; |
|
| 413 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 414 | + include_once $path.'Core.php'; |
|
| 415 | 415 | |
| 416 | 416 | $key = \Defuse\Crypto\Key::createNewRandomKey(); |
| 417 | 417 | $key = $key->saveToAsciiSafeString(); |
@@ -437,15 +437,15 @@ discard block |
||
| 437 | 437 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - include_once $path . 'Crypto.php'; |
|
| 441 | - include_once $path . 'Encoding.php'; |
|
| 442 | - include_once $path . 'DerivedKeys.php'; |
|
| 443 | - include_once $path . 'Key.php'; |
|
| 444 | - include_once $path . 'KeyOrPassword.php'; |
|
| 445 | - include_once $path . 'File.php'; |
|
| 446 | - include_once $path . 'RuntimeTests.php'; |
|
| 447 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 448 | - include_once $path . 'Core.php'; |
|
| 440 | + include_once $path.'Crypto.php'; |
|
| 441 | + include_once $path.'Encoding.php'; |
|
| 442 | + include_once $path.'DerivedKeys.php'; |
|
| 443 | + include_once $path.'Key.php'; |
|
| 444 | + include_once $path.'KeyOrPassword.php'; |
|
| 445 | + include_once $path.'File.php'; |
|
| 446 | + include_once $path.'RuntimeTests.php'; |
|
| 447 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 448 | + include_once $path.'Core.php'; |
|
| 449 | 449 | |
| 450 | 450 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk); |
| 451 | 451 | $protected_key_encoded = $protected_key->saveToAsciiSafeString(); |
@@ -472,15 +472,15 @@ discard block |
||
| 472 | 472 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - include_once $path . 'Crypto.php'; |
|
| 476 | - include_once $path . 'Encoding.php'; |
|
| 477 | - include_once $path . 'DerivedKeys.php'; |
|
| 478 | - include_once $path . 'Key.php'; |
|
| 479 | - include_once $path . 'KeyOrPassword.php'; |
|
| 480 | - include_once $path . 'File.php'; |
|
| 481 | - include_once $path . 'RuntimeTests.php'; |
|
| 482 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 483 | - include_once $path . 'Core.php'; |
|
| 475 | + include_once $path.'Crypto.php'; |
|
| 476 | + include_once $path.'Encoding.php'; |
|
| 477 | + include_once $path.'DerivedKeys.php'; |
|
| 478 | + include_once $path.'Key.php'; |
|
| 479 | + include_once $path.'KeyOrPassword.php'; |
|
| 480 | + include_once $path.'File.php'; |
|
| 481 | + include_once $path.'RuntimeTests.php'; |
|
| 482 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 483 | + include_once $path.'Core.php'; |
|
| 484 | 484 | |
| 485 | 485 | try { |
| 486 | 486 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | function db_error_handler($params) |
| 569 | 569 | { |
| 570 | - echo 'Error: ' . $params['error'] . "<br>\n"; |
|
| 571 | - echo 'Query: ' . $params['query'] . "<br>\n"; |
|
| 570 | + echo 'Error: '.$params['error']."<br>\n"; |
|
| 571 | + echo 'Query: '.$params['query']."<br>\n"; |
|
| 572 | 572 | throw new Exception('Error - Query', 1); |
| 573 | 573 | } |
| 574 | 574 | |
@@ -590,14 +590,14 @@ discard block |
||
| 590 | 590 | $SETTINGS |
| 591 | 591 | ) { |
| 592 | 592 | //load ClassLoader |
| 593 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 593 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 594 | 594 | |
| 595 | 595 | // Load superglobal |
| 596 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 596 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 597 | 597 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 598 | 598 | |
| 599 | 599 | //Connect to DB |
| 600 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 600 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 601 | 601 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 602 | 602 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 603 | 603 | } |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | DB::$encoding = DB_ENCODING; |
| 610 | 610 | |
| 611 | 611 | //Build tree |
| 612 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 612 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 613 | 613 | $tree->register(); |
| 614 | 614 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 615 | 615 | |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | function identAdmin($idFonctions, $SETTINGS, $tree) |
| 652 | 652 | { |
| 653 | 653 | // Load superglobal |
| 654 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 654 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 655 | 655 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 656 | 656 | |
| 657 | 657 | // Init |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION'); |
| 674 | 674 | |
| 675 | 675 | // Get list of Folders |
| 676 | - $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
| 676 | + $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
| 677 | 677 | foreach ($rows as $record) { |
| 678 | 678 | array_push($groupesVisibles, $record['id']); |
| 679 | 679 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | } |
| 693 | 693 | // Get ID of personal folder |
| 694 | 694 | $persfld = DB::queryfirstrow( |
| 695 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', |
|
| 695 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s', |
|
| 696 | 696 | $globalsUserId |
| 697 | 697 | ); |
| 698 | 698 | if (empty($persfld['id']) === false) { |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | // get complete list of ROLES |
| 714 | 714 | $tmp = explode(';', $idFonctions); |
| 715 | 715 | $rows = DB::query( |
| 716 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 716 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 717 | 717 | ORDER BY title ASC' |
| 718 | 718 | ); |
| 719 | 719 | foreach ($rows as $record) { |
@@ -725,9 +725,9 @@ discard block |
||
| 725 | 725 | $superGlobal->put('is_admin', 1, 'SESSION'); |
| 726 | 726 | |
| 727 | 727 | // Check if admin has created Folders and Roles |
| 728 | - DB::query('SELECT * FROM ' . prefixTable('nested_tree') . ''); |
|
| 728 | + DB::query('SELECT * FROM '.prefixTable('nested_tree').''); |
|
| 729 | 729 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 730 | - DB::query('SELECT * FROM ' . prefixTable('roles_title')); |
|
| 730 | + DB::query('SELECT * FROM '.prefixTable('roles_title')); |
|
| 731 | 731 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 732 | 732 | } |
| 733 | 733 | |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | $tree |
| 772 | 772 | ) { |
| 773 | 773 | // Load superglobal |
| 774 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 774 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 775 | 775 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 776 | 776 | |
| 777 | 777 | // Init |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | // Get list of folders depending on Roles |
| 805 | 805 | $rows = DB::query( |
| 806 | 806 | 'SELECT * |
| 807 | - FROM ' . prefixTable('roles_values') . ' |
|
| 807 | + FROM ' . prefixTable('roles_values').' |
|
| 808 | 808 | WHERE role_id IN %li AND type IN %ls', |
| 809 | 809 | $userRoles, |
| 810 | 810 | array('W', 'ND', 'NE', 'NDNE', 'R') |
@@ -829,9 +829,9 @@ discard block |
||
| 829 | 829 | // Does this user is allowed to see other items |
| 830 | 830 | $inc = 0; |
| 831 | 831 | $rows = DB::query( |
| 832 | - 'SELECT id, id_tree FROM ' . prefixTable('items') . ' |
|
| 832 | + 'SELECT id, id_tree FROM '.prefixTable('items').' |
|
| 833 | 833 | WHERE restricted_to LIKE %ss AND inactif = %s', |
| 834 | - $globalsUserId . ';', |
|
| 834 | + $globalsUserId.';', |
|
| 835 | 835 | '0' |
| 836 | 836 | ); |
| 837 | 837 | foreach ($rows as $record) { |
@@ -845,8 +845,8 @@ discard block |
||
| 845 | 845 | // Check for the users roles if some specific rights exist on items |
| 846 | 846 | $rows = DB::query( |
| 847 | 847 | 'SELECT i.id_tree, r.item_id |
| 848 | - FROM ' . prefixTable('items') . ' as i |
|
| 849 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id) |
|
| 848 | + FROM ' . prefixTable('items').' as i |
|
| 849 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id) |
|
| 850 | 850 | WHERE r.role_id IN %li |
| 851 | 851 | ORDER BY i.id_tree ASC', |
| 852 | 852 | $userRoles |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | ) { |
| 868 | 868 | $persoFld = DB::queryfirstrow( |
| 869 | 869 | 'SELECT id |
| 870 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 870 | + FROM ' . prefixTable('nested_tree').' |
|
| 871 | 871 | WHERE title = %s AND personal_folder = %i', |
| 872 | 872 | $globalsUserId, |
| 873 | 873 | 1 |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | } |
| 902 | 902 | $persoFlds = DB::query( |
| 903 | 903 | 'SELECT id |
| 904 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 904 | + FROM ' . prefixTable('nested_tree').' |
|
| 905 | 905 | WHERE %l', |
| 906 | 906 | $where |
| 907 | 907 | ); |
@@ -944,17 +944,17 @@ discard block |
||
| 944 | 944 | ); |
| 945 | 945 | |
| 946 | 946 | // Folders and Roles numbers |
| 947 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
| 947 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
| 948 | 948 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 949 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
| 949 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
| 950 | 950 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 951 | 951 | |
| 952 | 952 | // check if change proposals on User's items |
| 953 | 953 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
| 954 | 954 | DB::query( |
| 955 | 955 | 'SELECT * |
| 956 | - FROM ' . prefixTable('items_change') . ' AS c |
|
| 957 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
| 956 | + FROM ' . prefixTable('items_change').' AS c |
|
| 957 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
| 958 | 958 | WHERE i.action = %s AND i.id_user = %i', |
| 959 | 959 | 'at_creation', |
| 960 | 960 | $globalsUserId |
@@ -998,10 +998,10 @@ discard block |
||
| 998 | 998 | */ |
| 999 | 999 | function cacheTableRefresh($SETTINGS) |
| 1000 | 1000 | { |
| 1001 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1001 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1002 | 1002 | |
| 1003 | 1003 | //Connect to DB |
| 1004 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1004 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1005 | 1005 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1006 | 1006 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1007 | 1007 | } |
@@ -1018,13 +1018,13 @@ discard block |
||
| 1018 | 1018 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1019 | 1019 | |
| 1020 | 1020 | // truncate table |
| 1021 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
| 1021 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
| 1022 | 1022 | |
| 1023 | 1023 | // reload date |
| 1024 | 1024 | $rows = DB::query( |
| 1025 | 1025 | 'SELECT * |
| 1026 | - FROM ' . prefixTable('items') . ' as i |
|
| 1027 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1026 | + FROM ' . prefixTable('items').' as i |
|
| 1027 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1028 | 1028 | AND l.action = %s |
| 1029 | 1029 | AND i.inactif = %i', |
| 1030 | 1030 | 'at_creation', |
@@ -1036,18 +1036,18 @@ discard block |
||
| 1036 | 1036 | $tags = ''; |
| 1037 | 1037 | $itemTags = DB::query( |
| 1038 | 1038 | 'SELECT tag |
| 1039 | - FROM ' . prefixTable('tags') . ' |
|
| 1039 | + FROM ' . prefixTable('tags').' |
|
| 1040 | 1040 | WHERE item_id = %i AND tag != ""', |
| 1041 | 1041 | $record['id'] |
| 1042 | 1042 | ); |
| 1043 | 1043 | foreach ($itemTags as $itemTag) { |
| 1044 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1044 | + $tags .= $itemTag['tag'].' '; |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | // Get renewal period |
| 1048 | 1048 | $resNT = DB::queryfirstrow( |
| 1049 | 1049 | 'SELECT renewal_period |
| 1050 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 1050 | + FROM ' . prefixTable('nested_tree').' |
|
| 1051 | 1051 | WHERE id = %i', |
| 1052 | 1052 | $record['id_tree'] |
| 1053 | 1053 | ); |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | // Is this a User id? |
| 1062 | 1062 | $user = DB::queryfirstrow( |
| 1063 | 1063 | 'SELECT id, login |
| 1064 | - FROM ' . prefixTable('users') . ' |
|
| 1064 | + FROM ' . prefixTable('users').' |
|
| 1065 | 1065 | WHERE id = %i', |
| 1066 | 1066 | $elem->title |
| 1067 | 1067 | ); |
@@ -1103,14 +1103,14 @@ discard block |
||
| 1103 | 1103 | */ |
| 1104 | 1104 | function cacheTableUpdate($SETTINGS, $ident = null) |
| 1105 | 1105 | { |
| 1106 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1106 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1107 | 1107 | |
| 1108 | 1108 | // Load superglobal |
| 1109 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1109 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1110 | 1110 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1111 | 1111 | |
| 1112 | 1112 | //Connect to DB |
| 1113 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1113 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1114 | 1114 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1115 | 1115 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1116 | 1116 | } |
@@ -1129,7 +1129,7 @@ discard block |
||
| 1129 | 1129 | // get new value from db |
| 1130 | 1130 | $data = DB::queryfirstrow( |
| 1131 | 1131 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
| 1132 | - FROM ' . prefixTable('items') . ' |
|
| 1132 | + FROM ' . prefixTable('items').' |
|
| 1133 | 1133 | WHERE id=%i', |
| 1134 | 1134 | $ident |
| 1135 | 1135 | ); |
@@ -1137,12 +1137,12 @@ discard block |
||
| 1137 | 1137 | $tags = ''; |
| 1138 | 1138 | $itemTags = DB::query( |
| 1139 | 1139 | 'SELECT tag |
| 1140 | - FROM ' . prefixTable('tags') . ' |
|
| 1140 | + FROM ' . prefixTable('tags').' |
|
| 1141 | 1141 | WHERE item_id = %i AND tag != ""', |
| 1142 | 1142 | $ident |
| 1143 | 1143 | ); |
| 1144 | 1144 | foreach ($itemTags as $itemTag) { |
| 1145 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1145 | + $tags .= $itemTag['tag'].' '; |
|
| 1146 | 1146 | } |
| 1147 | 1147 | // form id_tree to full foldername |
| 1148 | 1148 | $folder = array(); |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | // Is this a User id? |
| 1154 | 1154 | $user = DB::queryfirstrow( |
| 1155 | 1155 | 'SELECT id, login |
| 1156 | - FROM ' . prefixTable('users') . ' |
|
| 1156 | + FROM ' . prefixTable('users').' |
|
| 1157 | 1157 | WHERE id = %i', |
| 1158 | 1158 | $elem->title |
| 1159 | 1159 | ); |
@@ -1192,17 +1192,17 @@ discard block |
||
| 1192 | 1192 | */ |
| 1193 | 1193 | function cacheTableAdd($SETTINGS, $ident = null) |
| 1194 | 1194 | { |
| 1195 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1195 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1196 | 1196 | |
| 1197 | 1197 | // Load superglobal |
| 1198 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1198 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1199 | 1199 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1200 | 1200 | |
| 1201 | 1201 | // Get superglobals |
| 1202 | 1202 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
| 1203 | 1203 | |
| 1204 | 1204 | //Connect to DB |
| 1205 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1205 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1206 | 1206 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1207 | 1207 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1208 | 1208 | } |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | // get new value from db |
| 1222 | 1222 | $data = DB::queryFirstRow( |
| 1223 | 1223 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
| 1224 | - FROM ' . prefixTable('items') . ' as i |
|
| 1225 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1224 | + FROM ' . prefixTable('items').' as i |
|
| 1225 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1226 | 1226 | WHERE i.id = %i |
| 1227 | 1227 | AND l.action = %s', |
| 1228 | 1228 | $ident, |
@@ -1232,12 +1232,12 @@ discard block |
||
| 1232 | 1232 | $tags = ''; |
| 1233 | 1233 | $itemTags = DB::query( |
| 1234 | 1234 | 'SELECT tag |
| 1235 | - FROM ' . prefixTable('tags') . ' |
|
| 1235 | + FROM ' . prefixTable('tags').' |
|
| 1236 | 1236 | WHERE item_id = %i AND tag != ""', |
| 1237 | 1237 | $ident |
| 1238 | 1238 | ); |
| 1239 | 1239 | foreach ($itemTags as $itemTag) { |
| 1240 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1240 | + $tags .= $itemTag['tag'].' '; |
|
| 1241 | 1241 | } |
| 1242 | 1242 | // form id_tree to full foldername |
| 1243 | 1243 | $folder = array(); |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | // Is this a User id? |
| 1249 | 1249 | $user = DB::queryfirstrow( |
| 1250 | 1250 | 'SELECT id, login |
| 1251 | - FROM ' . prefixTable('users') . ' |
|
| 1251 | + FROM ' . prefixTable('users').' |
|
| 1252 | 1252 | WHERE id = %i', |
| 1253 | 1253 | $elem->title |
| 1254 | 1254 | ); |
@@ -1289,48 +1289,48 @@ discard block |
||
| 1289 | 1289 | function getStatisticsData($SETTINGS) |
| 1290 | 1290 | { |
| 1291 | 1291 | DB::query( |
| 1292 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1292 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1293 | 1293 | 0 |
| 1294 | 1294 | ); |
| 1295 | 1295 | $counter_folders = DB::count(); |
| 1296 | 1296 | |
| 1297 | 1297 | DB::query( |
| 1298 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1298 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1299 | 1299 | 1 |
| 1300 | 1300 | ); |
| 1301 | 1301 | $counter_folders_perso = DB::count(); |
| 1302 | 1302 | |
| 1303 | 1303 | DB::query( |
| 1304 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1304 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1305 | 1305 | 0 |
| 1306 | 1306 | ); |
| 1307 | 1307 | $counter_items = DB::count(); |
| 1308 | 1308 | |
| 1309 | 1309 | DB::query( |
| 1310 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1310 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1311 | 1311 | 1 |
| 1312 | 1312 | ); |
| 1313 | 1313 | $counter_items_perso = DB::count(); |
| 1314 | 1314 | |
| 1315 | 1315 | DB::query( |
| 1316 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
| 1316 | + 'SELECT id FROM '.prefixTable('users').'' |
|
| 1317 | 1317 | ); |
| 1318 | 1318 | $counter_users = DB::count(); |
| 1319 | 1319 | |
| 1320 | 1320 | DB::query( |
| 1321 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
| 1321 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
| 1322 | 1322 | 1 |
| 1323 | 1323 | ); |
| 1324 | 1324 | $admins = DB::count(); |
| 1325 | 1325 | |
| 1326 | 1326 | DB::query( |
| 1327 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
| 1327 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
| 1328 | 1328 | 1 |
| 1329 | 1329 | ); |
| 1330 | 1330 | $managers = DB::count(); |
| 1331 | 1331 | |
| 1332 | 1332 | DB::query( |
| 1333 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
| 1333 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
| 1334 | 1334 | 1 |
| 1335 | 1335 | ); |
| 1336 | 1336 | $readOnly = DB::count(); |
@@ -1338,11 +1338,11 @@ discard block |
||
| 1338 | 1338 | // list the languages |
| 1339 | 1339 | $usedLang = []; |
| 1340 | 1340 | $tp_languages = DB::query( |
| 1341 | - 'SELECT name FROM ' . prefixTable('languages') |
|
| 1341 | + 'SELECT name FROM '.prefixTable('languages') |
|
| 1342 | 1342 | ); |
| 1343 | 1343 | foreach ($tp_languages as $tp_language) { |
| 1344 | 1344 | DB::query( |
| 1345 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
| 1345 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
| 1346 | 1346 | $tp_language['name'] |
| 1347 | 1347 | ); |
| 1348 | 1348 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | // get list of ips |
| 1352 | 1352 | $usedIp = []; |
| 1353 | 1353 | $tp_ips = DB::query( |
| 1354 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
| 1354 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
| 1355 | 1355 | ); |
| 1356 | 1356 | foreach ($tp_ips as $ip) { |
| 1357 | 1357 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
@@ -1413,23 +1413,23 @@ discard block |
||
| 1413 | 1413 | ) { |
| 1414 | 1414 | // CAse where email not defined |
| 1415 | 1415 | if ($email === 'none' || empty($email) === true) { |
| 1416 | - return '"error":"" , "message":"' . langHdl('forgot_my_pw_email_sent') . '"'; |
|
| 1416 | + return '"error":"" , "message":"'.langHdl('forgot_my_pw_email_sent').'"'; |
|
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | // Load settings |
| 1420 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 1420 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 1421 | 1421 | |
| 1422 | 1422 | // Load superglobal |
| 1423 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1423 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1424 | 1424 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1425 | 1425 | |
| 1426 | 1426 | // Get user language |
| 1427 | 1427 | $session_user_language = $superGlobal->get('user_language', 'SESSION'); |
| 1428 | 1428 | $user_language = isset($session_user_language) ? $session_user_language : 'english'; |
| 1429 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $user_language . '.php'; |
|
| 1429 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$user_language.'.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'; |
@@ -1534,7 +1534,7 @@ discard block |
||
| 1534 | 1534 | <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;"> |
| 1535 | 1535 | <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;"> |
| 1536 | 1536 | <br><div style="float:right;">' . |
| 1537 | - $textMail . |
|
| 1537 | + $textMail. |
|
| 1538 | 1538 | '<br><br></td></tr></table> |
| 1539 | 1539 | </td></tr></table> |
| 1540 | 1540 | <br></body></html>'; |
@@ -1547,7 +1547,7 @@ discard block |
||
| 1547 | 1547 | */ |
| 1548 | 1548 | function generateKey() |
| 1549 | 1549 | { |
| 1550 | - return substr(md5(rand() . rand()), 0, 15); |
|
| 1550 | + return substr(md5(rand().rand()), 0, 15); |
|
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | 1553 | /** |
@@ -1617,7 +1617,7 @@ discard block |
||
| 1617 | 1617 | { |
| 1618 | 1618 | array_walk_recursive( |
| 1619 | 1619 | $array, |
| 1620 | - function (&$item) { |
|
| 1620 | + function(&$item) { |
|
| 1621 | 1621 | if (mb_detect_encoding($item, 'utf-8', true) === false) { |
| 1622 | 1622 | $item = utf8_encode($item); |
| 1623 | 1623 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | 1655 | // Load superglobal |
| 1656 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1656 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1657 | 1657 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1658 | 1658 | |
| 1659 | 1659 | // Get superglobals |
@@ -1665,9 +1665,9 @@ discard block |
||
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | //load ClassLoader |
| 1668 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1668 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1669 | 1669 | //Load AES |
| 1670 | - $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1670 | + $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1671 | 1671 | $aes->register(); |
| 1672 | 1672 | |
| 1673 | 1673 | if ($type === 'encode' && is_array($data) === true) { |
@@ -1722,7 +1722,7 @@ discard block |
||
| 1722 | 1722 | function makeThumbnail($src, $dest, $desired_width) |
| 1723 | 1723 | { |
| 1724 | 1724 | /* read the source image */ |
| 1725 | - if(is_file($src) === true && mime_content_type($src) === 'image/png'){ |
|
| 1725 | + if (is_file($src) === true && mime_content_type($src) === 'image/png') { |
|
| 1726 | 1726 | $source_image = imagecreatefrompng($src); |
| 1727 | 1727 | if ($source_image === false) { |
| 1728 | 1728 | return "Error: Not a valid PNG file! It's type is ".mime_content_type($src); |
@@ -1759,7 +1759,7 @@ discard block |
||
| 1759 | 1759 | */ |
| 1760 | 1760 | function prefixTable($table) |
| 1761 | 1761 | { |
| 1762 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
| 1762 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
| 1763 | 1763 | if (!empty($safeTable)) { |
| 1764 | 1764 | // sanitize string |
| 1765 | 1765 | return $safeTable; |
@@ -1791,14 +1791,14 @@ discard block |
||
| 1791 | 1791 | $lowercase = false, |
| 1792 | 1792 | $SETTINGS |
| 1793 | 1793 | ) { |
| 1794 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1795 | - $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1794 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1795 | + $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1796 | 1796 | $generator->register(); |
| 1797 | 1797 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
| 1798 | 1798 | |
| 1799 | 1799 | // Is PHP7 being used? |
| 1800 | 1800 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
| 1801 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1801 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1802 | 1802 | $php7generator->register(); |
| 1803 | 1803 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
| 1804 | 1804 | } |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | function send_syslog($message, $host, $port, $component = 'teampass') |
| 1830 | 1830 | { |
| 1831 | 1831 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
| 1832 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
| 1832 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
| 1833 | 1833 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
| 1834 | 1834 | socket_close($sock); |
| 1835 | 1835 | } |
@@ -1853,7 +1853,7 @@ discard block |
||
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | // include librairies & connect to DB |
| 1856 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1856 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1857 | 1857 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1858 | 1858 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1859 | 1859 | } |
@@ -1879,14 +1879,14 @@ discard block |
||
| 1879 | 1879 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
| 1880 | 1880 | if ($type === 'user_mngt') { |
| 1881 | 1881 | send_syslog( |
| 1882 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
| 1882 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
| 1883 | 1883 | $SETTINGS['syslog_host'], |
| 1884 | 1884 | $SETTINGS['syslog_port'], |
| 1885 | 1885 | 'teampass' |
| 1886 | 1886 | ); |
| 1887 | 1887 | } else { |
| 1888 | 1888 | send_syslog( |
| 1889 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
| 1889 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
| 1890 | 1890 | $SETTINGS['syslog_host'], |
| 1891 | 1891 | $SETTINGS['syslog_port'], |
| 1892 | 1892 | 'teampass' |
@@ -1918,7 +1918,7 @@ discard block |
||
| 1918 | 1918 | $encryption_type = null |
| 1919 | 1919 | ) { |
| 1920 | 1920 | // include librairies & connect to DB |
| 1921 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1921 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1922 | 1922 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1923 | 1923 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1924 | 1924 | } |
@@ -1964,7 +1964,7 @@ discard block |
||
| 1964 | 1964 | if (empty($item_label) === true) { |
| 1965 | 1965 | $dataItem = DB::queryfirstrow( |
| 1966 | 1966 | 'SELECT id, id_tree, label |
| 1967 | - FROM ' . prefixTable('items') . ' |
|
| 1967 | + FROM ' . prefixTable('items').' |
|
| 1968 | 1968 | WHERE id = %i', |
| 1969 | 1969 | $item_id |
| 1970 | 1970 | ); |
@@ -1973,7 +1973,7 @@ discard block |
||
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | send_syslog( |
| 1976 | - 'action=' . str_replace('at_', '', $action) . ' attribute=' . str_replace('at_', '', $attribute[0]) . ' itemno=' . $item_id . ' user=' . addslashes($login) . ' itemname="' . addslashes($item_label) . '"', |
|
| 1976 | + 'action='.str_replace('at_', '', $action).' attribute='.str_replace('at_', '', $attribute[0]).' itemno='.$item_id.' user='.addslashes($login).' itemname="'.addslashes($item_label).'"', |
|
| 1977 | 1977 | $SETTINGS['syslog_host'], |
| 1978 | 1978 | $SETTINGS['syslog_port'], |
| 1979 | 1979 | 'teampass' |
@@ -1999,7 +1999,7 @@ discard block |
||
| 1999 | 1999 | && $action === 'at_shown' |
| 2000 | 2000 | ) { |
| 2001 | 2001 | // Load superglobal |
| 2002 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2002 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2003 | 2003 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2004 | 2004 | |
| 2005 | 2005 | // Get superglobals |
@@ -2010,7 +2010,7 @@ discard block |
||
| 2010 | 2010 | // Get info about item |
| 2011 | 2011 | $dataItem = DB::queryfirstrow( |
| 2012 | 2012 | 'SELECT id, id_tree, label |
| 2013 | - FROM ' . prefixTable('items') . ' |
|
| 2013 | + FROM ' . prefixTable('items').' |
|
| 2014 | 2014 | WHERE id = %i', |
| 2015 | 2015 | $item_id |
| 2016 | 2016 | ); |
@@ -2025,9 +2025,9 @@ discard block |
||
| 2025 | 2025 | 'body' => str_replace( |
| 2026 | 2026 | array('#tp_user#', '#tp_item#', '#tp_link#'), |
| 2027 | 2027 | array( |
| 2028 | - addslashes($globalsName . ' ' . $globalsLastname), |
|
| 2028 | + addslashes($globalsName.' '.$globalsLastname), |
|
| 2029 | 2029 | addslashes($item_label), |
| 2030 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id, |
|
| 2030 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id, |
|
| 2031 | 2031 | ), |
| 2032 | 2032 | langHdl('email_on_open_notification_mail') |
| 2033 | 2033 | ), |
@@ -2049,7 +2049,7 @@ discard block |
||
| 2049 | 2049 | function notifyChangesToSubscribers($item_id, $label, $changes, $SETTINGS) |
| 2050 | 2050 | { |
| 2051 | 2051 | // Load superglobal |
| 2052 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2052 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2053 | 2053 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2054 | 2054 | |
| 2055 | 2055 | // Get superglobals |
@@ -2061,8 +2061,8 @@ discard block |
||
| 2061 | 2061 | $notification = DB::queryOneColumn( |
| 2062 | 2062 | 'email', |
| 2063 | 2063 | 'SELECT * |
| 2064 | - FROM ' . prefixTable('notification') . ' AS n |
|
| 2065 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
| 2064 | + FROM ' . prefixTable('notification').' AS n |
|
| 2065 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
| 2066 | 2066 | WHERE n.item_id = %i AND n.user_id != %i', |
| 2067 | 2067 | $item_id, |
| 2068 | 2068 | $globalsUserId |
@@ -2075,7 +2075,7 @@ discard block |
||
| 2075 | 2075 | // Get list of changes |
| 2076 | 2076 | $htmlChanges = '<ul>'; |
| 2077 | 2077 | foreach ($changes as $change) { |
| 2078 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
| 2078 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
| 2079 | 2079 | } |
| 2080 | 2080 | $htmlChanges .= '</ul>'; |
| 2081 | 2081 | |
@@ -2109,7 +2109,7 @@ discard block |
||
| 2109 | 2109 | function geItemReadablePath($id_tree, $label, $SETTINGS) |
| 2110 | 2110 | { |
| 2111 | 2111 | // Class loader |
| 2112 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 2112 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 2113 | 2113 | |
| 2114 | 2114 | //Load Tree |
| 2115 | 2115 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
@@ -2120,15 +2120,15 @@ discard block |
||
| 2120 | 2120 | $path = ''; |
| 2121 | 2121 | foreach ($arbo as $elem) { |
| 2122 | 2122 | if (empty($path) === true) { |
| 2123 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 2123 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 2124 | 2124 | } else { |
| 2125 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2125 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2126 | 2126 | } |
| 2127 | 2127 | } |
| 2128 | 2128 | |
| 2129 | 2129 | // Build text to show user |
| 2130 | 2130 | if (empty($label) === false) { |
| 2131 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
| 2131 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
| 2132 | 2132 | } else { |
| 2133 | 2133 | return empty($path) === true ? '' : $path; |
| 2134 | 2134 | } |
@@ -2187,10 +2187,10 @@ discard block |
||
| 2187 | 2187 | */ |
| 2188 | 2188 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
| 2189 | 2189 | { |
| 2190 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
| 2190 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
| 2191 | 2191 | |
| 2192 | 2192 | // include librairies & connect to DB |
| 2193 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2193 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2194 | 2194 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2195 | 2195 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2196 | 2196 | } |
@@ -2204,8 +2204,8 @@ discard block |
||
| 2204 | 2204 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
| 2205 | 2205 | // perform a copy |
| 2206 | 2206 | if (file_exists($tp_config_file)) { |
| 2207 | - if (!copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
| 2208 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
| 2207 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
| 2208 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
| 2209 | 2209 | } |
| 2210 | 2210 | } |
| 2211 | 2211 | |
@@ -2216,11 +2216,11 @@ discard block |
||
| 2216 | 2216 | $data[1] = "global \$SETTINGS;\n"; |
| 2217 | 2217 | $data[2] = "\$SETTINGS = array (\n"; |
| 2218 | 2218 | $rows = DB::query( |
| 2219 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
| 2219 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
| 2220 | 2220 | 'admin' |
| 2221 | 2221 | ); |
| 2222 | 2222 | foreach ($rows as $record) { |
| 2223 | - array_push($data, " '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n"); |
|
| 2223 | + array_push($data, " '".$record['intitule']."' => '".$record['valeur']."',\n"); |
|
| 2224 | 2224 | } |
| 2225 | 2225 | array_push($data, ");\n"); |
| 2226 | 2226 | $data = array_unique($data); |
@@ -2234,15 +2234,15 @@ discard block |
||
| 2234 | 2234 | break; |
| 2235 | 2235 | } |
| 2236 | 2236 | |
| 2237 | - if (stristr($line, "'" . $field . "' => '")) { |
|
| 2238 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n"; |
|
| 2237 | + if (stristr($line, "'".$field."' => '")) { |
|
| 2238 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n"; |
|
| 2239 | 2239 | $bFound = true; |
| 2240 | 2240 | break; |
| 2241 | 2241 | } |
| 2242 | 2242 | ++$inc; |
| 2243 | 2243 | } |
| 2244 | 2244 | if ($bFound === false) { |
| 2245 | - $data[($inc)] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n"; |
|
| 2245 | + $data[($inc)] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n"; |
|
| 2246 | 2246 | } |
| 2247 | 2247 | } |
| 2248 | 2248 | |
@@ -2280,7 +2280,7 @@ discard block |
||
| 2280 | 2280 | $settings = array(); |
| 2281 | 2281 | |
| 2282 | 2282 | $rows = DB::query( |
| 2283 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
| 2283 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
| 2284 | 2284 | array( |
| 2285 | 2285 | 'type' => 'admin', |
| 2286 | 2286 | 'type2' => 'settings', |
@@ -2307,7 +2307,7 @@ discard block |
||
| 2307 | 2307 | $source_cf = array(); |
| 2308 | 2308 | $rows = DB::QUERY( |
| 2309 | 2309 | 'SELECT id_category |
| 2310 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2310 | + FROM ' . prefixTable('categories_folders').' |
|
| 2311 | 2311 | WHERE id_folder = %i', |
| 2312 | 2312 | $source_id |
| 2313 | 2313 | ); |
@@ -2318,7 +2318,7 @@ discard block |
||
| 2318 | 2318 | $target_cf = array(); |
| 2319 | 2319 | $rows = DB::QUERY( |
| 2320 | 2320 | 'SELECT id_category |
| 2321 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2321 | + FROM ' . prefixTable('categories_folders').' |
|
| 2322 | 2322 | WHERE id_folder = %i', |
| 2323 | 2323 | $target_id |
| 2324 | 2324 | ); |
@@ -2353,9 +2353,9 @@ discard block |
||
| 2353 | 2353 | $password = null |
| 2354 | 2354 | ) { |
| 2355 | 2355 | // Load AntiXSS |
| 2356 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2357 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2358 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2356 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2357 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2358 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2359 | 2359 | $antiXss = new voku\helper\AntiXSS(); |
| 2360 | 2360 | |
| 2361 | 2361 | // Protect against bad inputs |
@@ -2369,7 +2369,7 @@ discard block |
||
| 2369 | 2369 | |
| 2370 | 2370 | if (empty($password) === true || is_null($password) === true) { |
| 2371 | 2371 | // get KEY to define password |
| 2372 | - $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
| 2372 | + $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
| 2373 | 2373 | $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
| 2374 | 2374 | } |
| 2375 | 2375 | |
@@ -2415,15 +2415,15 @@ discard block |
||
| 2415 | 2415 | ) { |
| 2416 | 2416 | // load PhpEncryption library |
| 2417 | 2417 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2418 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2419 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2420 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2421 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2422 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2423 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2424 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2425 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2426 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2418 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2419 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2420 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2421 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2422 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2423 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2424 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2425 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2426 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2427 | 2427 | |
| 2428 | 2428 | try { |
| 2429 | 2429 | \Defuse\Crypto\File::encryptFileWithPassword( |
@@ -2461,15 +2461,15 @@ discard block |
||
| 2461 | 2461 | ) { |
| 2462 | 2462 | // load PhpEncryption library |
| 2463 | 2463 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2464 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2465 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2466 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2467 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2468 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2469 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2470 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2471 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2472 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2464 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2465 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2466 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2467 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2468 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2469 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2470 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2471 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2472 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2473 | 2473 | |
| 2474 | 2474 | try { |
| 2475 | 2475 | \Defuse\Crypto\File::decryptFileWithPassword( |
@@ -2515,9 +2515,9 @@ discard block |
||
| 2515 | 2515 | function fileDelete($file, $SETTINGS) |
| 2516 | 2516 | { |
| 2517 | 2517 | // Load AntiXSS |
| 2518 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2519 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2520 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2518 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2519 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2520 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2521 | 2521 | $antiXss = new voku\helper\AntiXSS(); |
| 2522 | 2522 | |
| 2523 | 2523 | $file = $antiXss->xss_clean($file); |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | continue; |
| 2564 | 2564 | } |
| 2565 | 2565 | |
| 2566 | - $fullPath = $dir . '/' . $file; |
|
| 2566 | + $fullPath = $dir.'/'.$file; |
|
| 2567 | 2567 | |
| 2568 | 2568 | if (is_dir($fullPath)) { |
| 2569 | 2569 | if ($res = @chmod($fullPath, $dirPermissions)) { |
@@ -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 | ); |
@@ -2721,9 +2721,9 @@ discard block |
||
| 2721 | 2721 | |
| 2722 | 2722 | foreach (explode(',', $SETTINGS['ldap_domain_controler']) as $domainControler) { |
| 2723 | 2723 | if ($SETTINGS['ldap_ssl'] == 1) { |
| 2724 | - $ldapURIs .= 'ldaps://' . $domainControler . ':' . $SETTINGS['ldap_port'] . ' '; |
|
| 2724 | + $ldapURIs .= 'ldaps://'.$domainControler.':'.$SETTINGS['ldap_port'].' '; |
|
| 2725 | 2725 | } else { |
| 2726 | - $ldapURIs .= 'ldap://' . $domainControler . ':' . $SETTINGS['ldap_port'] . ' '; |
|
| 2726 | + $ldapURIs .= 'ldap://'.$domainControler.':'.$SETTINGS['ldap_port'].' '; |
|
| 2727 | 2727 | } |
| 2728 | 2728 | } |
| 2729 | 2729 | $ldapconn = ldap_connect($ldapURIs); |
@@ -2748,7 +2748,7 @@ discard block |
||
| 2748 | 2748 | if ((empty($SETTINGS['ldap_bind_dn']) === true && empty($SETTINGS['ldap_bind_passwd']) === true) |
| 2749 | 2749 | || $ldapbind === true |
| 2750 | 2750 | ) { |
| 2751 | - $filter = '(&(' . $SETTINGS['ldap_user_attribute'] . '=' . $username . ')(objectClass=' . $SETTINGS['ldap_object_class'] . '))'; |
|
| 2751 | + $filter = '(&('.$SETTINGS['ldap_user_attribute'].'='.$username.')(objectClass='.$SETTINGS['ldap_object_class'].'))'; |
|
| 2752 | 2752 | $result = ldap_search( |
| 2753 | 2753 | $ldapconn, |
| 2754 | 2754 | $SETTINGS['ldap_search_base'], |
@@ -2773,7 +2773,7 @@ discard block |
||
| 2773 | 2773 | && empty($SETTINGS['ldap_usergroup']) === false |
| 2774 | 2774 | ) { |
| 2775 | 2775 | // New way to check User's group membership |
| 2776 | - $filter_group = 'memberUid=' . $username; |
|
| 2776 | + $filter_group = 'memberUid='.$username; |
|
| 2777 | 2777 | $result_group = ldap_search( |
| 2778 | 2778 | $ldapconn, |
| 2779 | 2779 | $SETTINGS['ldap_search_base'], |
@@ -2845,18 +2845,18 @@ discard block |
||
| 2845 | 2845 | if (strpos(html_entity_decode($username), '\\') === false) { |
| 2846 | 2846 | $ldap_suffix = ''; |
| 2847 | 2847 | } else { |
| 2848 | - $ldap_suffix = '@' . substr(html_entity_decode($username), 0, strpos(html_entity_decode($username), '\\')); |
|
| 2848 | + $ldap_suffix = '@'.substr(html_entity_decode($username), 0, strpos(html_entity_decode($username), '\\')); |
|
| 2849 | 2849 | $username = substr(html_entity_decode($username), strpos(html_entity_decode($username), '\\') + 1); |
| 2850 | 2850 | } |
| 2851 | 2851 | //load ClassLoader |
| 2852 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 2852 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 2853 | 2853 | |
| 2854 | 2854 | $adldap = new SplClassLoader('adLDAP', '../includes/libraries/LDAP'); |
| 2855 | 2855 | $adldap->register(); |
| 2856 | 2856 | |
| 2857 | 2857 | // Posix style LDAP handles user searches a bit differently |
| 2858 | 2858 | if ($SETTINGS['ldap_type'] === 'posix') { |
| 2859 | - $ldap_suffix = ',' . $SETTINGS['ldap_suffix'] . ',' . $SETTINGS['ldap_domain_dn']; |
|
| 2859 | + $ldap_suffix = ','.$SETTINGS['ldap_suffix'].','.$SETTINGS['ldap_domain_dn']; |
|
| 2860 | 2860 | } else { |
| 2861 | 2861 | // case where $SETTINGS['ldap_type'] equals 'windows' |
| 2862 | 2862 | //Multiple Domain Names |
@@ -2880,7 +2880,7 @@ discard block |
||
| 2880 | 2880 | |
| 2881 | 2881 | // OpenLDAP expects an attribute=value pair |
| 2882 | 2882 | if ($SETTINGS['ldap_type'] === 'posix') { |
| 2883 | - $auth_username = $SETTINGS['ldap_user_attribute'] . '=' . $username; |
|
| 2883 | + $auth_username = $SETTINGS['ldap_user_attribute'].'='.$username; |
|
| 2884 | 2884 | } else { |
| 2885 | 2885 | $auth_username = $username; |
| 2886 | 2886 | } |
@@ -2928,8 +2928,8 @@ discard block |
||
| 2928 | 2928 | function performDBQuery($SETTINGS, $fields, $table) |
| 2929 | 2929 | { |
| 2930 | 2930 | // include librairies & connect to DB |
| 2931 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2932 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2931 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2932 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2933 | 2933 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2934 | 2934 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2935 | 2935 | } |
@@ -2942,7 +2942,7 @@ discard block |
||
| 2942 | 2942 | |
| 2943 | 2943 | // Insert log in DB |
| 2944 | 2944 | return DB::query( |
| 2945 | - 'SELECT ' . $fields . ' |
|
| 2945 | + 'SELECT '.$fields.' |
|
| 2946 | 2946 | FROM ' . prefixTable($table) |
| 2947 | 2947 | ); |
| 2948 | 2948 | } |
@@ -2957,15 +2957,15 @@ discard block |
||
| 2957 | 2957 | function formatSizeUnits($bytes) |
| 2958 | 2958 | { |
| 2959 | 2959 | if ($bytes >= 1073741824) { |
| 2960 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
| 2960 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
| 2961 | 2961 | } elseif ($bytes >= 1048576) { |
| 2962 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
| 2962 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
| 2963 | 2963 | } elseif ($bytes >= 1024) { |
| 2964 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
| 2964 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
| 2965 | 2965 | } elseif ($bytes > 1) { |
| 2966 | - $bytes = $bytes . ' bytes'; |
|
| 2966 | + $bytes = $bytes.' bytes'; |
|
| 2967 | 2967 | } elseif ($bytes == 1) { |
| 2968 | - $bytes = $bytes . ' byte'; |
|
| 2968 | + $bytes = $bytes.' byte'; |
|
| 2969 | 2969 | } else { |
| 2970 | 2970 | $bytes = '0 bytes'; |
| 2971 | 2971 | } |
@@ -3180,16 +3180,16 @@ discard block |
||
| 3180 | 3180 | |
| 3181 | 3181 | // Encrypt the file content |
| 3182 | 3182 | $plaintext = file_get_contents( |
| 3183 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
| 3183 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
| 3184 | 3184 | ); |
| 3185 | 3185 | |
| 3186 | 3186 | $ciphertext = $cipher->encrypt($plaintext); |
| 3187 | 3187 | |
| 3188 | 3188 | // Save new file |
| 3189 | 3189 | $hash = md5($plaintext); |
| 3190 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
| 3190 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
| 3191 | 3191 | file_put_contents($fileOut, $ciphertext); |
| 3192 | - unlink($fileInPath . '/' . $fileInName); |
|
| 3192 | + unlink($fileInPath.'/'.$fileInName); |
|
| 3193 | 3193 | |
| 3194 | 3194 | return array( |
| 3195 | 3195 | 'fileHash' => base64_encode($hash), |
@@ -3232,7 +3232,7 @@ discard block |
||
| 3232 | 3232 | $cipher->disablePadding(); |
| 3233 | 3233 | |
| 3234 | 3234 | // Get file content |
| 3235 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
| 3235 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
| 3236 | 3236 | |
| 3237 | 3237 | // Decrypt file content and return |
| 3238 | 3238 | return base64_encode($cipher->decrypt($ciphertext)); |
@@ -3288,8 +3288,8 @@ discard block |
||
| 3288 | 3288 | $SETTINGS |
| 3289 | 3289 | ) { |
| 3290 | 3290 | // include librairies & connect to DB |
| 3291 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 3292 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3291 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 3292 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3293 | 3293 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3294 | 3294 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3295 | 3295 | } |
@@ -3308,7 +3308,7 @@ discard block |
||
| 3308 | 3308 | ); |
| 3309 | 3309 | |
| 3310 | 3310 | // Superglobals |
| 3311 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 3311 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 3312 | 3312 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 3313 | 3313 | |
| 3314 | 3314 | // Prepare superGlobal variables |
@@ -3335,8 +3335,8 @@ discard block |
||
| 3335 | 3335 | // Create sharekey for each user |
| 3336 | 3336 | $users = DB::query( |
| 3337 | 3337 | 'SELECT id, public_key |
| 3338 | - FROM ' . prefixTable('users') . ' |
|
| 3339 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
| 3338 | + FROM ' . prefixTable('users').' |
|
| 3339 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
| 3340 | 3340 | AND public_key != ""' |
| 3341 | 3341 | ); |
| 3342 | 3342 | foreach ($users as $user) { |
@@ -3420,9 +3420,9 @@ discard block |
||
| 3420 | 3420 | $ldapURIs = ''; |
| 3421 | 3421 | foreach (explode(',', $SETTINGS['ldap_domain_controler']) as $domainControler) { |
| 3422 | 3422 | if ($SETTINGS['ldap_ssl'] == 1) { |
| 3423 | - $ldapURIs .= 'ldaps://' . $domainControler . ':' . $SETTINGS['ldap_port'] . ' '; |
|
| 3423 | + $ldapURIs .= 'ldaps://'.$domainControler.':'.$SETTINGS['ldap_port'].' '; |
|
| 3424 | 3424 | } else { |
| 3425 | - $ldapURIs .= 'ldap://' . $domainControler . ':' . $SETTINGS['ldap_port'] . ' '; |
|
| 3425 | + $ldapURIs .= 'ldap://'.$domainControler.':'.$SETTINGS['ldap_port'].' '; |
|
| 3426 | 3426 | } |
| 3427 | 3427 | } |
| 3428 | 3428 | // Connect |
@@ -3466,7 +3466,7 @@ discard block |
||
| 3466 | 3466 | if ($ldapconn) { |
| 3467 | 3467 | if ($SETTINGS['ldap_type'] === 'posix-search') { |
| 3468 | 3468 | // LDAP with posix search |
| 3469 | - $filter = '(&(' . $SETTINGS['ldap_user_attribute'] . '=' . $login . ')(objectClass=' . $SETTINGS['ldap_object_class'] . '))'; |
|
| 3469 | + $filter = '(&('.$SETTINGS['ldap_user_attribute'].'='.$login.')(objectClass='.$SETTINGS['ldap_object_class'].'))'; |
|
| 3470 | 3470 | $result = ldap_search( |
| 3471 | 3471 | $ldapconn, |
| 3472 | 3472 | $SETTINGS['ldap_search_base'], |
@@ -3485,13 +3485,13 @@ discard block |
||
| 3485 | 3485 | } |
| 3486 | 3486 | } |
| 3487 | 3487 | } else { |
| 3488 | - $adldap = new SplClassLoader('adLDAP', $SETTINGS['cpassman_dir'] . '/includes/libraries/LDAP'); |
|
| 3488 | + $adldap = new SplClassLoader('adLDAP', $SETTINGS['cpassman_dir'].'/includes/libraries/LDAP'); |
|
| 3489 | 3489 | $adldap->register(); |
| 3490 | 3490 | $ldap_suffix = ''; |
| 3491 | 3491 | |
| 3492 | 3492 | // Posix style LDAP handles user searches a bit differently |
| 3493 | 3493 | if ($SETTINGS['ldap_type'] === 'posix') { |
| 3494 | - $ldap_suffix = ',' . $SETTINGS['ldap_suffix'] . ',' . $SETTINGS['ldap_domain_dn']; |
|
| 3494 | + $ldap_suffix = ','.$SETTINGS['ldap_suffix'].','.$SETTINGS['ldap_domain_dn']; |
|
| 3495 | 3495 | } elseif ($SETTINGS['ldap_type'] === 'windows') { |
| 3496 | 3496 | //Multiple Domain Names |
| 3497 | 3497 | $ldap_suffix = $SETTINGS['ldap_suffix']; |
@@ -3514,7 +3514,7 @@ discard block |
||
| 3514 | 3514 | |
| 3515 | 3515 | // OpenLDAP expects an attribute=value pair |
| 3516 | 3516 | if ($SETTINGS['ldap_type'] === 'posix') { |
| 3517 | - $login = $SETTINGS['ldap_user_attribute'] . '=' . $login; |
|
| 3517 | + $login = $SETTINGS['ldap_user_attribute'].'='.$login; |
|
| 3518 | 3518 | } |
| 3519 | 3519 | |
| 3520 | 3520 | // Authenticate the user |
@@ -3538,8 +3538,8 @@ discard block |
||
| 3538 | 3538 | function deleteUserObjetsKeys($userId, $SETTINGS) |
| 3539 | 3539 | { |
| 3540 | 3540 | // include librairies & connect to DB |
| 3541 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 3542 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3541 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 3542 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3543 | 3543 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3544 | 3544 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3545 | 3545 | } |