@@ -71,7 +71,7 @@ |
||
71 | 71 | || isset($SETTINGS['allow_import']) === false || (int) $SETTINGS['allow_import'] !== 1) { |
72 | 72 | // Not allowed page |
73 | 73 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
74 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
74 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
75 | 75 | exit; |
76 | 76 | } |
77 | 77 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('items') === false) { |
73 | 73 | // Not allowed page |
74 | 74 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
75 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
75 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
76 | 76 | exit; |
77 | 77 | } |
78 | 78 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | // |
1031 | 1031 | } else if ($(this).data('item-action') === 'link') { |
1032 | 1032 | // Add link to clipboard. |
1033 | - navigator.clipboard.writeText("<?php echo $SETTINGS['cpassman_url'];?>/index.php?page=items&group="+store.get('teampassItem').folderId+"&id="+store.get('teampassItem').id); |
|
1033 | + navigator.clipboard.writeText("<?php echo $SETTINGS['cpassman_url']; ?>/index.php?page=items&group="+store.get('teampassItem').folderId+"&id="+store.get('teampassItem').id); |
|
1034 | 1034 | |
1035 | 1035 | // Display message. |
1036 | 1036 | toastr.remove(); |
@@ -2649,7 +2649,7 @@ discard block |
||
2649 | 2649 | progress: "#form-item-password-strength", |
2650 | 2650 | score: "#form-item-password-strength" |
2651 | 2651 | }, |
2652 | - scores: [<?php echo TP_PW_STRENGTH_1;?>, <?php echo TP_PW_STRENGTH_2;?>, <?php echo TP_PW_STRENGTH_3;?>, <?php echo TP_PW_STRENGTH_4;?>, <?php echo TP_PW_STRENGTH_5;?>], |
|
2652 | + scores: [<?php echo TP_PW_STRENGTH_1; ?>, <?php echo TP_PW_STRENGTH_2; ?>, <?php echo TP_PW_STRENGTH_3; ?>, <?php echo TP_PW_STRENGTH_4; ?>, <?php echo TP_PW_STRENGTH_5; ?>], |
|
2653 | 2653 | }, |
2654 | 2654 | i18n : { |
2655 | 2655 | t: function (key) { |
@@ -2676,7 +2676,7 @@ discard block |
||
2676 | 2676 | <?php |
2677 | 2677 | $max_file_size = ''; |
2678 | 2678 | if (strrpos($SETTINGS['upload_maxfilesize'], 'mb') === false) { |
2679 | - $max_file_size = $SETTINGS['upload_maxfilesize'] . 'mb'; |
|
2679 | + $max_file_size = $SETTINGS['upload_maxfilesize'].'mb'; |
|
2680 | 2680 | } else { |
2681 | 2681 | $max_file_size = $SETTINGS['upload_maxfilesize']; |
2682 | 2682 | } |
@@ -4723,7 +4723,7 @@ discard block |
||
4723 | 4723 | |
4724 | 4724 | // Show passwords inputs and form |
4725 | 4725 | $('#dialog-ldap-user-change-password-info') |
4726 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>') |
|
4726 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>') |
|
4727 | 4727 | .removeClass('hidden'); |
4728 | 4728 | $('#dialog-ldap-user-change-password').removeClass('hidden'); |
4729 | 4729 | } else if (data.error_type !== 'undefined') { |
@@ -4742,7 +4742,7 @@ discard block |
||
4742 | 4742 | |
4743 | 4743 | // Show passwords inputs and form |
4744 | 4744 | $('#dialog-ldap-user-change-password-info') |
4745 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>') |
|
4745 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>') |
|
4746 | 4746 | .removeClass('hidden'); |
4747 | 4747 | $('#dialog-ldap-user-change-password').removeClass('hidden'); |
4748 | 4748 | }); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | //get through all users with enabled personnal folder. |
80 | 80 | $users = DB::query( |
81 | 81 | 'SELECT id, login, email |
82 | - FROM ' . prefixTable('users') . ' |
|
82 | + FROM ' . prefixTable('users').' |
|
83 | 83 | WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.') |
84 | 84 | AND personal_folder = 1 |
85 | 85 | ORDER BY login ASC' |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | //if folder doesn't exist then create it |
89 | 89 | $data = DB::queryfirstrow( |
90 | 90 | 'SELECT id |
91 | - FROM ' . prefixTable('nested_tree') . ' |
|
91 | + FROM ' . prefixTable('nested_tree').' |
|
92 | 92 | WHERE title = %s AND parent_id = %i', |
93 | 93 | $user['id'], |
94 | 94 | 0 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('items') === false) { |
70 | 70 | // Not allowed page |
71 | 71 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
72 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
72 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 | // Define Timezone |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | // Get list of users |
92 | 92 | $usersList = []; |
93 | -$rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC'); |
|
93 | +$rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC'); |
|
94 | 94 | foreach ($rows as $record) { |
95 | 95 | $usersList[$record['login']] = [ |
96 | 96 | 'id' => $record['id'], |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | // Get list of roles |
102 | 102 | $arrRoles = []; |
103 | 103 | $listRoles = ''; |
104 | -$rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
104 | +$rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
105 | 105 | foreach ($rows as $reccord) { |
106 | 106 | $arrRoles[$reccord['title']] = [ |
107 | 107 | 'id' => $reccord['id'], |
108 | 108 | 'title' => $reccord['title'], |
109 | 109 | ]; |
110 | 110 | if (empty($listRoles)) { |
111 | - $listRoles = $reccord['id'] . '#' . $reccord['title']; |
|
111 | + $listRoles = $reccord['id'].'#'.$reccord['title']; |
|
112 | 112 | } else { |
113 | - $listRoles .= ';' . $reccord['id'] . '#' . $reccord['title']; |
|
113 | + $listRoles .= ';'.$reccord['id'].'#'.$reccord['title']; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | <li class="nav-item"><a class="nav-link" href="#tab_3" data-toggle="tab"><i class="fa-solid fa-archive mr-2"></i><?php echo $lang->get('attachments'); ?></a></li> |
186 | 186 | <?php |
187 | 187 | echo isset($SETTINGS['item_extra_fields']) === true && (int) $SETTINGS['item_extra_fields'] === 1 ? ' |
188 | - <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields') . '</a></li>' : ''; |
|
188 | + <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields').'</a></li>' : ''; |
|
189 | 189 | ?> |
190 | 190 | </ul> |
191 | 191 | </div><!-- /.card-header --> |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | <?php |
255 | 255 | for ($i = 4; $i <= $SETTINGS['pwd_maximum_length']; ++$i) { |
256 | 256 | echo ' |
257 | - <option>' . $i . '</option>'; |
|
257 | + <option>' . $i.'</option>'; |
|
258 | 258 | } |
259 | 259 | ?> |
260 | 260 | </select> |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | <span class="ml-2 col-md-1 clear-me-html" id="form-item-icon-show"></span> |
285 | 285 | </div> |
286 | 286 | <small class='form-text text-muted'> |
287 | - <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a> |
|
287 | + <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a> |
|
288 | 288 | </small> |
289 | 289 | </div> |
290 | 290 | |
@@ -473,39 +473,39 @@ discard block |
||
473 | 473 | <div class="tab-pane" id="tab_4"> |
474 | 474 | <div id="form-item-field" class="hidden"> |
475 | 475 | <?php |
476 | - $session_item_fields = $session->get('system-item_fields');//print_r($session_item_fields); |
|
476 | + $session_item_fields = $session->get('system-item_fields'); //print_r($session_item_fields); |
|
477 | 477 | if (isset($session_item_fields) === true) { |
478 | 478 | foreach ($session_item_fields as $category) { |
479 | 479 | //print_r($category); |
480 | 480 | echo ' |
481 | - <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'] . '"> |
|
482 | - <h5>' . $category['title'] . '</h5> |
|
481 | + <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'].'"> |
|
482 | + <h5>' . $category['title'].'</h5> |
|
483 | 483 | <p>'; |
484 | 484 | foreach ($category['fields'] as $field) { |
485 | 485 | if ($field['type'] === 'textarea') { |
486 | 486 | echo ' |
487 | - <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '"> |
|
487 | + <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'"> |
|
488 | 488 | <label>' . $field['title'], |
489 | 489 | $field['is_mandatory'] === '1' ? |
490 | - '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '', |
|
490 | + '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '', |
|
491 | 491 | '</label> |
492 | - <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0"></textarea> |
|
492 | + <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0"></textarea> |
|
493 | 493 | </div>'; |
494 | 494 | } else { |
495 | 495 | echo ' |
496 | - <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '"> |
|
496 | + <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'"> |
|
497 | 497 | <div class="input-group-prepend"> |
498 | 498 | <span class="input-group-text">' . $field['title'], |
499 | 499 | $field['is_mandatory'] === '1' ? |
500 | - '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '', |
|
500 | + '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '', |
|
501 | 501 | '</span> |
502 | 502 | </div> |
503 | - <input type="' . $field['type'] . '" class="form-control form-item-control form-item-field-custom" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0"> |
|
503 | + <input type="' . $field['type'].'" class="form-control form-item-control form-item-field-custom" data-field-name="'.$field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0"> |
|
504 | 504 | </div>'; |
505 | 505 | } |
506 | 506 | if (!empty($field['regex'])) { |
507 | 507 | echo ' |
508 | - <div>Regex: '. $field['regex'] .'</div> |
|
508 | + <div>Regex: '. $field['regex'].'</div> |
|
509 | 509 | '; |
510 | 510 | } |
511 | 511 | } |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | ) { |
517 | 517 | echo ' |
518 | 518 | <div class="form-check icheck-blue"> |
519 | - <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'] . '" data-change-ongoing="0" data-field-name="template" id="template_' . $category['id'] . '"> |
|
520 | - <label class="form-check-label ml-3" for="template_' . $category['id'] . '">' . $lang->get('main_template') . '</label> |
|
519 | + <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'].'" data-change-ongoing="0" data-field-name="template" id="template_'.$category['id'].'"> |
|
520 | + <label class="form-check-label ml-3" for="template_' . $category['id'].'">'.$lang->get('main_template').'</label> |
|
521 | 521 | </div>'; |
522 | 522 | } |
523 | 523 | echo ' |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | } else { |
528 | 528 | echo |
529 | 529 | '<div class="alert alert-info"> |
530 | - <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information') . '</h5> |
|
531 | - ' . $lang->get('no_fields') . ' |
|
530 | + <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information').'</h5> |
|
531 | + ' . $lang->get('no_fields').' |
|
532 | 532 | </div>'; |
533 | 533 | } ?> |
534 | 534 | </div> |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | <p><?php |
670 | 670 | echo str_replace( |
671 | 671 | ['##otv_expiration_period##', '. '], |
672 | - ['<span class="text-bold text-primary">' . $SETTINGS['otv_expiration_period'] . '</span>', '<br>'], |
|
672 | + ['<span class="text-bold text-primary">'.$SETTINGS['otv_expiration_period'].'</span>', '<br>'], |
|
673 | 673 | $lang->get('otv_message') |
674 | 674 | ); |
675 | 675 | ?></p> |
@@ -687,9 +687,9 @@ discard block |
||
687 | 687 | |
688 | 688 | <div class="row"> |
689 | 689 | <div class="form-group col-4"> |
690 | - <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period'];?>)</label> |
|
690 | + <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period']; ?>)</label> |
|
691 | 691 | <div class="input-group mb-3"> |
692 | - <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period'];?>" value="<?php echo $SETTINGS['otv_expiration_period'];?>"> |
|
692 | + <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period']; ?>" value="<?php echo $SETTINGS['otv_expiration_period']; ?>"> |
|
693 | 693 | </div> |
694 | 694 | </div> |
695 | 695 | |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | <select class="form-control form-folder-control select2" style="width:100%;" id="form-folder-add-complexicity" required> |
778 | 778 | <?php |
779 | 779 | foreach (TP_PW_COMPLEXITY as $key => $value) { |
780 | - echo '<option value="' . $key . '">' . $value[1] . '</option>'; |
|
780 | + echo '<option value="'.$key.'">'.$value[1].'</option>'; |
|
781 | 781 | } |
782 | 782 | ?> |
783 | 783 | </select> |
@@ -795,14 +795,14 @@ discard block |
||
795 | 795 | <label><?php echo $lang->get('icon'); ?></label> |
796 | 796 | <input type="text" class="form-control form-folder-control" id="form-folder-add-icon"> |
797 | 797 | <small class='form-text text-muted'> |
798 | - <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a> |
|
798 | + <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a> |
|
799 | 799 | </small> |
800 | 800 | </div> |
801 | 801 | <div class="form-group"> |
802 | 802 | <label><?php echo $lang->get('icon_on_selection'); ?></label> |
803 | 803 | <input type="text" class="form-control form-folder-control" id="form-folder-add-icon-selected"> |
804 | 804 | <small class='form-text text-muted'> |
805 | - <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a> |
|
805 | + <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a> |
|
806 | 806 | </small> |
807 | 807 | </div> |
808 | 808 | </div> |
@@ -1213,18 +1213,18 @@ discard block |
||
1213 | 1213 | <?php |
1214 | 1214 | foreach ($session_item_fields as $elem) { |
1215 | 1215 | echo ' |
1216 | - <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'] . '"> |
|
1217 | - <h5>' . $elem['title'] . '</h5> |
|
1216 | + <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'].'"> |
|
1217 | + <h5>' . $elem['title'].'</h5> |
|
1218 | 1218 | <p> |
1219 | 1219 | <ul class="list-group list-group-unbordered mb-3">'; |
1220 | 1220 | foreach ($elem['fields'] as $field) { |
1221 | 1221 | echo ' |
1222 | - <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'] . '"> |
|
1223 | - <span id="card-item-field-title-' . $field['id'] . '"><b>' . $field['title'] . '</b></span> |
|
1224 | - <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear" data-clipboard-target="#card-item-field-value-' . $field['id'] . '"> |
|
1222 | + <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'].'"> |
|
1223 | + <span id="card-item-field-title-' . $field['id'].'"><b>'.$field['title'].'</b></span> |
|
1224 | + <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear" data-clipboard-target="#card-item-field-value-' . $field['id'].'"> |
|
1225 | 1225 | <i class="fa-solid fa-copy"></i> |
1226 | 1226 | </button> |
1227 | - <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'] . '"></span> |
|
1227 | + <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'].'"></span> |
|
1228 | 1228 | </li>'; |
1229 | 1229 | } |
1230 | 1230 | echo ' |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === 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 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // error |
150 | 150 | toastr.remove(); |
151 | 151 | toastr.error( |
152 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
152 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
153 | 153 | '', { |
154 | 154 | closeButton: true, |
155 | 155 | positionClass: 'toast-bottom-right' |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | // error |
224 | 224 | toastr.remove(); |
225 | 225 | toastr.error( |
226 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
226 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
227 | 227 | '', { |
228 | 228 | closeButton: true, |
229 | 229 | positionClass: 'toast-bottom-right' |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // error |
272 | 272 | toastr.remove(); |
273 | 273 | toastr.error( |
274 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
274 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
275 | 275 | '', { |
276 | 276 | closeButton: true, |
277 | 277 | positionClass: 'toast-bottom-right' |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('tasks') === false) { |
74 | 74 | // Not allowed page |
75 | 75 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
76 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
76 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
77 | 77 | exit; |
78 | 78 | } |
79 | 79 | ?> |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | // error |
371 | 371 | toastr.remove(); |
372 | 372 | toastr.error( |
373 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
373 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
374 | 374 | '', { |
375 | 375 | closeButton: true, |
376 | 376 | positionClass: 'toast-bottom-right' |
@@ -393,11 +393,11 @@ discard block |
||
393 | 393 | $('#'+field+'_parameter_value').val(frequency === null ? '' : frequency + ';' +value,); |
394 | 394 | param = value.split(';'); |
395 | 395 | if (param.length === 1) { |
396 | - txt = ' <?php echo $lang->get('at');?> ' + param[0]; |
|
396 | + txt = ' <?php echo $lang->get('at'); ?> ' + param[0]; |
|
397 | 397 | } else { |
398 | - txt = ' <?php echo $lang->get('day');?> ' + param[1] + ' <?php echo $lang->get('at');?> ' + param[0]; |
|
398 | + txt = ' <?php echo $lang->get('day'); ?> ' + param[1] + ' <?php echo $lang->get('at'); ?> ' + param[0]; |
|
399 | 399 | } |
400 | - $('#'+field+'_parameter').val(frequency === null ? '<?php echo $lang->get('not_defined');?>' : (data.message + txt)); |
|
400 | + $('#'+field+'_parameter').val(frequency === null ? '<?php echo $lang->get('not_defined'); ?>' : (data.message + txt)); |
|
401 | 401 | $("#task-define-modal").modal('hide'); |
402 | 402 | $('#task-define-modal-type, #task-define-modal-parameter-hourly-value, #task-define-modal-parameter-daily-value, #task-define-modal-frequency').val(''); |
403 | 403 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | // error |
504 | 504 | toastr.remove(); |
505 | 505 | toastr.error( |
506 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
506 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
507 | 507 | '', { |
508 | 508 | closeButton: true, |
509 | 509 | positionClass: 'toast-bottom-right' |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | // error |
565 | 565 | toastr.remove(); |
566 | 566 | toastr.error( |
567 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
567 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
568 | 568 | '', { |
569 | 569 | closeButton: true, |
570 | 570 | positionClass: 'toast-bottom-right' |
@@ -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 | error_log('TEAMPASS Error - ldap - '.$e->getMessage()); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // 2- Get user info from AD |
172 | 172 | // We want to isolate attribute ldap_user_attribute or mostly samAccountName |
173 | 173 | $userADInfos = $ldapConnection->query() |
174 | - ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username) |
|
174 | + ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username) |
|
175 | 175 | ->firstOrFail(); |
176 | 176 | |
177 | 177 | // Is user enabled? Only ActiveDirectory |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
193 | 193 | $error = $e->getDetailedError(); |
194 | 194 | if ($error) { |
195 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
195 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
196 | 196 | } else { |
197 | 197 | error_log('TEAMPASS Error - LDAP - Code: '.$e->getCode().' - Message: '.$e->getMessage()); |
198 | 198 | } |
@@ -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) { |
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 | } else { |
237 | 237 | error_log('TEAMPASS Error - LDAP - Code: '.$e->getCode().' - Message: '.$e->getMessage()); |
238 | 238 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) { |
74 | 74 | // Not allowed page |
75 | 75 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
76 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
76 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
77 | 77 | exit; |
78 | 78 | } |
79 | 79 | ?> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | }) |
98 | 98 | |
99 | 99 | // Select user properties |
100 | - $('#profile-user-language option[value=<?php echo $session->get('user-language');?>').attr('selected','selected'); |
|
100 | + $('#profile-user-language option[value=<?php echo $session->get('user-language'); ?>').attr('selected','selected'); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | // AVATAR IMPORT |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | console.log(store.get('teampassUser')); |
298 | 298 | |
299 | 299 | // reload page in case of language change |
300 | - if ($('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language');?>') { |
|
300 | + if ($('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language'); ?>') { |
|
301 | 301 | // prepare reload |
302 | 302 | $(this).delay(3000).queue(function() { |
303 | 303 | document.location.href = "index.php?page=profile"; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | // Inform user |
309 | 309 | toastr.remove(); |
310 | 310 | toastr.info( |
311 | - '<?php echo $lang->get('alert_page_will_reload') . ' ... ' . $lang->get('please_wait'); ?>', |
|
311 | + '<?php echo $lang->get('alert_page_will_reload').' ... '.$lang->get('please_wait'); ?>', |
|
312 | 312 | '', { |
313 | 313 | timeOut: 3000, |
314 | 314 | progressBar: true |
@@ -412,27 +412,27 @@ discard block |
||
412 | 412 | "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>", |
413 | 413 | "ratings": [ |
414 | 414 | { |
415 | - "minScore": <?php echo TP_PW_STRENGTH_1;?>, |
|
415 | + "minScore": <?php echo TP_PW_STRENGTH_1; ?>, |
|
416 | 416 | "className": "meterWarn", |
417 | 417 | "text": "<?php echo $lang->get('complex_level1'); ?>" |
418 | 418 | }, |
419 | 419 | { |
420 | - "minScore": <?php echo TP_PW_STRENGTH_2;?>, |
|
420 | + "minScore": <?php echo TP_PW_STRENGTH_2; ?>, |
|
421 | 421 | "className": "meterWarn", |
422 | 422 | "text": "<?php echo $lang->get('complex_level2'); ?>" |
423 | 423 | }, |
424 | 424 | { |
425 | - "minScore": <?php echo TP_PW_STRENGTH_3;?>, |
|
425 | + "minScore": <?php echo TP_PW_STRENGTH_3; ?>, |
|
426 | 426 | "className": "meterGood", |
427 | 427 | "text": "<?php echo $lang->get('complex_level3'); ?>" |
428 | 428 | }, |
429 | 429 | { |
430 | - "minScore": <?php echo TP_PW_STRENGTH_4;?>, |
|
430 | + "minScore": <?php echo TP_PW_STRENGTH_4; ?>, |
|
431 | 431 | "className": "meterGood", |
432 | 432 | "text": "<?php echo $lang->get('complex_level4'); ?>" |
433 | 433 | }, |
434 | 434 | { |
435 | - "minScore": <?php echo TP_PW_STRENGTH_5;?>, |
|
435 | + "minScore": <?php echo TP_PW_STRENGTH_5; ?>, |
|
436 | 436 | "className": "meterExcel", |
437 | 437 | "text": "<?php echo $lang->get('complex_level5'); ?>" |
438 | 438 | } |
@@ -525,27 +525,27 @@ discard block |
||
525 | 525 | "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>", |
526 | 526 | "ratings": [ |
527 | 527 | { |
528 | - "minScore": <?php echo TP_PW_STRENGTH_1;?>, |
|
528 | + "minScore": <?php echo TP_PW_STRENGTH_1; ?>, |
|
529 | 529 | "className": "meterWarn", |
530 | 530 | "text": "<?php echo $lang->get('complex_level1'); ?>" |
531 | 531 | }, |
532 | 532 | { |
533 | - "minScore": <?php echo TP_PW_STRENGTH_2;?>, |
|
533 | + "minScore": <?php echo TP_PW_STRENGTH_2; ?>, |
|
534 | 534 | "className": "meterWarn", |
535 | 535 | "text": "<?php echo $lang->get('complex_level2'); ?>" |
536 | 536 | }, |
537 | 537 | { |
538 | - "minScore": <?php echo TP_PW_STRENGTH_3;?>, |
|
538 | + "minScore": <?php echo TP_PW_STRENGTH_3; ?>, |
|
539 | 539 | "className": "meterGood", |
540 | 540 | "text": "<?php echo $lang->get('complex_level3'); ?>" |
541 | 541 | }, |
542 | 542 | { |
543 | - "minScore": <?php echo TP_PW_STRENGTH_4;?>, |
|
543 | + "minScore": <?php echo TP_PW_STRENGTH_4; ?>, |
|
544 | 544 | "className": "meterGood", |
545 | 545 | "text": "<?php echo $lang->get('complex_level4'); ?>" |
546 | 546 | }, |
547 | 547 | { |
548 | - "minScore": <?php echo TP_PW_STRENGTH_5;?>, |
|
548 | + "minScore": <?php echo TP_PW_STRENGTH_5; ?>, |
|
549 | 549 | "className": "meterExcel", |
550 | 550 | "text": "<?php echo $lang->get('complex_level5'); ?>" |
551 | 551 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } |
562 | 562 | }); |
563 | 563 | |
564 | - $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>'); |
|
564 | + $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>'); |
|
565 | 565 | |
566 | 566 | $("#open-dialog-keys-download").on('click', function(event) { |
567 | 567 | event.preventDefault(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param array $SETTINGS |
124 | 124 | * @return bool|string |
125 | 125 | */ |
126 | - function handleAuthAttempts($post_data, $SETTINGS): bool|string |
|
126 | + function handleAuthAttempts($post_data, $SETTINGS): bool | string |
|
127 | 127 | { |
128 | 128 | $session = SessionManager::getSession(); |
129 | 129 | $lang = new Language($session->get('user-language') ?? 'english'); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $sessionPwdAttempts = $session->get('pwd_attempts'); |
298 | 298 | $sessionUrl = $session->get('user-initial_url'); |
299 | 299 | $server = []; |
300 | - $server['PHP_AUTH_USER'] = $request->getUser(); |
|
300 | + $server['PHP_AUTH_USER'] = $request->getUser(); |
|
301 | 301 | $server['PHP_AUTH_PW'] = $request->getPassword(); |
302 | 302 | |
303 | 303 | // decrypt and retreive data in JSON format |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | // Check if Duo auth is in progress and pass the pw and login back to the standard login process |
315 | - if( |
|
315 | + if ( |
|
316 | 316 | isKeyExistingAndEqual('duo', 1, $SETTINGS) === true |
317 | 317 | && $dataReceived['user_2fa_selection'] === 'duo' |
318 | 318 | && $session->get('user-duo_status') === 'IN_PROGRESS' |
319 | 319 | && !empty($dataReceived['duo_state']) |
320 | - ){ |
|
320 | + ) { |
|
321 | 321 | $key = hash('sha256', $dataReceived['duo_state']); |
322 | 322 | $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16); |
323 | 323 | $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_data')), 'AES-256-CBC', $key, 0, $iv); |
324 | 324 | // Clear the data from the Duo process to continue clean with the standard login process |
325 | - $session->set('user-duo_data',''); |
|
326 | - if($duo_data_dec === false){ |
|
325 | + $session->set('user-duo_data', ''); |
|
326 | + if ($duo_data_dec === false) { |
|
327 | 327 | echo prepareExchangedData( |
328 | 328 | [ |
329 | 329 | 'error' => true, |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $dataReceived['login'] = $duo_data['duo_login']; |
339 | 339 | } |
340 | 340 | |
341 | - if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) { |
|
341 | + if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) { |
|
342 | 342 | echo json_encode([ |
343 | 343 | 'data' => prepareExchangedData( |
344 | 344 | [ |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | } |
648 | 648 | // Append with roles from AD groups |
649 | 649 | if (is_null($userInfo['roles_from_ad_groups']) === false) { |
650 | - $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups']; |
|
650 | + $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups']; |
|
651 | 651 | } |
652 | 652 | // store |
653 | 653 | $session->set('user-roles', $userInfo['fonction_id']); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | if (count($session->get('user-roles_array')) > 0) { |
660 | 660 | $rolesList = DB::query( |
661 | 661 | 'SELECT id, title, complexity |
662 | - FROM ' . prefixTable('roles_title') . ' |
|
662 | + FROM ' . prefixTable('roles_title').' |
|
663 | 663 | WHERE id IN %li', |
664 | 664 | $session->get('user-roles_array') |
665 | 665 | ); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | if ($adjustPermissions) { |
706 | 706 | $session->set('user-admin', (int) $userInfo['admin']); |
707 | 707 | $session->set('user-manager', (int) $userInfo['gestionnaire']); |
708 | - $session->set('user-can_manage_all_users',(int) $userInfo['can_manage_all_users']); |
|
708 | + $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']); |
|
709 | 709 | $session->set('user-read_only', (int) $userInfo['read_only']); |
710 | 710 | DB::update( |
711 | 711 | prefixTable('users'), |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | $session->set('user-latest_items_tab', []); |
778 | 778 | $session->set('user-nb_roles', 0); |
779 | 779 | foreach ($session->get('user-latest_items') as $item) { |
780 | - if (! empty($item)) { |
|
780 | + if (!empty($item)) { |
|
781 | 781 | $dataLastItems = DB::queryFirstRow( |
782 | 782 | 'SELECT id,label,id_tree |
783 | - FROM ' . prefixTable('items') . ' |
|
783 | + FROM ' . prefixTable('items').' |
|
784 | 784 | WHERE id=%i', |
785 | 785 | $item |
786 | 786 | ); |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | [ |
790 | 790 | 'id' => $item, |
791 | 791 | 'label' => $dataLastItems['label'], |
792 | - 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
792 | + 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
793 | 793 | ], |
794 | 794 | 'add' |
795 | 795 | ); |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | // Get cahce tree info |
800 | 800 | $cacheTreeData = DB::queryFirstRow( |
801 | 801 | 'SELECT visible_folders |
802 | - FROM ' . prefixTable('cache_tree') . ' |
|
802 | + FROM ' . prefixTable('cache_tree').' |
|
803 | 803 | WHERE user_id=%i', |
804 | 804 | (int) $session->get('user-id') |
805 | 805 | ); |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | && (int) $sessionAdmin !== 1 |
832 | 832 | ) { |
833 | 833 | // get all Admin users |
834 | - $val = DB::queryfirstrow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
834 | + $val = DB::queryfirstrow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
835 | 835 | if (DB::count() > 0) { |
836 | 836 | // Add email to table |
837 | 837 | prepareSendingEmail( |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | '#tp_time#', |
844 | 844 | ], |
845 | 845 | [ |
846 | - ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')', |
|
846 | + ' '.$session->get('user-login').' (IP: '.getClientIpServer().')', |
|
847 | 847 | date($SETTINGS['date_format'], (int) $session->get('user-last_connection')), |
848 | 848 | date($SETTINGS['time_format'], (int) $session->get('user-last_connection')), |
849 | 849 | ], |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | { |
992 | 992 | $rows = DB::query( |
993 | 993 | 'SELECT date |
994 | - FROM ' . prefixTable('log_system') . " |
|
994 | + FROM ' . prefixTable('log_system')." |
|
995 | 995 | WHERE field_1 = %s |
996 | 996 | AND type = 'failed_auth' |
997 | 997 | AND label = 'password_is_not_correct' |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | foreach ($rows as $record) { |
1006 | 1006 | array_push( |
1007 | 1007 | $arrAttempts, |
1008 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
1008 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
1009 | 1009 | ); |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | $ldapConnection |
1060 | 1060 | ) : bool |
1061 | 1061 | { |
1062 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1062 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1063 | 1063 | |
1064 | 1064 | if ((int) $userInfoDisabled === 1) { |
1065 | 1065 | return false; |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $openLdapExtra = new OpenLdapExtra(); |
1269 | 1269 | break; |
1270 | 1270 | default: |
1271 | - throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']); |
|
1271 | + throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']); |
|
1272 | 1272 | } |
1273 | 1273 | } catch (Exception $e) { |
1274 | 1274 | return [ |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | // 2- Get user info from AD |
1282 | 1282 | // We want to isolate attribute ldap_user_attribute or mostly samAccountName |
1283 | 1283 | $userADInfos = $ldapConnection->query() |
1284 | - ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $username) |
|
1284 | + ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $username) |
|
1285 | 1285 | ->firstOrFail(); |
1286 | 1286 | |
1287 | 1287 | // Is user enabled? Only ActiveDirectory |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | // For OpenLDAP and others, we use attribute dn |
1300 | 1300 | $userAuthAttempt = $ldapConnection->auth()->attempt( |
1301 | 1301 | $SETTINGS['ldap_type'] === 'ActiveDirectory' ? |
1302 | - $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication |
|
1302 | + $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication |
|
1303 | 1303 | $userADInfos['dn'], |
1304 | 1304 | $passwordClear |
1305 | 1305 | ); |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | // error |
1383 | 1383 | return [ |
1384 | 1384 | 'error' => true, |
1385 | - 'message' => "Error: Unsupported LDAP type: " . $SETTINGS['ldap_type'], |
|
1385 | + 'message' => "Error: Unsupported LDAP type: ".$SETTINGS['ldap_type'], |
|
1386 | 1386 | ]; |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1417,12 +1417,12 @@ discard block |
||
1417 | 1417 | if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) { |
1418 | 1418 | // Get user groups from AD |
1419 | 1419 | $user_ad_groups = []; |
1420 | - foreach($groups as $group) { |
|
1420 | + foreach ($groups as $group) { |
|
1421 | 1421 | //print_r($group); |
1422 | 1422 | // get relation role id for AD group |
1423 | 1423 | $role = DB::queryFirstRow( |
1424 | 1424 | 'SELECT lgr.role_id |
1425 | - FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr |
|
1425 | + FROM ' . prefixTable('ldap_groups_roles').' AS lgr |
|
1426 | 1426 | WHERE lgr.ldap_group_id = %s', |
1427 | 1427 | $group |
1428 | 1428 | ); |
@@ -1516,7 +1516,7 @@ discard block |
||
1516 | 1516 | $userInfo['id'] |
1517 | 1517 | ); |
1518 | 1518 | } |
1519 | - if (WIP === true) error_log("finalizeAuthentication - hashedPassword: " . $hashedPassword. " | ".$passwordManager->verifyPassword($userInfo['pw'], $passwordClear)." || ".$passwordClear); |
|
1519 | + if (WIP === true) error_log("finalizeAuthentication - hashedPassword: ".$hashedPassword." | ".$passwordManager->verifyPassword($userInfo['pw'], $passwordClear)." || ".$passwordClear); |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | /** |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | } |
1569 | 1569 | |
1570 | 1570 | // Now check yubico validity |
1571 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1571 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1572 | 1572 | $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
1573 | 1573 | $auth = $yubi->verify($yubico_key); |
1574 | 1574 | //, null, null, null, 60 |
@@ -1627,7 +1627,7 @@ discard block |
||
1627 | 1627 | // Check if exists in DB |
1628 | 1628 | $groupData = DB::queryFirstRow( |
1629 | 1629 | 'SELECT id |
1630 | - FROM ' . prefixTable('roles_title') . ' |
|
1630 | + FROM ' . prefixTable('roles_title').' |
|
1631 | 1631 | WHERE title = %s', |
1632 | 1632 | $group["displayName"] |
1633 | 1633 | ); |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | |
1757 | 1757 | // generate new QR |
1758 | 1758 | $new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
1759 | - 'Teampass - ' . $username, |
|
1759 | + 'Teampass - '.$username, |
|
1760 | 1760 | $userInfo['ga'] |
1761 | 1761 | ); |
1762 | 1762 | // clear temporary code from DB |
@@ -1769,7 +1769,7 @@ discard block |
||
1769 | 1769 | $userInfo['id'] |
1770 | 1770 | ); |
1771 | 1771 | $firstTime = [ |
1772 | - 'value' => '<img src="' . $new_2fa_qr . '">', |
|
1772 | + 'value' => '<img src="'.$new_2fa_qr.'">', |
|
1773 | 1773 | 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
1774 | 1774 | 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
1775 | 1775 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
@@ -1925,7 +1925,7 @@ discard block |
||
1925 | 1925 | }*/ |
1926 | 1926 | return [ |
1927 | 1927 | 'error' => true, |
1928 | - 'message' => $duo_error . $lang->get('duo_error_check_config'), |
|
1928 | + 'message' => $duo_error.$lang->get('duo_error_check_config'), |
|
1929 | 1929 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
1930 | 1930 | 'debug_message' => $e->getMessage(), |
1931 | 1931 | 'proceedIdentification' => false, |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | } catch (DuoException $e) { |
1942 | 1942 | return [ |
1943 | 1943 | 'error' => true, |
1944 | - 'message' => $duo_error . $lang->get('duo_error_url'), |
|
1944 | + 'message' => $duo_error.$lang->get('duo_error_url'), |
|
1945 | 1945 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
1946 | 1946 | 'debug_message' => $e->getMessage(), |
1947 | 1947 | 'proceedIdentification' => false, |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | // Somethimes Duo return success but fail to return a URL, double check if the URL has been created |
1952 | - if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) { |
|
1952 | + if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) { |
|
1953 | 1953 | // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt |
1954 | 1954 | $key = hash('sha256', $duo_state); |
1955 | 1955 | $iv = substr(hash('sha256', $duo_state), 0, 16); |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | } else { |
1978 | 1978 | return [ |
1979 | 1979 | 'error' => true, |
1980 | - 'message' => $duo_error . $lang->get('duo_error_url'), |
|
1980 | + 'message' => $duo_error.$lang->get('duo_error_url'), |
|
1981 | 1981 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
1982 | 1982 | 'proceedIdentification' => false, |
1983 | 1983 | ]; |
@@ -1998,8 +1998,8 @@ discard block |
||
1998 | 1998 | // return the response (which should be the user name) |
1999 | 1999 | if ($decoded_token['preferred_username'] === $username) { |
2000 | 2000 | $session->set('user-duo_status', 'COMPLET'); |
2001 | - $session->set('user-duo_state',''); |
|
2002 | - $session->set('user-duo_data',''); |
|
2001 | + $session->set('user-duo_state', ''); |
|
2002 | + $session->set('user-duo_data', ''); |
|
2003 | 2003 | $session->set('user-login', $username); |
2004 | 2004 | |
2005 | 2005 | return [ |
@@ -2010,9 +2010,9 @@ discard block |
||
2010 | 2010 | ]; |
2011 | 2011 | } else { |
2012 | 2012 | // Something wrong, username from the original Duo request is different than the one received now |
2013 | - $session->set('user-duo_status',''); |
|
2014 | - $session->set('user-duo_state',''); |
|
2015 | - $session->set('user-duo_data',''); |
|
2013 | + $session->set('user-duo_status', ''); |
|
2014 | + $session->set('user-duo_state', ''); |
|
2015 | + $session->set('user-duo_data', ''); |
|
2016 | 2016 | |
2017 | 2017 | return [ |
2018 | 2018 | 'error' => true, |
@@ -2023,9 +2023,9 @@ discard block |
||
2023 | 2023 | } |
2024 | 2024 | } |
2025 | 2025 | // If we are here something wrong |
2026 | - $session->set('user-duo_status',''); |
|
2027 | - $session->set('user-duo_state',''); |
|
2028 | - $session->set('user-duo_data',''); |
|
2026 | + $session->set('user-duo_status', ''); |
|
2027 | + $session->set('user-duo_state', ''); |
|
2028 | + $session->set('user-duo_data', ''); |
|
2029 | 2029 | return [ |
2030 | 2030 | 'error' => true, |
2031 | 2031 | 'message' => $lang->get('duo_login_mismatch'), |
@@ -2141,8 +2141,8 @@ discard block |
||
2141 | 2141 | // Get user info from DB |
2142 | 2142 | $data = DB::queryFirstRow( |
2143 | 2143 | 'SELECT u.*, a.value AS api_key |
2144 | - FROM ' . prefixTable('users') . ' AS u |
|
2145 | - LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id) |
|
2144 | + FROM ' . prefixTable('users').' AS u |
|
2145 | + LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id) |
|
2146 | 2146 | WHERE login = %s AND deleted_at IS NULL', |
2147 | 2147 | $login |
2148 | 2148 | ); |
@@ -2578,15 +2578,15 @@ discard block |
||
2578 | 2578 | |
2579 | 2579 | if ($ret['error'] !== false) { |
2580 | 2580 | logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username)); |
2581 | - $session->set('user-duo_status',''); |
|
2582 | - $session->set('user-duo_state',''); |
|
2583 | - $session->set('user-duo_data',''); |
|
2581 | + $session->set('user-duo_status', ''); |
|
2582 | + $session->set('user-duo_state', ''); |
|
2583 | + $session->set('user-duo_data', ''); |
|
2584 | 2584 | return [ |
2585 | 2585 | 'error' => true, |
2586 | 2586 | 'mfaData' => $ret, |
2587 | 2587 | 'mfaQRCodeInfos' => false, |
2588 | 2588 | ]; |
2589 | - } else if ($ret['duo_url_ready'] === true){ |
|
2589 | + } else if ($ret['duo_url_ready'] === true) { |
|
2590 | 2590 | return [ |
2591 | 2591 | 'error' => false, |
2592 | 2592 | 'mfaData' => $ret, |
@@ -1516,8 +1516,10 @@ discard block |
||
1516 | 1516 | $userInfo['id'] |
1517 | 1517 | ); |
1518 | 1518 | } |
1519 | - if (WIP === true) error_log("finalizeAuthentication - hashedPassword: " . $hashedPassword. " | ".$passwordManager->verifyPassword($userInfo['pw'], $passwordClear)." || ".$passwordClear); |
|
1520 | -} |
|
1519 | + if (WIP === true) { |
|
1520 | + error_log("finalizeAuthentication - hashedPassword: " . $hashedPassword. " | ".$passwordManager->verifyPassword($userInfo['pw'], $passwordClear)." || ".$passwordClear); |
|
1521 | + } |
|
1522 | + } |
|
1521 | 1523 | |
1522 | 1524 | /** |
1523 | 1525 | * Undocumented function. |
@@ -2051,7 +2053,9 @@ discard block |
||
2051 | 2053 | $passwordClear, |
2052 | 2054 | (int) $userInfo['id'] |
2053 | 2055 | ); |
2054 | - if (WIP === true) error_log("checkCredentials - User ".$userInfo['id']." | verify pwd: ".$passwordManager->verifyPassword($userInfo['pw'], $passwordClear)); |
|
2056 | + if (WIP === true) { |
|
2057 | + error_log("checkCredentials - User ".$userInfo['id']." | verify pwd: ".$passwordManager->verifyPassword($userInfo['pw'], $passwordClear)); |
|
2058 | + } |
|
2055 | 2059 | |
2056 | 2060 | if ($passwordManager->verifyPassword($userInfo['pw'], $passwordClear) === false) { |
2057 | 2061 | // password is not correct |