@@ -46,25 +46,25 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /* do checks */ |
49 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
50 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
49 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
50 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
51 | 51 | if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) { |
52 | 52 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
53 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
53 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
54 | 54 | exit; |
55 | 55 | } |
56 | 56 | |
57 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
59 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
57 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
59 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
60 | 60 | |
61 | 61 | header('Content-type: text/html; charset=utf-8'); |
62 | 62 | header('Cache-Control: no-cache, no-store, must-revalidate'); |
63 | 63 | |
64 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
64 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
65 | 65 | |
66 | 66 | // connect to the server |
67 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
67 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
68 | 68 | if (defined('DB_PASSWD_CLEAR') === false) { |
69 | 69 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
70 | 70 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | array( |
118 | 118 | 'http' => array( |
119 | 119 | 'ignore_errors' => true, |
120 | - 'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'], |
|
120 | + 'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'], |
|
121 | 121 | ), |
122 | 122 | ) |
123 | 123 | ); |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | $json_array = json_decode($json, true); |
137 | 137 | |
138 | 138 | // About version |
139 | - $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL; |
|
139 | + $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL; |
|
140 | 140 | if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) { |
141 | - $text .= ' <b>' . $LANG['please_update'] . '</b>'; |
|
141 | + $text .= ' <b>'.$LANG['please_update'].'</b>'; |
|
142 | 142 | } |
143 | 143 | $text .= '</li>'; |
144 | 144 | |
145 | 145 | // Libraries |
146 | 146 | $text .= '<li><u>Libraries</u> :</li>'; |
147 | 147 | foreach ($json_array['libraries'] as $key => $val) { |
148 | - $text .= "<li> <span class='fa fa-caret-right'></span> " . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>'; |
|
148 | + $text .= "<li> <span class='fa fa-caret-right'></span> ".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>'; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | $text .= '</ul>'; |
158 | 158 | |
159 | - echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]'; |
|
159 | + echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]'; |
|
160 | 160 | break; |
161 | 161 | |
162 | 162 | //########################################################## |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | //get through all users |
191 | 191 | $rows = DB::query( |
192 | 192 | 'SELECT id, login, email |
193 | - FROM ' . prefixTable('users') . ' |
|
193 | + FROM ' . prefixTable('users').' |
|
194 | 194 | ORDER BY login ASC' |
195 | 195 | ); |
196 | 196 | foreach ($rows as $record) { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | //if folder doesn't exist then create it |
208 | 208 | $data = DB::queryfirstrow( |
209 | 209 | 'SELECT id |
210 | - FROM ' . prefixTable('nested_tree') . ' |
|
210 | + FROM ' . prefixTable('nested_tree').' |
|
211 | 211 | WHERE title = %s AND parent_id = %i', |
212 | 212 | $record['id'], |
213 | 213 | 0 |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | $SETTINGS['cpassman_dir'], |
271 | 271 | array( |
272 | 272 | 'error' => false, |
273 | - 'message' => langHdl('last_execution') . ' ' . |
|
274 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
273 | + 'message' => langHdl('last_execution').' '. |
|
274 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
275 | 275 | '<i class="fas fa-check text-success ml-2"></i>', |
276 | 276 | ), |
277 | 277 | 'encode' |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | //Libraries call |
310 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
310 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
311 | 311 | |
312 | 312 | //init |
313 | 313 | $foldersIds = array(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | - $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds); |
|
324 | + $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds); |
|
325 | 325 | foreach ($items as $item) { |
326 | 326 | //Delete item |
327 | 327 | DB::DELETE(prefixTable('items'), 'id = %i', $item['id']); |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | // delete orphan items |
343 | 343 | $rows = DB::query( |
344 | 344 | 'SELECT id |
345 | - FROM ' . prefixTable('items') . ' |
|
345 | + FROM ' . prefixTable('items').' |
|
346 | 346 | ORDER BY id ASC' |
347 | 347 | ); |
348 | 348 | foreach ($rows as $item) { |
349 | 349 | DB::query( |
350 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
350 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
351 | 351 | $item['id'], |
352 | 352 | 'at_creation' |
353 | 353 | ); |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | $SETTINGS['cpassman_dir'], |
379 | 379 | array( |
380 | 380 | 'error' => false, |
381 | - 'message' => langHdl('last_execution') . ' ' . |
|
382 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
381 | + 'message' => langHdl('last_execution').' '. |
|
382 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
383 | 383 | '<i class="fas fa-check text-success ml-2 mr-3"></i> |
384 | 384 | <i class="fas fa-chevron-right mr-2"></i>' . |
385 | - $nbItemsDeleted . ' ' . langHdl('deleted_items'), |
|
385 | + $nbItemsDeleted.' '.langHdl('deleted_items'), |
|
386 | 386 | ), |
387 | 387 | 'encode' |
388 | 388 | ); |
@@ -416,21 +416,21 @@ discard block |
||
416 | 416 | break; |
417 | 417 | } |
418 | 418 | |
419 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
419 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
420 | 420 | $return = ''; |
421 | 421 | |
422 | 422 | //Get all tables |
423 | 423 | $tables = array(); |
424 | 424 | $result = DB::query('SHOW TABLES'); |
425 | 425 | foreach ($result as $row) { |
426 | - $tables[] = $row['Tables_in_' . $database]; |
|
426 | + $tables[] = $row['Tables_in_'.$database]; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | //cycle through |
430 | 430 | foreach ($tables as $table) { |
431 | 431 | if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) { |
432 | 432 | // Do query |
433 | - $result = DB::queryRaw('SELECT * FROM ' . $table); |
|
433 | + $result = DB::queryRaw('SELECT * FROM '.$table); |
|
434 | 434 | DB::queryRaw( |
435 | 435 | 'SELECT * |
436 | 436 | FROM INFORMATION_SCHEMA.COLUMNS |
@@ -442,19 +442,19 @@ discard block |
||
442 | 442 | $numFields = DB::count(); |
443 | 443 | |
444 | 444 | // prepare a drop table |
445 | - $return .= 'DROP TABLE ' . $table . ';'; |
|
446 | - $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table); |
|
447 | - $return .= "\n\n" . $row2['Create Table'] . ";\n\n"; |
|
445 | + $return .= 'DROP TABLE '.$table.';'; |
|
446 | + $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table); |
|
447 | + $return .= "\n\n".$row2['Create Table'].";\n\n"; |
|
448 | 448 | |
449 | 449 | //prepare all fields and datas |
450 | 450 | for ($i = 0; $i < $numFields; ++$i) { |
451 | 451 | while ($row = $result->fetch_row()) { |
452 | - $return .= 'INSERT INTO ' . $table . ' VALUES('; |
|
452 | + $return .= 'INSERT INTO '.$table.' VALUES('; |
|
453 | 453 | for ($j = 0; $j < $numFields; ++$j) { |
454 | 454 | $row[$j] = addslashes($row[$j]); |
455 | 455 | $row[$j] = preg_replace("/\n/", '\\n', $row[$j]); |
456 | 456 | if (isset($row[$j])) { |
457 | - $return .= '"' . $row[$j] . '"'; |
|
457 | + $return .= '"'.$row[$j].'"'; |
|
458 | 458 | } else { |
459 | 459 | $return .= 'NULL'; |
460 | 460 | } |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS); |
475 | 475 | |
476 | 476 | //save file |
477 | - $filename = time() . '-' . $token . '.sql'; |
|
478 | - $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+'); |
|
477 | + $filename = time().'-'.$token.'.sql'; |
|
478 | + $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+'); |
|
479 | 479 | if ($handle !== false) { |
480 | 480 | //write file |
481 | 481 | fwrite($handle, $return); |
@@ -487,17 +487,17 @@ discard block |
||
487 | 487 | // Encrypt the file |
488 | 488 | prepareFileWithDefuse( |
489 | 489 | 'encrypt', |
490 | - $SETTINGS['path_to_files_folder'] . '/' . $filename, |
|
491 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
490 | + $SETTINGS['path_to_files_folder'].'/'.$filename, |
|
491 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
492 | 492 | $SETTINGS, |
493 | 493 | $post_option |
494 | 494 | ); |
495 | 495 | |
496 | 496 | // Do clean |
497 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $filename); |
|
497 | + unlink($SETTINGS['path_to_files_folder'].'/'.$filename); |
|
498 | 498 | rename( |
499 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
500 | - $SETTINGS['path_to_files_folder'] . '/' . $filename |
|
499 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
500 | + $SETTINGS['path_to_files_folder'].'/'.$filename |
|
501 | 501 | ); |
502 | 502 | } |
503 | 503 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | //update LOG |
508 | 508 | logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']); |
509 | 509 | |
510 | - echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]'; |
|
510 | + echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]'; |
|
511 | 511 | } |
512 | 512 | break; |
513 | 513 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | ); |
539 | 539 | break; |
540 | 540 | } |
541 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
541 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
542 | 542 | |
543 | 543 | $dataPost = explode('&', $post_option); |
544 | 544 | $file = htmlspecialchars($dataPost[0]); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | // Get filename from database |
548 | 548 | $data = DB::queryFirstRow( |
549 | 549 | 'SELECT valeur |
550 | - FROM ' . prefixTable('misc') . ' |
|
550 | + FROM ' . prefixTable('misc').' |
|
551 | 551 | WHERE increment_id = %i', |
552 | 552 | $file |
553 | 553 | ); |
@@ -566,22 +566,22 @@ discard block |
||
566 | 566 | // Decrypt the file |
567 | 567 | $ret = prepareFileWithDefuse( |
568 | 568 | 'decrypt', |
569 | - $SETTINGS['path_to_files_folder'] . '/' . $file, |
|
570 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file, |
|
569 | + $SETTINGS['path_to_files_folder'].'/'.$file, |
|
570 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file, |
|
571 | 571 | $SETTINGS, |
572 | 572 | $key |
573 | 573 | ); |
574 | 574 | |
575 | 575 | if (empty($ret) === false) { |
576 | - echo '[{"result":"db_restore" , "message":"' . $ret . '"}]'; |
|
576 | + echo '[{"result":"db_restore" , "message":"'.$ret.'"}]'; |
|
577 | 577 | break; |
578 | 578 | } |
579 | 579 | |
580 | 580 | // Do clean |
581 | - fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS); |
|
582 | - $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file; |
|
581 | + fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS); |
|
582 | + $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file; |
|
583 | 583 | } else { |
584 | - $file = $SETTINGS['path_to_files_folder'] . '/' . $file; |
|
584 | + $file = $SETTINGS['path_to_files_folder'].'/'.$file; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | //read sql file |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | fclose($handle); |
599 | 599 | |
600 | 600 | //delete file |
601 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $file); |
|
601 | + unlink($SETTINGS['path_to_files_folder'].'/'.$file); |
|
602 | 602 | |
603 | 603 | //Show done |
604 | 604 | echo '[{"result":"db_restore" , "message":""}]'; |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | foreach ($table as $i => $tablename) { |
639 | 639 | if (substr_count($tablename, DB_PREFIX) > 0) { |
640 | 640 | // launch optimization quieries |
641 | - DB::query('ANALYZE TABLE `' . $tablename . '`'); |
|
642 | - DB::query('OPTIMIZE TABLE `' . $tablename . '`'); |
|
641 | + DB::query('ANALYZE TABLE `'.$tablename.'`'); |
|
642 | + DB::query('OPTIMIZE TABLE `'.$tablename.'`'); |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | } |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | //Clean up LOG_ITEMS table |
648 | 648 | $rows = DB::query( |
649 | 649 | 'SELECT id |
650 | - FROM ' . prefixTable('items') . ' |
|
650 | + FROM ' . prefixTable('items').' |
|
651 | 651 | ORDER BY id ASC' |
652 | 652 | ); |
653 | 653 | foreach ($rows as $item) { |
654 | 654 | DB::query( |
655 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
655 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
656 | 656 | $item['id'], |
657 | 657 | 'at_creation' |
658 | 658 | ); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | if ($counter === 0) { |
661 | 661 | //Create new at_creation entry |
662 | 662 | $rowTmp = DB::queryFirstRow( |
663 | - 'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC', |
|
663 | + 'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC', |
|
664 | 664 | $item['id'] |
665 | 665 | ); |
666 | 666 | DB::insert( |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | $SETTINGS['cpassman_dir'], |
692 | 692 | array( |
693 | 693 | 'error' => false, |
694 | - 'message' => langHdl('last_execution') . ' ' . |
|
695 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
694 | + 'message' => langHdl('last_execution').' '. |
|
695 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
696 | 696 | '<i class="fas fa-check text-success ml-2"></i>', |
697 | 697 | ), |
698 | 698 | 'encode' |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | break; |
728 | 728 | } |
729 | 729 | |
730 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
730 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
731 | 731 | |
732 | 732 | //read folder |
733 | 733 | if (is_dir($SETTINGS['path_to_files_folder']) === false) { |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $SETTINGS['cpassman_dir'], |
736 | 736 | array( |
737 | 737 | 'error' => true, |
738 | - 'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'], |
|
738 | + 'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'], |
|
739 | 739 | ), |
740 | 740 | 'encode' |
741 | 741 | ); |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | //delete file FILES |
748 | 748 | while (false !== ($f = readdir($dir))) { |
749 | 749 | if ($f !== '.' && $f !== '..' && $f !== '.htaccess') { |
750 | - if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) { |
|
751 | - fileDelete($dir . '/' . $f, $SETTINGS); |
|
750 | + if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) { |
|
751 | + fileDelete($dir.'/'.$f, $SETTINGS); |
|
752 | 752 | } |
753 | 753 | } |
754 | 754 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $SETTINGS['cpassman_dir'], |
764 | 764 | array( |
765 | 765 | 'error' => true, |
766 | - 'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'], |
|
766 | + 'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'], |
|
767 | 767 | ), |
768 | 768 | 'encode' |
769 | 769 | ); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | while (false !== ($f = readdir($dir))) { |
778 | 778 | if ($f !== '.' && $f !== '..') { |
779 | 779 | if (strpos($f, '_delete.') > 0) { |
780 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS); |
|
780 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS); |
|
781 | 781 | } |
782 | 782 | } |
783 | 783 | } |
@@ -800,11 +800,11 @@ discard block |
||
800 | 800 | $SETTINGS['cpassman_dir'], |
801 | 801 | array( |
802 | 802 | 'error' => false, |
803 | - 'message' => langHdl('last_execution') . ' ' . |
|
804 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
803 | + 'message' => langHdl('last_execution').' '. |
|
804 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
805 | 805 | '<i class="fas fa-check text-success ml-2 mr-3"></i> |
806 | 806 | <i class="fas fa-chevron-right mr-2"></i>' . |
807 | - $nbItemsDeleted . ' ' . langHdl('deleted_items'), |
|
807 | + $nbItemsDeleted.' '.langHdl('deleted_items'), |
|
808 | 808 | ), |
809 | 809 | 'encode' |
810 | 810 | ); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | break; |
840 | 840 | } |
841 | 841 | |
842 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
842 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
843 | 843 | updateCacheTable('reload', $SETTINGS, NULL); |
844 | 844 | |
845 | 845 | // Log |
@@ -856,8 +856,8 @@ discard block |
||
856 | 856 | $SETTINGS['cpassman_dir'], |
857 | 857 | [ |
858 | 858 | 'error' => false, |
859 | - 'message' => langHdl('last_execution') . ' ' . |
|
860 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
859 | + 'message' => langHdl('last_execution').' '. |
|
860 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
861 | 861 | '<i class="fas fa-check text-success mr-2"></i>', |
862 | 862 | ], |
863 | 863 | 'encode' |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | } |
895 | 895 | |
896 | 896 | // Perform |
897 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
897 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
898 | 898 | $ret = handleConfigFile('rebuild', $SETTINGS); |
899 | 899 | |
900 | 900 | // Log |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | $SETTINGS['cpassman_dir'], |
924 | 924 | array( |
925 | 925 | 'error' => false, |
926 | - 'message' => langHdl('last_execution') . ' ' . |
|
927 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
926 | + 'message' => langHdl('last_execution').' '. |
|
927 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
928 | 928 | '<i class="fas fa-check text-success ml-2"></i>', |
929 | 929 | ), |
930 | 930 | 'encode' |
@@ -966,33 +966,33 @@ discard block |
||
966 | 966 | $filename = $post_option; |
967 | 967 | $tp_settings = []; |
968 | 968 | //get backups infos |
969 | - $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin'); |
|
969 | + $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin'); |
|
970 | 970 | foreach ($rows as $record) { |
971 | 971 | $tp_settings[$record['intitule']] = $record['valeur']; |
972 | 972 | } |
973 | 973 | |
974 | 974 | // check if backup file is in DB. |
975 | 975 | // If YES then it is encrypted with DEFUSE |
976 | - $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename'); |
|
976 | + $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename'); |
|
977 | 977 | |
978 | 978 | //read file |
979 | 979 | $return = ''; |
980 | - $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql'; |
|
980 | + $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql'; |
|
981 | 981 | if (file_exists($Fnm)) { |
982 | 982 | if (!empty($bck) && $bck['valeur'] === $filename) { |
983 | 983 | $err = ''; |
984 | 984 | |
985 | 985 | // it means that file is DEFUSE encrypted |
986 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
987 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
988 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
989 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php'; |
|
990 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php'; |
|
986 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
987 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
988 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
989 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php'; |
|
990 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php'; |
|
991 | 991 | |
992 | 992 | try { |
993 | 993 | \Defuse\Crypto\File::decryptFileWithPassword( |
994 | - $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql', |
|
995 | - $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql', |
|
994 | + $SETTINGS['bck_script_path'].'/'.$post_option.'.sql', |
|
995 | + $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql', |
|
996 | 996 | base64_decode($SETTINGS['bck_script_key']) |
997 | 997 | ); |
998 | 998 | } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) { |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | if (!empty($err)) { |
1003 | - echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]'; |
|
1003 | + echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]'; |
|
1004 | 1004 | break; |
1005 | 1005 | } |
1006 | 1006 | } else { |
@@ -1022,19 +1022,19 @@ discard block |
||
1022 | 1022 | ); |
1023 | 1023 | |
1024 | 1024 | //save the file |
1025 | - $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+'); |
|
1025 | + $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+'); |
|
1026 | 1026 | if ($handle !== false) { |
1027 | 1027 | fwrite($handle, $return); |
1028 | 1028 | fclose($handle); |
1029 | 1029 | } |
1030 | 1030 | } |
1031 | 1031 | $result = 'backup_decrypt_success'; |
1032 | - $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql'; |
|
1032 | + $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql'; |
|
1033 | 1033 | } else { |
1034 | 1034 | $result = 'backup_decrypt_fails'; |
1035 | - $msg = 'File not found: ' . $Fnm; |
|
1035 | + $msg = 'File not found: '.$Fnm; |
|
1036 | 1036 | } |
1037 | - echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]'; |
|
1037 | + echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]'; |
|
1038 | 1038 | break; |
1039 | 1039 | |
1040 | 1040 | /* |
@@ -1070,22 +1070,22 @@ discard block |
||
1070 | 1070 | require_once 'main.functions.php'; |
1071 | 1071 | |
1072 | 1072 | // store old sk |
1073 | - $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
1073 | + $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
1074 | 1074 | |
1075 | 1075 | // generate new saltkey |
1076 | - $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time(); |
|
1076 | + $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time(); |
|
1077 | 1077 | copy( |
1078 | - SECUREPATH . '/teampass-seckey.txt', |
|
1078 | + SECUREPATH.'/teampass-seckey.txt', |
|
1079 | 1079 | $old_sk_filename |
1080 | 1080 | ); |
1081 | 1081 | $new_key = defuse_generate_key(); |
1082 | 1082 | file_put_contents( |
1083 | - SECUREPATH . '/teampass-seckey.txt', |
|
1083 | + SECUREPATH.'/teampass-seckey.txt', |
|
1084 | 1084 | $new_key |
1085 | 1085 | ); |
1086 | 1086 | |
1087 | 1087 | // store new sk |
1088 | - $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
1088 | + $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
1089 | 1089 | |
1090 | 1090 | //put tool in maintenance. |
1091 | 1091 | DB::update( |
@@ -1101,13 +1101,13 @@ discard block |
||
1101 | 1101 | logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']); |
1102 | 1102 | |
1103 | 1103 | // get number of items to change |
1104 | - DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0); |
|
1104 | + DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0); |
|
1105 | 1105 | $nb_of_items = DB::count(); |
1106 | 1106 | |
1107 | 1107 | // create backup table |
1108 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1108 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1109 | 1109 | DB::query( |
1110 | - 'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` ( |
|
1110 | + 'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` ( |
|
1111 | 1111 | `id` int(12) NOT null AUTO_INCREMENT, |
1112 | 1112 | `current_table` varchar(100) NOT NULL, |
1113 | 1113 | `current_field` varchar(500) NOT NULL, |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | ); |
1136 | 1136 | |
1137 | 1137 | // delete previous backup files |
1138 | - $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names |
|
1138 | + $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names |
|
1139 | 1139 | foreach ($files as $file) { // iterate files |
1140 | 1140 | if (is_file($file)) { |
1141 | 1141 | $file_parts = pathinfo($file); |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | $SETTINGS['cpassman_dir'], |
1223 | 1223 | array( |
1224 | 1224 | 'error' => true, |
1225 | - 'message' => 'Input `' . $objects[0] . '` is not allowed', |
|
1225 | + 'message' => 'Input `'.$objects[0].'` is not allowed', |
|
1226 | 1226 | 'nbOfItems' => '', |
1227 | 1227 | 'nextAction' => '', |
1228 | 1228 | ), |
@@ -1235,9 +1235,9 @@ discard block |
||
1235 | 1235 | //change all encrypted data in Items (passwords) |
1236 | 1236 | $rows = DB::query( |
1237 | 1237 | 'SELECT id, pw, pw_iv |
1238 | - FROM ' . prefixTable('items') . ' |
|
1238 | + FROM ' . prefixTable('items').' |
|
1239 | 1239 | WHERE perso = %s |
1240 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
1240 | + LIMIT ' . $post_start.', '.$post_length, |
|
1241 | 1241 | '0' |
1242 | 1242 | ); |
1243 | 1243 | foreach ($rows as $record) { |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | 'current_field' => 'pw', |
1250 | 1250 | 'value_id' => $record['id'], |
1251 | 1251 | 'value' => $record['pw'], |
1252 | - 'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';", |
|
1252 | + 'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';", |
|
1253 | 1253 | 'value2' => 'none', |
1254 | 1254 | 'result' => 'none', |
1255 | 1255 | ) |
@@ -1298,9 +1298,9 @@ discard block |
||
1298 | 1298 | //change all encrypted data in Logs (passwords) |
1299 | 1299 | $rows = DB::query( |
1300 | 1300 | 'SELECT raison, increment_id |
1301 | - FROM ' . prefixTable('log_items') . " |
|
1301 | + FROM ' . prefixTable('log_items')." |
|
1302 | 1302 | WHERE action = %s AND raison LIKE 'at_pw :%' |
1303 | - LIMIT " . $post_start . ', ' . $post_length, |
|
1303 | + LIMIT " . $post_start.', '.$post_length, |
|
1304 | 1304 | 'at_modification' |
1305 | 1305 | ); |
1306 | 1306 | foreach ($rows as $record) { |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | 'current_field' => 'raison', |
1313 | 1313 | 'value_id' => $record['increment_id'], |
1314 | 1314 | 'value' => $record['raison'], |
1315 | - 'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';", |
|
1315 | + 'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';", |
|
1316 | 1316 | 'value2' => 'none', |
1317 | 1317 | 'result' => 'none', |
1318 | 1318 | ) |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | DB::update( |
1341 | 1341 | prefixTable('log_items'), |
1342 | 1342 | array( |
1343 | - 'raison' => 'at_pw :' . $encrypt['string'], |
|
1343 | + 'raison' => 'at_pw :'.$encrypt['string'], |
|
1344 | 1344 | 'encryption_type' => 'defuse', |
1345 | 1345 | ), |
1346 | 1346 | 'increment_id = %i', |
@@ -1365,8 +1365,8 @@ discard block |
||
1365 | 1365 | //change all encrypted data in CATEGORIES (passwords) |
1366 | 1366 | $rows = DB::query( |
1367 | 1367 | 'SELECT id, data |
1368 | - FROM ' . prefixTable('categories_items') . ' |
|
1369 | - LIMIT ' . $post_start . ', ' . $post_length |
|
1368 | + FROM ' . prefixTable('categories_items').' |
|
1369 | + LIMIT ' . $post_start.', '.$post_length |
|
1370 | 1370 | ); |
1371 | 1371 | foreach ($rows as $record) { |
1372 | 1372 | // backup data |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | 'current_field' => 'data', |
1378 | 1378 | 'value_id' => $record['id'], |
1379 | 1379 | 'value' => $record['data'], |
1380 | - 'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';", |
|
1380 | + 'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';", |
|
1381 | 1381 | 'value2' => 'none', |
1382 | 1382 | 'result' => 'none', |
1383 | 1383 | ) |
@@ -1425,9 +1425,9 @@ discard block |
||
1425 | 1425 | // Change all encrypted data in FILES (passwords) |
1426 | 1426 | $rows = DB::query( |
1427 | 1427 | 'SELECT id, file, status |
1428 | - FROM ' . prefixTable('files') . " |
|
1428 | + FROM ' . prefixTable('files')." |
|
1429 | 1429 | WHERE status = 'encrypted' |
1430 | - LIMIT " . $post_start . ', ' . $post_length |
|
1430 | + LIMIT " . $post_start.', '.$post_length |
|
1431 | 1431 | ); |
1432 | 1432 | foreach ($rows as $record) { |
1433 | 1433 | // backup data |
@@ -1445,20 +1445,20 @@ discard block |
||
1445 | 1445 | ); |
1446 | 1446 | $newID = DB::insertId(); |
1447 | 1447 | |
1448 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
1448 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
1449 | 1449 | // make a copy of file |
1450 | 1450 | if (!copy( |
1451 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1452 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy' |
|
1451 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1452 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy' |
|
1453 | 1453 | )) { |
1454 | 1454 | $error = 'Copy not possible'; |
1455 | 1455 | exit; |
1456 | 1456 | } else { |
1457 | 1457 | // prepare a bck of file (that will not be deleted) |
1458 | - $backup_filename = $record['file'] . '.bck-change-sk.' . time(); |
|
1458 | + $backup_filename = $record['file'].'.bck-change-sk.'.time(); |
|
1459 | 1459 | copy( |
1460 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1461 | - $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename |
|
1460 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1461 | + $SETTINGS['path_to_upload_folder'].'/'.$backup_filename |
|
1462 | 1462 | ); |
1463 | 1463 | } |
1464 | 1464 | |
@@ -1466,24 +1466,24 @@ discard block |
||
1466 | 1466 | // STEP1 - Do decryption |
1467 | 1467 | prepareFileWithDefuse( |
1468 | 1468 | 'decrypt', |
1469 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1470 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
1469 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1470 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
1471 | 1471 | $SETTINGS |
1472 | 1472 | ); |
1473 | 1473 | |
1474 | 1474 | // Do cleanup of files |
1475 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']); |
|
1475 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']); |
|
1476 | 1476 | |
1477 | 1477 | // STEP2 - Do encryption |
1478 | 1478 | prepareFileWithDefuse( |
1479 | 1479 | 'encryp', |
1480 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
1481 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1480 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
1481 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1482 | 1482 | $SETTINGS |
1483 | 1483 | ); |
1484 | 1484 | |
1485 | 1485 | // Do cleanup of files |
1486 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'); |
|
1486 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'); |
|
1487 | 1487 | |
1488 | 1488 | // Update backup table |
1489 | 1489 | DB::update( |
@@ -1509,13 +1509,13 @@ discard block |
||
1509 | 1509 | // do some things for new object |
1510 | 1510 | if (isset($objects[0])) { |
1511 | 1511 | if ($objects[0] === 'logs') { |
1512 | - DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1512 | + DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1513 | 1513 | } elseif ($objects[0] === 'files') { |
1514 | - DB::query('SELECT id FROM ' . prefixTable('files')); |
|
1514 | + DB::query('SELECT id FROM '.prefixTable('files')); |
|
1515 | 1515 | } elseif ($objects[0] === 'categories') { |
1516 | - DB::query('SELECT id FROM ' . prefixTable('categories_items')); |
|
1516 | + DB::query('SELECT id FROM '.prefixTable('categories_items')); |
|
1517 | 1517 | } elseif ($objects[0] === 'custfields') { |
1518 | - DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1518 | + DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1519 | 1519 | } |
1520 | 1520 | $nb_of_items = DB::count(); |
1521 | 1521 | } else { |
@@ -1640,12 +1640,12 @@ discard block |
||
1640 | 1640 | ); |
1641 | 1641 | } elseif ($record['current_table'] === 'files') { |
1642 | 1642 | // restore backup file |
1643 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) { |
|
1644 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']); |
|
1645 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1643 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) { |
|
1644 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']); |
|
1645 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1646 | 1646 | rename( |
1647 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'], |
|
1648 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value'] |
|
1647 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value2'], |
|
1648 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value'] |
|
1649 | 1649 | ); |
1650 | 1650 | } |
1651 | 1651 | } |
@@ -1656,15 +1656,15 @@ discard block |
||
1656 | 1656 | |
1657 | 1657 | // restore saltkey file |
1658 | 1658 | if (file_exists($previous_saltkey_filename)) { |
1659 | - unlink(SECUREPATH . '/teampass-seckey.txt'); |
|
1659 | + unlink(SECUREPATH.'/teampass-seckey.txt'); |
|
1660 | 1660 | rename( |
1661 | 1661 | $previous_saltkey_filename, |
1662 | - SECUREPATH . '/teampass-seckey.txt' |
|
1662 | + SECUREPATH.'/teampass-seckey.txt' |
|
1663 | 1663 | ); |
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | // drop table |
1667 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1667 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1668 | 1668 | |
1669 | 1669 | // Send back |
1670 | 1670 | echo prepareExchangedData( |
@@ -1710,17 +1710,17 @@ discard block |
||
1710 | 1710 | // delete files |
1711 | 1711 | $rows = DB::query( |
1712 | 1712 | 'SELECT value, value2 |
1713 | - FROM ' . prefixTable('sk_reencrypt_backup') . " |
|
1713 | + FROM ' . prefixTable('sk_reencrypt_backup')." |
|
1714 | 1714 | WHERE current_table = 'files'" |
1715 | 1715 | ); |
1716 | 1716 | foreach ($rows as $record) { |
1717 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1718 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']); |
|
1717 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1718 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']); |
|
1719 | 1719 | } |
1720 | 1720 | } |
1721 | 1721 | |
1722 | 1722 | // drop table |
1723 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1723 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1724 | 1724 | |
1725 | 1725 | echo '[{"status":"done"}]'; |
1726 | 1726 | break; |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | ); |
1755 | 1755 | break; |
1756 | 1756 | } else { |
1757 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1757 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1758 | 1758 | |
1759 | 1759 | //send email |
1760 | 1760 | sendEmail( |
@@ -1792,11 +1792,11 @@ discard block |
||
1792 | 1792 | break; |
1793 | 1793 | } |
1794 | 1794 | |
1795 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1795 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1796 | 1796 | |
1797 | 1797 | $rows = DB::query( |
1798 | 1798 | 'SELECT * |
1799 | - FROM ' . prefixTable('emails') . ' |
|
1799 | + FROM ' . prefixTable('emails').' |
|
1800 | 1800 | WHERE status = %s OR status = %s', |
1801 | 1801 | 'not_sent', |
1802 | 1802 | '' |
@@ -1883,9 +1883,9 @@ discard block |
||
1883 | 1883 | break; |
1884 | 1884 | } |
1885 | 1885 | |
1886 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1886 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1887 | 1887 | |
1888 | - $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1888 | + $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1889 | 1889 | foreach ($rows as $record) { |
1890 | 1890 | //send email |
1891 | 1891 | $ret = json_decode( |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | break; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1959 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1960 | 1960 | |
1961 | 1961 | // init |
1962 | 1962 | $filesList = array(); |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | FROM ' . prefixTable('files') |
1970 | 1970 | ); |
1971 | 1971 | foreach ($rows as $record) { |
1972 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
1972 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
1973 | 1973 | $addFile = false; |
1974 | 1974 | if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted') |
1975 | 1975 | || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear') |
@@ -2038,8 +2038,8 @@ discard block |
||
2038 | 2038 | $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING); |
2039 | 2039 | $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT); |
2040 | 2040 | |
2041 | - include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
2042 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
2041 | + include $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
2042 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
2043 | 2043 | |
2044 | 2044 | $cpt = 0; |
2045 | 2045 | $continu = true; |
@@ -2047,15 +2047,15 @@ discard block |
||
2047 | 2047 | $message = ''; |
2048 | 2048 | |
2049 | 2049 | // load PhpEncryption library |
2050 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
2051 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php'; |
|
2052 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
2053 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php'; |
|
2054 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
2055 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php'; |
|
2056 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php'; |
|
2057 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php'; |
|
2058 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php'; |
|
2050 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
2051 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php'; |
|
2052 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
2053 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php'; |
|
2054 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
2055 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php'; |
|
2056 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php'; |
|
2057 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php'; |
|
2058 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php'; |
|
2059 | 2059 | |
2060 | 2060 | // treat 10 files |
2061 | 2061 | foreach ($post_list as $file) { |
@@ -2063,35 +2063,35 @@ discard block |
||
2063 | 2063 | // Get file name |
2064 | 2064 | $file_info = DB::queryfirstrow( |
2065 | 2065 | 'SELECT file |
2066 | - FROM ' . prefixTable('files') . ' |
|
2066 | + FROM ' . prefixTable('files').' |
|
2067 | 2067 | WHERE id = %i', |
2068 | 2068 | $file |
2069 | 2069 | ); |
2070 | 2070 | |
2071 | 2071 | // skip file is Coherancey not respected |
2072 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) { |
|
2072 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) { |
|
2073 | 2073 | // Case where we want to decrypt |
2074 | 2074 | if ($post_option === 'decrypt') { |
2075 | 2075 | prepareFileWithDefuse( |
2076 | 2076 | 'decrypt', |
2077 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
2078 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
2077 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
2078 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
2079 | 2079 | $SETTINGS |
2080 | 2080 | ); |
2081 | 2081 | // Case where we want to encrypt |
2082 | 2082 | } elseif ($post_option === 'encrypt') { |
2083 | 2083 | prepareFileWithDefuse( |
2084 | 2084 | 'encrypt', |
2085 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
2086 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
2085 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
2086 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
2087 | 2087 | $SETTINGS |
2088 | 2088 | ); |
2089 | 2089 | } |
2090 | 2090 | // Do file cleanup |
2091 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS); |
|
2091 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS); |
|
2092 | 2092 | rename( |
2093 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
2094 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'] |
|
2093 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
2094 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'] |
|
2095 | 2095 | ); |
2096 | 2096 | |
2097 | 2097 | // store in DB |
@@ -2126,8 +2126,8 @@ discard block |
||
2126 | 2126 | $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted' |
2127 | 2127 | ); |
2128 | 2128 | |
2129 | - $message = langHdl('last_execution') . ' ' . |
|
2130 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
2129 | + $message = langHdl('last_execution').' '. |
|
2130 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
2131 | 2131 | '<i class="fas fa-check text-success ml-2 mr-3"></i>'; |
2132 | 2132 | } |
2133 | 2133 | |
@@ -2175,7 +2175,7 @@ discard block |
||
2175 | 2175 | |
2176 | 2176 | // decrypt and retrieve data in JSON format |
2177 | 2177 | $dataReceived = prepareExchangedData( |
2178 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2178 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2179 | 2179 | |
2180 | 2180 | $post_label = isset($dataReceived['label']) === true ? filter_var($dataReceived['label'], FILTER_SANITIZE_STRING) : ''; |
2181 | 2181 | $post_action = filter_var($dataReceived['action'], FILTER_SANITIZE_STRING); |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING); |
2218 | 2218 | |
2219 | 2219 | DB::query( |
2220 | - 'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i', |
|
2220 | + 'DELETE FROM '.prefixTable('api').' WHERE id = %i', |
|
2221 | 2221 | $post_id |
2222 | 2222 | ); |
2223 | 2223 | } |
@@ -2266,7 +2266,7 @@ discard block |
||
2266 | 2266 | |
2267 | 2267 | // decrypt and retrieve data in JSON format |
2268 | 2268 | $dataReceived = prepareExchangedData( |
2269 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2269 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2270 | 2270 | |
2271 | 2271 | $post_action = filter_var($dataReceived['action'], FILTER_SANITIZE_STRING); |
2272 | 2272 | |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | // Delete existing key |
2314 | 2314 | } elseif (null !== $post_action && $post_action === 'delete') { |
2315 | 2315 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING); |
2316 | - DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id); |
|
2316 | + DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id); |
|
2317 | 2317 | } |
2318 | 2318 | |
2319 | 2319 | echo prepareExchangedData( |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | |
2330 | 2330 | case 'save_api_status': |
2331 | 2331 | // Do query |
2332 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
2332 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
2333 | 2333 | $counter = DB::count(); |
2334 | 2334 | if ($counter === 0) { |
2335 | 2335 | DB::insert( |
@@ -2355,7 +2355,7 @@ discard block |
||
2355 | 2355 | break; |
2356 | 2356 | |
2357 | 2357 | case 'save_duo_status': |
2358 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo'); |
|
2358 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo'); |
|
2359 | 2359 | $counter = DB::count(); |
2360 | 2360 | if ($counter === 0) { |
2361 | 2361 | DB::insert( |
@@ -2395,12 +2395,12 @@ discard block |
||
2395 | 2395 | |
2396 | 2396 | // decrypt and retrieve data in JSON format |
2397 | 2397 | $dataReceived = prepareExchangedData( |
2398 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2398 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2399 | 2399 | // Store in DB |
2400 | 2400 | foreach ($dataReceived as $key => $value) { |
2401 | 2401 | DB::query( |
2402 | 2402 | 'SELECT * |
2403 | - FROM ' . prefixTable('misc') . ' |
|
2403 | + FROM ' . prefixTable('misc').' |
|
2404 | 2404 | WHERE type = %s AND intitule = %s', |
2405 | 2405 | 'admin', |
2406 | 2406 | $key |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | } else { |
2472 | 2472 | $tmp = 1; |
2473 | 2473 | } |
2474 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
2474 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
2475 | 2475 | $counter = DB::count(); |
2476 | 2476 | if ($counter === 0) { |
2477 | 2477 | DB::insert( |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | |
2498 | 2498 | // ga_website_name |
2499 | 2499 | if (is_null($dataReceived['ga_website_name']) === false) { |
2500 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
2500 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
2501 | 2501 | $counter = DB::count(); |
2502 | 2502 | if ($counter === 0) { |
2503 | 2503 | DB::insert( |
@@ -2528,7 +2528,7 @@ discard block |
||
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | // send data |
2531 | - echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]'; |
|
2531 | + echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]'; |
|
2532 | 2532 | break; |
2533 | 2533 | |
2534 | 2534 | case 'save_agses_options': |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | |
2554 | 2554 | // agses_hosted_url |
2555 | 2555 | if (!is_null($dataReceived['agses_hosted_url'])) { |
2556 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
2556 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
2557 | 2557 | $counter = DB::count(); |
2558 | 2558 | if ($counter === 0) { |
2559 | 2559 | DB::insert( |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | |
2583 | 2583 | // agses_hosted_id |
2584 | 2584 | if (!is_null($dataReceived['agses_hosted_id'])) { |
2585 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
2585 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
2586 | 2586 | $counter = DB::count(); |
2587 | 2587 | if ($counter === 0) { |
2588 | 2588 | DB::insert( |
@@ -2611,7 +2611,7 @@ discard block |
||
2611 | 2611 | |
2612 | 2612 | // agses_hosted_apikey |
2613 | 2613 | if (!is_null($dataReceived['agses_hosted_apikey'])) { |
2614 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2614 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2615 | 2615 | $counter = DB::count(); |
2616 | 2616 | if ($counter === 0) { |
2617 | 2617 | DB::insert( |
@@ -2639,7 +2639,7 @@ discard block |
||
2639 | 2639 | } |
2640 | 2640 | |
2641 | 2641 | // send data |
2642 | - echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]'; |
|
2642 | + echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]'; |
|
2643 | 2643 | break; |
2644 | 2644 | |
2645 | 2645 | case 'save_option_change': |
@@ -2677,7 +2677,7 @@ discard block |
||
2677 | 2677 | |
2678 | 2678 | // Check if setting is already in DB. If NO then insert, if YES then update. |
2679 | 2679 | $data = DB::query( |
2680 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2680 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2681 | 2681 | WHERE type = %s AND intitule = %s', |
2682 | 2682 | $type, |
2683 | 2683 | $dataReceived['field'] |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | array( |
2700 | 2700 | 'valeur' => time(), |
2701 | 2701 | 'type' => $type, |
2702 | - 'intitule' => $dataReceived['field'] . '_time', |
|
2702 | + 'intitule' => $dataReceived['field'].'_time', |
|
2703 | 2703 | ) |
2704 | 2704 | ); |
2705 | 2705 | } |
@@ -2717,10 +2717,10 @@ discard block |
||
2717 | 2717 | if ($dataReceived['field'] === 'send_stats') { |
2718 | 2718 | // Check if previous time exists, if not them insert this value in DB |
2719 | 2719 | DB::query( |
2720 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2720 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2721 | 2721 | WHERE type = %s AND intitule = %s', |
2722 | 2722 | $type, |
2723 | - $dataReceived['field'] . '_time' |
|
2723 | + $dataReceived['field'].'_time' |
|
2724 | 2724 | ); |
2725 | 2725 | $counter = DB::count(); |
2726 | 2726 | if ($counter === 0) { |
@@ -2729,7 +2729,7 @@ discard block |
||
2729 | 2729 | array( |
2730 | 2730 | 'valeur' => 0, |
2731 | 2731 | 'type' => $type, |
2732 | - 'intitule' => $dataReceived['field'] . '_time', |
|
2732 | + 'intitule' => $dataReceived['field'].'_time', |
|
2733 | 2733 | ) |
2734 | 2734 | ); |
2735 | 2735 | } else { |
@@ -2749,13 +2749,13 @@ discard block |
||
2749 | 2749 | // special Cases |
2750 | 2750 | if ($dataReceived['field'] === 'cpassman_url') { |
2751 | 2751 | // update also jsUrl for CSFP protection |
2752 | - $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2752 | + $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2753 | 2753 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
2754 | 2754 | $data = file_get_contents($csrfp_file); |
2755 | 2755 | $posJsUrl = strpos($data, '"jsUrl" => "'); |
2756 | 2756 | $posEndLine = strpos($data, '",', $posJsUrl); |
2757 | 2757 | $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2)); |
2758 | - $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data); |
|
2758 | + $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data); |
|
2759 | 2759 | file_put_contents($csrfp_file, $newdata); |
2760 | 2760 | } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') { |
2761 | 2761 | DB::update( |
@@ -2780,7 +2780,7 @@ discard block |
||
2780 | 2780 | $SETTINGS['cpassman_dir'], |
2781 | 2781 | array( |
2782 | 2782 | 'error' => false, |
2783 | - 'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']], |
|
2783 | + 'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']], |
|
2784 | 2784 | ), |
2785 | 2785 | 'encode' |
2786 | 2786 | ); |
@@ -2825,7 +2825,7 @@ discard block |
||
2825 | 2825 | |
2826 | 2826 | // send statistics |
2827 | 2827 | if (null !== $post_status) { |
2828 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2828 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2829 | 2829 | $counter = DB::count(); |
2830 | 2830 | if ($counter === 0) { |
2831 | 2831 | DB::insert( |
@@ -2857,7 +2857,7 @@ discard block |
||
2857 | 2857 | |
2858 | 2858 | // send statistics items |
2859 | 2859 | if (null !== $post_list) { |
2860 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2860 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2861 | 2861 | $counter = DB::count(); |
2862 | 2862 | if ($counter === 0) { |
2863 | 2863 | DB::insert( |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | break; |
2906 | 2906 | } |
2907 | 2907 | |
2908 | - if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) { |
|
2908 | + if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) { |
|
2909 | 2909 | if (DB::count() === 1) { |
2910 | 2910 | echo 1; |
2911 | 2911 | } else { |
@@ -2944,7 +2944,7 @@ discard block |
||
2944 | 2944 | |
2945 | 2945 | $rows = DB::query( |
2946 | 2946 | 'SELECT id, title |
2947 | - FROM ' . prefixTable('roles_title') . ' |
|
2947 | + FROM ' . prefixTable('roles_title').' |
|
2948 | 2948 | ORDER BY title ASC' |
2949 | 2949 | ); |
2950 | 2950 | foreach ($rows as $record) { |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | } |
2961 | 2961 | |
2962 | 2962 | echo prepareExchangedData( |
2963 | - $SETTINGS['cpassman_dir'],$json, 'encode'); |
|
2963 | + $SETTINGS['cpassman_dir'], $json, 'encode'); |
|
2964 | 2964 | |
2965 | 2965 | break; |
2966 | 2966 | } |
@@ -505,7 +505,7 @@ |
||
505 | 505 | |
506 | 506 | // decrypt and retrieve data in JSON format |
507 | 507 | $dataReceived = prepareExchangedData( |
508 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
508 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
509 | 509 | |
510 | 510 | // Prepare variables |
511 | 511 | $post_roleId = filter_var($dataReceived['roleId'], FILTER_SANITIZE_NUMBER_INT); |
@@ -45,26 +45,26 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /* do checks */ |
48 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
49 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
48 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
49 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
50 | 50 | if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS)) { |
51 | 51 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
52 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
52 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
53 | 53 | exit(); |
54 | 54 | } |
55 | 55 | |
56 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
57 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
56 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
57 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
59 | 59 | |
60 | 60 | header('Content-type: text/html; charset=utf-8'); |
61 | 61 | header('Cache-Control: no-cache, no-store, must-revalidate'); |
62 | 62 | |
63 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
64 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
63 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
64 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
65 | 65 | |
66 | 66 | // connect to the server |
67 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
67 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
68 | 68 | if (defined('DB_PASSWD_CLEAR') === false) { |
69 | 69 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
70 | 70 | } |
@@ -129,38 +129,38 @@ discard block |
||
129 | 129 | ]; |
130 | 130 | |
131 | 131 | // Load expected libraries |
132 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
133 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
134 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
135 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
136 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
137 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
138 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
139 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
140 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
141 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
142 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
143 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
144 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
145 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
146 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
147 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
148 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
149 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
150 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
151 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
152 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
153 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
154 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
155 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
156 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
157 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
158 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
159 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
160 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
161 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
162 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
163 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
132 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
133 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
134 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
135 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
136 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
137 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
138 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
139 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
140 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
141 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
142 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
143 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
144 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
145 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
146 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
147 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
148 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
149 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
150 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
151 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
152 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
153 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
154 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
155 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
156 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
157 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
158 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
159 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
160 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
161 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
162 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
163 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
164 | 164 | |
165 | 165 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
166 | 166 | $ad->register(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $SETTINGS['cpassman_dir'], |
177 | 177 | array( |
178 | 178 | 'error' => true, |
179 | - 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(), |
|
179 | + 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(), |
|
180 | 180 | ), |
181 | 181 | 'encode' |
182 | 182 | ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $SETTINGS['cpassman_dir'], |
196 | 196 | array( |
197 | 197 | 'error' => true, |
198 | - 'message' => "Error : ".$e->withDetailedError($e),//->detailedError(), |
|
198 | + 'message' => "Error : ".$e->withDetailedError($e), //->detailedError(), |
|
199 | 199 | ), |
200 | 200 | 'encode' |
201 | 201 | ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $SETTINGS['cpassman_dir'], |
216 | 216 | array( |
217 | 217 | 'error' => true, |
218 | - 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(), |
|
218 | + 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(), |
|
219 | 219 | ), |
220 | 220 | 'encode' |
221 | 221 | ); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /* do checks */ |
50 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
51 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
50 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
51 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
52 | 52 | $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING); |
53 | 53 | if ( |
54 | 54 | checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | || $isprofileupdate === false |
60 | 60 | ) { |
61 | 61 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
62 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
62 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
63 | 63 | exit(); |
64 | 64 | } else { |
65 | 65 | // Do special check to allow user to change attributes of his profile |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false |
69 | 69 | ) { |
70 | 70 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
71 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
71 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
72 | 72 | exit(); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
77 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
78 | 78 | header('Content-type: text/html; charset=utf-8'); |
79 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
80 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
81 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
79 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
80 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
81 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
82 | 82 | |
83 | 83 | // Connect to mysql server |
84 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
84 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
85 | 85 | if (defined('DB_PASSWD_CLEAR') === false) { |
86 | 86 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
87 | 87 | } |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | |
129 | 129 | // decrypt and retrieve data in JSON format |
130 | 130 | $dataReceived = prepareExchangedData( |
131 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
131 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
132 | 132 | |
133 | 133 | // Prepare variables |
134 | 134 | $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING); |
135 | 135 | $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL); |
136 | - $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING); |
|
136 | + $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING); |
|
137 | 137 | $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING); |
138 | 138 | $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING); |
139 | 139 | $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Check if user already exists |
164 | 164 | $data = DB::query( |
165 | 165 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
166 | - FROM ' . prefixTable('users') . ' |
|
166 | + FROM ' . prefixTable('users').' |
|
167 | 167 | WHERE login = %s', |
168 | 168 | $login |
169 | 169 | ); |
@@ -379,14 +379,14 @@ discard block |
||
379 | 379 | |
380 | 380 | // decrypt and retrieve data in JSON format |
381 | 381 | $dataReceived = prepareExchangedData( |
382 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
382 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
383 | 383 | |
384 | 384 | // Prepare variables |
385 | 385 | $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
386 | 386 | |
387 | 387 | // Get info about user to delete |
388 | 388 | $data_user = DB::queryfirstrow( |
389 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
389 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
390 | 390 | WHERE id = %i', |
391 | 391 | $post_id |
392 | 392 | ); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | ); |
406 | 406 | // delete personal folder and subfolders |
407 | 407 | $data = DB::queryfirstrow( |
408 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
408 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
409 | 409 | WHERE title = %s AND personal_folder = %i', |
410 | 410 | $post_id, |
411 | 411 | '1' |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
419 | 419 | // delete items & logs |
420 | 420 | $items = DB::query( |
421 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
421 | + 'SELECT id FROM '.prefixTable('items').' |
|
422 | 422 | WHERE id_tree=%i AND perso = %i', |
423 | 423 | $folder->id, |
424 | 424 | '1' |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | // Check KEY |
471 | 471 | if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) { |
472 | 472 | echo prepareExchangedData( |
473 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
473 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
474 | 474 | break; |
475 | 475 | } |
476 | 476 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | |
479 | 479 | // Get info about user to delete |
480 | 480 | $data_user = DB::queryfirstrow( |
481 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
481 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
482 | 482 | WHERE id = %i', |
483 | 483 | $post_id |
484 | 484 | ); |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | $post_id |
499 | 499 | ); |
500 | 500 | echo prepareExchangedData( |
501 | - $SETTINGS['cpassman_dir'],array('error' => ''), 'encode'); |
|
501 | + $SETTINGS['cpassman_dir'], array('error' => ''), 'encode'); |
|
502 | 502 | } else { |
503 | 503 | echo prepareExchangedData( |
504 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode'); |
|
504 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode'); |
|
505 | 505 | } |
506 | 506 | break; |
507 | 507 | /* |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | || $_SESSION['is_admin'] !== '1' |
515 | 515 | ) { |
516 | 516 | echo prepareExchangedData( |
517 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
517 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
518 | 518 | exit(); |
519 | 519 | } |
520 | 520 | |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | |
524 | 524 | // Get info about user to delete |
525 | 525 | $data_user = DB::queryfirstrow( |
526 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
526 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
527 | 527 | WHERE id = %i', |
528 | 528 | $post_id |
529 | 529 | ); |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | ); |
547 | 547 | |
548 | 548 | echo prepareExchangedData( |
549 | - $SETTINGS['cpassman_dir'],array('error' => ''), 'encode'); |
|
549 | + $SETTINGS['cpassman_dir'], array('error' => ''), 'encode'); |
|
550 | 550 | } else { |
551 | 551 | echo prepareExchangedData( |
552 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode'); |
|
552 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode'); |
|
553 | 553 | } |
554 | 554 | break; |
555 | 555 | /* |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | // Check KEY |
560 | 560 | if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) { |
561 | 561 | echo prepareExchangedData( |
562 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
562 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
563 | 563 | break; |
564 | 564 | } |
565 | 565 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | // Get info about user to delete |
570 | 570 | $data_user = DB::queryfirstrow( |
571 | 571 | 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire |
572 | - FROM ' . prefixTable('users') . ' |
|
572 | + FROM ' . prefixTable('users').' |
|
573 | 573 | WHERE id = %i', |
574 | 574 | $post_id |
575 | 575 | ); |
@@ -594,10 +594,10 @@ discard block |
||
594 | 594 | $post_id |
595 | 595 | ); |
596 | 596 | echo prepareExchangedData( |
597 | - $SETTINGS['cpassman_dir'],array('error' => ''), 'encode'); |
|
597 | + $SETTINGS['cpassman_dir'], array('error' => ''), 'encode'); |
|
598 | 598 | } else { |
599 | 599 | echo prepareExchangedData( |
600 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode'); |
|
600 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode'); |
|
601 | 601 | } |
602 | 602 | break; |
603 | 603 | /* |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | // Check KEY |
608 | 608 | if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) { |
609 | 609 | echo prepareExchangedData( |
610 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
610 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
611 | 611 | break; |
612 | 612 | } |
613 | 613 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | |
617 | 617 | // Get info about user to delete |
618 | 618 | $data_user = DB::queryfirstrow( |
619 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
619 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
620 | 620 | WHERE id = %i', |
621 | 621 | $post_id |
622 | 622 | ); |
@@ -638,10 +638,10 @@ discard block |
||
638 | 638 | $post_id |
639 | 639 | ); |
640 | 640 | echo prepareExchangedData( |
641 | - $SETTINGS['cpassman_dir'],array('error' => ''), 'encode'); |
|
641 | + $SETTINGS['cpassman_dir'], array('error' => ''), 'encode'); |
|
642 | 642 | } else { |
643 | 643 | echo prepareExchangedData( |
644 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode'); |
|
644 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode'); |
|
645 | 645 | } |
646 | 646 | break; |
647 | 647 | /* |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | // Check KEY |
653 | 653 | if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) { |
654 | 654 | echo prepareExchangedData( |
655 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
655 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
656 | 656 | break; |
657 | 657 | } |
658 | 658 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | // Get info about user to delete |
663 | 663 | $data_user = DB::queryfirstrow( |
664 | 664 | 'SELECT admin, isAdministratedByRole, gestionnaire |
665 | - FROM ' . prefixTable('users') . ' |
|
665 | + FROM ' . prefixTable('users').' |
|
666 | 666 | WHERE id = %i', |
667 | 667 | $post_id |
668 | 668 | ); |
@@ -685,10 +685,10 @@ discard block |
||
685 | 685 | $post_id |
686 | 686 | ); |
687 | 687 | echo prepareExchangedData( |
688 | - $SETTINGS['cpassman_dir'],array('error' => ''), 'encode'); |
|
688 | + $SETTINGS['cpassman_dir'], array('error' => ''), 'encode'); |
|
689 | 689 | } else { |
690 | 690 | echo prepareExchangedData( |
691 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode'); |
|
691 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode'); |
|
692 | 692 | } |
693 | 693 | break; |
694 | 694 | /* |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | // Check KEY |
699 | 699 | if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) { |
700 | 700 | echo prepareExchangedData( |
701 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
701 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode'); |
|
702 | 702 | break; |
703 | 703 | } |
704 | 704 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | // Get info about user to delete |
709 | 709 | $data_user = DB::queryfirstrow( |
710 | 710 | 'SELECT admin, isAdministratedByRole, gestionnaire |
711 | - FROM ' . prefixTable('users') . ' |
|
711 | + FROM ' . prefixTable('users').' |
|
712 | 712 | WHERE id = %i', |
713 | 713 | $post_id |
714 | 714 | ); |
@@ -728,10 +728,10 @@ discard block |
||
728 | 728 | $post_id |
729 | 729 | ); |
730 | 730 | echo prepareExchangedData( |
731 | - $SETTINGS['cpassman_dir'],array('error' => ''), 'encode'); |
|
731 | + $SETTINGS['cpassman_dir'], array('error' => ''), 'encode'); |
|
732 | 732 | } else { |
733 | 733 | echo prepareExchangedData( |
734 | - $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode'); |
|
734 | + $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode'); |
|
735 | 735 | } |
736 | 736 | break; |
737 | 737 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | // Get info about user to delete |
751 | 751 | $data_user = DB::queryfirstrow( |
752 | 752 | 'SELECT admin, isAdministratedByRole, gestionnaire |
753 | - FROM ' . prefixTable('users') . ' |
|
753 | + FROM ' . prefixTable('users').' |
|
754 | 754 | WHERE id = %i', |
755 | 755 | $post_id |
756 | 756 | ); |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $return = array(); |
790 | 790 | // Check if folder exists |
791 | 791 | $data = DB::query( |
792 | - 'SELECT * FROM ' . prefixTable('nested_tree') . ' |
|
792 | + 'SELECT * FROM '.prefixTable('nested_tree').' |
|
793 | 793 | WHERE title = %s AND parent_id = %i', |
794 | 794 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING), |
795 | 795 | '0' |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | } |
803 | 803 | // Check if role exists |
804 | 804 | $data = DB::query( |
805 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
805 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
806 | 806 | WHERE title = %s', |
807 | 807 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING) |
808 | 808 | ); |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | case 'user_log_items': |
823 | 823 | $nb_pages = 1; |
824 | 824 | $logs = $sql_filter = ''; |
825 | - $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . ' : </td>'; |
|
825 | + $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').' : </td>'; |
|
826 | 826 | |
827 | 827 | // Prepare POST variables |
828 | 828 | $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT); |
@@ -834,14 +834,14 @@ discard block |
||
834 | 834 | && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)) |
835 | 835 | && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all' |
836 | 836 | ) { |
837 | - $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'"; |
|
837 | + $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'"; |
|
838 | 838 | } |
839 | 839 | // get number of pages |
840 | 840 | DB::query( |
841 | 841 | 'SELECT * |
842 | - FROM ' . prefixTable('log_items') . ' as l |
|
843 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
844 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
842 | + FROM ' . prefixTable('log_items').' as l |
|
843 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
844 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
845 | 845 | WHERE l.id_user = %i ' . $sql_filter, |
846 | 846 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
847 | 847 | ); |
@@ -859,19 +859,19 @@ discard block |
||
859 | 859 | // launch query |
860 | 860 | $rows = DB::query( |
861 | 861 | 'SELECT l.date as date, u.login as login, i.label as label, l.action as action |
862 | - FROM ' . prefixTable('log_items') . ' as l |
|
863 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
864 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
865 | - WHERE l.id_user = %i ' . $sql_filter . ' |
|
862 | + FROM ' . prefixTable('log_items').' as l |
|
863 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
864 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
865 | + WHERE l.id_user = %i ' . $sql_filter.' |
|
866 | 866 | ORDER BY date DESC |
867 | - LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page), |
|
867 | + LIMIT ' . intval($start).','.intval($post_nb_items_by_page), |
|
868 | 868 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
869 | 869 | ); |
870 | 870 | } else { |
871 | 871 | // get number of pages |
872 | 872 | DB::query( |
873 | 873 | 'SELECT * |
874 | - FROM ' . prefixTable('log_system') . ' |
|
874 | + FROM ' . prefixTable('log_system').' |
|
875 | 875 | WHERE type = %s AND field_1=%i', |
876 | 876 | 'user_mngt', |
877 | 877 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | // launch query |
891 | 891 | $rows = DB::query( |
892 | 892 | 'SELECT * |
893 | - FROM ' . prefixTable('log_system') . ' |
|
893 | + FROM ' . prefixTable('log_system').' |
|
894 | 894 | WHERE type = %s AND field_1 = %i |
895 | 895 | ORDER BY date DESC |
896 | 896 | LIMIT %i, %i', |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | if (isset($counter) && $counter != 0) { |
905 | 905 | $nb_pages = ceil($counter / intval($post_nb_items_by_page)); |
906 | 906 | for ($i = 1; $i <= $nb_pages; ++$i) { |
907 | - $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>'; |
|
907 | + $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>'; |
|
908 | 908 | } |
909 | 909 | } |
910 | 910 | $pages .= '</tr></table>'; |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | if ($post_scope === 'user_mngt') { |
914 | 914 | $user = DB::queryfirstrow( |
915 | 915 | 'SELECT login |
916 | - from ' . prefixTable('users') . ' |
|
916 | + from ' . prefixTable('users').' |
|
917 | 917 | WHERE id=%i', |
918 | 918 | $record['qui'] |
919 | 919 | ); |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | if ($tmp[0] == 'at_user_initial_pwd_changed') { |
924 | 924 | $label = langHdl('log_user_initial_pwd_changed'); |
925 | 925 | } elseif ($tmp[0] == 'at_user_email_changed') { |
926 | - $label = langHdl('log_user_email_changed') . $tmp[1]; |
|
926 | + $label = langHdl('log_user_email_changed').$tmp[1]; |
|
927 | 927 | } elseif ($tmp[0] == 'at_user_added') { |
928 | 928 | $label = langHdl('log_user_created'); |
929 | 929 | } elseif ($tmp[0] == 'at_user_locked') { |
@@ -934,14 +934,14 @@ discard block |
||
934 | 934 | $label = langHdl('log_user_pwd_changed'); |
935 | 935 | } |
936 | 936 | // prepare log |
937 | - $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>'; |
|
937 | + $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>'; |
|
938 | 938 | } else { |
939 | - $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>'; |
|
939 | + $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>'; |
|
940 | 940 | } |
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
944 | - echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]'; |
|
944 | + echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]'; |
|
945 | 945 | break; |
946 | 946 | |
947 | 947 | /* |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | } else { |
968 | 968 | // Get folder id for Admin |
969 | 969 | $admin_folder = DB::queryFirstRow( |
970 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
970 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
971 | 971 | WHERE title = %i AND personal_folder = %i', |
972 | 972 | intval($_SESSION['user_id']), |
973 | 973 | '1' |
@@ -978,15 +978,15 @@ discard block |
||
978 | 978 | // Get each Items in PF |
979 | 979 | $rows = DB::query( |
980 | 980 | 'SELECT i.pw, i.label, l.id_user |
981 | - FROM ' . prefixTable('items') . ' as i |
|
982 | - LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id) |
|
981 | + FROM ' . prefixTable('items').' as i |
|
982 | + LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id) |
|
983 | 983 | WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i', |
984 | 984 | 'at_creation', |
985 | 985 | '1', |
986 | 986 | intval($folder->id) |
987 | 987 | ); |
988 | 988 | foreach ($rows as $record) { |
989 | - echo $record['label'] . ' - '; |
|
989 | + echo $record['label'].' - '; |
|
990 | 990 | // Change user |
991 | 991 | DB::update( |
992 | 992 | prefixTable('log_items'), |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | // Get info about user to delete |
1022 | 1022 | $data_user = DB::queryfirstrow( |
1023 | 1023 | 'SELECT admin, isAdministratedByRole, gestionnaire |
1024 | - FROM ' . prefixTable('users') . ' |
|
1024 | + FROM ' . prefixTable('users').' |
|
1025 | 1025 | WHERE id = %i', |
1026 | 1026 | $post_user_id |
1027 | 1027 | ); |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | |
1059 | 1059 | // Do |
1060 | 1060 | $rows = DB::query( |
1061 | - 'SELECT id FROM ' . prefixTable('users') . ' |
|
1061 | + 'SELECT id FROM '.prefixTable('users').' |
|
1062 | 1062 | WHERE timestamp != %s AND admin != %i', |
1063 | 1063 | '', |
1064 | 1064 | '1' |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | // Get info about user to delete |
1068 | 1068 | $data_user = DB::queryfirstrow( |
1069 | 1069 | 'SELECT admin, isAdministratedByRole, gestionnaire |
1070 | - FROM ' . prefixTable('users') . ' |
|
1070 | + FROM ' . prefixTable('users').' |
|
1071 | 1071 | WHERE id = %i', |
1072 | 1072 | $record['id'] |
1073 | 1073 | ); |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | // decrypt and retrieve data in JSON format |
1122 | 1122 | $dataReceived = prepareExchangedData( |
1123 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
1123 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
1124 | 1124 | |
1125 | 1125 | // Prepare variables |
1126 | 1126 | $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | // Get info about user |
1129 | 1129 | $rowUser = DB::queryfirstrow( |
1130 | 1130 | 'SELECT * |
1131 | - FROM ' . prefixTable('users') . ' |
|
1131 | + FROM ' . prefixTable('users').' |
|
1132 | 1132 | WHERE id = %i', |
1133 | 1133 | $post_id |
1134 | 1134 | ); |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | $arrFldAllowed = array(); |
1147 | 1147 | |
1148 | 1148 | //Build tree |
1149 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1149 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1150 | 1150 | $tree->register(); |
1151 | 1151 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
1152 | 1152 | |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | // array of roles for actual user |
1158 | 1158 | $my_functions = explode(';', $_SESSION['fonction_id']); |
1159 | 1159 | |
1160 | - $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title')); |
|
1160 | + $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title')); |
|
1161 | 1161 | foreach ($rows as $record) { |
1162 | 1162 | if ( |
1163 | 1163 | (int) $_SESSION['is_admin'] === 1 |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | $rolesList = array(); |
1194 | 1194 | $managedBy = array(); |
1195 | 1195 | $selected = ''; |
1196 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
1196 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
1197 | 1197 | foreach ($rows as $reccord) { |
1198 | 1198 | $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']); |
1199 | 1199 | } |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | array_push( |
1225 | 1225 | $managedBy, |
1226 | 1226 | array( |
1227 | - 'title' => langHdl('managers_of') . ' ' . $fonction['title'], |
|
1227 | + 'title' => langHdl('managers_of').' '.$fonction['title'], |
|
1228 | 1228 | 'id' => $fonction['id'], |
1229 | 1229 | 'selected' => $selected, |
1230 | 1230 | ) |
@@ -1306,9 +1306,9 @@ discard block |
||
1306 | 1306 | |
1307 | 1307 | // get USER STATUS |
1308 | 1308 | if ($rowUser['disabled'] == 1) { |
1309 | - $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>'; |
|
1309 | + $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>'; |
|
1310 | 1310 | } else { |
1311 | - $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk"> ' . langHdl('user_info_lock_question'); |
|
1311 | + $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk"> '.langHdl('user_info_lock_question'); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | $arrData['error'] = false; |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | |
1381 | 1381 | // decrypt and retrieve data in JSON format |
1382 | 1382 | $dataReceived = prepareExchangedData( |
1383 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
1383 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
1384 | 1384 | |
1385 | 1385 | // Prepare variables |
1386 | 1386 | $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_STRING); |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | // count number of admins |
1406 | 1406 | $users = DB::query( |
1407 | 1407 | 'SELECT id |
1408 | - FROM ' . prefixTable('users') . ' |
|
1408 | + FROM ' . prefixTable('users').' |
|
1409 | 1409 | WHERE admin = 1 AND email != "" AND pw != ""' |
1410 | 1410 | ); |
1411 | 1411 | if (DB::count() === 1) { |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | |
1495 | 1495 | // Get info about user to delete |
1496 | 1496 | $data_user = DB::queryfirstrow( |
1497 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
1497 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
1498 | 1498 | WHERE id = %i', |
1499 | 1499 | $post_id |
1500 | 1500 | ); |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | ); |
1516 | 1516 | // delete personal folder and subfolders |
1517 | 1517 | $data = DB::queryfirstrow( |
1518 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
1518 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
1519 | 1519 | WHERE title = %s AND personal_folder = %i', |
1520 | 1520 | $post_id, |
1521 | 1521 | '1' |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
1529 | 1529 | // delete items & logs |
1530 | 1530 | $items = DB::query( |
1531 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
1531 | + 'SELECT id FROM '.prefixTable('items').' |
|
1532 | 1532 | WHERE id_tree=%i AND perso = %i', |
1533 | 1533 | $folder->id, |
1534 | 1534 | '1' |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | } else { |
1550 | 1550 | // Get old data about user |
1551 | 1551 | $oldData = DB::queryfirstrow( |
1552 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
1552 | + 'SELECT * FROM '.prefixTable('users').' |
|
1553 | 1553 | WHERE id = %i', |
1554 | 1554 | $post_id |
1555 | 1555 | ); |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | |
1580 | 1580 | // update LOG |
1581 | 1581 | if ($oldData['email'] !== $post_email) { |
1582 | - logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id); |
|
1582 | + logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id); |
|
1583 | 1583 | } |
1584 | 1584 | } |
1585 | 1585 | echo prepareExchangedData( |
@@ -1632,14 +1632,14 @@ discard block |
||
1632 | 1632 | |
1633 | 1633 | // decrypt and retrieve data in JSON format |
1634 | 1634 | $dataReceived = prepareExchangedData( |
1635 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
1635 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
1636 | 1636 | |
1637 | 1637 | // Prepare variables |
1638 | 1638 | $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
1639 | 1639 | |
1640 | 1640 | // Get info about user to delete |
1641 | 1641 | $data_user = DB::queryfirstrow( |
1642 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
1642 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
1643 | 1643 | WHERE id = %i', |
1644 | 1644 | $post_id |
1645 | 1645 | ); |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | } |
1692 | 1692 | |
1693 | 1693 | DB::queryfirstrow( |
1694 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
1694 | + 'SELECT * FROM '.prefixTable('users').' |
|
1695 | 1695 | WHERE login = %s', |
1696 | 1696 | filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING) |
1697 | 1697 | ); |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | |
1737 | 1737 | // decrypt and retrieve data in JSON format |
1738 | 1738 | $dataReceived = prepareExchangedData( |
1739 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
1739 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
1740 | 1740 | |
1741 | 1741 | // Prepare variables |
1742 | 1742 | $post_id = filter_input(INPUT_POST, 'user_id', FILTER_SANITIZE_NUMBER_INT); |
@@ -1744,14 +1744,14 @@ discard block |
||
1744 | 1744 | $arrData = array(); |
1745 | 1745 | |
1746 | 1746 | //Build tree |
1747 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1747 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1748 | 1748 | $tree->register(); |
1749 | 1749 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
1750 | 1750 | |
1751 | 1751 | // get User info |
1752 | 1752 | $rowUser = DB::queryFirstRow( |
1753 | 1753 | 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb |
1754 | - FROM ' . prefixTable('users') . ' |
|
1754 | + FROM ' . prefixTable('users').' |
|
1755 | 1755 | WHERE id = %i', |
1756 | 1756 | $post_id |
1757 | 1757 | ); |
@@ -1769,7 +1769,7 @@ discard block |
||
1769 | 1769 | // refine folders based upon roles |
1770 | 1770 | $rows = DB::query( |
1771 | 1771 | 'SELECT folder_id, type |
1772 | - FROM ' . prefixTable('roles_values') . ' |
|
1772 | + FROM ' . prefixTable('roles_values').' |
|
1773 | 1773 | WHERE role_id IN %ls |
1774 | 1774 | ORDER BY folder_id ASC', |
1775 | 1775 | $arrData['functions'] |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | } |
1793 | 1793 | |
1794 | 1794 | // add allowed folders |
1795 | - foreach($arrData['allowed_folders'] as $Fld) { |
|
1795 | + foreach ($arrData['allowed_folders'] as $Fld) { |
|
1796 | 1796 | array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true)); |
1797 | 1797 | } |
1798 | 1798 | |
@@ -1803,7 +1803,7 @@ discard block |
||
1803 | 1803 | // get folder name |
1804 | 1804 | $row = DB::queryFirstRow( |
1805 | 1805 | 'SELECT title, nlevel, id |
1806 | - FROM ' . prefixTable('nested_tree') . ' |
|
1806 | + FROM ' . prefixTable('nested_tree').' |
|
1807 | 1807 | WHERE id = %i', |
1808 | 1808 | $fld['id'] |
1809 | 1809 | ); |
@@ -1816,36 +1816,36 @@ discard block |
||
1816 | 1816 | |
1817 | 1817 | // manage right icon |
1818 | 1818 | if ($fld['type'] == 'W') { |
1819 | - $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' . |
|
1820 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' . |
|
1821 | - '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>'; |
|
1819 | + $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'. |
|
1820 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'. |
|
1821 | + '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>'; |
|
1822 | 1822 | } elseif ($fld['type'] == 'ND') { |
1823 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' . |
|
1824 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' . |
|
1825 | - '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>'; |
|
1823 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'. |
|
1824 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'. |
|
1825 | + '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>'; |
|
1826 | 1826 | } elseif ($fld['type'] == 'NE') { |
1827 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' . |
|
1828 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' . |
|
1829 | - '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>'; |
|
1827 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'. |
|
1828 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'. |
|
1829 | + '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>'; |
|
1830 | 1830 | } elseif ($fld['type'] == 'NDNE') { |
1831 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' . |
|
1832 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' . |
|
1833 | - '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>'; |
|
1831 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'. |
|
1832 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'. |
|
1833 | + '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>'; |
|
1834 | 1834 | } else { |
1835 | - $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>'; |
|
1835 | + $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>'; |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | - $html .= '<tr><td>' . $ident . $row['title'] . |
|
1839 | - ' <small class="text-info">[' . $row['id'] . ']</small>'. |
|
1840 | - ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . langHdl('user_specific_right') . '"></i>' : ''). |
|
1841 | - '</td><td>' . $label . '</td></tr>'; |
|
1838 | + $html .= '<tr><td>'.$ident.$row['title']. |
|
1839 | + ' <small class="text-info">['.$row['id'].']</small>'. |
|
1840 | + ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.langHdl('user_specific_right').'"></i>' : ''). |
|
1841 | + '</td><td>'.$label.'</td></tr>'; |
|
1842 | 1842 | break; |
1843 | 1843 | } |
1844 | 1844 | } |
1845 | 1845 | } |
1846 | 1846 | |
1847 | - $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' . |
|
1848 | - $html . '</tbody></table>'; |
|
1847 | + $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'. |
|
1848 | + $html.'</tbody></table>'; |
|
1849 | 1849 | } else { |
1850 | 1850 | $html_full = ''; |
1851 | 1851 | } |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) { |
1895 | 1895 | $rows = DB::query( |
1896 | 1896 | 'SELECT * |
1897 | - FROM ' . prefixTable('users') . ' |
|
1897 | + FROM ' . prefixTable('users').' |
|
1898 | 1898 | WHERE admin = %i AND isAdministratedByRole IN %ls', |
1899 | 1899 | '0', |
1900 | 1900 | array_filter($_SESSION['user_roles']) |
@@ -1902,7 +1902,7 @@ discard block |
||
1902 | 1902 | } else { |
1903 | 1903 | $rows = DB::query( |
1904 | 1904 | 'SELECT * |
1905 | - FROM ' . prefixTable('users') . ' |
|
1905 | + FROM ' . prefixTable('users').' |
|
1906 | 1906 | WHERE admin = %i', |
1907 | 1907 | '0' |
1908 | 1908 | ); |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | $groupIds = []; |
1915 | 1915 | foreach (explode(';', $record['fonction_id']) as $group) { |
1916 | 1916 | $tmp = DB::queryfirstrow( |
1917 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
1917 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
1918 | 1918 | WHERE id = %i', |
1919 | 1919 | $group |
1920 | 1920 | ); |
@@ -1926,7 +1926,7 @@ discard block |
||
1926 | 1926 | |
1927 | 1927 | // Get managed_by |
1928 | 1928 | $managedBy = DB::queryfirstrow( |
1929 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
1929 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
1930 | 1930 | WHERE id = %i', |
1931 | 1931 | $record['isAdministratedByRole'] |
1932 | 1932 | ); |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | $foldersAllowedIds = []; |
1937 | 1937 | foreach (explode(';', $record['groupes_visibles']) as $role) { |
1938 | 1938 | $tmp = DB::queryfirstrow( |
1939 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
1939 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
1940 | 1940 | WHERE id = %i', |
1941 | 1941 | $role |
1942 | 1942 | ); |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | $foldersForbiddenIds = []; |
1950 | 1950 | foreach (explode(';', $record['groupes_interdits']) as $role) { |
1951 | 1951 | $tmp = DB::queryfirstrow( |
1952 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
1952 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
1953 | 1953 | WHERE id = %i', |
1954 | 1954 | $role |
1955 | 1955 | ); |
@@ -1967,7 +1967,7 @@ discard block |
||
1967 | 1967 | 'login' => $record['login'], |
1968 | 1968 | 'groups' => implode(', ', $groups), |
1969 | 1969 | 'groupIds' => $groupIds, |
1970 | - 'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'], |
|
1970 | + 'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'], |
|
1971 | 1971 | 'managedById' => $managedBy === null ? 0 : $managedBy['id'], |
1972 | 1972 | 'foldersAllowed' => implode(', ', $foldersAllowed), |
1973 | 1973 | 'foldersAllowedIds' => $foldersAllowedIds, |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | |
2024 | 2024 | // decrypt and retreive data in JSON format |
2025 | 2025 | $dataReceived = prepareExchangedData( |
2026 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2026 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2027 | 2027 | |
2028 | 2028 | $post_source_id = filter_var(htmlspecialchars_decode($dataReceived['source_id']), FILTER_SANITIZE_NUMBER_INT); |
2029 | 2029 | $post_destination_ids = filter_var_array($dataReceived['destination_ids'], FILTER_SANITIZE_NUMBER_INT); |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | |
2050 | 2050 | // Get info about user |
2051 | 2051 | $data_user = DB::queryfirstrow( |
2052 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
2052 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
2053 | 2053 | WHERE id = %i', |
2054 | 2054 | $post_source_id |
2055 | 2055 | ); |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | |
2206 | 2206 | // decrypt and retrieve data in JSON format |
2207 | 2207 | $dataReceived = prepareExchangedData( |
2208 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2208 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2209 | 2209 | |
2210 | 2210 | // prepare variables |
2211 | 2211 | $post_user_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
@@ -2217,14 +2217,14 @@ discard block |
||
2217 | 2217 | if (empty($post_context) === false && $post_context === 'add_one_role_to_user') { |
2218 | 2218 | $data_user = DB::queryfirstrow( |
2219 | 2219 | 'SELECT fonction_id |
2220 | - FROM ' . prefixTable('users') . ' |
|
2220 | + FROM ' . prefixTable('users').' |
|
2221 | 2221 | WHERE id = %i', |
2222 | 2222 | $post_user_id |
2223 | 2223 | ); |
2224 | 2224 | |
2225 | 2225 | if ($data_user) { |
2226 | 2226 | // Ensure array is unique |
2227 | - $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value; |
|
2227 | + $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value; |
|
2228 | 2228 | $post_new_value = implode(';', array_unique(explode(';', $post_new_value))); |
2229 | 2229 | } else { |
2230 | 2230 | // User not found |
@@ -2282,7 +2282,7 @@ discard block |
||
2282 | 2282 | if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') { |
2283 | 2283 | $record = DB::queryFirstRow( |
2284 | 2284 | 'SELECT user_ip_lastdate |
2285 | - FROM ' . prefixTable('users') . ' |
|
2285 | + FROM ' . prefixTable('users').' |
|
2286 | 2286 | WHERE id = %i', |
2287 | 2287 | $_SESSION['user_id'] |
2288 | 2288 | ); |
@@ -2378,38 +2378,38 @@ discard block |
||
2378 | 2378 | ]; |
2379 | 2379 | |
2380 | 2380 | // Load expected libraries |
2381 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
2382 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
2383 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
2384 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
2385 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
2386 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
2387 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
2388 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
2389 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
2390 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
2391 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
2392 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
2393 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
2394 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
2395 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
2396 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
2397 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
2398 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
2399 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
2400 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
2401 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
2402 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
2403 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
2404 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
2405 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
2406 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
2407 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
2408 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
2409 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
2410 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
2411 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
2412 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
2381 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
2382 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
2383 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
2384 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
2385 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
2386 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
2387 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
2388 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
2389 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
2390 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
2391 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
2392 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
2393 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
2394 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
2395 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
2396 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
2397 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
2398 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
2399 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
2400 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
2401 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
2402 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
2403 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
2404 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
2405 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
2406 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
2407 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
2408 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
2409 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
2410 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
2411 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
2412 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
2413 | 2413 | |
2414 | 2414 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
2415 | 2415 | $ad->register(); |
@@ -2426,7 +2426,7 @@ discard block |
||
2426 | 2426 | $SETTINGS['cpassman_dir'], |
2427 | 2427 | array( |
2428 | 2428 | 'error' => true, |
2429 | - 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(), |
|
2429 | + 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(), |
|
2430 | 2430 | ), |
2431 | 2431 | 'encode' |
2432 | 2432 | ); |
@@ -2457,12 +2457,12 @@ discard block |
||
2457 | 2457 | ['objectclass', '=', 'posixaccount'], |
2458 | 2458 | ], null, null, 'or')->get(); |
2459 | 2459 | |
2460 | - foreach($users as $i => $adUser) { |
|
2460 | + foreach ($users as $i => $adUser) { |
|
2461 | 2461 | if (isset($adUser[$SETTINGS['ldap_user_attribute']]) === false) continue; |
2462 | 2462 | |
2463 | 2463 | // Build the list of all groups in AD |
2464 | 2464 | if (isset($adUser['memberof']) === true) { |
2465 | - foreach($adUser['memberof'] as $j => $adUserGroup) { |
|
2465 | + foreach ($adUser['memberof'] as $j => $adUserGroup) { |
|
2466 | 2466 | if (empty($adUserGroup) === false && $j !== "count") { |
2467 | 2467 | $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3); |
2468 | 2468 | if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) { |
@@ -2478,7 +2478,7 @@ discard block |
||
2478 | 2478 | // Get his ID |
2479 | 2479 | DB::queryfirstrow( |
2480 | 2480 | 'SELECT id, fonction_id, auth_type |
2481 | - FROM ' . prefixTable('users') . ' |
|
2481 | + FROM ' . prefixTable('users').' |
|
2482 | 2482 | WHERE login = %s', |
2483 | 2483 | $userLogin |
2484 | 2484 | ); |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | // Get all groups in Teampass |
2516 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
2516 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
2517 | 2517 | foreach ($rows as $record) { |
2518 | 2518 | array_push( |
2519 | 2519 | $teampassRoles, |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | |
2557 | 2557 | // decrypt and retrieve data in JSON format |
2558 | 2558 | $dataReceived = prepareExchangedData( |
2559 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2559 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2560 | 2560 | |
2561 | 2561 | // Prepare variables |
2562 | 2562 | $post_login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING); |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | // Check if user already exists |
2584 | 2584 | $data = DB::query( |
2585 | 2585 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
2586 | - FROM ' . prefixTable('users') . ' |
|
2586 | + FROM ' . prefixTable('users').' |
|
2587 | 2587 | WHERE login = %s', |
2588 | 2588 | $post_login |
2589 | 2589 | ); |
@@ -2690,7 +2690,7 @@ discard block |
||
2690 | 2690 | ); |
2691 | 2691 | |
2692 | 2692 | // Rebuild tree |
2693 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
2693 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
2694 | 2694 | $tree->register(); |
2695 | 2695 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
2696 | 2696 | $tree->rebuild(); |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | // Check if user already exists |
2768 | 2768 | DB::query( |
2769 | 2769 | 'SELECT id |
2770 | - FROM ' . prefixTable('users') . ' |
|
2770 | + FROM ' . prefixTable('users').' |
|
2771 | 2771 | WHERE id = %i', |
2772 | 2772 | $post_id |
2773 | 2773 | ); |
@@ -2824,7 +2824,7 @@ discard block |
||
2824 | 2824 | |
2825 | 2825 | // decrypt and retrieve data in JSON format |
2826 | 2826 | $dataReceived = prepareExchangedData( |
2827 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2827 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2828 | 2828 | |
2829 | 2829 | // Prepare variables |
2830 | 2830 | $post_userid = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
@@ -2848,7 +2848,7 @@ discard block |
||
2848 | 2848 | // Check if user already exists |
2849 | 2849 | $userInfo = DB::queryfirstrow( |
2850 | 2850 | 'SELECT id, private_key, public_key |
2851 | - FROM ' . prefixTable('users') . ' |
|
2851 | + FROM ' . prefixTable('users').' |
|
2852 | 2852 | WHERE id = %i', |
2853 | 2853 | $post_userid |
2854 | 2854 | ); |
@@ -2897,7 +2897,7 @@ discard block |
||
2897 | 2897 | if (count($_SESSION['personal_folders']) > 0) { |
2898 | 2898 | DB::query( |
2899 | 2899 | 'SELECT id |
2900 | - FROM ' . prefixTable('items') . ' |
|
2900 | + FROM ' . prefixTable('items').' |
|
2901 | 2901 | WHERE id_tree IN %ls', |
2902 | 2902 | $_SESSION['personal_folders'] |
2903 | 2903 | ); |
@@ -2957,7 +2957,7 @@ discard block |
||
2957 | 2957 | |
2958 | 2958 | // decrypt and retrieve data in JSON format |
2959 | 2959 | $dataReceived = prepareExchangedData( |
2960 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2960 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2961 | 2961 | |
2962 | 2962 | // Prepare variables |
2963 | 2963 | $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
@@ -2979,7 +2979,7 @@ discard block |
||
2979 | 2979 | // Check if user already exists |
2980 | 2980 | DB::query( |
2981 | 2981 | 'SELECT id |
2982 | - FROM ' . prefixTable('users') . ' |
|
2982 | + FROM ' . prefixTable('users').' |
|
2983 | 2983 | WHERE id = %i', |
2984 | 2984 | $post_id |
2985 | 2985 | ); |
@@ -3046,7 +3046,7 @@ discard block |
||
3046 | 3046 | |
3047 | 3047 | // decrypt and retrieve data in JSON format |
3048 | 3048 | $dataReceived = prepareExchangedData( |
3049 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
3049 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
3050 | 3050 | |
3051 | 3051 | // Prepare variables |
3052 | 3052 | $post_user_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT); |
@@ -3077,7 +3077,7 @@ discard block |
||
3077 | 3077 | |
3078 | 3078 | // Get info about user |
3079 | 3079 | $data_user = DB::queryfirstrow( |
3080 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
3080 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
3081 | 3081 | WHERE id = %i', |
3082 | 3082 | $value[1] |
3083 | 3083 | ); |
@@ -3110,7 +3110,7 @@ discard block |
||
3110 | 3110 | logEvents( |
3111 | 3111 | $SETTINGS, |
3112 | 3112 | 'user_mngt', |
3113 | - 'at_user_new_' . $value[0] . ':' . $value[1], |
|
3113 | + 'at_user_new_'.$value[0].':'.$value[1], |
|
3114 | 3114 | (string) $_SESSION['user_id'], |
3115 | 3115 | $_SESSION['login'], |
3116 | 3116 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING) |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | |
3143 | 3143 | // Get info about user |
3144 | 3144 | $data_user = DB::queryfirstrow( |
3145 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
3145 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
3146 | 3146 | WHERE id = %i', |
3147 | 3147 | $value[1] |
3148 | 3148 | ); |
@@ -122,29 +122,29 @@ 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/'; |
|
132 | - } |
|
133 | - |
|
134 | - include_once $path . 'Exception/CryptoException.php'; |
|
135 | - include_once $path . 'Exception/BadFormatException.php'; |
|
136 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
137 | - include_once $path . 'Exception/IOException.php'; |
|
138 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
139 | - include_once $path . 'Crypto.php'; |
|
140 | - include_once $path . 'Encoding.php'; |
|
141 | - include_once $path . 'DerivedKeys.php'; |
|
142 | - include_once $path . 'Key.php'; |
|
143 | - include_once $path . 'KeyOrPassword.php'; |
|
144 | - include_once $path . 'File.php'; |
|
145 | - include_once $path . 'RuntimeTests.php'; |
|
146 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
147 | - include_once $path . 'Core.php'; |
|
131 | + $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'; |
|
132 | + } |
|
133 | + |
|
134 | + include_once $path.'Exception/CryptoException.php'; |
|
135 | + include_once $path.'Exception/BadFormatException.php'; |
|
136 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
137 | + include_once $path.'Exception/IOException.php'; |
|
138 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
139 | + include_once $path.'Crypto.php'; |
|
140 | + include_once $path.'Encoding.php'; |
|
141 | + include_once $path.'DerivedKeys.php'; |
|
142 | + include_once $path.'Key.php'; |
|
143 | + include_once $path.'KeyOrPassword.php'; |
|
144 | + include_once $path.'File.php'; |
|
145 | + include_once $path.'RuntimeTests.php'; |
|
146 | + include_once $path.'KeyProtectedByPassword.php'; |
|
147 | + include_once $path.'Core.php'; |
|
148 | 148 | |
149 | 149 | // convert KEY |
150 | 150 | $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
@@ -189,20 +189,20 @@ discard block |
||
189 | 189 | $path = '../includes/libraries/Encryption/Encryption/'; |
190 | 190 | } |
191 | 191 | |
192 | - include_once $path . 'Exception/CryptoException.php'; |
|
193 | - include_once $path . 'Exception/BadFormatException.php'; |
|
194 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
195 | - include_once $path . 'Exception/IOException.php'; |
|
196 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
197 | - include_once $path . 'Crypto.php'; |
|
198 | - include_once $path . 'Encoding.php'; |
|
199 | - include_once $path . 'DerivedKeys.php'; |
|
200 | - include_once $path . 'Key.php'; |
|
201 | - include_once $path . 'KeyOrPassword.php'; |
|
202 | - include_once $path . 'File.php'; |
|
203 | - include_once $path . 'RuntimeTests.php'; |
|
204 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
205 | - include_once $path . 'Core.php'; |
|
192 | + include_once $path.'Exception/CryptoException.php'; |
|
193 | + include_once $path.'Exception/BadFormatException.php'; |
|
194 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
195 | + include_once $path.'Exception/IOException.php'; |
|
196 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
197 | + include_once $path.'Crypto.php'; |
|
198 | + include_once $path.'Encoding.php'; |
|
199 | + include_once $path.'DerivedKeys.php'; |
|
200 | + include_once $path.'Key.php'; |
|
201 | + include_once $path.'KeyOrPassword.php'; |
|
202 | + include_once $path.'File.php'; |
|
203 | + include_once $path.'RuntimeTests.php'; |
|
204 | + include_once $path.'KeyProtectedByPassword.php'; |
|
205 | + include_once $path.'Core.php'; |
|
206 | 206 | |
207 | 207 | $key = \Defuse\Crypto\Key::createNewRandomKey(); |
208 | 208 | $key = $key->saveToAsciiSafeString(); |
@@ -227,20 +227,20 @@ discard block |
||
227 | 227 | $path = '../includes/libraries/Encryption/Encryption/'; |
228 | 228 | } |
229 | 229 | |
230 | - include_once $path . 'Exception/CryptoException.php'; |
|
231 | - include_once $path . 'Exception/BadFormatException.php'; |
|
232 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
233 | - include_once $path . 'Exception/IOException.php'; |
|
234 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
235 | - include_once $path . 'Crypto.php'; |
|
236 | - include_once $path . 'Encoding.php'; |
|
237 | - include_once $path . 'DerivedKeys.php'; |
|
238 | - include_once $path . 'Key.php'; |
|
239 | - include_once $path . 'KeyOrPassword.php'; |
|
240 | - include_once $path . 'File.php'; |
|
241 | - include_once $path . 'RuntimeTests.php'; |
|
242 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
243 | - include_once $path . 'Core.php'; |
|
230 | + include_once $path.'Exception/CryptoException.php'; |
|
231 | + include_once $path.'Exception/BadFormatException.php'; |
|
232 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
233 | + include_once $path.'Exception/IOException.php'; |
|
234 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
235 | + include_once $path.'Crypto.php'; |
|
236 | + include_once $path.'Encoding.php'; |
|
237 | + include_once $path.'DerivedKeys.php'; |
|
238 | + include_once $path.'Key.php'; |
|
239 | + include_once $path.'KeyOrPassword.php'; |
|
240 | + include_once $path.'File.php'; |
|
241 | + include_once $path.'RuntimeTests.php'; |
|
242 | + include_once $path.'KeyProtectedByPassword.php'; |
|
243 | + include_once $path.'Core.php'; |
|
244 | 244 | |
245 | 245 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk); |
246 | 246 | return $protected_key->saveToAsciiSafeString(); // save this in user table |
@@ -265,20 +265,20 @@ discard block |
||
265 | 265 | $path = '../includes/libraries/Encryption/Encryption/'; |
266 | 266 | } |
267 | 267 | |
268 | - include_once $path . 'Exception/CryptoException.php'; |
|
269 | - include_once $path . 'Exception/BadFormatException.php'; |
|
270 | - include_once $path . 'Exception/EnvironmentIsBrokenException.php'; |
|
271 | - include_once $path . 'Exception/IOException.php'; |
|
272 | - include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
273 | - include_once $path . 'Crypto.php'; |
|
274 | - include_once $path . 'Encoding.php'; |
|
275 | - include_once $path . 'DerivedKeys.php'; |
|
276 | - include_once $path . 'Key.php'; |
|
277 | - include_once $path . 'KeyOrPassword.php'; |
|
278 | - include_once $path . 'File.php'; |
|
279 | - include_once $path . 'RuntimeTests.php'; |
|
280 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
281 | - include_once $path . 'Core.php'; |
|
268 | + include_once $path.'Exception/CryptoException.php'; |
|
269 | + include_once $path.'Exception/BadFormatException.php'; |
|
270 | + include_once $path.'Exception/EnvironmentIsBrokenException.php'; |
|
271 | + include_once $path.'Exception/IOException.php'; |
|
272 | + include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php'; |
|
273 | + include_once $path.'Crypto.php'; |
|
274 | + include_once $path.'Encoding.php'; |
|
275 | + include_once $path.'DerivedKeys.php'; |
|
276 | + include_once $path.'Key.php'; |
|
277 | + include_once $path.'KeyOrPassword.php'; |
|
278 | + include_once $path.'File.php'; |
|
279 | + include_once $path.'RuntimeTests.php'; |
|
280 | + include_once $path.'KeyProtectedByPassword.php'; |
|
281 | + include_once $path.'Core.php'; |
|
282 | 282 | |
283 | 283 | try { |
284 | 284 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function trimElement($chaine, string $element): string |
322 | 322 | { |
323 | - if (! empty($chaine)) { |
|
323 | + if (!empty($chaine)) { |
|
324 | 324 | if (is_array($chaine) === true) { |
325 | 325 | $chaine = implode(';', $chaine); |
326 | 326 | } |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | */ |
369 | 369 | function db_error_handler(array $params): void |
370 | 370 | { |
371 | - echo 'Error: ' . $params['error'] . "<br>\n"; |
|
372 | - echo 'Query: ' . $params['query'] . "<br>\n"; |
|
371 | + echo 'Error: '.$params['error']."<br>\n"; |
|
372 | + echo 'Query: '.$params['query']."<br>\n"; |
|
373 | 373 | throw new Exception('Error - Query', 1); |
374 | 374 | } |
375 | 375 | |
@@ -391,12 +391,12 @@ discard block |
||
391 | 391 | $SETTINGS |
392 | 392 | ) { |
393 | 393 | //load ClassLoader |
394 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
394 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
395 | 395 | // Load superglobal |
396 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
396 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
397 | 397 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
398 | 398 | //Connect to DB |
399 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
399 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
400 | 400 | if (defined('DB_PASSWD_CLEAR') === false) { |
401 | 401 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
402 | 402 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | DB::$port = DB_PORT; |
408 | 408 | DB::$encoding = DB_ENCODING; |
409 | 409 | //Build tree |
410 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
410 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
411 | 411 | $tree->register(); |
412 | 412 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
413 | 413 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | function identAdmin($idFonctions, $SETTINGS, $tree) |
453 | 453 | { |
454 | 454 | // Load superglobal |
455 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
455 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
456 | 456 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
457 | 457 | // Init |
458 | 458 | $groupesVisibles = []; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION'); |
472 | 472 | $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION'); |
473 | 473 | // Get list of Folders |
474 | - $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
474 | + $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
475 | 475 | foreach ($rows as $record) { |
476 | 476 | array_push($groupesVisibles, $record['id']); |
477 | 477 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | } |
491 | 491 | // Get ID of personal folder |
492 | 492 | $persfld = DB::queryfirstrow( |
493 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', |
|
493 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s', |
|
494 | 494 | $globalsUserId |
495 | 495 | ); |
496 | 496 | if (empty($persfld['id']) === false) { |
@@ -511,20 +511,20 @@ discard block |
||
511 | 511 | // get complete list of ROLES |
512 | 512 | $tmp = explode(';', $idFonctions); |
513 | 513 | $rows = DB::query( |
514 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
514 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
515 | 515 | ORDER BY title ASC' |
516 | 516 | ); |
517 | 517 | foreach ($rows as $record) { |
518 | - if (! empty($record['id']) && ! in_array($record['id'], $tmp)) { |
|
518 | + if (!empty($record['id']) && !in_array($record['id'], $tmp)) { |
|
519 | 519 | array_push($tmp, $record['id']); |
520 | 520 | } |
521 | 521 | } |
522 | 522 | $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION'); |
523 | 523 | $superGlobal->put('is_admin', 1, 'SESSION'); |
524 | 524 | // Check if admin has created Folders and Roles |
525 | - DB::query('SELECT * FROM ' . prefixTable('nested_tree') . ''); |
|
525 | + DB::query('SELECT * FROM '.prefixTable('nested_tree').''); |
|
526 | 526 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
527 | - DB::query('SELECT * FROM ' . prefixTable('roles_title')); |
|
527 | + DB::query('SELECT * FROM '.prefixTable('roles_title')); |
|
528 | 528 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
529 | 529 | |
530 | 530 | return true; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | object $tree |
571 | 571 | ) { |
572 | 572 | // Load superglobal |
573 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
573 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
574 | 574 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
575 | 575 | // Init |
576 | 576 | $superGlobal->put('groupes_visibles', [], 'SESSION'); |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | // Does this user is allowed to see other items |
610 | 610 | $inc = 0; |
611 | 611 | $rows = DB::query( |
612 | - 'SELECT id, id_tree FROM ' . prefixTable('items') . ' |
|
612 | + 'SELECT id, id_tree FROM '.prefixTable('items').' |
|
613 | 613 | WHERE restricted_to LIKE %ss AND inactif = %s'. |
614 | 614 | (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''), |
615 | - $globalsUserId . ';', |
|
615 | + $globalsUserId.';', |
|
616 | 616 | '0' |
617 | 617 | ); |
618 | 618 | foreach ($rows as $record) { |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | // Check for the users roles if some specific rights exist on items |
627 | 627 | $rows = DB::query( |
628 | 628 | 'SELECT i.id_tree, r.item_id |
629 | - FROM ' . prefixTable('items') . ' as i |
|
630 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id) |
|
629 | + FROM ' . prefixTable('items').' as i |
|
630 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id) |
|
631 | 631 | WHERE r.role_id IN %li AND i.id_tree <> "" |
632 | 632 | ORDER BY i.id_tree ASC', |
633 | 633 | $userRoles |
@@ -681,16 +681,16 @@ discard block |
||
681 | 681 | 'SESSION' |
682 | 682 | ); |
683 | 683 | // Folders and Roles numbers |
684 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
684 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
685 | 685 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
686 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
686 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
687 | 687 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
688 | 688 | // check if change proposals on User's items |
689 | 689 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
690 | 690 | $countNewItems = DB::query( |
691 | 691 | 'SELECT COUNT(*) |
692 | - FROM ' . prefixTable('items_change') . ' AS c |
|
693 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
692 | + FROM ' . prefixTable('items_change').' AS c |
|
693 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
694 | 694 | WHERE i.action = %s AND i.id_user = %i', |
695 | 695 | 'at_creation', |
696 | 696 | $globalsUserId |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | |
719 | 719 | $rows = DB::query( |
720 | 720 | 'SELECT * |
721 | - FROM ' . prefixTable('roles_values') . ' |
|
721 | + FROM ' . prefixTable('roles_values').' |
|
722 | 722 | WHERE role_id IN %li AND type IN %ls', |
723 | 723 | $userRoles, |
724 | 724 | ['W', 'ND', 'NE', 'NDNE', 'R'] |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | ) { |
786 | 786 | $persoFld = DB::queryfirstrow( |
787 | 787 | 'SELECT id |
788 | - FROM ' . prefixTable('nested_tree') . ' |
|
788 | + FROM ' . prefixTable('nested_tree').' |
|
789 | 789 | WHERE title = %s AND personal_folder = %i'. |
790 | 790 | (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''), |
791 | 791 | $globalsUserId, |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | } |
820 | 820 | $persoFlds = DB::query( |
821 | 821 | 'SELECT id |
822 | - FROM ' . prefixTable('nested_tree') . ' |
|
822 | + FROM ' . prefixTable('nested_tree').' |
|
823 | 823 | WHERE %l', |
824 | 824 | $where |
825 | 825 | ); |
@@ -883,9 +883,9 @@ discard block |
||
883 | 883 | */ |
884 | 884 | function cacheTableRefresh(array $SETTINGS): void |
885 | 885 | { |
886 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
886 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
887 | 887 | //Connect to DB |
888 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
888 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
889 | 889 | if (defined('DB_PASSWD_CLEAR') === false) { |
890 | 890 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
891 | 891 | } |
@@ -900,12 +900,12 @@ discard block |
||
900 | 900 | $tree->register(); |
901 | 901 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
902 | 902 | // truncate table |
903 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
903 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
904 | 904 | // reload date |
905 | 905 | $rows = DB::query( |
906 | 906 | 'SELECT * |
907 | - FROM ' . prefixTable('items') . ' as i |
|
908 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
907 | + FROM ' . prefixTable('items').' as i |
|
908 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
909 | 909 | AND l.action = %s |
910 | 910 | AND i.inactif = %i', |
911 | 911 | 'at_creation', |
@@ -917,18 +917,18 @@ discard block |
||
917 | 917 | $tags = ''; |
918 | 918 | $itemTags = DB::query( |
919 | 919 | 'SELECT tag |
920 | - FROM ' . prefixTable('tags') . ' |
|
920 | + FROM ' . prefixTable('tags').' |
|
921 | 921 | WHERE item_id = %i AND tag != ""', |
922 | 922 | $record['id'] |
923 | 923 | ); |
924 | 924 | foreach ($itemTags as $itemTag) { |
925 | - $tags .= $itemTag['tag'] . ' '; |
|
925 | + $tags .= $itemTag['tag'].' '; |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | // Get renewal period |
929 | 929 | $resNT = DB::queryfirstrow( |
930 | 930 | 'SELECT renewal_period |
931 | - FROM ' . prefixTable('nested_tree') . ' |
|
931 | + FROM ' . prefixTable('nested_tree').' |
|
932 | 932 | WHERE id = %i', |
933 | 933 | $record['id_tree'] |
934 | 934 | ); |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | // Is this a User id? |
942 | 942 | $user = DB::queryfirstrow( |
943 | 943 | 'SELECT id, login |
944 | - FROM ' . prefixTable('users') . ' |
|
944 | + FROM ' . prefixTable('users').' |
|
945 | 945 | WHERE id = %i', |
946 | 946 | $elem->title |
947 | 947 | ); |
@@ -959,11 +959,11 @@ discard block |
||
959 | 959 | 'id' => $record['id'], |
960 | 960 | 'label' => $record['label'], |
961 | 961 | 'description' => $record['description'] ?? '', |
962 | - 'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0', |
|
962 | + 'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0', |
|
963 | 963 | 'tags' => $tags, |
964 | 964 | 'id_tree' => $record['id_tree'], |
965 | 965 | 'perso' => $record['perso'], |
966 | - 'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
966 | + 'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
967 | 967 | 'login' => $record['login'] ?? '', |
968 | 968 | 'folder' => implode(' > ', $folder), |
969 | 969 | 'author' => $record['id_user'], |
@@ -985,12 +985,12 @@ discard block |
||
985 | 985 | */ |
986 | 986 | function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void |
987 | 987 | { |
988 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
988 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
989 | 989 | // Load superglobal |
990 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
990 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
991 | 991 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
992 | 992 | //Connect to DB |
993 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
993 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
994 | 994 | if (defined('DB_PASSWD_CLEAR') === false) { |
995 | 995 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
996 | 996 | } |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | // get new value from db |
1008 | 1008 | $data = DB::queryfirstrow( |
1009 | 1009 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
1010 | - FROM ' . prefixTable('items') . ' |
|
1010 | + FROM ' . prefixTable('items').' |
|
1011 | 1011 | WHERE id=%i', |
1012 | 1012 | $ident |
1013 | 1013 | ); |
@@ -1015,12 +1015,12 @@ discard block |
||
1015 | 1015 | $tags = ''; |
1016 | 1016 | $itemTags = DB::query( |
1017 | 1017 | 'SELECT tag |
1018 | - FROM ' . prefixTable('tags') . ' |
|
1018 | + FROM ' . prefixTable('tags').' |
|
1019 | 1019 | WHERE item_id = %i AND tag != ""', |
1020 | 1020 | $ident |
1021 | 1021 | ); |
1022 | 1022 | foreach ($itemTags as $itemTag) { |
1023 | - $tags .= $itemTag['tag'] . ' '; |
|
1023 | + $tags .= $itemTag['tag'].' '; |
|
1024 | 1024 | } |
1025 | 1025 | // form id_tree to full foldername |
1026 | 1026 | $folder = []; |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | // Is this a User id? |
1032 | 1032 | $user = DB::queryfirstrow( |
1033 | 1033 | 'SELECT id, login |
1034 | - FROM ' . prefixTable('users') . ' |
|
1034 | + FROM ' . prefixTable('users').' |
|
1035 | 1035 | WHERE id = %i', |
1036 | 1036 | $elem->title |
1037 | 1037 | ); |
@@ -1049,10 +1049,10 @@ discard block |
||
1049 | 1049 | 'label' => $data['label'], |
1050 | 1050 | 'description' => $data['description'], |
1051 | 1051 | 'tags' => $tags, |
1052 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
1052 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
1053 | 1053 | 'id_tree' => $data['id_tree'], |
1054 | 1054 | 'perso' => $data['perso'], |
1055 | - 'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
1055 | + 'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
1056 | 1056 | 'login' => $data['login'] ?? '', |
1057 | 1057 | 'folder' => implode(' » ', $folder), |
1058 | 1058 | 'author' => $superGlobal->get('user_id', 'SESSION'), |
@@ -1072,14 +1072,14 @@ discard block |
||
1072 | 1072 | */ |
1073 | 1073 | function cacheTableAdd(array $SETTINGS, ?int $ident = null): void |
1074 | 1074 | { |
1075 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1075 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1076 | 1076 | // Load superglobal |
1077 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1077 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1078 | 1078 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1079 | 1079 | // Get superglobals |
1080 | 1080 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
1081 | 1081 | //Connect to DB |
1082 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1082 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1083 | 1083 | if (defined('DB_PASSWD_CLEAR') === false) { |
1084 | 1084 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
1085 | 1085 | } |
@@ -1096,8 +1096,8 @@ discard block |
||
1096 | 1096 | // get new value from db |
1097 | 1097 | $data = DB::queryFirstRow( |
1098 | 1098 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
1099 | - FROM ' . prefixTable('items') . ' as i |
|
1100 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
1099 | + FROM ' . prefixTable('items').' as i |
|
1100 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
1101 | 1101 | WHERE i.id = %i |
1102 | 1102 | AND l.action = %s', |
1103 | 1103 | $ident, |
@@ -1107,12 +1107,12 @@ discard block |
||
1107 | 1107 | $tags = ''; |
1108 | 1108 | $itemTags = DB::query( |
1109 | 1109 | 'SELECT tag |
1110 | - FROM ' . prefixTable('tags') . ' |
|
1110 | + FROM ' . prefixTable('tags').' |
|
1111 | 1111 | WHERE item_id = %i AND tag != ""', |
1112 | 1112 | $ident |
1113 | 1113 | ); |
1114 | 1114 | foreach ($itemTags as $itemTag) { |
1115 | - $tags .= $itemTag['tag'] . ' '; |
|
1115 | + $tags .= $itemTag['tag'].' '; |
|
1116 | 1116 | } |
1117 | 1117 | // form id_tree to full foldername |
1118 | 1118 | $folder = []; |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | // Is this a User id? |
1124 | 1124 | $user = DB::queryfirstrow( |
1125 | 1125 | 'SELECT id, login |
1126 | - FROM ' . prefixTable('users') . ' |
|
1126 | + FROM ' . prefixTable('users').' |
|
1127 | 1127 | WHERE id = %i', |
1128 | 1128 | $elem->title |
1129 | 1129 | ); |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | 'label' => $data['label'], |
1143 | 1143 | 'description' => $data['description'], |
1144 | 1144 | 'tags' => isset($tags) && empty($tags) === false ? $tags : 'None', |
1145 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
1145 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
1146 | 1146 | 'id_tree' => $data['id_tree'], |
1147 | 1147 | 'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0', |
1148 | 1148 | 'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0', |
@@ -1164,52 +1164,52 @@ discard block |
||
1164 | 1164 | function getStatisticsData(array $SETTINGS): array |
1165 | 1165 | { |
1166 | 1166 | DB::query( |
1167 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
1167 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
1168 | 1168 | 0 |
1169 | 1169 | ); |
1170 | 1170 | $counter_folders = DB::count(); |
1171 | 1171 | DB::query( |
1172 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
1172 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
1173 | 1173 | 1 |
1174 | 1174 | ); |
1175 | 1175 | $counter_folders_perso = DB::count(); |
1176 | 1176 | DB::query( |
1177 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
1177 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
1178 | 1178 | 0 |
1179 | 1179 | ); |
1180 | 1180 | $counter_items = DB::count(); |
1181 | 1181 | DB::query( |
1182 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
1182 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
1183 | 1183 | 1 |
1184 | 1184 | ); |
1185 | 1185 | $counter_items_perso = DB::count(); |
1186 | 1186 | DB::query( |
1187 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
1187 | + 'SELECT id FROM '.prefixTable('users').'' |
|
1188 | 1188 | ); |
1189 | 1189 | $counter_users = DB::count(); |
1190 | 1190 | DB::query( |
1191 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
1191 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
1192 | 1192 | 1 |
1193 | 1193 | ); |
1194 | 1194 | $admins = DB::count(); |
1195 | 1195 | DB::query( |
1196 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
1196 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
1197 | 1197 | 1 |
1198 | 1198 | ); |
1199 | 1199 | $managers = DB::count(); |
1200 | 1200 | DB::query( |
1201 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
1201 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
1202 | 1202 | 1 |
1203 | 1203 | ); |
1204 | 1204 | $readOnly = DB::count(); |
1205 | 1205 | // list the languages |
1206 | 1206 | $usedLang = []; |
1207 | 1207 | $tp_languages = DB::query( |
1208 | - 'SELECT name FROM ' . prefixTable('languages') |
|
1208 | + 'SELECT name FROM '.prefixTable('languages') |
|
1209 | 1209 | ); |
1210 | 1210 | foreach ($tp_languages as $tp_language) { |
1211 | 1211 | DB::query( |
1212 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
1212 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
1213 | 1213 | $tp_language['name'] |
1214 | 1214 | ); |
1215 | 1215 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1218,12 +1218,12 @@ discard block |
||
1218 | 1218 | // get list of ips |
1219 | 1219 | $usedIp = []; |
1220 | 1220 | $tp_ips = DB::query( |
1221 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
1221 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
1222 | 1222 | ); |
1223 | 1223 | foreach ($tp_ips as $ip) { |
1224 | 1224 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
1225 | 1225 | $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']]; |
1226 | - } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
1226 | + } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
1227 | 1227 | $usedIp[$ip['user_ip']] = 1; |
1228 | 1228 | } |
1229 | 1229 | } |
@@ -1289,14 +1289,14 @@ discard block |
||
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | // Load settings |
1292 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
1292 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
1293 | 1293 | // Load superglobal |
1294 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1294 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1295 | 1295 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1296 | 1296 | // Get user language |
1297 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php'; |
|
1297 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php'; |
|
1298 | 1298 | // Load library |
1299 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1299 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1300 | 1300 | // load PHPMailer |
1301 | 1301 | $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries'); |
1302 | 1302 | $mail->register(); |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | |
1305 | 1305 | try { |
1306 | 1306 | // send to user |
1307 | - $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
1307 | + $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
1308 | 1308 | $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0; |
1309 | 1309 | $mail->Port = $SETTINGS['email_port']; |
1310 | 1310 | //COULD BE USED |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | <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;"> |
1405 | 1405 | <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;"> |
1406 | 1406 | <br><div style="float:right;">' . |
1407 | - $textMail . |
|
1407 | + $textMail. |
|
1408 | 1408 | '<br><br></td></tr></table> |
1409 | 1409 | </td></tr></table> |
1410 | 1410 | <br></body></html>'; |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | */ |
1418 | 1418 | function generateKey(): string |
1419 | 1419 | { |
1420 | - return substr(md5(rand() . rand()), 0, 15); |
|
1420 | + return substr(md5(rand().rand()), 0, 15); |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | /** |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | { |
1489 | 1489 | array_walk_recursive( |
1490 | 1490 | $array, |
1491 | - static function (&$item): void { |
|
1491 | + static function(&$item): void { |
|
1492 | 1492 | if (mb_detect_encoding((string) $item, 'utf-8', true) === false) { |
1493 | 1493 | $item = utf8_encode($item); |
1494 | 1494 | } |
@@ -1510,7 +1510,7 @@ discard block |
||
1510 | 1510 | function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null) |
1511 | 1511 | { |
1512 | 1512 | // Load superglobal |
1513 | - include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1513 | + include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1514 | 1514 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1515 | 1515 | // Get superglobals |
1516 | 1516 | if ($key !== null) { |
@@ -1521,9 +1521,9 @@ discard block |
||
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | //load ClassLoader |
1524 | - include_once $teampassDir . '/sources/SplClassLoader.php'; |
|
1524 | + include_once $teampassDir.'/sources/SplClassLoader.php'; |
|
1525 | 1525 | //Load AES |
1526 | - $aes = new SplClassLoader('Encryption\Crypt', $teampassDir . '/includes/libraries'); |
|
1526 | + $aes = new SplClassLoader('Encryption\Crypt', $teampassDir.'/includes/libraries'); |
|
1527 | 1527 | $aes->register(); |
1528 | 1528 | if ($type === 'encode' && is_array($data) === true) { |
1529 | 1529 | // Ensure UTF8 format |
@@ -1597,8 +1597,8 @@ discard block |
||
1597 | 1597 | */ |
1598 | 1598 | function prefixTable(string $table): string |
1599 | 1599 | { |
1600 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
1601 | - if (! empty($safeTable)) { |
|
1600 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
1601 | + if (!empty($safeTable)) { |
|
1602 | 1602 | // sanitize string |
1603 | 1603 | return $safeTable; |
1604 | 1604 | } |
@@ -1628,13 +1628,13 @@ discard block |
||
1628 | 1628 | bool $lowercase = false, |
1629 | 1629 | array $SETTINGS = [] |
1630 | 1630 | ): string { |
1631 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1632 | - $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1631 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1632 | + $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1633 | 1633 | $generator->register(); |
1634 | 1634 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
1635 | 1635 | // Is PHP7 being used? |
1636 | 1636 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
1637 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1637 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1638 | 1638 | $php7generator->register(); |
1639 | 1639 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
1640 | 1640 | } |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | function send_syslog($message, $host, $port, $component = 'teampass'): void |
1670 | 1670 | { |
1671 | 1671 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
1672 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
1672 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
1673 | 1673 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
1674 | 1674 | socket_close($sock); |
1675 | 1675 | } |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | // include librairies & connect to DB |
1696 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1696 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1697 | 1697 | if (defined('DB_PASSWD_CLEAR') === false) { |
1698 | 1698 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
1699 | 1699 | } |
@@ -1717,14 +1717,14 @@ discard block |
||
1717 | 1717 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
1718 | 1718 | if ($type === 'user_mngt') { |
1719 | 1719 | send_syslog( |
1720 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
1720 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
1721 | 1721 | $SETTINGS['syslog_host'], |
1722 | 1722 | $SETTINGS['syslog_port'], |
1723 | 1723 | 'teampass' |
1724 | 1724 | ); |
1725 | 1725 | } else { |
1726 | 1726 | send_syslog( |
1727 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
1727 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
1728 | 1728 | $SETTINGS['syslog_host'], |
1729 | 1729 | $SETTINGS['syslog_port'], |
1730 | 1730 | 'teampass' |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | ?string $encryption_type = null |
1759 | 1759 | ): void { |
1760 | 1760 | // include librairies & connect to DB |
1761 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1761 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1762 | 1762 | if (defined('DB_PASSWD_CLEAR') === false) { |
1763 | 1763 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
1764 | 1764 | } |
@@ -1802,7 +1802,7 @@ discard block |
||
1802 | 1802 | if (empty($item_label) === true) { |
1803 | 1803 | $dataItem = DB::queryfirstrow( |
1804 | 1804 | 'SELECT id, id_tree, label |
1805 | - FROM ' . prefixTable('items') . ' |
|
1805 | + FROM ' . prefixTable('items').' |
|
1806 | 1806 | WHERE id = %i', |
1807 | 1807 | $item_id |
1808 | 1808 | ); |
@@ -1810,11 +1810,11 @@ discard block |
||
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | send_syslog( |
1813 | - 'action=' . str_replace('at_', '', $action) . |
|
1814 | - ' attribute=' . str_replace('at_', '', $attribute[0]) . |
|
1815 | - ' itemno=' . $item_id . |
|
1816 | - ' user=' . is_null($login) === true ? '' : addslashes((string) $login) . |
|
1817 | - ' itemname="' . addslashes($item_label) . '"', |
|
1813 | + 'action='.str_replace('at_', '', $action). |
|
1814 | + ' attribute='.str_replace('at_', '', $attribute[0]). |
|
1815 | + ' itemno='.$item_id. |
|
1816 | + ' user='.is_null($login) === true ? '' : addslashes((string) $login). |
|
1817 | + ' itemname="'.addslashes($item_label).'"', |
|
1818 | 1818 | $SETTINGS['syslog_host'], |
1819 | 1819 | $SETTINGS['syslog_port'], |
1820 | 1820 | 'teampass' |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | && $action === 'at_shown' |
1843 | 1843 | ) { |
1844 | 1844 | // Load superglobal |
1845 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1845 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1846 | 1846 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1847 | 1847 | // Get superglobals |
1848 | 1848 | $globalsLastname = $superGlobal->get('lastname', 'SESSION'); |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | // Get info about item |
1852 | 1852 | $dataItem = DB::queryfirstrow( |
1853 | 1853 | 'SELECT id, id_tree, label |
1854 | - FROM ' . prefixTable('items') . ' |
|
1854 | + FROM ' . prefixTable('items').' |
|
1855 | 1855 | WHERE id = %i', |
1856 | 1856 | $item_id |
1857 | 1857 | ); |
@@ -1865,9 +1865,9 @@ discard block |
||
1865 | 1865 | 'body' => str_replace( |
1866 | 1866 | ['#tp_user#', '#tp_item#', '#tp_link#'], |
1867 | 1867 | [ |
1868 | - addslashes($globalsName . ' ' . $globalsLastname), |
|
1868 | + addslashes($globalsName.' '.$globalsLastname), |
|
1869 | 1869 | addslashes($item_label), |
1870 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id, |
|
1870 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id, |
|
1871 | 1871 | ], |
1872 | 1872 | langHdl('email_on_open_notification_mail') |
1873 | 1873 | ), |
@@ -1891,7 +1891,7 @@ discard block |
||
1891 | 1891 | function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void |
1892 | 1892 | { |
1893 | 1893 | // Load superglobal |
1894 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1894 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1895 | 1895 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1896 | 1896 | // Get superglobals |
1897 | 1897 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
@@ -1901,8 +1901,8 @@ discard block |
||
1901 | 1901 | $notification = DB::queryOneColumn( |
1902 | 1902 | 'email', |
1903 | 1903 | 'SELECT * |
1904 | - FROM ' . prefixTable('notification') . ' AS n |
|
1905 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
1904 | + FROM ' . prefixTable('notification').' AS n |
|
1905 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
1906 | 1906 | WHERE n.item_id = %i AND n.user_id != %i', |
1907 | 1907 | $item_id, |
1908 | 1908 | $globalsUserId |
@@ -1913,7 +1913,7 @@ discard block |
||
1913 | 1913 | // Get list of changes |
1914 | 1914 | $htmlChanges = '<ul>'; |
1915 | 1915 | foreach ($changes as $change) { |
1916 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
1916 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
1917 | 1917 | } |
1918 | 1918 | $htmlChanges .= '</ul>'; |
1919 | 1919 | // send email |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string |
1947 | 1947 | { |
1948 | 1948 | // Class loader |
1949 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1949 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1950 | 1950 | //Load Tree |
1951 | 1951 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
1952 | 1952 | $tree->register(); |
@@ -1955,15 +1955,15 @@ discard block |
||
1955 | 1955 | $path = ''; |
1956 | 1956 | foreach ($arbo as $elem) { |
1957 | 1957 | if (empty($path) === true) { |
1958 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
1958 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
1959 | 1959 | } else { |
1960 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
1960 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
1961 | 1961 | } |
1962 | 1962 | } |
1963 | 1963 | |
1964 | 1964 | // Build text to show user |
1965 | 1965 | if (empty($label) === false) { |
1966 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
1966 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
1967 | 1967 | } |
1968 | 1968 | return empty($path) === true ? '' : $path; |
1969 | 1969 | } |
@@ -2020,9 +2020,9 @@ discard block |
||
2020 | 2020 | */ |
2021 | 2021 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
2022 | 2022 | { |
2023 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
2023 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
2024 | 2024 | // include librairies & connect to DB |
2025 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2025 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2026 | 2026 | if (defined('DB_PASSWD_CLEAR') === false) { |
2027 | 2027 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
2028 | 2028 | } |
@@ -2035,8 +2035,8 @@ discard block |
||
2035 | 2035 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
2036 | 2036 | // perform a copy |
2037 | 2037 | if (file_exists($tp_config_file)) { |
2038 | - if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
2039 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
2038 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
2039 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
2040 | 2040 | } |
2041 | 2041 | } |
2042 | 2042 | |
@@ -2046,11 +2046,11 @@ discard block |
||
2046 | 2046 | $data[1] = "global \$SETTINGS;\n"; |
2047 | 2047 | $data[2] = "\$SETTINGS = array (\n"; |
2048 | 2048 | $rows = DB::query( |
2049 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
2049 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
2050 | 2050 | 'admin' |
2051 | 2051 | ); |
2052 | 2052 | foreach ($rows as $record) { |
2053 | - array_push($data, " '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n"); |
|
2053 | + array_push($data, " '".$record['intitule']."' => '".$record['valeur']."',\n"); |
|
2054 | 2054 | } |
2055 | 2055 | array_push($data, ");\n"); |
2056 | 2056 | $data = array_unique($data); |
@@ -2064,15 +2064,15 @@ discard block |
||
2064 | 2064 | break; |
2065 | 2065 | } |
2066 | 2066 | |
2067 | - if (stristr($line, "'" . $field . "' => '")) { |
|
2068 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n"; |
|
2067 | + if (stristr($line, "'".$field."' => '")) { |
|
2068 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n"; |
|
2069 | 2069 | $bFound = true; |
2070 | 2070 | break; |
2071 | 2071 | } |
2072 | 2072 | ++$inc; |
2073 | 2073 | } |
2074 | 2074 | if ($bFound === false) { |
2075 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n"; |
|
2075 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n"; |
|
2076 | 2076 | } |
2077 | 2077 | } |
2078 | 2078 | |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | { |
2103 | 2103 | global $SETTINGS; |
2104 | 2104 | /* LOAD CPASSMAN SETTINGS */ |
2105 | - if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
2105 | + if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
2106 | 2106 | $SETTINGS = []; |
2107 | 2107 | $SETTINGS['duplicate_folder'] = 0; |
2108 | 2108 | //by default, this is set to 0; |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | //by default, this value is set to 5; |
2113 | 2113 | $settings = []; |
2114 | 2114 | $rows = DB::query( |
2115 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
2115 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
2116 | 2116 | [ |
2117 | 2117 | 'type' => 'admin', |
2118 | 2118 | 'type2' => 'settings', |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | $source_cf = []; |
2145 | 2145 | $rows = DB::QUERY( |
2146 | 2146 | 'SELECT id_category |
2147 | - FROM ' . prefixTable('categories_folders') . ' |
|
2147 | + FROM ' . prefixTable('categories_folders').' |
|
2148 | 2148 | WHERE id_folder = %i', |
2149 | 2149 | $source_id |
2150 | 2150 | ); |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | $target_cf = []; |
2156 | 2156 | $rows = DB::QUERY( |
2157 | 2157 | 'SELECT id_category |
2158 | - FROM ' . prefixTable('categories_folders') . ' |
|
2158 | + FROM ' . prefixTable('categories_folders').' |
|
2159 | 2159 | WHERE id_folder = %i', |
2160 | 2160 | $target_id |
2161 | 2161 | ); |
@@ -2190,9 +2190,9 @@ discard block |
||
2190 | 2190 | string $password = null |
2191 | 2191 | ) { |
2192 | 2192 | // Load AntiXSS |
2193 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
2194 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
2195 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
2193 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
2194 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
2195 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
2196 | 2196 | $antiXss = new voku\helper\AntiXSS(); |
2197 | 2197 | // Protect against bad inputs |
2198 | 2198 | if (is_array($source_file) === true || is_array($target_file) === true) { |
@@ -2204,7 +2204,7 @@ discard block |
||
2204 | 2204 | $target_file = $antiXss->xss_clean($target_file); |
2205 | 2205 | if (empty($password) === true || is_null($password) === true) { |
2206 | 2206 | // get KEY to define password |
2207 | - $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
2207 | + $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
2208 | 2208 | $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
2209 | 2209 | } |
2210 | 2210 | |
@@ -2249,15 +2249,15 @@ discard block |
||
2249 | 2249 | ) { |
2250 | 2250 | // load PhpEncryption library |
2251 | 2251 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
2252 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
2253 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
2254 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
2255 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
2256 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
2257 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
2258 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
2259 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
2260 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
2252 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
2253 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
2254 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
2255 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
2256 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
2257 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
2258 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
2259 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
2260 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
2261 | 2261 | try { |
2262 | 2262 | \Defuse\Crypto\File::encryptFileWithPassword( |
2263 | 2263 | $source_file, |
@@ -2294,15 +2294,15 @@ discard block |
||
2294 | 2294 | ) { |
2295 | 2295 | // load PhpEncryption library |
2296 | 2296 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
2297 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
2298 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
2299 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
2300 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
2301 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
2302 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
2303 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
2304 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
2305 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
2297 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
2298 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
2299 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
2300 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
2301 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
2302 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
2303 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
2304 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
2305 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
2306 | 2306 | try { |
2307 | 2307 | \Defuse\Crypto\File::decryptFileWithPassword( |
2308 | 2308 | $source_file, |
@@ -2349,9 +2349,9 @@ discard block |
||
2349 | 2349 | function fileDelete(string $file, array $SETTINGS): void |
2350 | 2350 | { |
2351 | 2351 | // Load AntiXSS |
2352 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
2353 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
2354 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
2352 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
2353 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
2354 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
2355 | 2355 | $antiXss = new voku\helper\AntiXSS(); |
2356 | 2356 | $file = $antiXss->xss_clean($file); |
2357 | 2357 | if (is_file($file)) { |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | int $dirPerm = 0755 |
2402 | 2402 | ) { |
2403 | 2403 | // Check if the path exists |
2404 | - if (! file_exists($path)) { |
|
2404 | + if (!file_exists($path)) { |
|
2405 | 2405 | return false; |
2406 | 2406 | } |
2407 | 2407 | |
@@ -2439,7 +2439,7 @@ discard block |
||
2439 | 2439 | */ |
2440 | 2440 | function accessToItemIsGranted(int $item_id, array $SETTINGS) |
2441 | 2441 | { |
2442 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2442 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2443 | 2443 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
2444 | 2444 | // Prepare superGlobal variables |
2445 | 2445 | $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION'); |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | // Load item data |
2448 | 2448 | $data = DB::queryFirstRow( |
2449 | 2449 | 'SELECT id_tree |
2450 | - FROM ' . prefixTable('items') . ' |
|
2450 | + FROM ' . prefixTable('items').' |
|
2451 | 2451 | WHERE id = %i', |
2452 | 2452 | $item_id |
2453 | 2453 | ); |
@@ -2510,7 +2510,7 @@ discard block |
||
2510 | 2510 | } |
2511 | 2511 | $host .= substr(explode(".", $email[1])[0], -1, 1); |
2512 | 2512 | } |
2513 | - $email = $name . "@" . $host . "." . explode(".", $email[1])[1]; |
|
2513 | + $email = $name."@".$host.".".explode(".", $email[1])[1]; |
|
2514 | 2514 | return $email; |
2515 | 2515 | } |
2516 | 2516 | |
@@ -2526,8 +2526,8 @@ discard block |
||
2526 | 2526 | function performDBQuery(array $SETTINGS, string $fields, string $table): array |
2527 | 2527 | { |
2528 | 2528 | // include librairies & connect to DB |
2529 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
2530 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2529 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
2530 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2531 | 2531 | if (defined('DB_PASSWD_CLEAR') === false) { |
2532 | 2532 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
2533 | 2533 | } |
@@ -2539,7 +2539,7 @@ discard block |
||
2539 | 2539 | DB::$encoding = DB_ENCODING; |
2540 | 2540 | // Insert log in DB |
2541 | 2541 | return DB::query( |
2542 | - 'SELECT ' . $fields . ' |
|
2542 | + 'SELECT '.$fields.' |
|
2543 | 2543 | FROM ' . prefixTable($table) |
2544 | 2544 | ); |
2545 | 2545 | } |
@@ -2554,11 +2554,11 @@ discard block |
||
2554 | 2554 | function formatSizeUnits(int $bytes): string |
2555 | 2555 | { |
2556 | 2556 | if ($bytes >= 1073741824) { |
2557 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
2557 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
2558 | 2558 | } elseif ($bytes >= 1048576) { |
2559 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
2559 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
2560 | 2560 | } elseif ($bytes >= 1024) { |
2561 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
2561 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
2562 | 2562 | } elseif ($bytes > 1) { |
2563 | 2563 | $bytes .= ' bytes'; |
2564 | 2564 | } elseif ($bytes === 1) { |
@@ -2767,14 +2767,14 @@ discard block |
||
2767 | 2767 | |
2768 | 2768 | // Encrypt the file content |
2769 | 2769 | $plaintext = file_get_contents( |
2770 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
2770 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
2771 | 2771 | ); |
2772 | 2772 | $ciphertext = $cipher->encrypt($plaintext); |
2773 | 2773 | // Save new file |
2774 | 2774 | $hash = md5($plaintext); |
2775 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
2775 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
2776 | 2776 | file_put_contents($fileOut, $ciphertext); |
2777 | - unlink($fileInPath . '/' . $fileInName); |
|
2777 | + unlink($fileInPath.'/'.$fileInName); |
|
2778 | 2778 | return [ |
2779 | 2779 | 'fileHash' => base64_encode($hash), |
2780 | 2780 | 'objectKey' => base64_encode($objectKey), |
@@ -2792,7 +2792,7 @@ discard block |
||
2792 | 2792 | */ |
2793 | 2793 | function decryptFile(string $fileName, string $filePath, string $key): string |
2794 | 2794 | { |
2795 | - if (! defined('FILE_BUFFER_SIZE')) { |
|
2795 | + if (!defined('FILE_BUFFER_SIZE')) { |
|
2796 | 2796 | define('FILE_BUFFER_SIZE', 128 * 1024); |
2797 | 2797 | } |
2798 | 2798 | |
@@ -2811,7 +2811,7 @@ discard block |
||
2811 | 2811 | $cipher->enableContinuousBuffer(); |
2812 | 2812 | $cipher->disablePadding(); |
2813 | 2813 | // Get file content |
2814 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
2814 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
2815 | 2815 | // Decrypt file content and return |
2816 | 2816 | return base64_encode($cipher->decrypt($ciphertext)); |
2817 | 2817 | } |
@@ -2865,8 +2865,8 @@ discard block |
||
2865 | 2865 | array $SETTINGS |
2866 | 2866 | ): void { |
2867 | 2867 | // include librairies & connect to DB |
2868 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
2869 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2868 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
2869 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2870 | 2870 | if (defined('DB_PASSWD_CLEAR') === false) { |
2871 | 2871 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
2872 | 2872 | } |
@@ -2883,7 +2883,7 @@ discard block |
||
2883 | 2883 | $post_object_id |
2884 | 2884 | ); |
2885 | 2885 | // Superglobals |
2886 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2886 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2887 | 2887 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
2888 | 2888 | // Prepare superGlobal variables |
2889 | 2889 | $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION'); |
@@ -2908,8 +2908,8 @@ discard block |
||
2908 | 2908 | // Create sharekey for each user |
2909 | 2909 | $users = DB::query( |
2910 | 2910 | 'SELECT id, public_key |
2911 | - FROM ' . prefixTable('users') . ' |
|
2912 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
2911 | + FROM ' . prefixTable('users').' |
|
2912 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
2913 | 2913 | AND public_key != ""' |
2914 | 2914 | ); |
2915 | 2915 | foreach ($users as $user) { |
@@ -2939,7 +2939,7 @@ discard block |
||
2939 | 2939 | function isBase64(string $str): bool |
2940 | 2940 | { |
2941 | 2941 | $str = (string) trim($str); |
2942 | - if (! isset($str[0])) { |
|
2942 | + if (!isset($str[0])) { |
|
2943 | 2943 | return false; |
2944 | 2944 | } |
2945 | 2945 | |
@@ -3007,12 +3007,12 @@ discard block |
||
3007 | 3007 | ], |
3008 | 3008 | ]; |
3009 | 3009 | // Load expected libraries |
3010 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
3011 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
3012 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
3013 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
3014 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
3015 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
3010 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
3011 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
3012 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
3013 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
3014 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
3015 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
3016 | 3016 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
3017 | 3017 | $ad->register(); |
3018 | 3018 | $connection = new Connection($config); |
@@ -3021,7 +3021,7 @@ discard block |
||
3021 | 3021 | $connection->connect(); |
3022 | 3022 | } catch (\LdapRecord\Auth\BindException $e) { |
3023 | 3023 | $error = $e->getDetailedError(); |
3024 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
3024 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
3025 | 3025 | return false; |
3026 | 3026 | } |
3027 | 3027 | |
@@ -3034,7 +3034,7 @@ discard block |
||
3034 | 3034 | } |
3035 | 3035 | } catch (\LdapRecord\Auth\BindException $e) { |
3036 | 3036 | $error = $e->getDetailedError(); |
3037 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
3037 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
3038 | 3038 | return false; |
3039 | 3039 | } |
3040 | 3040 | |
@@ -3052,8 +3052,8 @@ discard block |
||
3052 | 3052 | function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool |
3053 | 3053 | { |
3054 | 3054 | // include librairies & connect to DB |
3055 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
3056 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
3055 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
3056 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
3057 | 3057 | if (defined('DB_PASSWD_CLEAR') === false) { |
3058 | 3058 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
3059 | 3059 | } |
@@ -3111,7 +3111,7 @@ discard block |
||
3111 | 3111 | foreach (DateTimeZone::listIdentifiers() as $timezone) { |
3112 | 3112 | $now->setTimezone(new DateTimeZone($timezone)); |
3113 | 3113 | $offsets[] = $offset = $now->getOffset(); |
3114 | - $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); |
|
3114 | + $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone); |
|
3115 | 3115 | } |
3116 | 3116 | |
3117 | 3117 | array_multisort($offsets, $timezones); |
@@ -3131,7 +3131,7 @@ discard block |
||
3131 | 3131 | { |
3132 | 3132 | $hours = intval($offset / 3600); |
3133 | 3133 | $minutes = abs(intval($offset % 3600 / 60)); |
3134 | - return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
3134 | + return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
3135 | 3135 | } |
3136 | 3136 | |
3137 | 3137 | /** |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
45 | 45 | } |
46 | 46 | |
47 | -if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
47 | +if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
48 | 48 | $SETTINGS = []; |
49 | 49 | $SETTINGS['cpassman_dir'] = '..'; |
50 | 50 | } |
51 | 51 | |
52 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
53 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
54 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
52 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
53 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
54 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
55 | 55 | |
56 | 56 | // If Debug then clean the files |
57 | 57 | if (DEBUGLDAP === true) { |
58 | - define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt'); |
|
58 | + define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt'); |
|
59 | 59 | $fp = fopen(DEBUGLDAPFILE, 'w'); |
60 | 60 | fclose($fp); |
61 | 61 | } |
62 | 62 | if (DEBUGDUO === true) { |
63 | - define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt'); |
|
63 | + define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt'); |
|
64 | 64 | $fp = fopen(DEBUGDUOFILE, 'w'); |
65 | 65 | fclose($fp); |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if (defined('DB_PASSWD_CLEAR') === false) { |
77 | 77 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
78 | 78 | } |
79 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
79 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
80 | 80 | if (defined('DB_PASSWD_CLEAR') === false) { |
81 | 81 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
82 | 82 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // This step creates the DUO request encrypted key |
94 | 94 | |
95 | 95 | // load library |
96 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
96 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
97 | 97 | $sig_request = Duo::signRequest( |
98 | 98 | $SETTINGS['IKEY'], |
99 | 99 | $SETTINGS['SKEY'], |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | debugIdentify( |
105 | 105 | DEBUGDUO, |
106 | 106 | DEBUGDUOFILE, |
107 | - "\n\n-----\n\n" . |
|
108 | - 'sig request : ' . $post_login . "\n" . |
|
109 | - 'resp : ' . $sig_request . "\n" |
|
107 | + "\n\n-----\n\n". |
|
108 | + 'sig request : '.$post_login."\n". |
|
109 | + 'resp : '.$sig_request."\n" |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | // load csrfprotector |
114 | - $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php'; |
|
114 | + $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php'; |
|
115 | 115 | // return result |
116 | - echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]'; |
|
116 | + echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]'; |
|
117 | 117 | // --- |
118 | 118 | // --- |
119 | 119 | } elseif ($post_type === 'identify_duo_user_check') { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | //-------- |
124 | 124 | |
125 | 125 | // load library |
126 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
126 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
127 | 127 | $authenticated_username = Duo::verifyResponse( |
128 | 128 | $SETTINGS['duo_ikey'], |
129 | 129 | $SETTINGS['duo_skey'], |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // is user in Teampass? |
139 | 139 | DB::queryfirstrow( |
140 | 140 | 'SELECT id |
141 | - FROM ' . prefixTable('users') . ' |
|
141 | + FROM ' . prefixTable('users').' |
|
142 | 142 | WHERE login = %s', |
143 | 143 | $post_login |
144 | 144 | ); |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - echo '[{"authenticated_username" : "' . $authenticated_username . '"}]'; |
|
151 | + echo '[{"authenticated_username" : "'.$authenticated_username.'"}]'; |
|
152 | 152 | } else { |
153 | - echo '[{"authenticated_username" : "' . $authenticated_username . '"}]'; |
|
153 | + echo '[{"authenticated_username" : "'.$authenticated_username.'"}]'; |
|
154 | 154 | } |
155 | 155 | // --- |
156 | 156 | // --- |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | // Load superGlobals |
179 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
179 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
180 | 180 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
181 | 181 | // Prepare GET variables |
182 | 182 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | } else { |
267 | 267 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
268 | 268 | } |
269 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
270 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
271 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
269 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
270 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
271 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
272 | 272 | |
273 | 273 | header('Content-type: text/html; charset=utf-8'); |
274 | 274 | error_reporting(E_ERROR); |
275 | 275 | |
276 | 276 | // Load AntiXSS |
277 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
277 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
278 | 278 | $antiXss = new voku\helper\AntiXSS(); |
279 | 279 | |
280 | 280 | // Load superGlobals |
281 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
281 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
282 | 282 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
283 | 283 | |
284 | 284 | // Prepare GET variables |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER'); |
293 | 293 | |
294 | 294 | // connect to the server |
295 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
295 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
296 | 296 | DB::$host = DB_HOST; |
297 | 297 | DB::$user = DB_USER; |
298 | 298 | DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR; |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | DB::$port = DB_PORT; |
301 | 301 | DB::$encoding = DB_ENCODING; |
302 | 302 | // User's language loading |
303 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php'; |
|
303 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php'; |
|
304 | 304 | |
305 | 305 | // decrypt and retreive data in JSON format |
306 | 306 | if (empty($sessionKey) === true) { |
307 | 307 | $dataReceived = $sentData; |
308 | 308 | } else { |
309 | 309 | $dataReceived = prepareExchangedData( |
310 | - $SETTINGS['cpassman_dir'],$sentData, 'decode', $sessionKey); |
|
310 | + $SETTINGS['cpassman_dir'], $sentData, 'decode', $sessionKey); |
|
311 | 311 | $superGlobal->put('key', $sessionKey, 'SESSION'); |
312 | 312 | } |
313 | 313 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | // Check if any unsuccessfull login tries exist |
457 | 457 | $rows = DB::query( |
458 | 458 | 'SELECT date |
459 | - FROM ' . prefixTable('log_system') . " |
|
459 | + FROM ' . prefixTable('log_system')." |
|
460 | 460 | WHERE field_1 = %s |
461 | 461 | AND type = 'failed_auth' |
462 | 462 | AND label = 'password_is_not_correct' |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | foreach ($rows as $record) { |
471 | 471 | array_push( |
472 | 472 | $arrAttempts, |
473 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
473 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
474 | 474 | ); |
475 | 475 | } |
476 | 476 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | foreach ($superGlobal->get('user_roles', 'SESSION') as $role) { |
586 | 586 | $resRoles = DB::queryFirstRow( |
587 | 587 | 'SELECT title, complexity |
588 | - FROM ' . prefixTable('roles_title') . ' |
|
588 | + FROM ' . prefixTable('roles_title').' |
|
589 | 589 | WHERE id=%i', |
590 | 590 | $role |
591 | 591 | ); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | |
607 | 607 | // build complete array of roles |
608 | 608 | $superGlobal->put('arr_roles_full', [], 'SESSION'); |
609 | - $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
609 | + $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
610 | 610 | foreach ($rows as $record) { |
611 | 611 | $superGlobal->put( |
612 | 612 | $record['id'], |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | $superGlobal->put('latest_items_tab', [], 'SESSION'); |
685 | 685 | $superGlobal->put('nb_roles', 0, 'SESSION'); |
686 | 686 | foreach ($superGlobal->get('latest_items', 'SESSION') as $item) { |
687 | - if (! empty($item)) { |
|
687 | + if (!empty($item)) { |
|
688 | 688 | $dataLastItems = DB::queryFirstRow( |
689 | 689 | 'SELECT id,label,id_tree |
690 | - FROM ' . prefixTable('items') . ' |
|
690 | + FROM ' . prefixTable('items').' |
|
691 | 691 | WHERE id=%i', |
692 | 692 | $item |
693 | 693 | ); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | [ |
697 | 697 | 'id' => $item, |
698 | 698 | 'label' => $dataLastItems['label'], |
699 | - 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
699 | + 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
700 | 700 | ], |
701 | 701 | 'SESSION', |
702 | 702 | 'latest_items_tab' |
@@ -713,12 +713,12 @@ discard block |
||
713 | 713 | ) { |
714 | 714 | // get all Admin users |
715 | 715 | $receivers = ''; |
716 | - $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
716 | + $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
717 | 717 | foreach ($rows as $record) { |
718 | 718 | if (empty($receivers)) { |
719 | 719 | $receivers = $record['email']; |
720 | 720 | } else { |
721 | - $receivers = ',' . $record['email']; |
|
721 | + $receivers = ','.$record['email']; |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | // Add email to table |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | '#tp_time#', |
735 | 735 | ], |
736 | 736 | [ |
737 | - ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')', |
|
737 | + ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')', |
|
738 | 738 | date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
739 | 739 | date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
740 | 740 | ], |
@@ -1059,44 +1059,44 @@ discard block |
||
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | // Load expected libraries |
1062 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1063 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1064 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1065 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1066 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1067 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1068 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1069 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1070 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1071 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1072 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
1073 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
1074 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1075 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
1076 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1077 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1078 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1079 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1080 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
1081 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
1082 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
1083 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1084 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1085 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1086 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
1087 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
1088 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
1089 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
1090 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1091 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1092 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
1093 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
1094 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
1095 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1096 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
1097 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1098 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1099 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
1062 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1063 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1064 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1065 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1066 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1067 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1068 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1069 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1070 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1071 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1072 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
1073 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
1074 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1075 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
1076 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1077 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1078 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1079 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1080 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
1081 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
1082 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
1083 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1084 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1085 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1086 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
1087 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
1088 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
1089 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
1090 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1091 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1092 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
1093 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
1094 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
1095 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1096 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
1097 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1098 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1099 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
1100 | 1100 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
1101 | 1101 | $ad->register(); |
1102 | 1102 | $connection = new Connection($config); |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | $error = $e->getDetailedError(); |
1109 | 1109 | return [ |
1110 | 1110 | 'error' => true, |
1111 | - 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
1111 | + 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
1112 | 1112 | |
1113 | 1113 | ]; |
1114 | 1114 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | // load passwordLib library |
1139 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1139 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1140 | 1140 | $pwdlib->register(); |
1141 | 1141 | $pwdlib = new PasswordLib\PasswordLib(); |
1142 | 1142 | $hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array |
1196 | 1196 | { |
1197 | 1197 | // Load superGlobals |
1198 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1198 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1199 | 1199 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1200 | 1200 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
1201 | 1201 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | // Now check yubico validity |
1237 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1237 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1238 | 1238 | $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
1239 | 1239 | $auth = $yubi->verify($yubico_key); |
1240 | 1240 | //, null, null, null, 60 |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | 'gestionnaire' => '0', |
1287 | 1287 | 'can_manage_all_users' => '0', |
1288 | 1288 | 'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0', |
1289 | - 'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'), |
|
1289 | + 'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'), |
|
1290 | 1290 | 'groupes_interdits' => '', |
1291 | 1291 | 'groupes_visibles' => '', |
1292 | 1292 | 'last_pw_change' => (int) time(), |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | ] |
1312 | 1312 | ); |
1313 | 1313 | // Rebuild tree |
1314 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1314 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1315 | 1315 | $tree->register(); |
1316 | 1316 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
1317 | 1317 | $tree->rebuild(); |
@@ -1342,13 +1342,13 @@ discard block |
||
1342 | 1342 | && empty($dataReceived['GACode']) === false |
1343 | 1343 | ) { |
1344 | 1344 | // Load superGlobals |
1345 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1345 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1346 | 1346 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1347 | 1347 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
1348 | 1348 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
1349 | 1349 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
1350 | 1350 | // load library |
1351 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1351 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1352 | 1352 | // create new instance |
1353 | 1353 | $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']); |
1354 | 1354 | // Init |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | $mfaMessage = langHdl('ga_flash_qr_and_login'); |
1371 | 1371 | // generate new QR |
1372 | 1372 | $new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
1373 | - 'Teampass - ' . $username, |
|
1373 | + 'Teampass - '.$username, |
|
1374 | 1374 | $userInfo['ga'] |
1375 | 1375 | ); |
1376 | 1376 | // clear temporary code from DB |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | $userInfo['id'] |
1384 | 1384 | ); |
1385 | 1385 | $firstTime = [ |
1386 | - 'value' => '<img src="' . $new_2fa_qr . '">', |
|
1386 | + 'value' => '<img src="'.$new_2fa_qr.'">', |
|
1387 | 1387 | 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
1388 | 1388 | 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
1389 | 1389 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | // Set to false |
1435 | 1435 | $userPasswordVerified = false; |
1436 | 1436 | // load passwordLib library |
1437 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1438 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1437 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1438 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1439 | 1439 | $pwdlib->register(); |
1440 | 1440 | $pwdlib = new PasswordLib\PasswordLib(); |
1441 | 1441 | // Check if old encryption used |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | // Brute force management |
1567 | 1567 | if ($sessionPwdAttempts > 3) { |
1568 | 1568 | // Load superGlobals |
1569 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1569 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1570 | 1570 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1571 | 1571 | $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION'); |
1572 | 1572 | $superGlobal->put('pwd_attempts', 0, 'SESSION'); |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | // Check if user exists |
1609 | 1609 | $userInfo = DB::queryFirstRow( |
1610 | 1610 | 'SELECT * |
1611 | - FROM ' . prefixTable('users') . ' WHERE login=%s', |
|
1611 | + FROM ' . prefixTable('users').' WHERE login=%s', |
|
1612 | 1612 | $username |
1613 | 1613 | ); |
1614 | 1614 |