@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | || (isset($session_user_admin) && (int) $session_user_admin === 1)) { |
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 | |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | if (empty($fav) === false) { |
126 | 126 | $data = DB::queryFirstRow( |
127 | 127 | 'SELECT i.label, i.description, i.id, i.id_tree, t.title |
128 | - FROM ' . prefixTable('items') . ' as i |
|
129 | - INNER JOIN ' . prefixTable('nested_tree') . ' as t ON (t.id = i.id_tree) |
|
128 | + FROM ' . prefixTable('items').' as i |
|
129 | + INNER JOIN ' . prefixTable('nested_tree').' as t ON (t.id = i.id_tree) |
|
130 | 130 | WHERE i.id = %i', |
131 | 131 | $fav |
132 | 132 | ); |
133 | - if (! empty($data['label'])) { |
|
133 | + if (!empty($data['label'])) { |
|
134 | 134 | ?> |
135 | 135 | <tr> |
136 | 136 | <td> |
@@ -33,7 +33,7 @@ |
||
33 | 33 | use TeampassClasses\SessionManager\SessionManager; |
34 | 34 | use TeampassClasses\ConfigManager\ConfigManager; |
35 | 35 | |
36 | -require_once __DIR__. '/../../includes/config/include.php'; |
|
36 | +require_once __DIR__.'/../../includes/config/include.php'; |
|
37 | 37 | require_once __DIR__.'/../../sources/main.functions.php'; |
38 | 38 | |
39 | 39 | // init |
@@ -134,7 +134,9 @@ |
||
134 | 134 | handleAttachmentError('File exceeds the maximum allowed size', 120, 413); |
135 | 135 | die(); |
136 | 136 | } |
137 | - if (WIP === true) error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
137 | + if (WIP === true) { |
|
138 | + error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
139 | + } |
|
138 | 140 | |
139 | 141 | // delete expired tokens |
140 | 142 | DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time()); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ) { |
75 | 75 | // Not allowed page |
76 | 76 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
77 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
77 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
78 | 78 | exit; |
79 | 79 | } |
80 | 80 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $post_isNewItem = $request->request->filter('isNewItem', null, FILTER_SANITIZE_NUMBER_INT); |
108 | 108 | $post_randomId = $request->request->filter('randomId', null, FILTER_SANITIZE_NUMBER_INT); |
109 | 109 | $post_isPersonal = $request->request->filter('isPersonal', null, FILTER_SANITIZE_NUMBER_INT); |
110 | -$post_fileSize= $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT); |
|
110 | +$post_fileSize = $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT); |
|
111 | 111 | $chunk = $request->request->filter('chunk', 0, FILTER_SANITIZE_NUMBER_INT); |
112 | 112 | $chunks = $request->request->filter('chunks', 0, FILTER_SANITIZE_NUMBER_INT); |
113 | 113 | $fileName = $request->request->filter('name', '', FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | $unit = strtoupper(substr(trim($POST_MAX_SIZE), -1)); // Assurez-vous de bien gérer les espaces éventuels |
123 | 123 | $units = ['G' => 1073741824, 'M' => 1048576, 'K' => 1024]; |
124 | 124 | $multiplier = $units[$unit] ?? 1; // Vérifie si l'unité est dans le tableau, sinon 1 |
125 | - $maxSize = (int)$POST_MAX_SIZE * $multiplier; |
|
125 | + $maxSize = (int) $POST_MAX_SIZE * $multiplier; |
|
126 | 126 | |
127 | 127 | // CHeck if the POST is too big |
128 | - if (!empty($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) { |
|
128 | + if (!empty($_SERVER['CONTENT_LENGTH']) && (int) $_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) { |
|
129 | 129 | handleAttachmentError('POST exceeded maximum allowed size.', 111, 413); |
130 | 130 | } |
131 | 131 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | handleAttachmentError('File exceeds the maximum allowed size', 120, 413); |
135 | 135 | die(); |
136 | 136 | } |
137 | - if (WIP === true) error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
137 | + if (WIP === true) error_log('POST_MAX_SIZE: '.$POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
138 | 138 | |
139 | 139 | // delete expired tokens |
140 | 140 | DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time()); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // check if token is expired |
186 | 186 | $data = DB::queryFirstRow( |
187 | 187 | 'SELECT end_timestamp |
188 | - FROM ' . prefixTable('tokens') . ' |
|
188 | + FROM ' . prefixTable('tokens').' |
|
189 | 189 | WHERE user_id = %i AND token = %s', |
190 | 190 | $session->get('user-id'), |
191 | 191 | $post_user_token |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | // HTTP headers for no cache etc |
220 | 220 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
221 | -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
221 | +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
222 | 222 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
223 | 223 | header('Cache-Control: post-check=0, pre-check=0', false); |
224 | 224 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // Validate file name (for our purposes we'll just remove invalid characters) |
257 | 257 | $file_name = preg_replace('[^A-Za-z0-9]', '', strtolower(basename($_FILES['file']['name']))); |
258 | 258 | if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) { |
259 | - handleAttachmentError('Invalid file name: ' . $file_name . '.', 114); |
|
259 | + handleAttachmentError('Invalid file name: '.$file_name.'.', 114); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // Validate file extension |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | $ext, |
267 | 267 | explode( |
268 | 268 | ',', |
269 | - $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] . |
|
270 | - ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext'] |
|
269 | + $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext']. |
|
270 | + ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext'] |
|
271 | 271 | ) |
272 | 272 | ) === false |
273 | 273 | ) { |
@@ -279,24 +279,24 @@ discard block |
||
279 | 279 | |
280 | 280 | // Clean the fileName for security reasons |
281 | 281 | $fileInfo = pathinfo($fileName); |
282 | -$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension']; |
|
282 | +$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension']; |
|
283 | 283 | $fileFullSize = 0; |
284 | 284 | |
285 | 285 | // Make sure the fileName is unique but only if chunking is disabled |
286 | -if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) { |
|
286 | +if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) { |
|
287 | 287 | $ext = strrpos($fileName, '.'); |
288 | 288 | $fileNameA = substr($fileName, 0, $ext); |
289 | 289 | $fileNameB = substr($fileName, $ext); |
290 | 290 | |
291 | 291 | $count = 1; |
292 | - while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) { |
|
292 | + while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) { |
|
293 | 293 | ++$count; |
294 | 294 | } |
295 | 295 | |
296 | - $fileName = $fileNameA . '_' . $count . $fileNameB; |
|
296 | + $fileName = $fileNameA.'_'.$count.$fileNameB; |
|
297 | 297 | } |
298 | 298 | |
299 | -$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName; |
|
299 | +$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName; |
|
300 | 300 | |
301 | 301 | // Create target dir |
302 | 302 | if (file_exists($targetDir) === false) { |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // Remove old temp files |
311 | 311 | if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) { |
312 | 312 | while (($file = readdir($dir)) !== false) { |
313 | - $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file; |
|
313 | + $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file; |
|
314 | 314 | |
315 | 315 | // Remove temp file if it is older than the max age and is not the current file |
316 | 316 | if ( |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | prefixTable('files'), |
413 | 413 | array( |
414 | 414 | 'id_item' => $post_itemId, |
415 | - 'name' => 'b64:' . $fileName, // add "b64:" prefix to indicate that the file name is base64 encoded |
|
415 | + 'name' => 'b64:'.$fileName, // add "b64:" prefix to indicate that the file name is base64 encoded |
|
416 | 416 | 'size' => $post_fileSize, |
417 | 417 | 'extension' => $fileInfo['extension'], |
418 | 418 | 'type' => $_FILES['file']['type'], |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | // This is a public object |
430 | 430 | $users = DB::query( |
431 | 431 | 'SELECT id, public_key |
432 | - FROM ' . prefixTable('users') . ' |
|
433 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
432 | + FROM ' . prefixTable('users').' |
|
433 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
434 | 434 | AND public_key != ""' |
435 | 435 | ); |
436 | 436 | foreach ($users as $user) { |
@@ -464,14 +464,14 @@ discard block |
||
464 | 464 | 'date' => time(), |
465 | 465 | 'id_user' => $session->get('user-id'), |
466 | 466 | 'action' => 'at_modification', |
467 | - 'raison' => 'at_add_file : ' . $fileName . ':' . $newID, |
|
467 | + 'raison' => 'at_add_file : '.$fileName.':'.$newID, |
|
468 | 468 | ) |
469 | 469 | ); |
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | 473 | // Return JSON-RPC response |
474 | -die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}'); |
|
474 | +die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}'); |
|
475 | 475 | |
476 | 476 | /** |
477 | 477 | * Handle errors and kill script. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ) { |
77 | 77 | // Not allowed page |
78 | 78 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
79 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
79 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
80 | 80 | exit; |
81 | 81 | } |
82 | 82 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | ); |
462 | 462 | |
463 | 463 | // add new role to user |
464 | - $tmp = $data_tmp['fonction_id'] . (substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';' . $role_id); |
|
464 | + $tmp = $data_tmp['fonction_id'].(substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';'.$role_id); |
|
465 | 465 | $session->set('user-roles', str_replace(';;', ';', $tmp)); |
466 | 466 | |
467 | 467 | // store in DB |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | $groupsData = $openLdapExtra->getADGroups($ldapConnection, $SETTINGS); |
650 | 650 | break; |
651 | 651 | default: |
652 | - throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']); |
|
652 | + throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']); |
|
653 | 653 | } |
654 | 654 | } catch (Exception $e) { |
655 | 655 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | } else { |
670 | 670 | // Handle successful retrieval of groups |
671 | 671 | // exists in Teampass |
672 | - foreach($groupsData['userGroups'] as $key => $group) { |
|
672 | + foreach ($groupsData['userGroups'] as $key => $group) { |
|
673 | 673 | $role_detail = DB::queryFirstRow( |
674 | 674 | 'SELECT a.increment_id as increment_id, a.role_id as role_id, r.title as title |
675 | 675 | FROM '.prefixTable('ldap_groups_roles').' AS a |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | |
695 | 695 | // Get all groups in Teampass |
696 | 696 | $teampassRoles = array(); |
697 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
697 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
698 | 698 | foreach ($rows as $record) { |
699 | 699 | array_push( |
700 | 700 | $teampassRoles, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ) { |
65 | 65 | // Not allowed page |
66 | 66 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
67 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
67 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
68 | 68 | exit; |
69 | 69 | } |
70 | 70 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ); |
126 | 126 | |
127 | 127 | $lastFolderChange = DB::queryFirstRow( |
128 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' |
|
128 | + 'SELECT valeur FROM '.prefixTable('misc').' |
|
129 | 129 | WHERE type = %s AND intitule = %s', |
130 | 130 | 'timestamp', |
131 | 131 | 'last_folder_change' |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $nbItemsInSubfolders = (int) $node->nb_items_in_subfolders; |
347 | 347 | $nbItemsInFolder = (int) $node->nb_items_in_folder; |
348 | 348 | $nbSubfolders = (int) $node->nb_subfolders; |
349 | - break; // Get out as soon as we find a valid node. |
|
349 | + break; // Get out as soon as we find a valid node. |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | if ($displayThisNode === true) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | foreach ($currentNode->children as $child) { |
459 | 459 | recursiveTree( |
460 | 460 | (int) $child, |
461 | - $tree->getNode($child),// get node info for this child |
|
461 | + $tree->getNode($child), // get node info for this child |
|
462 | 462 | /** @scrutinizer ignore-type */ $tree, |
463 | 463 | $listFoldersLimitedKeys, |
464 | 464 | $listRestrictedFoldersForItemsKeys, |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $lang = new Language($session->get('user-language') ?? 'english'); |
506 | 506 | |
507 | 507 | // prepare json return for current node |
508 | - $parent = $currentNode->parent_id === '0' ? '#' : 'li_' . $currentNode->parent_id; |
|
508 | + $parent = $currentNode->parent_id === '0' ? '#' : 'li_'.$currentNode->parent_id; |
|
509 | 509 | |
510 | 510 | // handle displaying |
511 | 511 | if (isKeyExistingAndEqual('show_only_accessible_folders', 1, $SETTINGS) === true) { |
@@ -522,17 +522,17 @@ discard block |
||
522 | 522 | array_push( |
523 | 523 | $ret_json, |
524 | 524 | array( |
525 | - 'id' => 'li_' . $nodeId, |
|
525 | + 'id' => 'li_'.$nodeId, |
|
526 | 526 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
527 | 527 | 'text' => '<i class="'.$currentNode->fa_icon.' tree-folder mr-2" data-folder="'.$currentNode->fa_icon.'" data-folder-selected="'.$currentNode->fa_icon_selected.'"></i>'.$text.htmlspecialchars($currentNode->title).$nodeData['html'], |
528 | 528 | 'li_attr' => array( |
529 | 529 | 'class' => 'jstreeopen', |
530 | - 'title' => 'ID [' . $nodeId . '] ' . $nodeData['title'], |
|
530 | + 'title' => 'ID ['.$nodeId.'] '.$nodeData['title'], |
|
531 | 531 | ), |
532 | 532 | 'a_attr' => array( |
533 | - 'id' => 'fld_' . $nodeId, |
|
533 | + 'id' => 'fld_'.$nodeId, |
|
534 | 534 | 'class' => $nodeData['folderClass'], |
535 | - 'onclick' => 'ListerItems(' . $nodeId . ', ' . $nodeData['restricted'] . ', 0, 1)', |
|
535 | + 'onclick' => 'ListerItems('.$nodeId.', '.$nodeData['restricted'].', 0, 1)', |
|
536 | 536 | 'data-title' => htmlspecialchars($currentNode->title), |
537 | 537 | ), |
538 | 538 | 'is_pf' => in_array($nodeId, $inputData['personalFolders']) === true ? 1 : 0, |
@@ -548,12 +548,12 @@ discard block |
||
548 | 548 | array_push( |
549 | 549 | $ret_json, |
550 | 550 | array( |
551 | - 'id' => 'li_' . $nodeId, |
|
551 | + 'id' => 'li_'.$nodeId, |
|
552 | 552 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
553 | 553 | 'text' => '<i class="'.$currentNode->fa_icon.' tree-folder mr-2" data-folder="'.$currentNode->fa_icon.'" data-folder-selected="'.$currentNode->fa_icon_selected.'"></i>'.'<i class="fas fa-times fa-xs text-danger mr-1 ml-1"></i>'.$text.htmlspecialchars($currentNode->title).$nodeData['html'], |
554 | 554 | 'li_attr' => array( |
555 | 555 | 'class' => '', |
556 | - 'title' => 'ID [' . $nodeId . '] ' . $lang->get('no_access'), |
|
556 | + 'title' => 'ID ['.$nodeId.'] '.$lang->get('no_access'), |
|
557 | 557 | ), |
558 | 558 | ) |
559 | 559 | ); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | if (in_array($nodeId, $session_read_only_folders) === true) { |
614 | 614 | return [ |
615 | 615 | 'html' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i>'. |
616 | - ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>' : ''), |
|
616 | + ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''), |
|
617 | 617 | 'title' => $lang->get('read_only_account'), |
618 | 618 | 'restricted' => 1, |
619 | 619 | 'folderClass' => 'folder_not_droppable', |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | ) { |
629 | 629 | return [ |
630 | 630 | 'html' => '<i class="far fa-eye fa-xs mr-1"></i>'. |
631 | - ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>' : ''), |
|
631 | + ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''), |
|
632 | 632 | 'title' => $lang->get('read_only_account'), |
633 | 633 | 'restricted' => 0, |
634 | 634 | 'folderClass' => 'folder', |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | } |
640 | 640 | |
641 | 641 | return [ |
642 | - 'html' => ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>' : ''), |
|
642 | + 'html' => ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''), |
|
643 | 643 | 'title' => '', |
644 | 644 | 'restricted' => 0, |
645 | 645 | 'folderClass' => 'folder', |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | |
651 | 651 | } elseif (in_array($nodeId, $listFoldersLimitedKeys) === true) { |
652 | 652 | return [ |
653 | - 'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') . |
|
654 | - ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>' : ''), |
|
653 | + 'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''). |
|
654 | + ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>' : ''), |
|
655 | 655 | 'title' => '', |
656 | 656 | 'restricted' => 1, |
657 | 657 | 'folderClass' => 'folder', |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | |
663 | 663 | } elseif (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) { |
664 | 664 | return [ |
665 | - 'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' . |
|
666 | - '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>', |
|
665 | + 'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''. |
|
666 | + '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>', |
|
667 | 667 | 'title' => '', |
668 | 668 | 'restricted' => 1, |
669 | 669 | 'folderClass' => 'folder', |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | // Does this user has a tree cache |
774 | 774 | $userCacheTree = DB::queryFirstRow( |
775 | 775 | 'SELECT data |
776 | - FROM ' . prefixTable('cache_tree') . ' |
|
776 | + FROM ' . prefixTable('cache_tree').' |
|
777 | 777 | WHERE user_id = %i', |
778 | 778 | $userId |
779 | 779 | ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ) { |
79 | 79 | // Not allowed page |
80 | 80 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
81 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
81 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
82 | 82 | exit; |
83 | 83 | } |
84 | 84 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $antiXss = new AntiXSS(); |
101 | 101 | |
102 | 102 | // User's language loading |
103 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
103 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
104 | 104 | |
105 | 105 | // Prepare POST variables |
106 | 106 | $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | 'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso, |
152 | 152 | i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url, |
153 | 153 | i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period |
154 | - FROM ' . prefixTable('items') . ' as i |
|
155 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
156 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item) |
|
154 | + FROM ' . prefixTable('items').' as i |
|
155 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
156 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item) |
|
157 | 157 | WHERE i.inactif = %i |
158 | 158 | AND i.id_tree= %i |
159 | 159 | AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s)) |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | // Run query |
177 | 177 | $dataItem = DB::queryFirstRow( |
178 | 178 | 'SELECT i.pw AS pw, s.share_key AS share_key |
179 | - FROM ' . prefixTable('items') . ' AS i |
|
180 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
179 | + FROM ' . prefixTable('items').' AS i |
|
180 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
181 | 181 | WHERE user_id = %i AND i.id = %i', |
182 | 182 | $session->get('user-id'), |
183 | 183 | $record['id'] |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | $arr_kbs = []; |
202 | 202 | $rows_kb = DB::query( |
203 | 203 | 'SELECT b.label, b.id |
204 | - FROM ' . prefixTable('kb_items') . ' AS a |
|
205 | - INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id) |
|
204 | + FROM ' . prefixTable('kb_items').' AS a |
|
205 | + INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id) |
|
206 | 206 | WHERE a.item_id = %i', |
207 | 207 | $record['id'] |
208 | 208 | ); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $arr_tags = []; |
215 | 215 | $rows_tag = DB::query( |
216 | 216 | 'SELECT tag |
217 | - FROM ' . prefixTable('tags') . ' |
|
217 | + FROM ' . prefixTable('tags').' |
|
218 | 218 | WHERE item_id = %i', |
219 | 219 | $record['id'] |
220 | 220 | ); |
@@ -226,18 +226,18 @@ discard block |
||
226 | 226 | $arr_trees = []; |
227 | 227 | $rows_child_tree = DB::query( |
228 | 228 | 'SELECT t.id, t.title |
229 | - FROM ' . prefixTable('nested_tree') . ' AS t |
|
230 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (t.id = i.id_tree) |
|
229 | + FROM ' . prefixTable('nested_tree').' AS t |
|
230 | + INNER JOIN ' . prefixTable('items').' AS i ON (t.id = i.id_tree) |
|
231 | 231 | WHERE i.id = %i', |
232 | 232 | $record['id'] |
233 | 233 | ); |
234 | 234 | foreach ($rows_child_tree as $rec_child_tree) { |
235 | 235 | $stack = array(); |
236 | 236 | $parent = $rec_child_tree['id']; |
237 | - while($parent != 0){ |
|
237 | + while ($parent != 0) { |
|
238 | 238 | $rows_parent_tree = DB::query( |
239 | 239 | 'SELECT parent_id, title |
240 | - FROM ' . prefixTable('nested_tree') . ' |
|
240 | + FROM ' . prefixTable('nested_tree').' |
|
241 | 241 | WHERE id = %i', |
242 | 242 | $parent |
243 | 243 | ); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // Prepare variables |
325 | 325 | $post_export_tag = filter_var($dataReceived['export_tag'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
326 | 326 | if (empty($post_export_tag) === false) { |
327 | - DB::query('DELETE FROM ' . prefixTable('export') . ' WHERE export_tag = %s', $post_export_tag); |
|
327 | + DB::query('DELETE FROM '.prefixTable('export').' WHERE export_tag = %s', $post_export_tag); |
|
328 | 328 | } |
329 | 329 | break; |
330 | 330 | |
@@ -374,9 +374,9 @@ discard block |
||
374 | 374 | l.date as date, i.pw_iv as pw_iv, |
375 | 375 | n.renewal_period as renewal_period, |
376 | 376 | i.id_tree as tree_id |
377 | - FROM ' . prefixTable('items') . ' as i |
|
378 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
379 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item) |
|
377 | + FROM ' . prefixTable('items').' as i |
|
378 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
379 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item) |
|
380 | 380 | WHERE i.inactif = %i |
381 | 381 | AND i.id_tree= %i |
382 | 382 | AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s)) |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | // Run query |
403 | 403 | $dataItem = DB::queryFirstRow( |
404 | 404 | 'SELECT i.pw AS pw, s.share_key AS share_key |
405 | - FROM ' . prefixTable('items') . ' AS i |
|
406 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
405 | + FROM ' . prefixTable('items').' AS i |
|
406 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
407 | 407 | WHERE user_id = %i AND i.id = %i', |
408 | 408 | $session->get('user-id'), |
409 | 409 | $record['id'] |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | $arr_kbs = ''; |
428 | 428 | $rows_kb = DB::query( |
429 | 429 | 'SELECT b.label, b.id |
430 | - FROM ' . prefixTable('kb_items') . ' AS a |
|
431 | - INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id) |
|
430 | + FROM ' . prefixTable('kb_items').' AS a |
|
431 | + INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id) |
|
432 | 432 | WHERE a.item_id = %i', |
433 | 433 | $record['id'] |
434 | 434 | ); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | if (empty($arr_kbs)) { |
437 | 437 | $arr_kbs = $rec_kb['label']; |
438 | 438 | } else { |
439 | - $arr_kbs .= ' | ' . $rec_kb['label']; |
|
439 | + $arr_kbs .= ' | '.$rec_kb['label']; |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $arr_tags = ''; |
445 | 445 | $rows_tag = DB::query( |
446 | 446 | 'SELECT tag |
447 | - FROM ' . prefixTable('tags') . ' |
|
447 | + FROM ' . prefixTable('tags').' |
|
448 | 448 | WHERE item_id = %i', |
449 | 449 | $record['id'] |
450 | 450 | ); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | if (empty($arr_tags)) { |
453 | 453 | $arr_tags = $rec_tag['tag']; |
454 | 454 | } else { |
455 | - $arr_tags .= ' ' . $rec_tag['tag']; |
|
455 | + $arr_tags .= ' '.$rec_tag['tag']; |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | // query |
531 | 531 | $rows = DB::query( |
532 | 532 | 'SELECT * |
533 | - FROM ' . prefixTable('export') . ' |
|
533 | + FROM ' . prefixTable('export').' |
|
534 | 534 | WHERE export_tag = %s', |
535 | 535 | $dataReceived['export_tag'] |
536 | 536 | ); |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $prev_path = ''; |
543 | 543 | |
544 | 544 | //Prepare the PDF file |
545 | - include $SETTINGS['cpassman_dir'] . '/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
545 | + include $SETTINGS['cpassman_dir'].'/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
546 | 546 | |
547 | 547 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); |
548 | 548 | $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null); |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | // set default header data |
556 | 556 | $pdf->SetHeaderData( |
557 | - $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png', |
|
557 | + $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png', |
|
558 | 558 | PDF_HEADER_LOGO_WIDTH, |
559 | 559 | 'Teampass export', |
560 | 560 | $session->get('user-lastname')." ".$session->get('user-name').' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time()) |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | logEvents($SETTINGS, 'pdf_export', '', (string) $session->get('user-id'), $session->get('user-login')); |
665 | 665 | |
666 | 666 | //clean table |
667 | - DB::query('TRUNCATE TABLE ' . prefixTable('export')); |
|
667 | + DB::query('TRUNCATE TABLE '.prefixTable('export')); |
|
668 | 668 | |
669 | 669 | // Clean any content of the output buffer |
670 | 670 | ob_end_clean(); |
@@ -702,13 +702,13 @@ discard block |
||
702 | 702 | // step 1: |
703 | 703 | // - prepare export file |
704 | 704 | // - get full list of objects id to export |
705 | - include $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
705 | + include $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
706 | 706 | $idsList = array(); |
707 | 707 | |
708 | 708 | // query |
709 | 709 | $rows = DB::query( |
710 | 710 | 'SELECT * |
711 | - FROM ' . prefixTable('export') . ' |
|
711 | + FROM ' . prefixTable('export').' |
|
712 | 712 | WHERE export_tag = %s', |
713 | 713 | $inputData['export_tag'] |
714 | 714 | ); |
@@ -745,13 +745,13 @@ discard block |
||
745 | 745 | } |
746 | 746 | // prepare export file |
747 | 747 | //save the file |
748 | - $outstream = fopen($SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], 'w'); |
|
748 | + $outstream = fopen($SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], 'w'); |
|
749 | 749 | if ($outstream === false) { |
750 | 750 | echo (string) prepareExchangedData( |
751 | 751 | [ |
752 | 752 | 'error' => true, |
753 | 753 | 'message' => $lang->get('error_while_creating_file'), |
754 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
754 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
755 | 755 | ], |
756 | 756 | 'encode' |
757 | 757 | ); |
@@ -777,12 +777,12 @@ discard block |
||
777 | 777 | </style> |
778 | 778 | </head> |
779 | 779 | <body> |
780 | - <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']) . '" /> |
|
780 | + <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']).'" /> |
|
781 | 781 | <div id="header"> |
782 | - ' . TP_TOOL_NAME . ' - Off Line mode |
|
782 | + ' . TP_TOOL_NAME.' - Off Line mode |
|
783 | 783 | </div> |
784 | 784 | <div style="margin:10px; font-size:9px;"> |
785 | - <i>This page was generated by <b>' . $session->get('user-name') . ' ' . $session->get('user-lastname') . '</b>, the ' . date('Y/m/d H:i:s') . '.</i> |
|
785 | + <i>This page was generated by <b>' . $session->get('user-name').' '.$session->get('user-lastname').'</b>, the '.date('Y/m/d H:i:s').'.</i> |
|
786 | 786 | <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span> |
787 | 787 | </div> |
788 | 788 | <div id="information"></div> |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | <div> |
794 | 794 | <table id="itemsTable"> |
795 | 795 | <thead><tr> |
796 | - <th style="width:15%;">' . $lang->get('label') . '</th> |
|
797 | - <th style="width:10%;">' . $lang->get('pw') . '</th> |
|
798 | - <th style="width:30%;">' . $lang->get('description') . '</th> |
|
799 | - <th style="width:5%;">' . $lang->get('user_login') . '</th> |
|
800 | - <th style="width:20%;">' . $lang->get('url') . '</th> |
|
796 | + <th style="width:15%;">' . $lang->get('label').'</th> |
|
797 | + <th style="width:10%;">' . $lang->get('pw').'</th> |
|
798 | + <th style="width:30%;">' . $lang->get('description').'</th> |
|
799 | + <th style="width:5%;">' . $lang->get('user_login').'</th> |
|
800 | + <th style="width:20%;">' . $lang->get('url').'</th> |
|
801 | 801 | </tr></thead> |
802 | 802 | <tbody id="itemsTable_tbody">' |
803 | 803 | ); |
@@ -811,8 +811,8 @@ discard block |
||
811 | 811 | 'loop' => true, |
812 | 812 | 'ids_list' => json_encode($idsList), |
813 | 813 | 'ids_count' => count($idsList), |
814 | - 'file_path' => $SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], |
|
815 | - 'file_link' => $SETTINGS['url_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], |
|
814 | + 'file_path' => $SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], |
|
815 | + 'file_link' => $SETTINGS['url_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], |
|
816 | 816 | 'export_tag' => $inputData['export_tag'], |
817 | 817 | ], |
818 | 818 | 'encode' |
@@ -851,12 +851,12 @@ discard block |
||
851 | 851 | $full_listing = array(); |
852 | 852 | $items_id_list = array(); |
853 | 853 | $outstream = ''; |
854 | - include $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
854 | + include $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
855 | 855 | |
856 | 856 | // query |
857 | 857 | $rows = DB::query( |
858 | 858 | 'SELECT * |
859 | - FROM ' . prefixTable('export') . ' |
|
859 | + FROM ' . prefixTable('export').' |
|
860 | 860 | WHERE export_tag = %s AND item_id IN %ls', |
861 | 861 | $inputData['export_tag'], |
862 | 862 | $inputData['idsList'] |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | [ |
871 | 871 | 'error' => true, |
872 | 872 | 'message' => $lang->get('error_while_creating_file'), |
873 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
873 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
874 | 874 | ], |
875 | 875 | 'encode' |
876 | 876 | ); |
@@ -912,13 +912,13 @@ discard block |
||
912 | 912 | if (empty($arboHtml)) { |
913 | 913 | $arboHtml = $arboHtml_tmp; |
914 | 914 | } else { |
915 | - $arboHtml .= ' » ' . $arboHtml_tmp; |
|
915 | + $arboHtml .= ' » '.$arboHtml_tmp; |
|
916 | 916 | } |
917 | 917 | } |
918 | 918 | fputs( |
919 | 919 | $outstream, |
920 | 920 | ' |
921 | - <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>' |
|
921 | + <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>' |
|
922 | 922 | ); |
923 | 923 | $idTree = $record['folder_id']; |
924 | 924 | |
@@ -926,12 +926,12 @@ discard block |
||
926 | 926 | fputs( |
927 | 927 | $outstream, |
928 | 928 | ' |
929 | - <tr class="' . $lineType . '"> |
|
930 | - <td>' . addslashes($record['label']) . '</td> |
|
931 | - <td align="center"><span class="span_pw" id="span_' . $record['item_id'] . '"><a href="#" onclick="decryptme(' . $record['item_id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $record['item_id'] . '" value="' . $encPw . '" /></td> |
|
932 | - <td>' . (empty($record['description']) === true ? ' ' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))) . '</td> |
|
933 | - <td align="center">' . (empty($record['login']) === true ? ' ' : addslashes($record['login'])) . '</td> |
|
934 | - <td align="center">' . (empty($record['url']) === true ? ' ' : addslashes($record['url'])) . '</td> |
|
929 | + <tr class="' . $lineType.'"> |
|
930 | + <td>' . addslashes($record['label']).'</td> |
|
931 | + <td align="center"><span class="span_pw" id="span_' . $record['item_id'].'"><a href="#" onclick="decryptme('.$record['item_id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$record['item_id'].'" value="'.$encPw.'" /></td> |
|
932 | + <td>' . (empty($record['description']) === true ? ' ' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))).'</td> |
|
933 | + <td align="center">' . (empty($record['login']) === true ? ' ' : addslashes($record['login'])).'</td> |
|
934 | + <td align="center">' . (empty($record['url']) === true ? ' ' : addslashes($record['url'])).'</td> |
|
935 | 935 | </tr>' |
936 | 936 | ); |
937 | 937 | } |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $inputData['password'] = (string) filter_var($dataReceived['password'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
981 | 981 | |
982 | 982 | // Load includes |
983 | - include $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
983 | + include $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
984 | 984 | |
985 | 985 | // read the content of the temporary file |
986 | 986 | $handle = fopen($inputData['filename'].'.txt', 'r'); |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | [ |
990 | 990 | 'error' => true, |
991 | 991 | 'message' => $lang->get('error_while_creating_file'), |
992 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
992 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
993 | 993 | ], |
994 | 994 | 'encode' |
995 | 995 | ); |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | [ |
1002 | 1002 | 'error' => true, |
1003 | 1003 | 'message' => $lang->get('error_while_creating_file'), |
1004 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
1004 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
1005 | 1005 | ], |
1006 | 1006 | 'encode' |
1007 | 1007 | ); |
@@ -1017,9 +1017,9 @@ discard block |
||
1017 | 1017 | $chunks = explode('|#|#|', chunk_split($contents, 10000, '|#|#|')); |
1018 | 1018 | foreach ($chunks as $chunk) { |
1019 | 1019 | if (empty($encrypted_text) === true) { |
1020 | - $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] ); |
|
1020 | + $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']); |
|
1021 | 1021 | } else { |
1022 | - $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] ); |
|
1022 | + $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']); |
|
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | [ |
1031 | 1031 | 'error' => true, |
1032 | 1032 | 'message' => $lang->get('error_while_creating_file'), |
1033 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
1033 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
1034 | 1034 | ], |
1035 | 1035 | 'encode' |
1036 | 1036 | ); |
@@ -1043,9 +1043,9 @@ discard block |
||
1043 | 1043 | </table></div> |
1044 | 1044 | <input type="button" value="Hide all" onclick="hideAll()" /> |
1045 | 1045 | <div id="footer" style="text-align:center;"> |
1046 | - <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME . ' ' . TP_VERSION . ' ' . TP_COPYRIGHT . '</a> |
|
1046 | + <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME.' '.TP_VERSION.' '.TP_COPYRIGHT.'</a> |
|
1047 | 1047 | </div> |
1048 | - <div id="enc_html" style="display:none;">' . $encrypted_text . '</div> |
|
1048 | + <div id="enc_html" style="display:none;">' . $encrypted_text.'</div> |
|
1049 | 1049 | </body> |
1050 | 1050 | </html> |
1051 | 1051 | <script type="text/javascript"> |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | fclose($outstream); |
1149 | 1149 | |
1150 | 1150 | //clean table |
1151 | - DB::query('TRUNCATE TABLE ' . prefixTable('export')); |
|
1151 | + DB::query('TRUNCATE TABLE '.prefixTable('export')); |
|
1152 | 1152 | |
1153 | 1153 | echo (string) prepareExchangedData( |
1154 | 1154 | [ |
1155 | 1155 | 'error' => false, |
1156 | - 'filelink' => $inputData['file_link'] , |
|
1156 | + 'filelink' => $inputData['file_link'], |
|
1157 | 1157 | ], |
1158 | 1158 | 'encode' |
1159 | 1159 | ); |
@@ -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 | ); |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | 'SELECT u.login as login, u.name as name, u.lastname as lastname, |
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 | - FROM ' . prefixTable('log_items') . ' as l |
|
154 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
155 | - LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
156 | - LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id) |
|
153 | + FROM ' . prefixTable('log_items').' as l |
|
154 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
155 | + LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
156 | + LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id) |
|
157 | 157 | WHERE i.inactif = %i |
158 | 158 | AND l.action = %s', |
159 | 159 | 1, |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 'label' => $record['label'], |
176 | 176 | 'date' => date($SETTINGS['date_format'], (int) $record['date']), |
177 | 177 | 'login' => $record['login'], |
178 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
178 | + 'name' => $record['name'].' '.$record['lastname'], |
|
179 | 179 | 'folder_label' => $record['folder_title'], |
180 | 180 | 'folder_deleted' => $thisFolder, |
181 | 181 | ) |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | foreach ($post_folders as $folderId) { |
234 | 234 | $data = DB::queryFirstRow( |
235 | 235 | 'SELECT valeur |
236 | - FROM ' . prefixTable('misc') . " |
|
236 | + FROM ' . prefixTable('misc')." |
|
237 | 237 | WHERE type = 'folder_deleted' |
238 | 238 | AND intitule = %s", |
239 | - 'f' . $folderId |
|
239 | + 'f'.$folderId |
|
240 | 240 | ); |
241 | 241 | if ((int) $data['valeur'] !== 0) { |
242 | 242 | $folderData = explode(', ', $data['valeur']); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | prefixTable('misc'), |
264 | 264 | 'type = %s AND intitule = %s', |
265 | 265 | 'folder_deleted', |
266 | - 'f' . $folderId |
|
266 | + 'f'.$folderId |
|
267 | 267 | ); |
268 | 268 | |
269 | 269 | // Restore all items in this folder |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // Get list of all items in thos folder |
280 | 280 | $items = DB::query( |
281 | 281 | 'SELECT id |
282 | - FROM ' . prefixTable('items') . ' |
|
282 | + FROM ' . prefixTable('items').' |
|
283 | 283 | WHERE id_tree = %i', |
284 | 284 | $folderId |
285 | 285 | ); |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | foreach ($post_folders as $folderId) { |
369 | 369 | $data = DB::queryFirstRow( |
370 | 370 | 'SELECT valeur |
371 | - FROM ' . prefixTable('misc') . " |
|
371 | + FROM ' . prefixTable('misc')." |
|
372 | 372 | WHERE type = 'folder_deleted' |
373 | 373 | AND intitule = %s", |
374 | - 'f' . $folderId |
|
374 | + 'f'.$folderId |
|
375 | 375 | ); |
376 | 376 | if ((int) $data['valeur'] !== 0) { |
377 | 377 | $exploded = explode(',', $data['valeur']); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | prefixTable('misc'), |
383 | 383 | 'type = %s AND intitule = %s', |
384 | 384 | 'folder_deleted', |
385 | - 'f' . $folderData[0] |
|
385 | + 'f'.$folderData[0] |
|
386 | 386 | ); |
387 | 387 | |
388 | 388 | // Delete all items in this folder |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | // Get list of all items in thos folder |
397 | 397 | $items = DB::query( |
398 | 398 | 'SELECT id |
399 | - FROM ' . prefixTable('items') . ' |
|
399 | + FROM ' . prefixTable('items').' |
|
400 | 400 | WHERE id_tree = %i', |
401 | 401 | $folderData[0] |
402 | 402 | ); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | // Delete all fields |
414 | 414 | $fields = DB::query( |
415 | 415 | 'SELECT id |
416 | - FROM ' . prefixTable('categories_items') . ' |
|
416 | + FROM ' . prefixTable('categories_items').' |
|
417 | 417 | WHERE item_id = %i', |
418 | 418 | $folderData[0] |
419 | 419 | ); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | // Delete all files |
434 | 434 | $files = DB::query( |
435 | 435 | 'SELECT id |
436 | - FROM ' . prefixTable('files') . ' |
|
436 | + FROM ' . prefixTable('files').' |
|
437 | 437 | WHERE id_item = %i', |
438 | 438 | $folderData[0] |
439 | 439 | ); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | // Delete sharekey fields |
491 | 491 | $itemFields = DB::query( |
492 | 492 | 'SELECT id |
493 | - FROM ' . prefixTable('categories_items') . ' |
|
493 | + FROM ' . prefixTable('categories_items').' |
|
494 | 494 | WHERE item_id = %i', |
495 | 495 | $itemId |
496 | 496 | ); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | // Delete sharekey files |
506 | 506 | $itemFiles = DB::query( |
507 | 507 | 'SELECT id |
508 | - FROM ' . prefixTable('files') . ' |
|
508 | + FROM ' . prefixTable('files').' |
|
509 | 509 | WHERE id_item = %i', |
510 | 510 | $itemId |
511 | 511 | ); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | ) { |
583 | 583 | if ($post_log_type === 'items') { |
584 | 584 | DB::query( |
585 | - 'SELECT * FROM ' . prefixTable('log_items') . ' |
|
585 | + 'SELECT * FROM '.prefixTable('log_items').' |
|
586 | 586 | WHERE (date BETWEEN %i AND %i)' |
587 | 587 | . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"') |
588 | 588 | . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user), |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | } elseif ($post_log_type === 'connections') { |
603 | 603 | //db::debugmode(true); |
604 | 604 | DB::query( |
605 | - 'SELECT * FROM ' . prefixTable('log_system') . ' |
|
605 | + 'SELECT * FROM '.prefixTable('log_system').' |
|
606 | 606 | WHERE type=%s ' |
607 | 607 | . 'AND (date BETWEEN %i AND %i)' |
608 | 608 | . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action) |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | ); |
626 | 626 | } elseif ($post_log_type === 'errors') { |
627 | 627 | DB::query( |
628 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
628 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
629 | 629 | 'AND (date BETWEEN %i AND %i)', |
630 | 630 | 'error', |
631 | 631 | $post_date_from, |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | ); |
643 | 643 | } elseif ($post_log_type === 'copy') { |
644 | 644 | DB::query( |
645 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' . |
|
645 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '. |
|
646 | 646 | 'AND (date BETWEEN %i AND %i)', |
647 | 647 | 'at_copy', |
648 | 648 | $post_date_from, |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | ); |
660 | 660 | } elseif ($post_log_type === 'admin') { |
661 | 661 | DB::query( |
662 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
662 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
663 | 663 | 'AND (date BETWEEN %i AND %i)', |
664 | 664 | 'admin_action', |
665 | 665 | $post_date_from, |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | ); |
677 | 677 | } elseif ($post_log_type === 'failed') { |
678 | 678 | DB::query( |
679 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
679 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
680 | 680 | 'AND (date BETWEEN %i AND %i)', |
681 | 681 | 'failed_auth', |
682 | 682 | $post_date_from, |
@@ -747,19 +747,19 @@ discard block |
||
747 | 747 | // Get info about task |
748 | 748 | $taskInfo = DB::queryFirstRow( |
749 | 749 | 'SELECT p.process_type as process_type |
750 | - FROM ' . prefixTable('background_tasks') . ' as p |
|
750 | + FROM ' . prefixTable('background_tasks').' as p |
|
751 | 751 | WHERE p.increment_id = %i', |
752 | 752 | $post_id |
753 | 753 | ); |
754 | 754 | if ($taskInfo !== null) { |
755 | 755 | // delete task |
756 | 756 | DB::query( |
757 | - 'DELETE FROM ' . prefixTable('background_subtasks') . ' |
|
757 | + 'DELETE FROM '.prefixTable('background_subtasks').' |
|
758 | 758 | WHERE task_id = %i', |
759 | 759 | $post_id |
760 | 760 | ); |
761 | 761 | DB::query( |
762 | - 'DELETE FROM ' . prefixTable('background_tasks') . ' |
|
762 | + 'DELETE FROM '.prefixTable('background_tasks').' |
|
763 | 763 | WHERE increment_id = %i', |
764 | 764 | $post_id |
765 | 765 | ); |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | ->setDayOfMonth('*') |
827 | 827 | ->setMonths('*') |
828 | 828 | ->setDayOfWeek('*') |
829 | - ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php') |
|
829 | + ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php') |
|
830 | 830 | ->setComments('Teampass scheduler'); |
831 | 831 | |
832 | 832 | $crontabRepository->addJob($crontabJob); |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | { |
59 | 59 | // Load AntiXSS |
60 | 60 | $antiXss = new AntiXSS(); |
61 | - if (! headers_sent()) { //If headers not sent yet... then do php redirect |
|
62 | - header('Location: ' . $antiXss->xss_clean($url)); |
|
61 | + if (!headers_sent()) { //If headers not sent yet... then do php redirect |
|
62 | + header('Location: '.$antiXss->xss_clean($url)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | //If headers are sent... do java redirect... if java disabled, do html redirect. |
66 | 66 | echo '<script type="text/javascript">'; |
67 | - echo 'window.location.href="' . $antiXss->xss_clean($url) . '";'; |
|
67 | + echo 'window.location.href="'.$antiXss->xss_clean($url).'";'; |
|
68 | 68 | echo '</script>'; |
69 | 69 | echo '<noscript>'; |
70 | - echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />'; |
|
70 | + echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />'; |
|
71 | 71 | echo '</noscript>'; |
72 | 72 | } |
73 | 73 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | && isset($SETTINGS['enable_sts']) === true |
94 | 94 | && (int) $SETTINGS['enable_sts'] === 1 |
95 | 95 | ) { |
96 | - teampassRedirect('https://' . $server['http_host'] . $server['request_uri']); |
|
96 | + teampassRedirect('https://'.$server['http_host'].$server['request_uri']); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // Load pwComplexity |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | // LOAD CPASSMAN SETTINGS |
115 | 115 | if ( |
116 | 116 | isset($SETTINGS['cpassman_dir']) === true |
117 | - && is_dir($SETTINGS['cpassman_dir'] . '/install') === true |
|
117 | + && is_dir($SETTINGS['cpassman_dir'].'/install') === true |
|
118 | 118 | ) { |
119 | 119 | // Should we delete folder INSTALL? |
120 | 120 | $row = DB::queryFirstRow( |
121 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s', |
|
121 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s', |
|
122 | 122 | 'install', |
123 | 123 | 'clear_install_folder' |
124 | 124 | ); |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | if ($directories !== false) { |
137 | 137 | $files = array_diff($directories, ['.', '..']); |
138 | 138 | foreach ($files as $file) { |
139 | - if (is_dir($dir . '/' . $file)) { |
|
140 | - delTree($dir . '/' . $file); |
|
139 | + if (is_dir($dir.'/'.$file)) { |
|
140 | + delTree($dir.'/'.$file); |
|
141 | 141 | } else { |
142 | 142 | try { |
143 | - unlink($dir . '/' . $file); |
|
143 | + unlink($dir.'/'.$file); |
|
144 | 144 | } catch (Exception $e) { |
145 | 145 | // do nothing... php will ignore and continue |
146 | 146 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
157 | - if (is_dir($SETTINGS['cpassman_dir'] . '/install')) { |
|
157 | + if (is_dir($SETTINGS['cpassman_dir'].'/install')) { |
|
158 | 158 | // Set the permissions on the install directory and delete |
159 | 159 | // is server Windows or Linux? |
160 | 160 | if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { |
161 | - recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440); |
|
161 | + recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440); |
|
162 | 162 | } |
163 | - delTree($SETTINGS['cpassman_dir'] . '/install'); |
|
163 | + delTree($SETTINGS['cpassman_dir'].'/install'); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // Delete temporary install table |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | // Load Languages stuff |
179 | 179 | if (isset($languagesList) === false) { |
180 | 180 | $languagesList = []; |
181 | - $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC'); |
|
181 | + $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC'); |
|
182 | 182 | foreach ($rows as $record) { |
183 | 183 | array_push($languagesList, $record['name']); |
184 | - if ($session->get('user-language') === $record['name'] ) { |
|
184 | + if ($session->get('user-language') === $record['name']) { |
|
185 | 185 | $session->set('user-language_flag', $record['flag']); |
186 | 186 | $session->set('user-language_code', $record['code']); |
187 | 187 | //$session->set('user-language_label', $record['label']); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // CHECK IF SESSION EXISTS AND IF SESSION IS VALID |
239 | 239 | if (empty($session->get('user-session_duration')) === false) { |
240 | 240 | $dataSession = DB::queryFirstRow( |
241 | - 'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i', |
|
241 | + 'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i', |
|
242 | 242 | $session->get('user-id') |
243 | 243 | ); |
244 | 244 | } else { |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | && ($session->has('user-admin') && $session->get('user-admin') && null !== $session->get('user-admin') && $session->get('user-admin') === 1) |
294 | 294 | ) { |
295 | 295 | $row = DB::queryFirstRow( |
296 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule', |
|
296 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule', |
|
297 | 297 | [ |
298 | 298 | 'type' => 'admin', |
299 | 299 | 'intitule' => 'teampass_version', |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | syslog( |
336 | 336 | LOG_WARNING, |
337 | - 'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})" |
|
337 | + 'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})" |
|
338 | 338 | ); |
339 | 339 | // erase session table |
340 | 340 | $session->invalidate(); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($session->has('user-timezone') && null !== $session->get('user-id') && empty($session->get('user-id')) === false) { |
389 | 389 | // query on user |
390 | 390 | $data = DB::queryFirstRow( |
391 | - 'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM ' . prefixTable('users') . ' WHERE id=%i', |
|
391 | + 'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM '.prefixTable('users').' WHERE id=%i', |
|
392 | 392 | $session->get('user-id') |
393 | 393 | ); |
394 | 394 | //Check if user has been deleted or unlogged |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $data['groupes_visibles'], |
436 | 436 | $data['groupes_interdits'], |
437 | 437 | $data['admin'], |
438 | - is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']), |
|
438 | + is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']), |
|
439 | 439 | $SETTINGS |
440 | 440 | ); |
441 | 441 | if ($session->has('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') && null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) { |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $session->set('system-item_fields', []); |
471 | 471 | $rows = DB::query( |
472 | 472 | 'SELECT * |
473 | - FROM ' . prefixTable('categories') . ' |
|
473 | + FROM ' . prefixTable('categories').' |
|
474 | 474 | WHERE level=%i', |
475 | 475 | '0' |
476 | 476 | ); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | // get each field |
480 | 480 | $rows2 = DB::query( |
481 | 481 | 'SELECT * |
482 | - FROM ' . prefixTable('categories') . ' |
|
482 | + FROM ' . prefixTable('categories').' |
|
483 | 483 | WHERE parent_id=%i |
484 | 484 | ORDER BY `order` ASC', |
485 | 485 | $record['id'] |
@@ -566,5 +566,5 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | /* CHECK NUMBER OF USER ONLINE */ |
569 | -DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600); |
|
569 | +DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600); |
|
570 | 570 | $session->set('system-nb_users_online', DB::count()); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ) { |
74 | 74 | // Not allowed page |
75 | 75 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
76 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
76 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
77 | 77 | exit; |
78 | 78 | } |
79 | 79 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | if (null === $session->get('user-accessible_folders') |
93 | 93 | || empty($session->get('user-accessible_folders')) === true |
94 | 94 | ) { |
95 | - echo '{"sEcho": ' . $request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }'; |
|
95 | + echo '{"sEcho": '.$request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }'; |
|
96 | 96 | exit; |
97 | 97 | } |
98 | 98 | |
99 | 99 | //Columns name |
100 | -$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data'];// |
|
100 | +$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data']; // |
|
101 | 101 | $aSortTypes = ['ASC', 'DESC']; |
102 | 102 | //init SQL variables |
103 | 103 | $sOrder = $sLimit = $sWhere = ''; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | //Get current user "personal folder" ID |
119 | 119 | $row = DB::query( |
120 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i', |
|
120 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i', |
|
121 | 121 | intval($session->get('user-id')) |
122 | 122 | ); |
123 | 123 | //get list of personal folders |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | $listPf = ''; |
127 | 127 | if (empty($row['id']) === false) { |
128 | 128 | $rows = DB::query( |
129 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
129 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
130 | 130 | WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i', |
131 | 131 | filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT), |
132 | 132 | filter_var($session->get('user-id'), FILTER_SANITIZE_NUMBER_INT) |
133 | 133 | ); |
134 | 134 | foreach ($rows as $record) { |
135 | - if (! in_array($record['id'], $arrayPf)) { |
|
135 | + if (!in_array($record['id'], $arrayPf)) { |
|
136 | 136 | //build an array of personal folders ids |
137 | 137 | array_push($arrayPf, $record['id']); |
138 | 138 | //build also a string with those ids |
139 | 139 | if (empty($listPf)) { |
140 | 140 | $listPf = $record['id']; |
141 | 141 | } else { |
142 | - $listPf .= ', ' . $record['id']; |
|
142 | + $listPf .= ', '.$record['id']; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | //Paging |
150 | 150 | $sLimit = ''; |
151 | 151 | if (null !== $request->query->get('start') && $request->query->get('length') !== '-1') { |
152 | - $sLimit = 'LIMIT ' . $request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT) . ', ' . $request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT) . ''; |
|
152 | + $sLimit = 'LIMIT '.$request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT).', '.$request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT).''; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //Ordering |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | } |
164 | 164 | $sOrder = 'ORDER BY '; |
165 | 165 | if ($orderParam[0]['column'] >= 0) { |
166 | - $sOrder .= '' . $aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' ' |
|
167 | - . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . ', '; |
|
166 | + $sOrder .= ''.$aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)].' ' |
|
167 | + . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS).', '; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $sOrder = substr_replace($sOrder, '', -2); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $sOrder = ''; |
173 | 173 | } |
174 | 174 | } else { |
175 | - $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC'; |
|
175 | + $sOrder = 'ORDER BY '.$aColumns[1].' ASC'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | // Define criteria |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | if (empty($search_criteria) === false) { |
197 | 197 | $sWhere .= ' AND ('; |
198 | 198 | for ($i = 0; $i < count($aColumns); ++$i) { |
199 | - $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR '; |
|
199 | + $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR '; |
|
200 | 200 | } |
201 | - $sWhere = substr_replace((string) $sWhere, '', -3) . ') '; |
|
201 | + $sWhere = substr_replace((string) $sWhere, '', -3).') '; |
|
202 | 202 | $crit = [ |
203 | 203 | 'idtree' => array_unique($folders), |
204 | 204 | '0' => $search_criteria, |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | |
236 | 236 | // Do NOT show the items in PERSONAL FOLDERS |
237 | 237 | if (empty($listPf) === false) { |
238 | - $sWhere = 'WHERE ' . $sWhere . ' AND c.id_tree NOT IN %ls_pf '; |
|
238 | + $sWhere = 'WHERE '.$sWhere.' AND c.id_tree NOT IN %ls_pf '; |
|
239 | 239 | } else { |
240 | - $sWhere = 'WHERE ' . $sWhere; |
|
240 | + $sWhere = 'WHERE '.$sWhere; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Do queries |
244 | 244 | DB::query( |
245 | 245 | "SELECT c.id |
246 | - FROM " . prefixTable('cache') . " AS c |
|
247 | - LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id) |
|
246 | + FROM " . prefixTable('cache')." AS c |
|
247 | + LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id) |
|
248 | 248 | {$sWhere} |
249 | 249 | {$sOrder}", |
250 | 250 | $crit |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | $iTotal = DB::count(); |
253 | 253 | $rows = DB::query( |
254 | 254 | "SELECT c.*, ci.data, i.item_key |
255 | - FROM " . prefixTable('cache') . " AS c |
|
256 | - LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id) |
|
257 | - INNER JOIN " . prefixTable('items') . " AS i ON (i.id = c.id) |
|
255 | + FROM " . prefixTable('cache')." AS c |
|
256 | + LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id) |
|
257 | + INNER JOIN " . prefixTable('items')." AS i ON (i.id = c.id) |
|
258 | 258 | {$sWhere} |
259 | 259 | {$sOrder} |
260 | 260 | {$sLimit}", |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (null === $request->query->get('type')) { |
280 | 280 | $sOutput = '{'; |
281 | 281 | if (null !== $request->query->get('draw')) { |
282 | - $sOutput .= '"draw": ' . $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
282 | + $sOutput .= '"draw": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
283 | 283 | } |
284 | 284 | $sOutput .= '"data": ['; |
285 | 285 | $sOutputConst = ''; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | foreach (explode(';', $session->get('user-roles')) as $role) { |
297 | 297 | //db::debugmode(true); |
298 | 298 | $access = DB::queryFirstRow( |
299 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
299 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
300 | 300 | $role, |
301 | 301 | $record['id_tree'] |
302 | 302 | ); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel; |
318 | 318 | if ($accessLevel === 0) { |
319 | - $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">'; |
|
319 | + $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">'; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | if ((int) $accessLevel === 0) { |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | if (empty($restrictedTo)) { |
357 | 357 | $restrictedTo = $session->get('user-id'); |
358 | 358 | } else { |
359 | - $restrictedTo .= ',' . $session->get('user-id'); |
|
359 | + $restrictedTo .= ','.$session->get('user-id'); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | 363 | //col1 |
364 | - $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . $lang->get('open_url_link') . '\" onClick=\"window.location.href='index.php?page=items&group=' . $record['id_tree'] . '&id=' . $record['id'] . ''\" style=\"cursor:pointer;\"></i>' . |
|
365 | - '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . stripslashes($lang->get('see_item_title')) . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '",' ; |
|
364 | + $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.$lang->get('open_url_link').'\" onClick=\"window.location.href='index.php?page=items&group='.$record['id_tree'].'&id='.$record['id'].''\" style=\"cursor:pointer;\"></i>'. |
|
365 | + '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.stripslashes($lang->get('see_item_title')).'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'",'; |
|
366 | 366 | //col2 |
367 | - $sOutputItem .= '"'.base64_encode('<span id=\"item_label-' . $record['id'] . '\">' . (str_replace("\\", "\", (string) $record['label'])) . '</span>').'", '; // replace backslash #3015 |
|
367 | + $sOutputItem .= '"'.base64_encode('<span id=\"item_label-'.$record['id'].'\">'.(str_replace("\\", "\", (string) $record['label'])).'</span>').'", '; // replace backslash #3015 |
|
368 | 368 | //col3 |
369 | - $sOutputItem .= '"' . base64_encode(str_replace('&', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))) . '", '; |
|
369 | + $sOutputItem .= '"'.base64_encode(str_replace('&', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))).'", '; |
|
370 | 370 | //col4 |
371 | 371 | //get restriction from ROles |
372 | 372 | $restrictedToRole = false; |
373 | 373 | $rTmp = DB::queryFirstColumn( |
374 | - 'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', |
|
374 | + 'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', |
|
375 | 375 | $record['id'] |
376 | 376 | ); |
377 | 377 | // We considere here that if user has at least one group similar to the object ones |
@@ -389,14 +389,14 @@ discard block |
||
389 | 389 | } else { |
390 | 390 | $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description'])); |
391 | 391 | if (strlen($txt) > 50) { |
392 | - $sOutputItem .= '"' . base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)) . '", '; |
|
392 | + $sOutputItem .= '"'.base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)).'", '; |
|
393 | 393 | } else { |
394 | - $sOutputItem .= '"' . base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))) . '", '; |
|
394 | + $sOutputItem .= '"'.base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))).'", '; |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
398 | 398 | //col5 - TAGS |
399 | - $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)) . '", '; |
|
399 | + $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)).'", '; |
|
400 | 400 | // col6 - URL |
401 | 401 | if ($record['url'] !== '0') { |
402 | 402 | $sOutputItem .= '"'.htmlspecialchars(filter_var($record['url'], FILTER_SANITIZE_URL)).'", '; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | //col7 - Prepare the Treegrid |
408 | - $sOutputItem .= '"' . base64_encode(stripslashes((string) $record['folder'])) . '"'; |
|
408 | + $sOutputItem .= '"'.base64_encode(stripslashes((string) $record['folder'])).'"'; |
|
409 | 409 | //Finish the line |
410 | 410 | //$sOutputItem .= '], '; |
411 | 411 | if ($getItemInList === true) { |
@@ -414,17 +414,17 @@ discard block |
||
414 | 414 | --$iTotal; |
415 | 415 | } |
416 | 416 | } |
417 | - if (! empty($sOutputConst)) { |
|
417 | + if (!empty($sOutputConst)) { |
|
418 | 418 | $sOutput .= substr_replace($sOutputConst, '', -2); |
419 | 419 | } |
420 | 420 | $sOutput .= '], '; |
421 | - $sOutput .= '"recordsTotal": ' . $iTotal . ', '; |
|
422 | - $sOutput .= '"recordsFiltered": ' . $iTotal . ' }'; |
|
421 | + $sOutput .= '"recordsTotal": '.$iTotal.', '; |
|
422 | + $sOutput .= '"recordsFiltered": '.$iTotal.' }'; |
|
423 | 423 | // file deepcode ignore XSS: data is secured |
424 | 424 | echo ($sOutput); |
425 | 425 | } elseif (null !== $request->query->get('type') && ($request->query->get('type') === 'search_for_items' || $request->query->get('type') === 'search_for_items_with_tags')) { |
426 | 426 | include_once 'main.functions.php'; |
427 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
427 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
428 | 428 | |
429 | 429 | $totalItems = $request->query->filter('totalItems', null, FILTER_SANITIZE_NUMBER_INT); |
430 | 430 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $arr_data[$record['id']]['tree_id'] = (int) $record['id_tree']; |
436 | 436 | $arr_data[$record['id']]['label'] = (string) $record['label']; |
437 | 437 | $arr_data[$record['id']]['desc'] = (string) strip_tags(explode('<br>', $record['description'])[0]); |
438 | - $arr_data[$record['id']]['folder'] = (string)$record['folder']; |
|
438 | + $arr_data[$record['id']]['folder'] = (string) $record['folder']; |
|
439 | 439 | $arr_data[$record['id']]['login'] = (string) strtr($record['login'], '"', '"'); |
440 | 440 | $arr_data[$record['id']]['item_key'] = (string) $record['item_key']; |
441 | 441 | $arr_data[$record['id']]['link'] = (string) $record['url'] !== '0' && empty($record['url']) === false ? filter_var($record['url'], FILTER_SANITIZE_URL) : ''; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | |
449 | 449 | // Anyone can modify? |
450 | 450 | $tmp = DB::queryFirstRow( |
451 | - 'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i', |
|
451 | + 'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i', |
|
452 | 452 | $record['id'] |
453 | 453 | ); |
454 | 454 | if (count($tmp) > 0) { |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles) |
480 | 480 | $user_is_included_in_role = 0; |
481 | 481 | $roles = DB::query( |
482 | - 'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i', |
|
482 | + 'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i', |
|
483 | 483 | $record['id'] |
484 | 484 | ); |
485 | 485 | if (count($roles) > 0) { |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | if (empty($restrictedTo)) { |
503 | 503 | $restrictedTo = $session->get('user-id'); |
504 | 504 | } else { |
505 | - $restrictedTo .= ',' . $session->get('user-id'); |
|
505 | + $restrictedTo .= ','.$session->get('user-id'); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $arrTmp = []; |
601 | 601 | foreach (explode(';', $session->get('user-roles')) as $role) { |
602 | 602 | $access = DB::queryFirstRow( |
603 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
603 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
604 | 604 | $role, |
605 | 605 | $record['id_tree'] |
606 | 606 | ); |
@@ -651,8 +651,8 @@ discard block |
||
651 | 651 | ) { |
652 | 652 | $data_item = DB::queryFirstRow( |
653 | 653 | 'SELECT i.pw AS pw, s.share_key AS share_key |
654 | - FROM ' . prefixTable('items') . ' AS i |
|
655 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
654 | + FROM ' . prefixTable('items').' AS i |
|
655 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
656 | 656 | WHERE i.id = %i AND s.user_id = %i', |
657 | 657 | $record['id'], |
658 | 658 | $session->get('user-id') |