@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ) { |
| 78 | 78 | // Not allowed page |
| 79 | 79 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 80 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 80 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 81 | 81 | exit; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $arrFolders = array(); |
| 129 | 129 | $rows = DB::query( |
| 130 | 130 | 'SELECT valeur, intitule |
| 131 | - FROM ' . prefixTable('misc') . ' |
|
| 131 | + FROM ' . prefixTable('misc').' |
|
| 132 | 132 | WHERE type = %s', |
| 133 | 133 | 'folder_deleted' |
| 134 | 134 | ); |
@@ -151,11 +151,11 @@ discard block |
||
| 151 | 151 | i.id as id, i.label as label, |
| 152 | 152 | i.id_tree as id_tree, l.date as date, n.title as folder_title, |
| 153 | 153 | a.del_enabled as del_enabled, a.del_value as del_value, a.del_type as del_type |
| 154 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 155 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
| 156 | - LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 157 | - LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id) |
|
| 158 | - LEFT JOIN ' . prefixTable('automatic_del') . ' as a ON (l.id_item = a.item_id) |
|
| 154 | + FROM ' . prefixTable('log_items').' as l |
|
| 155 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
| 156 | + LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 157 | + LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id) |
|
| 158 | + LEFT JOIN ' . prefixTable('automatic_del').' as a ON (l.id_item = a.item_id) |
|
| 159 | 159 | WHERE l.action = %s |
| 160 | 160 | AND i.perso = %i |
| 161 | 161 | AND TRIM(COALESCE(i.deleted_at, "")) <> "" |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | 'label' => $record['label'], |
| 180 | 180 | 'date' => date($SETTINGS['date_format'], (int) $record['date']), |
| 181 | 181 | 'login' => $record['login'], |
| 182 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
| 182 | + 'name' => $record['name'].' '.$record['lastname'], |
|
| 183 | 183 | 'folder_label' => $record['folder_title'], |
| 184 | 184 | 'folder_deleted' => $thisFolder, |
| 185 | 185 | 'del_enabled' => (bool) $record['del_enabled'], |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | foreach ($post_folders as $folderId) { |
| 241 | 241 | $data = DB::queryFirstRow( |
| 242 | 242 | 'SELECT valeur |
| 243 | - FROM ' . prefixTable('misc') . " |
|
| 243 | + FROM ' . prefixTable('misc')." |
|
| 244 | 244 | WHERE type = 'folder_deleted' |
| 245 | 245 | AND intitule = %s", |
| 246 | - 'f' . $folderId |
|
| 246 | + 'f'.$folderId |
|
| 247 | 247 | ); |
| 248 | 248 | if ((int) $data['valeur'] !== 0) { |
| 249 | 249 | $folderData = explode(', ', $data['valeur']); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | prefixTable('misc'), |
| 271 | 271 | 'type = %s AND intitule = %s', |
| 272 | 272 | 'folder_deleted', |
| 273 | - 'f' . $folderId |
|
| 273 | + 'f'.$folderId |
|
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | 276 | // Restore all items in this folder |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // Get list of all items in thos folder |
| 288 | 288 | $items = DB::query( |
| 289 | 289 | 'SELECT id |
| 290 | - FROM ' . prefixTable('items') . ' |
|
| 290 | + FROM ' . prefixTable('items').' |
|
| 291 | 291 | WHERE id_tree = %i', |
| 292 | 292 | $folderId |
| 293 | 293 | ); |
@@ -377,10 +377,10 @@ discard block |
||
| 377 | 377 | foreach ($post_folders as $folderId) { |
| 378 | 378 | $data = DB::queryFirstRow( |
| 379 | 379 | 'SELECT valeur |
| 380 | - FROM ' . prefixTable('misc') . " |
|
| 380 | + FROM ' . prefixTable('misc')." |
|
| 381 | 381 | WHERE type = 'folder_deleted' |
| 382 | 382 | AND intitule = %s", |
| 383 | - 'f' . $folderId |
|
| 383 | + 'f'.$folderId |
|
| 384 | 384 | ); |
| 385 | 385 | if ((int) $data['valeur'] !== 0) { |
| 386 | 386 | $exploded = explode(',', $data['valeur']); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | prefixTable('misc'), |
| 392 | 392 | 'type = %s AND intitule = %s', |
| 393 | 393 | 'folder_deleted', |
| 394 | - 'f' . $folderData[0] |
|
| 394 | + 'f'.$folderData[0] |
|
| 395 | 395 | ); |
| 396 | 396 | |
| 397 | 397 | // Delete all items in this folder |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | // Get list of all items in thos folder |
| 406 | 406 | $items = DB::query( |
| 407 | 407 | 'SELECT id |
| 408 | - FROM ' . prefixTable('items') . ' |
|
| 408 | + FROM ' . prefixTable('items').' |
|
| 409 | 409 | WHERE id_tree = %i', |
| 410 | 410 | $folderData[0] |
| 411 | 411 | ); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | // Delete all fields |
| 423 | 423 | $fields = DB::query( |
| 424 | 424 | 'SELECT id |
| 425 | - FROM ' . prefixTable('categories_items') . ' |
|
| 425 | + FROM ' . prefixTable('categories_items').' |
|
| 426 | 426 | WHERE item_id = %i', |
| 427 | 427 | $folderData[0] |
| 428 | 428 | ); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | // Delete all files |
| 443 | 443 | $files = DB::query( |
| 444 | 444 | 'SELECT id |
| 445 | - FROM ' . prefixTable('files') . ' |
|
| 445 | + FROM ' . prefixTable('files').' |
|
| 446 | 446 | WHERE id_item = %i', |
| 447 | 447 | $folderData[0] |
| 448 | 448 | ); |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | // Delete sharekey fields |
| 500 | 500 | $itemFields = DB::query( |
| 501 | 501 | 'SELECT id |
| 502 | - FROM ' . prefixTable('categories_items') . ' |
|
| 502 | + FROM ' . prefixTable('categories_items').' |
|
| 503 | 503 | WHERE item_id = %i', |
| 504 | 504 | $itemId |
| 505 | 505 | ); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | // Delete sharekey files |
| 515 | 515 | $itemFiles = DB::query( |
| 516 | 516 | 'SELECT id |
| 517 | - FROM ' . prefixTable('files') . ' |
|
| 517 | + FROM ' . prefixTable('files').' |
|
| 518 | 518 | WHERE id_item = %i', |
| 519 | 519 | $itemId |
| 520 | 520 | ); |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | ) { |
| 592 | 592 | if ($post_log_type === 'items') { |
| 593 | 593 | DB::query( |
| 594 | - 'SELECT * FROM ' . prefixTable('log_items') . ' |
|
| 594 | + 'SELECT * FROM '.prefixTable('log_items').' |
|
| 595 | 595 | WHERE (date BETWEEN %i AND %i)' |
| 596 | 596 | . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"') |
| 597 | 597 | . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user), |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | } elseif ($post_log_type === 'connections') { |
| 612 | 612 | //db::debugmode(true); |
| 613 | 613 | DB::query( |
| 614 | - 'SELECT * FROM ' . prefixTable('log_system') . ' |
|
| 614 | + 'SELECT * FROM '.prefixTable('log_system').' |
|
| 615 | 615 | WHERE type=%s ' |
| 616 | 616 | . 'AND (date BETWEEN %i AND %i)' |
| 617 | 617 | . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action) |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | ); |
| 635 | 635 | } elseif ($post_log_type === 'errors') { |
| 636 | 636 | DB::query( |
| 637 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
| 637 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
| 638 | 638 | 'AND (date BETWEEN %i AND %i)', |
| 639 | 639 | 'error', |
| 640 | 640 | $post_date_from, |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | ); |
| 652 | 652 | } elseif ($post_log_type === 'copy') { |
| 653 | 653 | DB::query( |
| 654 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' . |
|
| 654 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '. |
|
| 655 | 655 | 'AND (date BETWEEN %i AND %i)', |
| 656 | 656 | 'at_copy', |
| 657 | 657 | $post_date_from, |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | ); |
| 669 | 669 | } elseif ($post_log_type === 'admin') { |
| 670 | 670 | DB::query( |
| 671 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
| 671 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
| 672 | 672 | 'AND (date BETWEEN %i AND %i)', |
| 673 | 673 | 'admin_action', |
| 674 | 674 | $post_date_from, |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | ); |
| 686 | 686 | } elseif ($post_log_type === 'failed') { |
| 687 | 687 | DB::query( |
| 688 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
| 688 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
| 689 | 689 | 'AND (date BETWEEN %i AND %i)', |
| 690 | 690 | 'failed_auth', |
| 691 | 691 | $post_date_from, |
@@ -756,19 +756,19 @@ discard block |
||
| 756 | 756 | // Get info about task |
| 757 | 757 | $taskInfo = DB::queryFirstRow( |
| 758 | 758 | 'SELECT p.process_type as process_type |
| 759 | - FROM ' . prefixTable('background_tasks') . ' as p |
|
| 759 | + FROM ' . prefixTable('background_tasks').' as p |
|
| 760 | 760 | WHERE p.increment_id = %i', |
| 761 | 761 | $post_id |
| 762 | 762 | ); |
| 763 | 763 | if ($taskInfo !== null) { |
| 764 | 764 | // delete task |
| 765 | 765 | DB::query( |
| 766 | - 'DELETE FROM ' . prefixTable('background_subtasks') . ' |
|
| 766 | + 'DELETE FROM '.prefixTable('background_subtasks').' |
|
| 767 | 767 | WHERE task_id = %i', |
| 768 | 768 | $post_id |
| 769 | 769 | ); |
| 770 | 770 | DB::query( |
| 771 | - 'DELETE FROM ' . prefixTable('background_tasks') . ' |
|
| 771 | + 'DELETE FROM '.prefixTable('background_tasks').' |
|
| 772 | 772 | WHERE increment_id = %i', |
| 773 | 773 | $post_id |
| 774 | 774 | ); |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | ->setDayOfMonth('*') |
| 836 | 836 | ->setMonths('*') |
| 837 | 837 | ->setDayOfWeek('*') |
| 838 | - ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php') |
|
| 838 | + ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php') |
|
| 839 | 839 | ->setComments('Teampass scheduler'); |
| 840 | 840 | |
| 841 | 841 | $crontabRepository->addJob($crontabJob); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) { |
| 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 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // Get info about user to modify |
| 147 | 147 | $targetUserInfos = DB::queryFirstRow( |
| 148 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 148 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 149 | 149 | WHERE id = %i', |
| 150 | 150 | (int) $dataReceived['user_id'] |
| 151 | 151 | ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // Check if user already exists |
| 278 | 278 | $data = DB::query( |
| 279 | 279 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
| 280 | - FROM ' . prefixTable('users') . ' |
|
| 280 | + FROM ' . prefixTable('users').' |
|
| 281 | 281 | WHERE login = %s |
| 282 | 282 | AND deleted_at IS NULL', |
| 283 | 283 | $login |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | // Prepare variables |
| 495 | - $userId = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
|
| 495 | + $userId = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
|
| 496 | 496 | |
| 497 | 497 | if (empty($userId)) { |
| 498 | 498 | echo prepareExchangedData( |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | // Get info about user to delete |
| 509 | 509 | $data_user = DB::queryFirstRow( |
| 510 | - 'SELECT login, admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 510 | + 'SELECT login, admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 511 | 511 | WHERE id = %i', |
| 512 | 512 | $userId |
| 513 | 513 | ); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | || ((int) $session->get('user-can_manage_all_users') === 1 && (int) $data_user['admin'] !== 1) |
| 525 | 525 | ) { |
| 526 | 526 | $timestamp = time(); |
| 527 | - $deletedSuffix = '_deleted_' . $timestamp; |
|
| 527 | + $deletedSuffix = '_deleted_'.$timestamp; |
|
| 528 | 528 | |
| 529 | 529 | // delete user in database |
| 530 | 530 | DB::update( |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | echo prepareExchangedData( |
| 663 | 663 | [ |
| 664 | 664 | 'error' => true, |
| 665 | - 'message' => $lang->get('error') . ': ' . $e->getMessage(), |
|
| 665 | + 'message' => $lang->get('error').': '.$e->getMessage(), |
|
| 666 | 666 | ], |
| 667 | 667 | 'encode' |
| 668 | 668 | ); |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | $return = array(); |
| 677 | 677 | // Check if folder exists |
| 678 | 678 | $data = DB::query( |
| 679 | - 'SELECT * FROM ' . prefixTable('nested_tree') . ' |
|
| 679 | + 'SELECT * FROM '.prefixTable('nested_tree').' |
|
| 680 | 680 | WHERE title = %s AND parent_id = %i', |
| 681 | 681 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS), |
| 682 | 682 | '0' |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | // Check if role exists |
| 691 | 691 | $data = DB::query( |
| 692 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 692 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 693 | 693 | WHERE title = %s', |
| 694 | 694 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
| 695 | 695 | ); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | // Get info about user to delete |
| 719 | 719 | $data_user = DB::queryFirstRow( |
| 720 | 720 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 721 | - FROM ' . prefixTable('users') . ' |
|
| 721 | + FROM ' . prefixTable('users').' |
|
| 722 | 722 | WHERE id = %i', |
| 723 | 723 | $post_user_id |
| 724 | 724 | ); |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | // Get info about user |
| 775 | 775 | $rowUser = DB::queryFirstRow( |
| 776 | 776 | 'SELECT * |
| 777 | - FROM ' . prefixTable('users') . ' |
|
| 777 | + FROM ' . prefixTable('users').' |
|
| 778 | 778 | WHERE id = %i', |
| 779 | 779 | $post_id |
| 780 | 780 | ); |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $session->set('user-roles_array', explode(';', $session->get('user-roles'))); |
| 803 | 803 | $rows = DB::query(' |
| 804 | 804 | SELECT id,title,creator_id |
| 805 | - FROM ' . prefixTable('roles_title') .' |
|
| 805 | + FROM ' . prefixTable('roles_title').' |
|
| 806 | 806 | WHERE id IN %li', |
| 807 | 807 | $session->get('user-roles_array') |
| 808 | 808 | ); |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | $rolesList = array(); |
| 841 | 841 | $managedBy = array(); |
| 842 | 842 | $selected = ''; |
| 843 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
| 843 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
| 844 | 844 | foreach ($rows as $reccord) { |
| 845 | 845 | $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']); |
| 846 | 846 | } |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | array_push( |
| 872 | 872 | $managedBy, |
| 873 | 873 | array( |
| 874 | - 'title' => $lang->get('managers_of') . ' ' . $fonction['title'], |
|
| 874 | + 'title' => $lang->get('managers_of').' '.$fonction['title'], |
|
| 875 | 875 | 'id' => $fonction['id'], |
| 876 | 876 | 'selected' => $selected, |
| 877 | 877 | ) |
@@ -953,9 +953,9 @@ discard block |
||
| 953 | 953 | |
| 954 | 954 | // get USER STATUS |
| 955 | 955 | if ($rowUser['disabled'] == 1) { |
| 956 | - $arrData['info'] = $lang->get('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">' . $lang->get('user_info_unlock_question') . '</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . $lang->get('user_info_delete_question') . '</label>'; |
|
| 956 | + $arrData['info'] = $lang->get('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">'.$lang->get('user_info_unlock_question').'</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.$lang->get('user_info_delete_question').'</label>'; |
|
| 957 | 957 | } else { |
| 958 | - $arrData['info'] = $lang->get('user_info_active') . '<br><input type="checkbox" value="lock" class="chk"> ' . $lang->get('user_info_lock_question'); |
|
| 958 | + $arrData['info'] = $lang->get('user_info_active').'<br><input type="checkbox" value="lock" class="chk"> '.$lang->get('user_info_lock_question'); |
|
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | $arrData['error'] = false; |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | // Get info about user to modify |
| 1044 | 1044 | $data_user = DB::queryFirstRow( |
| 1045 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 1045 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 1046 | 1046 | WHERE id = %i', |
| 1047 | 1047 | $post_id |
| 1048 | 1048 | ); |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | // count number of admins |
| 1054 | 1054 | $users = DB::query( |
| 1055 | 1055 | 'SELECT id |
| 1056 | - FROM ' . prefixTable('users') . ' |
|
| 1056 | + FROM ' . prefixTable('users').' |
|
| 1057 | 1057 | WHERE admin = 1 AND email != "" AND pw != "" AND id != %i', |
| 1058 | 1058 | $post_id |
| 1059 | 1059 | ); |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | // Exclude roles from AD - PR #3635 |
| 1077 | 1077 | $adRoles = DB::query( |
| 1078 | 1078 | 'SELECT roles_from_ad_groups |
| 1079 | - FROM ' . prefixTable('users') . ' |
|
| 1079 | + FROM ' . prefixTable('users').' |
|
| 1080 | 1080 | WHERE id = %i', |
| 1081 | 1081 | $post_id |
| 1082 | 1082 | )[0]['roles_from_ad_groups']; |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | ); |
| 1179 | 1179 | // delete personal folder and subfolders |
| 1180 | 1180 | $data = DB::queryFirstRow( |
| 1181 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 1181 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 1182 | 1182 | WHERE title = %s AND personal_folder = %i', |
| 1183 | 1183 | $post_id, |
| 1184 | 1184 | '1' |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
| 1192 | 1192 | // delete items & logs |
| 1193 | 1193 | $items = DB::query( |
| 1194 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
| 1194 | + 'SELECT id FROM '.prefixTable('items').' |
|
| 1195 | 1195 | WHERE id_tree=%i AND perso = %i', |
| 1196 | 1196 | $folder->id, |
| 1197 | 1197 | '1' |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | } else { |
| 1213 | 1213 | // Get old data about user |
| 1214 | 1214 | $oldData = DB::queryFirstRow( |
| 1215 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
| 1215 | + 'SELECT * FROM '.prefixTable('users').' |
|
| 1216 | 1216 | WHERE id = %i', |
| 1217 | 1217 | $post_id |
| 1218 | 1218 | ); |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | |
| 1250 | 1250 | // update LOG |
| 1251 | 1251 | if ($oldData['email'] !== $post_email) { |
| 1252 | - logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id); |
|
| 1252 | + logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id); |
|
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | 1255 | echo prepareExchangedData( |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | DB::queryFirstRow( |
| 1300 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
| 1300 | + 'SELECT * FROM '.prefixTable('users').' |
|
| 1301 | 1301 | WHERE login = %s |
| 1302 | 1302 | AND deleted_at IS NULL', |
| 1303 | 1303 | filter_input(INPUT_POST, 'login', FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
@@ -1349,7 +1349,7 @@ discard block |
||
| 1349 | 1349 | // get User info |
| 1350 | 1350 | $rowUser = DB::queryFirstRow( |
| 1351 | 1351 | 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb, roles_from_ad_groups |
| 1352 | - FROM ' . prefixTable('users') . ' |
|
| 1352 | + FROM ' . prefixTable('users').' |
|
| 1353 | 1353 | WHERE id = %i', |
| 1354 | 1354 | $post_id |
| 1355 | 1355 | ); |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | $html = ''; |
| 1360 | 1360 | |
| 1361 | 1361 | if (isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) { |
| 1362 | - $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id']. ';' . $rowUser['roles_from_ad_groups']; |
|
| 1362 | + $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups']; |
|
| 1363 | 1363 | } |
| 1364 | 1364 | $arrData['functions'] = array_filter(explode(';', $rowUser['fonction_id'])); |
| 1365 | 1365 | $arrData['allowed_folders'] = array_filter(explode(';', $rowUser['groupes_visibles'])); |
@@ -1370,8 +1370,8 @@ discard block |
||
| 1370 | 1370 | // refine folders based upon roles |
| 1371 | 1371 | $rows = DB::query( |
| 1372 | 1372 | 'SELECT rv.folder_id, rv.type |
| 1373 | - FROM ' . prefixTable('roles_values') . ' as rv |
|
| 1374 | - INNER JOIN ' . prefixTable('nested_tree') . ' as nt ON rv.folder_id = nt.id |
|
| 1373 | + FROM ' . prefixTable('roles_values').' as rv |
|
| 1374 | + INNER JOIN ' . prefixTable('nested_tree').' as nt ON rv.folder_id = nt.id |
|
| 1375 | 1375 | WHERE rv.role_id IN %ls AND nt.personal_folder = 0 |
| 1376 | 1376 | ORDER BY rv.folder_id ASC', |
| 1377 | 1377 | $arrData['functions'] |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | 1396 | // add allowed folders |
| 1397 | - foreach($arrData['allowed_folders'] as $Fld) { |
|
| 1397 | + foreach ($arrData['allowed_folders'] as $Fld) { |
|
| 1398 | 1398 | array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true)); |
| 1399 | 1399 | } |
| 1400 | 1400 | |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | // get folder name |
| 1406 | 1406 | $row = DB::queryFirstRow( |
| 1407 | 1407 | 'SELECT title, nlevel, id |
| 1408 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 1408 | + FROM ' . prefixTable('nested_tree').' |
|
| 1409 | 1409 | WHERE id = %i', |
| 1410 | 1410 | $fld['id'] |
| 1411 | 1411 | ); |
@@ -1418,38 +1418,38 @@ discard block |
||
| 1418 | 1418 | |
| 1419 | 1419 | // manage right icon |
| 1420 | 1420 | if ($fld['type'] == 'W') { |
| 1421 | - $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1422 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' . |
|
| 1423 | - '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>'; |
|
| 1421 | + $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1422 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'. |
|
| 1423 | + '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>'; |
|
| 1424 | 1424 | } elseif ($fld['type'] == 'ND') { |
| 1425 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1426 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' . |
|
| 1427 | - '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>'; |
|
| 1425 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1426 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'. |
|
| 1427 | + '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>'; |
|
| 1428 | 1428 | } elseif ($fld['type'] == 'NE') { |
| 1429 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1430 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' . |
|
| 1431 | - '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>'; |
|
| 1429 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1430 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'. |
|
| 1431 | + '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>'; |
|
| 1432 | 1432 | } elseif ($fld['type'] == 'NDNE') { |
| 1433 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1434 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' . |
|
| 1435 | - '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>'; |
|
| 1433 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1434 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'. |
|
| 1435 | + '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>'; |
|
| 1436 | 1436 | } elseif ($fld['type'] == '') { |
| 1437 | - $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . $lang->get('no_access') . '"></i>'; |
|
| 1437 | + $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.$lang->get('no_access').'"></i>'; |
|
| 1438 | 1438 | } else { |
| 1439 | - $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . $lang->get('read') . '"></i>'; |
|
| 1439 | + $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.$lang->get('read').'"></i>'; |
|
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | - $html .= '<tr><td>' . $ident . $row['title'] . |
|
| 1443 | - ' <small class="text-info">[' . $row['id'] . ']</small>'. |
|
| 1444 | - ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . $lang->get('user_specific_right') . '"></i>' : ''). |
|
| 1445 | - '</td><td>' . $label . '</td></tr>'; |
|
| 1442 | + $html .= '<tr><td>'.$ident.$row['title']. |
|
| 1443 | + ' <small class="text-info">['.$row['id'].']</small>'. |
|
| 1444 | + ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.$lang->get('user_specific_right').'"></i>' : ''). |
|
| 1445 | + '</td><td>'.$label.'</td></tr>'; |
|
| 1446 | 1446 | break; |
| 1447 | 1447 | } |
| 1448 | 1448 | } |
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | - $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' . |
|
| 1452 | - $html . '</tbody></table>'; |
|
| 1451 | + $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'. |
|
| 1452 | + $html.'</tbody></table>'; |
|
| 1453 | 1453 | } else { |
| 1454 | 1454 | $html_full = ''; |
| 1455 | 1455 | } |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | if ((int) $session->get('user-admin') === 0 && (int) $session->get('user-can_manage_all_users') === 0) { |
| 1496 | 1496 | $rows = DB::query( |
| 1497 | 1497 | 'SELECT * |
| 1498 | - FROM ' . prefixTable('users') . ' |
|
| 1498 | + FROM ' . prefixTable('users').' |
|
| 1499 | 1499 | WHERE admin = %i AND isAdministratedByRole IN %ls AND deleted_at IS NULL and disabled = %i', |
| 1500 | 1500 | 0, |
| 1501 | 1501 | array_filter($session->get('user-roles_array')), |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | } else { |
| 1505 | 1505 | $rows = DB::query( |
| 1506 | 1506 | 'SELECT * |
| 1507 | - FROM ' . prefixTable('users') . ' |
|
| 1507 | + FROM ' . prefixTable('users').' |
|
| 1508 | 1508 | WHERE admin = %i AND deleted_at IS NULL and disabled = %i', |
| 1509 | 1509 | 0, |
| 1510 | 1510 | 0 |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | $groupIds = []; |
| 1518 | 1518 | foreach (explode(';', $record['fonction_id']) as $group) { |
| 1519 | 1519 | $tmp = DB::queryFirstRow( |
| 1520 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
| 1520 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
| 1521 | 1521 | WHERE id = %i', |
| 1522 | 1522 | $group |
| 1523 | 1523 | ); |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | |
| 1530 | 1530 | // Get managed_by |
| 1531 | 1531 | $managedBy = DB::queryFirstRow( |
| 1532 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
| 1532 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
| 1533 | 1533 | WHERE id = %i', |
| 1534 | 1534 | $record['isAdministratedByRole'] |
| 1535 | 1535 | ); |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | $foldersAllowedIds = []; |
| 1540 | 1540 | foreach (explode(';', $record['groupes_visibles']) as $role) { |
| 1541 | 1541 | $tmp = DB::queryFirstRow( |
| 1542 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
| 1542 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
| 1543 | 1543 | WHERE id = %i', |
| 1544 | 1544 | $role |
| 1545 | 1545 | ); |
@@ -1552,7 +1552,7 @@ discard block |
||
| 1552 | 1552 | $foldersForbiddenIds = []; |
| 1553 | 1553 | foreach (explode(';', $record['groupes_interdits']) as $role) { |
| 1554 | 1554 | $tmp = DB::queryFirstRow( |
| 1555 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
| 1555 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
| 1556 | 1556 | WHERE id = %i', |
| 1557 | 1557 | $role |
| 1558 | 1558 | ); |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | 'login' => $record['login'], |
| 1571 | 1571 | 'groups' => implode(', ', $groups), |
| 1572 | 1572 | 'groupIds' => $groupIds, |
| 1573 | - 'managedBy' => $managedBy=== null ? $lang->get('administrator') : $managedBy['title'], |
|
| 1573 | + 'managedBy' => $managedBy === null ? $lang->get('administrator') : $managedBy['title'], |
|
| 1574 | 1574 | 'managedById' => $managedBy === null ? 0 : $managedBy['id'], |
| 1575 | 1575 | 'foldersAllowed' => implode(', ', $foldersAllowed), |
| 1576 | 1576 | 'foldersAllowedIds' => $foldersAllowedIds, |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | |
| 1672 | 1672 | // Get info about user |
| 1673 | 1673 | $data_user = DB::queryFirstRow( |
| 1674 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 1674 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 1675 | 1675 | WHERE id = %i', |
| 1676 | 1676 | $inputData['source_id'] |
| 1677 | 1677 | ); |
@@ -1903,14 +1903,14 @@ discard block |
||
| 1903 | 1903 | if (empty($post_context) === false && $post_context === 'add_one_role_to_user') { |
| 1904 | 1904 | $data_user = DB::queryFirstRow( |
| 1905 | 1905 | 'SELECT fonction_id, public_key |
| 1906 | - FROM ' . prefixTable('users') . ' |
|
| 1906 | + FROM ' . prefixTable('users').' |
|
| 1907 | 1907 | WHERE id = %i', |
| 1908 | 1908 | $post_user_id |
| 1909 | 1909 | ); |
| 1910 | 1910 | |
| 1911 | 1911 | if ($data_user) { |
| 1912 | 1912 | // Ensure array is unique |
| 1913 | - $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value; |
|
| 1913 | + $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value; |
|
| 1914 | 1914 | $post_new_value = implode(';', array_unique(explode(';', $post_new_value))); |
| 1915 | 1915 | } else { |
| 1916 | 1916 | // User not found |
@@ -1926,14 +1926,14 @@ discard block |
||
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | 1928 | // Manage specific case of api key |
| 1929 | - if($post_field === 'user_api_key') { |
|
| 1929 | + if ($post_field === 'user_api_key') { |
|
| 1930 | 1930 | $encrypted_key = encryptUserObjectKey(base64_encode($post_new_value), $session->get('user-public_key')); |
| 1931 | 1931 | $session->set('user-api_key', $post_new_value); |
| 1932 | 1932 | |
| 1933 | 1933 | // test if user has an api key |
| 1934 | 1934 | $data_user = DB::queryFirstRow( |
| 1935 | 1935 | 'SELECT value |
| 1936 | - FROM ' . prefixTable('api') . ' |
|
| 1936 | + FROM ' . prefixTable('api').' |
|
| 1937 | 1937 | WHERE user_id = %i', |
| 1938 | 1938 | $post_user_id |
| 1939 | 1939 | ); |
@@ -2053,7 +2053,7 @@ discard block |
||
| 2053 | 2053 | } catch (\LdapRecord\Auth\BindException $e) { |
| 2054 | 2054 | $error = $e->getDetailedError(); |
| 2055 | 2055 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 2056 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
| 2056 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
| 2057 | 2057 | } |
| 2058 | 2058 | // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending |
| 2059 | 2059 | echo prepareExchangedData( |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | } catch (\LdapRecord\Auth\BindException $e) { |
| 2084 | 2084 | $error = $e->getDetailedError(); |
| 2085 | 2085 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 2086 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
| 2086 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
| 2087 | 2087 | } |
| 2088 | 2088 | // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending |
| 2089 | 2089 | echo prepareExchangedData( |
@@ -2100,7 +2100,7 @@ discard block |
||
| 2100 | 2100 | if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue; |
| 2101 | 2101 | // Build the list of all groups in AD |
| 2102 | 2102 | if (isset($adUser['memberof']) === true) { |
| 2103 | - foreach($adUser['memberof'] as $j => $adUserGroup) { |
|
| 2103 | + foreach ($adUser['memberof'] as $j => $adUserGroup) { |
|
| 2104 | 2104 | if (empty($adUserGroup) === false && $j !== "count") { |
| 2105 | 2105 | $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3); |
| 2106 | 2106 | if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) { |
@@ -2116,7 +2116,7 @@ discard block |
||
| 2116 | 2116 | // Get his ID |
| 2117 | 2117 | $userInfo = DB::queryFirstRow( |
| 2118 | 2118 | 'SELECT id, login, fonction_id, auth_type |
| 2119 | - FROM ' . prefixTable('users') . ' |
|
| 2119 | + FROM ' . prefixTable('users').' |
|
| 2120 | 2120 | WHERE login = %s', |
| 2121 | 2121 | $userLogin |
| 2122 | 2122 | ); |
@@ -2152,7 +2152,7 @@ discard block |
||
| 2152 | 2152 | |
| 2153 | 2153 | // Get all groups in Teampass |
| 2154 | 2154 | $teampassRoles = array(); |
| 2155 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
| 2155 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
| 2156 | 2156 | foreach ($rows as $record) { |
| 2157 | 2157 | array_push( |
| 2158 | 2158 | $teampassRoles, |
@@ -2217,7 +2217,7 @@ discard block |
||
| 2217 | 2217 | // Check if user already exists |
| 2218 | 2218 | $data = DB::query( |
| 2219 | 2219 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
| 2220 | - FROM ' . prefixTable('users') . ' |
|
| 2220 | + FROM ' . prefixTable('users').' |
|
| 2221 | 2221 | WHERE login = %s', |
| 2222 | 2222 | $post_login |
| 2223 | 2223 | ); |
@@ -2405,7 +2405,7 @@ discard block |
||
| 2405 | 2405 | // Check if user already exists |
| 2406 | 2406 | DB::query( |
| 2407 | 2407 | 'SELECT id |
| 2408 | - FROM ' . prefixTable('users') . ' |
|
| 2408 | + FROM ' . prefixTable('users').' |
|
| 2409 | 2409 | WHERE id = %i', |
| 2410 | 2410 | $post_id |
| 2411 | 2411 | ); |
@@ -2467,7 +2467,7 @@ discard block |
||
| 2467 | 2467 | // Get all groups in Teampass |
| 2468 | 2468 | $teampassRoles = array(); |
| 2469 | 2469 | $titleToIdMap = []; |
| 2470 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
| 2470 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
| 2471 | 2471 | foreach ($rows as $record) { |
| 2472 | 2472 | array_push( |
| 2473 | 2473 | $teampassRoles, |
@@ -2513,7 +2513,7 @@ discard block |
||
| 2513 | 2513 | // Get his ID |
| 2514 | 2514 | $userInfo = DB::queryFirstRow( |
| 2515 | 2515 | 'SELECT id, login, fonction_id, auth_type |
| 2516 | - FROM ' . prefixTable('users') . ' |
|
| 2516 | + FROM ' . prefixTable('users').' |
|
| 2517 | 2517 | WHERE login = %s', |
| 2518 | 2518 | $userLogin |
| 2519 | 2519 | ); |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | // Check if user already exists |
| 2621 | 2621 | DB::query( |
| 2622 | 2622 | 'SELECT id |
| 2623 | - FROM ' . prefixTable('users') . ' |
|
| 2623 | + FROM ' . prefixTable('users').' |
|
| 2624 | 2624 | WHERE id = %i', |
| 2625 | 2625 | $post_id |
| 2626 | 2626 | ); |
@@ -2686,7 +2686,7 @@ discard block |
||
| 2686 | 2686 | // Search TP_USER in db |
| 2687 | 2687 | $userTP = DB::queryFirstRow( |
| 2688 | 2688 | 'SELECT pw |
| 2689 | - FROM ' . prefixTable('users') . ' |
|
| 2689 | + FROM ' . prefixTable('users').' |
|
| 2690 | 2690 | WHERE id = %i', |
| 2691 | 2691 | TP_USER_ID |
| 2692 | 2692 | ); |
@@ -2709,7 +2709,7 @@ discard block |
||
| 2709 | 2709 | 'arguments' => json_encode([ |
| 2710 | 2710 | 'new_user_id' => (int) $post_user_id, |
| 2711 | 2711 | 'new_user_pwd' => '', |
| 2712 | - 'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'], |
|
| 2712 | + 'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'], |
|
| 2713 | 2713 | 'owner_id' => (int) TP_USER_ID, |
| 2714 | 2714 | 'creator_pwd' => $userTP['pw'], |
| 2715 | 2715 | 'email_body' => $lang->get('email_body_user_config_5'), |
@@ -2816,17 +2816,17 @@ discard block |
||
| 2816 | 2816 | // get user info |
| 2817 | 2817 | $processesProgress = DB::query( |
| 2818 | 2818 | 'SELECT u.ongoing_process_id, pt.task, pt.updated_at, pt.finished_at, pt.is_in_progress |
| 2819 | - FROM ' . prefixTable('users') . ' AS u |
|
| 2820 | - INNER JOIN ' . prefixTable('background_subtasks') . ' AS pt ON (pt.task_id = u.ongoing_process_id) |
|
| 2819 | + FROM ' . prefixTable('users').' AS u |
|
| 2820 | + INNER JOIN ' . prefixTable('background_subtasks').' AS pt ON (pt.task_id = u.ongoing_process_id) |
|
| 2821 | 2821 | WHERE u.id = %i', |
| 2822 | 2822 | $user_id |
| 2823 | 2823 | ); |
| 2824 | 2824 | |
| 2825 | 2825 | $finished_steps = 0; |
| 2826 | 2826 | $nb_steps = count($processesProgress); |
| 2827 | - foreach($processesProgress as $process) { |
|
| 2827 | + foreach ($processesProgress as $process) { |
|
| 2828 | 2828 | if ((int) $process['is_in_progress'] === -1) { |
| 2829 | - $finished_steps ++; |
|
| 2829 | + $finished_steps++; |
|
| 2830 | 2830 | } |
| 2831 | 2831 | } |
| 2832 | 2832 | |
@@ -2835,7 +2835,7 @@ discard block |
||
| 2835 | 2835 | 'error' => false, |
| 2836 | 2836 | 'message' => '', |
| 2837 | 2837 | 'user_id' => $user_id, |
| 2838 | - 'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps/$nb_steps*100, 0).'%', |
|
| 2838 | + 'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps / $nb_steps * 100, 0).'%', |
|
| 2839 | 2839 | 'debug' => $finished_steps.",".$nb_steps, |
| 2840 | 2840 | ), |
| 2841 | 2841 | 'encode' |
@@ -3003,13 +3003,13 @@ discard block |
||
| 3003 | 3003 | |
| 3004 | 3004 | // Prepare variables |
| 3005 | 3005 | $daysRetention = filter_var($dataReceived['days_retention'], FILTER_SANITIZE_NUMBER_INT); |
| 3006 | - $daysRetention = empty($daysRetention) ? 90 : (int)$daysRetention; |
|
| 3006 | + $daysRetention = empty($daysRetention) ? 90 : (int) $daysRetention; |
|
| 3007 | 3007 | $cutoffTimestamp = time() - ($daysRetention * 86400); |
| 3008 | 3008 | |
| 3009 | 3009 | try { |
| 3010 | 3010 | // Get list of users to delete |
| 3011 | 3011 | $users = DB::query( |
| 3012 | - "SELECT id FROM " . prefixTable("users") . " |
|
| 3012 | + "SELECT id FROM ".prefixTable("users")." |
|
| 3013 | 3013 | WHERE deleted_at IS NOT NULL |
| 3014 | 3014 | AND deleted_at > 0 |
| 3015 | 3015 | AND deleted_at < %i |
@@ -3033,7 +3033,7 @@ discard block |
||
| 3033 | 3033 | echo prepareExchangedData( |
| 3034 | 3034 | [ |
| 3035 | 3035 | 'error' => true, |
| 3036 | - 'message' => $lang->get('error') . ': ' . $e->getMessage(), |
|
| 3036 | + 'message' => $lang->get('error').': '.$e->getMessage(), |
|
| 3037 | 3037 | ], |
| 3038 | 3038 | 'encode' |
| 3039 | 3039 | ); |
@@ -3087,10 +3087,10 @@ discard block |
||
| 3087 | 3087 | |
| 3088 | 3088 | $purgedCount = 0; |
| 3089 | 3089 | $errors = []; |
| 3090 | - $cutoffTimestamp = time() - ((int)$daysRetention * 86400); |
|
| 3090 | + $cutoffTimestamp = time() - ((int) $daysRetention * 86400); |
|
| 3091 | 3091 | |
| 3092 | 3092 | foreach ($userIds as $userId) { |
| 3093 | - $userId = (int)$userId; |
|
| 3093 | + $userId = (int) $userId; |
|
| 3094 | 3094 | |
| 3095 | 3095 | try { |
| 3096 | 3096 | $result = purgeDeletedUserById($userId); |
@@ -3098,7 +3098,7 @@ discard block |
||
| 3098 | 3098 | |
| 3099 | 3099 | } catch (Exception $e) { |
| 3100 | 3100 | DB::rollback(); |
| 3101 | - $errors[] = "User ID $userId: " . $e->getMessage(); |
|
| 3101 | + $errors[] = "User ID $userId: ".$e->getMessage(); |
|
| 3102 | 3102 | } |
| 3103 | 3103 | } |
| 3104 | 3104 | |
@@ -3108,7 +3108,7 @@ discard block |
||
| 3108 | 3108 | 'purged_count' => $purgedCount, |
| 3109 | 3109 | 'total_in_batch' => count($userIds), |
| 3110 | 3110 | 'errors' => $errors, |
| 3111 | - 'message' => $purgedCount . ' user(s) purged in this batch' |
|
| 3111 | + 'message' => $purgedCount.' user(s) purged in this batch' |
|
| 3112 | 3112 | ], |
| 3113 | 3113 | 'encode' |
| 3114 | 3114 | ); |
@@ -3142,7 +3142,7 @@ discard block |
||
| 3142 | 3142 | |
| 3143 | 3143 | // Get info about user |
| 3144 | 3144 | $data_user = DB::queryFirstRow( |
| 3145 | - 'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i', |
|
| 3145 | + 'SELECT login FROM '.prefixTable('users').' WHERE id = %i', |
|
| 3146 | 3146 | $userId |
| 3147 | 3147 | ); |
| 3148 | 3148 | |
@@ -3155,7 +3155,7 @@ discard block |
||
| 3155 | 3155 | } |
| 3156 | 3156 | |
| 3157 | 3157 | // Remove user suffix "_deleted_timestamp" |
| 3158 | - $deletedSuffix = '_deleted_' . substr($data_user['login'], strrpos($data_user['login'], '_deleted_') + 9); |
|
| 3158 | + $deletedSuffix = '_deleted_'.substr($data_user['login'], strrpos($data_user['login'], '_deleted_') + 9); |
|
| 3159 | 3159 | $originalLogin = str_replace($deletedSuffix, '', $data_user['login']); |
| 3160 | 3160 | |
| 3161 | 3161 | // Restore user |
@@ -3184,7 +3184,7 @@ discard block |
||
| 3184 | 3184 | |
| 3185 | 3185 | // Get info about user |
| 3186 | 3186 | $data_user = DB::queryFirstRow( |
| 3187 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 3187 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 3188 | 3188 | WHERE id = %i', |
| 3189 | 3189 | $value[1] |
| 3190 | 3190 | ); |
@@ -3218,7 +3218,7 @@ discard block |
||
| 3218 | 3218 | logEvents( |
| 3219 | 3219 | $SETTINGS, |
| 3220 | 3220 | 'user_mngt', |
| 3221 | - 'at_user_new_' . $value[0] . ':' . $value[1], |
|
| 3221 | + 'at_user_new_'.$value[0].':'.$value[1], |
|
| 3222 | 3222 | (string) $session->get('user-id'), |
| 3223 | 3223 | $session->get('user-login'), |
| 3224 | 3224 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
@@ -3253,7 +3253,7 @@ discard block |
||
| 3253 | 3253 | |
| 3254 | 3254 | // Get info about user |
| 3255 | 3255 | $data_user = DB::queryFirstRow( |
| 3256 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 3256 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 3257 | 3257 | WHERE id = %i', |
| 3258 | 3258 | $id[1] |
| 3259 | 3259 | ); |
@@ -3292,7 +3292,7 @@ discard block |
||
| 3292 | 3292 | $users = DB::query( |
| 3293 | 3293 | "SELECT id, login, email, deleted_at, |
| 3294 | 3294 | DATEDIFF(NOW(), FROM_UNIXTIME(deleted_at)) as days_since_deletion |
| 3295 | - FROM " . prefixTable("users") . " |
|
| 3295 | + FROM " . prefixTable("users")." |
|
| 3296 | 3296 | WHERE deleted_at IS NOT NULL |
| 3297 | 3297 | AND deleted_at > 0 |
| 3298 | 3298 | ORDER BY deleted_at DESC" |
@@ -3318,7 +3318,7 @@ discard block |
||
| 3318 | 3318 | |
| 3319 | 3319 | // Vérifier que l'utilisateur est bien marqué deleted |
| 3320 | 3320 | $user = DB::queryFirstRow( |
| 3321 | - "SELECT id, login, deleted_at FROM " . prefixTable("users") . " |
|
| 3321 | + "SELECT id, login, deleted_at FROM ".prefixTable("users")." |
|
| 3322 | 3322 | WHERE id = %i |
| 3323 | 3323 | AND deleted_at IS NOT NULL |
| 3324 | 3324 | AND deleted_at > 0", |
@@ -3358,7 +3358,7 @@ discard block |
||
| 3358 | 3358 | |
| 3359 | 3359 | // delete personal folder and subfolders |
| 3360 | 3360 | $data = DB::queryFirstRow( |
| 3361 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 3361 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 3362 | 3362 | WHERE title = %s AND personal_folder = %i', |
| 3363 | 3363 | $userId, |
| 3364 | 3364 | '1' |
@@ -3380,7 +3380,7 @@ discard block |
||
| 3380 | 3380 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
| 3381 | 3381 | // delete items & logs |
| 3382 | 3382 | $items = DB::query( |
| 3383 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
| 3383 | + 'SELECT id FROM '.prefixTable('items').' |
|
| 3384 | 3384 | WHERE id_tree=%i AND perso = %i', |
| 3385 | 3385 | $folder->id, |
| 3386 | 3386 | '1' |
@@ -3410,7 +3410,7 @@ discard block |
||
| 3410 | 3410 | // Delete any process related to user |
| 3411 | 3411 | $processes = DB::query( |
| 3412 | 3412 | 'SELECT increment_id |
| 3413 | - FROM ' . prefixTable('background_tasks') . ' |
|
| 3413 | + FROM ' . prefixTable('background_tasks').' |
|
| 3414 | 3414 | WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i', |
| 3415 | 3415 | $userId |
| 3416 | 3416 | ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === 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 | |
@@ -92,24 +92,24 @@ discard block |
||
| 92 | 92 | // If administrator then all roles are shown |
| 93 | 93 | // else only the Roles the users is associated to. |
| 94 | 94 | if ((int) $session->get('user-admin') === 1) { |
| 95 | - $optionsManagedBy .= '<option value="0">' . $lang->get('administrators_only') . '</option>'; |
|
| 95 | + $optionsManagedBy .= '<option value="0">'.$lang->get('administrators_only').'</option>'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $rows = DB::query( |
| 99 | 99 | 'SELECT id, title, creator_id |
| 100 | - FROM ' . prefixTable('roles_title') . ' |
|
| 100 | + FROM ' . prefixTable('roles_title').' |
|
| 101 | 101 | ORDER BY title ASC' |
| 102 | 102 | ); |
| 103 | 103 | foreach ($rows as $record) { |
| 104 | 104 | if ((int) $session->get('user-admin') === 1 || in_array($record['id'], $session->get('user-roles_array')) === true) { |
| 105 | - $optionsManagedBy .= '<option value="' . $record['id'] . '">' . $lang->get('managers_of') . ' ' . addslashes($record['title']) . '</option>'; |
|
| 105 | + $optionsManagedBy .= '<option value="'.$record['id'].'">'.$lang->get('managers_of').' '.addslashes($record['title']).'</option>'; |
|
| 106 | 106 | } |
| 107 | 107 | if ( |
| 108 | 108 | (int) $session->get('user-admin') === 1 |
| 109 | 109 | || (((int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) |
| 110 | 110 | && (in_array($record['id'], $userRoles) === true) || (int) $record['creator_id'] === (int) $session->get('user-id')) |
| 111 | 111 | ) { |
| 112 | - $optionsRoles .= '<option value="' . $record['id'] . '">' . addslashes($record['title']) . '</option>'; |
|
| 112 | + $optionsRoles .= '<option value="'.$record['id'].'">'.addslashes($record['title']).'</option>'; |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | for ($y = 1; $y < $t->nlevel; ++$y) { |
| 125 | 125 | $ident .= ' '; |
| 126 | 126 | } |
| 127 | - $foldersList .= '<option value="' . $t->id . '">' . $ident . htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8') . '</option>'; |
|
| 127 | + $foldersList .= '<option value="'.$t->id.'">'.$ident.htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8').'</option>'; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | </button><?php |
| 162 | 162 | echo isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && (int) $session->get('user-admin') === 1 ? |
| 163 | 163 | '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="ldap-sync"> |
| 164 | - <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization') . ' |
|
| 164 | + <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization').' |
|
| 165 | 165 | </button>' : ''; |
| 166 | 166 | ?> |
| 167 | 167 | </button><?php |
| 168 | 168 | echo isset($SETTINGS['oauth2_enabled']) === true && (int) $SETTINGS['oauth2_enabled'] === 1 && (int) $session->get('user-admin') === 1 ? |
| 169 | 169 | '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="oauth2-sync"> |
| 170 | - <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization') . ' |
|
| 170 | + <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization').' |
|
| 171 | 171 | </button>' : ''; |
| 172 | 172 | ?> |
| 173 | 173 | <button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="deleted-users"> |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | <!-- /.card-header --> |
| 179 | 179 | <div class="card-body form user-content with-header-menu" id="users-list" data-content="refresh"> |
| 180 | - <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons');?></span></label> |
|
| 180 | + <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons'); ?></span></label> |
|
| 181 | 181 | <table id="table-users" class="table table-striped nowrap table-responsive-sm"> |
| 182 | 182 | <thead> |
| 183 | 183 | <tr> |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | <?php |
| 242 | 242 | foreach (TP_PW_COMPLEXITY as $entry) { |
| 243 | 243 | echo ' |
| 244 | - <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>'; |
|
| 244 | + <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>'; |
|
| 245 | 245 | } |
| 246 | 246 | ?> |
| 247 | 247 | </select> |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | <?php |
| 319 | 319 | foreach (TP_PW_COMPLEXITY as $entry) { |
| 320 | 320 | echo ' |
| 321 | - <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>'; |
|
| 321 | + <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>'; |
|
| 322 | 322 | } |
| 323 | 323 | ?> |
| 324 | 324 | </select> |
@@ -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 | |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | // |
| 1077 | 1077 | } else if ($(this).data('item-action') === 'link') { |
| 1078 | 1078 | // Add link to clipboard. |
| 1079 | - navigator.clipboard.writeText("<?php echo $SETTINGS['cpassman_url'];?>/index.php?page=items&group="+store.get('teampassItem').folderId+"&id="+store.get('teampassItem').id); |
|
| 1079 | + navigator.clipboard.writeText("<?php echo $SETTINGS['cpassman_url']; ?>/index.php?page=items&group="+store.get('teampassItem').folderId+"&id="+store.get('teampassItem').id); |
|
| 1080 | 1080 | |
| 1081 | 1081 | // Display message. |
| 1082 | 1082 | toastr.remove(); |
@@ -2904,7 +2904,7 @@ discard block |
||
| 2904 | 2904 | progress: "#form-item-password-strength", |
| 2905 | 2905 | score: "#form-item-password-strength" |
| 2906 | 2906 | }, |
| 2907 | - 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;?>], |
|
| 2907 | + 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; ?>], |
|
| 2908 | 2908 | }, |
| 2909 | 2909 | i18n : { |
| 2910 | 2910 | t: function (key) { |
@@ -2931,7 +2931,7 @@ discard block |
||
| 2931 | 2931 | <?php |
| 2932 | 2932 | $max_file_size = ''; |
| 2933 | 2933 | if (strrpos($SETTINGS['upload_maxfilesize'], 'mb') === false) { |
| 2934 | - $max_file_size = $SETTINGS['upload_maxfilesize'] . 'mb'; |
|
| 2934 | + $max_file_size = $SETTINGS['upload_maxfilesize'].'mb'; |
|
| 2935 | 2935 | } else { |
| 2936 | 2936 | $max_file_size = $SETTINGS['upload_maxfilesize']; |
| 2937 | 2937 | } |
@@ -3921,7 +3921,7 @@ discard block |
||
| 3921 | 3921 | function displaySubfolders(folders, parentId) { |
| 3922 | 3922 | // Manage case where no folders |
| 3923 | 3923 | if (folders === '' || folders === undefined) { |
| 3924 | - $('#teampass_subfolders_list').html('<tr><td colspan="2" class="text-center text-muted"><?php echo $lang->get('no_folder_selected');?></td></tr>'); |
|
| 3924 | + $('#teampass_subfolders_list').html('<tr><td colspan="2" class="text-center text-muted"><?php echo $lang->get('no_folder_selected'); ?></td></tr>'); |
|
| 3925 | 3925 | return false; |
| 3926 | 3926 | } |
| 3927 | 3927 | |
@@ -4912,7 +4912,7 @@ discard block |
||
| 4912 | 4912 | (retData.edition_locked_delay === null ? |
| 4913 | 4913 | '' |
| 4914 | 4914 | : |
| 4915 | - ' : ' + retData.edition_locked_delay + ' <?php echo $lang->get('seconds');?>'), |
|
| 4915 | + ' : ' + retData.edition_locked_delay + ' <?php echo $lang->get('seconds'); ?>'), |
|
| 4916 | 4916 | '', { |
| 4917 | 4917 | timeOut: 5000, |
| 4918 | 4918 | progressBar: true |
@@ -5069,7 +5069,7 @@ discard block |
||
| 5069 | 5069 | |
| 5070 | 5070 | // Show passwords inputs and form |
| 5071 | 5071 | $('#dialog-ldap-user-change-password-info') |
| 5072 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>') |
|
| 5072 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>') |
|
| 5073 | 5073 | .removeClass('hidden'); |
| 5074 | 5074 | $('#dialog-ldap-user-change-password').removeClass('hidden'); |
| 5075 | 5075 | } else if (data.error_type !== 'undefined') { |
@@ -5088,7 +5088,7 @@ discard block |
||
| 5088 | 5088 | |
| 5089 | 5089 | // Show passwords inputs and form |
| 5090 | 5090 | $('#dialog-ldap-user-change-password-info') |
| 5091 | - .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>') |
|
| 5091 | + .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>') |
|
| 5092 | 5092 | .removeClass('hidden'); |
| 5093 | 5093 | $('#dialog-ldap-user-change-password').removeClass('hidden'); |
| 5094 | 5094 | }); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ) { |
| 80 | 80 | // Not allowed page |
| 81 | 81 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 82 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 82 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 83 | 83 | exit; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | date_default_timezone_set('UTC'); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
| 107 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
| 108 | 108 | header('Content-type: text/html; charset=utf-8'); |
| 109 | 109 | header('Cache-Control: no-cache, must-revalidate'); |
| 110 | 110 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | // About special settings |
| 367 | 367 | $dataFolderSettings = DB::queryFirstRow( |
| 368 | 368 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
| 369 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 369 | + FROM ' . prefixTable('nested_tree').' |
|
| 370 | 370 | WHERE id = %i', |
| 371 | 371 | $inputData['folderId'] |
| 372 | 372 | ); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | // Get folder complexity |
| 384 | 384 | $folderComplexity = DB::queryFirstRow( |
| 385 | 385 | 'SELECT valeur |
| 386 | - FROM ' . prefixTable('misc') . ' |
|
| 386 | + FROM ' . prefixTable('misc').' |
|
| 387 | 387 | WHERE type = %s AND intitule = %i', |
| 388 | 388 | 'complex', |
| 389 | 389 | $inputData['folderId'] |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | $itemExists = 0; |
| 409 | 409 | $newID = ''; |
| 410 | 410 | $data = DB::queryFirstRow( |
| 411 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 411 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 412 | 412 | WHERE label = %s AND inactif = %i', |
| 413 | 413 | $inputData['label'], |
| 414 | 414 | 0 |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | (int) $post_folder_is_personal, |
| 490 | 490 | (int) $newID, |
| 491 | 491 | $cryptedStuff['objectKey'], |
| 492 | - true, // only for the item creator |
|
| 493 | - false, // no delete all |
|
| 492 | + true, // only for the item creator |
|
| 493 | + false, // no delete all |
|
| 494 | 494 | ); |
| 495 | 495 | |
| 496 | 496 | // update fields |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | // should we encrypt the data |
| 504 | 504 | $dataTmp = DB::queryFirstRow( |
| 505 | 505 | 'SELECT encrypted_data |
| 506 | - FROM ' . prefixTable('categories') . ' |
|
| 506 | + FROM ' . prefixTable('categories').' |
|
| 507 | 507 | WHERE id = %i', |
| 508 | 508 | $field['id'] |
| 509 | 509 | ); |
@@ -532,8 +532,8 @@ discard block |
||
| 532 | 532 | (int) $post_folder_is_personal, |
| 533 | 533 | (int) $newObjectId, |
| 534 | 534 | $cryptedStuff['objectKey'], |
| 535 | - true, // only for the item creator |
|
| 536 | - false, // delete all |
|
| 535 | + true, // only for the item creator |
|
| 536 | + false, // delete all |
|
| 537 | 537 | ); |
| 538 | 538 | |
| 539 | 539 | array_push( |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | ) { |
| 570 | 570 | DB::queryFirstRow( |
| 571 | 571 | 'SELECT * |
| 572 | - FROM ' . prefixTable('templates') . ' |
|
| 572 | + FROM ' . prefixTable('templates').' |
|
| 573 | 573 | WHERE item_id = %i', |
| 574 | 574 | $newID |
| 575 | 575 | ); |
@@ -638,11 +638,11 @@ discard block |
||
| 638 | 638 | ) { |
| 639 | 639 | foreach ($post_restricted_to as $userRest) { |
| 640 | 640 | if (empty($userRest) === false) { |
| 641 | - $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest); |
|
| 641 | + $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest); |
|
| 642 | 642 | if (empty($listOfRestricted)) { |
| 643 | 643 | $listOfRestricted = $dataTmp['login']; |
| 644 | 644 | } else { |
| 645 | - $listOfRestricted .= ';' . $dataTmp['login']; |
|
| 645 | + $listOfRestricted .= ';'.$dataTmp['login']; |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | if (empty($userRest) === false) { |
| 659 | 659 | $dataTmp = DB::queryFirstRow( |
| 660 | 660 | 'SELECT login |
| 661 | - FROM ' . prefixTable('users') . ' |
|
| 661 | + FROM ' . prefixTable('users').' |
|
| 662 | 662 | WHERE id= %i', |
| 663 | 663 | $userRest |
| 664 | 664 | ); |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | if (empty($oldRestrictionList) === true) { |
| 667 | 667 | $oldRestrictionList = $dataTmp['login']; |
| 668 | 668 | } else { |
| 669 | - $oldRestrictionList .= ';' . $dataTmp['login']; |
|
| 669 | + $oldRestrictionList .= ';'.$dataTmp['login']; |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | if (empty($post_uploaded_file_id) === false) { |
| 730 | 730 | $rows = DB::query( |
| 731 | 731 | 'SELECT id |
| 732 | - FROM ' . prefixTable('files') . ' |
|
| 732 | + FROM ' . prefixTable('files').' |
|
| 733 | 733 | WHERE id_item = %s', |
| 734 | 734 | $post_uploaded_file_id |
| 735 | 735 | ); |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | $lang->get('email_subject_item_updated'), |
| 786 | 786 | str_replace( |
| 787 | 787 | array('#label', '#link'), |
| 788 | - array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']), |
|
| 788 | + array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']), |
|
| 789 | 789 | $lang->get('new_item_email_body') |
| 790 | 790 | ), |
| 791 | 791 | $emailAddress, |
@@ -889,11 +889,11 @@ discard block |
||
| 889 | 889 | // Prepare variables |
| 890 | 890 | $itemInfos = array(); |
| 891 | 891 | $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; |
| 892 | - $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : ''; |
|
| 892 | + $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : ''; |
|
| 893 | 893 | $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : ''; |
| 894 | 894 | $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; |
| 895 | - $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : ''; |
|
| 896 | - $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : ''; |
|
| 895 | + $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : ''; |
|
| 896 | + $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : ''; |
|
| 897 | 897 | $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT); |
| 898 | 898 | $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT); |
| 899 | 899 | $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT); |
@@ -924,8 +924,7 @@ discard block |
||
| 924 | 924 | $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var( |
| 925 | 925 | $dataReceived['to_be_deleted_after_date'], |
| 926 | 926 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
| 927 | - ) : |
|
| 928 | - ''; |
|
| 927 | + ) : ''; |
|
| 929 | 928 | $post_fields = (filter_var_array( |
| 930 | 929 | $dataReceived['fields'], |
| 931 | 930 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
@@ -985,7 +984,7 @@ discard block |
||
| 985 | 984 | // About special settings |
| 986 | 985 | $dataFolderSettings = DB::queryFirstRow( |
| 987 | 986 | 'SELECT bloquer_creation, bloquer_modification, personal_folder, title |
| 988 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 987 | + FROM ' . prefixTable('nested_tree').' |
|
| 989 | 988 | WHERE id = %i', |
| 990 | 989 | $inputData['folderId'] |
| 991 | 990 | ); |
@@ -1001,7 +1000,7 @@ discard block |
||
| 1001 | 1000 | // Get folder complexity |
| 1002 | 1001 | $folderComplexity = DB::queryFirstRow( |
| 1003 | 1002 | 'SELECT valeur |
| 1004 | - FROM ' . prefixTable('misc') . ' |
|
| 1003 | + FROM ' . prefixTable('misc').' |
|
| 1005 | 1004 | WHERE type = %s AND intitule = %i', |
| 1006 | 1005 | 'complex', |
| 1007 | 1006 | $inputData['folderId'] |
@@ -1046,8 +1045,8 @@ discard block |
||
| 1046 | 1045 | // Get all informations for this item |
| 1047 | 1046 | $dataItem = DB::queryFirstRow( |
| 1048 | 1047 | 'SELECT * |
| 1049 | - FROM ' . prefixTable('items') . ' as i |
|
| 1050 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1048 | + FROM ' . prefixTable('items').' as i |
|
| 1049 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1051 | 1050 | WHERE i.id=%i AND l.action = %s', |
| 1052 | 1051 | $inputData['itemId'], |
| 1053 | 1052 | 'at_creation' |
@@ -1089,7 +1088,7 @@ discard block |
||
| 1089 | 1088 | // Does the user has the sharekey for this item? |
| 1090 | 1089 | DB::query( |
| 1091 | 1090 | 'SELECT * |
| 1092 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 1091 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 1093 | 1092 | WHERE object_id = %i AND user_id = %s', |
| 1094 | 1093 | $inputData['itemId'], |
| 1095 | 1094 | $session->get('user-id') |
@@ -1150,9 +1149,9 @@ discard block |
||
| 1150 | 1149 | 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, |
| 1151 | 1150 | i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification, |
| 1152 | 1151 | u.login as user_login, u.email as user_email |
| 1153 | - FROM ' . prefixTable('items') . ' as i |
|
| 1154 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item) |
|
| 1155 | - INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user) |
|
| 1152 | + FROM ' . prefixTable('items').' as i |
|
| 1153 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item) |
|
| 1154 | + INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user) |
|
| 1156 | 1155 | WHERE i.id=%i', |
| 1157 | 1156 | $inputData['itemId'] |
| 1158 | 1157 | ); |
@@ -1160,7 +1159,7 @@ discard block |
||
| 1160 | 1159 | // Should we log a password change? |
| 1161 | 1160 | $userKey = DB::queryFirstRow( |
| 1162 | 1161 | 'SELECT share_key |
| 1163 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 1162 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 1164 | 1163 | WHERE user_id = %i AND object_id = %i', |
| 1165 | 1164 | $session->get('user-id'), |
| 1166 | 1165 | $inputData['itemId'] |
@@ -1224,12 +1223,12 @@ discard block |
||
| 1224 | 1223 | (int) $post_folder_is_personal, |
| 1225 | 1224 | (int) $inputData['itemId'], |
| 1226 | 1225 | $encrypted_password_key, |
| 1227 | - true, // only for the item creator |
|
| 1228 | - true, // delete all |
|
| 1226 | + true, // only for the item creator |
|
| 1227 | + true, // delete all |
|
| 1229 | 1228 | ); |
| 1230 | 1229 | |
| 1231 | 1230 | // Create a task to create sharekeys for users |
| 1232 | - if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw); |
|
| 1231 | + if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw); |
|
| 1233 | 1232 | $tasksToBePerformed = ['item_password']; |
| 1234 | 1233 | $encryptionTaskIsRequested = true; |
| 1235 | 1234 | } else { |
@@ -1240,7 +1239,7 @@ discard block |
||
| 1240 | 1239 | // Get list of tags |
| 1241 | 1240 | $itemTags = DB::queryFirstColumn( |
| 1242 | 1241 | 'SELECT tag |
| 1243 | - FROM ' . prefixTable('tags') . ' |
|
| 1242 | + FROM ' . prefixTable('tags').' |
|
| 1244 | 1243 | WHERE item_id = %i', |
| 1245 | 1244 | $inputData['itemId'] |
| 1246 | 1245 | ); |
@@ -1286,7 +1285,7 @@ discard block |
||
| 1286 | 1285 | $session->get('user-id'), |
| 1287 | 1286 | 'at_modification', |
| 1288 | 1287 | $session->get('user-login'), |
| 1289 | - 'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags |
|
| 1288 | + 'at_tag : '.implode(' ', $itemTags).' => '.$post_tags |
|
| 1290 | 1289 | ); |
| 1291 | 1290 | } |
| 1292 | 1291 | |
@@ -1331,8 +1330,8 @@ discard block |
||
| 1331 | 1330 | 'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv, |
| 1332 | 1331 | i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, |
| 1333 | 1332 | c.masked AS masked, i.id AS field_item_id |
| 1334 | - FROM ' . prefixTable('categories_items') . ' AS i |
|
| 1335 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id) |
|
| 1333 | + FROM ' . prefixTable('categories_items').' AS i |
|
| 1334 | + INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id) |
|
| 1336 | 1335 | WHERE i.field_id = %i AND i.item_id = %i', |
| 1337 | 1336 | $field['id'], |
| 1338 | 1337 | $inputData['itemId'] |
@@ -1348,7 +1347,7 @@ discard block |
||
| 1348 | 1347 | // Perform new query |
| 1349 | 1348 | $dataTmpCat = DB::queryFirstRow( |
| 1350 | 1349 | 'SELECT id, title, encrypted_data, masked |
| 1351 | - FROM ' . prefixTable('categories') . ' |
|
| 1350 | + FROM ' . prefixTable('categories').' |
|
| 1352 | 1351 | WHERE id = %i', |
| 1353 | 1352 | $field['id'] |
| 1354 | 1353 | ); |
@@ -1378,8 +1377,8 @@ discard block |
||
| 1378 | 1377 | (int) $post_folder_is_personal, |
| 1379 | 1378 | (int) $newId, |
| 1380 | 1379 | $cryptedStuff['objectKey'], |
| 1381 | - true, // only for the item creator |
|
| 1382 | - true, // delete all |
|
| 1380 | + true, // only for the item creator |
|
| 1381 | + true, // delete all |
|
| 1383 | 1382 | ); |
| 1384 | 1383 | |
| 1385 | 1384 | // update value |
@@ -1429,7 +1428,7 @@ discard block |
||
| 1429 | 1428 | $session->get('user-id'), |
| 1430 | 1429 | 'at_modification', |
| 1431 | 1430 | $session->get('user-login'), |
| 1432 | - 'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value'] |
|
| 1431 | + 'at_field : '.$dataTmpCat['title'].' : '.$field['value'] |
|
| 1433 | 1432 | ); |
| 1434 | 1433 | } else { |
| 1435 | 1434 | // Case where the field already exists |
@@ -1438,7 +1437,7 @@ discard block |
||
| 1438 | 1437 | // Get user sharekey for this field |
| 1439 | 1438 | $userKey = DB::queryFirstRow( |
| 1440 | 1439 | 'SELECT share_key |
| 1441 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 1440 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 1442 | 1441 | WHERE user_id = %i AND object_id = %i', |
| 1443 | 1442 | $session->get('user-id'), |
| 1444 | 1443 | $dataTmpCat['field_item_id'] |
@@ -1477,8 +1476,8 @@ discard block |
||
| 1477 | 1476 | (int) $post_folder_is_personal, |
| 1478 | 1477 | (int) $dataTmpCat['field_item_id'], |
| 1479 | 1478 | $cryptedStuff['objectKey'], |
| 1480 | - true, // only for the item creator |
|
| 1481 | - true, // delete all |
|
| 1479 | + true, // only for the item creator |
|
| 1480 | + true, // delete all |
|
| 1482 | 1481 | ); |
| 1483 | 1482 | |
| 1484 | 1483 | if ($encryptedFieldIsChanged === false) { |
@@ -1520,7 +1519,7 @@ discard block |
||
| 1520 | 1519 | $session->get('user-id'), |
| 1521 | 1520 | 'at_modification', |
| 1522 | 1521 | $session->get('user-login'), |
| 1523 | - 'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal |
|
| 1522 | + 'at_field : '.$dataTmpCat['title'].' => '.$oldVal |
|
| 1524 | 1523 | ); |
| 1525 | 1524 | } |
| 1526 | 1525 | } |
@@ -1574,7 +1573,7 @@ discard block |
||
| 1574 | 1573 | ) { |
| 1575 | 1574 | DB::queryFirstRow( |
| 1576 | 1575 | 'SELECT * |
| 1577 | - FROM ' . prefixTable('templates') . ' |
|
| 1576 | + FROM ' . prefixTable('templates').' |
|
| 1578 | 1577 | WHERE item_id = %i', |
| 1579 | 1578 | $inputData['itemId'] |
| 1580 | 1579 | ); |
@@ -1617,7 +1616,7 @@ discard block |
||
| 1617 | 1616 | // check if elem exists in Table. If not add it or update it. |
| 1618 | 1617 | DB::query( |
| 1619 | 1618 | 'SELECT * |
| 1620 | - FROM ' . prefixTable('automatic_del') . ' |
|
| 1619 | + FROM ' . prefixTable('automatic_del').' |
|
| 1621 | 1620 | WHERE item_id = %i', |
| 1622 | 1621 | $inputData['itemId'] |
| 1623 | 1622 | ); |
@@ -1644,7 +1643,7 @@ discard block |
||
| 1644 | 1643 | // Store updates performed |
| 1645 | 1644 | array_push( |
| 1646 | 1645 | $arrayOfChanges, |
| 1647 | - $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled') |
|
| 1646 | + $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled') |
|
| 1648 | 1647 | ); |
| 1649 | 1648 | |
| 1650 | 1649 | // update LOG |
@@ -1687,7 +1686,7 @@ discard block |
||
| 1687 | 1686 | // Store updates performed |
| 1688 | 1687 | array_push( |
| 1689 | 1688 | $arrayOfChanges, |
| 1690 | - $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled') |
|
| 1689 | + $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled') |
|
| 1691 | 1690 | ); |
| 1692 | 1691 | |
| 1693 | 1692 | // update LOG |
@@ -1715,7 +1714,7 @@ discard block |
||
| 1715 | 1714 | if (empty($userId) === false) { |
| 1716 | 1715 | $dataTmp = DB::queryFirstRow( |
| 1717 | 1716 | 'SELECT id, name, lastname |
| 1718 | - FROM ' . prefixTable('users') . ' |
|
| 1717 | + FROM ' . prefixTable('users').' |
|
| 1719 | 1718 | WHERE id= %i', |
| 1720 | 1719 | $userId |
| 1721 | 1720 | ); |
@@ -1723,7 +1722,7 @@ discard block |
||
| 1723 | 1722 | // Add to array |
| 1724 | 1723 | array_push( |
| 1725 | 1724 | $arrayOfUsersRestriction, |
| 1726 | - $dataTmp['name'] . ' ' . $dataTmp['lastname'] |
|
| 1725 | + $dataTmp['name'].' '.$dataTmp['lastname'] |
|
| 1727 | 1726 | ); |
| 1728 | 1727 | array_push( |
| 1729 | 1728 | $arrayOfUsersIdRestriction, |
@@ -1754,8 +1753,8 @@ discard block |
||
| 1754 | 1753 | // get values before deleting them |
| 1755 | 1754 | $rows = DB::query( |
| 1756 | 1755 | 'SELECT t.title, t.id AS id |
| 1757 | - FROM ' . prefixTable('roles_title') . ' as t |
|
| 1758 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id) |
|
| 1756 | + FROM ' . prefixTable('roles_title').' as t |
|
| 1757 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id) |
|
| 1759 | 1758 | WHERE r.item_id = %i |
| 1760 | 1759 | ORDER BY t.title ASC', |
| 1761 | 1760 | $inputData['itemId'] |
@@ -1789,7 +1788,7 @@ discard block |
||
| 1789 | 1788 | ); |
| 1790 | 1789 | $dataTmp = DB::queryFirstRow( |
| 1791 | 1790 | 'SELECT title |
| 1792 | - FROM ' . prefixTable('roles_title') . ' |
|
| 1791 | + FROM ' . prefixTable('roles_title').' |
|
| 1793 | 1792 | WHERE id = %i', |
| 1794 | 1793 | $role |
| 1795 | 1794 | ); |
@@ -1817,7 +1816,7 @@ discard block |
||
| 1817 | 1816 | // Get current status |
| 1818 | 1817 | $otpStatus = DB::queryFirstRow( |
| 1819 | 1818 | 'SELECT enabled as otp_is_enabled, phone_number, secret |
| 1820 | - FROM ' . prefixTable('items_otp') . ' |
|
| 1819 | + FROM ' . prefixTable('items_otp').' |
|
| 1821 | 1820 | WHERE item_id = %i', |
| 1822 | 1821 | $inputData['itemId'] |
| 1823 | 1822 | ); |
@@ -1831,7 +1830,7 @@ discard block |
||
| 1831 | 1830 | 'decrypt' |
| 1832 | 1831 | )['string']; |
| 1833 | 1832 | } else { |
| 1834 | - $currentsecret=''; |
|
| 1833 | + $currentsecret = ''; |
|
| 1835 | 1834 | } |
| 1836 | 1835 | |
| 1837 | 1836 | // If OTP secret provided then encrypt it |
@@ -1881,7 +1880,7 @@ discard block |
||
| 1881 | 1880 | $session->get('user-id'), |
| 1882 | 1881 | 'at_modification', |
| 1883 | 1882 | $session->get('user-login'), |
| 1884 | - 'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled') |
|
| 1883 | + 'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled') |
|
| 1885 | 1884 | ); |
| 1886 | 1885 | } |
| 1887 | 1886 | if ($otpStatus['phone_number'] !== $post_otp_phone_number) { |
@@ -1892,7 +1891,7 @@ discard block |
||
| 1892 | 1891 | $session->get('user-id'), |
| 1893 | 1892 | 'at_modification', |
| 1894 | 1893 | $session->get('user-login'), |
| 1895 | - 'at_phone_number:' . $otpStatus['phone_number'] . ' => ' . $post_otp_phone_number |
|
| 1894 | + 'at_phone_number:'.$otpStatus['phone_number'].' => '.$post_otp_phone_number |
|
| 1896 | 1895 | ); |
| 1897 | 1896 | } |
| 1898 | 1897 | if ($currentsecret !== $post_otp_secret) { |
@@ -1941,8 +1940,8 @@ discard block |
||
| 1941 | 1940 | $session->get('user-id'), |
| 1942 | 1941 | 'at_modification', |
| 1943 | 1942 | $session->get('user-login'), |
| 1944 | - 'at_restriction : ' . (count($diffUsersRestiction) > 0 ? |
|
| 1945 | - implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '') |
|
| 1943 | + 'at_restriction : '.(count($diffUsersRestiction) > 0 ? |
|
| 1944 | + implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '') |
|
| 1946 | 1945 | ); |
| 1947 | 1946 | } |
| 1948 | 1947 | |
@@ -1962,7 +1961,7 @@ discard block |
||
| 1962 | 1961 | $session->get('user-id'), |
| 1963 | 1962 | 'at_modification', |
| 1964 | 1963 | $session->get('user-login'), |
| 1965 | - 'at_label : ' . $data['label'] . ' => ' . $inputData['label'] |
|
| 1964 | + 'at_label : '.$data['label'].' => '.$inputData['label'] |
|
| 1966 | 1965 | ); |
| 1967 | 1966 | } |
| 1968 | 1967 | // LOGIN |
@@ -1981,7 +1980,7 @@ discard block |
||
| 1981 | 1980 | $session->get('user-id'), |
| 1982 | 1981 | 'at_modification', |
| 1983 | 1982 | $session->get('user-login'), |
| 1984 | - 'at_login : ' . $data['login'] . ' => ' . $post_login |
|
| 1983 | + 'at_login : '.$data['login'].' => '.$post_login |
|
| 1985 | 1984 | ); |
| 1986 | 1985 | } |
| 1987 | 1986 | |
@@ -2000,7 +1999,7 @@ discard block |
||
| 2000 | 1999 | $session->get('user-id'), |
| 2001 | 2000 | 'at_modification', |
| 2002 | 2001 | $session->get('user-login'), |
| 2003 | - 'at_email : ' . $data['email'] . ' => ' . $post_email |
|
| 2002 | + 'at_email : '.$data['email'].' => '.$post_email |
|
| 2004 | 2003 | ); |
| 2005 | 2004 | } |
| 2006 | 2005 | // URL |
@@ -2019,7 +2018,7 @@ discard block |
||
| 2019 | 2018 | $session->get('user-id'), |
| 2020 | 2019 | 'at_modification', |
| 2021 | 2020 | $session->get('user-login'), |
| 2022 | - 'at_url : ' . $data['url'] . ' => ' . $post_url |
|
| 2021 | + 'at_url : '.$data['url'].' => '.$post_url |
|
| 2023 | 2022 | ); |
| 2024 | 2023 | } |
| 2025 | 2024 | // DESCRIPTION |
@@ -2045,7 +2044,7 @@ discard block |
||
| 2045 | 2044 | // FOLDER |
| 2046 | 2045 | if ((int) $data['id_tree'] !== (int) $inputData['folderId']) { |
| 2047 | 2046 | // Get name of folders |
| 2048 | - $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId'])); |
|
| 2047 | + $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId'])); |
|
| 2049 | 2048 | |
| 2050 | 2049 | // Store updates performed |
| 2051 | 2050 | array_push( |
@@ -2061,7 +2060,7 @@ discard block |
||
| 2061 | 2060 | $session->get('user-id'), |
| 2062 | 2061 | 'at_modification', |
| 2063 | 2062 | $session->get('user-login'), |
| 2064 | - 'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title'] |
|
| 2063 | + 'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title'] |
|
| 2065 | 2064 | ); |
| 2066 | 2065 | } |
| 2067 | 2066 | // ANYONE_CAN_MODIFY |
@@ -2069,7 +2068,7 @@ discard block |
||
| 2069 | 2068 | // Store updates performed |
| 2070 | 2069 | array_push( |
| 2071 | 2070 | $arrayOfChanges, |
| 2072 | - $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled')) |
|
| 2071 | + $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled')) |
|
| 2073 | 2072 | ); |
| 2074 | 2073 | |
| 2075 | 2074 | // Log |
@@ -2080,15 +2079,15 @@ discard block |
||
| 2080 | 2079 | $session->get('user-id'), |
| 2081 | 2080 | 'at_modification', |
| 2082 | 2081 | $session->get('user-login'), |
| 2083 | - 'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled') |
|
| 2082 | + 'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled') |
|
| 2084 | 2083 | ); |
| 2085 | 2084 | } |
| 2086 | 2085 | |
| 2087 | 2086 | // Reload new values |
| 2088 | 2087 | $dataItem = DB::queryFirstRow( |
| 2089 | 2088 | 'SELECT * |
| 2090 | - FROM ' . prefixTable('items') . ' as i |
|
| 2091 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 2089 | + FROM ' . prefixTable('items').' as i |
|
| 2090 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 2092 | 2091 | WHERE i.id = %i AND l.action = %s', |
| 2093 | 2092 | $inputData['itemId'], |
| 2094 | 2093 | 'at_creation' |
@@ -2097,8 +2096,8 @@ discard block |
||
| 2097 | 2096 | $history = ''; |
| 2098 | 2097 | $rows = DB::query( |
| 2099 | 2098 | 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login |
| 2100 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 2101 | - LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 2099 | + FROM ' . prefixTable('log_items').' as l |
|
| 2100 | + LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 2102 | 2101 | WHERE l.action <> %s AND id_item=%s', |
| 2103 | 2102 | 'at_shown', |
| 2104 | 2103 | $inputData['itemId'] |
@@ -2107,14 +2106,14 @@ discard block |
||
| 2107 | 2106 | if ($record['raison'] === NULL) continue; |
| 2108 | 2107 | $reason = explode(':', $record['raison']); |
| 2109 | 2108 | if (count($reason) > 0) { |
| 2110 | - $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' |
|
| 2111 | - . $record['login'] . ' - ' . $lang->get($record['action']) . ' - ' |
|
| 2112 | - . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1] |
|
| 2109 | + $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - ' |
|
| 2110 | + . $record['login'].' - '.$lang->get($record['action']).' - ' |
|
| 2111 | + . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1] |
|
| 2113 | 2112 | : $lang->get(trim($reason[0]))) : ''); |
| 2114 | 2113 | if (empty($history)) { |
| 2115 | 2114 | $history = $sentence; |
| 2116 | 2115 | } else { |
| 2117 | - $history .= '<br />' . $sentence; |
|
| 2116 | + $history .= '<br />'.$sentence; |
|
| 2118 | 2117 | } |
| 2119 | 2118 | } |
| 2120 | 2119 | } |
@@ -2252,7 +2251,7 @@ discard block |
||
| 2252 | 2251 | ) { |
| 2253 | 2252 | // load the original record into an array |
| 2254 | 2253 | $originalRecord = DB::queryFirstRow( |
| 2255 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 2254 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 2256 | 2255 | WHERE id = %i', |
| 2257 | 2256 | $inputData['itemId'] |
| 2258 | 2257 | ); |
@@ -2271,7 +2270,7 @@ discard block |
||
| 2271 | 2270 | |
| 2272 | 2271 | // Load the destination folder record into an array |
| 2273 | 2272 | $dataDestination = DB::queryFirstRow( |
| 2274 | - 'SELECT personal_folder FROM ' . prefixTable('nested_tree') . ' |
|
| 2273 | + 'SELECT personal_folder FROM '.prefixTable('nested_tree').' |
|
| 2275 | 2274 | WHERE id = %i', |
| 2276 | 2275 | $post_dest_id |
| 2277 | 2276 | ); |
@@ -2279,7 +2278,7 @@ discard block |
||
| 2279 | 2278 | // Get the ITEM object key for the user |
| 2280 | 2279 | $userKey = DB::queryFirstRow( |
| 2281 | 2280 | 'SELECT share_key |
| 2282 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2281 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2283 | 2282 | WHERE user_id = %i AND object_id = %i', |
| 2284 | 2283 | $session->get('user-id'), |
| 2285 | 2284 | $inputData['itemId'] |
@@ -2356,8 +2355,8 @@ discard block |
||
| 2356 | 2355 | // Manage Custom Fields |
| 2357 | 2356 | $rows = DB::query( |
| 2358 | 2357 | 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data |
| 2359 | - FROM ' . prefixTable('categories_items') . ' AS ci |
|
| 2360 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id) |
|
| 2358 | + FROM ' . prefixTable('categories_items').' AS ci |
|
| 2359 | + INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id) |
|
| 2361 | 2360 | WHERE ci.item_id = %i', |
| 2362 | 2361 | $inputData['itemId'] |
| 2363 | 2362 | ); |
@@ -2369,7 +2368,7 @@ discard block |
||
| 2369 | 2368 | // Get user key |
| 2370 | 2369 | $userKey = DB::queryFirstRow( |
| 2371 | 2370 | 'SELECT share_key |
| 2372 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 2371 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 2373 | 2372 | WHERE user_id = %i AND object_id = %i', |
| 2374 | 2373 | $session->get('user-id'), |
| 2375 | 2374 | $field['id'] |
@@ -2436,15 +2435,15 @@ discard block |
||
| 2436 | 2435 | $rows = DB::query( |
| 2437 | 2436 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension, |
| 2438 | 2437 | f.size AS size, f.type AS type, s.share_key AS share_key |
| 2439 | - FROM ' . prefixTable('files') . ' AS f |
|
| 2440 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
| 2438 | + FROM ' . prefixTable('files').' AS f |
|
| 2439 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
| 2441 | 2440 | WHERE s.user_id = %i AND f.id_item = %i', |
| 2442 | 2441 | $session->get('user-id'), |
| 2443 | 2442 | $inputData['itemId'] |
| 2444 | 2443 | ); |
| 2445 | 2444 | foreach ($rows as $record) { |
| 2446 | 2445 | // Check if file still exists |
| 2447 | - if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) { |
|
| 2446 | + if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) { |
|
| 2448 | 2447 | // Step1 - decrypt the file |
| 2449 | 2448 | // deepcode ignore PT: path is sanitized inside decryptFile() |
| 2450 | 2449 | $fileContent = decryptFile( |
@@ -2455,8 +2454,8 @@ discard block |
||
| 2455 | 2454 | |
| 2456 | 2455 | // Step2 - create file |
| 2457 | 2456 | // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database |
| 2458 | - $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension']; |
|
| 2459 | - $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab'); |
|
| 2457 | + $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension']; |
|
| 2458 | + $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab'); |
|
| 2460 | 2459 | if ($outstream === false) { |
| 2461 | 2460 | echo prepareExchangedData( |
| 2462 | 2461 | array( |
@@ -2529,7 +2528,7 @@ discard block |
||
| 2529 | 2528 | |
| 2530 | 2529 | // ------------------------- |
| 2531 | 2530 | // Add specific restrictions |
| 2532 | - $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']); |
|
| 2531 | + $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']); |
|
| 2533 | 2532 | foreach ($rows as $record) { |
| 2534 | 2533 | DB::insert( |
| 2535 | 2534 | prefixTable('restriction_to_roles'), |
@@ -2541,7 +2540,7 @@ discard block |
||
| 2541 | 2540 | } |
| 2542 | 2541 | |
| 2543 | 2542 | // Add Tags |
| 2544 | - $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']); |
|
| 2543 | + $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']); |
|
| 2545 | 2544 | foreach ($rows as $record) { |
| 2546 | 2545 | DB::insert( |
| 2547 | 2546 | prefixTable('tags'), |
@@ -2643,7 +2642,7 @@ discard block |
||
| 2643 | 2642 | // then we can show it |
| 2644 | 2643 | $item_deleted = DB::queryFirstRow( |
| 2645 | 2644 | 'SELECT * |
| 2646 | - FROM ' . prefixTable('log_items') . ' |
|
| 2645 | + FROM ' . prefixTable('log_items').' |
|
| 2647 | 2646 | WHERE id_item = %i AND action = %s |
| 2648 | 2647 | ORDER BY date DESC |
| 2649 | 2648 | LIMIT 0, 1', |
@@ -2654,7 +2653,7 @@ discard block |
||
| 2654 | 2653 | |
| 2655 | 2654 | $item_restored = DB::queryFirstRow( |
| 2656 | 2655 | 'SELECT * |
| 2657 | - FROM ' . prefixTable('log_items') . ' |
|
| 2656 | + FROM ' . prefixTable('log_items').' |
|
| 2658 | 2657 | WHERE id_item = %i AND action = %s |
| 2659 | 2658 | ORDER BY date DESC |
| 2660 | 2659 | LIMIT 0, 1', |
@@ -2678,8 +2677,8 @@ discard block |
||
| 2678 | 2677 | // Get all informations for this item |
| 2679 | 2678 | $dataItem = DB::queryFirstRow( |
| 2680 | 2679 | 'SELECT * |
| 2681 | - FROM ' . prefixTable('items') . ' as i |
|
| 2682 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 2680 | + FROM ' . prefixTable('items').' as i |
|
| 2681 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 2683 | 2682 | WHERE i.id = %i AND l.action = %s', |
| 2684 | 2683 | $inputData['id'], |
| 2685 | 2684 | 'at_creation' |
@@ -2688,7 +2687,7 @@ discard block |
||
| 2688 | 2687 | // Notification |
| 2689 | 2688 | DB::queryFirstRow( |
| 2690 | 2689 | 'SELECT * |
| 2691 | - FROM ' . prefixTable('notification') . ' |
|
| 2690 | + FROM ' . prefixTable('notification').' |
|
| 2692 | 2691 | WHERE item_id = %i AND user_id = %i', |
| 2693 | 2692 | $inputData['id'], |
| 2694 | 2693 | $session->get('user-id') |
@@ -2707,7 +2706,7 @@ discard block |
||
| 2707 | 2706 | |
| 2708 | 2707 | // manage case of API user |
| 2709 | 2708 | if ($dataItem['id_user'] === API_USER_ID) { |
| 2710 | - $arrData['author'] = 'API [' . $dataItem['description'] . ']'; |
|
| 2709 | + $arrData['author'] = 'API ['.$dataItem['description'].']'; |
|
| 2711 | 2710 | $arrData['id_user'] = API_USER_ID; |
| 2712 | 2711 | $arrData['author_email'] = ''; |
| 2713 | 2712 | $arrData['notification_status'] = false; |
@@ -2717,7 +2716,7 @@ discard block |
||
| 2717 | 2716 | $tags = array(); |
| 2718 | 2717 | $rows = DB::query( |
| 2719 | 2718 | 'SELECT tag |
| 2720 | - FROM ' . prefixTable('tags') . ' |
|
| 2719 | + FROM ' . prefixTable('tags').' |
|
| 2721 | 2720 | WHERE item_id = %i', |
| 2722 | 2721 | $inputData['id'] |
| 2723 | 2722 | ); |
@@ -2741,7 +2740,7 @@ discard block |
||
| 2741 | 2740 | // Check if user has a role that is accepted |
| 2742 | 2741 | $rows_tmp = DB::query( |
| 2743 | 2742 | 'SELECT role_id |
| 2744 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 2743 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 2745 | 2744 | WHERE item_id=%i', |
| 2746 | 2745 | $inputData['id'] |
| 2747 | 2746 | ); |
@@ -2755,7 +2754,7 @@ discard block |
||
| 2755 | 2754 | // Get the object key for the user |
| 2756 | 2755 | $userKeys = DB::query( |
| 2757 | 2756 | 'SELECT share_key |
| 2758 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2757 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2759 | 2758 | WHERE user_id = %i AND object_id = %i', |
| 2760 | 2759 | $session->get('user-id'), |
| 2761 | 2760 | $inputData['id'] |
@@ -2868,8 +2867,8 @@ discard block |
||
| 2868 | 2867 | // Add restriction if item is restricted to roles |
| 2869 | 2868 | $rows = DB::query( |
| 2870 | 2869 | 'SELECT t.title, t.id |
| 2871 | - FROM ' . prefixTable('roles_title') . ' AS t |
|
| 2872 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id) |
|
| 2870 | + FROM ' . prefixTable('roles_title').' AS t |
|
| 2871 | + INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id) |
|
| 2873 | 2872 | WHERE r.item_id = %i |
| 2874 | 2873 | ORDER BY t.title ASC', |
| 2875 | 2874 | $inputData['id'] |
@@ -2885,8 +2884,8 @@ discard block |
||
| 2885 | 2884 | $tmp = array(); |
| 2886 | 2885 | $rows = DB::query( |
| 2887 | 2886 | 'SELECT k.label, k.id |
| 2888 | - FROM ' . prefixTable('kb_items') . ' as i |
|
| 2889 | - INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id) |
|
| 2887 | + FROM ' . prefixTable('kb_items').' as i |
|
| 2888 | + INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id) |
|
| 2890 | 2889 | WHERE i.item_id = %i |
| 2891 | 2890 | ORDER BY k.label ASC', |
| 2892 | 2891 | $inputData['id'] |
@@ -2969,7 +2968,7 @@ discard block |
||
| 2969 | 2968 | $arrCatList = array(); |
| 2970 | 2969 | $rows_tmp = DB::query( |
| 2971 | 2970 | 'SELECT id_category |
| 2972 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2971 | + FROM ' . prefixTable('categories_folders').' |
|
| 2973 | 2972 | WHERE id_folder=%i', |
| 2974 | 2973 | $inputData['folderId'] |
| 2975 | 2974 | ); |
@@ -2984,8 +2983,8 @@ discard block |
||
| 2984 | 2983 | 'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id, |
| 2985 | 2984 | i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id, |
| 2986 | 2985 | c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility |
| 2987 | - FROM ' . prefixTable('categories_items') . ' AS i |
|
| 2988 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id) |
|
| 2986 | + FROM ' . prefixTable('categories_items').' AS i |
|
| 2987 | + INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id) |
|
| 2989 | 2988 | WHERE i.item_id=%i AND c.parent_id IN %ls', |
| 2990 | 2989 | $inputData['id'], |
| 2991 | 2990 | $arrCatList |
@@ -2996,7 +2995,7 @@ discard block |
||
| 2996 | 2995 | //db::debugmode(true); |
| 2997 | 2996 | $userKey = DB::queryFirstRow( |
| 2998 | 2997 | 'SELECT share_key |
| 2999 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 2998 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 3000 | 2999 | WHERE user_id = %i AND object_id = %i', |
| 3001 | 3000 | $session->get('user-id'), |
| 3002 | 3001 | $row['id'] |
@@ -3014,7 +3013,7 @@ discard block |
||
| 3014 | 3013 | } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) { |
| 3015 | 3014 | // Data is not encrypted in DB |
| 3016 | 3015 | $fieldText = [ |
| 3017 | - 'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : |
|
| 3016 | + 'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : |
|
| 3018 | 3017 | 'encrypted' => false, |
| 3019 | 3018 | 'error' => false, |
| 3020 | 3019 | ]; |
@@ -3059,7 +3058,7 @@ discard block |
||
| 3059 | 3058 | if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) { |
| 3060 | 3059 | $rows_tmp = DB::queryFirstRow( |
| 3061 | 3060 | 'SELECT category_id |
| 3062 | - FROM ' . prefixTable('templates') . ' |
|
| 3061 | + FROM ' . prefixTable('templates').' |
|
| 3063 | 3062 | WHERE item_id = %i', |
| 3064 | 3063 | $inputData['id'] |
| 3065 | 3064 | ); |
@@ -3076,7 +3075,7 @@ discard block |
||
| 3076 | 3075 | // Evaluate if item is ready for all users |
| 3077 | 3076 | $rows_tmp = DB::queryFirstRow( |
| 3078 | 3077 | 'SELECT finished_at |
| 3079 | - FROM ' . prefixTable('background_tasks') . ' |
|
| 3078 | + FROM ' . prefixTable('background_tasks').' |
|
| 3080 | 3079 | WHERE item_id = %i', |
| 3081 | 3080 | $inputData['id'] |
| 3082 | 3081 | ); |
@@ -3093,7 +3092,7 @@ discard block |
||
| 3093 | 3092 | // Is the Item to be deleted? |
| 3094 | 3093 | $dataDelete = DB::queryFirstRow( |
| 3095 | 3094 | 'SELECT * |
| 3096 | - FROM ' . prefixTable('automatic_del') . ' |
|
| 3095 | + FROM ' . prefixTable('automatic_del').' |
|
| 3097 | 3096 | WHERE item_id = %i', |
| 3098 | 3097 | $inputData['id'] |
| 3099 | 3098 | ); |
@@ -3174,14 +3173,14 @@ discard block |
||
| 3174 | 3173 | if (empty($userRest) === false) { |
| 3175 | 3174 | $dataTmp = DB::queryFirstRow( |
| 3176 | 3175 | 'SELECT login |
| 3177 | - FROM ' . prefixTable('users') . ' |
|
| 3176 | + FROM ' . prefixTable('users').' |
|
| 3178 | 3177 | WHERE id= %i', |
| 3179 | 3178 | $userRest |
| 3180 | 3179 | ); |
| 3181 | 3180 | if (empty($listOfRestricted)) { |
| 3182 | 3181 | $listOfRestricted = $dataTmp['login']; |
| 3183 | 3182 | } else { |
| 3184 | - $listOfRestricted .= ';' . $dataTmp['login']; |
|
| 3183 | + $listOfRestricted .= ';'.$dataTmp['login']; |
|
| 3185 | 3184 | } |
| 3186 | 3185 | } |
| 3187 | 3186 | } |
@@ -3255,9 +3254,9 @@ discard block |
||
| 3255 | 3254 | // Load item data |
| 3256 | 3255 | $dataItem = DB::queryFirstRow( |
| 3257 | 3256 | 'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret |
| 3258 | - FROM ' . prefixTable('items') . ' AS i |
|
| 3259 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
| 3260 | - LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id) |
|
| 3257 | + FROM ' . prefixTable('items').' AS i |
|
| 3258 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
| 3259 | + LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id) |
|
| 3261 | 3260 | WHERE i.id = %i', |
| 3262 | 3261 | $inputData['id'] |
| 3263 | 3262 | ); |
@@ -3279,7 +3278,7 @@ discard block |
||
| 3279 | 3278 | // Check if user has a role that is accepted |
| 3280 | 3279 | $rows_tmp = DB::query( |
| 3281 | 3280 | 'SELECT role_id |
| 3282 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 3281 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 3283 | 3282 | WHERE item_id=%i', |
| 3284 | 3283 | $inputData['id'] |
| 3285 | 3284 | ); |
@@ -3311,12 +3310,12 @@ discard block |
||
| 3311 | 3310 | // launch query |
| 3312 | 3311 | $rows = DB::query( |
| 3313 | 3312 | 'SELECT id, name, file, extension, size |
| 3314 | - FROM ' . prefixTable('files') . ' |
|
| 3313 | + FROM ' . prefixTable('files').' |
|
| 3315 | 3314 | WHERE id_item = %i AND confirmed = 1', |
| 3316 | 3315 | $inputData['id'] |
| 3317 | 3316 | ); |
| 3318 | 3317 | foreach ($rows as $record) { |
| 3319 | - $filename = basename($record['name'], '.' . $record['extension']); |
|
| 3318 | + $filename = basename($record['name'], '.'.$record['extension']); |
|
| 3320 | 3319 | $filename = isBase64($filename) === true ? base64_decode($filename) : $filename; |
| 3321 | 3320 | |
| 3322 | 3321 | array_push( |
@@ -3329,7 +3328,7 @@ discard block |
||
| 3329 | 3328 | 'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0, |
| 3330 | 3329 | 'id' => $record['id'], |
| 3331 | 3330 | 'key' => $session->get('user-key_tmp'), |
| 3332 | - 'internalFilename' => basename($record['name'], '.' . $record['extension']), |
|
| 3331 | + 'internalFilename' => basename($record['name'], '.'.$record['extension']), |
|
| 3333 | 3332 | ) |
| 3334 | 3333 | ); |
| 3335 | 3334 | } |
@@ -3367,7 +3366,7 @@ discard block |
||
| 3367 | 3366 | array( |
| 3368 | 3367 | 'latest_items' => implode(';', $session->get('user-latest_items')), |
| 3369 | 3368 | ), |
| 3370 | - 'id=' . $session->get('user-id') |
|
| 3369 | + 'id='.$session->get('user-id') |
|
| 3371 | 3370 | ); |
| 3372 | 3371 | } |
| 3373 | 3372 | |
@@ -3376,8 +3375,8 @@ discard block |
||
| 3376 | 3375 | $listOptionsForRoles = array(); |
| 3377 | 3376 | $rows = DB::query( |
| 3378 | 3377 | 'SELECT r.role_id AS role_id, t.title AS title |
| 3379 | - FROM ' . prefixTable('roles_values') . ' AS r |
|
| 3380 | - INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id) |
|
| 3378 | + FROM ' . prefixTable('roles_values').' AS r |
|
| 3379 | + INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id) |
|
| 3381 | 3380 | WHERE r.folder_id = %i', |
| 3382 | 3381 | $dataItem['id_tree'] |
| 3383 | 3382 | ); |
@@ -3391,9 +3390,9 @@ discard block |
||
| 3391 | 3390 | ); |
| 3392 | 3391 | $rows2 = DB::query( |
| 3393 | 3392 | 'SELECT id, login, fonction_id, email, name, lastname |
| 3394 | - FROM ' . prefixTable('users') . ' |
|
| 3393 | + FROM ' . prefixTable('users').' |
|
| 3395 | 3394 | WHERE fonction_id LIKE %s', |
| 3396 | - '%' . $record['role_id'] . '%' |
|
| 3395 | + '%'.$record['role_id'].'%' |
|
| 3397 | 3396 | ); |
| 3398 | 3397 | foreach ($rows2 as $record2) { |
| 3399 | 3398 | foreach (explode(';', $record2['fonction_id']) as $role) { |
@@ -3406,7 +3405,7 @@ discard block |
||
| 3406 | 3405 | array( |
| 3407 | 3406 | 'id' => (int) $record2['id'], |
| 3408 | 3407 | 'login' => $record2['login'], |
| 3409 | - 'name' => $record2['name'] . ' ' . $record2['lastname'], |
|
| 3408 | + 'name' => $record2['name'].' '.$record2['lastname'], |
|
| 3410 | 3409 | 'email' => $record2['email'], |
| 3411 | 3410 | ) |
| 3412 | 3411 | ); |
@@ -3425,16 +3424,16 @@ discard block |
||
| 3425 | 3424 | $path = ''; |
| 3426 | 3425 | foreach ($arbo as $elem) { |
| 3427 | 3426 | if (empty($path) === true) { |
| 3428 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 3427 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 3429 | 3428 | } else { |
| 3430 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 3429 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 3431 | 3430 | } |
| 3432 | 3431 | } |
| 3433 | 3432 | // Build text to show user |
| 3434 | 3433 | if (empty($path) === true) { |
| 3435 | 3434 | $path = addslashes($dataItem['label']); |
| 3436 | 3435 | } else { |
| 3437 | - $path = addslashes($dataItem['label']) . ' (' . $path . ')'; |
|
| 3436 | + $path = addslashes($dataItem['label']).' ('.$path.')'; |
|
| 3438 | 3437 | } |
| 3439 | 3438 | |
| 3440 | 3439 | // Add Admins to notification list if expected |
@@ -3457,7 +3456,7 @@ discard block |
||
| 3457 | 3456 | array( |
| 3458 | 3457 | addslashes($session->get('user-login')), |
| 3459 | 3458 | $path, |
| 3460 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'], |
|
| 3459 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'], |
|
| 3461 | 3460 | ), |
| 3462 | 3461 | $lang->get('email_on_open_notification_mail') |
| 3463 | 3462 | ), |
@@ -3467,7 +3466,7 @@ discard block |
||
| 3467 | 3466 | } |
| 3468 | 3467 | |
| 3469 | 3468 | // has this item a change proposal |
| 3470 | - DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']); |
|
| 3469 | + DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']); |
|
| 3471 | 3470 | $returnArray['has_change_proposal'] = DB::count(); |
| 3472 | 3471 | |
| 3473 | 3472 | // Setting |
@@ -3478,7 +3477,7 @@ discard block |
||
| 3478 | 3477 | if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) { |
| 3479 | 3478 | DB::query( |
| 3480 | 3479 | 'SELECT * |
| 3481 | - FROM ' . prefixTable('otv') . ' |
|
| 3480 | + FROM ' . prefixTable('otv').' |
|
| 3482 | 3481 | WHERE item_id = %i |
| 3483 | 3482 | AND time_limit > %i', |
| 3484 | 3483 | $inputData['id'], |
@@ -3577,7 +3576,7 @@ discard block |
||
| 3577 | 3576 | // Load item data |
| 3578 | 3577 | $data = DB::queryFirstRow( |
| 3579 | 3578 | 'SELECT id_tree, id, label |
| 3580 | - FROM ' . prefixTable('items') . ' |
|
| 3579 | + FROM ' . prefixTable('items').' |
|
| 3581 | 3580 | WHERE id = %i OR item_key = %s', |
| 3582 | 3581 | $inputData['itemId'], |
| 3583 | 3582 | $inputData['itemKey'] |
@@ -3668,7 +3667,7 @@ discard block |
||
| 3668 | 3667 | // Load item data |
| 3669 | 3668 | $dataItem = DB::queryFirstRow( |
| 3670 | 3669 | 'SELECT secret, enabled |
| 3671 | - FROM ' . prefixTable('items_otp') . ' |
|
| 3670 | + FROM ' . prefixTable('items_otp').' |
|
| 3672 | 3671 | WHERE item_id = %i', |
| 3673 | 3672 | $inputData['id'] |
| 3674 | 3673 | ); |
@@ -3750,13 +3749,13 @@ discard block |
||
| 3750 | 3749 | |
| 3751 | 3750 | // Check if user is allowed to access this folder |
| 3752 | 3751 | if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) { |
| 3753 | - echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]'; |
|
| 3752 | + echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]'; |
|
| 3754 | 3753 | break; |
| 3755 | 3754 | } |
| 3756 | 3755 | |
| 3757 | 3756 | // Check if title doesn't contains html codes |
| 3758 | 3757 | if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) { |
| 3759 | - echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]'; |
|
| 3758 | + echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]'; |
|
| 3760 | 3759 | break; |
| 3761 | 3760 | } |
| 3762 | 3761 | // check that title is not numeric |
@@ -3767,9 +3766,9 @@ discard block |
||
| 3767 | 3766 | |
| 3768 | 3767 | // Check if duplicate folders name are allowed |
| 3769 | 3768 | if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') { |
| 3770 | - $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title); |
|
| 3769 | + $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title); |
|
| 3771 | 3770 | if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) { |
| 3772 | - echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]'; |
|
| 3771 | + echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]'; |
|
| 3773 | 3772 | break; |
| 3774 | 3773 | } |
| 3775 | 3774 | } |
@@ -3777,7 +3776,7 @@ discard block |
||
| 3777 | 3776 | // query on folder |
| 3778 | 3777 | $data = DB::queryFirstRow( |
| 3779 | 3778 | 'SELECT parent_id, personal_folder |
| 3780 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 3779 | + FROM ' . prefixTable('nested_tree').' |
|
| 3781 | 3780 | WHERE id = %i', |
| 3782 | 3781 | $inputData['folderId'] |
| 3783 | 3782 | ); |
@@ -3787,20 +3786,20 @@ discard block |
||
| 3787 | 3786 | if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') { |
| 3788 | 3787 | $data = DB::queryFirstRow( |
| 3789 | 3788 | 'SELECT valeur |
| 3790 | - FROM ' . prefixTable('misc') . ' |
|
| 3789 | + FROM ' . prefixTable('misc').' |
|
| 3791 | 3790 | WHERE intitule = %i AND type = %s', |
| 3792 | 3791 | $data['parent_id'], |
| 3793 | 3792 | 'complex' |
| 3794 | 3793 | ); |
| 3795 | 3794 | if (intval($dataReceived['complexity']) < intval($data['valeur'])) { |
| 3796 | - echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]'; |
|
| 3795 | + echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]'; |
|
| 3797 | 3796 | break; |
| 3798 | 3797 | } |
| 3799 | 3798 | } |
| 3800 | 3799 | |
| 3801 | 3800 | // update Folders table |
| 3802 | 3801 | $tmp = DB::queryFirstRow( |
| 3803 | - 'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 3802 | + 'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 3804 | 3803 | $dataReceived['folder'] |
| 3805 | 3804 | ); |
| 3806 | 3805 | if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) { |
@@ -3914,7 +3913,7 @@ discard block |
||
| 3914 | 3913 | $uniqueLoadData['path'] = $arr_arbo; |
| 3915 | 3914 | |
| 3916 | 3915 | // store last folder accessed in cookie |
| 3917 | - $arr_cookie_options = array ( |
|
| 3916 | + $arr_cookie_options = array( |
|
| 3918 | 3917 | 'expires' => time() + TP_ONE_DAY_SECONDS * 5, |
| 3919 | 3918 | 'path' => '/', |
| 3920 | 3919 | 'secure' => true, |
@@ -3929,7 +3928,7 @@ discard block |
||
| 3929 | 3928 | foreach ($session->get('user-roles_array') as $role) { |
| 3930 | 3929 | $roleQ = DB::queryFirstRow( |
| 3931 | 3930 | 'SELECT allow_pw_change |
| 3932 | - FROM ' . prefixTable('roles_title') . ' |
|
| 3931 | + FROM ' . prefixTable('roles_title').' |
|
| 3933 | 3932 | WHERE id = %i', |
| 3934 | 3933 | $role |
| 3935 | 3934 | ); |
@@ -3960,11 +3959,11 @@ discard block |
||
| 3960 | 3959 | |
| 3961 | 3960 | foreach ($session->get('user-roles_array') as $role) { |
| 3962 | 3961 | $access = DB::queryFirstRow( |
| 3963 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
| 3962 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
| 3964 | 3963 | $role, |
| 3965 | 3964 | $inputData['id'] |
| 3966 | 3965 | ); |
| 3967 | - if (DB::count()>0) { |
|
| 3966 | + if (DB::count() > 0) { |
|
| 3968 | 3967 | if ($access['type'] === 'R') { |
| 3969 | 3968 | array_push($arrTmp, 10); |
| 3970 | 3969 | } elseif ($access['type'] === 'W') { |
@@ -4029,7 +4028,7 @@ discard block |
||
| 4029 | 4028 | } else { |
| 4030 | 4029 | DB::query( |
| 4031 | 4030 | 'SELECT * |
| 4032 | - FROM ' . prefixTable('items') . ' |
|
| 4031 | + FROM ' . prefixTable('items').' |
|
| 4033 | 4032 | WHERE inactif = %i', |
| 4034 | 4033 | 0 |
| 4035 | 4034 | ); |
@@ -4039,7 +4038,7 @@ discard block |
||
| 4039 | 4038 | |
| 4040 | 4039 | // Get folder complexity |
| 4041 | 4040 | $folderComplexity = DB::queryFirstRow( |
| 4042 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i', |
|
| 4041 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i', |
|
| 4043 | 4042 | 'complex', |
| 4044 | 4043 | $inputData['id'] |
| 4045 | 4044 | ); |
@@ -4051,7 +4050,7 @@ discard block |
||
| 4051 | 4050 | if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) { |
| 4052 | 4051 | $folderRow = DB::query( |
| 4053 | 4052 | 'SELECT id_category |
| 4054 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 4053 | + FROM ' . prefixTable('categories_folders').' |
|
| 4055 | 4054 | WHERE id_folder = %i', |
| 4056 | 4055 | $inputData['id'] |
| 4057 | 4056 | ); |
@@ -4107,8 +4106,8 @@ discard block |
||
| 4107 | 4106 | $where->add('i.inactif=%i', 0); |
| 4108 | 4107 | $where->add('i.deleted_at IS NULL'); |
| 4109 | 4108 | |
| 4110 | - $query_limit = ' LIMIT ' . |
|
| 4111 | - $start . ',' . |
|
| 4109 | + $query_limit = ' LIMIT '. |
|
| 4110 | + $start.','. |
|
| 4112 | 4111 | $post_nb_items_to_display_once; |
| 4113 | 4112 | |
| 4114 | 4113 | $rows = DB::query( |
@@ -4116,8 +4115,8 @@ discard block |
||
| 4116 | 4115 | i.label, i.description, i.pw, i.login, |
| 4117 | 4116 | i.anyone_can_modify, i.id_tree AS tree_id, i.fa_icon, |
| 4118 | 4117 | n.renewal_period, i.url AS link, i.email |
| 4119 | - FROM ' . prefixTable('items') . ' AS i |
|
| 4120 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
| 4118 | + FROM ' . prefixTable('items').' AS i |
|
| 4119 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
| 4121 | 4120 | WHERE %l |
| 4122 | 4121 | ORDER BY i.label ASC' . $query_limit, |
| 4123 | 4122 | $where |
@@ -4131,8 +4130,8 @@ discard block |
||
| 4131 | 4130 | i.label, i.description, i.pw, i.login, |
| 4132 | 4131 | i.anyone_can_modify, i.id_tree AS tree_id, i.fa_icon, |
| 4133 | 4132 | n.renewal_period, i.url AS link, i.email |
| 4134 | - FROM ' . prefixTable('items') . ' AS i |
|
| 4135 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
| 4133 | + FROM ' . prefixTable('items').' AS i |
|
| 4134 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
| 4136 | 4135 | WHERE %l |
| 4137 | 4136 | ORDER BY i.label ASC', |
| 4138 | 4137 | $where |
@@ -4162,7 +4161,7 @@ discard block |
||
| 4162 | 4161 | $item_is_restricted_to_role = false; |
| 4163 | 4162 | DB::queryFirstRow( |
| 4164 | 4163 | 'SELECT role_id |
| 4165 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 4164 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 4166 | 4165 | WHERE item_id = %i', |
| 4167 | 4166 | $record['id'] |
| 4168 | 4167 | ); |
@@ -4174,7 +4173,7 @@ discard block |
||
| 4174 | 4173 | $user_is_included_in_role = false; |
| 4175 | 4174 | DB::query( |
| 4176 | 4175 | 'SELECT role_id |
| 4177 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 4176 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 4178 | 4177 | WHERE item_id = %i AND role_id IN %ls', |
| 4179 | 4178 | $record['id'], |
| 4180 | 4179 | $session->get('user-roles_array') |
@@ -4384,8 +4383,8 @@ discard block |
||
| 4384 | 4383 | if ((int) $start === 0) { |
| 4385 | 4384 | DB::query( |
| 4386 | 4385 | 'SELECT i.id |
| 4387 | - FROM ' . prefixTable('items') . ' as i |
|
| 4388 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
| 4386 | + FROM ' . prefixTable('items').' as i |
|
| 4387 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
| 4389 | 4388 | WHERE %l', |
| 4390 | 4389 | $where |
| 4391 | 4390 | ); |
@@ -4445,8 +4444,8 @@ discard block |
||
| 4445 | 4444 | $dataItem = DB::queryFirstRow( |
| 4446 | 4445 | 'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id, |
| 4447 | 4446 | i.label AS label, i.id_tree AS id_tree |
| 4448 | - FROM ' . prefixTable('items') . ' AS i |
|
| 4449 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
| 4447 | + FROM ' . prefixTable('items').' AS i |
|
| 4448 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
| 4450 | 4449 | WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)', |
| 4451 | 4450 | $session->get('user-id'), |
| 4452 | 4451 | $inputData['itemKey'] ?? '', |
@@ -4558,7 +4557,7 @@ discard block |
||
| 4558 | 4557 | // do query on this folder |
| 4559 | 4558 | $data_this_folder = DB::queryFirstRow( |
| 4560 | 4559 | 'SELECT id, personal_folder, title |
| 4561 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 4560 | + FROM ' . prefixTable('nested_tree').' |
|
| 4562 | 4561 | WHERE id = %s', |
| 4563 | 4562 | $inputData['folderId'] |
| 4564 | 4563 | ); |
@@ -4598,8 +4597,8 @@ discard block |
||
| 4598 | 4597 | $visibilite = ''; |
| 4599 | 4598 | $data = DB::queryFirstRow( |
| 4600 | 4599 | 'SELECT m.valeur, n.personal_folder |
| 4601 | - FROM ' . prefixTable('misc') . ' AS m |
|
| 4602 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id) |
|
| 4600 | + FROM ' . prefixTable('misc').' AS m |
|
| 4601 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id) |
|
| 4603 | 4602 | WHERE type=%s AND intitule = %s', |
| 4604 | 4603 | 'complex', |
| 4605 | 4604 | $inputData['folderId'] |
@@ -4612,8 +4611,8 @@ discard block |
||
| 4612 | 4611 | // Prepare Item actual visibility (what Users/Roles can see it) |
| 4613 | 4612 | $rows = DB::query( |
| 4614 | 4613 | 'SELECT t.title |
| 4615 | - FROM ' . prefixTable('roles_values') . ' as v |
|
| 4616 | - INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id) |
|
| 4614 | + FROM ' . prefixTable('roles_values').' as v |
|
| 4615 | + INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id) |
|
| 4617 | 4616 | WHERE v.folder_id = %i |
| 4618 | 4617 | GROUP BY title', |
| 4619 | 4618 | $inputData['folderId'] |
@@ -4622,7 +4621,7 @@ discard block |
||
| 4622 | 4621 | if (empty($visibilite)) { |
| 4623 | 4622 | $visibilite = $record['title']; |
| 4624 | 4623 | } else { |
| 4625 | - $visibilite .= ' - ' . $record['title']; |
|
| 4624 | + $visibilite .= ' - '.$record['title']; |
|
| 4626 | 4625 | } |
| 4627 | 4626 | } |
| 4628 | 4627 | } else { |
@@ -4632,14 +4631,14 @@ discard block |
||
| 4632 | 4631 | // do new query to know if current folder is pf |
| 4633 | 4632 | $data_pf = DB::queryFirstRow( |
| 4634 | 4633 | 'SELECT personal_folder |
| 4635 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 4634 | + FROM ' . prefixTable('nested_tree').' |
|
| 4636 | 4635 | WHERE id = %s', |
| 4637 | 4636 | $inputData['folderId'] |
| 4638 | 4637 | ); |
| 4639 | 4638 | |
| 4640 | 4639 | $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0; |
| 4641 | 4640 | |
| 4642 | - $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')'; |
|
| 4641 | + $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')'; |
|
| 4643 | 4642 | } |
| 4644 | 4643 | |
| 4645 | 4644 | recupDroitCreationSansComplexite($inputData['folderId']); |
@@ -4649,8 +4648,8 @@ discard block |
||
| 4649 | 4648 | $listOptionsForRoles = array(); |
| 4650 | 4649 | $rows = DB::query( |
| 4651 | 4650 | 'SELECT r.role_id AS role_id, t.title AS title |
| 4652 | - FROM ' . prefixTable('roles_values') . ' AS r |
|
| 4653 | - INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id) |
|
| 4651 | + FROM ' . prefixTable('roles_values').' AS r |
|
| 4652 | + INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id) |
|
| 4654 | 4653 | WHERE r.folder_id = %i', |
| 4655 | 4654 | $inputData['folderId'] |
| 4656 | 4655 | ); |
@@ -4664,7 +4663,7 @@ discard block |
||
| 4664 | 4663 | ); |
| 4665 | 4664 | $rows2 = DB::query( |
| 4666 | 4665 | 'SELECT id, login, fonction_id, email, name, lastname |
| 4667 | - FROM ' . prefixTable('users') . ' |
|
| 4666 | + FROM ' . prefixTable('users').' |
|
| 4668 | 4667 | WHERE admin = 0 AND fonction_id is not null' |
| 4669 | 4668 | ); |
| 4670 | 4669 | foreach ($rows2 as $record2) { |
@@ -4678,7 +4677,7 @@ discard block |
||
| 4678 | 4677 | array( |
| 4679 | 4678 | 'id' => $record2['id'], |
| 4680 | 4679 | 'login' => $record2['login'], |
| 4681 | - 'name' => $record2['name'] . ' ' . $record2['lastname'], |
|
| 4680 | + 'name' => $record2['name'].' '.$record2['lastname'], |
|
| 4682 | 4681 | 'email' => $record2['email'], |
| 4683 | 4682 | ) |
| 4684 | 4683 | ); |
@@ -4695,12 +4694,12 @@ discard block |
||
| 4695 | 4694 | foreach ($session->get('user-roles_array') as $role) { |
| 4696 | 4695 | $access = DB::queryFirstRow( |
| 4697 | 4696 | 'SELECT type |
| 4698 | - FROM ' . prefixTable('roles_values') . ' |
|
| 4697 | + FROM ' . prefixTable('roles_values').' |
|
| 4699 | 4698 | WHERE role_id = %i AND folder_id = %i', |
| 4700 | 4699 | $role, |
| 4701 | 4700 | $inputData['folderId'] |
| 4702 | 4701 | ); |
| 4703 | - if (DB::count()>0) { |
|
| 4702 | + if (DB::count() > 0) { |
|
| 4704 | 4703 | if ($access['type'] === 'R') { |
| 4705 | 4704 | array_push($arrTmp, 10); |
| 4706 | 4705 | } elseif ($access['type'] === 'W') { |
@@ -4728,7 +4727,7 @@ discard block |
||
| 4728 | 4727 | // Check if personal folder is owned by user |
| 4729 | 4728 | $folder = DB::queryFirstRow( |
| 4730 | 4729 | 'SELECT id |
| 4731 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 4730 | + FROM ' . prefixTable('nested_tree').' |
|
| 4732 | 4731 | WHERE title = %s', |
| 4733 | 4732 | $session->get('user-id'), |
| 4734 | 4733 | ); |
@@ -4833,7 +4832,7 @@ discard block |
||
| 4833 | 4832 | // Get some info before deleting |
| 4834 | 4833 | $data = DB::queryFirstRow( |
| 4835 | 4834 | 'SELECT name, id_item, file |
| 4836 | - FROM ' . prefixTable('files') . ' |
|
| 4835 | + FROM ' . prefixTable('files').' |
|
| 4837 | 4836 | WHERE id = %i', |
| 4838 | 4837 | $fileId |
| 4839 | 4838 | ); |
@@ -4841,7 +4840,7 @@ discard block |
||
| 4841 | 4840 | // Load item data |
| 4842 | 4841 | $data_item = DB::queryFirstRow( |
| 4843 | 4842 | 'SELECT id_tree |
| 4844 | - FROM ' . prefixTable('items') . ' |
|
| 4843 | + FROM ' . prefixTable('items').' |
|
| 4845 | 4844 | WHERE id = %i', |
| 4846 | 4845 | $data['id_item'] |
| 4847 | 4846 | ); |
@@ -4871,7 +4870,7 @@ discard block |
||
| 4871 | 4870 | $session->get('user-id'), |
| 4872 | 4871 | 'at_modification', |
| 4873 | 4872 | $session->get('user-login'), |
| 4874 | - 'at_del_file : ' . $data['name'] |
|
| 4873 | + 'at_del_file : '.$data['name'] |
|
| 4875 | 4874 | ); |
| 4876 | 4875 | |
| 4877 | 4876 | // DElete sharekeys |
@@ -4882,7 +4881,7 @@ discard block |
||
| 4882 | 4881 | ); |
| 4883 | 4882 | |
| 4884 | 4883 | // Delete file from server |
| 4885 | - $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']); |
|
| 4884 | + $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']); |
|
| 4886 | 4885 | $fileToDelete = realpath($fileToDelete); |
| 4887 | 4886 | if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) { |
| 4888 | 4887 | fileDelete($fileToDelete, $SETTINGS); |
@@ -4936,7 +4935,7 @@ discard block |
||
| 4936 | 4935 | // Update SESSION with this new favourite |
| 4937 | 4936 | $data = DB::queryFirstRow( |
| 4938 | 4937 | 'SELECT label,id_tree |
| 4939 | - FROM ' . prefixTable('items') . ' |
|
| 4938 | + FROM ' . prefixTable('items').' |
|
| 4940 | 4939 | WHERE id = %i', |
| 4941 | 4940 | $inputData['itemId'] |
| 4942 | 4941 | ); |
@@ -4945,7 +4944,7 @@ discard block |
||
| 4945 | 4944 | [ |
| 4946 | 4945 | $inputData['itemId'] => [ |
| 4947 | 4946 | 'label' => $data['label'], |
| 4948 | - 'url' => 'index.php?page=items&group=' . $data['id_tree'] . '&id=' . $inputData['itemId'], |
|
| 4947 | + 'url' => 'index.php?page=items&group='.$data['id_tree'].'&id='.$inputData['itemId'], |
|
| 4949 | 4948 | ], |
| 4950 | 4949 | ], |
| 4951 | 4950 | 'add' |
@@ -5014,8 +5013,8 @@ discard block |
||
| 5014 | 5013 | // get data about item |
| 5015 | 5014 | $dataSource = DB::queryFirstRow( |
| 5016 | 5015 | 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label |
| 5017 | - FROM ' . prefixTable('items') . ' as i |
|
| 5018 | - INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id) |
|
| 5016 | + FROM ' . prefixTable('items').' as i |
|
| 5017 | + INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id) |
|
| 5019 | 5018 | WHERE i.id=%i', |
| 5020 | 5019 | $inputData['itemId'] |
| 5021 | 5020 | ); |
@@ -5059,7 +5058,7 @@ discard block |
||
| 5059 | 5058 | // get data about new folder |
| 5060 | 5059 | $dataDestination = DB::queryFirstRow( |
| 5061 | 5060 | 'SELECT personal_folder, title |
| 5062 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 5061 | + FROM ' . prefixTable('nested_tree').' |
|
| 5063 | 5062 | WHERE id = %i', |
| 5064 | 5063 | $inputData['folderId'] |
| 5065 | 5064 | ); |
@@ -5112,7 +5111,7 @@ discard block |
||
| 5112 | 5111 | // Get fields for this Item |
| 5113 | 5112 | $rows = DB::query( |
| 5114 | 5113 | 'SELECT id |
| 5115 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5114 | + FROM ' . prefixTable('categories_items').' |
|
| 5116 | 5115 | WHERE item_id = %i', |
| 5117 | 5116 | $inputData['itemId'] |
| 5118 | 5117 | ); |
@@ -5129,7 +5128,7 @@ discard block |
||
| 5129 | 5128 | // Get FILES for this Item |
| 5130 | 5129 | $rows = DB::query( |
| 5131 | 5130 | 'SELECT id |
| 5132 | - FROM ' . prefixTable('files') . ' |
|
| 5131 | + FROM ' . prefixTable('files').' |
|
| 5133 | 5132 | WHERE id_item = %i', |
| 5134 | 5133 | $inputData['itemId'] |
| 5135 | 5134 | ); |
@@ -5176,7 +5175,7 @@ discard block |
||
| 5176 | 5175 | // Get the ITEM object key for the user |
| 5177 | 5176 | $userKey = DB::queryFirstRow( |
| 5178 | 5177 | 'SELECT share_key |
| 5179 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 5178 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 5180 | 5179 | WHERE user_id = %i AND object_id = %i', |
| 5181 | 5180 | $session->get('user-id'), |
| 5182 | 5181 | $inputData['itemId'] |
@@ -5187,7 +5186,7 @@ discard block |
||
| 5187 | 5186 | // This is a public object |
| 5188 | 5187 | $users = DB::query( |
| 5189 | 5188 | 'SELECT id, public_key |
| 5190 | - FROM ' . prefixTable('users') . ' |
|
| 5189 | + FROM ' . prefixTable('users').' |
|
| 5191 | 5190 | WHERE id NOT IN %li |
| 5192 | 5191 | AND public_key != ""', |
| 5193 | 5192 | $tpUsersIDs |
@@ -5209,14 +5208,14 @@ discard block |
||
| 5209 | 5208 | // Get fields for this Item |
| 5210 | 5209 | $rows = DB::query( |
| 5211 | 5210 | 'SELECT id |
| 5212 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5211 | + FROM ' . prefixTable('categories_items').' |
|
| 5213 | 5212 | WHERE item_id = %i', |
| 5214 | 5213 | $inputData['itemId'] |
| 5215 | 5214 | ); |
| 5216 | 5215 | foreach ($rows as $field) { |
| 5217 | 5216 | $userKey = DB::queryFirstRow( |
| 5218 | 5217 | 'SELECT share_key |
| 5219 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 5218 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 5220 | 5219 | WHERE user_id = %i AND object_id = %i', |
| 5221 | 5220 | $session->get('user-id'), |
| 5222 | 5221 | $field['id'] |
@@ -5227,7 +5226,7 @@ discard block |
||
| 5227 | 5226 | // This is a public object |
| 5228 | 5227 | $users = DB::query( |
| 5229 | 5228 | 'SELECT id, public_key |
| 5230 | - FROM ' . prefixTable('users') . ' |
|
| 5229 | + FROM ' . prefixTable('users').' |
|
| 5231 | 5230 | WHERE id NOT IN %li |
| 5232 | 5231 | AND public_key != ""', |
| 5233 | 5232 | $tpUsersIDs |
@@ -5250,14 +5249,14 @@ discard block |
||
| 5250 | 5249 | // Get FILES for this Item |
| 5251 | 5250 | $rows = DB::query( |
| 5252 | 5251 | 'SELECT id |
| 5253 | - FROM ' . prefixTable('files') . ' |
|
| 5252 | + FROM ' . prefixTable('files').' |
|
| 5254 | 5253 | WHERE id_item = %i', |
| 5255 | 5254 | $inputData['itemId'] |
| 5256 | 5255 | ); |
| 5257 | 5256 | foreach ($rows as $attachment) { |
| 5258 | 5257 | $userKey = DB::queryFirstRow( |
| 5259 | 5258 | 'SELECT share_key |
| 5260 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 5259 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 5261 | 5260 | WHERE user_id = %i AND object_id = %i', |
| 5262 | 5261 | $session->get('user-id'), |
| 5263 | 5262 | $attachment['id'] |
@@ -5268,7 +5267,7 @@ discard block |
||
| 5268 | 5267 | // This is a public object |
| 5269 | 5268 | $users = DB::query( |
| 5270 | 5269 | 'SELECT id, public_key |
| 5271 | - FROM ' . prefixTable('users') . ' |
|
| 5270 | + FROM ' . prefixTable('users').' |
|
| 5272 | 5271 | WHERE id NOT IN %li |
| 5273 | 5272 | AND public_key != ""', |
| 5274 | 5273 | $tpUsersIDs |
@@ -5309,7 +5308,7 @@ discard block |
||
| 5309 | 5308 | $session->get('user-id'), |
| 5310 | 5309 | 'at_modification', |
| 5311 | 5310 | $session->get('user-login'), |
| 5312 | - 'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title'] |
|
| 5311 | + 'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title'] |
|
| 5313 | 5312 | ); |
| 5314 | 5313 | |
| 5315 | 5314 | // Update cache table |
@@ -5368,8 +5367,8 @@ discard block |
||
| 5368 | 5367 | // get data about item |
| 5369 | 5368 | $dataSource = DB::queryFirstRow( |
| 5370 | 5369 | 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label |
| 5371 | - FROM ' . prefixTable('items') . ' as i |
|
| 5372 | - INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id) |
|
| 5370 | + FROM ' . prefixTable('items').' as i |
|
| 5371 | + INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id) |
|
| 5373 | 5372 | WHERE i.id=%i', |
| 5374 | 5373 | $item_id |
| 5375 | 5374 | ); |
@@ -5391,7 +5390,7 @@ discard block |
||
| 5391 | 5390 | |
| 5392 | 5391 | // get data about new folder |
| 5393 | 5392 | $dataDestination = DB::queryFirstRow( |
| 5394 | - 'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 5393 | + 'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 5395 | 5394 | $inputData['folderId'] |
| 5396 | 5395 | ); |
| 5397 | 5396 | |
@@ -5425,14 +5424,14 @@ discard block |
||
| 5425 | 5424 | prefixTable('sharekeys_items'), |
| 5426 | 5425 | 'object_id = %i AND user_id NOT IN %ls', |
| 5427 | 5426 | $item_id, |
| 5428 | - [$session->get('user-id'), TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID] |
|
| 5427 | + [$session->get('user-id'), TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID] |
|
| 5429 | 5428 | ); |
| 5430 | 5429 | |
| 5431 | 5430 | // Remove all item sharekeys fields |
| 5432 | 5431 | // Get fields for this Item |
| 5433 | 5432 | $rows = DB::query( |
| 5434 | 5433 | 'SELECT id |
| 5435 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5434 | + FROM ' . prefixTable('categories_items').' |
|
| 5436 | 5435 | WHERE item_id = %i', |
| 5437 | 5436 | $item_id |
| 5438 | 5437 | ); |
@@ -5449,7 +5448,7 @@ discard block |
||
| 5449 | 5448 | // Get FILES for this Item |
| 5450 | 5449 | $rows = DB::query( |
| 5451 | 5450 | 'SELECT id |
| 5452 | - FROM ' . prefixTable('files') . ' |
|
| 5451 | + FROM ' . prefixTable('files').' |
|
| 5453 | 5452 | WHERE id_item = %i', |
| 5454 | 5453 | $item_id |
| 5455 | 5454 | ); |
@@ -5504,7 +5503,7 @@ discard block |
||
| 5504 | 5503 | // Get the ITEM object key for the user |
| 5505 | 5504 | $userKey = DB::queryFirstRow( |
| 5506 | 5505 | 'SELECT share_key |
| 5507 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 5506 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 5508 | 5507 | WHERE user_id = %i AND object_id = %i', |
| 5509 | 5508 | $session->get('user-id'), |
| 5510 | 5509 | $item_id |
@@ -5515,7 +5514,7 @@ discard block |
||
| 5515 | 5514 | // This is a public object |
| 5516 | 5515 | $users = DB::query( |
| 5517 | 5516 | 'SELECT id, public_key |
| 5518 | - FROM ' . prefixTable('users') . ' |
|
| 5517 | + FROM ' . prefixTable('users').' |
|
| 5519 | 5518 | WHERE id NOT IN %li |
| 5520 | 5519 | AND public_key != ""', |
| 5521 | 5520 | $tpUsersIDs |
@@ -5538,14 +5537,14 @@ discard block |
||
| 5538 | 5537 | // Get fields for this Item |
| 5539 | 5538 | $rows = DB::query( |
| 5540 | 5539 | 'SELECT id |
| 5541 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5540 | + FROM ' . prefixTable('categories_items').' |
|
| 5542 | 5541 | WHERE item_id = %i', |
| 5543 | 5542 | $item_id |
| 5544 | 5543 | ); |
| 5545 | 5544 | foreach ($rows as $field) { |
| 5546 | 5545 | $userKey = DB::queryFirstRow( |
| 5547 | 5546 | 'SELECT share_key |
| 5548 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 5547 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 5549 | 5548 | WHERE user_id = %i AND object_id = %i', |
| 5550 | 5549 | $session->get('user-id'), |
| 5551 | 5550 | $field['id'] |
@@ -5556,7 +5555,7 @@ discard block |
||
| 5556 | 5555 | // This is a public object |
| 5557 | 5556 | $users = DB::query( |
| 5558 | 5557 | 'SELECT id, public_key |
| 5559 | - FROM ' . prefixTable('users') . ' |
|
| 5558 | + FROM ' . prefixTable('users').' |
|
| 5560 | 5559 | WHERE id NOT IN %li |
| 5561 | 5560 | AND public_key != ""', |
| 5562 | 5561 | $tpUsersIDs |
@@ -5580,14 +5579,14 @@ discard block |
||
| 5580 | 5579 | // Get FILES for this Item |
| 5581 | 5580 | $rows = DB::query( |
| 5582 | 5581 | 'SELECT id |
| 5583 | - FROM ' . prefixTable('files') . ' |
|
| 5582 | + FROM ' . prefixTable('files').' |
|
| 5584 | 5583 | WHERE id_item = %i', |
| 5585 | 5584 | $item_id |
| 5586 | 5585 | ); |
| 5587 | 5586 | foreach ($rows as $attachment) { |
| 5588 | 5587 | $userKey = DB::queryFirstRow( |
| 5589 | 5588 | 'SELECT share_key |
| 5590 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 5589 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 5591 | 5590 | WHERE user_id = %i AND object_id = %i', |
| 5592 | 5591 | $session->get('user-id'), |
| 5593 | 5592 | $attachment['id'] |
@@ -5598,7 +5597,7 @@ discard block |
||
| 5598 | 5597 | // This is a public object |
| 5599 | 5598 | $users = DB::query( |
| 5600 | 5599 | 'SELECT id, public_key |
| 5601 | - FROM ' . prefixTable('users') . ' |
|
| 5600 | + FROM ' . prefixTable('users').' |
|
| 5602 | 5601 | WHERE id NOT IN %li |
| 5603 | 5602 | AND public_key != ""', |
| 5604 | 5603 | $tpUsersIDs |
@@ -5638,13 +5637,13 @@ discard block |
||
| 5638 | 5637 | $session->get('user-id'), |
| 5639 | 5638 | 'at_modification', |
| 5640 | 5639 | $session->get('user-login'), |
| 5641 | - 'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title'] |
|
| 5640 | + 'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title'] |
|
| 5642 | 5641 | ); |
| 5643 | 5642 | } |
| 5644 | 5643 | } |
| 5645 | 5644 | |
| 5646 | 5645 | // reload cache table |
| 5647 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 5646 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 5648 | 5647 | updateCacheTable('reload', null); |
| 5649 | 5648 | |
| 5650 | 5649 | echo (string) prepareExchangedData( |
@@ -5708,7 +5707,7 @@ discard block |
||
| 5708 | 5707 | // get info |
| 5709 | 5708 | $dataSource = DB::queryFirstRow( |
| 5710 | 5709 | 'SELECT label, id_tree |
| 5711 | - FROM ' . prefixTable('items') . ' |
|
| 5710 | + FROM ' . prefixTable('items').' |
|
| 5712 | 5711 | WHERE id=%i', |
| 5713 | 5712 | $item_id |
| 5714 | 5713 | ); |
@@ -5809,14 +5808,14 @@ discard block |
||
| 5809 | 5808 | // Variables |
| 5810 | 5809 | $dataAuthor = DB::queryFirstRow( |
| 5811 | 5810 | 'SELECT email,login |
| 5812 | - FROM ' . prefixTable('users') . ' |
|
| 5811 | + FROM ' . prefixTable('users').' |
|
| 5813 | 5812 | WHERE id = %i', |
| 5814 | 5813 | $post_content[1] |
| 5815 | 5814 | ); |
| 5816 | 5815 | |
| 5817 | 5816 | $dataItem = DB::queryFirstRow( |
| 5818 | 5817 | 'SELECT label, id_tree |
| 5819 | - FROM ' . prefixTable('items') . ' |
|
| 5818 | + FROM ' . prefixTable('items').' |
|
| 5820 | 5819 | WHERE id = %i', |
| 5821 | 5820 | $post_content[0] |
| 5822 | 5821 | ); |
@@ -5833,7 +5832,7 @@ discard block |
||
| 5833 | 5832 | $lang->get('email_request_access_subject'), |
| 5834 | 5833 | str_replace( |
| 5835 | 5834 | array('#tp_item_author#', '#tp_user#', '#tp_item#'), |
| 5836 | - array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path), |
|
| 5835 | + array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path), |
|
| 5837 | 5836 | $lang->get('email_request_access_mail') |
| 5838 | 5837 | ), |
| 5839 | 5838 | $dataAuthor['email'], |
@@ -5842,7 +5841,7 @@ discard block |
||
| 5842 | 5841 | } elseif ($inputData['cat'] === 'share_this_item') { |
| 5843 | 5842 | $dataItem = DB::queryFirstRow( |
| 5844 | 5843 | 'SELECT label,id_tree |
| 5845 | - FROM ' . prefixTable('items') . ' |
|
| 5844 | + FROM ' . prefixTable('items').' |
|
| 5846 | 5845 | WHERE id= %i', |
| 5847 | 5846 | $inputData['id'] |
| 5848 | 5847 | ); |
@@ -5865,7 +5864,7 @@ discard block |
||
| 5865 | 5864 | ), |
| 5866 | 5865 | array( |
| 5867 | 5866 | empty($SETTINGS['email_server_url']) === false ? |
| 5868 | - $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'], |
|
| 5867 | + $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'], |
|
| 5869 | 5868 | addslashes($session->get('user-login')), |
| 5870 | 5869 | addslashes($path), |
| 5871 | 5870 | ), |
@@ -5914,8 +5913,8 @@ discard block |
||
| 5914 | 5913 | // Get all informations for this item |
| 5915 | 5914 | $dataItem = DB::queryFirstRow( |
| 5916 | 5915 | 'SELECT * |
| 5917 | - FROM ' . prefixTable('items') . ' as i |
|
| 5918 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 5916 | + FROM ' . prefixTable('items').' as i |
|
| 5917 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 5919 | 5918 | WHERE i.id=%i AND l.action = %s', |
| 5920 | 5919 | $item_id, |
| 5921 | 5920 | 'at_creation' |
@@ -5944,18 +5943,18 @@ discard block |
||
| 5944 | 5943 | $session->get('user-login'), |
| 5945 | 5944 | htmlspecialchars_decode($label, ENT_QUOTES), |
| 5946 | 5945 | null, |
| 5947 | - (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format']) |
|
| 5946 | + (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format']) |
|
| 5948 | 5947 | ); |
| 5949 | 5948 | // Prepare new line |
| 5950 | 5949 | $data = DB::queryFirstRow( |
| 5951 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC', |
|
| 5950 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC', |
|
| 5952 | 5951 | $item_id |
| 5953 | 5952 | ); |
| 5954 | - $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison']; |
|
| 5953 | + $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison']; |
|
| 5955 | 5954 | // send back |
| 5956 | 5955 | $data = array( |
| 5957 | 5956 | 'error' => '', |
| 5958 | - 'new_line' => '<br>' . addslashes($historic), |
|
| 5957 | + 'new_line' => '<br>'.addslashes($historic), |
|
| 5959 | 5958 | ); |
| 5960 | 5959 | echo (string) prepareExchangedData( |
| 5961 | 5960 | $data, |
@@ -6030,8 +6029,8 @@ discard block |
||
| 6030 | 6029 | // Should we log a password change? |
| 6031 | 6030 | $itemQ = DB::queryFirstRow( |
| 6032 | 6031 | 'SELECT s.share_key, i.pw |
| 6033 | - FROM ' . prefixTable('items') . ' AS i |
|
| 6034 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id) |
|
| 6032 | + FROM ' . prefixTable('items').' AS i |
|
| 6033 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id) |
|
| 6035 | 6034 | WHERE s.user_id = %i AND s.object_id = %i', |
| 6036 | 6035 | $session->get('user-id'), |
| 6037 | 6036 | $dataReceived['id'] |
@@ -6086,7 +6085,7 @@ discard block |
||
| 6086 | 6085 | if (isset($SETTINGS['otv_expiration_period']) === false) { |
| 6087 | 6086 | $SETTINGS['otv_expiration_period'] = 7; |
| 6088 | 6087 | } |
| 6089 | - $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session); |
|
| 6088 | + $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session); |
|
| 6090 | 6089 | |
| 6091 | 6090 | echo json_encode( |
| 6092 | 6091 | array( |
@@ -6117,7 +6116,7 @@ discard block |
||
| 6117 | 6116 | // get parameters from original link |
| 6118 | 6117 | $url = $dataReceived['original_link']; |
| 6119 | 6118 | $parts = parse_url($url); |
| 6120 | - if(isset($parts['query'])){ |
|
| 6119 | + if (isset($parts['query'])) { |
|
| 6121 | 6120 | parse_str($parts['query'], $orignal_link_parameters); |
| 6122 | 6121 | } else { |
| 6123 | 6122 | $orignal_link_parameters = array(); |
@@ -6148,13 +6147,13 @@ discard block |
||
| 6148 | 6147 | $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME); |
| 6149 | 6148 | $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST); |
| 6150 | 6149 | if (str_contains($domain_host, 'www.') === true) { |
| 6151 | - $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4); |
|
| 6150 | + $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4); |
|
| 6152 | 6151 | } else { |
| 6153 | - $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host; |
|
| 6152 | + $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host; |
|
| 6154 | 6153 | } |
| 6155 | - $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session); |
|
| 6154 | + $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session); |
|
| 6156 | 6155 | } else { |
| 6157 | - $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session); |
|
| 6156 | + $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session); |
|
| 6158 | 6157 | } |
| 6159 | 6158 | |
| 6160 | 6159 | echo (string) prepareExchangedData( |
@@ -6189,8 +6188,8 @@ discard block |
||
| 6189 | 6188 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, |
| 6190 | 6189 | f.extension AS extension, f.type AS type, |
| 6191 | 6190 | s.share_key AS share_key |
| 6192 | - FROM ' . prefixTable('files') . ' AS f |
|
| 6193 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
| 6191 | + FROM ' . prefixTable('files').' AS f |
|
| 6192 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
| 6194 | 6193 | WHERE s.user_id = %i AND s.object_id = %i', |
| 6195 | 6194 | $session->get('user-id'), |
| 6196 | 6195 | $inputData['id'] |
@@ -6211,7 +6210,7 @@ discard block |
||
| 6211 | 6210 | //$fileName = basename($file_info['name'], '.'.$file_info['extension']); |
| 6212 | 6211 | |
| 6213 | 6212 | // prepare image info |
| 6214 | - $post_title = basename($file_info['name'], '.' . $file_info['extension']); |
|
| 6213 | + $post_title = basename($file_info['name'], '.'.$file_info['extension']); |
|
| 6215 | 6214 | $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title; |
| 6216 | 6215 | |
| 6217 | 6216 | // Get image content |
@@ -6238,7 +6237,7 @@ discard block |
||
| 6238 | 6237 | echo (string) prepareExchangedData( |
| 6239 | 6238 | array( |
| 6240 | 6239 | 'error' => false, |
| 6241 | - 'filename' => $post_title . '.' . $file_info['extension'], |
|
| 6240 | + 'filename' => $post_title.'.'.$file_info['extension'], |
|
| 6242 | 6241 | 'file_type' => $file_info['type'], |
| 6243 | 6242 | 'file_content' => $fileContent, |
| 6244 | 6243 | ), |
@@ -6350,7 +6349,7 @@ discard block |
||
| 6350 | 6349 | $arbo = $tree->getPath($folder->id, false); |
| 6351 | 6350 | $path = ''; |
| 6352 | 6351 | foreach ($arbo as $elem) { |
| 6353 | - $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 6352 | + $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 6354 | 6353 | } |
| 6355 | 6354 | |
| 6356 | 6355 | // Build array |
@@ -6417,7 +6416,7 @@ discard block |
||
| 6417 | 6416 | if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') { |
| 6418 | 6417 | $rows = DB::query( |
| 6419 | 6418 | 'SELECT id, categories |
| 6420 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 6419 | + FROM ' . prefixTable('nested_tree').' |
|
| 6421 | 6420 | WHERE id IN (%l)', |
| 6422 | 6421 | implode(',', $foldersArray) |
| 6423 | 6422 | ); |
@@ -6435,7 +6434,7 @@ discard block |
||
| 6435 | 6434 | if (count($ids) > 0) { |
| 6436 | 6435 | $subfolders = DB::queryFirstColumn( |
| 6437 | 6436 | 'SELECT title |
| 6438 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 6437 | + FROM ' . prefixTable('nested_tree').' |
|
| 6439 | 6438 | WHERE id IN %li', |
| 6440 | 6439 | $ids |
| 6441 | 6440 | ); |
@@ -6471,7 +6470,7 @@ discard block |
||
| 6471 | 6470 | // get item info |
| 6472 | 6471 | $dataItem = DB::queryFirstRow( |
| 6473 | 6472 | 'SELECT * |
| 6474 | - FROM ' . prefixTable('items') . ' |
|
| 6473 | + FROM ' . prefixTable('items').' |
|
| 6475 | 6474 | WHERE id=%i', |
| 6476 | 6475 | $inputData['itemId'] |
| 6477 | 6476 | ); |
@@ -6483,8 +6482,8 @@ discard block |
||
| 6483 | 6482 | 'SELECT l.date as date, l.action as action, l.raison as raison, |
| 6484 | 6483 | u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname, |
| 6485 | 6484 | l.old_value as old_value |
| 6486 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 6487 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 6485 | + FROM ' . prefixTable('log_items').' as l |
|
| 6486 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 6488 | 6487 | WHERE id_item=%i AND l.action NOT IN (%l) |
| 6489 | 6488 | ORDER BY date DESC', |
| 6490 | 6489 | $inputData['itemId'], |
@@ -6499,18 +6498,18 @@ discard block |
||
| 6499 | 6498 | |
| 6500 | 6499 | // imported via API |
| 6501 | 6500 | if (empty($record['login']) === true) { |
| 6502 | - $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']'; |
|
| 6501 | + $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']'; |
|
| 6503 | 6502 | } |
| 6504 | 6503 | |
| 6505 | 6504 | // Prepare avatar |
| 6506 | 6505 | if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) { |
| 6507 | - if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) { |
|
| 6508 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb']; |
|
| 6506 | + if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) { |
|
| 6507 | + $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb']; |
|
| 6509 | 6508 | } else { |
| 6510 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
| 6509 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
| 6511 | 6510 | } |
| 6512 | 6511 | } else { |
| 6513 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
| 6512 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
| 6514 | 6513 | } |
| 6515 | 6514 | |
| 6516 | 6515 | // Prepare action |
@@ -6530,7 +6529,7 @@ discard block |
||
| 6530 | 6529 | $previous_passwords, |
| 6531 | 6530 | [ |
| 6532 | 6531 | 'password' => htmlentities($previous_pwd['string']), |
| 6533 | - 'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']), |
|
| 6532 | + 'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']), |
|
| 6534 | 6533 | ] |
| 6535 | 6534 | ); |
| 6536 | 6535 | } |
@@ -6543,19 +6542,19 @@ discard block |
||
| 6543 | 6542 | $action = $lang->get($reason[0]); |
| 6544 | 6543 | if ($reason[0] === 'at_moved') { |
| 6545 | 6544 | $tmp = explode(' -> ', $reason[1]); |
| 6546 | - $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>'; |
|
| 6545 | + $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>'; |
|
| 6547 | 6546 | } elseif ($reason[0] === 'at_field') { |
| 6548 | 6547 | $tmp = explode(' => ', $reason[1]); |
| 6549 | 6548 | if (count($tmp) > 1) { |
| 6550 | - $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') . |
|
| 6551 | - ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>'; |
|
| 6549 | + $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value'). |
|
| 6550 | + ': <span class="font-weight-light">'.trim($tmp[1]).'</span>'; |
|
| 6552 | 6551 | } else { |
| 6553 | 6552 | $detail = trim($reason[1]); |
| 6554 | 6553 | } |
| 6555 | 6554 | } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) { |
| 6556 | 6555 | $tmp = explode(' => ', $reason[1]); |
| 6557 | 6556 | $detail = empty(trim($tmp[0])) === true ? |
| 6558 | - $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>'; |
|
| 6557 | + $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>'; |
|
| 6559 | 6558 | } elseif ($reason[0] === 'at_automatic_del') { |
| 6560 | 6559 | $detail = $lang->get($reason[1]); |
| 6561 | 6560 | } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status' || $reason[0] === 'at_otp_secret' || $reason[0] === 'at_phone_number') { |
@@ -6564,7 +6563,7 @@ discard block |
||
| 6564 | 6563 | $tmp = explode(':', $reason[1]); |
| 6565 | 6564 | $tmp = explode('.', $tmp[0]); |
| 6566 | 6565 | $detail = isBase64($tmp[0]) === true ? |
| 6567 | - base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0]; |
|
| 6566 | + base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0]; |
|
| 6568 | 6567 | } elseif ($reason[0] === 'at_import') { |
| 6569 | 6568 | $detail = ''; |
| 6570 | 6569 | } elseif (in_array($reason[0], array('csv', 'pdf')) === true) { |
@@ -6583,8 +6582,8 @@ discard block |
||
| 6583 | 6582 | array( |
| 6584 | 6583 | 'avatar' => $avatar, |
| 6585 | 6584 | 'login' => $record['login'], |
| 6586 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
| 6587 | - 'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']), |
|
| 6585 | + 'name' => $record['name'].' '.$record['lastname'], |
|
| 6586 | + 'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']), |
|
| 6588 | 6587 | 'action' => $action, |
| 6589 | 6588 | 'detail' => $detail, |
| 6590 | 6589 | ) |
@@ -6672,11 +6671,11 @@ discard block |
||
| 6672 | 6671 | |
| 6673 | 6672 | // get some info to add to the notification email |
| 6674 | 6673 | $resp_user = DB::queryFirstRow( |
| 6675 | - 'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i', |
|
| 6674 | + 'SELECT login FROM '.prefixTable('users').' WHERE id = %i', |
|
| 6676 | 6675 | $session->get('user-id') |
| 6677 | 6676 | ); |
| 6678 | 6677 | $resp_folder = DB::queryFirstRow( |
| 6679 | - 'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 6678 | + 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 6680 | 6679 | $folder |
| 6681 | 6680 | ); |
| 6682 | 6681 | |
@@ -6685,7 +6684,7 @@ discard block |
||
| 6685 | 6684 | $emailService = new EmailService(); |
| 6686 | 6685 | $rows = DB::query( |
| 6687 | 6686 | 'SELECT email |
| 6688 | - FROM ' . prefixTable('users') . ' |
|
| 6687 | + FROM ' . prefixTable('users').' |
|
| 6689 | 6688 | WHERE `gestionnaire` = %i AND `email` IS NOT NULL', |
| 6690 | 6689 | 1 |
| 6691 | 6690 | ); |
@@ -6731,7 +6730,7 @@ discard block |
||
| 6731 | 6730 | // Send email |
| 6732 | 6731 | $dataItem = DB::queryFirstRow( |
| 6733 | 6732 | 'SELECT label, id_tree |
| 6734 | - FROM ' . prefixTable('items') . ' |
|
| 6733 | + FROM ' . prefixTable('items').' |
|
| 6735 | 6734 | WHERE id = %i', |
| 6736 | 6735 | $inputData['itemId'] |
| 6737 | 6736 | ); |
@@ -6785,7 +6784,7 @@ discard block |
||
| 6785 | 6784 | |
| 6786 | 6785 | DB::query( |
| 6787 | 6786 | 'SELECT * |
| 6788 | - FROM ' . prefixTable('notification') . ' |
|
| 6787 | + FROM ' . prefixTable('notification').' |
|
| 6789 | 6788 | WHERE item_id = %i AND user_id = %i', |
| 6790 | 6789 | $inputData['itemId'], |
| 6791 | 6790 | $session->get('user-id') |
@@ -6857,7 +6856,7 @@ discard block |
||
| 6857 | 6856 | // And related logs |
| 6858 | 6857 | $rows = DB::query( |
| 6859 | 6858 | 'SELECT id, file AS filename |
| 6860 | - FROM ' . prefixTable('files') . ' |
|
| 6859 | + FROM ' . prefixTable('files').' |
|
| 6861 | 6860 | WHERE id_item = %i AND confirmed = %i', |
| 6862 | 6861 | $inputData['itemId'], |
| 6863 | 6862 | 0 |
@@ -6871,12 +6870,12 @@ discard block |
||
| 6871 | 6870 | ); |
| 6872 | 6871 | |
| 6873 | 6872 | // Delete file on server |
| 6874 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename'])); |
|
| 6873 | + unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename'])); |
|
| 6875 | 6874 | |
| 6876 | 6875 | // Delete related logs |
| 6877 | 6876 | $logFile = DB::query( |
| 6878 | 6877 | 'SELECT increment_id, raison |
| 6879 | - FROM ' . prefixTable('log_items') . ' |
|
| 6878 | + FROM ' . prefixTable('log_items').' |
|
| 6880 | 6879 | WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"', |
| 6881 | 6880 | $inputData['itemId'], |
| 6882 | 6881 | $session->get('user-id'), |
@@ -6935,7 +6934,7 @@ discard block |
||
| 6935 | 6934 | // Confirm attachments |
| 6936 | 6935 | $rows = DB::query( |
| 6937 | 6936 | 'SELECT id, file AS filename |
| 6938 | - FROM ' . prefixTable('files') . ' |
|
| 6937 | + FROM ' . prefixTable('files').' |
|
| 6939 | 6938 | WHERE id_item = %i AND confirmed = %i', |
| 6940 | 6939 | $inputData['itemId'], |
| 6941 | 6940 | 0 |
@@ -7051,7 +7050,7 @@ discard block |
||
| 7051 | 7050 | $successfulDeletions = array(); |
| 7052 | 7051 | $failedDeletions = array(); |
| 7053 | 7052 | |
| 7054 | - foreach( $selectedItemIds as $itemId) { |
|
| 7053 | + foreach ($selectedItemIds as $itemId) { |
|
| 7055 | 7054 | // Check that user can access this item |
| 7056 | 7055 | $granted = accessToItemIsGranted((int) $itemId, $SETTINGS); |
| 7057 | 7056 | if ($granted !== true) { |
@@ -7062,7 +7061,7 @@ discard block |
||
| 7062 | 7061 | // Load item data |
| 7063 | 7062 | $data = DB::queryFirstRow( |
| 7064 | 7063 | 'SELECT id_tree, id, label |
| 7065 | - FROM ' . prefixTable('items') . ' |
|
| 7064 | + FROM ' . prefixTable('items').' |
|
| 7066 | 7065 | WHERE id = %i', |
| 7067 | 7066 | $itemId |
| 7068 | 7067 | ); |
@@ -7145,15 +7144,15 @@ discard block |
||
| 7145 | 7144 | case 'autocomplete_tags': |
| 7146 | 7145 | // Get a list off all existing TAGS |
| 7147 | 7146 | $listOfTags = ''; |
| 7148 | - $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']); |
|
| 7147 | + $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']); |
|
| 7149 | 7148 | foreach ($rows as $record) { |
| 7150 | 7149 | if (empty($listOfTags)) { |
| 7151 | - $listOfTags = '"' . $record['tag'] . '"'; |
|
| 7150 | + $listOfTags = '"'.$record['tag'].'"'; |
|
| 7152 | 7151 | } else { |
| 7153 | - $listOfTags .= ', "' . $record['tag'] . '"'; |
|
| 7152 | + $listOfTags .= ', "'.$record['tag'].'"'; |
|
| 7154 | 7153 | } |
| 7155 | 7154 | } |
| 7156 | - echo '[' . $listOfTags . ']'; |
|
| 7155 | + echo '['.$listOfTags.']'; |
|
| 7157 | 7156 | break; |
| 7158 | 7157 | } |
| 7159 | 7158 | } |
@@ -7169,7 +7168,7 @@ discard block |
||
| 7169 | 7168 | { |
| 7170 | 7169 | $data = DB::queryFirstRow( |
| 7171 | 7170 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
| 7172 | - FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 7171 | + FROM ' . prefixTable('nested_tree').' WHERE id = %i', |
|
| 7173 | 7172 | $groupe |
| 7174 | 7173 | ); |
| 7175 | 7174 | // Check if it's in a personal folder. If yes, then force complexity overhead. |
@@ -7289,7 +7288,7 @@ discard block |
||
| 7289 | 7288 | // Get item date |
| 7290 | 7289 | $itemRestrictedUsersList = DB::queryFirstRow( |
| 7291 | 7290 | 'SELECT restricted_to |
| 7292 | - FROM ' . prefixTable('items') . ' |
|
| 7291 | + FROM ' . prefixTable('items').' |
|
| 7293 | 7292 | WHERE id = %i', |
| 7294 | 7293 | $itemId |
| 7295 | 7294 | ); |
@@ -7322,7 +7321,7 @@ discard block |
||
| 7322 | 7321 | $now = time(); |
| 7323 | 7322 | $editionLocks = DB::query( |
| 7324 | 7323 | 'SELECT timestamp, user_id, increment_id |
| 7325 | - FROM ' . prefixTable('items_edition') . ' |
|
| 7324 | + FROM ' . prefixTable('items_edition').' |
|
| 7326 | 7325 | WHERE item_id = %i |
| 7327 | 7326 | ORDER BY increment_id DESC', |
| 7328 | 7327 | $itemId |
@@ -7368,7 +7367,7 @@ discard block |
||
| 7368 | 7367 | |
| 7369 | 7368 | // Delete related background tasks if any |
| 7370 | 7369 | $task = DB::queryFirstRow( |
| 7371 | - 'SELECT increment_id FROM ' . prefixTable('background_tasks') . ' |
|
| 7370 | + 'SELECT increment_id FROM '.prefixTable('background_tasks').' |
|
| 7372 | 7371 | WHERE item_id = %i AND finished_at = ""', |
| 7373 | 7372 | $itemId |
| 7374 | 7373 | ); |
@@ -7381,7 +7380,7 @@ discard block |
||
| 7381 | 7380 | // Check if encryption process is still running |
| 7382 | 7381 | DB::queryFirstRow( |
| 7383 | 7382 | 'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id |
| 7384 | - FROM ' . prefixTable('background_tasks') . ' |
|
| 7383 | + FROM ' . prefixTable('background_tasks').' |
|
| 7385 | 7384 | WHERE item_id = %i AND finished_at = "" |
| 7386 | 7385 | ORDER BY increment_id DESC', |
| 7387 | 7386 | $itemId |
@@ -7402,7 +7401,7 @@ discard block |
||
| 7402 | 7401 | } |
| 7403 | 7402 | |
| 7404 | 7403 | return [ |
| 7405 | - 'status' => true, // Encryption in progress |
|
| 7404 | + 'status' => true, // Encryption in progress |
|
| 7406 | 7405 | 'delay' => $delay - $elapsed, // Time remaining before the lock expires |
| 7407 | 7406 | ]; |
| 7408 | 7407 | } |
@@ -7447,7 +7446,7 @@ discard block |
||
| 7447 | 7446 | { |
| 7448 | 7447 | // Check if there's an ongoing background encryption process for the item |
| 7449 | 7448 | $ongoingProcess = DB::queryFirstRow( |
| 7450 | - 'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', |
|
| 7449 | + 'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', |
|
| 7451 | 7450 | $itemId |
| 7452 | 7451 | ); |
| 7453 | 7452 | |
@@ -7465,7 +7464,7 @@ discard block |
||
| 7465 | 7464 | function getUserVisibleFolders(int $userId): array |
| 7466 | 7465 | { |
| 7467 | 7466 | // Query to retrieve visible folders for the user |
| 7468 | - $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId); |
|
| 7467 | + $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId); |
|
| 7469 | 7468 | |
| 7470 | 7469 | // Decode JSON data into an array; return an empty array if the data is invalid |
| 7471 | 7470 | return json_decode($data['visible_folders'], true) ?? []; |
@@ -7489,7 +7488,7 @@ discard block |
||
| 7489 | 7488 | |
| 7490 | 7489 | // Query the access rights for the given roles and folder |
| 7491 | 7490 | $accessTypes = DB::queryFirstColumn( |
| 7492 | - 'SELECT DISTINCT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', |
|
| 7491 | + 'SELECT DISTINCT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', |
|
| 7493 | 7492 | $roles, |
| 7494 | 7493 | $treeId |
| 7495 | 7494 | ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ) { |
| 80 | 80 | // Not allowed page |
| 81 | 81 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 82 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 82 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 83 | 83 | exit; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @param array $SETTINGS |
| 208 | 208 | * @return string |
| 209 | 209 | */ |
| 210 | -function passwordHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string |
|
| 210 | +function passwordHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string |
|
| 211 | 211 | { |
| 212 | 212 | $session = SessionManager::getSession(); |
| 213 | 213 | $lang = new Language($session->get('user-language') ?? 'english'); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | // Get current user hash |
| 277 | 277 | $userHash = DB::queryFirstRow( |
| 278 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;", |
|
| 278 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;", |
|
| 279 | 279 | $session->get('user-id') |
| 280 | 280 | )['pw']; |
| 281 | 281 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * @param string $post_key |
| 331 | 331 | * @return string |
| 332 | 332 | */ |
| 333 | -function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string |
|
| 333 | +function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string |
|
| 334 | 334 | { |
| 335 | 335 | $session = SessionManager::getSession(); |
| 336 | 336 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | if (isset($dataReceived['user_id'])) { |
| 366 | 366 | // Get info about user to modify |
| 367 | 367 | $targetUserInfos = DB::queryFirstRow( |
| 368 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 368 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 369 | 369 | WHERE id = %i', |
| 370 | 370 | $dataReceived['user_id'] |
| 371 | 371 | ); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | case 'mail_me'://action_mail |
| 515 | 515 | // Get info about user to send email |
| 516 | 516 | $data_user = DB::queryFirstRow( |
| 517 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 517 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 518 | 518 | WHERE email = %s', |
| 519 | 519 | filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
| 520 | 520 | ); |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | if (isset($dataReceived['user_id'])) { |
| 635 | 635 | // Get info about user to modify |
| 636 | 636 | $targetUserInfos = DB::queryFirstRow( |
| 637 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 637 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 638 | 638 | WHERE id = %i', |
| 639 | 639 | $dataReceived['user_id'] |
| 640 | 640 | ); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | // Get current user hash |
| 720 | 720 | $userHash = DB::queryFirstRow( |
| 721 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;", |
|
| 721 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;", |
|
| 722 | 722 | $session->get('user-id') |
| 723 | 723 | )['pw']; |
| 724 | 724 | |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | |
| 757 | 757 | // Get current user hash |
| 758 | 758 | $userHash = DB::queryFirstRow( |
| 759 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;", |
|
| 759 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;", |
|
| 760 | 760 | $session->get('user-id') |
| 761 | 761 | )['pw']; |
| 762 | 762 | |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | // Get current user hash |
| 803 | 803 | $userHash = DB::queryFirstRow( |
| 804 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;", |
|
| 804 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;", |
|
| 805 | 805 | $session->get('user-id') |
| 806 | 806 | )['pw']; |
| 807 | 807 | |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | * @param array $SETTINGS |
| 854 | 854 | * @return string |
| 855 | 855 | */ |
| 856 | -function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string |
|
| 856 | +function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string |
|
| 857 | 857 | { |
| 858 | 858 | $session = SessionManager::getSession(); |
| 859 | 859 | switch ($post_type) { |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | ) |
| 955 | 955 | ); |
| 956 | 956 | |
| 957 | - return '[{"token" : "' . $token . '"}]'; |
|
| 957 | + return '[{"token" : "'.$token.'"}]'; |
|
| 958 | 958 | |
| 959 | 959 | /* |
| 960 | 960 | * Default case |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
| 973 | -function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string |
|
| 973 | +function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string |
|
| 974 | 974 | { |
| 975 | 975 | switch ($post_type) { |
| 976 | 976 | /* |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | array( |
| 1040 | 1040 | 'error' => false, |
| 1041 | 1041 | 'timestamp' => $session->get('user-session_duration'), |
| 1042 | - 'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60), |
|
| 1042 | + 'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60), |
|
| 1043 | 1043 | 'max_session_duration' => $maximum_session_expiration_time, |
| 1044 | 1044 | ), |
| 1045 | 1045 | 'encode' |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | // get number of items |
| 1092 | 1092 | DB::queryFirstRow( |
| 1093 | 1093 | 'SELECT increment_id |
| 1094 | - FROM ' . prefixTable('sharekeys_items') . |
|
| 1094 | + FROM ' . prefixTable('sharekeys_items'). |
|
| 1095 | 1095 | ' WHERE user_id = %i', |
| 1096 | 1096 | $userId |
| 1097 | 1097 | ); |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | // check if expected security level is reached |
| 1147 | 1147 | $dataUser = DB::queryFirstRow( |
| 1148 | 1148 | 'SELECT * |
| 1149 | - FROM ' . prefixTable('users') . ' WHERE id = %i', |
|
| 1149 | + FROM ' . prefixTable('users').' WHERE id = %i', |
|
| 1150 | 1150 | $post_user_id |
| 1151 | 1151 | ); |
| 1152 | 1152 | |
@@ -1167,8 +1167,8 @@ discard block |
||
| 1167 | 1167 | if (empty($dataUser['fonction_id']) === false) { |
| 1168 | 1168 | $data = DB::queryFirstRow( |
| 1169 | 1169 | 'SELECT complexity |
| 1170 | - FROM ' . prefixTable('roles_title') . ' |
|
| 1171 | - WHERE id IN (' . $dataUser['fonction_id'] . ') |
|
| 1170 | + FROM ' . prefixTable('roles_title').' |
|
| 1171 | + WHERE id IN (' . $dataUser['fonction_id'].') |
|
| 1172 | 1172 | ORDER BY complexity DESC' |
| 1173 | 1173 | ); |
| 1174 | 1174 | } else { |
@@ -1181,8 +1181,8 @@ discard block |
||
| 1181 | 1181 | return prepareExchangedData( |
| 1182 | 1182 | array( |
| 1183 | 1183 | 'error' => true, |
| 1184 | - 'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' . |
|
| 1185 | - $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>', |
|
| 1184 | + 'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'. |
|
| 1185 | + $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>', |
|
| 1186 | 1186 | ), |
| 1187 | 1187 | 'encode' |
| 1188 | 1188 | ); |
@@ -1286,14 +1286,14 @@ discard block |
||
| 1286 | 1286 | // Get data about user |
| 1287 | 1287 | $dataUser = DB::queryFirstRow( |
| 1288 | 1288 | 'SELECT id, email, pw |
| 1289 | - FROM ' . prefixTable('users') . ' |
|
| 1289 | + FROM ' . prefixTable('users').' |
|
| 1290 | 1290 | WHERE login = %s', |
| 1291 | 1291 | $post_login |
| 1292 | 1292 | ); |
| 1293 | 1293 | } else { |
| 1294 | 1294 | $dataUser = DB::queryFirstRow( |
| 1295 | 1295 | 'SELECT id, login, email, pw |
| 1296 | - FROM ' . prefixTable('users') . ' |
|
| 1296 | + FROM ' . prefixTable('users').' |
|
| 1297 | 1297 | WHERE id = %i', |
| 1298 | 1298 | $post_id |
| 1299 | 1299 | ); |
@@ -1347,7 +1347,7 @@ discard block |
||
| 1347 | 1347 | // Check if token already used |
| 1348 | 1348 | $dataToken = DB::queryFirstRow( |
| 1349 | 1349 | 'SELECT end_timestamp, reason |
| 1350 | - FROM ' . prefixTable('tokens') . ' |
|
| 1350 | + FROM ' . prefixTable('tokens').' |
|
| 1351 | 1351 | WHERE token = %s AND user_id = %i', |
| 1352 | 1352 | $post_token, |
| 1353 | 1353 | $dataUser['id'] |
@@ -1358,11 +1358,11 @@ discard block |
||
| 1358 | 1358 | return prepareExchangedData( |
| 1359 | 1359 | array( |
| 1360 | 1360 | 'error' => true, |
| 1361 | - 'message' => 'TOKEN already used',//$lang->get('no_email_set'), |
|
| 1361 | + 'message' => 'TOKEN already used', //$lang->get('no_email_set'), |
|
| 1362 | 1362 | ), |
| 1363 | 1363 | 'encode' |
| 1364 | 1364 | ); |
| 1365 | - } elseif(DB::count() === 0) { |
|
| 1365 | + } elseif (DB::count() === 0) { |
|
| 1366 | 1366 | // Store token for this action |
| 1367 | 1367 | DB::insert( |
| 1368 | 1368 | prefixTable('tokens'), |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | 'email' => $dataUser['email'], |
| 1425 | 1425 | 'email_result' => str_replace( |
| 1426 | 1426 | '#email#', |
| 1427 | - '<b>' . obfuscateEmail($dataUser['email']) . '</b>', |
|
| 1427 | + '<b>'.obfuscateEmail($dataUser['email']).'</b>', |
|
| 1428 | 1428 | addslashes($lang->get('admin_email_result_ok')) |
| 1429 | 1429 | ), |
| 1430 | 1430 | ), |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | 'email' => $dataUser['email'], |
| 1441 | 1441 | 'email_result' => str_replace( |
| 1442 | 1442 | '#email#', |
| 1443 | - '<b>' . obfuscateEmail($dataUser['email']) . '</b>', |
|
| 1443 | + '<b>'.obfuscateEmail($dataUser['email']).'</b>', |
|
| 1444 | 1444 | addslashes($lang->get('admin_email_result_ok')) |
| 1445 | 1445 | ), |
| 1446 | 1446 | ), |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | |
| 1458 | 1458 | if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) { |
| 1459 | 1459 | $row = DB::queryFirstRow( |
| 1460 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', |
|
| 1460 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', |
|
| 1461 | 1461 | 'cron', |
| 1462 | 1462 | 'sending_emails' |
| 1463 | 1463 | ); |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) { |
| 1466 | 1466 | $rows = DB::query( |
| 1467 | 1467 | 'SELECT * |
| 1468 | - FROM ' . prefixTable('emails') . |
|
| 1468 | + FROM ' . prefixTable('emails'). |
|
| 1469 | 1469 | ' WHERE status != %s', |
| 1470 | 1470 | 'sent' |
| 1471 | 1471 | ); |
@@ -1517,8 +1517,8 @@ discard block |
||
| 1517 | 1517 | $arr_html = array(); |
| 1518 | 1518 | $rows = DB::query( |
| 1519 | 1519 | 'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted |
| 1520 | - FROM ' . prefixTable('log_items') . ' AS l |
|
| 1521 | - RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id) |
|
| 1520 | + FROM ' . prefixTable('log_items').' AS l |
|
| 1521 | + RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id) |
|
| 1522 | 1522 | WHERE l.action = %s AND l.id_user = %i |
| 1523 | 1523 | ORDER BY l.date DESC |
| 1524 | 1524 | LIMIT 0, 100', |
@@ -1550,7 +1550,7 @@ discard block |
||
| 1550 | 1550 | if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true |
| 1551 | 1551 | && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1) |
| 1552 | 1552 | ) { |
| 1553 | - DB::query('SELECT * FROM ' . prefixTable('suggestion')); |
|
| 1553 | + DB::query('SELECT * FROM '.prefixTable('suggestion')); |
|
| 1554 | 1554 | $nb_suggestions_waiting = DB::count(); |
| 1555 | 1555 | } |
| 1556 | 1556 | |
@@ -1585,13 +1585,13 @@ discard block |
||
| 1585 | 1585 | if ($data === 'stat_languages') { |
| 1586 | 1586 | $tmp = ''; |
| 1587 | 1587 | foreach ($stats_data[$data] as $key => $value) { |
| 1588 | - $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value; |
|
| 1588 | + $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value; |
|
| 1589 | 1589 | } |
| 1590 | 1590 | $statsToSend[$data] = $tmp; |
| 1591 | 1591 | } elseif ($data === 'stat_country') { |
| 1592 | 1592 | $tmp = ''; |
| 1593 | 1593 | foreach ($stats_data[$data] as $key => $value) { |
| 1594 | - $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value; |
|
| 1594 | + $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value; |
|
| 1595 | 1595 | } |
| 1596 | 1596 | $statsToSend[$data] = $tmp; |
| 1597 | 1597 | } else { |
@@ -1678,7 +1678,7 @@ discard block |
||
| 1678 | 1678 | $url_found = $value; |
| 1679 | 1679 | if (empty($url_found) === false) { |
| 1680 | 1680 | $tmp = parse_url($url_found); |
| 1681 | - $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : ''); |
|
| 1681 | + $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : ''); |
|
| 1682 | 1682 | $value = $anonym_url; |
| 1683 | 1683 | } else { |
| 1684 | 1684 | $value = ''; |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | $teampass_errors = ''; |
| 1709 | 1709 | $rows = DB::query( |
| 1710 | 1710 | 'SELECT label, date AS error_date |
| 1711 | - FROM ' . prefixTable('log_system') . " |
|
| 1711 | + FROM ' . prefixTable('log_system')." |
|
| 1712 | 1712 | WHERE `type` LIKE 'error' |
| 1713 | 1713 | ORDER BY `date` DESC |
| 1714 | 1714 | LIMIT 0, 10" |
@@ -1716,9 +1716,9 @@ discard block |
||
| 1716 | 1716 | if (DB::count() > 0) { |
| 1717 | 1717 | foreach ($rows as $record) { |
| 1718 | 1718 | if (empty($teampass_errors) === true) { |
| 1719 | - $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label']; |
|
| 1719 | + $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label']; |
|
| 1720 | 1720 | } else { |
| 1721 | - $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label']; |
|
| 1721 | + $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label']; |
|
| 1722 | 1722 | } |
| 1723 | 1723 | } |
| 1724 | 1724 | } |
@@ -1730,7 +1730,7 @@ discard block |
||
| 1730 | 1730 | |
| 1731 | 1731 | // Now prepare text |
| 1732 | 1732 | $txt = '### Page on which it happened |
| 1733 | -' . $data['current_page'] . ' |
|
| 1733 | +' . $data['current_page'].' |
|
| 1734 | 1734 | |
| 1735 | 1735 | ### Steps to reproduce |
| 1736 | 1736 | 1. |
@@ -1745,39 +1745,39 @@ discard block |
||
| 1745 | 1745 | Tell us what happens instead |
| 1746 | 1746 | |
| 1747 | 1747 | ### Server configuration |
| 1748 | -**Operating system**: ' . php_uname() . ' |
|
| 1748 | +**Operating system**: ' . php_uname().' |
|
| 1749 | 1749 | |
| 1750 | -**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . ' |
|
| 1750 | +**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].' |
|
| 1751 | 1751 | |
| 1752 | -**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . ' |
|
| 1752 | +**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).' |
|
| 1753 | 1753 | |
| 1754 | -**PHP version:** ' . PHP_VERSION . ' |
|
| 1754 | +**PHP version:** ' . PHP_VERSION.' |
|
| 1755 | 1755 | |
| 1756 | -**Teampass version:** ' . TP_VERSION . '.' . TP_VERSION_MINOR . ' |
|
| 1756 | +**Teampass version:** ' . TP_VERSION.'.'.TP_VERSION_MINOR.' |
|
| 1757 | 1757 | |
| 1758 | 1758 | **Teampass configuration variables:** |
| 1759 | 1759 | ``` |
| 1760 | -' . $list_of_options . ' |
|
| 1760 | +' . $list_of_options.' |
|
| 1761 | 1761 | ``` |
| 1762 | 1762 | |
| 1763 | 1763 | **Updated from an older Teampass or fresh install:** |
| 1764 | 1764 | |
| 1765 | 1765 | ### Client configuration |
| 1766 | 1766 | |
| 1767 | -**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . ' |
|
| 1767 | +**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].' |
|
| 1768 | 1768 | |
| 1769 | -**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits |
|
| 1769 | +**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits |
|
| 1770 | 1770 | |
| 1771 | 1771 | ### Logs |
| 1772 | 1772 | |
| 1773 | 1773 | #### Web server error log |
| 1774 | 1774 | ``` |
| 1775 | -' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ') |
|
| 1775 | +' . $err['message'].' - '.$err['file'].' ('.$err['line'].') |
|
| 1776 | 1776 | ``` |
| 1777 | 1777 | |
| 1778 | 1778 | #### Teampass 10 last system errors |
| 1779 | 1779 | ``` |
| 1780 | -' . $teampass_errors . ' |
|
| 1780 | +' . $teampass_errors.' |
|
| 1781 | 1781 | ``` |
| 1782 | 1782 | |
| 1783 | 1783 | #### Log from the web-browser developer console (CTRL + SHIFT + i) |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | // Check if user exists |
| 1820 | 1820 | $userInfo = DB::queryFirstRow( |
| 1821 | 1821 | 'SELECT public_key, private_key, pw, auth_type |
| 1822 | - FROM ' . prefixTable('users') . ' |
|
| 1822 | + FROM ' . prefixTable('users').' |
|
| 1823 | 1823 | WHERE id = %i', |
| 1824 | 1824 | $post_user_id |
| 1825 | 1825 | ); |
@@ -1828,9 +1828,9 @@ discard block |
||
| 1828 | 1828 | // Get one item |
| 1829 | 1829 | $currentUserKey = DB::queryFirstRow( |
| 1830 | 1830 | 'SELECT object_id, share_key, increment_id |
| 1831 | - FROM ' . prefixTable('sharekeys_items') . ' AS si |
|
| 1832 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = si.object_id) |
|
| 1833 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON (i.id_tree = nt.id) |
|
| 1831 | + FROM ' . prefixTable('sharekeys_items').' AS si |
|
| 1832 | + INNER JOIN ' . prefixTable('items').' AS i ON (i.id = si.object_id) |
|
| 1833 | + INNER JOIN ' . prefixTable('nested_tree').' AS nt ON (i.id_tree = nt.id) |
|
| 1834 | 1834 | WHERE user_id = %i AND nt.personal_folder = %i', |
| 1835 | 1835 | $post_user_id, |
| 1836 | 1836 | 0 |
@@ -1949,7 +1949,7 @@ discard block |
||
| 1949 | 1949 | // Get user info |
| 1950 | 1950 | $userData = DB::queryFirstRow( |
| 1951 | 1951 | 'SELECT private_key |
| 1952 | - FROM ' . prefixTable('users') . ' |
|
| 1952 | + FROM ' . prefixTable('users').' |
|
| 1953 | 1953 | WHERE id = %i', |
| 1954 | 1954 | $post_user_id |
| 1955 | 1955 | ); |
@@ -2031,7 +2031,7 @@ discard block |
||
| 2031 | 2031 | // Get user info |
| 2032 | 2032 | $userData = DB::queryFirstRow( |
| 2033 | 2033 | 'SELECT email, auth_type, login |
| 2034 | - FROM ' . prefixTable('users') . ' |
|
| 2034 | + FROM ' . prefixTable('users').' |
|
| 2035 | 2035 | WHERE id = %i', |
| 2036 | 2036 | $post_user_id |
| 2037 | 2037 | ); |
@@ -2129,7 +2129,7 @@ discard block |
||
| 2129 | 2129 | // Get user info |
| 2130 | 2130 | $userData = DB::queryFirstRow( |
| 2131 | 2131 | 'SELECT email, auth_type, login |
| 2132 | - FROM ' . prefixTable('users') . ' |
|
| 2132 | + FROM ' . prefixTable('users').' |
|
| 2133 | 2133 | WHERE id = %i', |
| 2134 | 2134 | $userId |
| 2135 | 2135 | ); |
@@ -2195,7 +2195,7 @@ discard block |
||
| 2195 | 2195 | // Check if user exists |
| 2196 | 2196 | DB::queryFirstRow( |
| 2197 | 2197 | 'SELECT * |
| 2198 | - FROM ' . prefixTable('users') . ' |
|
| 2198 | + FROM ' . prefixTable('users').' |
|
| 2199 | 2199 | WHERE id = %i', |
| 2200 | 2200 | $post_user_id |
| 2201 | 2201 | ); |
@@ -2265,7 +2265,7 @@ discard block |
||
| 2265 | 2265 | // Check if user exists |
| 2266 | 2266 | $userInfo = DB::queryFirstRow( |
| 2267 | 2267 | 'SELECT public_key |
| 2268 | - FROM ' . prefixTable('users') . ' |
|
| 2268 | + FROM ' . prefixTable('users').' |
|
| 2269 | 2269 | WHERE id = %i', |
| 2270 | 2270 | $post_user_id |
| 2271 | 2271 | ); |
@@ -2413,15 +2413,15 @@ discard block |
||
| 2413 | 2413 | // Loop on items |
| 2414 | 2414 | $rows = DB::query( |
| 2415 | 2415 | 'SELECT id, pw |
| 2416 | - FROM ' . prefixTable('items') . ' |
|
| 2416 | + FROM ' . prefixTable('items').' |
|
| 2417 | 2417 | WHERE perso = 0 |
| 2418 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2418 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2419 | 2419 | ); |
| 2420 | 2420 | foreach ($rows as $record) { |
| 2421 | 2421 | // Get itemKey from current user |
| 2422 | 2422 | $currentUserKey = DB::queryFirstRow( |
| 2423 | 2423 | 'SELECT share_key, increment_id |
| 2424 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2424 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2425 | 2425 | WHERE object_id = %i AND user_id = %i', |
| 2426 | 2426 | $record['id'], |
| 2427 | 2427 | $session->get('user-id') |
@@ -2453,7 +2453,7 @@ discard block |
||
| 2453 | 2453 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2454 | 2454 | $currentUserKey = DB::queryFirstRow( |
| 2455 | 2455 | 'SELECT increment_id |
| 2456 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2456 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2457 | 2457 | WHERE object_id = %i AND user_id = %i', |
| 2458 | 2458 | $record['id'], |
| 2459 | 2459 | $post_user_id |
@@ -2486,7 +2486,7 @@ discard block |
||
| 2486 | 2486 | // SHould we change step? |
| 2487 | 2487 | DB::query( |
| 2488 | 2488 | 'SELECT * |
| 2489 | - FROM ' . prefixTable('items') . ' |
|
| 2489 | + FROM ' . prefixTable('items').' |
|
| 2490 | 2490 | WHERE perso = 0' |
| 2491 | 2491 | ); |
| 2492 | 2492 | |
@@ -2511,15 +2511,15 @@ discard block |
||
| 2511 | 2511 | // Loop on logs |
| 2512 | 2512 | $rows = DB::query( |
| 2513 | 2513 | 'SELECT increment_id |
| 2514 | - FROM ' . prefixTable('log_items') . ' |
|
| 2514 | + FROM ' . prefixTable('log_items').' |
|
| 2515 | 2515 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes" |
| 2516 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2516 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2517 | 2517 | ); |
| 2518 | 2518 | foreach ($rows as $record) { |
| 2519 | 2519 | // Get itemKey from current user |
| 2520 | 2520 | $currentUserKey = DB::queryFirstRow( |
| 2521 | 2521 | 'SELECT share_key |
| 2522 | - FROM ' . prefixTable('sharekeys_logs') . ' |
|
| 2522 | + FROM ' . prefixTable('sharekeys_logs').' |
|
| 2523 | 2523 | WHERE object_id = %i AND user_id = %i', |
| 2524 | 2524 | $record['increment_id'], |
| 2525 | 2525 | $session->get('user-id') |
@@ -2551,7 +2551,7 @@ discard block |
||
| 2551 | 2551 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2552 | 2552 | $currentUserKey = DB::queryFirstRow( |
| 2553 | 2553 | 'SELECT increment_id |
| 2554 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2554 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2555 | 2555 | WHERE object_id = %i AND user_id = %i', |
| 2556 | 2556 | $record['id'], |
| 2557 | 2557 | $post_user_id |
@@ -2573,7 +2573,7 @@ discard block |
||
| 2573 | 2573 | // SHould we change step? |
| 2574 | 2574 | DB::query( |
| 2575 | 2575 | 'SELECT increment_id |
| 2576 | - FROM ' . prefixTable('log_items') . ' |
|
| 2576 | + FROM ' . prefixTable('log_items').' |
|
| 2577 | 2577 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"' |
| 2578 | 2578 | ); |
| 2579 | 2579 | |
@@ -2598,15 +2598,15 @@ discard block |
||
| 2598 | 2598 | // Loop on fields |
| 2599 | 2599 | $rows = DB::query( |
| 2600 | 2600 | 'SELECT id |
| 2601 | - FROM ' . prefixTable('categories_items') . ' |
|
| 2601 | + FROM ' . prefixTable('categories_items').' |
|
| 2602 | 2602 | WHERE encryption_type = "teampass_aes" |
| 2603 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2603 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2604 | 2604 | ); |
| 2605 | 2605 | foreach ($rows as $record) { |
| 2606 | 2606 | // Get itemKey from current user |
| 2607 | 2607 | $currentUserKey = DB::queryFirstRow( |
| 2608 | 2608 | 'SELECT share_key |
| 2609 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 2609 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 2610 | 2610 | WHERE object_id = %i AND user_id = %i', |
| 2611 | 2611 | $record['id'], |
| 2612 | 2612 | $session->get('user-id') |
@@ -2638,7 +2638,7 @@ discard block |
||
| 2638 | 2638 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2639 | 2639 | $currentUserKey = DB::queryFirstRow( |
| 2640 | 2640 | 'SELECT increment_id |
| 2641 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2641 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2642 | 2642 | WHERE object_id = %i AND user_id = %i', |
| 2643 | 2643 | $record['id'], |
| 2644 | 2644 | $post_user_id |
@@ -2660,7 +2660,7 @@ discard block |
||
| 2660 | 2660 | // SHould we change step? |
| 2661 | 2661 | DB::query( |
| 2662 | 2662 | 'SELECT * |
| 2663 | - FROM ' . prefixTable('categories_items') . ' |
|
| 2663 | + FROM ' . prefixTable('categories_items').' |
|
| 2664 | 2664 | WHERE encryption_type = "teampass_aes"' |
| 2665 | 2665 | ); |
| 2666 | 2666 | |
@@ -2685,14 +2685,14 @@ discard block |
||
| 2685 | 2685 | // Loop on suggestions |
| 2686 | 2686 | $rows = DB::query( |
| 2687 | 2687 | 'SELECT id |
| 2688 | - FROM ' . prefixTable('suggestion') . ' |
|
| 2689 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2688 | + FROM ' . prefixTable('suggestion').' |
|
| 2689 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2690 | 2690 | ); |
| 2691 | 2691 | foreach ($rows as $record) { |
| 2692 | 2692 | // Get itemKey from current user |
| 2693 | 2693 | $currentUserKey = DB::queryFirstRow( |
| 2694 | 2694 | 'SELECT share_key |
| 2695 | - FROM ' . prefixTable('sharekeys_suggestions') . ' |
|
| 2695 | + FROM ' . prefixTable('sharekeys_suggestions').' |
|
| 2696 | 2696 | WHERE object_id = %i AND user_id = %i', |
| 2697 | 2697 | $record['id'], |
| 2698 | 2698 | $session->get('user-id') |
@@ -2724,7 +2724,7 @@ discard block |
||
| 2724 | 2724 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2725 | 2725 | $currentUserKey = DB::queryFirstRow( |
| 2726 | 2726 | 'SELECT increment_id |
| 2727 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2727 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2728 | 2728 | WHERE object_id = %i AND user_id = %i', |
| 2729 | 2729 | $record['id'], |
| 2730 | 2730 | $post_user_id |
@@ -2770,15 +2770,15 @@ discard block |
||
| 2770 | 2770 | // Loop on files |
| 2771 | 2771 | $rows = DB::query( |
| 2772 | 2772 | 'SELECT id |
| 2773 | - FROM ' . prefixTable('files') . ' |
|
| 2774 | - WHERE status = "' . TP_ENCRYPTION_NAME . '" |
|
| 2775 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2773 | + FROM ' . prefixTable('files').' |
|
| 2774 | + WHERE status = "' . TP_ENCRYPTION_NAME.'" |
|
| 2775 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2776 | 2776 | ); //aes_encryption |
| 2777 | 2777 | foreach ($rows as $record) { |
| 2778 | 2778 | // Get itemKey from current user |
| 2779 | 2779 | $currentUserKey = DB::queryFirstRow( |
| 2780 | 2780 | 'SELECT share_key |
| 2781 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 2781 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 2782 | 2782 | WHERE object_id = %i AND user_id = %i', |
| 2783 | 2783 | $record['id'], |
| 2784 | 2784 | $session->get('user-id') |
@@ -2810,7 +2810,7 @@ discard block |
||
| 2810 | 2810 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2811 | 2811 | $currentUserKey = DB::queryFirstRow( |
| 2812 | 2812 | 'SELECT increment_id |
| 2813 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2813 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2814 | 2814 | WHERE object_id = %i AND user_id = %i', |
| 2815 | 2815 | $record['id'], |
| 2816 | 2816 | $post_user_id |
@@ -2832,8 +2832,8 @@ discard block |
||
| 2832 | 2832 | // SHould we change step? |
| 2833 | 2833 | DB::query( |
| 2834 | 2834 | 'SELECT * |
| 2835 | - FROM ' . prefixTable('files') . ' |
|
| 2836 | - WHERE status = "' . TP_ENCRYPTION_NAME . '"' |
|
| 2835 | + FROM ' . prefixTable('files').' |
|
| 2836 | + WHERE status = "' . TP_ENCRYPTION_NAME.'"' |
|
| 2837 | 2837 | ); |
| 2838 | 2838 | |
| 2839 | 2839 | $next_start = (int) $post_start + (int) $post_length; |
@@ -2866,9 +2866,9 @@ discard block |
||
| 2866 | 2866 | if (count($session->get('user-personal_folders')) > 0) { |
| 2867 | 2867 | $rows = DB::query( |
| 2868 | 2868 | 'SELECT id, pw |
| 2869 | - FROM ' . prefixTable('items') . ' |
|
| 2869 | + FROM ' . prefixTable('items').' |
|
| 2870 | 2870 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s |
| 2871 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
| 2871 | + LIMIT ' . $post_start.', '.$post_length, |
|
| 2872 | 2872 | $session->get('user-personal_folders'), |
| 2873 | 2873 | "defuse" |
| 2874 | 2874 | ); |
@@ -2876,7 +2876,7 @@ discard block |
||
| 2876 | 2876 | // Get itemKey from current user |
| 2877 | 2877 | $currentUserKey = DB::queryFirstRow( |
| 2878 | 2878 | 'SELECT share_key, increment_id |
| 2879 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2879 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2880 | 2880 | WHERE object_id = %i AND user_id = %i', |
| 2881 | 2881 | $record['id'], |
| 2882 | 2882 | $session->get('user-id') |
@@ -2903,7 +2903,7 @@ discard block |
||
| 2903 | 2903 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2904 | 2904 | $currentUserKey = DB::queryFirstRow( |
| 2905 | 2905 | 'SELECT increment_id |
| 2906 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2906 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2907 | 2907 | WHERE object_id = %i AND user_id = %i', |
| 2908 | 2908 | $record['id'], |
| 2909 | 2909 | $post_user_id |
@@ -2926,7 +2926,7 @@ discard block |
||
| 2926 | 2926 | // SHould we change step? |
| 2927 | 2927 | DB::query( |
| 2928 | 2928 | 'SELECT * |
| 2929 | - FROM ' . prefixTable('items') . ' |
|
| 2929 | + FROM ' . prefixTable('items').' |
|
| 2930 | 2930 | WHERE perso = 0' |
| 2931 | 2931 | ); |
| 2932 | 2932 | |
@@ -2954,7 +2954,7 @@ discard block |
||
| 2954 | 2954 | // Check if user exists |
| 2955 | 2955 | $userInfo = DB::queryFirstRow( |
| 2956 | 2956 | 'SELECT public_key, encrypted_psk |
| 2957 | - FROM ' . prefixTable('users') . ' |
|
| 2957 | + FROM ' . prefixTable('users').' |
|
| 2958 | 2958 | WHERE id = %i', |
| 2959 | 2959 | $post_user_id |
| 2960 | 2960 | ); |
@@ -2980,7 +2980,7 @@ discard block |
||
| 2980 | 2980 | if ($post_counterItemsToTreat === -1) { |
| 2981 | 2981 | DB::query( |
| 2982 | 2982 | 'SELECT id |
| 2983 | - FROM ' . prefixTable('items') . ' |
|
| 2983 | + FROM ' . prefixTable('items').' |
|
| 2984 | 2984 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s', |
| 2985 | 2985 | $session->get('user-personal_folders'), |
| 2986 | 2986 | 'teampass_aes' |
@@ -2993,7 +2993,7 @@ discard block |
||
| 2993 | 2993 | // Loop on persoanl items |
| 2994 | 2994 | $rows = DB::query( |
| 2995 | 2995 | 'SELECT id, pw |
| 2996 | - FROM ' . prefixTable('items') . ' |
|
| 2996 | + FROM ' . prefixTable('items').' |
|
| 2997 | 2997 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s |
| 2998 | 2998 | LIMIT ' . $post_length, |
| 2999 | 2999 | $session->get('user-personal_folders'), |
@@ -3037,7 +3037,7 @@ discard block |
||
| 3037 | 3037 | // Loop on files |
| 3038 | 3038 | $rows = DB::query( |
| 3039 | 3039 | 'SELECT id, file |
| 3040 | - FROM ' . prefixTable('files') . ' |
|
| 3040 | + FROM ' . prefixTable('files').' |
|
| 3041 | 3041 | WHERE status != %s |
| 3042 | 3042 | AND id_item = %i', |
| 3043 | 3043 | TP_ENCRYPTION_NAME, |
@@ -3048,13 +3048,13 @@ discard block |
||
| 3048 | 3048 | // Now decrypt the file |
| 3049 | 3049 | prepareFileWithDefuse( |
| 3050 | 3050 | 'decrypt', |
| 3051 | - $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'], |
|
| 3052 | - $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete', |
|
| 3051 | + $SETTINGS['path_to_upload_folder'].'/'.$record2['file'], |
|
| 3052 | + $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete', |
|
| 3053 | 3053 | $post_user_psk |
| 3054 | 3054 | ); |
| 3055 | 3055 | |
| 3056 | 3056 | // Encrypt the file |
| 3057 | - $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']); |
|
| 3057 | + $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']); |
|
| 3058 | 3058 | |
| 3059 | 3059 | DB::update( |
| 3060 | 3060 | prefixTable('files'), |
@@ -3077,7 +3077,7 @@ discard block |
||
| 3077 | 3077 | ); |
| 3078 | 3078 | |
| 3079 | 3079 | // Unlink original file |
| 3080 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']); |
|
| 3080 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']); |
|
| 3081 | 3081 | } |
| 3082 | 3082 | } |
| 3083 | 3083 | |
@@ -3085,7 +3085,7 @@ discard block |
||
| 3085 | 3085 | $next_start = (int) $post_start + (int) $post_length; |
| 3086 | 3086 | DB::query( |
| 3087 | 3087 | 'SELECT id |
| 3088 | - FROM ' . prefixTable('items') . ' |
|
| 3088 | + FROM ' . prefixTable('items').' |
|
| 3089 | 3089 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s', |
| 3090 | 3090 | $session->get('user-personal_folders'), |
| 3091 | 3091 | 'teampass_aes' |
@@ -3155,7 +3155,7 @@ discard block |
||
| 3155 | 3155 | // Get user info |
| 3156 | 3156 | $userData = DB::queryFirstRow( |
| 3157 | 3157 | 'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time, personal_items_migrated |
| 3158 | - FROM ' . prefixTable('users') . ' |
|
| 3158 | + FROM ' . prefixTable('users').' |
|
| 3159 | 3159 | WHERE id = %i', |
| 3160 | 3160 | $post_user_id |
| 3161 | 3161 | ); |
@@ -3202,7 +3202,7 @@ discard block |
||
| 3202 | 3202 | // Get user info |
| 3203 | 3203 | $userData = DB::queryFirstRow( |
| 3204 | 3204 | 'SELECT auth_type, login, private_key |
| 3205 | - FROM ' . prefixTable('users') . ' |
|
| 3205 | + FROM ' . prefixTable('users').' |
|
| 3206 | 3206 | WHERE id = %i', |
| 3207 | 3207 | $post_user_id |
| 3208 | 3208 | ); |
@@ -3252,7 +3252,7 @@ discard block |
||
| 3252 | 3252 | return prepareExchangedData( |
| 3253 | 3253 | array( |
| 3254 | 3254 | 'error' => false, |
| 3255 | - 'message' => $lang->get('done'),'', |
|
| 3255 | + 'message' => $lang->get('done'), '', |
|
| 3256 | 3256 | ), |
| 3257 | 3257 | 'encode' |
| 3258 | 3258 | ); |
@@ -3301,7 +3301,7 @@ discard block |
||
| 3301 | 3301 | // Get user info |
| 3302 | 3302 | $userData = DB::queryFirstRow( |
| 3303 | 3303 | 'SELECT u.auth_type, u.login, u.private_key, u.special |
| 3304 | - FROM ' . prefixTable('users') . ' AS u |
|
| 3304 | + FROM ' . prefixTable('users').' AS u |
|
| 3305 | 3305 | WHERE u.id = %i', |
| 3306 | 3306 | $post_user_id |
| 3307 | 3307 | ); |
@@ -3337,7 +3337,7 @@ discard block |
||
| 3337 | 3337 | return prepareExchangedData( |
| 3338 | 3338 | array( |
| 3339 | 3339 | 'error' => false, |
| 3340 | - 'message' => $lang->get('done'),'', |
|
| 3340 | + 'message' => $lang->get('done'), '', |
|
| 3341 | 3341 | ), |
| 3342 | 3342 | 'encode' |
| 3343 | 3343 | ); |
@@ -3358,8 +3358,8 @@ discard block |
||
| 3358 | 3358 | // Get one itemKey from current user |
| 3359 | 3359 | $currentUserKey = DB::queryFirstRow( |
| 3360 | 3360 | 'SELECT ski.share_key, ski.increment_id, l.id_user |
| 3361 | - FROM ' . prefixTable('sharekeys_items') . ' AS ski |
|
| 3362 | - INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item |
|
| 3361 | + FROM ' . prefixTable('sharekeys_items').' AS ski |
|
| 3362 | + INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item |
|
| 3363 | 3363 | WHERE ski.user_id = %i |
| 3364 | 3364 | ORDER BY RAND() |
| 3365 | 3365 | LIMIT 1', |
@@ -3426,8 +3426,8 @@ discard block |
||
| 3426 | 3426 | 'process_type' => 'create_user_keys', |
| 3427 | 3427 | 'arguments' => json_encode([ |
| 3428 | 3428 | 'new_user_id' => (int) $post_user_id, |
| 3429 | - 'new_user_pwd' => cryption($post_previous_pwd, '','encrypt')['string'], |
|
| 3430 | - 'new_user_private_key' => cryption($validPreviousKey['private_key'], '','encrypt')['string'], |
|
| 3429 | + 'new_user_pwd' => cryption($post_previous_pwd, '', 'encrypt')['string'], |
|
| 3430 | + 'new_user_private_key' => cryption($validPreviousKey['private_key'], '', 'encrypt')['string'], |
|
| 3431 | 3431 | 'send_email' => 0, |
| 3432 | 3432 | 'otp_provided_new_value' => 0, |
| 3433 | 3433 | 'user_self_change' => 1, |
@@ -3496,7 +3496,7 @@ discard block |
||
| 3496 | 3496 | id, |
| 3497 | 3497 | private_key, |
| 3498 | 3498 | created_at |
| 3499 | - FROM " . prefixTable('user_private_keys') . " |
|
| 3499 | + FROM " . prefixTable('user_private_keys')." |
|
| 3500 | 3500 | WHERE user_id = %i |
| 3501 | 3501 | ORDER BY created_at DESC, id DESC", |
| 3502 | 3502 | $userId |
@@ -3518,9 +3518,9 @@ discard block |
||
| 3518 | 3518 | // Select one personal item share_key to test decryption |
| 3519 | 3519 | $currentUserItemKey = DB::queryFirstRow( |
| 3520 | 3520 | 'SELECT si.share_key, si.increment_id, l.id_user, i.perso |
| 3521 | - FROM ' . prefixTable('sharekeys_items') . ' AS si |
|
| 3522 | - INNER JOIN ' . prefixTable('log_items') . ' AS l ON si.object_id = l.id_item |
|
| 3523 | - INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = l.id_item |
|
| 3521 | + FROM ' . prefixTable('sharekeys_items').' AS si |
|
| 3522 | + INNER JOIN ' . prefixTable('log_items').' AS l ON si.object_id = l.id_item |
|
| 3523 | + INNER JOIN ' . prefixTable('items').' AS i ON i.id = l.id_item |
|
| 3524 | 3524 | WHERE si.user_id = %i AND i.perso = 1 AND si.share_key != "" |
| 3525 | 3525 | ORDER BY RAND() |
| 3526 | 3526 | LIMIT 1', |
@@ -3571,7 +3571,7 @@ discard block |
||
| 3571 | 3571 | $session->get('user-id') |
| 3572 | 3572 | ); |
| 3573 | 3573 | // Return data |
| 3574 | - return '[{"new_value":"' . $session->get('user-session_duration') . '"}]'; |
|
| 3574 | + return '[{"new_value":"'.$session->get('user-session_duration').'"}]'; |
|
| 3575 | 3575 | } |
| 3576 | 3576 | |
| 3577 | 3577 | return '[{"new_value":"expired"}]'; |
@@ -3621,8 +3621,8 @@ discard block |
||
| 3621 | 3621 | { |
| 3622 | 3622 | $personalItems = DB::query( |
| 3623 | 3623 | 'SELECT i.id, i.pw, s.share_key, s.increment_id |
| 3624 | - FROM ' . prefixTable('items') . ' i |
|
| 3625 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' s ON i.id = s.object_id |
|
| 3624 | + FROM ' . prefixTable('items').' i |
|
| 3625 | + INNER JOIN ' . prefixTable('sharekeys_items').' s ON i.id = s.object_id |
|
| 3626 | 3626 | WHERE i.perso = %i |
| 3627 | 3627 | AND s.user_id = %i', |
| 3628 | 3628 | 1, |
@@ -3677,8 +3677,8 @@ discard block |
||
| 3677 | 3677 | if ($skipPasswordChange === true) { |
| 3678 | 3678 | // Remove all sharekeys for personal items |
| 3679 | 3679 | DB::query( |
| 3680 | - 'UPDATE ' . prefixTable('sharekeys_items') . ' AS ski |
|
| 3681 | - INNER JOIN ' . prefixTable('items') . ' AS i ON ski.object_id = i.id |
|
| 3680 | + 'UPDATE '.prefixTable('sharekeys_items').' AS ski |
|
| 3681 | + INNER JOIN ' . prefixTable('items').' AS i ON ski.object_id = i.id |
|
| 3682 | 3682 | SET ski.share_key = "" |
| 3683 | 3683 | WHERE i.perso = 1 |
| 3684 | 3684 | AND ski.user_id = %i', |
@@ -3687,8 +3687,8 @@ discard block |
||
| 3687 | 3687 | |
| 3688 | 3688 | // Remove all sharekeys for personal files |
| 3689 | 3689 | DB::query( |
| 3690 | - 'UPDATE ' . prefixTable('sharekeys_files') . ' AS skf |
|
| 3691 | - INNER JOIN ' . prefixTable('items') . ' AS i ON skf.object_id = i.id |
|
| 3690 | + 'UPDATE '.prefixTable('sharekeys_files').' AS skf |
|
| 3691 | + INNER JOIN ' . prefixTable('items').' AS i ON skf.object_id = i.id |
|
| 3692 | 3692 | SET skf.share_key = "" |
| 3693 | 3693 | WHERE i.perso = 1 |
| 3694 | 3694 | AND skf.user_id = %i', |
@@ -3697,8 +3697,8 @@ discard block |
||
| 3697 | 3697 | |
| 3698 | 3698 | // Remove all sharekeys for personal fields |
| 3699 | 3699 | DB::query( |
| 3700 | - 'UPDATE ' . prefixTable('sharekeys_fields') . ' AS skf |
|
| 3701 | - INNER JOIN ' . prefixTable('items') . ' AS i ON skf.object_id = i.id |
|
| 3700 | + 'UPDATE '.prefixTable('sharekeys_fields').' AS skf |
|
| 3701 | + INNER JOIN ' . prefixTable('items').' AS i ON skf.object_id = i.id |
|
| 3702 | 3702 | SET skf.share_key = "" |
| 3703 | 3703 | WHERE i.perso = 1 |
| 3704 | 3704 | AND skf.user_id = %i', |
@@ -3742,8 +3742,8 @@ discard block |
||
| 3742 | 3742 | 'process_type' => 'create_user_keys', |
| 3743 | 3743 | 'arguments' => json_encode([ |
| 3744 | 3744 | 'new_user_id' => (int) $userId, |
| 3745 | - 'new_user_pwd' => cryption($userCurrentPwd, '','encrypt')['string'], |
|
| 3746 | - 'new_user_private_key' => cryption($validPreviousKey['private_key'], '','encrypt')['string'], |
|
| 3745 | + 'new_user_pwd' => cryption($userCurrentPwd, '', 'encrypt')['string'], |
|
| 3746 | + 'new_user_private_key' => cryption($validPreviousKey['private_key'], '', 'encrypt')['string'], |
|
| 3747 | 3747 | 'send_email' => 0, |
| 3748 | 3748 | 'otp_provided_new_value' => 0, |
| 3749 | 3749 | 'user_self_change' => 1, |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === 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 | |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | break; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 136 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 137 | 137 | $return = ''; |
| 138 | 138 | |
| 139 | 139 | //Get all tables |
| 140 | 140 | $tables = array(); |
| 141 | 141 | $result = DB::query('SHOW TABLES'); |
| 142 | 142 | foreach ($result as $row) { |
| 143 | - $tables[] = $row['Tables_in_' . DB_NAME]; |
|
| 143 | + $tables[] = $row['Tables_in_'.DB_NAME]; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | //cycle through |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) { |
| 149 | 149 | $table = (is_string($table) ? $table : strval($table)); |
| 150 | 150 | // Do query |
| 151 | - $result = DB::query('SELECT * FROM ' . $table); |
|
| 151 | + $result = DB::query('SELECT * FROM '.$table); |
|
| 152 | 152 | DB::query( |
| 153 | 153 | 'SELECT * |
| 154 | 154 | FROM INFORMATION_SCHEMA.COLUMNS |
@@ -160,20 +160,20 @@ discard block |
||
| 160 | 160 | $numFields = DB::count(); |
| 161 | 161 | |
| 162 | 162 | // prepare a drop table |
| 163 | - $return .= 'DROP TABLE ' . $table . ';'; |
|
| 164 | - $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table); |
|
| 165 | - $return .= "\n\n" . strval($row2['Create Table']) . ";\n\n"; |
|
| 163 | + $return .= 'DROP TABLE '.$table.';'; |
|
| 164 | + $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table); |
|
| 165 | + $return .= "\n\n".strval($row2['Create Table']).";\n\n"; |
|
| 166 | 166 | |
| 167 | 167 | //prepare all fields and datas |
| 168 | 168 | for ($i = 0; $i < $numFields; ++$i) { |
| 169 | 169 | if (is_object($result)) { |
| 170 | 170 | while ($row = $result->fetch_row()) { |
| 171 | - $return .= 'INSERT INTO ' . $table . ' VALUES('; |
|
| 171 | + $return .= 'INSERT INTO '.$table.' VALUES('; |
|
| 172 | 172 | for ($j = 0; $j < $numFields; ++$j) { |
| 173 | 173 | $row[$j] = addslashes($row[$j]); |
| 174 | 174 | $row[$j] = preg_replace("/\n/", '\\n', $row[$j]); |
| 175 | 175 | if (isset($row[$j])) { |
| 176 | - $return .= '"' . $row[$j] . '"'; |
|
| 176 | + $return .= '"'.$row[$j].'"'; |
|
| 177 | 177 | } else { |
| 178 | 178 | $return .= 'NULL'; |
| 179 | 179 | } |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $token = GenerateCryptKey(20, false, true, true, false, true); |
| 195 | 195 | |
| 196 | 196 | //save file |
| 197 | - $filename = time() . '-' . $token . '.sql'; |
|
| 198 | - $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+'); |
|
| 197 | + $filename = time().'-'.$token.'.sql'; |
|
| 198 | + $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+'); |
|
| 199 | 199 | if ($handle !== false) { |
| 200 | 200 | //write file |
| 201 | 201 | fwrite($handle, $return); |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | // Encrypt the file |
| 208 | 208 | prepareFileWithDefuse( |
| 209 | 209 | 'encrypt', |
| 210 | - $SETTINGS['path_to_files_folder'] . '/' . $filename, |
|
| 211 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
| 210 | + $SETTINGS['path_to_files_folder'].'/'.$filename, |
|
| 211 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
| 212 | 212 | $post_option |
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | // Do clean |
| 216 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $filename); |
|
| 216 | + unlink($SETTINGS['path_to_files_folder'].'/'.$filename); |
|
| 217 | 217 | rename( |
| 218 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
| 219 | - $SETTINGS['path_to_files_folder'] . '/' . $filename |
|
| 218 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
| 219 | + $SETTINGS['path_to_files_folder'].'/'.$filename |
|
| 220 | 220 | ); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | //update LOG |
| 227 | 227 | logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login')); |
| 228 | 228 | |
| 229 | - echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]'; |
|
| 229 | + echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]'; |
|
| 230 | 230 | } |
| 231 | 231 | break; |
| 232 | 232 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | ); |
| 256 | 256 | break; |
| 257 | 257 | } |
| 258 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 258 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 259 | 259 | |
| 260 | 260 | $dataPost = explode('&', $post_option); |
| 261 | 261 | $file = htmlspecialchars($dataPost[0]); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | // Get filename from database |
| 265 | 265 | $data = DB::queryFirstRow( |
| 266 | 266 | 'SELECT valeur |
| 267 | - FROM ' . prefixTable('misc') . ' |
|
| 267 | + FROM ' . prefixTable('misc').' |
|
| 268 | 268 | WHERE increment_id = %i', |
| 269 | 269 | $file |
| 270 | 270 | ); |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | // Decrypt the file |
| 284 | 284 | $ret = prepareFileWithDefuse( |
| 285 | 285 | 'decrypt', |
| 286 | - $SETTINGS['path_to_files_folder'] . '/' . $file, |
|
| 287 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file, |
|
| 286 | + $SETTINGS['path_to_files_folder'].'/'.$file, |
|
| 287 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file, |
|
| 288 | 288 | $key |
| 289 | 289 | ); |
| 290 | 290 | |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Do clean |
| 298 | - fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS); |
|
| 299 | - $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file; |
|
| 298 | + fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS); |
|
| 299 | + $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file; |
|
| 300 | 300 | } else { |
| 301 | - $file = $SETTINGS['path_to_files_folder'] . '/' . $file; |
|
| 301 | + $file = $SETTINGS['path_to_files_folder'].'/'.$file; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | //read sql file |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | fclose($handle); |
| 316 | 316 | |
| 317 | 317 | //delete file |
| 318 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $file); |
|
| 318 | + unlink($SETTINGS['path_to_files_folder'].'/'.$file); |
|
| 319 | 319 | |
| 320 | 320 | //Show done |
| 321 | 321 | echo '[{"result":"db_restore" , "message":""}]'; |
@@ -354,8 +354,8 @@ discard block |
||
| 354 | 354 | $tablename = (is_string($tablename) ? $tablename : strval($tablename)); |
| 355 | 355 | if (substr_count($tablename, DB_PREFIX) > 0) { |
| 356 | 356 | // launch optimization quieries |
| 357 | - DB::query('ANALYZE TABLE `' . $tablename . '`'); |
|
| 358 | - DB::query('OPTIMIZE TABLE `' . $tablename . '`'); |
|
| 357 | + DB::query('ANALYZE TABLE `'.$tablename.'`'); |
|
| 358 | + DB::query('OPTIMIZE TABLE `'.$tablename.'`'); |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | //Clean up LOG_ITEMS table |
| 364 | 364 | $rows = DB::query( |
| 365 | 365 | 'SELECT id |
| 366 | - FROM ' . prefixTable('items') . ' |
|
| 366 | + FROM ' . prefixTable('items').' |
|
| 367 | 367 | ORDER BY id ASC' |
| 368 | 368 | ); |
| 369 | 369 | foreach ($rows as $item) { |
| 370 | 370 | DB::query( |
| 371 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
| 371 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
| 372 | 372 | $item['id'], |
| 373 | 373 | 'at_creation' |
| 374 | 374 | ); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | if ($counter === 0) { |
| 377 | 377 | //Create new at_creation entry |
| 378 | 378 | $rowTmp = DB::queryFirstRow( |
| 379 | - 'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC', |
|
| 379 | + 'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC', |
|
| 380 | 380 | $item['id'] |
| 381 | 381 | ); |
| 382 | 382 | DB::insert( |
@@ -406,8 +406,8 @@ discard block |
||
| 406 | 406 | echo prepareExchangedData( |
| 407 | 407 | array( |
| 408 | 408 | 'error' => false, |
| 409 | - 'message' => $lang->get('last_execution') . ' ' . |
|
| 410 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 409 | + 'message' => $lang->get('last_execution').' '. |
|
| 410 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 411 | 411 | '<i class="fas fa-check text-success ml-2"></i>', |
| 412 | 412 | ), |
| 413 | 413 | 'encode' |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | break; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 446 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 447 | 447 | updateCacheTable('reload', NULL); |
| 448 | 448 | |
| 449 | 449 | // Log |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | echo prepareExchangedData( |
| 460 | 460 | [ |
| 461 | 461 | 'error' => false, |
| 462 | - 'message' => $lang->get('last_execution') . ' ' . |
|
| 463 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 462 | + 'message' => $lang->get('last_execution').' '. |
|
| 463 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 464 | 464 | '<i class="fas fa-check text-success mr-2"></i>', |
| 465 | 465 | ], |
| 466 | 466 | 'encode' |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE)); |
| 503 | 503 | |
| 504 | 504 | // generate new saltkey |
| 505 | - $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time(); |
|
| 505 | + $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time(); |
|
| 506 | 506 | copy( |
| 507 | 507 | SECUREPATH.'/'.SECUREFILE, |
| 508 | 508 | $old_sk_filename |
@@ -531,13 +531,13 @@ discard block |
||
| 531 | 531 | logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login')); |
| 532 | 532 | |
| 533 | 533 | // get number of items to change |
| 534 | - DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0); |
|
| 534 | + DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0); |
|
| 535 | 535 | $nb_of_items = DB::count(); |
| 536 | 536 | |
| 537 | 537 | // create backup table |
| 538 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
| 538 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
| 539 | 539 | DB::query( |
| 540 | - 'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` ( |
|
| 540 | + 'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` ( |
|
| 541 | 541 | `id` int(12) NOT null AUTO_INCREMENT, |
| 542 | 542 | `current_table` varchar(100) NOT NULL, |
| 543 | 543 | `current_field` varchar(500) NOT NULL, |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | ); |
| 566 | 566 | |
| 567 | 567 | // delete previous backup files |
| 568 | - $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names |
|
| 568 | + $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names |
|
| 569 | 569 | foreach ($files as $file) { // iterate files |
| 570 | 570 | if (is_file($file)) { |
| 571 | 571 | $file_parts = pathinfo($file); |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | echo prepareExchangedData( |
| 653 | 653 | array( |
| 654 | 654 | 'error' => true, |
| 655 | - 'message' => 'Input `' . $objects[0] . '` is not allowed', |
|
| 655 | + 'message' => 'Input `'.$objects[0].'` is not allowed', |
|
| 656 | 656 | 'nbOfItems' => '', |
| 657 | 657 | 'nextAction' => '', |
| 658 | 658 | ), |
@@ -665,9 +665,9 @@ discard block |
||
| 665 | 665 | //change all encrypted data in Items (passwords) |
| 666 | 666 | $rows = DB::query( |
| 667 | 667 | 'SELECT id, pw, pw_iv |
| 668 | - FROM ' . prefixTable('items') . ' |
|
| 668 | + FROM ' . prefixTable('items').' |
|
| 669 | 669 | WHERE perso = %s |
| 670 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
| 670 | + LIMIT ' . $post_start.', '.$post_length, |
|
| 671 | 671 | '0' |
| 672 | 672 | ); |
| 673 | 673 | foreach ($rows as $record) { |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | 'current_field' => 'pw', |
| 680 | 680 | 'value_id' => $record['id'], |
| 681 | 681 | 'value' => $record['pw'], |
| 682 | - 'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';", |
|
| 682 | + 'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';", |
|
| 683 | 683 | 'value2' => 'none', |
| 684 | 684 | 'result' => 'none', |
| 685 | 685 | ) |
@@ -728,9 +728,9 @@ discard block |
||
| 728 | 728 | //change all encrypted data in Logs (passwords) |
| 729 | 729 | $rows = DB::query( |
| 730 | 730 | 'SELECT raison, increment_id |
| 731 | - FROM ' . prefixTable('log_items') . " |
|
| 731 | + FROM ' . prefixTable('log_items')." |
|
| 732 | 732 | WHERE action = %s AND raison LIKE 'at_pw :%' |
| 733 | - LIMIT " . $post_start . ', ' . $post_length, |
|
| 733 | + LIMIT " . $post_start.', '.$post_length, |
|
| 734 | 734 | 'at_modification' |
| 735 | 735 | ); |
| 736 | 736 | foreach ($rows as $record) { |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | 'current_field' => 'raison', |
| 743 | 743 | 'value_id' => $record['increment_id'], |
| 744 | 744 | 'value' => $record['raison'], |
| 745 | - 'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';", |
|
| 745 | + 'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';", |
|
| 746 | 746 | 'value2' => 'none', |
| 747 | 747 | 'result' => 'none', |
| 748 | 748 | ) |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | DB::update( |
| 771 | 771 | prefixTable('log_items'), |
| 772 | 772 | array( |
| 773 | - 'raison' => 'at_pw :' . $encrypt['string'], |
|
| 773 | + 'raison' => 'at_pw :'.$encrypt['string'], |
|
| 774 | 774 | 'encryption_type' => 'defuse', |
| 775 | 775 | ), |
| 776 | 776 | 'increment_id = %i', |
@@ -795,8 +795,8 @@ discard block |
||
| 795 | 795 | //change all encrypted data in CATEGORIES (passwords) |
| 796 | 796 | $rows = DB::query( |
| 797 | 797 | 'SELECT id, data |
| 798 | - FROM ' . prefixTable('categories_items') . ' |
|
| 799 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 798 | + FROM ' . prefixTable('categories_items').' |
|
| 799 | + LIMIT ' . $post_start.', '.$post_length |
|
| 800 | 800 | ); |
| 801 | 801 | foreach ($rows as $record) { |
| 802 | 802 | // backup data |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | 'current_field' => 'data', |
| 808 | 808 | 'value_id' => $record['id'], |
| 809 | 809 | 'value' => $record['data'], |
| 810 | - 'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';", |
|
| 810 | + 'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';", |
|
| 811 | 811 | 'value2' => 'none', |
| 812 | 812 | 'result' => 'none', |
| 813 | 813 | ) |
@@ -855,9 +855,9 @@ discard block |
||
| 855 | 855 | // Change all encrypted data in FILES (passwords) |
| 856 | 856 | $rows = DB::query( |
| 857 | 857 | 'SELECT id, file, status |
| 858 | - FROM ' . prefixTable('files') . " |
|
| 858 | + FROM ' . prefixTable('files')." |
|
| 859 | 859 | WHERE status = 'encrypted' |
| 860 | - LIMIT " . $post_start . ', ' . $post_length |
|
| 860 | + LIMIT " . $post_start.', '.$post_length |
|
| 861 | 861 | ); |
| 862 | 862 | foreach ($rows as $record) { |
| 863 | 863 | // backup data |
@@ -875,20 +875,20 @@ discard block |
||
| 875 | 875 | ); |
| 876 | 876 | $newID = DB::insertId(); |
| 877 | 877 | |
| 878 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
| 878 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
| 879 | 879 | // make a copy of file |
| 880 | 880 | if (!copy( |
| 881 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 882 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy' |
|
| 881 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 882 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy' |
|
| 883 | 883 | )) { |
| 884 | 884 | $error = 'Copy not possible'; |
| 885 | 885 | exit; |
| 886 | 886 | } else { |
| 887 | 887 | // prepare a bck of file (that will not be deleted) |
| 888 | - $backup_filename = $record['file'] . '.bck-change-sk.' . time(); |
|
| 888 | + $backup_filename = $record['file'].'.bck-change-sk.'.time(); |
|
| 889 | 889 | copy( |
| 890 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 891 | - $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename |
|
| 890 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 891 | + $SETTINGS['path_to_upload_folder'].'/'.$backup_filename |
|
| 892 | 892 | ); |
| 893 | 893 | } |
| 894 | 894 | |
@@ -896,22 +896,22 @@ discard block |
||
| 896 | 896 | // STEP1 - Do decryption |
| 897 | 897 | prepareFileWithDefuse( |
| 898 | 898 | 'decrypt', |
| 899 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 900 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted' |
|
| 899 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 900 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted' |
|
| 901 | 901 | ); |
| 902 | 902 | |
| 903 | 903 | // Do cleanup of files |
| 904 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']); |
|
| 904 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']); |
|
| 905 | 905 | |
| 906 | 906 | // STEP2 - Do encryption |
| 907 | 907 | prepareFileWithDefuse( |
| 908 | 908 | 'encryp', |
| 909 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
| 910 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] |
|
| 909 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
| 910 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'] |
|
| 911 | 911 | ); |
| 912 | 912 | |
| 913 | 913 | // Do cleanup of files |
| 914 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'); |
|
| 914 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'); |
|
| 915 | 915 | |
| 916 | 916 | // Update backup table |
| 917 | 917 | DB::update( |
@@ -937,13 +937,13 @@ discard block |
||
| 937 | 937 | // do some things for new object |
| 938 | 938 | if (isset($objects[0])) { |
| 939 | 939 | if ($objects[0] === 'logs') { |
| 940 | - DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 940 | + DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 941 | 941 | } elseif ($objects[0] === 'files') { |
| 942 | - DB::query('SELECT id FROM ' . prefixTable('files')); |
|
| 942 | + DB::query('SELECT id FROM '.prefixTable('files')); |
|
| 943 | 943 | } elseif ($objects[0] === 'categories') { |
| 944 | - DB::query('SELECT id FROM ' . prefixTable('categories_items')); |
|
| 944 | + DB::query('SELECT id FROM '.prefixTable('categories_items')); |
|
| 945 | 945 | } elseif ($objects[0] === 'custfields') { |
| 946 | - DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 946 | + DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 947 | 947 | } |
| 948 | 948 | $nb_of_items = DB::count(); |
| 949 | 949 | } else { |
@@ -1063,12 +1063,12 @@ discard block |
||
| 1063 | 1063 | ); |
| 1064 | 1064 | } elseif ($record['current_table'] === 'files') { |
| 1065 | 1065 | // restore backup file |
| 1066 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) { |
|
| 1067 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']); |
|
| 1068 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
| 1066 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) { |
|
| 1067 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']); |
|
| 1068 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
| 1069 | 1069 | rename( |
| 1070 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'], |
|
| 1071 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value'] |
|
| 1070 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value2'], |
|
| 1071 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value'] |
|
| 1072 | 1072 | ); |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
@@ -1087,7 +1087,7 @@ discard block |
||
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | // drop table |
| 1090 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
| 1090 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
| 1091 | 1091 | |
| 1092 | 1092 | // Send back |
| 1093 | 1093 | echo prepareExchangedData( |
@@ -1130,17 +1130,17 @@ discard block |
||
| 1130 | 1130 | // delete files |
| 1131 | 1131 | $rows = DB::query( |
| 1132 | 1132 | 'SELECT value, value2 |
| 1133 | - FROM ' . prefixTable('sk_reencrypt_backup') . " |
|
| 1133 | + FROM ' . prefixTable('sk_reencrypt_backup')." |
|
| 1134 | 1134 | WHERE current_table = 'files'" |
| 1135 | 1135 | ); |
| 1136 | 1136 | foreach ($rows as $record) { |
| 1137 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
| 1138 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']); |
|
| 1137 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
| 1138 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']); |
|
| 1139 | 1139 | } |
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | // drop table |
| 1143 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
| 1143 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
| 1144 | 1144 | |
| 1145 | 1145 | echo '[{"status":"done"}]'; |
| 1146 | 1146 | break; |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | 'encode' |
| 1172 | 1172 | ); |
| 1173 | 1173 | } else { |
| 1174 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1174 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1175 | 1175 | |
| 1176 | 1176 | //send email |
| 1177 | 1177 | $emailSettings = new EmailSettings($SETTINGS); |
@@ -1209,13 +1209,13 @@ discard block |
||
| 1209 | 1209 | break; |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1212 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1213 | 1213 | $emailSettings = new EmailSettings($SETTINGS); |
| 1214 | 1214 | $emailService = new EmailService(); |
| 1215 | 1215 | |
| 1216 | 1216 | $rows = DB::query( |
| 1217 | 1217 | 'SELECT * |
| 1218 | - FROM ' . prefixTable('emails') . ' |
|
| 1218 | + FROM ' . prefixTable('emails').' |
|
| 1219 | 1219 | WHERE status = %s OR status = %s', |
| 1220 | 1220 | 'not_sent', |
| 1221 | 1221 | '' |
@@ -1301,13 +1301,13 @@ discard block |
||
| 1301 | 1301 | break; |
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1304 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1305 | 1305 | |
| 1306 | 1306 | // Instatiate email settings and service |
| 1307 | 1307 | $emailSettings = new EmailSettings($SETTINGS); |
| 1308 | 1308 | $emailService = new EmailService(); |
| 1309 | 1309 | |
| 1310 | - $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
| 1310 | + $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
| 1311 | 1311 | foreach ($rows as $record) { |
| 1312 | 1312 | //send email |
| 1313 | 1313 | $email = $emailService->sendMail( |
@@ -1376,7 +1376,7 @@ discard block |
||
| 1376 | 1376 | break; |
| 1377 | 1377 | } |
| 1378 | 1378 | |
| 1379 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1379 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1380 | 1380 | |
| 1381 | 1381 | // init |
| 1382 | 1382 | $filesList = array(); |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | FROM ' . prefixTable('files') |
| 1390 | 1390 | ); |
| 1391 | 1391 | foreach ($rows as $record) { |
| 1392 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
| 1392 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
| 1393 | 1393 | $addFile = false; |
| 1394 | 1394 | if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted') |
| 1395 | 1395 | || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear') |
@@ -1454,8 +1454,8 @@ discard block |
||
| 1454 | 1454 | $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 1455 | 1455 | $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT); |
| 1456 | 1456 | |
| 1457 | - include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 1458 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1457 | + include $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 1458 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1459 | 1459 | |
| 1460 | 1460 | $cpt = 0; |
| 1461 | 1461 | $continu = true; |
@@ -1468,33 +1468,33 @@ discard block |
||
| 1468 | 1468 | // Get file name |
| 1469 | 1469 | $file_info = DB::queryFirstRow( |
| 1470 | 1470 | 'SELECT file |
| 1471 | - FROM ' . prefixTable('files') . ' |
|
| 1471 | + FROM ' . prefixTable('files').' |
|
| 1472 | 1472 | WHERE id = %i', |
| 1473 | 1473 | $file |
| 1474 | 1474 | ); |
| 1475 | 1475 | |
| 1476 | 1476 | // skip file is Coherancey not respected |
| 1477 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) { |
|
| 1477 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) { |
|
| 1478 | 1478 | // Case where we want to decrypt |
| 1479 | 1479 | if ($post_option === 'decrypt') { |
| 1480 | 1480 | prepareFileWithDefuse( |
| 1481 | 1481 | 'decrypt', |
| 1482 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
| 1483 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
| 1482 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
| 1483 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
| 1484 | 1484 | ); |
| 1485 | 1485 | // Case where we want to encrypt |
| 1486 | 1486 | } elseif ($post_option === 'encrypt') { |
| 1487 | 1487 | prepareFileWithDefuse( |
| 1488 | 1488 | 'encrypt', |
| 1489 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
| 1490 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
| 1489 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
| 1490 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
| 1491 | 1491 | ); |
| 1492 | 1492 | } |
| 1493 | 1493 | // Do file cleanup |
| 1494 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS); |
|
| 1494 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS); |
|
| 1495 | 1495 | rename( |
| 1496 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
| 1497 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'] |
|
| 1496 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
| 1497 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'] |
|
| 1498 | 1498 | ); |
| 1499 | 1499 | |
| 1500 | 1500 | // store in DB |
@@ -1529,8 +1529,8 @@ discard block |
||
| 1529 | 1529 | $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted' |
| 1530 | 1530 | ); |
| 1531 | 1531 | |
| 1532 | - $message = $lang->get('last_execution') . ' ' . |
|
| 1533 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 1532 | + $message = $lang->get('last_execution').' '. |
|
| 1533 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 1534 | 1534 | '<i class="fas fa-check text-success ml-2 mr-3"></i>'; |
| 1535 | 1535 | } |
| 1536 | 1536 | |
@@ -1620,7 +1620,7 @@ discard block |
||
| 1620 | 1620 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT); |
| 1621 | 1621 | |
| 1622 | 1622 | DB::query( |
| 1623 | - 'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i', |
|
| 1623 | + 'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i', |
|
| 1624 | 1624 | $post_id |
| 1625 | 1625 | ); |
| 1626 | 1626 | } |
@@ -1715,7 +1715,7 @@ discard block |
||
| 1715 | 1715 | // Delete existing key |
| 1716 | 1716 | } elseif (null !== $post_action && $post_action === 'delete') { |
| 1717 | 1717 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 1718 | - DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id); |
|
| 1718 | + DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id); |
|
| 1719 | 1719 | } |
| 1720 | 1720 | |
| 1721 | 1721 | echo prepareExchangedData( |
@@ -1730,7 +1730,7 @@ discard block |
||
| 1730 | 1730 | |
| 1731 | 1731 | case 'save_api_status': |
| 1732 | 1732 | // Do query |
| 1733 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
| 1733 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
| 1734 | 1734 | $counter = DB::count(); |
| 1735 | 1735 | if ($counter === 0) { |
| 1736 | 1736 | DB::insert( |
@@ -1759,7 +1759,7 @@ discard block |
||
| 1759 | 1759 | |
| 1760 | 1760 | case 'run_duo_config_check': |
| 1761 | 1761 | //Libraries call |
| 1762 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1762 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1763 | 1763 | // Check KEY |
| 1764 | 1764 | if ($post_key !== $session->get('key')) { |
| 1765 | 1765 | echo prepareExchangedData( |
@@ -1865,7 +1865,7 @@ discard block |
||
| 1865 | 1865 | } else { |
| 1866 | 1866 | $tmp = 1; |
| 1867 | 1867 | } |
| 1868 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
| 1868 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
| 1869 | 1869 | $counter = DB::count(); |
| 1870 | 1870 | if ($counter === 0) { |
| 1871 | 1871 | DB::insert( |
@@ -1893,7 +1893,7 @@ discard block |
||
| 1893 | 1893 | |
| 1894 | 1894 | // ga_website_name |
| 1895 | 1895 | if (is_null($dataReceived['ga_website_name']) === false) { |
| 1896 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
| 1896 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
| 1897 | 1897 | $counter = DB::count(); |
| 1898 | 1898 | if ($counter === 0) { |
| 1899 | 1899 | DB::insert( |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | 1925 | // send data |
| 1926 | - echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]'; |
|
| 1926 | + echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]'; |
|
| 1927 | 1927 | break; |
| 1928 | 1928 | |
| 1929 | 1929 | case 'save_agses_options': |
@@ -1946,7 +1946,7 @@ discard block |
||
| 1946 | 1946 | |
| 1947 | 1947 | // agses_hosted_url |
| 1948 | 1948 | if (!is_null($dataReceived['agses_hosted_url'])) { |
| 1949 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
| 1949 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
| 1950 | 1950 | $counter = DB::count(); |
| 1951 | 1951 | if ($counter === 0) { |
| 1952 | 1952 | DB::insert( |
@@ -1977,7 +1977,7 @@ discard block |
||
| 1977 | 1977 | |
| 1978 | 1978 | // agses_hosted_id |
| 1979 | 1979 | if (!is_null($dataReceived['agses_hosted_id'])) { |
| 1980 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
| 1980 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
| 1981 | 1981 | $counter = DB::count(); |
| 1982 | 1982 | if ($counter === 0) { |
| 1983 | 1983 | DB::insert( |
@@ -2008,7 +2008,7 @@ discard block |
||
| 2008 | 2008 | |
| 2009 | 2009 | // agses_hosted_apikey |
| 2010 | 2010 | if (!is_null($dataReceived['agses_hosted_apikey'])) { |
| 2011 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
| 2011 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
| 2012 | 2012 | $counter = DB::count(); |
| 2013 | 2013 | if ($counter === 0) { |
| 2014 | 2014 | DB::insert( |
@@ -2038,7 +2038,7 @@ discard block |
||
| 2038 | 2038 | } |
| 2039 | 2039 | |
| 2040 | 2040 | // send data |
| 2041 | - echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]'; |
|
| 2041 | + echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]'; |
|
| 2042 | 2042 | break; |
| 2043 | 2043 | |
| 2044 | 2044 | case 'save_option_change': |
@@ -2079,7 +2079,7 @@ discard block |
||
| 2079 | 2079 | |
| 2080 | 2080 | // Check if setting is already in DB. If NO then insert, if YES then update. |
| 2081 | 2081 | $data = DB::query( |
| 2082 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
| 2082 | + 'SELECT * FROM '.prefixTable('misc').' |
|
| 2083 | 2083 | WHERE type = %s AND intitule = %s', |
| 2084 | 2084 | 'admin', |
| 2085 | 2085 | $post_field |
@@ -2102,7 +2102,7 @@ discard block |
||
| 2102 | 2102 | array( |
| 2103 | 2103 | 'valeur' => time(), |
| 2104 | 2104 | 'type' => 'admin', |
| 2105 | - 'intitule' => $post_field . '_time', |
|
| 2105 | + 'intitule' => $post_field.'_time', |
|
| 2106 | 2106 | 'updated_at' => time(), |
| 2107 | 2107 | ) |
| 2108 | 2108 | ); |
@@ -2124,10 +2124,10 @@ discard block |
||
| 2124 | 2124 | if ($post_field === 'send_stats') { |
| 2125 | 2125 | // Check if previous time exists, if not them insert this value in DB |
| 2126 | 2126 | DB::query( |
| 2127 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
| 2127 | + 'SELECT * FROM '.prefixTable('misc').' |
|
| 2128 | 2128 | WHERE type = %s AND intitule = %s', |
| 2129 | 2129 | 'admin', |
| 2130 | - $post_field . '_time' |
|
| 2130 | + $post_field.'_time' |
|
| 2131 | 2131 | ); |
| 2132 | 2132 | $counter = DB::count(); |
| 2133 | 2133 | if ($counter === 0) { |
@@ -2136,7 +2136,7 @@ discard block |
||
| 2136 | 2136 | array( |
| 2137 | 2137 | 'valeur' => 0, |
| 2138 | 2138 | 'type' => 'admin', |
| 2139 | - 'intitule' => $post_field . '_time', |
|
| 2139 | + 'intitule' => $post_field.'_time', |
|
| 2140 | 2140 | 'created_at' => time(), |
| 2141 | 2141 | ) |
| 2142 | 2142 | ); |
@@ -2158,13 +2158,13 @@ discard block |
||
| 2158 | 2158 | // special Cases |
| 2159 | 2159 | if ($post_field === 'cpassman_url') { |
| 2160 | 2160 | // update also jsUrl for CSFP protection |
| 2161 | - $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
| 2161 | + $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
| 2162 | 2162 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
| 2163 | 2163 | $data = file_get_contents($csrfp_file); |
| 2164 | 2164 | $posJsUrl = strpos($data, '"jsUrl" => "'); |
| 2165 | 2165 | $posEndLine = strpos($data, '",', $posJsUrl); |
| 2166 | 2166 | $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2)); |
| 2167 | - $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data); |
|
| 2167 | + $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data); |
|
| 2168 | 2168 | file_put_contents($csrfp_file, $newdata); |
| 2169 | 2169 | } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) { |
| 2170 | 2170 | DB::update( |
@@ -2183,7 +2183,7 @@ discard block |
||
| 2183 | 2183 | echo prepareExchangedData( |
| 2184 | 2184 | array( |
| 2185 | 2185 | 'error' => false, |
| 2186 | - 'misc' => $counter . ' ; ' . $SETTINGS[$post_field], |
|
| 2186 | + 'misc' => $counter.' ; '.$SETTINGS[$post_field], |
|
| 2187 | 2187 | 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '', |
| 2188 | 2188 | ), |
| 2189 | 2189 | 'encode' |
@@ -2226,7 +2226,7 @@ discard block |
||
| 2226 | 2226 | |
| 2227 | 2227 | // send statistics |
| 2228 | 2228 | if (null !== $post_status) { |
| 2229 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
| 2229 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
| 2230 | 2230 | $counter = DB::count(); |
| 2231 | 2231 | if ($counter === 0) { |
| 2232 | 2232 | DB::insert( |
@@ -2257,7 +2257,7 @@ discard block |
||
| 2257 | 2257 | |
| 2258 | 2258 | // send statistics items |
| 2259 | 2259 | if (null !== $post_list) { |
| 2260 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
| 2260 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
| 2261 | 2261 | $counter = DB::count(); |
| 2262 | 2262 | if ($counter === 0) { |
| 2263 | 2263 | DB::insert( |
@@ -2303,7 +2303,7 @@ discard block |
||
| 2303 | 2303 | break; |
| 2304 | 2304 | } |
| 2305 | 2305 | |
| 2306 | - if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) { |
|
| 2306 | + if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) { |
|
| 2307 | 2307 | if (DB::count() === 1) { |
| 2308 | 2308 | echo 1; |
| 2309 | 2309 | } else { |
@@ -2364,7 +2364,7 @@ discard block |
||
| 2364 | 2364 | |
| 2365 | 2365 | $rows = DB::query( |
| 2366 | 2366 | 'SELECT id, title |
| 2367 | - FROM ' . prefixTable('roles_title') . ' |
|
| 2367 | + FROM ' . prefixTable('roles_title').' |
|
| 2368 | 2368 | ORDER BY title ASC' |
| 2369 | 2369 | ); |
| 2370 | 2370 | foreach ($rows as $record) { |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | |
| 2497 | 2497 | $ignoredFiles = DB::queryFirstField( |
| 2498 | 2498 | 'SELECT valeur |
| 2499 | - FROM ' . prefixTable('misc') . ' |
|
| 2499 | + FROM ' . prefixTable('misc').' |
|
| 2500 | 2500 | WHERE type = %s AND intitule = %s', |
| 2501 | 2501 | 'admin', |
| 2502 | 2502 | 'ignored_unknown_files' |
@@ -2539,7 +2539,7 @@ discard block |
||
| 2539 | 2539 | // Get ignored unknown files |
| 2540 | 2540 | $existingData = DB::queryFirstRow( |
| 2541 | 2541 | 'SELECT valeur |
| 2542 | - FROM ' . prefixTable('misc') . ' |
|
| 2542 | + FROM ' . prefixTable('misc').' |
|
| 2543 | 2543 | WHERE type = %s AND intitule = %s', |
| 2544 | 2544 | 'admin', |
| 2545 | 2545 | 'ignored_unknown_files' |
@@ -2596,7 +2596,7 @@ discard block |
||
| 2596 | 2596 | // Get the list of files to delete |
| 2597 | 2597 | $filesToDelete = DB::queryFirstField( |
| 2598 | 2598 | 'SELECT valeur |
| 2599 | - FROM ' . prefixTable('misc') . ' |
|
| 2599 | + FROM ' . prefixTable('misc').' |
|
| 2600 | 2600 | WHERE type = %s AND intitule = %s', |
| 2601 | 2601 | 'admin', |
| 2602 | 2602 | 'unknown_files' |
@@ -2642,7 +2642,7 @@ discard block |
||
| 2642 | 2642 | // Get some TP USER info |
| 2643 | 2643 | $userInfo = DB::queryFirstRow( |
| 2644 | 2644 | 'SELECT id, public_key, private_key, pw |
| 2645 | - FROM ' . prefixTable('users') . ' |
|
| 2645 | + FROM ' . prefixTable('users').' |
|
| 2646 | 2646 | WHERE id = %i', |
| 2647 | 2647 | TP_USER_ID, |
| 2648 | 2648 | ); |
@@ -2688,8 +2688,8 @@ discard block |
||
| 2688 | 2688 | |
| 2689 | 2689 | $users = DB::query( |
| 2690 | 2690 | 'SELECT u.id, u.public_key, a.increment_id |
| 2691 | - FROM ' . prefixTable('users') . ' AS u |
|
| 2692 | - LEFT JOIN ' . prefixTable('api') . ' AS a |
|
| 2691 | + FROM ' . prefixTable('users').' AS u |
|
| 2692 | + LEFT JOIN ' . prefixTable('api').' AS a |
|
| 2693 | 2693 | ON a.user_id = u.id AND a.type = %s |
| 2694 | 2694 | WHERE u.disabled = %i AND u.deleted_at IS NULL AND u.public_key IS NOT NULL AND u.admin = %i |
| 2695 | 2695 | ORDER BY u.login ASC', |
@@ -2795,9 +2795,9 @@ discard block |
||
| 2795 | 2795 | COUNT(*) as total_users, |
| 2796 | 2796 | SUM(CASE WHEN personal_items_migrated = 1 THEN 1 ELSE 0 END) as migrated_users, |
| 2797 | 2797 | SUM(CASE WHEN personal_items_migrated = 0 THEN 1 ELSE 0 END) as pending_users |
| 2798 | - FROM " . prefixTable('users') . " |
|
| 2798 | + FROM " . prefixTable('users')." |
|
| 2799 | 2799 | WHERE disabled = 0 AND deleted_at IS NULL AND id NOT IN %li", |
| 2800 | - [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID] |
|
| 2800 | + [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID] |
|
| 2801 | 2801 | ); |
| 2802 | 2802 | |
| 2803 | 2803 | $progressPercent = ($stats[0]['migrated_users'] / $stats[0]['total_users']) * 100; |
@@ -2809,7 +2809,7 @@ discard block |
||
| 2809 | 2809 | WHERE personal_items_migrated = 0 |
| 2810 | 2810 | AND disabled = 0 AND deleted_at IS NULL AND id NOT IN %li |
| 2811 | 2811 | ORDER BY last_connexion DESC", |
| 2812 | - [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID] |
|
| 2812 | + [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID] |
|
| 2813 | 2813 | ); |
| 2814 | 2814 | |
| 2815 | 2815 | // Get users ready |
@@ -2819,7 +2819,7 @@ discard block |
||
| 2819 | 2819 | WHERE personal_items_migrated = 1 |
| 2820 | 2820 | AND disabled = 0 AND deleted_at IS NULL AND id NOT IN %li |
| 2821 | 2821 | ORDER BY last_connexion DESC", |
| 2822 | - [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID] |
|
| 2822 | + [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID] |
|
| 2823 | 2823 | ); |
| 2824 | 2824 | |
| 2825 | 2825 | return [ |
@@ -2843,7 +2843,7 @@ discard block |
||
| 2843 | 2843 | { |
| 2844 | 2844 | // Count auto-recoveries in last 24h |
| 2845 | 2845 | $autoRecoveriesLast24h = DB::queryFirstField( |
| 2846 | - 'SELECT COUNT(*) FROM ' . prefixTable('log_system') . ' |
|
| 2846 | + 'SELECT COUNT(*) FROM '.prefixTable('log_system').' |
|
| 2847 | 2847 | WHERE label = %s |
| 2848 | 2848 | AND date > %i', |
| 2849 | 2849 | 'auto_reencryption_success', |
@@ -2852,21 +2852,21 @@ discard block |
||
| 2852 | 2852 | |
| 2853 | 2853 | // Count failed recoveries (all time) |
| 2854 | 2854 | $failedRecoveries = DB::queryFirstField( |
| 2855 | - 'SELECT COUNT(*) FROM ' . prefixTable('log_system') . ' |
|
| 2855 | + 'SELECT COUNT(*) FROM '.prefixTable('log_system').' |
|
| 2856 | 2856 | WHERE label = %s', |
| 2857 | 2857 | 'auto_reencryption_failed' |
| 2858 | 2858 | ); |
| 2859 | 2859 | |
| 2860 | 2860 | // Count critical failures (all time) |
| 2861 | 2861 | $criticalFailures = DB::queryFirstField( |
| 2862 | - 'SELECT COUNT(*) FROM ' . prefixTable('log_system') . ' |
|
| 2862 | + 'SELECT COUNT(*) FROM '.prefixTable('log_system').' |
|
| 2863 | 2863 | WHERE label = %s', |
| 2864 | 2864 | 'auto_reencryption_critical_failure' |
| 2865 | 2865 | ); |
| 2866 | 2866 | |
| 2867 | 2867 | // Count users with transparent recovery enabled (have seed and backup) |
| 2868 | 2868 | $usersMigrated = DB::queryFirstField( |
| 2869 | - 'SELECT COUNT(*) FROM ' . prefixTable('users') . ' |
|
| 2869 | + 'SELECT COUNT(*) FROM '.prefixTable('users').' |
|
| 2870 | 2870 | WHERE user_derivation_seed IS NOT NULL |
| 2871 | 2871 | AND private_key_backup IS NOT NULL |
| 2872 | 2872 | AND disabled = 0' |
@@ -2874,7 +2874,7 @@ discard block |
||
| 2874 | 2874 | |
| 2875 | 2875 | // Count total active users |
| 2876 | 2876 | $totalUsers = DB::queryFirstField( |
| 2877 | - 'SELECT COUNT(*) FROM ' . prefixTable('users') . ' |
|
| 2877 | + 'SELECT COUNT(*) FROM '.prefixTable('users').' |
|
| 2878 | 2878 | WHERE disabled = 0 |
| 2879 | 2879 | AND private_key IS NOT NULL |
| 2880 | 2880 | AND private_key != "none"' |
@@ -2883,8 +2883,8 @@ discard block |
||
| 2883 | 2883 | // Get recent recovery events (last 10) |
| 2884 | 2884 | $recentEvents = DB::query( |
| 2885 | 2885 | 'SELECT l.date, l.label, l.qui, u.login |
| 2886 | - FROM ' . prefixTable('log_system') . ' AS l |
|
| 2887 | - INNER JOIN ' . prefixTable('users') . ' AS u ON u.id = l.qui |
|
| 2886 | + FROM ' . prefixTable('log_system').' AS l |
|
| 2887 | + INNER JOIN ' . prefixTable('users').' AS u ON u.id = l.qui |
|
| 2888 | 2888 | WHERE l.label IN %ls |
| 2889 | 2889 | ORDER BY l.date DESC |
| 2890 | 2890 | LIMIT 10', |
@@ -2896,7 +2896,7 @@ discard block |
||
| 2896 | 2896 | |
| 2897 | 2897 | // Calculate failure rate (last 30 days) |
| 2898 | 2898 | $totalAttempts30d = DB::queryFirstField( |
| 2899 | - 'SELECT COUNT(*) FROM ' . prefixTable('log_system') . ' |
|
| 2899 | + 'SELECT COUNT(*) FROM '.prefixTable('log_system').' |
|
| 2900 | 2900 | WHERE label IN %ls |
| 2901 | 2901 | AND date > %i', |
| 2902 | 2902 | ['auto_reencryption_success', 'auto_reencryption_failed'], |
@@ -2904,7 +2904,7 @@ discard block |
||
| 2904 | 2904 | ); |
| 2905 | 2905 | |
| 2906 | 2906 | $failures30d = DB::queryFirstField( |
| 2907 | - 'SELECT COUNT(*) FROM ' . prefixTable('log_system') . ' |
|
| 2907 | + 'SELECT COUNT(*) FROM '.prefixTable('log_system').' |
|
| 2908 | 2908 | WHERE label = %s |
| 2909 | 2909 | AND date > %i', |
| 2910 | 2910 | 'auto_reencryption_failed', |
@@ -2941,7 +2941,7 @@ discard block |
||
| 2941 | 2941 | $lang = new Language($session->get('user-language') ?? 'english'); |
| 2942 | 2942 | |
| 2943 | 2943 | $results = []; |
| 2944 | - $fullPath = __DIR__ . '/../'; |
|
| 2944 | + $fullPath = __DIR__.'/../'; |
|
| 2945 | 2945 | |
| 2946 | 2946 | foreach ($files as $file) { |
| 2947 | 2947 | // Normalize path separators for cross-platform compatibility |
@@ -2990,7 +2990,7 @@ discard block |
||
| 2990 | 2990 | } |
| 2991 | 2991 | |
| 2992 | 2992 | // Try to delete the file |
| 2993 | - $deleteResult = '';//@unlink($normalizedPath); |
|
| 2993 | + $deleteResult = ''; //@unlink($normalizedPath); |
|
| 2994 | 2994 | |
| 2995 | 2995 | if ($deleteResult) { |
| 2996 | 2996 | $results[$normalizedPath] = [ |
@@ -3020,7 +3020,7 @@ discard block |
||
| 3020 | 3020 | */ |
| 3021 | 3021 | function filesIntegrityCheck($baseDir): array |
| 3022 | 3022 | { |
| 3023 | - $referenceFile = __DIR__ . '/../files_reference.txt'; |
|
| 3023 | + $referenceFile = __DIR__.'/../files_reference.txt'; |
|
| 3024 | 3024 | |
| 3025 | 3025 | $unknownFiles = findUnknownFiles($baseDir, $referenceFile); |
| 3026 | 3026 | |
@@ -3058,7 +3058,7 @@ discard block |
||
| 3058 | 3058 | $dir, |
| 3059 | 3059 | FilesystemIterator::SKIP_DOTS |
| 3060 | 3060 | ), |
| 3061 | - function ($current, $key, $iterator) { |
|
| 3061 | + function($current, $key, $iterator) { |
|
| 3062 | 3062 | // Ignore hidden files and folders |
| 3063 | 3063 | if ($current->getFilename()[0] === '.') { |
| 3064 | 3064 | return false; |
@@ -3072,7 +3072,7 @@ discard block |
||
| 3072 | 3072 | foreach ($iterator as $file) { |
| 3073 | 3073 | try { |
| 3074 | 3074 | if ($file->isFile()) { |
| 3075 | - $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
| 3075 | + $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
| 3076 | 3076 | $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux |
| 3077 | 3077 | |
| 3078 | 3078 | // Split relatif path into parts |
@@ -3138,7 +3138,7 @@ discard block |
||
| 3138 | 3138 | // Get ignored files |
| 3139 | 3139 | $ignoredFiles = DB::queryFirstField( |
| 3140 | 3140 | 'SELECT valeur |
| 3141 | - FROM ' . prefixTable('misc') . ' |
|
| 3141 | + FROM ' . prefixTable('misc').' |
|
| 3142 | 3142 | WHERE type = %s AND intitule = %s', |
| 3143 | 3143 | 'admin', |
| 3144 | 3144 | 'ignored_unknown_files' |
@@ -3157,7 +3157,7 @@ discard block |
||
| 3157 | 3157 | function tablesIntegrityCheck(): array |
| 3158 | 3158 | { |
| 3159 | 3159 | // Get integrity tables file |
| 3160 | - $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json'; |
|
| 3160 | + $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json'; |
|
| 3161 | 3161 | if (file_exists($integrityTablesFile) === false) { |
| 3162 | 3162 | return [ |
| 3163 | 3163 | 'error' => true, |
@@ -3175,7 +3175,7 @@ discard block |
||
| 3175 | 3175 | // Get all tables |
| 3176 | 3176 | $tables = []; |
| 3177 | 3177 | foreach (DB::queryFirstColumn("SHOW TABLES") as $table) { |
| 3178 | - $tables[] = str_replace(DB_PREFIX, "", $table);; |
|
| 3178 | + $tables[] = str_replace(DB_PREFIX, "", $table); ; |
|
| 3179 | 3179 | } |
| 3180 | 3180 | // Prepare the integrity check |
| 3181 | 3181 | $tablesInError = []; |
@@ -3241,7 +3241,7 @@ discard block |
||
| 3241 | 3241 | |
| 3242 | 3242 | // Compare hashes |
| 3243 | 3243 | $expectedHash = $referenceData[$file]; |
| 3244 | - $actualHash = md5_file($baseDir . '/' . $file); |
|
| 3244 | + $actualHash = md5_file($baseDir.'/'.$file); |
|
| 3245 | 3245 | |
| 3246 | 3246 | if ($expectedHash !== $actualHash) { |
| 3247 | 3247 | $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)"; |
@@ -3294,7 +3294,7 @@ discard block |
||
| 3294 | 3294 | foreach ($iterator as $file) { |
| 3295 | 3295 | if ($file->isFile()) { |
| 3296 | 3296 | // Build relative path |
| 3297 | - $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
| 3297 | + $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
| 3298 | 3298 | $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows |
| 3299 | 3299 | // Calculate hash |
| 3300 | 3300 | $files[$relativePath] = md5_file($file->getPathname()); |
@@ -3324,8 +3324,8 @@ discard block |
||
| 3324 | 3324 | // Loop on items |
| 3325 | 3325 | $item = DB::queryFirstRow( |
| 3326 | 3326 | 'SELECT i.id, i.pw, s.share_key, s.increment_id |
| 3327 | - FROM ' . prefixTable('items') . ' i |
|
| 3328 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' s ON i.id = s.object_id |
|
| 3327 | + FROM ' . prefixTable('items').' i |
|
| 3328 | + INNER JOIN ' . prefixTable('sharekeys_items').' s ON i.id = s.object_id |
|
| 3329 | 3329 | WHERE i.perso = %i |
| 3330 | 3330 | AND s.user_id = %i |
| 3331 | 3331 | ORDER BY RAND() |
@@ -3354,7 +3354,7 @@ discard block |
||
| 3354 | 3354 | // Get all items in database |
| 3355 | 3355 | $rows = DB::queryFirstRow( |
| 3356 | 3356 | 'SELECT count(*) as counter |
| 3357 | - FROM ' . prefixTable('sharekeys_items') . ' s |
|
| 3357 | + FROM ' . prefixTable('sharekeys_items').' s |
|
| 3358 | 3358 | WHERE s.user_id = %i', |
| 3359 | 3359 | TP_USER_ID |
| 3360 | 3360 | ); |
@@ -40,24 +40,24 @@ discard block |
||
| 40 | 40 | private function migratePersonalItems($arguments) { |
| 41 | 41 | // Get all subtasks related to this task |
| 42 | 42 | $subtasks = DB::query( |
| 43 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
| 43 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
| 44 | 44 | $this->taskId |
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | if (empty($subtasks)) { |
| 48 | - if (LOG_TASKS=== true) $this->logger->log("No subtask was found for task {$this->taskId}"); |
|
| 48 | + if (LOG_TASKS === true) $this->logger->log("No subtask was found for task {$this->taskId}"); |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Process each subtask |
| 53 | 53 | foreach ($subtasks as $subtask) { |
| 54 | - if (LOG_TASKS=== true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}"); |
|
| 54 | + if (LOG_TASKS === true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}"); |
|
| 55 | 55 | $this->processMigratePersonalItemsSubtask($subtask, $arguments); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Are all subtasks completed? |
| 59 | 59 | $remainingSubtasks = DB::queryFirstField( |
| 60 | - 'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0', |
|
| 60 | + 'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0', |
|
| 61 | 61 | $this->taskId |
| 62 | 62 | ); |
| 63 | 63 | if ($remainingSubtasks == 0) { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $subtask['increment_id'] |
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | - if (LOG_TASKS=== true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO'); |
|
| 91 | + if (LOG_TASKS === true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO'); |
|
| 92 | 92 | switch ($taskData['step'] ?? '') { |
| 93 | 93 | case 'user-personal-items-migration-step10': |
| 94 | 94 | $this->migratePersonalItemsStep10($taskData, $arguments); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $subtask['increment_id'] |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $this->logger->log("Subtask {$subtask['increment_id']} failure: " . $e->getMessage(), 'ERROR'); |
|
| 143 | + $this->logger->log("Subtask {$subtask['increment_id']} failure: ".$e->getMessage(), 'ERROR'); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | // get TP_USER private key |
| 164 | 164 | $userTP = DB::queryFirstRow( |
| 165 | 165 | 'SELECT pw, public_key, private_key |
| 166 | - FROM ' . prefixTable('users') . ' |
|
| 166 | + FROM ' . prefixTable('users').' |
|
| 167 | 167 | WHERE id = %i', |
| 168 | 168 | TP_USER_ID |
| 169 | 169 | ); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | // Loop on items |
| 175 | 175 | $rows = DB::query( |
| 176 | 176 | 'SELECT id, pw |
| 177 | - FROM ' . prefixTable('items') . ' |
|
| 177 | + FROM ' . prefixTable('items').' |
|
| 178 | 178 | WHERE perso = 1 |
| 179 | 179 | AND id_tree IN %li |
| 180 | 180 | ORDER BY id ASC |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // Get itemKey from current user |
| 189 | 189 | $shareKeyForItem = DB::queryFirstRow( |
| 190 | 190 | 'SELECT share_key, increment_id |
| 191 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 191 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 192 | 192 | WHERE object_id = %i AND user_id = %i', |
| 193 | 193 | $item['id'], |
| 194 | 194 | (int) $arguments['user_id'] |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | // get TP_USER private key |
| 291 | 291 | $userTP = DB::queryFirstRow( |
| 292 | 292 | 'SELECT pw, public_key, private_key |
| 293 | - FROM ' . prefixTable('users') . ' |
|
| 293 | + FROM ' . prefixTable('users').' |
|
| 294 | 294 | WHERE id = %i', |
| 295 | 295 | TP_USER_ID |
| 296 | 296 | ); |
@@ -301,16 +301,16 @@ discard block |
||
| 301 | 301 | // Loop on logs |
| 302 | 302 | $rows = DB::query( |
| 303 | 303 | 'SELECT increment_id |
| 304 | - FROM ' . prefixTable('log_items') . ' |
|
| 304 | + FROM ' . prefixTable('log_items').' |
|
| 305 | 305 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes" |
| 306 | 306 | ORDER BY increment_id ASC |
| 307 | - LIMIT ' . $taskData['index'] . ', ' . $taskData['nb'] |
|
| 307 | + LIMIT ' . $taskData['index'].', '.$taskData['nb'] |
|
| 308 | 308 | ); |
| 309 | 309 | foreach ($rows as $record) { |
| 310 | 310 | // Get itemKey from current user |
| 311 | 311 | $currentUserKey = DB::queryFirstRow( |
| 312 | 312 | 'SELECT share_key |
| 313 | - FROM ' . prefixTable('sharekeys_logs') . ' |
|
| 313 | + FROM ' . prefixTable('sharekeys_logs').' |
|
| 314 | 314 | WHERE object_id = %i AND user_id = %i', |
| 315 | 315 | $record['increment_id'], |
| 316 | 316 | $arguments['user_id'] |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | // get TP_USER private key |
| 367 | 367 | $userTP = DB::queryFirstRow( |
| 368 | 368 | 'SELECT pw, public_key, private_key |
| 369 | - FROM ' . prefixTable('users') . ' |
|
| 369 | + FROM ' . prefixTable('users').' |
|
| 370 | 370 | WHERE id = %i', |
| 371 | 371 | TP_USER_ID |
| 372 | 372 | ); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | // Loop on fields |
| 378 | 378 | $rows = DB::query( |
| 379 | 379 | 'SELECT id |
| 380 | - FROM ' . prefixTable('categories_items') . ' |
|
| 380 | + FROM ' . prefixTable('categories_items').' |
|
| 381 | 381 | WHERE encryption_type = "teampass_aes" |
| 382 | 382 | ORDER BY id ASC |
| 383 | 383 | LIMIT %i, %i', |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | // Get itemKey from current user |
| 389 | 389 | $currentUserKey = DB::queryFirstRow( |
| 390 | 390 | 'SELECT share_key |
| 391 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 391 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 392 | 392 | WHERE object_id = %i AND user_id = %i', |
| 393 | 393 | $record['id'], |
| 394 | 394 | $arguments['user_id'] |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | // get TP_USER private key |
| 442 | 442 | $userTP = DB::queryFirstRow( |
| 443 | 443 | 'SELECT pw, public_key, private_key |
| 444 | - FROM ' . prefixTable('users') . ' |
|
| 444 | + FROM ' . prefixTable('users').' |
|
| 445 | 445 | WHERE id = %i', |
| 446 | 446 | TP_USER_ID |
| 447 | 447 | ); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | // Loop on suggestions |
| 453 | 453 | $rows = DB::query( |
| 454 | 454 | 'SELECT id |
| 455 | - FROM ' . prefixTable('suggestion') . ' |
|
| 455 | + FROM ' . prefixTable('suggestion').' |
|
| 456 | 456 | ORDER BY id ASC |
| 457 | 457 | LIMIT %i, %i', |
| 458 | 458 | $taskData['index'], |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | // Get itemKey from current user |
| 463 | 463 | $currentUserKey = DB::queryFirstRow( |
| 464 | 464 | 'SELECT share_key |
| 465 | - FROM ' . prefixTable('sharekeys_suggestions') . ' |
|
| 465 | + FROM ' . prefixTable('sharekeys_suggestions').' |
|
| 466 | 466 | WHERE object_id = %i AND user_id = %i', |
| 467 | 467 | $record['id'], |
| 468 | 468 | $arguments['user_id'] |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | // get TP_USER private key |
| 519 | 519 | $userTP = DB::queryFirstRow( |
| 520 | 520 | 'SELECT pw, public_key, private_key |
| 521 | - FROM ' . prefixTable('users') . ' |
|
| 521 | + FROM ' . prefixTable('users').' |
|
| 522 | 522 | WHERE id = %i', |
| 523 | 523 | TP_USER_ID |
| 524 | 524 | ); |
@@ -529,9 +529,9 @@ discard block |
||
| 529 | 529 | // Loop on files |
| 530 | 530 | $rows = DB::query( |
| 531 | 531 | 'SELECT f.id AS id, i.perso AS perso |
| 532 | - FROM ' . prefixTable('files') . ' AS f |
|
| 533 | - INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item |
|
| 534 | - WHERE f.status = "' . TP_ENCRYPTION_NAME . '" |
|
| 532 | + FROM ' . prefixTable('files').' AS f |
|
| 533 | + INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item |
|
| 534 | + WHERE f.status = "' . TP_ENCRYPTION_NAME.'" |
|
| 535 | 535 | LIMIT %i, %i', |
| 536 | 536 | $taskData['index'], |
| 537 | 537 | $taskData['nb'] |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | // Get itemKey from current user |
| 541 | 541 | $currentUserKey = DB::queryFirstRow( |
| 542 | 542 | 'SELECT share_key, increment_id |
| 543 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 543 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 544 | 544 | WHERE object_id = %i AND user_id = %i', |
| 545 | 545 | $record['id'], |
| 546 | 546 | (int) $arguments['user_id'] |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | require_once __DIR__.'/traits/UserHandlerTrait.php'; |
| 34 | 34 | require_once __DIR__.'/traits/EmailTrait.php'; |
| 35 | 35 | require_once __DIR__.'/traits/MigrateUserHandlerTrait.php'; |
| 36 | -require_once __DIR__ . '/taskLogger.php'; |
|
| 36 | +require_once __DIR__.'/taskLogger.php'; |
|
| 37 | 37 | |
| 38 | 38 | class TaskWorker { |
| 39 | 39 | use ItemHandlerTrait; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function execute() { |
| 68 | 68 | try { |
| 69 | - if (LOG_TASKS=== true) $this->logger->log('Processing task: ' . print_r($this->taskData, true), 'DEBUG'); |
|
| 69 | + if (LOG_TASKS === true) $this->logger->log('Processing task: '.print_r($this->taskData, true), 'DEBUG'); |
|
| 70 | 70 | // Dispatch selon le type de processus |
| 71 | 71 | switch ($this->processType) { |
| 72 | 72 | case 'item_copy': |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $arguments = ''; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if (LOG_TASKS=== true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
| 144 | + if (LOG_TASKS === true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
| 145 | 145 | |
| 146 | 146 | // Add 'arguments' only if not empty |
| 147 | 147 | if (!empty($arguments)) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | 'increment_id = %i', |
| 156 | 156 | $this->taskId |
| 157 | 157 | ); |
| 158 | - if (LOG_TASKS=== true) $this->logger->log('Finishing task: ' . $this->taskId, 'DEBUG'); |
|
| 158 | + if (LOG_TASKS === true) $this->logger->log('Finishing task: '.$this->taskId, 'DEBUG'); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | 'increment_id = %i', |
| 179 | 179 | $this->taskId |
| 180 | 180 | ); |
| 181 | - $this->logger->log('Task failure: ' . $e->getMessage(), 'ERROR'); |
|
| 181 | + $this->logger->log('Task failure: '.$e->getMessage(), 'ERROR'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -190,16 +190,16 @@ discard block |
||
| 190 | 190 | * @return void |
| 191 | 191 | */ |
| 192 | 192 | private function processSubTasks($arguments) { |
| 193 | - if (LOG_TASKS=== true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
| 193 | + if (LOG_TASKS === true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
| 194 | 194 | // Get all subtasks related to this task |
| 195 | 195 | $subtasks = DB::query( |
| 196 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
| 196 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
| 197 | 197 | $this->taskId |
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | 200 | // Check if there are any subtasks to process |
| 201 | 201 | if (empty($subtasks)) { |
| 202 | - if (LOG_TASKS=== true) $this->logger->log('No subtask was found for task: ' . $this->taskId, 'DEBUG'); |
|
| 202 | + if (LOG_TASKS === true) $this->logger->log('No subtask was found for task: '.$this->taskId, 'DEBUG'); |
|
| 203 | 203 | return; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | // Get the subtask data |
| 210 | 210 | $subtaskData = json_decode($subtask['task'], true); |
| 211 | 211 | |
| 212 | - if (LOG_TASKS=== true) $this->logger->log('Processing subtask: ' . $subtaskData['step'], 'DEBUG'); |
|
| 212 | + if (LOG_TASKS === true) $this->logger->log('Processing subtask: '.$subtaskData['step'], 'DEBUG'); |
|
| 213 | 213 | |
| 214 | 214 | // Mark subtask as in progress |
| 215 | 215 | DB::update( |
@@ -261,13 +261,13 @@ discard block |
||
| 261 | 261 | $subtask['increment_id'] |
| 262 | 262 | ); |
| 263 | 263 | |
| 264 | - $this->logger->log('processSubTasks : ' . $e->getMessage(), 'ERROR'); |
|
| 264 | + $this->logger->log('processSubTasks : '.$e->getMessage(), 'ERROR'); |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // Are all subtasks completed? |
| 269 | 269 | $remainingSubtasks = DB::queryFirstField( |
| 270 | - 'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0', |
|
| 270 | + 'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0', |
|
| 271 | 271 | $this->taskId |
| 272 | 272 | ); |
| 273 | 273 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | error_log("Usage: php background_tasks___worker.php <task_id> <process_type> [<task_data>]"); |
| 284 | 284 | exit(1); |
| 285 | 285 | } |
| 286 | -$taskId = (int)$argv[1]; |
|
| 286 | +$taskId = (int) $argv[1]; |
|
| 287 | 287 | $processType = $argv[2]; |
| 288 | 288 | $taskData = $argv[3] ?? null; |
| 289 | 289 | if ($taskData) { |