@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ) { |
| 75 | 75 | // Not allowed page |
| 76 | 76 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 77 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 77 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 78 | 78 | exit; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | if ( |
| 132 | 132 | is_array($dataReceived) && // check if the data is an array |
| 133 | - array_diff_key(array_flip($requiredKeys), $dataReceived) === [] && // check if all required keys have a valuekeys are present |
|
| 133 | + array_diff_key(array_flip($requiredKeys), $dataReceived) === [] && // check if all required keys have a valuekeys are present |
|
| 134 | 134 | count(array_filter($dataReceived)) === count($requiredKeys) && // check if all required |
| 135 | 135 | in_array($dataReceived['action'], ['at_password_shown', 'at_password_copied'], true) && // only log these actions |
| 136 | 136 | $session->get('user-id') === (int) filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT) // only log actions of the current user |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | // Show passwords inputs and form |
| 177 | 177 | $('#dialog-user-change-password-info') |
| 178 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('user_has_to_change_password_info');?>') |
|
| 178 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('user_has_to_change_password_info'); ?>') |
|
| 179 | 179 | .removeClass('hidden'); |
| 180 | 180 | $('#dialog-user-change-password').removeClass('hidden'); |
| 181 | 181 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | // Show passwords inputs and form |
| 190 | 190 | $('#dialog-ldap-user-change-password-info') |
| 191 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>') |
|
| 191 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>') |
|
| 192 | 192 | .removeClass('hidden'); |
| 193 | 193 | $('#dialog-ldap-user-change-password').removeClass('hidden'); |
| 194 | 194 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | if (data.queryResults.auth_type === 'oauth2') { |
| 218 | 218 | // LDAP or local account to OAuth2 account |
| 219 | - var info_message = '<?php echo $lang->get('oauth2_need_user_old_password');?>'; |
|
| 219 | + var info_message = '<?php echo $lang->get('oauth2_need_user_old_password'); ?>'; |
|
| 220 | 220 | |
| 221 | 221 | // Hide the "new password" field that users can't fill in manually |
| 222 | 222 | $('#new-password-field').hide(); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $('#dialog-ldap-user-change-password-current').val(oauth2_encryption_hash); |
| 229 | 229 | } else { |
| 230 | 230 | // LDAP password updated |
| 231 | - var info_message = '<?php echo $lang->get('ldap_user_has_changed_his_password');?>'; |
|
| 231 | + var info_message = '<?php echo $lang->get('ldap_user_has_changed_his_password'); ?>'; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Display info tip |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | /*console.log('User has to regenerate keys') |
| 340 | 340 | // HIde |
| 341 | 341 | $('.content-header, .content').addClass('hidden'); |
| 342 | - $('#dialog-user-temporary-code-info').html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('renecyption_expected');?>'); |
|
| 342 | + $('#dialog-user-temporary-code-info').html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('renecyption_expected'); ?>'); |
|
| 343 | 343 | |
| 344 | 344 | // Show passwords inputs and form |
| 345 | 345 | $('#dialog-user-temporary-code').removeClass('hidden'); |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | { |
| 422 | 422 | if (step === 'psk') { |
| 423 | 423 | // Inform user |
| 424 | - $("#user-current-defuse-psk-progress").html('<b><?php echo $lang->get('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' + |
|
| 424 | + $("#user-current-defuse-psk-progress").html('<b><?php echo $lang->get('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' + |
|
| 425 | 425 | '... <?php echo $lang->get('please_wait'); ?><i class="fa-solid fa-spinner fa-pulse ml-3 text-primary"></i>'); |
| 426 | 426 | |
| 427 | 427 | var data = { |
| 428 | 428 | 'userPsk' : $('#user-current-defuse-psk').val(), |
| 429 | 429 | 'start': start, |
| 430 | - 'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>, |
|
| 430 | + 'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>, |
|
| 431 | 431 | 'user_id': userId, |
| 432 | 432 | 'counterItemsToTreat': counterItemsToTreat |
| 433 | 433 | }; |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | // Show passwords inputs and form |
| 505 | 505 | $('#dialog-ldap-user-change-password-info') |
| 506 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>') |
|
| 506 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>') |
|
| 507 | 507 | .removeClass('hidden'); |
| 508 | 508 | $('#dialog-ldap-user-change-password').removeClass('hidden'); |
| 509 | 509 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | '</div>' + |
| 594 | 594 | '</div>' + |
| 595 | 595 | '</div>' + |
| 596 | - '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' + |
|
| 596 | + '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' + |
|
| 597 | 597 | '<h6><?php echo $lang->get('provide_recovery_keys'); ?></h6>' + |
| 598 | 598 | '<div class="input-group mb-2">' + |
| 599 | 599 | '<div class="input-group-prepend">' + |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | '<textarea rows="2" id="recovery-private-key" class="form-control form-item-control"></textarea>' + |
| 609 | 609 | '</div>' + |
| 610 | 610 | '</div>' + |
| 611 | - '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' + |
|
| 611 | + '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' + |
|
| 612 | 612 | '<div class="alert" id="confirm-no-recovery-keys-div">' + |
| 613 | 613 | '<div class="form-check">' + |
| 614 | 614 | '<input type="checkbox" class="form-check-input" id="confirm-no-recovery-keys">' + |
@@ -1172,15 +1172,15 @@ discard block |
||
| 1172 | 1172 | // Prepare data |
| 1173 | 1173 | var data = { |
| 1174 | 1174 | 'receipt': $('#temp-user-email').val(), |
| 1175 | - 'subject': '[Teampass] <?php echo $lang->get('your_new_password');?>', |
|
| 1176 | - 'body': '<?php echo $lang->get('email_body_temporary_login_password');?>', |
|
| 1175 | + 'subject': '[Teampass] <?php echo $lang->get('your_new_password'); ?>', |
|
| 1176 | + 'body': '<?php echo $lang->get('email_body_temporary_login_password'); ?>', |
|
| 1177 | 1177 | 'pre_replace' : { |
| 1178 | 1178 | '#enc_code#' : $('#temp-user-pwd').val(), |
| 1179 | 1179 | } |
| 1180 | 1180 | } |
| 1181 | 1181 | if (debugJavascript === true) console.log(data); |
| 1182 | 1182 | // Prepare form |
| 1183 | - $('#dialog-admin-change-user-password-info').html('<?php echo $lang->get('sending_email_message');?>'); |
|
| 1183 | + $('#dialog-admin-change-user-password-info').html('<?php echo $lang->get('sending_email_message'); ?>'); |
|
| 1184 | 1184 | toastr.remove(); |
| 1185 | 1185 | toastr.info( |
| 1186 | 1186 | '<?php echo $lang->get('in_progress'); ?><i class="fa-solid fa-circle-notch fa-spin fa-2x ml-3"></i>' |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | '#warningModal', |
| 1703 | 1703 | '<i class="fa-solid fa-clock fa-lg warning mr-2"></i><?php echo $lang->get('index_add_one_hour'); ?>', |
| 1704 | 1704 | '<div class="form-group">' + |
| 1705 | - '<label for="warningModal-input" class="col-form-label"><?php echo $lang->get('extend_session_duration_by') . ' (' . $lang->get('minutes') . ')'; ?>:</label>' + |
|
| 1705 | + '<label for="warningModal-input" class="col-form-label"><?php echo $lang->get('extend_session_duration_by').' ('.$lang->get('minutes').')'; ?>:</label>' + |
|
| 1706 | 1706 | '<input type="number" max="'+(60*60*24)+'" class="form-control" id="warningModal-input" value="60">' + |
| 1707 | 1707 | '</div>' + |
| 1708 | 1708 | '<div class="form-text text-muted"><i class=\"fa-solid fa-info-circle mr-2\"></i><?php echo $lang->get('maximum_session_expiration_time'); ?>: '+data.max_session_duration+'</div>', |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | return DB::query( |
| 31 | 31 | 'SELECT * |
| 32 | - FROM ' . prefixTable('users') . ' |
|
| 32 | + FROM ' . prefixTable('users').' |
|
| 33 | 33 | ORDER BY id ASC LIMIT %i', |
| 34 | 34 | $limit |
| 35 | 35 | ); |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | // Get items |
| 51 | 51 | $rows = DB::query( |
| 52 | 52 | 'SELECT i.id, label, description, i.pw, i.url, i.id_tree, i.login, i.email, i.viewed_no, i.fa_icon, i.inactif, i.perso, t.title as folder_label |
| 53 | - FROM ' . prefixTable('items') . ' AS i |
|
| 53 | + FROM ' . prefixTable('items').' AS i |
|
| 54 | 54 | LEFT JOIN '.prefixTable('nested_tree').' as t ON (t.id = i.id_tree) '. |
| 55 | - $sqlExtra . |
|
| 56 | - " ORDER BY i.id ASC" . |
|
| 57 | - ($limit > 0 ? " LIMIT ". $limit : '') |
|
| 55 | + $sqlExtra. |
|
| 56 | + " ORDER BY i.id ASC". |
|
| 57 | + ($limit > 0 ? " LIMIT ".$limit : '') |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | $ret = []; |
| 61 | 61 | foreach ($rows as $row) { |
| 62 | 62 | $userKey = DB::queryfirstrow( |
| 63 | 63 | 'SELECT share_key |
| 64 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 64 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 65 | 65 | WHERE user_id = %i AND object_id = %i', |
| 66 | 66 | $userId, |
| 67 | 67 | $row['id'] |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (empty($path) === true) { |
| 99 | 99 | $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
| 100 | 100 | } else { |
| 101 | - $path .= '/' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 101 | + $path .= '/'.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ) : array |
| 149 | 149 | { |
| 150 | 150 | try { |
| 151 | - include_once API_ROOT_PATH . '/../sources/main.functions.php'; |
|
| 151 | + include_once API_ROOT_PATH.'/../sources/main.functions.php'; |
|
| 152 | 152 | |
| 153 | 153 | // Load config |
| 154 | 154 | $configManager = new ConfigManager(); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if (strlen($password) > $SETTINGS['pwd_maximum_length']) { |
| 274 | - throw new Exception('Password is too long (max allowed is ' . $SETTINGS['pwd_maximum_length'] . ' characters)'); |
|
| 274 | + throw new Exception('Password is too long (max allowed is '.$SETTINGS['pwd_maximum_length'].' characters)'); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | $dataFolderSettings = DB::queryFirstRow( |
| 286 | 286 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
| 287 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 287 | + FROM ' . prefixTable('nested_tree').' |
|
| 288 | 288 | WHERE id = %i', |
| 289 | 289 | $folderId |
| 290 | 290 | ); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | { |
| 308 | 308 | $folderComplexity = DB::queryFirstRow( |
| 309 | 309 | 'SELECT valeur |
| 310 | - FROM ' . prefixTable('misc') . ' |
|
| 310 | + FROM ' . prefixTable('misc').' |
|
| 311 | 311 | WHERE type = %s AND intitule = %i', |
| 312 | 312 | 'complex', |
| 313 | 313 | $itemInfos['folderId'] |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | private function checkForDuplicates(string $label, array $SETTINGS, array $itemInfos) : void |
| 336 | 336 | { |
| 337 | 337 | DB::queryFirstRow( |
| 338 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 338 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 339 | 339 | WHERE label = %s AND inactif = %i', |
| 340 | 340 | $label, |
| 341 | 341 | 0 |
@@ -342,8 +342,8 @@ |
||
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | if (DB::count() > 0 && ( |
| 345 | - (isset($SETTINGS['duplicate_item']) && (int) $SETTINGS['duplicate_item'] === 0) |
|
| 346 | - && (int) $itemInfos['personal_folder'] === 0) |
|
| 345 | + (isset($SETTINGS['duplicate_item']) && (int) $SETTINGS['duplicate_item'] === 0) |
|
| 346 | + && (int) $itemInfos['personal_folder'] === 0) |
|
| 347 | 347 | ) { |
| 348 | 348 | throw new Exception('Similar item already exists. Duplicates are not allowed.'); |
| 349 | 349 | } |
@@ -401,12 +401,13 @@ |
||
| 401 | 401 | <select class="form-control" id="profile-user-timezone"> |
| 402 | 402 | <?php foreach ($zones as $key => $zone): ?> |
| 403 | 403 | <option value="<?php echo $key; ?>"<?php |
| 404 | - if ($session->has('user-timezone')) |
|
| 405 | - if($session->get('user-timezone') === $key) |
|
| 404 | + if ($session->has('user-timezone')) { |
|
| 405 | + if($session->get('user-timezone') === $key) |
|
| 406 | 406 | echo ' selected'; |
| 407 | - elseif ($session->get('user-timezone') === 'not_defined') |
|
| 408 | - if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
|
| 407 | + } elseif ($session->get('user-timezone') === 'not_defined') { |
|
| 408 | + if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
|
| 409 | 409 | echo ' selected'; |
| 410 | + } |
|
| 410 | 411 | ?>><?php echo $zone; ?></option> |
| 411 | 412 | <?php endforeach; ?> |
| 412 | 413 | </select> |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) { |
| 69 | 69 | // Not allowed page |
| 70 | 70 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 71 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 71 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 72 | 72 | exit; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -101,49 +101,49 @@ discard block |
||
| 101 | 101 | $zones = timezone_list(); |
| 102 | 102 | // prepare list of languages |
| 103 | 103 | $languages = DB::query( |
| 104 | - 'SELECT label, name FROM ' . prefixTable('languages') . ' ORDER BY label ASC' |
|
| 104 | + 'SELECT label, name FROM '.prefixTable('languages').' ORDER BY label ASC' |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | // Do some stats |
| 108 | 108 | $userItemsNumber = DB::queryFirstField( |
| 109 | 109 | 'SELECT COUNT(id_item) as count |
| 110 | - FROM ' . prefixTable('log_items') . ' |
|
| 110 | + FROM ' . prefixTable('log_items').' |
|
| 111 | 111 | WHERE action = "at_creation" AND id_user = %i', |
| 112 | 112 | $session->get('user-id') |
| 113 | 113 | ); |
| 114 | 114 | |
| 115 | 115 | $userModificationNumber = DB::queryFirstField( |
| 116 | 116 | 'SELECT COUNT(id_item) as count |
| 117 | - FROM ' . prefixTable('log_items') . ' |
|
| 117 | + FROM ' . prefixTable('log_items').' |
|
| 118 | 118 | WHERE action = "at_modification" AND id_user = %i', |
| 119 | 119 | $session->get('user-id') |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | 122 | $userSeenItemsNumber = DB::queryFirstField( |
| 123 | 123 | 'SELECT COUNT(id_item) as count |
| 124 | - FROM ' . prefixTable('log_items') . ' |
|
| 124 | + FROM ' . prefixTable('log_items').' |
|
| 125 | 125 | WHERE action = "at_shown" AND id_user = %i', |
| 126 | 126 | $session->get('user-id') |
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $userSeenPasswordsNumber = DB::queryFirstField( |
| 130 | 130 | 'SELECT COUNT(id_item) |
| 131 | - FROM ' . prefixTable('log_items') . ' |
|
| 131 | + FROM ' . prefixTable('log_items').' |
|
| 132 | 132 | WHERE action = "at_password_shown" AND id_user = %i', |
| 133 | 133 | $session->get('user-id') |
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | 136 | $userInfo = DB::queryFirstRow( |
| 137 | 137 | 'SELECT avatar, last_pw_change |
| 138 | - FROM ' . prefixTable('users') . ' |
|
| 138 | + FROM ' . prefixTable('users').' |
|
| 139 | 139 | WHERE id = %i', |
| 140 | 140 | $session->get('user-id') |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | 143 | if (empty($userInfo['avatar']) === true) { |
| 144 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
| 144 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
| 145 | 145 | } else { |
| 146 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $userInfo['avatar']; |
|
| 146 | + $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$userInfo['avatar']; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Get Groups name |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | foreach ($session->get('user-roles_array') as $role) { |
| 152 | 152 | $tmp = DB::queryFirstRow( |
| 153 | 153 | 'SELECT title |
| 154 | - FROM ' . prefixTable('roles_title') . ' |
|
| 154 | + FROM ' . prefixTable('roles_title').' |
|
| 155 | 155 | WHERE id = %i', |
| 156 | 156 | $role |
| 157 | 157 | ); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | <h3 id="profile-username" class="text-center"> |
| 198 | 198 | <?php |
| 199 | 199 | if (null !== $session->get('user-name') && empty($session->get('user-name')) === false) { |
| 200 | - echo $session->get('user-name') . ' ' . $session->get('user-lastname'); |
|
| 200 | + echo $session->get('user-name').' '.$session->get('user-lastname'); |
|
| 201 | 201 | } else { |
| 202 | 202 | echo $session->get('user-login'); |
| 203 | 203 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } else { |
| 266 | 266 | echo date('d/m/Y', (int) $session->get('user-last_connection')); |
| 267 | 267 | } |
| 268 | - echo ' ' . $lang->get('at') . ' '; |
|
| 268 | + echo ' '.$lang->get('at').' '; |
|
| 269 | 269 | if (isset($SETTINGS['time_format']) === true) { |
| 270 | 270 | echo date($SETTINGS['time_format'], (int) $session->get('user-last_connection')); |
| 271 | 271 | } else { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | </a> |
| 276 | 276 | </li> |
| 277 | 277 | <?php |
| 278 | - if (null !== $session->get('user-last_pw_change') && ! empty($session->get('user-last_pw_change') === true)) { |
|
| 278 | + if (null !== $session->get('user-last_pw_change') && !empty($session->get('user-last_pw_change') === true)) { |
|
| 279 | 279 | // Handle last password change string |
| 280 | 280 | if ($session->has('user-last_pw_change') && null !== $session->get('user-last_pw_change')) { |
| 281 | 281 | if (isset($SETTINGS['date_format']) === true) { |
@@ -295,12 +295,12 @@ discard block |
||
| 295 | 295 | ) { |
| 296 | 296 | $numDaysBeforePwExpiration = ''; |
| 297 | 297 | } else { |
| 298 | - $numDaysBeforePwExpiration = $lang['index_pw_expiration'] . ' ' . $session->get('user-num_days_before_exp') . ' ' . $lang['days'] . '.'; |
|
| 298 | + $numDaysBeforePwExpiration = $lang['index_pw_expiration'].' '.$session->get('user-num_days_before_exp').' '.$lang['days'].'.'; |
|
| 299 | 299 | } |
| 300 | 300 | echo ' |
| 301 | 301 | <li class="list-group-item"> |
| 302 | - <b><i class="fas fa-calendar-alt fa-fw fa-lg mr-2"></i>' . $lang->get('index_last_pw_change') . '</b> |
|
| 303 | - <a class="float-right">' . $last_pw_change . ' ' . $numDaysBeforePwExpiration . '</a> |
|
| 302 | + <b><i class="fas fa-calendar-alt fa-fw fa-lg mr-2"></i>' . $lang->get('index_last_pw_change').'</b> |
|
| 303 | + <a class="float-right">' . $last_pw_change.' '.$numDaysBeforePwExpiration.'</a> |
|
| 304 | 304 | </li>'; |
| 305 | 305 | } |
| 306 | 306 | ?> |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | if (isset($SETTINGS['api']) === true && (int) $SETTINGS['api'] === 1) { |
| 321 | 321 | echo ' |
| 322 | 322 | <li class="list-group-item"> |
| 323 | - <b><i class="fas fa-paper-plane fa-fw fa-lg mr-2"></i>' . $lang->get('user_profile_api_key') . '</b> |
|
| 323 | + <b><i class="fas fa-paper-plane fa-fw fa-lg mr-2"></i>' . $lang->get('user_profile_api_key').'</b> |
|
| 324 | 324 | <button class="btn btn-sm btn-primary float-right" id="copy-api-key"><i class="fa-regular fa-copy pointer"></i></button> |
| 325 | 325 | <a class="float-right mr-2" id="profile-user-api-token">', |
| 326 | 326 | null !== $session->get('user-api_key') ? $session->get('user-api_key') : '', |
@@ -338,12 +338,12 @@ discard block |
||
| 338 | 338 | <?php |
| 339 | 339 | $rows = DB::query( |
| 340 | 340 | 'SELECT label AS labelAction, date, null |
| 341 | - FROM ' . prefixTable('log_system') . ' |
|
| 341 | + FROM ' . prefixTable('log_system').' |
|
| 342 | 342 | WHERE qui = %i |
| 343 | 343 | UNION |
| 344 | 344 | SELECT l.action, l.date, i.label AS itemLabel |
| 345 | - FROM ' . prefixTable('log_items') . ' AS l |
|
| 346 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id) |
|
| 345 | + FROM ' . prefixTable('log_items').' AS l |
|
| 346 | + INNER JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id) |
|
| 347 | 347 | WHERE l.id_user = %i AND l.action IN ("at_access") |
| 348 | 348 | ORDER BY date DESC |
| 349 | 349 | LIMIT 0, 40', |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | $text = $lang->get($record['labelAction']); |
| 358 | 358 | } |
| 359 | 359 | if (empty($record['NULL']) === false) { |
| 360 | - $text .= ' ' . $lang->get('for') . ' <span class="font-weight-light">' . addslashes($record['NULL']) . '</span>'; |
|
| 360 | + $text .= ' '.$lang->get('for').' <span class="font-weight-light">'.addslashes($record['NULL']).'</span>'; |
|
| 361 | 361 | } |
| 362 | - echo '<li class="list-group-item">' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' . $text . '</li>'; |
|
| 362 | + echo '<li class="list-group-item">'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '.$text.'</li>'; |
|
| 363 | 363 | } |
| 364 | 364 | ?> |
| 365 | 365 | </ul> |
@@ -393,13 +393,13 @@ discard block |
||
| 393 | 393 | <?php endif; /* disable_user_edit_profile */ |
| 394 | 394 | if (($SETTINGS['disable_user_edit_timezone'] ?? '0') === '0') : ?> |
| 395 | 395 | <div class="form-group"> |
| 396 | - <label class="col-sm-10 control-label"><?php echo $lang->get('timezone_selection');?></label> |
|
| 396 | + <label class="col-sm-10 control-label"><?php echo $lang->get('timezone_selection'); ?></label> |
|
| 397 | 397 | <div class="col-sm-10"> |
| 398 | 398 | <select class="form-control" id="profile-user-timezone"> |
| 399 | 399 | <?php foreach ($zones as $key => $zone): ?> |
| 400 | 400 | <option value="<?php echo $key; ?>"<?php |
| 401 | 401 | if ($session->has('user-timezone')) |
| 402 | - if($session->get('user-timezone') === $key) |
|
| 402 | + if ($session->get('user-timezone') === $key) |
|
| 403 | 403 | echo ' selected'; |
| 404 | 404 | elseif ($session->get('user-timezone') === 'not_defined') |
| 405 | 405 | if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
@@ -417,10 +417,10 @@ discard block |
||
| 417 | 417 | <select class="form-control" id="profile-user-language"> |
| 418 | 418 | <?php |
| 419 | 419 | foreach ($languages as $language) { |
| 420 | - echo '<option value="' . $language['name'] . '"', |
|
| 420 | + echo '<option value="'.$language['name'].'"', |
|
| 421 | 421 | strtolower($session->get('user-language')) === strtolower($language['name']) ? |
| 422 | 422 | ' selected="selected"' : '', |
| 423 | - '>' . $language['label'] . '</option>'; |
|
| 423 | + '>'.$language['label'].'</option>'; |
|
| 424 | 424 | } |
| 425 | 425 | ?> |
| 426 | 426 | </select> |
@@ -433,11 +433,11 @@ discard block |
||
| 433 | 433 | <div class="col-sm-10"> |
| 434 | 434 | <select class="form-control" id="profile-user-treeloadstrategy"> |
| 435 | 435 | |
| 436 | - <option value="sequential" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'sequential' ? ' selected' : '';?>> |
|
| 436 | + <option value="sequential" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'sequential' ? ' selected' : ''; ?>> |
|
| 437 | 437 | <?php echo $lang->get('sequential'); ?> |
| 438 | 438 | </option> |
| 439 | 439 | |
| 440 | - <option value="full" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'full' ? ' selected' : '';?>> |
|
| 440 | + <option value="full" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'full' ? ' selected' : ''; ?>> |
|
| 441 | 441 | <?php echo $lang->get('full'); ?> |
| 442 | 442 | </option> |
| 443 | 443 | </select> |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | <div class="col-sm-10"> |
| 451 | 451 | <select class="form-control" id="profile-user-split_view_mode"> |
| 452 | 452 | |
| 453 | - <option value="0" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && $session->get('user-split_view_mode') === 0 ? 'selected' : '';?>> |
|
| 453 | + <option value="0" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && $session->get('user-split_view_mode') === 0 ? 'selected' : ''; ?>> |
|
| 454 | 454 | <?php echo $lang->get('no'); ?> |
| 455 | 455 | </option> |
| 456 | 456 | |
| 457 | - <option value="1" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && (int) $session->get('user-split_view_mode') === 1 ? 'selected' : '';?>> |
|
| 457 | + <option value="1" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && (int) $session->get('user-split_view_mode') === 1 ? 'selected' : ''; ?>> |
|
| 458 | 458 | <?php echo $lang->get('yes'); ?> |
| 459 | 459 | </option> |
| 460 | 460 | </select> |
@@ -466,11 +466,11 @@ discard block |
||
| 466 | 466 | <div class="col-sm-10"> |
| 467 | 467 | <select class="form-control" id="profile-user-show_subfolders"> |
| 468 | 468 | |
| 469 | - <option value="0" <?php echo $session->has('user-show_subfolders') && $session->get('user-show_subfolders') && null !== $session->get('user-show_subfolders') && $session->get('user-show_subfolders') === 0 ? 'selected' : '';?>> |
|
| 469 | + <option value="0" <?php echo $session->has('user-show_subfolders') && $session->get('user-show_subfolders') && null !== $session->get('user-show_subfolders') && $session->get('user-show_subfolders') === 0 ? 'selected' : ''; ?>> |
|
| 470 | 470 | <?php echo $lang->get('no'); ?> |
| 471 | 471 | </option> |
| 472 | 472 | |
| 473 | - <option value="1" <?php echo $session->has('user-show_subfolders') && $session->get('user-show_subfolders') && null !== $session->get('user-show_subfolders') && (int) $session->get('user-show_subfolders') === 1 ? 'selected' : '';?>> |
|
| 473 | + <option value="1" <?php echo $session->has('user-show_subfolders') && $session->get('user-show_subfolders') && null !== $session->get('user-show_subfolders') && (int) $session->get('user-show_subfolders') === 1 ? 'selected' : ''; ?>> |
|
| 474 | 474 | <?php echo $lang->get('yes'); ?> |
| 475 | 475 | </option> |
| 476 | 476 | </select> |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | <?php |
| 489 | 489 | } |
| 490 | 490 | if (isset($SETTINGS['api']) === true && (int) $SETTINGS['api'] === 1) { |
| 491 | - echo '<button type="button" class="btn btn-warning float-right" id="profile-button-api_token">' . $lang->get('generate_api_token') . '</button>'; |
|
| 491 | + echo '<button type="button" class="btn btn-warning float-right" id="profile-button-api_token">'.$lang->get('generate_api_token').'</button>'; |
|
| 492 | 492 | } |
| 493 | 493 | ?> |
| 494 | 494 | <div id="profile-avatar-file-container" class="hidden"></div> |
@@ -37,45 +37,45 @@ discard block |
||
| 37 | 37 | * @return boolean |
| 38 | 38 | */ |
| 39 | 39 | function is_jwt_valid($jwt) { |
| 40 | - try { |
|
| 41 | - $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256')); |
|
| 40 | + try { |
|
| 41 | + $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256')); |
|
| 42 | 42 | |
| 43 | - // Check if expiration is reached |
|
| 44 | - if ($decoded['exp'] - time() < 0) { |
|
| 45 | - return false; |
|
| 46 | - } |
|
| 43 | + // Check if expiration is reached |
|
| 44 | + if ($decoded['exp'] - time() < 0) { |
|
| 45 | + return false; |
|
| 46 | + } |
|
| 47 | 47 | /* |
| 48 | 48 | $decoded1 = JWT::decode($jwt, new Key(DB_PASSWD, 'HS256'), $headers = new stdClass()); |
| 49 | 49 | print_r($headers); |
| 50 | 50 | */ |
| 51 | 51 | |
| 52 | - return true; |
|
| 53 | - } catch (InvalidArgumentException $e) { |
|
| 54 | - // provided key/key-array is empty or malformed. |
|
| 55 | - return false; |
|
| 56 | - } catch (DomainException $e) { |
|
| 57 | - // provided algorithm is unsupported OR |
|
| 58 | - // provided key is invalid OR |
|
| 59 | - // unknown error thrown in openSSL or libsodium OR |
|
| 60 | - // libsodium is required but not available. |
|
| 61 | - return false; |
|
| 62 | - } catch (SignatureInvalidException $e) { |
|
| 63 | - // provided JWT signature verification failed. |
|
| 64 | - return false; |
|
| 65 | - } catch (BeforeValidException $e) { |
|
| 66 | - // provided JWT is trying to be used before "nbf" claim OR |
|
| 67 | - // provided JWT is trying to be used before "iat" claim. |
|
| 68 | - return false; |
|
| 69 | - } catch (ExpiredException $e) { |
|
| 70 | - // provided JWT is trying to be used after "exp" claim. |
|
| 71 | - return false; |
|
| 72 | - } catch (UnexpectedValueException $e) { |
|
| 73 | - // provided JWT is malformed OR |
|
| 74 | - // provided JWT is missing an algorithm / using an unsupported algorithm OR |
|
| 75 | - // provided JWT algorithm does not match provided key OR |
|
| 76 | - // provided key ID in key/key-array is empty or invalid. |
|
| 77 | - return false; |
|
| 78 | - } |
|
| 52 | + return true; |
|
| 53 | + } catch (InvalidArgumentException $e) { |
|
| 54 | + // provided key/key-array is empty or malformed. |
|
| 55 | + return false; |
|
| 56 | + } catch (DomainException $e) { |
|
| 57 | + // provided algorithm is unsupported OR |
|
| 58 | + // provided key is invalid OR |
|
| 59 | + // unknown error thrown in openSSL or libsodium OR |
|
| 60 | + // libsodium is required but not available. |
|
| 61 | + return false; |
|
| 62 | + } catch (SignatureInvalidException $e) { |
|
| 63 | + // provided JWT signature verification failed. |
|
| 64 | + return false; |
|
| 65 | + } catch (BeforeValidException $e) { |
|
| 66 | + // provided JWT is trying to be used before "nbf" claim OR |
|
| 67 | + // provided JWT is trying to be used before "iat" claim. |
|
| 68 | + return false; |
|
| 69 | + } catch (ExpiredException $e) { |
|
| 70 | + // provided JWT is trying to be used after "exp" claim. |
|
| 71 | + return false; |
|
| 72 | + } catch (UnexpectedValueException $e) { |
|
| 73 | + // provided JWT is malformed OR |
|
| 74 | + // provided JWT is missing an algorithm / using an unsupported algorithm OR |
|
| 75 | + // provided JWT algorithm does not match provided key OR |
|
| 76 | + // provided key ID in key/key-array is empty or invalid. |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | function base64url_encode($data) { |
@@ -84,24 +84,24 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | function get_authorization_header() |
| 86 | 86 | { |
| 87 | - $request = symfonyRequest::createFromGlobals(); |
|
| 88 | - $authorizationHeader = $request->headers->get('Authorization'); |
|
| 89 | - $headers = null; |
|
| 87 | + $request = symfonyRequest::createFromGlobals(); |
|
| 88 | + $authorizationHeader = $request->headers->get('Authorization'); |
|
| 89 | + $headers = null; |
|
| 90 | 90 | |
| 91 | - // Check if the authorization header is not empty |
|
| 92 | - if (!empty($authorizationHeader)) { |
|
| 93 | - $headers = trim($authorizationHeader); |
|
| 94 | - } else if (function_exists('apache_request_headers') === true) { |
|
| 95 | - $requestHeaders = (array) apache_request_headers(); |
|
| 96 | - // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) |
|
| 97 | - $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); |
|
| 98 | - //print_r($requestHeaders); |
|
| 99 | - if (isset($requestHeaders['Authorization']) === true) { |
|
| 100 | - $headers = trim($requestHeaders['Authorization']); |
|
| 101 | - } |
|
| 102 | - } |
|
| 91 | + // Check if the authorization header is not empty |
|
| 92 | + if (!empty($authorizationHeader)) { |
|
| 93 | + $headers = trim($authorizationHeader); |
|
| 94 | + } else if (function_exists('apache_request_headers') === true) { |
|
| 95 | + $requestHeaders = (array) apache_request_headers(); |
|
| 96 | + // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) |
|
| 97 | + $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); |
|
| 98 | + //print_r($requestHeaders); |
|
| 99 | + if (isset($requestHeaders['Authorization']) === true) { |
|
| 100 | + $headers = trim($requestHeaders['Authorization']); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - return $headers; |
|
| 104 | + return $headers; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | function get_bearer_token() { |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | function get_bearer_data($jwt) { |
| 120 | 120 | // split the jwt |
| 121 | - $tokenParts = explode('.', $jwt); |
|
| 122 | - $payload = base64_decode($tokenParts[1]); |
|
| 121 | + $tokenParts = explode('.', $jwt); |
|
| 122 | + $payload = base64_decode($tokenParts[1]); |
|
| 123 | 123 | |
| 124 | 124 | // HEADER: Get the access token from the header |
| 125 | 125 | if (empty($payload) === false) { |
@@ -148,34 +148,34 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | function get_user_keys(int $userId, string $keyTempo, string $sessionKey): ?array |
| 150 | 150 | { |
| 151 | - require_once API_ROOT_PATH . '/inc/encryption_utils.php'; |
|
| 151 | + require_once API_ROOT_PATH.'/inc/encryption_utils.php'; |
|
| 152 | 152 | |
| 153 | 153 | // Retrieve user's public key and encrypted private key from database |
| 154 | 154 | $userInfo = DB::queryfirstrow( |
| 155 | 155 | "SELECT u.public_key, u.key_tempo, a.encrypted_private_key |
| 156 | - FROM " . prefixTable('users') . " AS u |
|
| 157 | - INNER JOIN " . prefixTable('api') . " AS a ON (a.user_id = u.id) |
|
| 156 | + FROM " . prefixTable('users')." AS u |
|
| 157 | + INNER JOIN " . prefixTable('api')." AS a ON (a.user_id = u.id) |
|
| 158 | 158 | WHERE u.id = %i", |
| 159 | 159 | $userId |
| 160 | 160 | ); |
| 161 | 161 | |
| 162 | 162 | if (DB::count() === 0) { |
| 163 | 163 | // User not found or no API configuration |
| 164 | - error_log('[API] get_user_keys: User not found or no API config for user ID ' . $userId); |
|
| 164 | + error_log('[API] get_user_keys: User not found or no API config for user ID '.$userId); |
|
| 165 | 165 | return null; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Validate key_tempo matches (security check - ensures session is still valid) |
| 169 | 169 | if ($userInfo['key_tempo'] !== $keyTempo) { |
| 170 | 170 | // Session invalid or expired |
| 171 | - error_log('[API] get_user_keys: Invalid key_tempo for user ID ' . $userId); |
|
| 171 | + error_log('[API] get_user_keys: Invalid key_tempo for user ID '.$userId); |
|
| 172 | 172 | return null; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // Check if encrypted private key exists |
| 176 | 176 | if (empty($userInfo['encrypted_private_key'])) { |
| 177 | 177 | // No encrypted key found - user needs to re-authenticate |
| 178 | - error_log('[API] get_user_keys: No encrypted private key found for user ID ' . $userId); |
|
| 178 | + error_log('[API] get_user_keys: No encrypted private key found for user ID '.$userId); |
|
| 179 | 179 | return null; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | if ($privateKeyDecrypted === false) { |
| 197 | 197 | // Decryption failed - wrong key or tampered data |
| 198 | - error_log('[API] get_user_keys: Failed to decrypt private key for user ID ' . $userId); |
|
| 198 | + error_log('[API] get_user_keys: Failed to decrypt private key for user ID '.$userId); |
|
| 199 | 199 | return null; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | header("Access-Control-Allow-Methods: POST, GET"); |
| 40 | 40 | header("Access-Control-Max-Age: 3600"); |
| 41 | 41 | header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); |
| 42 | -require __DIR__ . "/inc/bootstrap.php"; |
|
| 42 | +require __DIR__."/inc/bootstrap.php"; |
|
| 43 | 43 | |
| 44 | 44 | // sanitize url segments |
| 45 | 45 | $base = new BaseController(); |
| 46 | 46 | $uri = $base->getUriSegments(); |
| 47 | 47 | if (!is_array($uri)) { |
| 48 | - $uri = [$uri]; // ensure $uril is table |
|
| 48 | + $uri = [$uri]; // ensure $uril is table |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Prepare DB password |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | if ($uri[0] === 'authorize') { |
| 62 | 62 | // Is API enabled in Teampass settings |
| 63 | 63 | if ($apiStatus['error'] === false) { |
| 64 | - require API_ROOT_PATH . "/Controller/Api/AuthController.php"; |
|
| 64 | + require API_ROOT_PATH."/Controller/Api/AuthController.php"; |
|
| 65 | 65 | $objFeedController = new AuthController(); |
| 66 | - $strMethodName = $uri[0] . 'Action'; |
|
| 66 | + $strMethodName = $uri[0].'Action'; |
|
| 67 | 67 | $objFeedController->{$strMethodName}(); |
| 68 | 68 | } else { |
| 69 | 69 | // Error management |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // action related to USER |
| 91 | 91 | } elseif ($controller === 'user') { |
| 92 | - require API_ROOT_PATH . "/Controller/Api/UserController.php"; |
|
| 92 | + require API_ROOT_PATH."/Controller/Api/UserController.php"; |
|
| 93 | 93 | $objFeedController = new UserController(); |
| 94 | - $strMethodName = (string) $action . 'Action'; |
|
| 94 | + $strMethodName = (string) $action.'Action'; |
|
| 95 | 95 | $objFeedController->{$strMethodName}(); |
| 96 | 96 | |
| 97 | 97 | // action related to ITEM |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ) { |
| 81 | 81 | // Not allowed page |
| 82 | 82 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 83 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 83 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 84 | 84 | exit; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $openLdapExtra = new OpenLdapExtra(); |
| 155 | 155 | break; |
| 156 | 156 | default: |
| 157 | - throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']); |
|
| 157 | + throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']); |
|
| 158 | 158 | } |
| 159 | 159 | } catch (Exception $e) { |
| 160 | 160 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // 2- Get user info from AD |
| 174 | 174 | // We want to isolate attribute ldap_user_attribute or mostly samAccountName |
| 175 | 175 | $userADInfos = $ldapConnection->query() |
| 176 | - ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username) |
|
| 176 | + ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username) |
|
| 177 | 177 | ->firstOrFail(); |
| 178 | 178 | |
| 179 | 179 | // Is user enabled? Only ActiveDirectory |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
| 195 | 195 | $error = $e->getDetailedError(); |
| 196 | 196 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 197 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
| 197 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
| 198 | 198 | } |
| 199 | 199 | // deepcode ignore ServerLeak: No important data is sent and is encrypted before being sent |
| 200 | 200 | echo prepareExchangedData( |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | // For OpenLDAP and others, we use attribute dn |
| 214 | 214 | $userAuthAttempt = $ldapConnection->auth()->attempt( |
| 215 | 215 | $SETTINGS['ldap_type'] === 'ActiveDirectory' ? |
| 216 | - $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication |
|
| 216 | + $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication |
|
| 217 | 217 | $userADInfos['dn'], |
| 218 | 218 | $post_password |
| 219 | 219 | ); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
| 233 | 233 | $error = $e->getDetailedError(); |
| 234 | 234 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 235 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
| 235 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
| 236 | 236 | } |
| 237 | 237 | // deepcode ignore ServerLeak: No important data is sent and is encrypted before being sent |
| 238 | 238 | echo prepareExchangedData( |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | function provideLog(string $message, array $SETTINGS) |
| 103 | 103 | { |
| 104 | 104 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 105 | - error_log((string) date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) . ' - '.$message); |
|
| 105 | + error_log((string) date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).' - '.$message); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | -function performVisibleFoldersHtmlUpdate (int $user_id) |
|
| 109 | +function performVisibleFoldersHtmlUpdate(int $user_id) |
|
| 110 | 110 | { |
| 111 | 111 | $html = []; |
| 112 | 112 | |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // get current folders visible for user |
| 118 | 118 | $cache_tree = DB::queryFirstRow( |
| 119 | - 'SELECT increment_id, data FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', |
|
| 119 | + 'SELECT increment_id, data FROM '.prefixTable('cache_tree').' WHERE user_id = %i', |
|
| 120 | 120 | $user_id |
| 121 | 121 | ); |
| 122 | - $folders = json_decode($cache_tree['data'], true);//print_r($folders); |
|
| 122 | + $folders = json_decode($cache_tree['data'], true); //print_r($folders); |
|
| 123 | 123 | foreach ($folders as $folder) { |
| 124 | 124 | $idFolder = (int) explode("li_", $folder['id'])[1]; |
| 125 | 125 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | // get folder info |
| 134 | 134 | $folder = DB::queryFirstRow( |
| 135 | - 'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 135 | + 'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 136 | 136 | $idFolder |
| 137 | 137 | ); |
| 138 | 138 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | function subTaskStatus($taskId) |
| 168 | 168 | { |
| 169 | 169 | $subTasks = DB::query( |
| 170 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i', |
|
| 170 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i', |
|
| 171 | 171 | $taskId |
| 172 | 172 | ); |
| 173 | 173 | |