@@ -122,26 +122,26 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array |
| 124 | 124 | { |
| 125 | - $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key; |
|
| 125 | + $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key; |
|
| 126 | 126 | $err = false; |
| 127 | 127 | // load PhpEncryption library |
| 128 | 128 | if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) { |
| 129 | 129 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 130 | 130 | } else { |
| 131 | - $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/'; |
|
| 131 | + $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Check if class already exists |
| 135 | 135 | if (!class_exists('Defuse\Crypto\Crypto', false)) { |
| 136 | - include_once $path . 'Crypto.php'; |
|
| 137 | - include_once $path . 'Encoding.php'; |
|
| 138 | - include_once $path . 'DerivedKeys.php'; |
|
| 139 | - include_once $path . 'Key.php'; |
|
| 140 | - include_once $path . 'KeyOrPassword.php'; |
|
| 141 | - include_once $path . 'File.php'; |
|
| 142 | - include_once $path . 'RuntimeTests.php'; |
|
| 143 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 144 | - include_once $path . 'Core.php'; |
|
| 136 | + include_once $path.'Crypto.php'; |
|
| 137 | + include_once $path.'Encoding.php'; |
|
| 138 | + include_once $path.'DerivedKeys.php'; |
|
| 139 | + include_once $path.'Key.php'; |
|
| 140 | + include_once $path.'KeyOrPassword.php'; |
|
| 141 | + include_once $path.'File.php'; |
|
| 142 | + include_once $path.'RuntimeTests.php'; |
|
| 143 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 144 | + include_once $path.'Core.php'; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // convert KEY |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - include_once $path . 'Crypto.php'; |
|
| 191 | - include_once $path . 'Encoding.php'; |
|
| 192 | - include_once $path . 'DerivedKeys.php'; |
|
| 193 | - include_once $path . 'Key.php'; |
|
| 194 | - include_once $path . 'KeyOrPassword.php'; |
|
| 195 | - include_once $path . 'File.php'; |
|
| 196 | - include_once $path . 'RuntimeTests.php'; |
|
| 197 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 198 | - include_once $path . 'Core.php'; |
|
| 190 | + include_once $path.'Crypto.php'; |
|
| 191 | + include_once $path.'Encoding.php'; |
|
| 192 | + include_once $path.'DerivedKeys.php'; |
|
| 193 | + include_once $path.'Key.php'; |
|
| 194 | + include_once $path.'KeyOrPassword.php'; |
|
| 195 | + include_once $path.'File.php'; |
|
| 196 | + include_once $path.'RuntimeTests.php'; |
|
| 197 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 198 | + include_once $path.'Core.php'; |
|
| 199 | 199 | $key = \Defuse\Crypto\Key::createNewRandomKey(); |
| 200 | 200 | $key = $key->saveToAsciiSafeString(); |
| 201 | 201 | return $key; |
@@ -217,15 +217,15 @@ discard block |
||
| 217 | 217 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - include_once $path . 'Crypto.php'; |
|
| 221 | - include_once $path . 'Encoding.php'; |
|
| 222 | - include_once $path . 'DerivedKeys.php'; |
|
| 223 | - include_once $path . 'Key.php'; |
|
| 224 | - include_once $path . 'KeyOrPassword.php'; |
|
| 225 | - include_once $path . 'File.php'; |
|
| 226 | - include_once $path . 'RuntimeTests.php'; |
|
| 227 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 228 | - include_once $path . 'Core.php'; |
|
| 220 | + include_once $path.'Crypto.php'; |
|
| 221 | + include_once $path.'Encoding.php'; |
|
| 222 | + include_once $path.'DerivedKeys.php'; |
|
| 223 | + include_once $path.'Key.php'; |
|
| 224 | + include_once $path.'KeyOrPassword.php'; |
|
| 225 | + include_once $path.'File.php'; |
|
| 226 | + include_once $path.'RuntimeTests.php'; |
|
| 227 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 228 | + include_once $path.'Core.php'; |
|
| 229 | 229 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk); |
| 230 | 230 | return $protected_key->saveToAsciiSafeString(); // save this in user table |
| 231 | 231 | } |
@@ -247,15 +247,15 @@ discard block |
||
| 247 | 247 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - include_once $path . 'Crypto.php'; |
|
| 251 | - include_once $path . 'Encoding.php'; |
|
| 252 | - include_once $path . 'DerivedKeys.php'; |
|
| 253 | - include_once $path . 'Key.php'; |
|
| 254 | - include_once $path . 'KeyOrPassword.php'; |
|
| 255 | - include_once $path . 'File.php'; |
|
| 256 | - include_once $path . 'RuntimeTests.php'; |
|
| 257 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 258 | - include_once $path . 'Core.php'; |
|
| 250 | + include_once $path.'Crypto.php'; |
|
| 251 | + include_once $path.'Encoding.php'; |
|
| 252 | + include_once $path.'DerivedKeys.php'; |
|
| 253 | + include_once $path.'Key.php'; |
|
| 254 | + include_once $path.'KeyOrPassword.php'; |
|
| 255 | + include_once $path.'File.php'; |
|
| 256 | + include_once $path.'RuntimeTests.php'; |
|
| 257 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 258 | + include_once $path.'Core.php'; |
|
| 259 | 259 | try { |
| 260 | 260 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); |
| 261 | 261 | $user_key = $protected_key->unlockKey($psk); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | function trimElement($chaine, string $element): string |
| 296 | 296 | { |
| 297 | - if (! empty($chaine)) { |
|
| 297 | + if (!empty($chaine)) { |
|
| 298 | 298 | if (is_array($chaine) === true) { |
| 299 | 299 | $chaine = implode(';', $chaine); |
| 300 | 300 | } |
@@ -340,8 +340,8 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | function db_error_handler(array $params): void |
| 342 | 342 | { |
| 343 | - echo 'Error: ' . $params['error'] . "<br>\n"; |
|
| 344 | - echo 'Query: ' . $params['query'] . "<br>\n"; |
|
| 343 | + echo 'Error: '.$params['error']."<br>\n"; |
|
| 344 | + echo 'Query: '.$params['query']."<br>\n"; |
|
| 345 | 345 | throw new Exception('Error - Query', 1); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | $SETTINGS |
| 364 | 364 | ) { |
| 365 | 365 | //load ClassLoader |
| 366 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 366 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 367 | 367 | // Load superglobal |
| 368 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 368 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 369 | 369 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 370 | 370 | //Connect to DB |
| 371 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 371 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 372 | 372 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 373 | 373 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 374 | 374 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | DB::$port = DB_PORT; |
| 380 | 380 | DB::$encoding = DB_ENCODING; |
| 381 | 381 | //Build tree |
| 382 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 382 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 383 | 383 | $tree->register(); |
| 384 | 384 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 385 | 385 | // Check if user is ADMINISTRATOR |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | function identAdmin($idFonctions, $SETTINGS, $tree) |
| 423 | 423 | { |
| 424 | 424 | // Load superglobal |
| 425 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 425 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 426 | 426 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 427 | 427 | // Init |
| 428 | 428 | $groupesVisibles = []; |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION'); |
| 442 | 442 | $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION'); |
| 443 | 443 | // Get list of Folders |
| 444 | - $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
| 444 | + $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
| 445 | 445 | foreach ($rows as $record) { |
| 446 | 446 | array_push($groupesVisibles, $record['id']); |
| 447 | 447 | } |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | // Get ID of personal folder |
| 462 | 462 | $persfld = DB::queryfirstrow( |
| 463 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', |
|
| 463 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s', |
|
| 464 | 464 | $globalsUserId |
| 465 | 465 | ); |
| 466 | 466 | if (empty($persfld['id']) === false) { |
@@ -481,20 +481,20 @@ discard block |
||
| 481 | 481 | // get complete list of ROLES |
| 482 | 482 | $tmp = explode(';', $idFonctions); |
| 483 | 483 | $rows = DB::query( |
| 484 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 484 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 485 | 485 | ORDER BY title ASC' |
| 486 | 486 | ); |
| 487 | 487 | foreach ($rows as $record) { |
| 488 | - if (! empty($record['id']) && ! in_array($record['id'], $tmp)) { |
|
| 488 | + if (!empty($record['id']) && !in_array($record['id'], $tmp)) { |
|
| 489 | 489 | array_push($tmp, $record['id']); |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION'); |
| 493 | 493 | $superGlobal->put('is_admin', 1, 'SESSION'); |
| 494 | 494 | // Check if admin has created Folders and Roles |
| 495 | - DB::query('SELECT * FROM ' . prefixTable('nested_tree') . ''); |
|
| 495 | + DB::query('SELECT * FROM '.prefixTable('nested_tree').''); |
|
| 496 | 496 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 497 | - DB::query('SELECT * FROM ' . prefixTable('roles_title')); |
|
| 497 | + DB::query('SELECT * FROM '.prefixTable('roles_title')); |
|
| 498 | 498 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 499 | 499 | } |
| 500 | 500 | |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | object $tree |
| 537 | 537 | ) { |
| 538 | 538 | // Load superglobal |
| 539 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 539 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 540 | 540 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 541 | 541 | // Init |
| 542 | 542 | $superGlobal->put('groupes_visibles', [], 'SESSION'); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | // Get list of folders depending on Roles |
| 565 | 565 | $rows = DB::query( |
| 566 | 566 | 'SELECT * |
| 567 | - FROM ' . prefixTable('roles_values') . ' |
|
| 567 | + FROM ' . prefixTable('roles_values').' |
|
| 568 | 568 | WHERE role_id IN %li AND type IN %ls', |
| 569 | 569 | $userRoles, |
| 570 | 570 | ['W', 'ND', 'NE', 'NDNE', 'R'] |
@@ -589,10 +589,10 @@ discard block |
||
| 589 | 589 | // Does this user is allowed to see other items |
| 590 | 590 | $inc = 0; |
| 591 | 591 | $rows = DB::query( |
| 592 | - 'SELECT id, id_tree FROM ' . prefixTable('items') . ' |
|
| 592 | + 'SELECT id, id_tree FROM '.prefixTable('items').' |
|
| 593 | 593 | WHERE restricted_to LIKE %ss AND inactif = %s'. |
| 594 | 594 | (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''), |
| 595 | - $globalsUserId . ';', |
|
| 595 | + $globalsUserId.';', |
|
| 596 | 596 | '0' |
| 597 | 597 | ); |
| 598 | 598 | foreach ($rows as $record) { |
@@ -606,8 +606,8 @@ discard block |
||
| 606 | 606 | // Check for the users roles if some specific rights exist on items |
| 607 | 607 | $rows = DB::query( |
| 608 | 608 | 'SELECT i.id_tree, r.item_id |
| 609 | - FROM ' . prefixTable('items') . ' as i |
|
| 610 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id) |
|
| 609 | + FROM ' . prefixTable('items').' as i |
|
| 610 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id) |
|
| 611 | 611 | WHERE r.role_id IN %li AND i.id_tree <> "" |
| 612 | 612 | ORDER BY i.id_tree ASC', |
| 613 | 613 | $userRoles |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | ) { |
| 629 | 629 | $persoFld = DB::queryfirstrow( |
| 630 | 630 | 'SELECT id |
| 631 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 631 | + FROM ' . prefixTable('nested_tree').' |
|
| 632 | 632 | WHERE title = %s AND personal_folder = %i'. |
| 633 | 633 | (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''), |
| 634 | 634 | $globalsUserId, |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | } |
| 663 | 663 | $persoFlds = DB::query( |
| 664 | 664 | 'SELECT id |
| 665 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 665 | + FROM ' . prefixTable('nested_tree').' |
|
| 666 | 666 | WHERE %l', |
| 667 | 667 | $where |
| 668 | 668 | ); |
@@ -703,16 +703,16 @@ discard block |
||
| 703 | 703 | 'SESSION' |
| 704 | 704 | ); |
| 705 | 705 | // Folders and Roles numbers |
| 706 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
| 706 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
| 707 | 707 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 708 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
| 708 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
| 709 | 709 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 710 | 710 | // check if change proposals on User's items |
| 711 | 711 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
| 712 | 712 | DB::query( |
| 713 | 713 | 'SELECT * |
| 714 | - FROM ' . prefixTable('items_change') . ' AS c |
|
| 715 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
| 714 | + FROM ' . prefixTable('items_change').' AS c |
|
| 715 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
| 716 | 716 | WHERE i.action = %s AND i.id_user = %i', |
| 717 | 717 | 'at_creation', |
| 718 | 718 | $globalsUserId |
@@ -756,9 +756,9 @@ discard block |
||
| 756 | 756 | */ |
| 757 | 757 | function cacheTableRefresh(array $SETTINGS): void |
| 758 | 758 | { |
| 759 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 759 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 760 | 760 | //Connect to DB |
| 761 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 761 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 762 | 762 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 763 | 763 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 764 | 764 | } |
@@ -773,12 +773,12 @@ discard block |
||
| 773 | 773 | $tree->register(); |
| 774 | 774 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 775 | 775 | // truncate table |
| 776 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
| 776 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
| 777 | 777 | // reload date |
| 778 | 778 | $rows = DB::query( |
| 779 | 779 | 'SELECT * |
| 780 | - FROM ' . prefixTable('items') . ' as i |
|
| 781 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 780 | + FROM ' . prefixTable('items').' as i |
|
| 781 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 782 | 782 | AND l.action = %s |
| 783 | 783 | AND i.inactif = %i', |
| 784 | 784 | 'at_creation', |
@@ -790,18 +790,18 @@ discard block |
||
| 790 | 790 | $tags = ''; |
| 791 | 791 | $itemTags = DB::query( |
| 792 | 792 | 'SELECT tag |
| 793 | - FROM ' . prefixTable('tags') . ' |
|
| 793 | + FROM ' . prefixTable('tags').' |
|
| 794 | 794 | WHERE item_id = %i AND tag != ""', |
| 795 | 795 | $record['id'] |
| 796 | 796 | ); |
| 797 | 797 | foreach ($itemTags as $itemTag) { |
| 798 | - $tags .= $itemTag['tag'] . ' '; |
|
| 798 | + $tags .= $itemTag['tag'].' '; |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | // Get renewal period |
| 802 | 802 | $resNT = DB::queryfirstrow( |
| 803 | 803 | 'SELECT renewal_period |
| 804 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 804 | + FROM ' . prefixTable('nested_tree').' |
|
| 805 | 805 | WHERE id = %i', |
| 806 | 806 | $record['id_tree'] |
| 807 | 807 | ); |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | // Is this a User id? |
| 815 | 815 | $user = DB::queryfirstrow( |
| 816 | 816 | 'SELECT id, login |
| 817 | - FROM ' . prefixTable('users') . ' |
|
| 817 | + FROM ' . prefixTable('users').' |
|
| 818 | 818 | WHERE id = %i', |
| 819 | 819 | $elem->title |
| 820 | 820 | ); |
@@ -832,11 +832,11 @@ discard block |
||
| 832 | 832 | 'id' => $record['id'], |
| 833 | 833 | 'label' => $record['label'], |
| 834 | 834 | 'description' => $record['description'] ?? '', |
| 835 | - 'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0', |
|
| 835 | + 'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0', |
|
| 836 | 836 | 'tags' => $tags, |
| 837 | 837 | 'id_tree' => $record['id_tree'], |
| 838 | 838 | 'perso' => $record['perso'], |
| 839 | - 'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
| 839 | + 'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
| 840 | 840 | 'login' => $record['login'] ?? '', |
| 841 | 841 | 'folder' => implode(' > ', $folder), |
| 842 | 842 | 'author' => $record['id_user'], |
@@ -856,12 +856,12 @@ discard block |
||
| 856 | 856 | */ |
| 857 | 857 | function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void |
| 858 | 858 | { |
| 859 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 859 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 860 | 860 | // Load superglobal |
| 861 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 861 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 862 | 862 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 863 | 863 | //Connect to DB |
| 864 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 864 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 865 | 865 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 866 | 866 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 867 | 867 | } |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | // get new value from db |
| 879 | 879 | $data = DB::queryfirstrow( |
| 880 | 880 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
| 881 | - FROM ' . prefixTable('items') . ' |
|
| 881 | + FROM ' . prefixTable('items').' |
|
| 882 | 882 | WHERE id=%i', |
| 883 | 883 | $ident |
| 884 | 884 | ); |
@@ -886,12 +886,12 @@ discard block |
||
| 886 | 886 | $tags = ''; |
| 887 | 887 | $itemTags = DB::query( |
| 888 | 888 | 'SELECT tag |
| 889 | - FROM ' . prefixTable('tags') . ' |
|
| 889 | + FROM ' . prefixTable('tags').' |
|
| 890 | 890 | WHERE item_id = %i AND tag != ""', |
| 891 | 891 | $ident |
| 892 | 892 | ); |
| 893 | 893 | foreach ($itemTags as $itemTag) { |
| 894 | - $tags .= $itemTag['tag'] . ' '; |
|
| 894 | + $tags .= $itemTag['tag'].' '; |
|
| 895 | 895 | } |
| 896 | 896 | // form id_tree to full foldername |
| 897 | 897 | $folder = []; |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | // Is this a User id? |
| 903 | 903 | $user = DB::queryfirstrow( |
| 904 | 904 | 'SELECT id, login |
| 905 | - FROM ' . prefixTable('users') . ' |
|
| 905 | + FROM ' . prefixTable('users').' |
|
| 906 | 906 | WHERE id = %i', |
| 907 | 907 | $elem->title |
| 908 | 908 | ); |
@@ -920,10 +920,10 @@ discard block |
||
| 920 | 920 | 'label' => $data['label'], |
| 921 | 921 | 'description' => $data['description'], |
| 922 | 922 | 'tags' => $tags, |
| 923 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
| 923 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
| 924 | 924 | 'id_tree' => $data['id_tree'], |
| 925 | 925 | 'perso' => $data['perso'], |
| 926 | - 'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
| 926 | + 'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
| 927 | 927 | 'login' => $data['login'] ?? '', |
| 928 | 928 | 'folder' => implode(' » ', $folder), |
| 929 | 929 | 'author' => $superGlobal->get('user_id', 'SESSION'), |
@@ -941,14 +941,14 @@ discard block |
||
| 941 | 941 | */ |
| 942 | 942 | function cacheTableAdd(array $SETTINGS, ?int $ident = null): void |
| 943 | 943 | { |
| 944 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 944 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 945 | 945 | // Load superglobal |
| 946 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 946 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 947 | 947 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 948 | 948 | // Get superglobals |
| 949 | 949 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
| 950 | 950 | //Connect to DB |
| 951 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 951 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 952 | 952 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 953 | 953 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 954 | 954 | } |
@@ -965,8 +965,8 @@ discard block |
||
| 965 | 965 | // get new value from db |
| 966 | 966 | $data = DB::queryFirstRow( |
| 967 | 967 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
| 968 | - FROM ' . prefixTable('items') . ' as i |
|
| 969 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 968 | + FROM ' . prefixTable('items').' as i |
|
| 969 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 970 | 970 | WHERE i.id = %i |
| 971 | 971 | AND l.action = %s', |
| 972 | 972 | $ident, |
@@ -976,12 +976,12 @@ discard block |
||
| 976 | 976 | $tags = ''; |
| 977 | 977 | $itemTags = DB::query( |
| 978 | 978 | 'SELECT tag |
| 979 | - FROM ' . prefixTable('tags') . ' |
|
| 979 | + FROM ' . prefixTable('tags').' |
|
| 980 | 980 | WHERE item_id = %i AND tag != ""', |
| 981 | 981 | $ident |
| 982 | 982 | ); |
| 983 | 983 | foreach ($itemTags as $itemTag) { |
| 984 | - $tags .= $itemTag['tag'] . ' '; |
|
| 984 | + $tags .= $itemTag['tag'].' '; |
|
| 985 | 985 | } |
| 986 | 986 | // form id_tree to full foldername |
| 987 | 987 | $folder = []; |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | // Is this a User id? |
| 993 | 993 | $user = DB::queryfirstrow( |
| 994 | 994 | 'SELECT id, login |
| 995 | - FROM ' . prefixTable('users') . ' |
|
| 995 | + FROM ' . prefixTable('users').' |
|
| 996 | 996 | WHERE id = %i', |
| 997 | 997 | $elem->title |
| 998 | 998 | ); |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | 'label' => $data['label'], |
| 1012 | 1012 | 'description' => $data['description'], |
| 1013 | 1013 | 'tags' => isset($tags) && empty($tags) === false ? $tags : 'None', |
| 1014 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
| 1014 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
| 1015 | 1015 | 'id_tree' => $data['id_tree'], |
| 1016 | 1016 | 'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0', |
| 1017 | 1017 | 'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0', |
@@ -1033,52 +1033,52 @@ discard block |
||
| 1033 | 1033 | function getStatisticsData(array $SETTINGS): array |
| 1034 | 1034 | { |
| 1035 | 1035 | DB::query( |
| 1036 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1036 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1037 | 1037 | 0 |
| 1038 | 1038 | ); |
| 1039 | 1039 | $counter_folders = DB::count(); |
| 1040 | 1040 | DB::query( |
| 1041 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1041 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1042 | 1042 | 1 |
| 1043 | 1043 | ); |
| 1044 | 1044 | $counter_folders_perso = DB::count(); |
| 1045 | 1045 | DB::query( |
| 1046 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1046 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1047 | 1047 | 0 |
| 1048 | 1048 | ); |
| 1049 | 1049 | $counter_items = DB::count(); |
| 1050 | 1050 | DB::query( |
| 1051 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1051 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1052 | 1052 | 1 |
| 1053 | 1053 | ); |
| 1054 | 1054 | $counter_items_perso = DB::count(); |
| 1055 | 1055 | DB::query( |
| 1056 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
| 1056 | + 'SELECT id FROM '.prefixTable('users').'' |
|
| 1057 | 1057 | ); |
| 1058 | 1058 | $counter_users = DB::count(); |
| 1059 | 1059 | DB::query( |
| 1060 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
| 1060 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
| 1061 | 1061 | 1 |
| 1062 | 1062 | ); |
| 1063 | 1063 | $admins = DB::count(); |
| 1064 | 1064 | DB::query( |
| 1065 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
| 1065 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
| 1066 | 1066 | 1 |
| 1067 | 1067 | ); |
| 1068 | 1068 | $managers = DB::count(); |
| 1069 | 1069 | DB::query( |
| 1070 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
| 1070 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
| 1071 | 1071 | 1 |
| 1072 | 1072 | ); |
| 1073 | 1073 | $readOnly = DB::count(); |
| 1074 | 1074 | // list the languages |
| 1075 | 1075 | $usedLang = []; |
| 1076 | 1076 | $tp_languages = DB::query( |
| 1077 | - 'SELECT name FROM ' . prefixTable('languages') |
|
| 1077 | + 'SELECT name FROM '.prefixTable('languages') |
|
| 1078 | 1078 | ); |
| 1079 | 1079 | foreach ($tp_languages as $tp_language) { |
| 1080 | 1080 | DB::query( |
| 1081 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
| 1081 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
| 1082 | 1082 | $tp_language['name'] |
| 1083 | 1083 | ); |
| 1084 | 1084 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1087,12 +1087,12 @@ discard block |
||
| 1087 | 1087 | // get list of ips |
| 1088 | 1088 | $usedIp = []; |
| 1089 | 1089 | $tp_ips = DB::query( |
| 1090 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
| 1090 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
| 1091 | 1091 | ); |
| 1092 | 1092 | foreach ($tp_ips as $ip) { |
| 1093 | 1093 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
| 1094 | 1094 | $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']]; |
| 1095 | - } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
| 1095 | + } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
| 1096 | 1096 | $usedIp[$ip['user_ip']] = 1; |
| 1097 | 1097 | } |
| 1098 | 1098 | } |
@@ -1158,14 +1158,14 @@ discard block |
||
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | // Load settings |
| 1161 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 1161 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 1162 | 1162 | // Load superglobal |
| 1163 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1163 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1164 | 1164 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1165 | 1165 | // Get user language |
| 1166 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php'; |
|
| 1166 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php'; |
|
| 1167 | 1167 | // Load library |
| 1168 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1168 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1169 | 1169 | // load PHPMailer |
| 1170 | 1170 | $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries'); |
| 1171 | 1171 | $mail->register(); |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | |
| 1174 | 1174 | try { |
| 1175 | 1175 | // send to user |
| 1176 | - $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1176 | + $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1177 | 1177 | $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0; |
| 1178 | 1178 | $mail->Port = $SETTINGS['email_port']; |
| 1179 | 1179 | //COULD BE USED |
@@ -1273,7 +1273,7 @@ discard block |
||
| 1273 | 1273 | <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;"> |
| 1274 | 1274 | <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;"> |
| 1275 | 1275 | <br><div style="float:right;">' . |
| 1276 | - $textMail . |
|
| 1276 | + $textMail. |
|
| 1277 | 1277 | '<br><br></td></tr></table> |
| 1278 | 1278 | </td></tr></table> |
| 1279 | 1279 | <br></body></html>'; |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | */ |
| 1285 | 1285 | function generateKey(): string |
| 1286 | 1286 | { |
| 1287 | - return substr(md5(rand() . rand()), 0, 15); |
|
| 1287 | + return substr(md5(rand().rand()), 0, 15); |
|
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | /** |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | { |
| 1356 | 1356 | array_walk_recursive( |
| 1357 | 1357 | $array, |
| 1358 | - static function (&$item): void { |
|
| 1358 | + static function(&$item): void { |
|
| 1359 | 1359 | if (mb_detect_encoding((string) $item, 'utf-8', true) === false) { |
| 1360 | 1360 | $item = utf8_encode($item); |
| 1361 | 1361 | } |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | // Load superglobal |
| 1393 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1393 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1394 | 1394 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1395 | 1395 | // Get superglobals |
| 1396 | 1396 | if ($key !== null) { |
@@ -1401,9 +1401,9 @@ discard block |
||
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | //load ClassLoader |
| 1404 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1404 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1405 | 1405 | //Load AES |
| 1406 | - $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1406 | + $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1407 | 1407 | $aes->register(); |
| 1408 | 1408 | if ($type === 'encode' && is_array($data) === true) { |
| 1409 | 1409 | // Ensure UTF8 format |
@@ -1473,8 +1473,8 @@ discard block |
||
| 1473 | 1473 | */ |
| 1474 | 1474 | function prefixTable(string $table): string |
| 1475 | 1475 | { |
| 1476 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
| 1477 | - if (! empty($safeTable)) { |
|
| 1476 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
| 1477 | + if (!empty($safeTable)) { |
|
| 1478 | 1478 | // sanitize string |
| 1479 | 1479 | return $safeTable; |
| 1480 | 1480 | } |
@@ -1502,13 +1502,13 @@ discard block |
||
| 1502 | 1502 | bool $lowercase = false, |
| 1503 | 1503 | array $SETTINGS = [] |
| 1504 | 1504 | ): string { |
| 1505 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1506 | - $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1505 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1506 | + $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1507 | 1507 | $generator->register(); |
| 1508 | 1508 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
| 1509 | 1509 | // Is PHP7 being used? |
| 1510 | 1510 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
| 1511 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1511 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1512 | 1512 | $php7generator->register(); |
| 1513 | 1513 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
| 1514 | 1514 | } |
@@ -1538,7 +1538,7 @@ discard block |
||
| 1538 | 1538 | function send_syslog($message, $host, $port, $component = 'teampass'): void |
| 1539 | 1539 | { |
| 1540 | 1540 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
| 1541 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
| 1541 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
| 1542 | 1542 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
| 1543 | 1543 | socket_close($sock); |
| 1544 | 1544 | } |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | // include librairies & connect to DB |
| 1563 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1563 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1564 | 1564 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1565 | 1565 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1566 | 1566 | } |
@@ -1584,14 +1584,14 @@ discard block |
||
| 1584 | 1584 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
| 1585 | 1585 | if ($type === 'user_mngt') { |
| 1586 | 1586 | send_syslog( |
| 1587 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
| 1587 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
| 1588 | 1588 | $SETTINGS['syslog_host'], |
| 1589 | 1589 | $SETTINGS['syslog_port'], |
| 1590 | 1590 | 'teampass' |
| 1591 | 1591 | ); |
| 1592 | 1592 | } else { |
| 1593 | 1593 | send_syslog( |
| 1594 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
| 1594 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
| 1595 | 1595 | $SETTINGS['syslog_host'], |
| 1596 | 1596 | $SETTINGS['syslog_port'], |
| 1597 | 1597 | 'teampass' |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | ?string $encryption_type = null |
| 1624 | 1624 | ): void { |
| 1625 | 1625 | // include librairies & connect to DB |
| 1626 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1626 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1627 | 1627 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1628 | 1628 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1629 | 1629 | } |
@@ -1667,7 +1667,7 @@ discard block |
||
| 1667 | 1667 | if (empty($item_label) === true) { |
| 1668 | 1668 | $dataItem = DB::queryfirstrow( |
| 1669 | 1669 | 'SELECT id, id_tree, label |
| 1670 | - FROM ' . prefixTable('items') . ' |
|
| 1670 | + FROM ' . prefixTable('items').' |
|
| 1671 | 1671 | WHERE id = %i', |
| 1672 | 1672 | $item_id |
| 1673 | 1673 | ); |
@@ -1675,11 +1675,11 @@ discard block |
||
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | 1677 | send_syslog( |
| 1678 | - 'action=' . str_replace('at_', '', $action) . |
|
| 1679 | - ' attribute=' . str_replace('at_', '', $attribute[0]) . |
|
| 1680 | - ' itemno=' . $item_id . |
|
| 1681 | - ' user=' . is_null($login) === true ? '' : addslashes((string) $login) . |
|
| 1682 | - ' itemname="' . addslashes($item_label) . '"', |
|
| 1678 | + 'action='.str_replace('at_', '', $action). |
|
| 1679 | + ' attribute='.str_replace('at_', '', $attribute[0]). |
|
| 1680 | + ' itemno='.$item_id. |
|
| 1681 | + ' user='.is_null($login) === true ? '' : addslashes((string) $login). |
|
| 1682 | + ' itemname="'.addslashes($item_label).'"', |
|
| 1683 | 1683 | $SETTINGS['syslog_host'], |
| 1684 | 1684 | $SETTINGS['syslog_port'], |
| 1685 | 1685 | 'teampass' |
@@ -1705,7 +1705,7 @@ discard block |
||
| 1705 | 1705 | && $action === 'at_shown' |
| 1706 | 1706 | ) { |
| 1707 | 1707 | // Load superglobal |
| 1708 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1708 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1709 | 1709 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1710 | 1710 | // Get superglobals |
| 1711 | 1711 | $globalsLastname = $superGlobal->get('lastname', 'SESSION'); |
@@ -1714,7 +1714,7 @@ discard block |
||
| 1714 | 1714 | // Get info about item |
| 1715 | 1715 | $dataItem = DB::queryfirstrow( |
| 1716 | 1716 | 'SELECT id, id_tree, label |
| 1717 | - FROM ' . prefixTable('items') . ' |
|
| 1717 | + FROM ' . prefixTable('items').' |
|
| 1718 | 1718 | WHERE id = %i', |
| 1719 | 1719 | $item_id |
| 1720 | 1720 | ); |
@@ -1728,9 +1728,9 @@ discard block |
||
| 1728 | 1728 | 'body' => str_replace( |
| 1729 | 1729 | ['#tp_user#', '#tp_item#', '#tp_link#'], |
| 1730 | 1730 | [ |
| 1731 | - addslashes($globalsName . ' ' . $globalsLastname), |
|
| 1731 | + addslashes($globalsName.' '.$globalsLastname), |
|
| 1732 | 1732 | addslashes($item_label), |
| 1733 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id, |
|
| 1733 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id, |
|
| 1734 | 1734 | ], |
| 1735 | 1735 | langHdl('email_on_open_notification_mail') |
| 1736 | 1736 | ), |
@@ -1752,7 +1752,7 @@ discard block |
||
| 1752 | 1752 | function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void |
| 1753 | 1753 | { |
| 1754 | 1754 | // Load superglobal |
| 1755 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1755 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1756 | 1756 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1757 | 1757 | // Get superglobals |
| 1758 | 1758 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
@@ -1762,8 +1762,8 @@ discard block |
||
| 1762 | 1762 | $notification = DB::queryOneColumn( |
| 1763 | 1763 | 'email', |
| 1764 | 1764 | 'SELECT * |
| 1765 | - FROM ' . prefixTable('notification') . ' AS n |
|
| 1766 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
| 1765 | + FROM ' . prefixTable('notification').' AS n |
|
| 1766 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
| 1767 | 1767 | WHERE n.item_id = %i AND n.user_id != %i', |
| 1768 | 1768 | $item_id, |
| 1769 | 1769 | $globalsUserId |
@@ -1774,7 +1774,7 @@ discard block |
||
| 1774 | 1774 | // Get list of changes |
| 1775 | 1775 | $htmlChanges = '<ul>'; |
| 1776 | 1776 | foreach ($changes as $change) { |
| 1777 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
| 1777 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
| 1778 | 1778 | } |
| 1779 | 1779 | $htmlChanges .= '</ul>'; |
| 1780 | 1780 | // send email |
@@ -1805,7 +1805,7 @@ discard block |
||
| 1805 | 1805 | function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string |
| 1806 | 1806 | { |
| 1807 | 1807 | // Class loader |
| 1808 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1808 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1809 | 1809 | //Load Tree |
| 1810 | 1810 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
| 1811 | 1811 | $tree->register(); |
@@ -1814,15 +1814,15 @@ discard block |
||
| 1814 | 1814 | $path = ''; |
| 1815 | 1815 | foreach ($arbo as $elem) { |
| 1816 | 1816 | if (empty($path) === true) { |
| 1817 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 1817 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 1818 | 1818 | } else { |
| 1819 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 1819 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 1820 | 1820 | } |
| 1821 | 1821 | } |
| 1822 | 1822 | |
| 1823 | 1823 | // Build text to show user |
| 1824 | 1824 | if (empty($label) === false) { |
| 1825 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
| 1825 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | return empty($path) === true ? '' : $path; |
| 1828 | 1828 | } |
@@ -1877,9 +1877,9 @@ discard block |
||
| 1877 | 1877 | */ |
| 1878 | 1878 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
| 1879 | 1879 | { |
| 1880 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
| 1880 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
| 1881 | 1881 | // include librairies & connect to DB |
| 1882 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1882 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1883 | 1883 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1884 | 1884 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1885 | 1885 | } |
@@ -1892,8 +1892,8 @@ discard block |
||
| 1892 | 1892 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
| 1893 | 1893 | // perform a copy |
| 1894 | 1894 | if (file_exists($tp_config_file)) { |
| 1895 | - if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
| 1896 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
| 1895 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
| 1896 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
| 1897 | 1897 | } |
| 1898 | 1898 | } |
| 1899 | 1899 | |
@@ -1903,11 +1903,11 @@ discard block |
||
| 1903 | 1903 | $data[1] = "global \$SETTINGS;\n"; |
| 1904 | 1904 | $data[2] = "\$SETTINGS = array (\n"; |
| 1905 | 1905 | $rows = DB::query( |
| 1906 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
| 1906 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
| 1907 | 1907 | 'admin' |
| 1908 | 1908 | ); |
| 1909 | 1909 | foreach ($rows as $record) { |
| 1910 | - array_push($data, " '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n"); |
|
| 1910 | + array_push($data, " '".$record['intitule']."' => '".$record['valeur']."',\n"); |
|
| 1911 | 1911 | } |
| 1912 | 1912 | array_push($data, ");\n"); |
| 1913 | 1913 | $data = array_unique($data); |
@@ -1921,15 +1921,15 @@ discard block |
||
| 1921 | 1921 | break; |
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | - if (stristr($line, "'" . $field . "' => '")) { |
|
| 1925 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n"; |
|
| 1924 | + if (stristr($line, "'".$field."' => '")) { |
|
| 1925 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n"; |
|
| 1926 | 1926 | $bFound = true; |
| 1927 | 1927 | break; |
| 1928 | 1928 | } |
| 1929 | 1929 | ++$inc; |
| 1930 | 1930 | } |
| 1931 | 1931 | if ($bFound === false) { |
| 1932 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n"; |
|
| 1932 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n"; |
|
| 1933 | 1933 | } |
| 1934 | 1934 | } |
| 1935 | 1935 | |
@@ -1955,7 +1955,7 @@ discard block |
||
| 1955 | 1955 | { |
| 1956 | 1956 | global $SETTINGS; |
| 1957 | 1957 | /* LOAD CPASSMAN SETTINGS */ |
| 1958 | - if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
| 1958 | + if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
| 1959 | 1959 | $SETTINGS = []; |
| 1960 | 1960 | $SETTINGS['duplicate_folder'] = 0; |
| 1961 | 1961 | //by default, this is set to 0; |
@@ -1965,7 +1965,7 @@ discard block |
||
| 1965 | 1965 | //by default, this value is set to 5; |
| 1966 | 1966 | $settings = []; |
| 1967 | 1967 | $rows = DB::query( |
| 1968 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
| 1968 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
| 1969 | 1969 | [ |
| 1970 | 1970 | 'type' => 'admin', |
| 1971 | 1971 | 'type2' => 'settings', |
@@ -1992,7 +1992,7 @@ discard block |
||
| 1992 | 1992 | $source_cf = []; |
| 1993 | 1993 | $rows = DB::QUERY( |
| 1994 | 1994 | 'SELECT id_category |
| 1995 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 1995 | + FROM ' . prefixTable('categories_folders').' |
|
| 1996 | 1996 | WHERE id_folder = %i', |
| 1997 | 1997 | $source_id |
| 1998 | 1998 | ); |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | $target_cf = []; |
| 2004 | 2004 | $rows = DB::QUERY( |
| 2005 | 2005 | 'SELECT id_category |
| 2006 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2006 | + FROM ' . prefixTable('categories_folders').' |
|
| 2007 | 2007 | WHERE id_folder = %i', |
| 2008 | 2008 | $target_id |
| 2009 | 2009 | ); |
@@ -2038,9 +2038,9 @@ discard block |
||
| 2038 | 2038 | $password = null |
| 2039 | 2039 | ) { |
| 2040 | 2040 | // Load AntiXSS |
| 2041 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2042 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2043 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2041 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2042 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2043 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2044 | 2044 | $antiXss = new voku\helper\AntiXSS(); |
| 2045 | 2045 | // Protect against bad inputs |
| 2046 | 2046 | if (is_array($source_file) === true || is_array($target_file) === true) { |
@@ -2052,7 +2052,7 @@ discard block |
||
| 2052 | 2052 | $target_file = $antiXss->xss_clean($target_file); |
| 2053 | 2053 | if (empty($password) === true || is_null($password) === true) { |
| 2054 | 2054 | // get KEY to define password |
| 2055 | - $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
| 2055 | + $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
| 2056 | 2056 | $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
| 2057 | 2057 | } |
| 2058 | 2058 | |
@@ -2097,15 +2097,15 @@ discard block |
||
| 2097 | 2097 | ) { |
| 2098 | 2098 | // load PhpEncryption library |
| 2099 | 2099 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2100 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2101 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2102 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2103 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2104 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2105 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2106 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2107 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2108 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2100 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2101 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2102 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2103 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2104 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2105 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2106 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2107 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2108 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2109 | 2109 | try { |
| 2110 | 2110 | \Defuse\Crypto\File::encryptFileWithPassword( |
| 2111 | 2111 | $source_file, |
@@ -2142,15 +2142,15 @@ discard block |
||
| 2142 | 2142 | ) { |
| 2143 | 2143 | // load PhpEncryption library |
| 2144 | 2144 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2145 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2146 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2147 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2148 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2149 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2150 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2151 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2152 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2153 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2145 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2146 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2147 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2148 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2149 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2150 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2151 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2152 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2153 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2154 | 2154 | try { |
| 2155 | 2155 | \Defuse\Crypto\File::decryptFileWithPassword( |
| 2156 | 2156 | $source_file, |
@@ -2195,9 +2195,9 @@ discard block |
||
| 2195 | 2195 | function fileDelete(string $file, array $SETTINGS): void |
| 2196 | 2196 | { |
| 2197 | 2197 | // Load AntiXSS |
| 2198 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2199 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2200 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2198 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2199 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2200 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2201 | 2201 | $antiXss = new voku\helper\AntiXSS(); |
| 2202 | 2202 | $file = $antiXss->xss_clean($file); |
| 2203 | 2203 | if (is_file($file)) { |
@@ -2241,7 +2241,7 @@ discard block |
||
| 2241 | 2241 | |
| 2242 | 2242 | function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) { |
| 2243 | 2243 | // Check if the path exists |
| 2244 | - if (! file_exists($path)) { |
|
| 2244 | + if (!file_exists($path)) { |
|
| 2245 | 2245 | return false; |
| 2246 | 2246 | } |
| 2247 | 2247 | |
@@ -2276,7 +2276,7 @@ discard block |
||
| 2276 | 2276 | */ |
| 2277 | 2277 | function accessToItemIsGranted(int $item_id, $SETTINGS) |
| 2278 | 2278 | { |
| 2279 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2279 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2280 | 2280 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2281 | 2281 | // Prepare superGlobal variables |
| 2282 | 2282 | $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION'); |
@@ -2284,7 +2284,7 @@ discard block |
||
| 2284 | 2284 | // Load item data |
| 2285 | 2285 | $data = DB::queryFirstRow( |
| 2286 | 2286 | 'SELECT id_tree |
| 2287 | - FROM ' . prefixTable('items') . ' |
|
| 2287 | + FROM ' . prefixTable('items').' |
|
| 2288 | 2288 | WHERE id = %i', |
| 2289 | 2289 | $item_id |
| 2290 | 2290 | ); |
@@ -2357,8 +2357,8 @@ discard block |
||
| 2357 | 2357 | function performDBQuery(array $SETTINGS, string $fields, string $table): array |
| 2358 | 2358 | { |
| 2359 | 2359 | // include librairies & connect to DB |
| 2360 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2361 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2360 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2361 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2362 | 2362 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2363 | 2363 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2364 | 2364 | } |
@@ -2370,7 +2370,7 @@ discard block |
||
| 2370 | 2370 | DB::$encoding = DB_ENCODING; |
| 2371 | 2371 | // Insert log in DB |
| 2372 | 2372 | return DB::query( |
| 2373 | - 'SELECT ' . $fields . ' |
|
| 2373 | + 'SELECT '.$fields.' |
|
| 2374 | 2374 | FROM ' . prefixTable($table) |
| 2375 | 2375 | ); |
| 2376 | 2376 | } |
@@ -2383,11 +2383,11 @@ discard block |
||
| 2383 | 2383 | function formatSizeUnits(int $bytes): string |
| 2384 | 2384 | { |
| 2385 | 2385 | if ($bytes >= 1073741824) { |
| 2386 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
| 2386 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
| 2387 | 2387 | } elseif ($bytes >= 1048576) { |
| 2388 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
| 2388 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
| 2389 | 2389 | } elseif ($bytes >= 1024) { |
| 2390 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
| 2390 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
| 2391 | 2391 | } elseif ($bytes > 1) { |
| 2392 | 2392 | $bytes .= ' bytes'; |
| 2393 | 2393 | } elseif ($bytes === 1) { |
@@ -2578,14 +2578,14 @@ discard block |
||
| 2578 | 2578 | |
| 2579 | 2579 | // Encrypt the file content |
| 2580 | 2580 | $plaintext = file_get_contents( |
| 2581 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
| 2581 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
| 2582 | 2582 | ); |
| 2583 | 2583 | $ciphertext = $cipher->encrypt($plaintext); |
| 2584 | 2584 | // Save new file |
| 2585 | 2585 | $hash = md5($plaintext); |
| 2586 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
| 2586 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
| 2587 | 2587 | file_put_contents($fileOut, $ciphertext); |
| 2588 | - unlink($fileInPath . '/' . $fileInName); |
|
| 2588 | + unlink($fileInPath.'/'.$fileInName); |
|
| 2589 | 2589 | return [ |
| 2590 | 2590 | 'fileHash' => base64_encode($hash), |
| 2591 | 2591 | 'objectKey' => base64_encode($objectKey), |
@@ -2601,7 +2601,7 @@ discard block |
||
| 2601 | 2601 | */ |
| 2602 | 2602 | function decryptFile(string $fileName, string $filePath, string $key): string |
| 2603 | 2603 | { |
| 2604 | - if (! defined('FILE_BUFFER_SIZE')) { |
|
| 2604 | + if (!defined('FILE_BUFFER_SIZE')) { |
|
| 2605 | 2605 | define('FILE_BUFFER_SIZE', 128 * 1024); |
| 2606 | 2606 | } |
| 2607 | 2607 | |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | $cipher->enableContinuousBuffer(); |
| 2621 | 2621 | $cipher->disablePadding(); |
| 2622 | 2622 | // Get file content |
| 2623 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
| 2623 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
| 2624 | 2624 | // Decrypt file content and return |
| 2625 | 2625 | return base64_encode($cipher->decrypt($ciphertext)); |
| 2626 | 2626 | } |
@@ -2670,8 +2670,8 @@ discard block |
||
| 2670 | 2670 | array $SETTINGS |
| 2671 | 2671 | ): void { |
| 2672 | 2672 | // include librairies & connect to DB |
| 2673 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2674 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2673 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2674 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2675 | 2675 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2676 | 2676 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2677 | 2677 | } |
@@ -2688,7 +2688,7 @@ discard block |
||
| 2688 | 2688 | $post_object_id |
| 2689 | 2689 | ); |
| 2690 | 2690 | // Superglobals |
| 2691 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2691 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2692 | 2692 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2693 | 2693 | // Prepare superGlobal variables |
| 2694 | 2694 | $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION'); |
@@ -2713,8 +2713,8 @@ discard block |
||
| 2713 | 2713 | // Create sharekey for each user |
| 2714 | 2714 | $users = DB::query( |
| 2715 | 2715 | 'SELECT id, public_key |
| 2716 | - FROM ' . prefixTable('users') . ' |
|
| 2717 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
| 2716 | + FROM ' . prefixTable('users').' |
|
| 2717 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
| 2718 | 2718 | AND public_key != ""' |
| 2719 | 2719 | ); |
| 2720 | 2720 | foreach ($users as $user) { |
@@ -2742,7 +2742,7 @@ discard block |
||
| 2742 | 2742 | function isBase64(string $str): bool |
| 2743 | 2743 | { |
| 2744 | 2744 | $str = (string) trim($str); |
| 2745 | - if (! isset($str[0])) { |
|
| 2745 | + if (!isset($str[0])) { |
|
| 2746 | 2746 | return false; |
| 2747 | 2747 | } |
| 2748 | 2748 | |
@@ -2810,13 +2810,13 @@ discard block |
||
| 2810 | 2810 | ], |
| 2811 | 2811 | ]; |
| 2812 | 2812 | // Load expected libraries |
| 2813 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 2814 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 2815 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 2816 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 2817 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 2818 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 2819 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 2813 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 2814 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 2815 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 2816 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 2817 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 2818 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 2819 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 2820 | 2820 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 2821 | 2821 | $ad->register(); |
| 2822 | 2822 | $connection = new Connection($config); |
@@ -2825,7 +2825,7 @@ discard block |
||
| 2825 | 2825 | $connection->connect(); |
| 2826 | 2826 | } catch (\LdapRecord\Auth\BindException $e) { |
| 2827 | 2827 | $error = $e->getDetailedError(); |
| 2828 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
| 2828 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
| 2829 | 2829 | return false; |
| 2830 | 2830 | } |
| 2831 | 2831 | |
@@ -2834,7 +2834,7 @@ discard block |
||
| 2834 | 2834 | $connection->auth()->attempt($SETTINGS['ldap_user_attribute'].'='.$login.','.$SETTINGS['ldap_bdn'], $password, $stayAuthenticated = true); |
| 2835 | 2835 | } catch (\LdapRecord\Auth\BindException $e) { |
| 2836 | 2836 | $error = $e->getDetailedError(); |
| 2837 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
| 2837 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
| 2838 | 2838 | return false; |
| 2839 | 2839 | } |
| 2840 | 2840 | |
@@ -2852,8 +2852,8 @@ discard block |
||
| 2852 | 2852 | function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool |
| 2853 | 2853 | { |
| 2854 | 2854 | // include librairies & connect to DB |
| 2855 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2856 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2855 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2856 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2857 | 2857 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2858 | 2858 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2859 | 2859 | } |
@@ -2911,7 +2911,7 @@ discard block |
||
| 2911 | 2911 | foreach (DateTimeZone::listIdentifiers() as $timezone) { |
| 2912 | 2912 | $now->setTimezone(new DateTimeZone($timezone)); |
| 2913 | 2913 | $offsets[] = $offset = $now->getOffset(); |
| 2914 | - $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); |
|
| 2914 | + $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone); |
|
| 2915 | 2915 | } |
| 2916 | 2916 | |
| 2917 | 2917 | array_multisort($offsets, $timezones); |
@@ -2931,7 +2931,7 @@ discard block |
||
| 2931 | 2931 | { |
| 2932 | 2932 | $hours = intval($offset / 3600); |
| 2933 | 2933 | $minutes = abs(intval($offset % 3600 / 60)); |
| 2934 | - return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
| 2934 | + return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
| 2935 | 2935 | } |
| 2936 | 2936 | |
| 2937 | 2937 | /** |