@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | DB::debugmode(false); |
| 72 | 72 | $process_to_perform = DB::queryfirstrow( |
| 73 | 73 | 'SELECT * |
| 74 | - FROM ' . prefixTable('processes') . ' |
|
| 74 | + FROM ' . prefixTable('processes').' |
|
| 75 | 75 | WHERE is_in_progress = %i AND process_type = %s |
| 76 | 76 | ORDER BY increment_id ASC', |
| 77 | 77 | 1, |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // search for next process to handle |
| 92 | 92 | $process_to_perform = DB::queryfirstrow( |
| 93 | 93 | 'SELECT * |
| 94 | - FROM ' . prefixTable('processes') . ' |
|
| 94 | + FROM ' . prefixTable('processes').' |
|
| 95 | 95 | WHERE is_in_progress = %i AND finished_at = "" AND process_type = %s |
| 96 | 96 | ORDER BY increment_id ASC', |
| 97 | 97 | 0, |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $process_to_perform['increment_id'] |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | - provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS); |
|
| 112 | + provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS); |
|
| 113 | 113 | handleTask( |
| 114 | 114 | $process_to_perform['increment_id'], |
| 115 | 115 | json_decode($process_to_perform['arguments'], true), |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | function handleTask(int $processId, array $ProcessArguments, array $SETTINGS): bool |
| 140 | 140 | { |
| 141 | - provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS); |
|
| 141 | + provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS); |
|
| 142 | 142 | //DB::debugmode(false); |
| 143 | 143 | $task_to_perform = DB::queryfirstrow( |
| 144 | 144 | 'SELECT * |
| 145 | - FROM ' . prefixTable('processes_tasks') . ' |
|
| 145 | + FROM ' . prefixTable('processes_tasks').' |
|
| 146 | 146 | WHERE process_id = %i AND finished_at IS NULL |
| 147 | 147 | ORDER BY increment_id ASC', |
| 148 | 148 | $processId |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | // check if a linux process is not currently on going |
| 158 | 158 | // if sub_task_in_progress === 1 then exit |
| 159 | 159 | if ((int) $task_to_perform['sub_task_in_progress'] === 0) { |
| 160 | - provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]', $SETTINGS); |
|
| 160 | + provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]', $SETTINGS); |
|
| 161 | 161 | |
| 162 | 162 | // handle next task |
| 163 | 163 | $args = json_decode($task_to_perform['task'], true); |
@@ -210,10 +210,9 @@ discard block |
||
| 210 | 210 | DB::update( |
| 211 | 211 | prefixTable('processes_tasks'), |
| 212 | 212 | array( |
| 213 | - 'sub_task_in_progress' => 0, // flag sub task is no more in prgoress |
|
| 213 | + 'sub_task_in_progress' => 0, // flag sub task is no more in prgoress |
|
| 214 | 214 | 'task' => $taskStatus['new_action'] !== $args['step'] ? |
| 215 | - json_encode(["status" => "Done"]) : |
|
| 216 | - json_encode([ |
|
| 215 | + json_encode(["status" => "Done"]) : json_encode([ |
|
| 217 | 216 | "step" => $taskStatus['new_action'], |
| 218 | 217 | "index" => $taskStatus['new_index'], |
| 219 | 218 | "nb" => isset($SETTINGS['maximum_number_of_items_to_treat']) === true ? $SETTINGS['maximum_number_of_items_to_treat'] : $args['nb'], |
@@ -249,7 +248,7 @@ discard block |
||
| 249 | 248 | |
| 250 | 249 | } else { |
| 251 | 250 | // Task is currently being in progress by another server process |
| 252 | - provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS); |
|
| 251 | + provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS); |
|
| 253 | 252 | return false; |
| 254 | 253 | } |
| 255 | 254 | } |
@@ -282,7 +281,7 @@ discard block |
||
| 282 | 281 | // Check if user exists |
| 283 | 282 | $userInfo = DB::queryFirstRow( |
| 284 | 283 | 'SELECT public_key, private_key |
| 285 | - FROM ' . prefixTable('users') . ' |
|
| 284 | + FROM ' . prefixTable('users').' |
|
| 286 | 285 | WHERE id = %i', |
| 287 | 286 | $post_user_id |
| 288 | 287 | ); |
@@ -413,13 +412,13 @@ discard block |
||
| 413 | 412 | { |
| 414 | 413 | $userInfo = DB::queryFirstRow( |
| 415 | 414 | 'SELECT pw, public_key, private_key, login, name |
| 416 | - FROM ' . prefixTable('users') . ' |
|
| 415 | + FROM ' . prefixTable('users').' |
|
| 417 | 416 | WHERE id = %i', |
| 418 | 417 | $owner_id |
| 419 | 418 | ); |
| 420 | 419 | |
| 421 | 420 | // decrypt owner password |
| 422 | - $pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string']; |
|
| 421 | + $pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string']; |
|
| 423 | 422 | provideLog('[USER][INFO] ID:'.$owner_id, $SETTINGS); |
| 424 | 423 | //provideLog('[DEBUG] '.$pwd." -- ", $SETTINGS); |
| 425 | 424 | // decrypt private key and send back |
@@ -459,15 +458,15 @@ discard block |
||
| 459 | 458 | // Loop on items |
| 460 | 459 | $rows = DB::query( |
| 461 | 460 | 'SELECT id, pw |
| 462 | - FROM ' . prefixTable('items') . ' |
|
| 461 | + FROM ' . prefixTable('items').' |
|
| 463 | 462 | ORDER BY id ASC |
| 464 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 463 | + LIMIT ' . $post_start.', '.$post_length |
|
| 465 | 464 | ); |
| 466 | 465 | foreach ($rows as $record) { |
| 467 | 466 | // Get itemKey from current user |
| 468 | 467 | $currentUserKey = DB::queryFirstRow( |
| 469 | 468 | 'SELECT share_key, increment_id |
| 470 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 469 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 471 | 470 | WHERE object_id = %i AND user_id = %i', |
| 472 | 471 | $record['id'], |
| 473 | 472 | $extra_arguments['owner_id'] |
@@ -499,7 +498,7 @@ discard block |
||
| 499 | 498 | if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) { |
| 500 | 499 | $currentUserKey = DB::queryFirstRow( |
| 501 | 500 | 'SELECT increment_id |
| 502 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 501 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 503 | 502 | WHERE object_id = %i AND user_id = %i', |
| 504 | 503 | $record['id'], |
| 505 | 504 | $post_user_id |
@@ -572,15 +571,15 @@ discard block |
||
| 572 | 571 | // Loop on logs |
| 573 | 572 | $rows = DB::query( |
| 574 | 573 | 'SELECT increment_id |
| 575 | - FROM ' . prefixTable('log_items') . ' |
|
| 574 | + FROM ' . prefixTable('log_items').' |
|
| 576 | 575 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes" |
| 577 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 576 | + LIMIT ' . $post_start.', '.$post_length |
|
| 578 | 577 | ); |
| 579 | 578 | foreach ($rows as $record) { |
| 580 | 579 | // Get itemKey from current user |
| 581 | 580 | $currentUserKey = DB::queryFirstRow( |
| 582 | 581 | 'SELECT share_key |
| 583 | - FROM ' . prefixTable('sharekeys_logs') . ' |
|
| 582 | + FROM ' . prefixTable('sharekeys_logs').' |
|
| 584 | 583 | WHERE object_id = %i AND user_id = %i', |
| 585 | 584 | $record['increment_id'], |
| 586 | 585 | $extra_arguments['owner_id'] |
@@ -612,7 +611,7 @@ discard block |
||
| 612 | 611 | if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) { |
| 613 | 612 | $currentUserKey = DB::queryFirstRow( |
| 614 | 613 | 'SELECT increment_id |
| 615 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 614 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 616 | 615 | WHERE object_id = %i AND user_id = %i', |
| 617 | 616 | $record['id'], |
| 618 | 617 | $post_user_id |
@@ -634,7 +633,7 @@ discard block |
||
| 634 | 633 | // SHould we change step? |
| 635 | 634 | DB::query( |
| 636 | 635 | 'SELECT increment_id |
| 637 | - FROM ' . prefixTable('log_items') . ' |
|
| 636 | + FROM ' . prefixTable('log_items').' |
|
| 638 | 637 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"' |
| 639 | 638 | ); |
| 640 | 639 | |
@@ -674,15 +673,15 @@ discard block |
||
| 674 | 673 | // Loop on fields |
| 675 | 674 | $rows = DB::query( |
| 676 | 675 | 'SELECT id |
| 677 | - FROM ' . prefixTable('categories_items') . ' |
|
| 676 | + FROM ' . prefixTable('categories_items').' |
|
| 678 | 677 | WHERE encryption_type = "teampass_aes" |
| 679 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 678 | + LIMIT ' . $post_start.', '.$post_length |
|
| 680 | 679 | ); |
| 681 | 680 | foreach ($rows as $record) { |
| 682 | 681 | // Get itemKey from current user |
| 683 | 682 | $currentUserKey = DB::queryFirstRow( |
| 684 | 683 | 'SELECT share_key |
| 685 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 684 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 686 | 685 | WHERE object_id = %i AND user_id = %i', |
| 687 | 686 | $record['id'], |
| 688 | 687 | $extra_arguments['owner_id'] |
@@ -710,7 +709,7 @@ discard block |
||
| 710 | 709 | if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) { |
| 711 | 710 | $currentUserKey = DB::queryFirstRow( |
| 712 | 711 | 'SELECT increment_id |
| 713 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 712 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 714 | 713 | WHERE object_id = %i AND user_id = %i', |
| 715 | 714 | $record['id'], |
| 716 | 715 | $post_user_id |
@@ -733,7 +732,7 @@ discard block |
||
| 733 | 732 | // SHould we change step? |
| 734 | 733 | DB::query( |
| 735 | 734 | 'SELECT * |
| 736 | - FROM ' . prefixTable('categories_items') . ' |
|
| 735 | + FROM ' . prefixTable('categories_items').' |
|
| 737 | 736 | WHERE encryption_type = "teampass_aes"' |
| 738 | 737 | ); |
| 739 | 738 | |
@@ -773,14 +772,14 @@ discard block |
||
| 773 | 772 | // Loop on suggestions |
| 774 | 773 | $rows = DB::query( |
| 775 | 774 | 'SELECT id |
| 776 | - FROM ' . prefixTable('suggestion') . ' |
|
| 777 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 775 | + FROM ' . prefixTable('suggestion').' |
|
| 776 | + LIMIT ' . $post_start.', '.$post_length |
|
| 778 | 777 | ); |
| 779 | 778 | foreach ($rows as $record) { |
| 780 | 779 | // Get itemKey from current user |
| 781 | 780 | $currentUserKey = DB::queryFirstRow( |
| 782 | 781 | 'SELECT share_key |
| 783 | - FROM ' . prefixTable('sharekeys_suggestions') . ' |
|
| 782 | + FROM ' . prefixTable('sharekeys_suggestions').' |
|
| 784 | 783 | WHERE object_id = %i AND user_id = %i', |
| 785 | 784 | $record['id'], |
| 786 | 785 | $extra_arguments['owner_id'] |
@@ -812,7 +811,7 @@ discard block |
||
| 812 | 811 | if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) { |
| 813 | 812 | $currentUserKey = DB::queryFirstRow( |
| 814 | 813 | 'SELECT increment_id |
| 815 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 814 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 816 | 815 | WHERE object_id = %i AND user_id = %i', |
| 817 | 816 | $record['id'], |
| 818 | 817 | $post_user_id |
@@ -873,15 +872,15 @@ discard block |
||
| 873 | 872 | // Loop on files |
| 874 | 873 | $rows = DB::query( |
| 875 | 874 | 'SELECT id |
| 876 | - FROM ' . prefixTable('files') . ' |
|
| 877 | - WHERE status = "' . TP_ENCRYPTION_NAME . '" |
|
| 878 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 875 | + FROM ' . prefixTable('files').' |
|
| 876 | + WHERE status = "' . TP_ENCRYPTION_NAME.'" |
|
| 877 | + LIMIT ' . $post_start.', '.$post_length |
|
| 879 | 878 | ); //aes_encryption |
| 880 | 879 | foreach ($rows as $record) { |
| 881 | 880 | // Get itemKey from current user |
| 882 | 881 | $currentUserKey = DB::queryFirstRow( |
| 883 | 882 | 'SELECT share_key |
| 884 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 883 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 885 | 884 | WHERE object_id = %i AND user_id = %i', |
| 886 | 885 | $record['id'], |
| 887 | 886 | $extra_arguments['owner_id'] |
@@ -913,7 +912,7 @@ discard block |
||
| 913 | 912 | if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) { |
| 914 | 913 | $currentUserKey = DB::queryFirstRow( |
| 915 | 914 | 'SELECT increment_id |
| 916 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 915 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 917 | 916 | WHERE object_id = %i AND user_id = %i', |
| 918 | 917 | $record['id'], |
| 919 | 918 | $post_user_id |
@@ -935,8 +934,8 @@ discard block |
||
| 935 | 934 | // SHould we change step? Finished ? |
| 936 | 935 | DB::query( |
| 937 | 936 | 'SELECT * |
| 938 | - FROM ' . prefixTable('files') . ' |
|
| 939 | - WHERE status = "' . TP_ENCRYPTION_NAME . '"' |
|
| 937 | + FROM ' . prefixTable('files').' |
|
| 938 | + WHERE status = "' . TP_ENCRYPTION_NAME.'"' |
|
| 940 | 939 | ); |
| 941 | 940 | $counter = DB::count(); |
| 942 | 941 | $next_start = (int) $post_start + (int) $post_length; |
@@ -1000,7 +999,7 @@ discard block |
||
| 1000 | 999 | // get user info |
| 1001 | 1000 | $userInfo = DB::queryFirstRow( |
| 1002 | 1001 | 'SELECT email, login, auth_type, special, lastname, name |
| 1003 | - FROM ' . prefixTable('users') . ' |
|
| 1002 | + FROM ' . prefixTable('users').' |
|
| 1004 | 1003 | WHERE id = %i', |
| 1005 | 1004 | $extra_arguments['new_user_id'] |
| 1006 | 1005 | ); |
@@ -1014,13 +1013,13 @@ discard block |
||
| 1014 | 1013 | sendMailToUser( |
| 1015 | 1014 | filter_var($userInfo['email'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), |
| 1016 | 1015 | empty($extra_arguments['email_body']) === false ? $extra_arguments['email_body'] : langHdl('email_body_user_config_1'), |
| 1017 | - 'TEAMPASS - ' . langHdl('login_credentials'), |
|
| 1016 | + 'TEAMPASS - '.langHdl('login_credentials'), |
|
| 1018 | 1017 | (array) filter_var_array( |
| 1019 | 1018 | [ |
| 1020 | - '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'], |
|
| 1019 | + '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'], |
|
| 1021 | 1020 | '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '', |
| 1022 | 1021 | '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '', |
| 1023 | - '#password#' => cryption($extra_arguments['new_user_pwd'], '','decrypt', $SETTINGS)['string'], |
|
| 1022 | + '#password#' => cryption($extra_arguments['new_user_pwd'], '', 'decrypt', $SETTINGS)['string'], |
|
| 1024 | 1023 | ], |
| 1025 | 1024 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
| 1026 | 1025 | ), |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // Load config if $SETTINGS not defined |
| 35 | 35 | if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) { |
| 36 | - include_once __DIR__ . '/../includes/config/tp.config.php'; |
|
| 36 | + include_once __DIR__.'/../includes/config/tp.config.php'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | header('Content-type: text/html; charset=utf-8'); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | and improve performance by avoiding to include the file for every missing strings. |
| 64 | 64 | */ |
| 65 | 65 | if (isset($_SESSION['teampass']) === false || isset($_SESSION['teampass']['en_lang'][trim($string)]) === false) { |
| 66 | - $_SESSION['teampass']['en_lang'] = include_once __DIR__. '/../includes/language/english.php'; |
|
| 66 | + $_SESSION['teampass']['en_lang'] = include_once __DIR__.'/../includes/language/english.php'; |
|
| 67 | 67 | $session_language = isset($_SESSION['teampass']['en_lang'][trim($string)]) === false ? '' : $_SESSION['teampass']['en_lang'][trim($string)]; |
| 68 | 68 | } else { |
| 69 | 69 | $session_language = $_SESSION['teampass']['en_lang'][trim($string)]; |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $path = __DIR__.'/../includes/libraries/Encryption/Encryption/'; |
| 124 | 124 | |
| 125 | - include_once $path . 'Exception/CryptoException.php'; |
|
| 126 | - include_once $path . 'Exception/BadFormatException.php'; |
|
| 127 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
| 128 | - include_once $path . 'Exception/IOException.php'; |
|
| 129 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 130 | - include_once $path . 'Crypto.php'; |
|
| 131 | - include_once $path . 'Encoding.php'; |
|
| 132 | - include_once $path . 'DerivedKeys.php'; |
|
| 133 | - include_once $path . 'Key.php'; |
|
| 134 | - include_once $path . 'KeyOrPassword.php'; |
|
| 135 | - include_once $path . 'File.php'; |
|
| 136 | - include_once $path . 'RuntimeTests.php'; |
|
| 137 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 138 | - include_once $path . 'Core.php'; |
|
| 125 | + include_once $path.'Exception/CryptoException.php'; |
|
| 126 | + include_once $path.'Exception/BadFormatException.php'; |
|
| 127 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
| 128 | + include_once $path.'Exception/IOException.php'; |
|
| 129 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 130 | + include_once $path.'Crypto.php'; |
|
| 131 | + include_once $path.'Encoding.php'; |
|
| 132 | + include_once $path.'DerivedKeys.php'; |
|
| 133 | + include_once $path.'Key.php'; |
|
| 134 | + include_once $path.'KeyOrPassword.php'; |
|
| 135 | + include_once $path.'File.php'; |
|
| 136 | + include_once $path.'RuntimeTests.php'; |
|
| 137 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 138 | + include_once $path.'Core.php'; |
|
| 139 | 139 | |
| 140 | 140 | // convert KEY |
| 141 | 141 | $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
@@ -180,20 +180,20 @@ discard block |
||
| 180 | 180 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - include_once $path . 'Exception/CryptoException.php'; |
|
| 184 | - include_once $path . 'Exception/BadFormatException.php'; |
|
| 185 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
| 186 | - include_once $path . 'Exception/IOException.php'; |
|
| 187 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 188 | - include_once $path . 'Crypto.php'; |
|
| 189 | - include_once $path . 'Encoding.php'; |
|
| 190 | - include_once $path . 'DerivedKeys.php'; |
|
| 191 | - include_once $path . 'Key.php'; |
|
| 192 | - include_once $path . 'KeyOrPassword.php'; |
|
| 193 | - include_once $path . 'File.php'; |
|
| 194 | - include_once $path . 'RuntimeTests.php'; |
|
| 195 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 196 | - include_once $path . 'Core.php'; |
|
| 183 | + include_once $path.'Exception/CryptoException.php'; |
|
| 184 | + include_once $path.'Exception/BadFormatException.php'; |
|
| 185 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
| 186 | + include_once $path.'Exception/IOException.php'; |
|
| 187 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 188 | + include_once $path.'Crypto.php'; |
|
| 189 | + include_once $path.'Encoding.php'; |
|
| 190 | + include_once $path.'DerivedKeys.php'; |
|
| 191 | + include_once $path.'Key.php'; |
|
| 192 | + include_once $path.'KeyOrPassword.php'; |
|
| 193 | + include_once $path.'File.php'; |
|
| 194 | + include_once $path.'RuntimeTests.php'; |
|
| 195 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 196 | + include_once $path.'Core.php'; |
|
| 197 | 197 | |
| 198 | 198 | $key = \Defuse\Crypto\Key::createNewRandomKey(); |
| 199 | 199 | $key = $key->saveToAsciiSafeString(); |
@@ -218,20 +218,20 @@ discard block |
||
| 218 | 218 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - include_once $path . 'Exception/CryptoException.php'; |
|
| 222 | - include_once $path . 'Exception/BadFormatException.php'; |
|
| 223 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
| 224 | - include_once $path . 'Exception/IOException.php'; |
|
| 225 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 226 | - include_once $path . 'Crypto.php'; |
|
| 227 | - include_once $path . 'Encoding.php'; |
|
| 228 | - include_once $path . 'DerivedKeys.php'; |
|
| 229 | - include_once $path . 'Key.php'; |
|
| 230 | - include_once $path . 'KeyOrPassword.php'; |
|
| 231 | - include_once $path . 'File.php'; |
|
| 232 | - include_once $path . 'RuntimeTests.php'; |
|
| 233 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 234 | - include_once $path . 'Core.php'; |
|
| 221 | + include_once $path.'Exception/CryptoException.php'; |
|
| 222 | + include_once $path.'Exception/BadFormatException.php'; |
|
| 223 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
| 224 | + include_once $path.'Exception/IOException.php'; |
|
| 225 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 226 | + include_once $path.'Crypto.php'; |
|
| 227 | + include_once $path.'Encoding.php'; |
|
| 228 | + include_once $path.'DerivedKeys.php'; |
|
| 229 | + include_once $path.'Key.php'; |
|
| 230 | + include_once $path.'KeyOrPassword.php'; |
|
| 231 | + include_once $path.'File.php'; |
|
| 232 | + include_once $path.'RuntimeTests.php'; |
|
| 233 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 234 | + include_once $path.'Core.php'; |
|
| 235 | 235 | |
| 236 | 236 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk); |
| 237 | 237 | return $protected_key->saveToAsciiSafeString(); // save this in user table |
@@ -256,20 +256,20 @@ discard block |
||
| 256 | 256 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - include_once $path . 'Exception/CryptoException.php'; |
|
| 260 | - include_once $path . 'Exception/BadFormatException.php'; |
|
| 261 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
| 262 | - include_once $path . 'Exception/IOException.php'; |
|
| 263 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 264 | - include_once $path . 'Crypto.php'; |
|
| 265 | - include_once $path . 'Encoding.php'; |
|
| 266 | - include_once $path . 'DerivedKeys.php'; |
|
| 267 | - include_once $path . 'Key.php'; |
|
| 268 | - include_once $path . 'KeyOrPassword.php'; |
|
| 269 | - include_once $path . 'File.php'; |
|
| 270 | - include_once $path . 'RuntimeTests.php'; |
|
| 271 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 272 | - include_once $path . 'Core.php'; |
|
| 259 | + include_once $path.'Exception/CryptoException.php'; |
|
| 260 | + include_once $path.'Exception/BadFormatException.php'; |
|
| 261 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
| 262 | + include_once $path.'Exception/IOException.php'; |
|
| 263 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 264 | + include_once $path.'Crypto.php'; |
|
| 265 | + include_once $path.'Encoding.php'; |
|
| 266 | + include_once $path.'DerivedKeys.php'; |
|
| 267 | + include_once $path.'Key.php'; |
|
| 268 | + include_once $path.'KeyOrPassword.php'; |
|
| 269 | + include_once $path.'File.php'; |
|
| 270 | + include_once $path.'RuntimeTests.php'; |
|
| 271 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 272 | + include_once $path.'Core.php'; |
|
| 273 | 273 | |
| 274 | 274 | try { |
| 275 | 275 | $protected_key_encoded = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | function trimElement($chaine, string $element): string |
| 313 | 313 | { |
| 314 | - if (! empty($chaine)) { |
|
| 314 | + if (!empty($chaine)) { |
|
| 315 | 315 | if (is_array($chaine) === true) { |
| 316 | 316 | $chaine = implode(';', $chaine); |
| 317 | 317 | } |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | function db_error_handler(array $params): void |
| 361 | 361 | { |
| 362 | - echo 'Error: ' . $params['error'] . "<br>\n"; |
|
| 363 | - echo 'Query: ' . $params['query'] . "<br>\n"; |
|
| 362 | + echo 'Error: '.$params['error']."<br>\n"; |
|
| 363 | + echo 'Query: '.$params['query']."<br>\n"; |
|
| 364 | 364 | throw new Exception('Error - Query', 1); |
| 365 | 365 | } |
| 366 | 366 | |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | $SETTINGS |
| 383 | 383 | ) { |
| 384 | 384 | //load ClassLoader |
| 385 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 385 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 386 | 386 | // Load superglobal |
| 387 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 387 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 388 | 388 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 389 | 389 | //Connect to DB |
| 390 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 390 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 391 | 391 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 392 | 392 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 393 | 393 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | DB::$ssl = DB_SSL; |
| 401 | 401 | DB::$connect_options = DB_CONNECT_OPTIONS; |
| 402 | 402 | //Build tree |
| 403 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 403 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 404 | 404 | $tree->register(); |
| 405 | 405 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 406 | 406 | |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | function identAdmin($idFonctions, $SETTINGS, $tree) |
| 446 | 446 | { |
| 447 | 447 | // Load superglobal |
| 448 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 448 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 449 | 449 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 450 | 450 | // Init |
| 451 | 451 | $groupesVisibles = []; |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION'); |
| 465 | 465 | $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION'); |
| 466 | 466 | // Get list of Folders |
| 467 | - $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
| 467 | + $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
| 468 | 468 | foreach ($rows as $record) { |
| 469 | 469 | array_push($groupesVisibles, $record['id']); |
| 470 | 470 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | // Get ID of personal folder |
| 485 | 485 | $persfld = DB::queryfirstrow( |
| 486 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', |
|
| 486 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s', |
|
| 487 | 487 | $globalsUserId |
| 488 | 488 | ); |
| 489 | 489 | if (empty($persfld['id']) === false) { |
@@ -504,20 +504,20 @@ discard block |
||
| 504 | 504 | // get complete list of ROLES |
| 505 | 505 | $tmp = explode(';', $idFonctions); |
| 506 | 506 | $rows = DB::query( |
| 507 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 507 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 508 | 508 | ORDER BY title ASC' |
| 509 | 509 | ); |
| 510 | 510 | foreach ($rows as $record) { |
| 511 | - if (! empty($record['id']) && ! in_array($record['id'], $tmp)) { |
|
| 511 | + if (!empty($record['id']) && !in_array($record['id'], $tmp)) { |
|
| 512 | 512 | array_push($tmp, $record['id']); |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION'); |
| 516 | 516 | $superGlobal->put('is_admin', 1, 'SESSION'); |
| 517 | 517 | // Check if admin has created Folders and Roles |
| 518 | - DB::query('SELECT * FROM ' . prefixTable('nested_tree') . ''); |
|
| 518 | + DB::query('SELECT * FROM '.prefixTable('nested_tree').''); |
|
| 519 | 519 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 520 | - DB::query('SELECT * FROM ' . prefixTable('roles_title')); |
|
| 520 | + DB::query('SELECT * FROM '.prefixTable('roles_title')); |
|
| 521 | 521 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 522 | 522 | |
| 523 | 523 | return true; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | object $tree |
| 564 | 564 | ) { |
| 565 | 565 | // Load superglobal |
| 566 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 566 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 567 | 567 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 568 | 568 | // Init |
| 569 | 569 | $superGlobal->put('groupes_visibles', [], 'SESSION'); |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | // Does this user is allowed to see other items |
| 603 | 603 | $inc = 0; |
| 604 | 604 | $rows = DB::query( |
| 605 | - 'SELECT id, id_tree FROM ' . prefixTable('items') . ' |
|
| 605 | + 'SELECT id, id_tree FROM '.prefixTable('items').' |
|
| 606 | 606 | WHERE restricted_to LIKE %ss AND inactif = %s'. |
| 607 | 607 | (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''), |
| 608 | 608 | $globalsUserId, |
@@ -619,8 +619,8 @@ discard block |
||
| 619 | 619 | // Check for the users roles if some specific rights exist on items |
| 620 | 620 | $rows = DB::query( |
| 621 | 621 | 'SELECT i.id_tree, r.item_id |
| 622 | - FROM ' . prefixTable('items') . ' as i |
|
| 623 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id) |
|
| 622 | + FROM ' . prefixTable('items').' as i |
|
| 623 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id) |
|
| 624 | 624 | WHERE i.id_tree <> "" '. |
| 625 | 625 | (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : ''). |
| 626 | 626 | 'ORDER BY i.id_tree ASC', |
@@ -675,16 +675,16 @@ discard block |
||
| 675 | 675 | 'SESSION' |
| 676 | 676 | ); |
| 677 | 677 | // Folders and Roles numbers |
| 678 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
| 678 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
| 679 | 679 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 680 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
| 680 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
| 681 | 681 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 682 | 682 | // check if change proposals on User's items |
| 683 | 683 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
| 684 | 684 | $countNewItems = DB::query( |
| 685 | 685 | 'SELECT COUNT(*) |
| 686 | - FROM ' . prefixTable('items_change') . ' AS c |
|
| 687 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
| 686 | + FROM ' . prefixTable('items_change').' AS c |
|
| 687 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
| 688 | 688 | WHERE i.action = %s AND i.id_user = %i', |
| 689 | 689 | 'at_creation', |
| 690 | 690 | $globalsUserId |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | { |
| 712 | 712 | $rows = DB::query( |
| 713 | 713 | 'SELECT * |
| 714 | - FROM ' . prefixTable('roles_values') . ' |
|
| 714 | + FROM ' . prefixTable('roles_values').' |
|
| 715 | 715 | WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''), |
| 716 | 716 | ['W', 'ND', 'NE', 'NDNE', 'R'], |
| 717 | 717 | $userRoles, |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | ) { |
| 779 | 779 | $persoFld = DB::queryfirstrow( |
| 780 | 780 | 'SELECT id |
| 781 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 781 | + FROM ' . prefixTable('nested_tree').' |
|
| 782 | 782 | WHERE title = %s AND personal_folder = %i'. |
| 783 | 783 | (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''), |
| 784 | 784 | $globalsUserId, |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | } |
| 812 | 812 | $persoFlds = DB::query( |
| 813 | 813 | 'SELECT id |
| 814 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 814 | + FROM ' . prefixTable('nested_tree').' |
|
| 815 | 815 | WHERE %l', |
| 816 | 816 | $where |
| 817 | 817 | ); |
@@ -875,9 +875,9 @@ discard block |
||
| 875 | 875 | */ |
| 876 | 876 | function cacheTableRefresh(array $SETTINGS): void |
| 877 | 877 | { |
| 878 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 878 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 879 | 879 | //Connect to DB |
| 880 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 880 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 881 | 881 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 882 | 882 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 883 | 883 | } |
@@ -890,16 +890,16 @@ discard block |
||
| 890 | 890 | DB::$ssl = DB_SSL; |
| 891 | 891 | DB::$connect_options = DB_CONNECT_OPTIONS; |
| 892 | 892 | //Load Tree |
| 893 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] .'/includes/libraries'); |
|
| 893 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 894 | 894 | $tree->register(); |
| 895 | 895 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 896 | 896 | // truncate table |
| 897 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
| 897 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
| 898 | 898 | // reload date |
| 899 | 899 | $rows = DB::query( |
| 900 | 900 | 'SELECT * |
| 901 | - FROM ' . prefixTable('items') . ' as i |
|
| 902 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 901 | + FROM ' . prefixTable('items').' as i |
|
| 902 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 903 | 903 | AND l.action = %s |
| 904 | 904 | AND i.inactif = %i', |
| 905 | 905 | 'at_creation', |
@@ -911,18 +911,18 @@ discard block |
||
| 911 | 911 | $tags = ''; |
| 912 | 912 | $itemTags = DB::query( |
| 913 | 913 | 'SELECT tag |
| 914 | - FROM ' . prefixTable('tags') . ' |
|
| 914 | + FROM ' . prefixTable('tags').' |
|
| 915 | 915 | WHERE item_id = %i AND tag != ""', |
| 916 | 916 | $record['id'] |
| 917 | 917 | ); |
| 918 | 918 | foreach ($itemTags as $itemTag) { |
| 919 | - $tags .= $itemTag['tag'] . ' '; |
|
| 919 | + $tags .= $itemTag['tag'].' '; |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | // Get renewal period |
| 923 | 923 | $resNT = DB::queryfirstrow( |
| 924 | 924 | 'SELECT renewal_period |
| 925 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 925 | + FROM ' . prefixTable('nested_tree').' |
|
| 926 | 926 | WHERE id = %i', |
| 927 | 927 | $record['id_tree'] |
| 928 | 928 | ); |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | // Is this a User id? |
| 936 | 936 | $user = DB::queryfirstrow( |
| 937 | 937 | 'SELECT id, login |
| 938 | - FROM ' . prefixTable('users') . ' |
|
| 938 | + FROM ' . prefixTable('users').' |
|
| 939 | 939 | WHERE id = %i', |
| 940 | 940 | $elem->title |
| 941 | 941 | ); |
@@ -953,11 +953,11 @@ discard block |
||
| 953 | 953 | 'id' => $record['id'], |
| 954 | 954 | 'label' => $record['label'], |
| 955 | 955 | 'description' => $record['description'] ?? '', |
| 956 | - 'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0', |
|
| 956 | + 'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0', |
|
| 957 | 957 | 'tags' => $tags, |
| 958 | 958 | 'id_tree' => $record['id_tree'], |
| 959 | 959 | 'perso' => $record['perso'], |
| 960 | - 'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
| 960 | + 'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
| 961 | 961 | 'login' => $record['login'] ?? '', |
| 962 | 962 | 'folder' => implode(' > ', $folder), |
| 963 | 963 | 'author' => $record['id_user'], |
@@ -979,12 +979,12 @@ discard block |
||
| 979 | 979 | */ |
| 980 | 980 | function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void |
| 981 | 981 | { |
| 982 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 982 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 983 | 983 | // Load superglobal |
| 984 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 984 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 985 | 985 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 986 | 986 | //Connect to DB |
| 987 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 987 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 988 | 988 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 989 | 989 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 990 | 990 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | // get new value from db |
| 1004 | 1004 | $data = DB::queryfirstrow( |
| 1005 | 1005 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
| 1006 | - FROM ' . prefixTable('items') . ' |
|
| 1006 | + FROM ' . prefixTable('items').' |
|
| 1007 | 1007 | WHERE id=%i', |
| 1008 | 1008 | $ident |
| 1009 | 1009 | ); |
@@ -1011,12 +1011,12 @@ discard block |
||
| 1011 | 1011 | $tags = ''; |
| 1012 | 1012 | $itemTags = DB::query( |
| 1013 | 1013 | 'SELECT tag |
| 1014 | - FROM ' . prefixTable('tags') . ' |
|
| 1014 | + FROM ' . prefixTable('tags').' |
|
| 1015 | 1015 | WHERE item_id = %i AND tag != ""', |
| 1016 | 1016 | $ident |
| 1017 | 1017 | ); |
| 1018 | 1018 | foreach ($itemTags as $itemTag) { |
| 1019 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1019 | + $tags .= $itemTag['tag'].' '; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | // form id_tree to full foldername |
| 1022 | 1022 | $folder = []; |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | // Is this a User id? |
| 1028 | 1028 | $user = DB::queryfirstrow( |
| 1029 | 1029 | 'SELECT id, login |
| 1030 | - FROM ' . prefixTable('users') . ' |
|
| 1030 | + FROM ' . prefixTable('users').' |
|
| 1031 | 1031 | WHERE id = %i', |
| 1032 | 1032 | $elem->title |
| 1033 | 1033 | ); |
@@ -1045,10 +1045,10 @@ discard block |
||
| 1045 | 1045 | 'label' => $data['label'], |
| 1046 | 1046 | 'description' => $data['description'], |
| 1047 | 1047 | 'tags' => $tags, |
| 1048 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
| 1048 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
| 1049 | 1049 | 'id_tree' => $data['id_tree'], |
| 1050 | 1050 | 'perso' => $data['perso'], |
| 1051 | - 'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
| 1051 | + 'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
| 1052 | 1052 | 'login' => $data['login'] ?? '', |
| 1053 | 1053 | 'folder' => implode(' » ', $folder), |
| 1054 | 1054 | 'author' => $superGlobal->get('user_id', 'SESSION'), |
@@ -1068,14 +1068,14 @@ discard block |
||
| 1068 | 1068 | */ |
| 1069 | 1069 | function cacheTableAdd(array $SETTINGS, ?int $ident = null): void |
| 1070 | 1070 | { |
| 1071 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1071 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1072 | 1072 | // Load superglobal |
| 1073 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1073 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1074 | 1074 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1075 | 1075 | // Get superglobals |
| 1076 | 1076 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
| 1077 | 1077 | //Connect to DB |
| 1078 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1078 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1079 | 1079 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1080 | 1080 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1081 | 1081 | } |
@@ -1094,8 +1094,8 @@ discard block |
||
| 1094 | 1094 | // get new value from db |
| 1095 | 1095 | $data = DB::queryFirstRow( |
| 1096 | 1096 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
| 1097 | - FROM ' . prefixTable('items') . ' as i |
|
| 1098 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1097 | + FROM ' . prefixTable('items').' as i |
|
| 1098 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1099 | 1099 | WHERE i.id = %i |
| 1100 | 1100 | AND l.action = %s', |
| 1101 | 1101 | $ident, |
@@ -1105,12 +1105,12 @@ discard block |
||
| 1105 | 1105 | $tags = ''; |
| 1106 | 1106 | $itemTags = DB::query( |
| 1107 | 1107 | 'SELECT tag |
| 1108 | - FROM ' . prefixTable('tags') . ' |
|
| 1108 | + FROM ' . prefixTable('tags').' |
|
| 1109 | 1109 | WHERE item_id = %i AND tag != ""', |
| 1110 | 1110 | $ident |
| 1111 | 1111 | ); |
| 1112 | 1112 | foreach ($itemTags as $itemTag) { |
| 1113 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1113 | + $tags .= $itemTag['tag'].' '; |
|
| 1114 | 1114 | } |
| 1115 | 1115 | // form id_tree to full foldername |
| 1116 | 1116 | $folder = []; |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | // Is this a User id? |
| 1122 | 1122 | $user = DB::queryfirstrow( |
| 1123 | 1123 | 'SELECT id, login |
| 1124 | - FROM ' . prefixTable('users') . ' |
|
| 1124 | + FROM ' . prefixTable('users').' |
|
| 1125 | 1125 | WHERE id = %i', |
| 1126 | 1126 | $elem->title |
| 1127 | 1127 | ); |
@@ -1140,7 +1140,7 @@ discard block |
||
| 1140 | 1140 | 'label' => $data['label'], |
| 1141 | 1141 | 'description' => $data['description'], |
| 1142 | 1142 | 'tags' => isset($tags) && empty($tags) === false ? $tags : 'None', |
| 1143 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
| 1143 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
| 1144 | 1144 | 'id_tree' => $data['id_tree'], |
| 1145 | 1145 | 'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0', |
| 1146 | 1146 | 'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0', |
@@ -1162,52 +1162,52 @@ discard block |
||
| 1162 | 1162 | function getStatisticsData(array $SETTINGS): array |
| 1163 | 1163 | { |
| 1164 | 1164 | DB::query( |
| 1165 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1165 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1166 | 1166 | 0 |
| 1167 | 1167 | ); |
| 1168 | 1168 | $counter_folders = DB::count(); |
| 1169 | 1169 | DB::query( |
| 1170 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1170 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1171 | 1171 | 1 |
| 1172 | 1172 | ); |
| 1173 | 1173 | $counter_folders_perso = DB::count(); |
| 1174 | 1174 | DB::query( |
| 1175 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1175 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1176 | 1176 | 0 |
| 1177 | 1177 | ); |
| 1178 | 1178 | $counter_items = DB::count(); |
| 1179 | 1179 | DB::query( |
| 1180 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1180 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1181 | 1181 | 1 |
| 1182 | 1182 | ); |
| 1183 | 1183 | $counter_items_perso = DB::count(); |
| 1184 | 1184 | DB::query( |
| 1185 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
| 1185 | + 'SELECT id FROM '.prefixTable('users').'' |
|
| 1186 | 1186 | ); |
| 1187 | 1187 | $counter_users = DB::count(); |
| 1188 | 1188 | DB::query( |
| 1189 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
| 1189 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
| 1190 | 1190 | 1 |
| 1191 | 1191 | ); |
| 1192 | 1192 | $admins = DB::count(); |
| 1193 | 1193 | DB::query( |
| 1194 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
| 1194 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
| 1195 | 1195 | 1 |
| 1196 | 1196 | ); |
| 1197 | 1197 | $managers = DB::count(); |
| 1198 | 1198 | DB::query( |
| 1199 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
| 1199 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
| 1200 | 1200 | 1 |
| 1201 | 1201 | ); |
| 1202 | 1202 | $readOnly = DB::count(); |
| 1203 | 1203 | // list the languages |
| 1204 | 1204 | $usedLang = []; |
| 1205 | 1205 | $tp_languages = DB::query( |
| 1206 | - 'SELECT name FROM ' . prefixTable('languages') |
|
| 1206 | + 'SELECT name FROM '.prefixTable('languages') |
|
| 1207 | 1207 | ); |
| 1208 | 1208 | foreach ($tp_languages as $tp_language) { |
| 1209 | 1209 | DB::query( |
| 1210 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
| 1210 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
| 1211 | 1211 | $tp_language['name'] |
| 1212 | 1212 | ); |
| 1213 | 1213 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1216,12 +1216,12 @@ discard block |
||
| 1216 | 1216 | // get list of ips |
| 1217 | 1217 | $usedIp = []; |
| 1218 | 1218 | $tp_ips = DB::query( |
| 1219 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
| 1219 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
| 1220 | 1220 | ); |
| 1221 | 1221 | foreach ($tp_ips as $ip) { |
| 1222 | 1222 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
| 1223 | 1223 | $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']]; |
| 1224 | - } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
| 1224 | + } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
| 1225 | 1225 | $usedIp[$ip['user_ip']] = 1; |
| 1226 | 1226 | } |
| 1227 | 1227 | } |
@@ -1374,19 +1374,19 @@ discard block |
||
| 1374 | 1374 | // Load settings |
| 1375 | 1375 | //include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
| 1376 | 1376 | // Load superglobal |
| 1377 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1377 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1378 | 1378 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1379 | 1379 | // Get user language |
| 1380 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . (null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english') . '.php'; |
|
| 1380 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.(null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english').'.php'; |
|
| 1381 | 1381 | // Load library |
| 1382 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1382 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1383 | 1383 | // load PHPMailer |
| 1384 | - $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1384 | + $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1385 | 1385 | $mail->register(); |
| 1386 | 1386 | $mail = new PHPMailer\PHPMailer\PHPMailer(true); |
| 1387 | 1387 | |
| 1388 | 1388 | // send to user |
| 1389 | - $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1389 | + $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1390 | 1390 | $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true && $cron === false && $silent === false ? $SETTINGS['email_debug_level'] : 0; |
| 1391 | 1391 | $mail->Port = (int) $SETTINGS['email_port']; |
| 1392 | 1392 | //COULD BE USED |
@@ -1476,7 +1476,7 @@ discard block |
||
| 1476 | 1476 | <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;"> |
| 1477 | 1477 | <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;"> |
| 1478 | 1478 | <br><div style="float:right;">' . |
| 1479 | - $textMail . |
|
| 1479 | + $textMail. |
|
| 1480 | 1480 | '<br><br></td></tr></table> |
| 1481 | 1481 | </td></tr></table> |
| 1482 | 1482 | <br></body></html>'; |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | */ |
| 1490 | 1490 | function generateKey(): string |
| 1491 | 1491 | { |
| 1492 | - return substr(md5(rand() . rand()), 0, 15); |
|
| 1492 | + return substr(md5(rand().rand()), 0, 15); |
|
| 1493 | 1493 | } |
| 1494 | 1494 | |
| 1495 | 1495 | /** |
@@ -1567,7 +1567,7 @@ discard block |
||
| 1567 | 1567 | { |
| 1568 | 1568 | array_walk_recursive( |
| 1569 | 1569 | $array, |
| 1570 | - static function (&$item): void { |
|
| 1570 | + static function(&$item): void { |
|
| 1571 | 1571 | if (mb_detect_encoding((string) $item, 'utf-8', true) === false) { |
| 1572 | 1572 | $item = utf8_encode($item); |
| 1573 | 1573 | } |
@@ -1588,9 +1588,9 @@ discard block |
||
| 1588 | 1588 | */ |
| 1589 | 1589 | function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null) |
| 1590 | 1590 | { |
| 1591 | - $teampassDir = __DIR__ . '/..'; |
|
| 1591 | + $teampassDir = __DIR__.'/..'; |
|
| 1592 | 1592 | // Load superglobal |
| 1593 | - include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1593 | + include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1594 | 1594 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1595 | 1595 | // Get superglobals |
| 1596 | 1596 | if ($key !== null) { |
@@ -1601,10 +1601,10 @@ discard block |
||
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | //load Encoding |
| 1604 | - include_once $teampassDir . '/includes/libraries/ForceUTF8/Encoding.php'; |
|
| 1604 | + include_once $teampassDir.'/includes/libraries/ForceUTF8/Encoding.php'; |
|
| 1605 | 1605 | |
| 1606 | 1606 | //Load CRYPTOJS |
| 1607 | - include_once $teampassDir . '/includes/libraries/Encryption/CryptoJs/Encryption.php'; |
|
| 1607 | + include_once $teampassDir.'/includes/libraries/Encryption/CryptoJs/Encryption.php'; |
|
| 1608 | 1608 | |
| 1609 | 1609 | // Perform |
| 1610 | 1610 | if ($type === 'encode' && is_array($data) === true) { |
@@ -1676,8 +1676,8 @@ discard block |
||
| 1676 | 1676 | */ |
| 1677 | 1677 | function prefixTable(string $table): string |
| 1678 | 1678 | { |
| 1679 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
| 1680 | - if (! empty($safeTable)) { |
|
| 1679 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
| 1680 | + if (!empty($safeTable)) { |
|
| 1681 | 1681 | // sanitize string |
| 1682 | 1682 | return $safeTable; |
| 1683 | 1683 | } |
@@ -1707,13 +1707,13 @@ discard block |
||
| 1707 | 1707 | bool $lowercase = false, |
| 1708 | 1708 | array $SETTINGS = [] |
| 1709 | 1709 | ): string { |
| 1710 | - include_once __DIR__ . '/../sources/SplClassLoader.php'; |
|
| 1711 | - $generator = new SplClassLoader('PasswordGenerator\Generator', __DIR__. '/../includes/libraries'); |
|
| 1710 | + include_once __DIR__.'/../sources/SplClassLoader.php'; |
|
| 1711 | + $generator = new SplClassLoader('PasswordGenerator\Generator', __DIR__.'/../includes/libraries'); |
|
| 1712 | 1712 | $generator->register(); |
| 1713 | 1713 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
| 1714 | 1714 | // Is PHP7 being used? |
| 1715 | 1715 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
| 1716 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', __DIR__ . '/../includes/libraries'); |
|
| 1716 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', __DIR__.'/../includes/libraries'); |
|
| 1717 | 1717 | $php7generator->register(); |
| 1718 | 1718 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
| 1719 | 1719 | } |
@@ -1748,7 +1748,7 @@ discard block |
||
| 1748 | 1748 | function send_syslog($message, $host, $port, $component = 'teampass'): void |
| 1749 | 1749 | { |
| 1750 | 1750 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
| 1751 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
| 1751 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
| 1752 | 1752 | socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port); |
| 1753 | 1753 | socket_close($sock); |
| 1754 | 1754 | } |
@@ -1779,7 +1779,7 @@ discard block |
||
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | 1781 | // include librairies & connect to DB |
| 1782 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1782 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1783 | 1783 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1784 | 1784 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1785 | 1785 | } |
@@ -1805,14 +1805,14 @@ discard block |
||
| 1805 | 1805 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
| 1806 | 1806 | if ($type === 'user_mngt') { |
| 1807 | 1807 | send_syslog( |
| 1808 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
| 1808 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
| 1809 | 1809 | $SETTINGS['syslog_host'], |
| 1810 | 1810 | $SETTINGS['syslog_port'], |
| 1811 | 1811 | 'teampass' |
| 1812 | 1812 | ); |
| 1813 | 1813 | } else { |
| 1814 | 1814 | send_syslog( |
| 1815 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
| 1815 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
| 1816 | 1816 | $SETTINGS['syslog_host'], |
| 1817 | 1817 | $SETTINGS['syslog_port'], |
| 1818 | 1818 | 'teampass' |
@@ -1850,7 +1850,7 @@ discard block |
||
| 1850 | 1850 | ?string $old_value = null |
| 1851 | 1851 | ): void { |
| 1852 | 1852 | // include librairies & connect to DB |
| 1853 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1853 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1854 | 1854 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1855 | 1855 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1856 | 1856 | } |
@@ -1896,7 +1896,7 @@ discard block |
||
| 1896 | 1896 | if (empty($item_label) === true) { |
| 1897 | 1897 | $dataItem = DB::queryfirstrow( |
| 1898 | 1898 | 'SELECT id, id_tree, label |
| 1899 | - FROM ' . prefixTable('items') . ' |
|
| 1899 | + FROM ' . prefixTable('items').' |
|
| 1900 | 1900 | WHERE id = %i', |
| 1901 | 1901 | $item_id |
| 1902 | 1902 | ); |
@@ -1904,11 +1904,11 @@ discard block |
||
| 1904 | 1904 | } |
| 1905 | 1905 | |
| 1906 | 1906 | send_syslog( |
| 1907 | - 'action=' . str_replace('at_', '', $action) . |
|
| 1908 | - ' attribute=' . str_replace('at_', '', $attribute[0]) . |
|
| 1909 | - ' itemno=' . $item_id . |
|
| 1910 | - ' user=' . is_null($login) === true ? '' : addslashes((string) $login) . |
|
| 1911 | - ' itemname="' . addslashes($item_label) . '"', |
|
| 1907 | + 'action='.str_replace('at_', '', $action). |
|
| 1908 | + ' attribute='.str_replace('at_', '', $attribute[0]). |
|
| 1909 | + ' itemno='.$item_id. |
|
| 1910 | + ' user='.is_null($login) === true ? '' : addslashes((string) $login). |
|
| 1911 | + ' itemname="'.addslashes($item_label).'"', |
|
| 1912 | 1912 | $SETTINGS['syslog_host'], |
| 1913 | 1913 | $SETTINGS['syslog_port'], |
| 1914 | 1914 | 'teampass' |
@@ -1987,7 +1987,7 @@ discard block |
||
| 1987 | 1987 | function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void |
| 1988 | 1988 | { |
| 1989 | 1989 | // Load superglobal |
| 1990 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1990 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1991 | 1991 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1992 | 1992 | // Get superglobals |
| 1993 | 1993 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
@@ -1997,8 +1997,8 @@ discard block |
||
| 1997 | 1997 | $notification = DB::queryOneColumn( |
| 1998 | 1998 | 'email', |
| 1999 | 1999 | 'SELECT * |
| 2000 | - FROM ' . prefixTable('notification') . ' AS n |
|
| 2001 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
| 2000 | + FROM ' . prefixTable('notification').' AS n |
|
| 2001 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
| 2002 | 2002 | WHERE n.item_id = %i AND n.user_id != %i', |
| 2003 | 2003 | $item_id, |
| 2004 | 2004 | $globalsUserId |
@@ -2009,7 +2009,7 @@ discard block |
||
| 2009 | 2009 | // Get list of changes |
| 2010 | 2010 | $htmlChanges = '<ul>'; |
| 2011 | 2011 | foreach ($changes as $change) { |
| 2012 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
| 2012 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
| 2013 | 2013 | } |
| 2014 | 2014 | $htmlChanges .= '</ul>'; |
| 2015 | 2015 | // send email |
@@ -2042,7 +2042,7 @@ discard block |
||
| 2042 | 2042 | function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string |
| 2043 | 2043 | { |
| 2044 | 2044 | // Class loader |
| 2045 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 2045 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 2046 | 2046 | //Load Tree |
| 2047 | 2047 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
| 2048 | 2048 | $tree->register(); |
@@ -2051,15 +2051,15 @@ discard block |
||
| 2051 | 2051 | $path = ''; |
| 2052 | 2052 | foreach ($arbo as $elem) { |
| 2053 | 2053 | if (empty($path) === true) { |
| 2054 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 2054 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 2055 | 2055 | } else { |
| 2056 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2056 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2057 | 2057 | } |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | 2060 | // Build text to show user |
| 2061 | 2061 | if (empty($label) === false) { |
| 2062 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
| 2062 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
| 2063 | 2063 | } |
| 2064 | 2064 | return empty($path) === true ? '' : $path; |
| 2065 | 2065 | } |
@@ -2116,9 +2116,9 @@ discard block |
||
| 2116 | 2116 | */ |
| 2117 | 2117 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
| 2118 | 2118 | { |
| 2119 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
| 2119 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
| 2120 | 2120 | // include librairies & connect to DB |
| 2121 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2121 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2122 | 2122 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2123 | 2123 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2124 | 2124 | } |
@@ -2133,8 +2133,8 @@ discard block |
||
| 2133 | 2133 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
| 2134 | 2134 | // perform a copy |
| 2135 | 2135 | if (file_exists($tp_config_file)) { |
| 2136 | - if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
| 2137 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
| 2136 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
| 2137 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
| 2138 | 2138 | } |
| 2139 | 2139 | } |
| 2140 | 2140 | |
@@ -2144,11 +2144,11 @@ discard block |
||
| 2144 | 2144 | $data[1] = "global \$SETTINGS;\n"; |
| 2145 | 2145 | $data[2] = "\$SETTINGS = array (\n"; |
| 2146 | 2146 | $rows = DB::query( |
| 2147 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
| 2147 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
| 2148 | 2148 | 'admin' |
| 2149 | 2149 | ); |
| 2150 | 2150 | foreach ($rows as $record) { |
| 2151 | - array_push($data, " '" . $record['intitule'] . "' => '" . htmlspecialchars_decode($record['valeur'], ENT_COMPAT) . "',\n"); |
|
| 2151 | + array_push($data, " '".$record['intitule']."' => '".htmlspecialchars_decode($record['valeur'], ENT_COMPAT)."',\n"); |
|
| 2152 | 2152 | } |
| 2153 | 2153 | array_push($data, ");\n"); |
| 2154 | 2154 | $data = array_unique($data); |
@@ -2162,15 +2162,15 @@ discard block |
||
| 2162 | 2162 | break; |
| 2163 | 2163 | } |
| 2164 | 2164 | |
| 2165 | - if (stristr($line, "'" . $field . "' => '")) { |
|
| 2166 | - $data[$inc] = " '" . $field . "' => '" . htmlspecialchars_decode($value, ENT_COMPAT) . "',\n"; |
|
| 2165 | + if (stristr($line, "'".$field."' => '")) { |
|
| 2166 | + $data[$inc] = " '".$field."' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n"; |
|
| 2167 | 2167 | $bFound = true; |
| 2168 | 2168 | break; |
| 2169 | 2169 | } |
| 2170 | 2170 | ++$inc; |
| 2171 | 2171 | } |
| 2172 | 2172 | if ($bFound === false) { |
| 2173 | - $data[$inc] = " '" . $field . "' => '" . htmlspecialchars_decode($value, ENT_COMPAT). "',\n);\n"; |
|
| 2173 | + $data[$inc] = " '".$field."' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n);\n"; |
|
| 2174 | 2174 | } |
| 2175 | 2175 | } |
| 2176 | 2176 | |
@@ -2200,7 +2200,7 @@ discard block |
||
| 2200 | 2200 | { |
| 2201 | 2201 | global $SETTINGS; |
| 2202 | 2202 | /* LOAD CPASSMAN SETTINGS */ |
| 2203 | - if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
| 2203 | + if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
| 2204 | 2204 | $SETTINGS = []; |
| 2205 | 2205 | $SETTINGS['duplicate_folder'] = 0; |
| 2206 | 2206 | //by default, this is set to 0; |
@@ -2210,7 +2210,7 @@ discard block |
||
| 2210 | 2210 | //by default, this value is set to 5; |
| 2211 | 2211 | $settings = []; |
| 2212 | 2212 | $rows = DB::query( |
| 2213 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
| 2213 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
| 2214 | 2214 | [ |
| 2215 | 2215 | 'type' => 'admin', |
| 2216 | 2216 | 'type2' => 'settings', |
@@ -2242,7 +2242,7 @@ discard block |
||
| 2242 | 2242 | $source_cf = []; |
| 2243 | 2243 | $rows = DB::QUERY( |
| 2244 | 2244 | 'SELECT id_category |
| 2245 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2245 | + FROM ' . prefixTable('categories_folders').' |
|
| 2246 | 2246 | WHERE id_folder = %i', |
| 2247 | 2247 | $source_id |
| 2248 | 2248 | ); |
@@ -2253,7 +2253,7 @@ discard block |
||
| 2253 | 2253 | $target_cf = []; |
| 2254 | 2254 | $rows = DB::QUERY( |
| 2255 | 2255 | 'SELECT id_category |
| 2256 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2256 | + FROM ' . prefixTable('categories_folders').' |
|
| 2257 | 2257 | WHERE id_folder = %i', |
| 2258 | 2258 | $target_id |
| 2259 | 2259 | ); |
@@ -2288,9 +2288,9 @@ discard block |
||
| 2288 | 2288 | string $password = null |
| 2289 | 2289 | ) { |
| 2290 | 2290 | // Load AntiXSS |
| 2291 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 2292 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 2293 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 2291 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 2292 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 2293 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 2294 | 2294 | $antiXss = new voku\helper\AntiXSS(); |
| 2295 | 2295 | // Protect against bad inputs |
| 2296 | 2296 | if (is_array($source_file) === true || is_array($target_file) === true) { |
@@ -2347,20 +2347,20 @@ discard block |
||
| 2347 | 2347 | ) { |
| 2348 | 2348 | // load PhpEncryption library |
| 2349 | 2349 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2350 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php'; |
|
| 2351 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php'; |
|
| 2352 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php'; |
|
| 2353 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php'; |
|
| 2354 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 2355 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2356 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2357 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2358 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2359 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2360 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2361 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2362 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2363 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2350 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php'; |
|
| 2351 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php'; |
|
| 2352 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php'; |
|
| 2353 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php'; |
|
| 2354 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 2355 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2356 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2357 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2358 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2359 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2360 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2361 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2362 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2363 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2364 | 2364 | try { |
| 2365 | 2365 | \Defuse\Crypto\File::encryptFileWithPassword( |
| 2366 | 2366 | $source_file, |
@@ -2397,20 +2397,20 @@ discard block |
||
| 2397 | 2397 | ) { |
| 2398 | 2398 | // load PhpEncryption library |
| 2399 | 2399 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2400 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php'; |
|
| 2401 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php'; |
|
| 2402 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php'; |
|
| 2403 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php'; |
|
| 2404 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 2405 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2406 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2407 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2408 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2409 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2410 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2411 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2412 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2413 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2400 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php'; |
|
| 2401 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php'; |
|
| 2402 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php'; |
|
| 2403 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php'; |
|
| 2404 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
| 2405 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2406 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2407 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2408 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2409 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2410 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2411 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2412 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2413 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2414 | 2414 | try { |
| 2415 | 2415 | \Defuse\Crypto\File::decryptFileWithPassword( |
| 2416 | 2416 | $source_file, |
@@ -2457,9 +2457,9 @@ discard block |
||
| 2457 | 2457 | function fileDelete(string $file, array $SETTINGS): void |
| 2458 | 2458 | { |
| 2459 | 2459 | // Load AntiXSS |
| 2460 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 2461 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 2462 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 2460 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 2461 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 2462 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 2463 | 2463 | $antiXss = new voku\helper\AntiXSS(); |
| 2464 | 2464 | $file = $antiXss->xss_clean($file); |
| 2465 | 2465 | if (is_file($file)) { |
@@ -2509,7 +2509,7 @@ discard block |
||
| 2509 | 2509 | int $dirPerm = 0755 |
| 2510 | 2510 | ) { |
| 2511 | 2511 | // Check if the path exists |
| 2512 | - if (! file_exists($path)) { |
|
| 2512 | + if (!file_exists($path)) { |
|
| 2513 | 2513 | return false; |
| 2514 | 2514 | } |
| 2515 | 2515 | |
@@ -2547,7 +2547,7 @@ discard block |
||
| 2547 | 2547 | */ |
| 2548 | 2548 | function accessToItemIsGranted(int $item_id, array $SETTINGS) |
| 2549 | 2549 | { |
| 2550 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2550 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2551 | 2551 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2552 | 2552 | // Prepare superGlobal variables |
| 2553 | 2553 | $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION'); |
@@ -2555,7 +2555,7 @@ discard block |
||
| 2555 | 2555 | // Load item data |
| 2556 | 2556 | $data = DB::queryFirstRow( |
| 2557 | 2557 | 'SELECT id_tree |
| 2558 | - FROM ' . prefixTable('items') . ' |
|
| 2558 | + FROM ' . prefixTable('items').' |
|
| 2559 | 2559 | WHERE id = %i', |
| 2560 | 2560 | $item_id |
| 2561 | 2561 | ); |
@@ -2618,7 +2618,7 @@ discard block |
||
| 2618 | 2618 | } |
| 2619 | 2619 | $host .= substr(explode(".", $email[1])[0], -1, 1); |
| 2620 | 2620 | } |
| 2621 | - $email = $name . "@" . $host . "." . explode(".", $email[1])[1]; |
|
| 2621 | + $email = $name."@".$host.".".explode(".", $email[1])[1]; |
|
| 2622 | 2622 | return $email; |
| 2623 | 2623 | } |
| 2624 | 2624 | |
@@ -2634,8 +2634,8 @@ discard block |
||
| 2634 | 2634 | function performDBQuery(array $SETTINGS, string $fields, string $table): array |
| 2635 | 2635 | { |
| 2636 | 2636 | // include librairies & connect to DB |
| 2637 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2638 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2637 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2638 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2639 | 2639 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2640 | 2640 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2641 | 2641 | } |
@@ -2649,7 +2649,7 @@ discard block |
||
| 2649 | 2649 | DB::$connect_options = DB_CONNECT_OPTIONS; |
| 2650 | 2650 | // Insert log in DB |
| 2651 | 2651 | return DB::query( |
| 2652 | - 'SELECT ' . $fields . ' |
|
| 2652 | + 'SELECT '.$fields.' |
|
| 2653 | 2653 | FROM ' . prefixTable($table) |
| 2654 | 2654 | ); |
| 2655 | 2655 | } |
@@ -2664,11 +2664,11 @@ discard block |
||
| 2664 | 2664 | function formatSizeUnits(int $bytes): string |
| 2665 | 2665 | { |
| 2666 | 2666 | if ($bytes >= 1073741824) { |
| 2667 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
| 2667 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
| 2668 | 2668 | } elseif ($bytes >= 1048576) { |
| 2669 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
| 2669 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
| 2670 | 2670 | } elseif ($bytes >= 1024) { |
| 2671 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
| 2671 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
| 2672 | 2672 | } elseif ($bytes > 1) { |
| 2673 | 2673 | $bytes .= ' bytes'; |
| 2674 | 2674 | } elseif ($bytes === 1) { |
@@ -2883,14 +2883,14 @@ discard block |
||
| 2883 | 2883 | |
| 2884 | 2884 | // Encrypt the file content |
| 2885 | 2885 | $plaintext = file_get_contents( |
| 2886 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
| 2886 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
| 2887 | 2887 | ); |
| 2888 | 2888 | $ciphertext = $cipher->encrypt($plaintext); |
| 2889 | 2889 | // Save new file |
| 2890 | 2890 | $hash = md5($plaintext); |
| 2891 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
| 2891 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
| 2892 | 2892 | file_put_contents($fileOut, $ciphertext); |
| 2893 | - unlink($fileInPath . '/' . $fileInName); |
|
| 2893 | + unlink($fileInPath.'/'.$fileInName); |
|
| 2894 | 2894 | return [ |
| 2895 | 2895 | 'fileHash' => base64_encode($hash), |
| 2896 | 2896 | 'objectKey' => base64_encode($objectKey), |
@@ -2908,7 +2908,7 @@ discard block |
||
| 2908 | 2908 | */ |
| 2909 | 2909 | function decryptFile(string $fileName, string $filePath, string $key): string |
| 2910 | 2910 | { |
| 2911 | - if (! defined('FILE_BUFFER_SIZE')) { |
|
| 2911 | + if (!defined('FILE_BUFFER_SIZE')) { |
|
| 2912 | 2912 | define('FILE_BUFFER_SIZE', 128 * 1024); |
| 2913 | 2913 | } |
| 2914 | 2914 | |
@@ -2927,7 +2927,7 @@ discard block |
||
| 2927 | 2927 | $cipher->enableContinuousBuffer(); |
| 2928 | 2928 | $cipher->disablePadding(); |
| 2929 | 2929 | // Get file content |
| 2930 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
| 2930 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
| 2931 | 2931 | // Decrypt file content and return |
| 2932 | 2932 | return base64_encode($cipher->decrypt($ciphertext)); |
| 2933 | 2933 | } |
@@ -2988,9 +2988,9 @@ discard block |
||
| 2988 | 2988 | array $objectKeyArray = [] |
| 2989 | 2989 | ): void { |
| 2990 | 2990 | // include librairies |
| 2991 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2992 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2993 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2991 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2992 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2993 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2994 | 2994 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2995 | 2995 | |
| 2996 | 2996 | // connect to DB |
@@ -3023,8 +3023,8 @@ discard block |
||
| 3023 | 3023 | // Only create the sharekey for user |
| 3024 | 3024 | $user = DB::queryFirstRow( |
| 3025 | 3025 | 'SELECT public_key |
| 3026 | - FROM ' . prefixTable('users') . ' |
|
| 3027 | - WHERE id = ' . (int) $superGlobal->get('user_id', 'SESSION') . ' |
|
| 3026 | + FROM ' . prefixTable('users').' |
|
| 3027 | + WHERE id = ' . (int) $superGlobal->get('user_id', 'SESSION').' |
|
| 3028 | 3028 | AND public_key != ""' |
| 3029 | 3029 | ); |
| 3030 | 3030 | |
@@ -3061,10 +3061,9 @@ discard block |
||
| 3061 | 3061 | //DB::debugmode(true); |
| 3062 | 3062 | $users = DB::query( |
| 3063 | 3063 | 'SELECT id, public_key |
| 3064 | - FROM ' . prefixTable('users') . ' |
|
| 3064 | + FROM ' . prefixTable('users').' |
|
| 3065 | 3065 | WHERE ' . ($onlyForUser === true ? |
| 3066 | - 'id IN ("' . TP_USER_ID . '","' . $superGlobal->get('user_id', 'SESSION') . '") ' : |
|
| 3067 | - 'id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") ') . ' |
|
| 3066 | + 'id IN ("'.TP_USER_ID.'","'.$superGlobal->get('user_id', 'SESSION').'") ' : 'id NOT IN ("'.OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") ').' |
|
| 3068 | 3067 | AND public_key != ""' |
| 3069 | 3068 | ); |
| 3070 | 3069 | //DB::debugmode(false); |
@@ -3111,7 +3110,7 @@ discard block |
||
| 3111 | 3110 | function isBase64(string $str): bool |
| 3112 | 3111 | { |
| 3113 | 3112 | $str = (string) trim($str); |
| 3114 | - if (! isset($str[0])) { |
|
| 3113 | + if (!isset($str[0])) { |
|
| 3115 | 3114 | return false; |
| 3116 | 3115 | } |
| 3117 | 3116 | |
@@ -3179,12 +3178,12 @@ discard block |
||
| 3179 | 3178 | ], |
| 3180 | 3179 | ]; |
| 3181 | 3180 | // Load expected libraries |
| 3182 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 3183 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 3184 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 3185 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 3186 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 3187 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 3181 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 3182 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 3183 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 3184 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 3185 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 3186 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 3188 | 3187 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 3189 | 3188 | $ad->register(); |
| 3190 | 3189 | $connection = new Connection($config); |
@@ -3193,7 +3192,7 @@ discard block |
||
| 3193 | 3192 | $connection->connect(); |
| 3194 | 3193 | } catch (\LdapRecord\Auth\BindException $e) { |
| 3195 | 3194 | $error = $e->getDetailedError(); |
| 3196 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
| 3195 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
| 3197 | 3196 | return false; |
| 3198 | 3197 | } |
| 3199 | 3198 | |
@@ -3206,7 +3205,7 @@ discard block |
||
| 3206 | 3205 | } |
| 3207 | 3206 | } catch (\LdapRecord\Auth\BindException $e) { |
| 3208 | 3207 | $error = $e->getDetailedError(); |
| 3209 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
| 3208 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
| 3210 | 3209 | return false; |
| 3211 | 3210 | } |
| 3212 | 3211 | |
@@ -3224,8 +3223,8 @@ discard block |
||
| 3224 | 3223 | function deleteUserObjetsKeys(int $userId, array $SETTINGS = []): bool |
| 3225 | 3224 | { |
| 3226 | 3225 | // include librairies & connect to DB |
| 3227 | - include_once __DIR__. '/../includes/config/settings.php'; |
|
| 3228 | - include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3226 | + include_once __DIR__.'/../includes/config/settings.php'; |
|
| 3227 | + include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3229 | 3228 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3230 | 3229 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3231 | 3230 | } |
@@ -3285,7 +3284,7 @@ discard block |
||
| 3285 | 3284 | foreach (DateTimeZone::listIdentifiers() as $timezone) { |
| 3286 | 3285 | $now->setTimezone(new DateTimeZone($timezone)); |
| 3287 | 3286 | $offsets[] = $offset = $now->getOffset(); |
| 3288 | - $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); |
|
| 3287 | + $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone); |
|
| 3289 | 3288 | } |
| 3290 | 3289 | |
| 3291 | 3290 | array_multisort($offsets, $timezones); |
@@ -3305,7 +3304,7 @@ discard block |
||
| 3305 | 3304 | { |
| 3306 | 3305 | $hours = intval($offset / 3600); |
| 3307 | 3306 | $minutes = abs(intval($offset % 3600 / 60)); |
| 3308 | - return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
| 3307 | + return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
| 3309 | 3308 | } |
| 3310 | 3309 | |
| 3311 | 3310 | /** |
@@ -3405,8 +3404,7 @@ discard block |
||
| 3405 | 3404 | { |
| 3406 | 3405 | if (isset($array[$key]) === true |
| 3407 | 3406 | && (is_int($value) === true ? |
| 3408 | - (int) $array[$key] === $value : |
|
| 3409 | - (string) $array[$key] === $value) |
|
| 3407 | + (int) $array[$key] === $value : (string) $array[$key] === $value) |
|
| 3410 | 3408 | ) { |
| 3411 | 3409 | return true; |
| 3412 | 3410 | } |
@@ -3428,8 +3426,7 @@ discard block |
||
| 3428 | 3426 | { |
| 3429 | 3427 | if (isset($var) === false |
| 3430 | 3428 | || (is_int($value) === true ? |
| 3431 | - (int) $var === $value : |
|
| 3432 | - (string) $var === $value) |
|
| 3429 | + (int) $var === $value : (string) $var === $value) |
|
| 3433 | 3430 | ) { |
| 3434 | 3431 | return true; |
| 3435 | 3432 | } |
@@ -3480,7 +3477,7 @@ discard block |
||
| 3480 | 3477 | */ |
| 3481 | 3478 | function isSetArrayOfValues(array $arrayOfValues): bool |
| 3482 | 3479 | { |
| 3483 | - foreach($arrayOfValues as $value) { |
|
| 3480 | + foreach ($arrayOfValues as $value) { |
|
| 3484 | 3481 | if (isset($value) === false) { |
| 3485 | 3482 | return false; |
| 3486 | 3483 | } |
@@ -3502,7 +3499,7 @@ discard block |
||
| 3502 | 3499 | /*PHP8 - integer|string*/$value |
| 3503 | 3500 | ) : bool |
| 3504 | 3501 | { |
| 3505 | - foreach($arrayOfVars as $variable) { |
|
| 3502 | + foreach ($arrayOfVars as $variable) { |
|
| 3506 | 3503 | if ($variable !== $value) { |
| 3507 | 3504 | return false; |
| 3508 | 3505 | } |
@@ -3522,7 +3519,7 @@ discard block |
||
| 3522 | 3519 | /*PHP8 - integer|string*/$value |
| 3523 | 3520 | ) : bool |
| 3524 | 3521 | { |
| 3525 | - foreach($arrayOfVars as $variable) { |
|
| 3522 | + foreach ($arrayOfVars as $variable) { |
|
| 3526 | 3523 | if ($variable === $value) { |
| 3527 | 3524 | return true; |
| 3528 | 3525 | } |
@@ -3591,26 +3588,26 @@ discard block |
||
| 3591 | 3588 | function dataSanitizer( |
| 3592 | 3589 | array $data, |
| 3593 | 3590 | array $filters, |
| 3594 | - string $path = __DIR__. '/..' // Path to Teampass root |
|
| 3591 | + string $path = __DIR__.'/..' // Path to Teampass root |
|
| 3595 | 3592 | ) |
| 3596 | 3593 | { |
| 3597 | 3594 | // Load Sanitizer library |
| 3598 | - require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php'; |
|
| 3599 | - require_once $path . '/includes/libraries/Illuminate/Support/Str.php'; |
|
| 3600 | - require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php'; |
|
| 3601 | - require_once $path . '/includes/libraries/Illuminate/Support/Arr.php'; |
|
| 3602 | - require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php'; |
|
| 3603 | - require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php'; |
|
| 3604 | - require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php'; |
|
| 3605 | - require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php'; |
|
| 3606 | - require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php'; |
|
| 3607 | - require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php'; |
|
| 3595 | + require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php'; |
|
| 3596 | + require_once $path.'/includes/libraries/Illuminate/Support/Str.php'; |
|
| 3597 | + require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php'; |
|
| 3598 | + require_once $path.'/includes/libraries/Illuminate/Support/Arr.php'; |
|
| 3599 | + require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php'; |
|
| 3600 | + require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php'; |
|
| 3601 | + require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php'; |
|
| 3602 | + require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php'; |
|
| 3603 | + require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php'; |
|
| 3604 | + require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php'; |
|
| 3608 | 3605 | $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters); |
| 3609 | 3606 | |
| 3610 | 3607 | // Load AntiXSS |
| 3611 | - include_once $path. '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 3612 | - include_once $path . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 3613 | - include_once $path . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 3608 | + include_once $path.'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 3609 | + include_once $path.'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 3610 | + include_once $path.'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 3614 | 3611 | $antiXss = new voku\helper\AntiXSS(); |
| 3615 | 3612 | |
| 3616 | 3613 | // Sanitize post and get variables |
@@ -3628,9 +3625,9 @@ discard block |
||
| 3628 | 3625 | */ |
| 3629 | 3626 | function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS, string $field_update = '') |
| 3630 | 3627 | { |
| 3631 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 3628 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 3632 | 3629 | //Connect to DB |
| 3633 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3630 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3634 | 3631 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3635 | 3632 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3636 | 3633 | } |
@@ -3646,7 +3643,7 @@ discard block |
||
| 3646 | 3643 | // Exists ? |
| 3647 | 3644 | $userCacheId = DB::queryfirstrow( |
| 3648 | 3645 | 'SELECT increment_id |
| 3649 | - FROM ' . prefixTable('cache_tree') . ' |
|
| 3646 | + FROM ' . prefixTable('cache_tree').' |
|
| 3650 | 3647 | WHERE user_id = %i', |
| 3651 | 3648 | $user_id |
| 3652 | 3649 | ); |
@@ -3695,7 +3692,7 @@ discard block |
||
| 3695 | 3692 | */ |
| 3696 | 3693 | function pourcentage(float $nombre, float $total, float $pourcentage): float |
| 3697 | 3694 | { |
| 3698 | - $resultat = ($nombre/$total) * $pourcentage; |
|
| 3695 | + $resultat = ($nombre / $total) * $pourcentage; |
|
| 3699 | 3696 | return round($resultat); |
| 3700 | 3697 | } |
| 3701 | 3698 | |
@@ -3723,7 +3720,7 @@ discard block |
||
| 3723 | 3720 | |
| 3724 | 3721 | // Get last folder update |
| 3725 | 3722 | $lastFolderChange = DB::queryfirstrow( |
| 3726 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' |
|
| 3723 | + 'SELECT valeur FROM '.prefixTable('misc').' |
|
| 3727 | 3724 | WHERE type = %s AND intitule = %s', |
| 3728 | 3725 | 'timestamp', |
| 3729 | 3726 | 'last_folder_change' |
@@ -3753,7 +3750,7 @@ discard block |
||
| 3753 | 3750 | // Does this user has a tree cache |
| 3754 | 3751 | $userCacheTree = DB::queryfirstrow( |
| 3755 | 3752 | 'SELECT '.$fieldName.' |
| 3756 | - FROM ' . prefixTable('cache_tree') . ' |
|
| 3753 | + FROM ' . prefixTable('cache_tree').' |
|
| 3757 | 3754 | WHERE user_id = %i', |
| 3758 | 3755 | $_SESSION['user_id'] |
| 3759 | 3756 | ); |
@@ -3782,10 +3779,10 @@ discard block |
||
| 3782 | 3779 | ) |
| 3783 | 3780 | { |
| 3784 | 3781 | //load ClassLoader |
| 3785 | - include_once __DIR__. '/../sources/SplClassLoader.php'; |
|
| 3782 | + include_once __DIR__.'/../sources/SplClassLoader.php'; |
|
| 3786 | 3783 | |
| 3787 | 3784 | //Connect to DB |
| 3788 | - include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3785 | + include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3789 | 3786 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3790 | 3787 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, [])); |
| 3791 | 3788 | } |
@@ -3804,7 +3801,7 @@ discard block |
||
| 3804 | 3801 | if (count($folderIds) === 0) { |
| 3805 | 3802 | $folderIds = DB::queryFirstColumn( |
| 3806 | 3803 | 'SELECT id |
| 3807 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 3804 | + FROM ' . prefixTable('nested_tree').' |
|
| 3808 | 3805 | WHERE personal_folder=%i', |
| 3809 | 3806 | 0 |
| 3810 | 3807 | ); |
@@ -3821,8 +3818,8 @@ discard block |
||
| 3821 | 3818 | $rows_tmp = DB::query( |
| 3822 | 3819 | 'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory, |
| 3823 | 3820 | f.id_category AS category_id |
| 3824 | - FROM ' . prefixTable('categories_folders') . ' AS f |
|
| 3825 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id) |
|
| 3821 | + FROM ' . prefixTable('categories_folders').' AS f |
|
| 3822 | + INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id) |
|
| 3826 | 3823 | WHERE id_folder=%i', |
| 3827 | 3824 | $folder |
| 3828 | 3825 | ); |
@@ -3848,7 +3845,7 @@ discard block |
||
| 3848 | 3845 | $valTemp = ''; |
| 3849 | 3846 | $data = DB::queryFirstRow( |
| 3850 | 3847 | 'SELECT valeur |
| 3851 | - FROM ' . prefixTable('misc') . ' |
|
| 3848 | + FROM ' . prefixTable('misc').' |
|
| 3852 | 3849 | WHERE type = %s AND intitule=%i', |
| 3853 | 3850 | 'complex', |
| 3854 | 3851 | $folder |
@@ -3865,14 +3862,14 @@ discard block |
||
| 3865 | 3862 | $valTemp = ''; |
| 3866 | 3863 | $rows_tmp = DB::query( |
| 3867 | 3864 | 'SELECT t.title |
| 3868 | - FROM ' . prefixTable('roles_values') . ' as v |
|
| 3869 | - INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id) |
|
| 3865 | + FROM ' . prefixTable('roles_values').' as v |
|
| 3866 | + INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id) |
|
| 3870 | 3867 | WHERE v.folder_id = %i |
| 3871 | 3868 | GROUP BY title', |
| 3872 | 3869 | $folder |
| 3873 | 3870 | ); |
| 3874 | 3871 | foreach ($rows_tmp as $record) { |
| 3875 | - $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title']; |
|
| 3872 | + $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title']; |
|
| 3876 | 3873 | } |
| 3877 | 3874 | $arr_data['visibilityRoles'] = $valTemp; |
| 3878 | 3875 | |
@@ -3904,7 +3901,7 @@ discard block |
||
| 3904 | 3901 | // loop on users and check if user has this role |
| 3905 | 3902 | $rows = DB::query( |
| 3906 | 3903 | 'SELECT id, fonction_id |
| 3907 | - FROM ' . prefixTable('users') . ' |
|
| 3904 | + FROM ' . prefixTable('users').' |
|
| 3908 | 3905 | WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""', |
| 3909 | 3906 | $_SESSION['user_id'] |
| 3910 | 3907 | ); |
@@ -3943,7 +3940,7 @@ discard block |
||
| 3943 | 3940 | |
| 3944 | 3941 | $val = DB::queryfirstrow( |
| 3945 | 3942 | 'SELECT * |
| 3946 | - FROM ' . prefixTable('users') . ' |
|
| 3943 | + FROM ' . prefixTable('users').' |
|
| 3947 | 3944 | WHERE id = %i', |
| 3948 | 3945 | $userId |
| 3949 | 3946 | ); |
@@ -3959,12 +3956,12 @@ discard block |
||
| 3959 | 3956 | function upgradeRequired(): bool |
| 3960 | 3957 | { |
| 3961 | 3958 | // Get settings.php |
| 3962 | - include_once __DIR__. '/../includes/config/settings.php'; |
|
| 3959 | + include_once __DIR__.'/../includes/config/settings.php'; |
|
| 3963 | 3960 | |
| 3964 | 3961 | // Get timestamp in DB |
| 3965 | 3962 | $val = DB::queryfirstrow( |
| 3966 | 3963 | 'SELECT valeur |
| 3967 | - FROM ' . prefixTable('misc') . ' |
|
| 3964 | + FROM ' . prefixTable('misc').' |
|
| 3968 | 3965 | WHERE type = %s AND intitule = %s', |
| 3969 | 3966 | 'admin', |
| 3970 | 3967 | 'upgrade_timestamp' |
@@ -4011,7 +4008,7 @@ discard block |
||
| 4011 | 4008 | // prepapre background tasks for item keys generation |
| 4012 | 4009 | $userTP = DB::queryFirstRow( |
| 4013 | 4010 | 'SELECT pw, public_key, private_key |
| 4014 | - FROM ' . prefixTable('users') . ' |
|
| 4011 | + FROM ' . prefixTable('users').' |
|
| 4015 | 4012 | WHERE id = %i', |
| 4016 | 4013 | TP_USER_ID |
| 4017 | 4014 | ); |
@@ -4071,8 +4068,8 @@ discard block |
||
| 4071 | 4068 | 'process_type' => 'create_user_keys', |
| 4072 | 4069 | 'arguments' => json_encode([ |
| 4073 | 4070 | 'new_user_id' => (int) $userId, |
| 4074 | - 'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'], |
|
| 4075 | - 'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'], |
|
| 4071 | + 'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'], |
|
| 4072 | + 'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'], |
|
| 4076 | 4073 | 'owner_id' => (int) TP_USER_ID, |
| 4077 | 4074 | 'creator_pwd' => $userTP['pw'], |
| 4078 | 4075 | 'send_email' => $sendEmailToUser === true ? 1 : 0, |