@@ -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'); |
@@ -264,19 +264,19 @@ discard block |
||
264 | 264 | } else { |
265 | 265 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
266 | 266 | } |
267 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
268 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
269 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
267 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
268 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
269 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
270 | 270 | |
271 | 271 | header('Content-type: text/html; charset=utf-8'); |
272 | 272 | error_reporting(E_ERROR); |
273 | 273 | |
274 | 274 | // Load AntiXSS |
275 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
275 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
276 | 276 | $antiXss = new voku\helper\AntiXSS(); |
277 | 277 | |
278 | 278 | // Load superGlobals |
279 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
279 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
280 | 280 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
281 | 281 | |
282 | 282 | // Prepare GET variables |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER'); |
291 | 291 | |
292 | 292 | // connect to the server |
293 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
293 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
294 | 294 | DB::$host = DB_HOST; |
295 | 295 | DB::$user = DB_USER; |
296 | 296 | DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | DB::$port = DB_PORT; |
299 | 299 | DB::$encoding = DB_ENCODING; |
300 | 300 | // User's language loading |
301 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php'; |
|
301 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php'; |
|
302 | 302 | |
303 | 303 | // decrypt and retreive data in JSON format |
304 | 304 | if (empty($sessionKey) === true) { |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | // Check if any unsuccessfull login tries exist |
450 | 450 | $rows = DB::query( |
451 | 451 | 'SELECT date |
452 | - FROM ' . prefixTable('log_system') . " |
|
452 | + FROM ' . prefixTable('log_system')." |
|
453 | 453 | WHERE field_1 = %s |
454 | 454 | AND type = 'failed_auth' |
455 | 455 | AND label = 'password_is_not_correct' |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | foreach ($rows as $record) { |
464 | 464 | array_push( |
465 | 465 | $arrAttempts, |
466 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
466 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
467 | 467 | ); |
468 | 468 | } |
469 | 469 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | foreach ($superGlobal->get('user_roles', 'SESSION') as $role) { |
579 | 579 | $resRoles = DB::queryFirstRow( |
580 | 580 | 'SELECT title, complexity |
581 | - FROM ' . prefixTable('roles_title') . ' |
|
581 | + FROM ' . prefixTable('roles_title').' |
|
582 | 582 | WHERE id=%i', |
583 | 583 | $role |
584 | 584 | ); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | // build complete array of roles |
601 | 601 | $superGlobal->put('arr_roles_full', [], 'SESSION'); |
602 | - $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
602 | + $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
603 | 603 | foreach ($rows as $record) { |
604 | 604 | $superGlobal->put( |
605 | 605 | $record['id'], |
@@ -677,10 +677,10 @@ discard block |
||
677 | 677 | $superGlobal->put('latest_items_tab', [], 'SESSION'); |
678 | 678 | $superGlobal->put('nb_roles', 0, 'SESSION'); |
679 | 679 | foreach ($superGlobal->get('latest_items', 'SESSION') as $item) { |
680 | - if (! empty($item)) { |
|
680 | + if (!empty($item)) { |
|
681 | 681 | $dataLastItems = DB::queryFirstRow( |
682 | 682 | 'SELECT id,label,id_tree |
683 | - FROM ' . prefixTable('items') . ' |
|
683 | + FROM ' . prefixTable('items').' |
|
684 | 684 | WHERE id=%i', |
685 | 685 | $item |
686 | 686 | ); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | [ |
690 | 690 | 'id' => $item, |
691 | 691 | 'label' => $dataLastItems['label'], |
692 | - 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
692 | + 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
693 | 693 | ], |
694 | 694 | 'SESSION', |
695 | 695 | 'latest_items_tab' |
@@ -706,12 +706,12 @@ discard block |
||
706 | 706 | ) { |
707 | 707 | // get all Admin users |
708 | 708 | $receivers = ''; |
709 | - $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
709 | + $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
710 | 710 | foreach ($rows as $record) { |
711 | 711 | if (empty($receivers)) { |
712 | 712 | $receivers = $record['email']; |
713 | 713 | } else { |
714 | - $receivers = ',' . $record['email']; |
|
714 | + $receivers = ','.$record['email']; |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 | // Add email to table |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | '#tp_time#', |
728 | 728 | ], |
729 | 729 | [ |
730 | - ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')', |
|
730 | + ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')', |
|
731 | 731 | date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
732 | 732 | date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
733 | 733 | ], |
@@ -1048,45 +1048,45 @@ discard block |
||
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | // Load expected libraries |
1051 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1052 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1053 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1054 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1055 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1056 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1057 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1058 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1059 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1060 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1061 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
1062 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
1063 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1064 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
1065 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1066 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1067 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1068 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1069 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
1070 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
1071 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
1072 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1073 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1074 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1075 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
1076 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
1077 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
1078 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
1079 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1080 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1081 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
1082 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
1083 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
1084 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1085 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
1086 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1087 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
1088 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1089 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
1051 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1052 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1053 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1054 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1055 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1056 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1057 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1058 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1059 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1060 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1061 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
1062 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
1063 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1064 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
1065 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1066 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1067 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1068 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1069 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
1070 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
1071 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
1072 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1073 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1074 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1075 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
1076 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
1077 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
1078 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
1079 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1080 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1081 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
1082 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
1083 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
1084 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1085 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
1086 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1087 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
1088 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1089 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
1090 | 1090 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
1091 | 1091 | $ad->register(); |
1092 | 1092 | $connection = new Connection($config); |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | $error = $e->getDetailedError(); |
1099 | 1099 | return [ |
1100 | 1100 | 'error' => true, |
1101 | - 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
1101 | + 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
1102 | 1102 | |
1103 | 1103 | ]; |
1104 | 1104 | } |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | // load passwordLib library |
1129 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1129 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1130 | 1130 | $pwdlib->register(); |
1131 | 1131 | $pwdlib = new PasswordLib\PasswordLib(); |
1132 | 1132 | $hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
@@ -1185,7 +1185,7 @@ discard block |
||
1185 | 1185 | function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array |
1186 | 1186 | { |
1187 | 1187 | // Load superGlobals |
1188 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1188 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1189 | 1189 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1190 | 1190 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
1191 | 1191 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | // Now check yubico validity |
1227 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1227 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1228 | 1228 | $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
1229 | 1229 | $auth = $yubi->verify($yubico_key); |
1230 | 1230 | //, null, null, null, 60 |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | 'gestionnaire' => '0', |
1277 | 1277 | 'can_manage_all_users' => '0', |
1278 | 1278 | 'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0', |
1279 | - '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'), |
|
1279 | + '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'), |
|
1280 | 1280 | 'groupes_interdits' => '', |
1281 | 1281 | 'groupes_visibles' => '', |
1282 | 1282 | 'last_pw_change' => (int) time(), |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | ] |
1302 | 1302 | ); |
1303 | 1303 | // Rebuild tree |
1304 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1304 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1305 | 1305 | $tree->register(); |
1306 | 1306 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
1307 | 1307 | $tree->rebuild(); |
@@ -1332,13 +1332,13 @@ discard block |
||
1332 | 1332 | && empty($dataReceived['GACode']) === false |
1333 | 1333 | ) { |
1334 | 1334 | // Load superGlobals |
1335 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1335 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1336 | 1336 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1337 | 1337 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
1338 | 1338 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
1339 | 1339 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
1340 | 1340 | // load library |
1341 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1341 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1342 | 1342 | // create new instance |
1343 | 1343 | $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']); |
1344 | 1344 | // Init |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | $mfaMessage = langHdl('ga_flash_qr_and_login'); |
1361 | 1361 | // generate new QR |
1362 | 1362 | $new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
1363 | - 'Teampass - ' . $username, |
|
1363 | + 'Teampass - '.$username, |
|
1364 | 1364 | $userInfo['ga'] |
1365 | 1365 | ); |
1366 | 1366 | // clear temporary code from DB |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | $userInfo['id'] |
1374 | 1374 | ); |
1375 | 1375 | $firstTime = [ |
1376 | - 'value' => '<img src="' . $new_2fa_qr . '">', |
|
1376 | + 'value' => '<img src="'.$new_2fa_qr.'">', |
|
1377 | 1377 | 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
1378 | 1378 | 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
1379 | 1379 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
@@ -1424,8 +1424,8 @@ discard block |
||
1424 | 1424 | // Set to false |
1425 | 1425 | $userPasswordVerified = false; |
1426 | 1426 | // load passwordLib library |
1427 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1428 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1427 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1428 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1429 | 1429 | $pwdlib->register(); |
1430 | 1430 | $pwdlib = new PasswordLib\PasswordLib(); |
1431 | 1431 | // Check if old encryption used |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | // Brute force management |
1557 | 1557 | if ($sessionPwdAttempts > 3) { |
1558 | 1558 | // Load superGlobals |
1559 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1559 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1560 | 1560 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1561 | 1561 | $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION'); |
1562 | 1562 | $superGlobal->put('pwd_attempts', 0, 'SESSION'); |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | // Check if user exists |
1599 | 1599 | $userInfo = DB::queryFirstRow( |
1600 | 1600 | 'SELECT * |
1601 | - FROM ' . prefixTable('users') . ' WHERE login=%s', |
|
1601 | + FROM ' . prefixTable('users').' WHERE login=%s', |
|
1602 | 1602 | $username |
1603 | 1603 | ); |
1604 | 1604 |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | // includes |
45 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
46 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
47 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
48 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
49 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
45 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
46 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
47 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
48 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
49 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
50 | 50 | |
51 | 51 | // header |
52 | 52 | header('Content-type: text/html; charset=utf-8'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // Connect to mysql server |
63 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
63 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
64 | 64 | if (defined('DB_PASSWD_CLEAR') === false) { |
65 | 65 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | DB::$encoding = DB_ENCODING; |
73 | 73 | |
74 | 74 | // Superglobal load |
75 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
75 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
76 | 76 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
77 | 77 | $get = []; |
78 | 78 | $get['user_tree_structure'] = $superGlobal->get('user_tree_structure', 'GET'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $session['personal_visible_groups'] = $superGlobal->get('personal_visible_groups', 'SESSION'); |
93 | 93 | |
94 | 94 | $lastFolderChange = DB::query( |
95 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
95 | + 'SELECT * FROM '.prefixTable('misc').' |
|
96 | 96 | WHERE type = %s AND intitule = %s', |
97 | 97 | 'timestamp', |
98 | 98 | 'last_folder_change' |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | || (isset($get['force_refresh']) === true && (int) $get['force_refresh'] === 1) |
104 | 104 | ) { |
105 | 105 | // Build tree |
106 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
106 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
107 | 107 | $tree->register(); |
108 | 108 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
109 | 109 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $SETTINGS |
214 | 214 | ) { |
215 | 215 | // Load library |
216 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
216 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
217 | 217 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
218 | 218 | |
219 | 219 | // Prepare superGlobal variables |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // get count of Items in this folder |
264 | 264 | DB::query( |
265 | 265 | 'SELECT * |
266 | - FROM ' . prefixTable('items') . ' |
|
266 | + FROM ' . prefixTable('items').' |
|
267 | 267 | WHERE inactif=%i AND id_tree = %i', |
268 | 268 | 0, |
269 | 269 | $node->id |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | // get info about current folder |
274 | 274 | DB::query( |
275 | 275 | 'SELECT * |
276 | - FROM ' . prefixTable('nested_tree') . ' |
|
276 | + FROM ' . prefixTable('nested_tree').' |
|
277 | 277 | WHERE parent_id = %i', |
278 | 278 | $node->id |
279 | 279 | ); |
@@ -281,11 +281,10 @@ discard block |
||
281 | 281 | |
282 | 282 | // If personal Folder, convert id into user name |
283 | 283 | $node->title = $node->title === $session_user_id && (int) $node->nlevel === 1 ? |
284 | - $session_login : |
|
285 | - ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES)); |
|
284 | + $session_login : ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES)); |
|
286 | 285 | |
287 | 286 | // prepare json return for current node |
288 | - $parent = $node->parent_id === 0 ? '#' : 'li_' . $node->parent_id; |
|
287 | + $parent = $node->parent_id === 0 ? '#' : 'li_'.$node->parent_id; |
|
289 | 288 | |
290 | 289 | // special case for READ-ONLY folder |
291 | 290 | $title = $session_user_read_only === true && in_array($node->id, $session_personal_folders) === false ? langHdl('read_only_account') : $title; |
@@ -295,33 +294,30 @@ discard block |
||
295 | 294 | |
296 | 295 | if (in_array($node->id, $session_groupes_visibles)) { |
297 | 296 | if (in_array($node->id, $session_read_only_folders)) { |
298 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
297 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
299 | 298 | $title = langHdl('read_only_account'); |
300 | 299 | $restricted = 1; |
301 | 300 | $folderClass = 'folder_not_droppable'; |
302 | 301 | } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) { |
303 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
302 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
304 | 303 | } |
305 | 304 | $text .= |
306 | - ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>' |
|
305 | + ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>' |
|
307 | 306 | .(isset($SETTINGS['tree_counters']) && (int) $SETTINGS['tree_counters'] === 1 ? |
308 | - '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : |
|
309 | - '') |
|
307 | + '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '') |
|
310 | 308 | .'</span>'; |
311 | 309 | } elseif (in_array($node->id, $listFoldersLimitedKeys)) { |
312 | 310 | $restricted = 1; |
313 | 311 | $text .= |
314 | 312 | $session_user_read_only === true ? |
315 | - "<i class='far fa-eye fa-xs mr-1'></i>" : |
|
316 | - '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_folders_limited[$node->id]) . '</span>'; |
|
313 | + "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_folders_limited[$node->id]).'</span>'; |
|
317 | 314 | } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) { |
318 | 315 | $restricted = 1; |
319 | 316 | if ($session_user_read_only === true) { |
320 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
317 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
321 | 318 | } |
322 | 319 | $text .= $session_user_read_only === true ? |
323 | - "<i class='far fa-eye fa-xs mr-1'></i>" : |
|
324 | - '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>'; |
|
320 | + "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_restricted_folders_for_items[$node->id]).'</span>'; |
|
325 | 321 | } else { |
326 | 322 | $restricted = 1; |
327 | 323 | $folderClass = 'folder_not_droppable'; |
@@ -343,22 +339,21 @@ discard block |
||
343 | 339 | } |
344 | 340 | |
345 | 341 | // json |
346 | - $hide_node === true ? '' : |
|
347 | - array_push( |
|
342 | + $hide_node === true ? '' : array_push( |
|
348 | 343 | $ret_json, |
349 | 344 | array( |
350 | - 'id' => 'li_' . $node->id, |
|
345 | + 'id' => 'li_'.$node->id, |
|
351 | 346 | 'parent' => $parent, |
352 | - 'text' => ($show_but_block === true ? '<i class="fas fa-times fa-xs text-danger mr-1"></i>' : '') . $text, |
|
347 | + 'text' => ($show_but_block === true ? '<i class="fas fa-times fa-xs text-danger mr-1"></i>' : '').$text, |
|
353 | 348 | 'children' => ($childrenNb === 0 ? false : true), |
354 | 349 | 'li_attr' => array( |
355 | 350 | 'class' => ($show_but_block === true ? '' : 'jstreeopen'), |
356 | - 'title' => 'ID [' . $node->id . '] ' . ($show_but_block === true ? angHdl('no_access') : $title), |
|
351 | + 'title' => 'ID ['.$node->id.'] '.($show_but_block === true ? angHdl('no_access') : $title), |
|
357 | 352 | ), |
358 | 353 | 'a_attr' => $show_but_block === true ? (array( |
359 | - 'id' => 'fld_' . $node->id, |
|
354 | + 'id' => 'fld_'.$node->id, |
|
360 | 355 | 'class' => $folderClass, |
361 | - 'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)', |
|
356 | + 'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)', |
|
362 | 357 | 'data-title' => $node->title, |
363 | 358 | )) : '', |
364 | 359 | ) |
@@ -451,7 +446,7 @@ discard block |
||
451 | 446 | ) === true |
452 | 447 | ) { |
453 | 448 | DB::query( |
454 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
449 | + 'SELECT * FROM '.prefixTable('items').' |
|
455 | 450 | WHERE inactif=%i AND id_tree = %i', |
456 | 451 | 0, |
457 | 452 | $node |
@@ -538,7 +533,7 @@ discard block |
||
538 | 533 | { |
539 | 534 | // get info about current folder |
540 | 535 | DB::query( |
541 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
536 | + 'SELECT * FROM '.prefixTable('items').' |
|
542 | 537 | WHERE inactif=%i AND id_tree = %i', |
543 | 538 | 0, |
544 | 539 | $completTree[$nodeId]->id |
@@ -639,7 +634,7 @@ discard block |
||
639 | 634 | */ |
640 | 635 | |
641 | 636 | // prepare json return for current node |
642 | - $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_' . $completTree[$nodeId]->parent_id; |
|
637 | + $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_'.$completTree[$nodeId]->parent_id; |
|
643 | 638 | |
644 | 639 | // handle displaying |
645 | 640 | if ( |
@@ -659,17 +654,17 @@ discard block |
||
659 | 654 | array_push( |
660 | 655 | $ret_json, |
661 | 656 | array( |
662 | - 'id' => 'li_' . $completTree[$nodeId]->id, |
|
657 | + 'id' => 'li_'.$completTree[$nodeId]->id, |
|
663 | 658 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
664 | 659 | 'text' => $text.$completTree[$nodeId]->title.$nodeData['html'], |
665 | 660 | 'li_attr' => array( |
666 | 661 | 'class' => 'jstreeopen', |
667 | - 'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $nodeData['title'], |
|
662 | + 'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$nodeData['title'], |
|
668 | 663 | ), |
669 | 664 | 'a_attr' => array( |
670 | - 'id' => 'fld_' . $completTree[$nodeId]->id, |
|
665 | + 'id' => 'fld_'.$completTree[$nodeId]->id, |
|
671 | 666 | 'class' => $nodeData['folderClass'], |
672 | - 'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $nodeData['restricted'] . ', 0, 1)', |
|
667 | + 'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$nodeData['restricted'].', 0, 1)', |
|
673 | 668 | 'data-title' => $completTree[$nodeId]->title, |
674 | 669 | ), |
675 | 670 | ) |
@@ -678,12 +673,12 @@ discard block |
||
678 | 673 | array_push( |
679 | 674 | $ret_json, |
680 | 675 | array( |
681 | - 'id' => 'li_' . $completTree[$nodeId]->id, |
|
676 | + 'id' => 'li_'.$completTree[$nodeId]->id, |
|
682 | 677 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
683 | 678 | 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'], |
684 | 679 | 'li_attr' => array( |
685 | 680 | 'class' => '', |
686 | - 'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'), |
|
681 | + 'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'), |
|
687 | 682 | ), |
688 | 683 | ) |
689 | 684 | ); |
@@ -746,8 +741,8 @@ discard block |
||
746 | 741 | if (in_array($nodeId, $session_groupes_visibles) === true) { |
747 | 742 | if (in_array($nodeId, $session_read_only_folders) === true) { |
748 | 743 | return [ |
749 | - 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb . |
|
750 | - ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : '') . '</span>', |
|
744 | + 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb. |
|
745 | + ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>', |
|
751 | 746 | 'title' => langHdl('read_only_account'), |
752 | 747 | 'restricted' => 1, |
753 | 748 | 'folderClass' => 'folder_not_droppable', |
@@ -761,8 +756,8 @@ discard block |
||
761 | 756 | && in_array($nodeId, $session_personal_visible_groups) === false |
762 | 757 | ) { |
763 | 758 | return [ |
764 | - 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb . |
|
765 | - ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : '') . '</span>', |
|
759 | + 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb. |
|
760 | + ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>', |
|
766 | 761 | 'title' => $title, |
767 | 762 | 'restricted' => 0, |
768 | 763 | 'folderClass' => 'folder', |
@@ -772,8 +767,8 @@ discard block |
||
772 | 767 | } |
773 | 768 | |
774 | 769 | return [ |
775 | - 'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb . |
|
776 | - ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : '') . '</span>', |
|
770 | + 'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb. |
|
771 | + ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>', |
|
777 | 772 | 'title' => $title, |
778 | 773 | 'restricted' => 0, |
779 | 774 | 'folderClass' => 'folder', |
@@ -784,8 +779,8 @@ discard block |
||
784 | 779 | |
785 | 780 | if (in_array($nodeId, $listFoldersLimitedKeys) === true) { |
786 | 781 | return [ |
787 | - 'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') . |
|
788 | - '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>', |
|
782 | + 'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''). |
|
783 | + '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>', |
|
789 | 784 | 'title' => $title, |
790 | 785 | 'restricted' => 1, |
791 | 786 | 'folderClass' => 'folder', |
@@ -796,8 +791,8 @@ discard block |
||
796 | 791 | |
797 | 792 | if (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) { |
798 | 793 | return [ |
799 | - 'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' . |
|
800 | - '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>', |
|
794 | + 'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''. |
|
795 | + '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>', |
|
801 | 796 | 'title' => $title, |
802 | 797 | 'restricted' => 1, |
803 | 798 | 'folderClass' => 'folder', |
@@ -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 |
@@ -679,16 +679,16 @@ discard block |
||
679 | 679 | 'SESSION' |
680 | 680 | ); |
681 | 681 | // Folders and Roles numbers |
682 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
682 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
683 | 683 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
684 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
684 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
685 | 685 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
686 | 686 | // check if change proposals on User's items |
687 | 687 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
688 | 688 | $countNewItems = DB::query( |
689 | 689 | 'SELECT COUNT(*) |
690 | - FROM ' . prefixTable('items_change') . ' AS c |
|
691 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
690 | + FROM ' . prefixTable('items_change').' AS c |
|
691 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
692 | 692 | WHERE i.action = %s AND i.id_user = %i', |
693 | 693 | 'at_creation', |
694 | 694 | $globalsUserId |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | |
717 | 717 | $rows = DB::query( |
718 | 718 | 'SELECT * |
719 | - FROM ' . prefixTable('roles_values') . ' |
|
719 | + FROM ' . prefixTable('roles_values').' |
|
720 | 720 | WHERE role_id IN %li AND type IN %ls', |
721 | 721 | $userRoles, |
722 | 722 | ['W', 'ND', 'NE', 'NDNE', 'R'] |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | ) { |
781 | 781 | $persoFld = DB::queryfirstrow( |
782 | 782 | 'SELECT id |
783 | - FROM ' . prefixTable('nested_tree') . ' |
|
783 | + FROM ' . prefixTable('nested_tree').' |
|
784 | 784 | WHERE title = %s AND personal_folder = %i'. |
785 | 785 | (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''), |
786 | 786 | $globalsUserId, |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | } |
815 | 815 | $persoFlds = DB::query( |
816 | 816 | 'SELECT id |
817 | - FROM ' . prefixTable('nested_tree') . ' |
|
817 | + FROM ' . prefixTable('nested_tree').' |
|
818 | 818 | WHERE %l', |
819 | 819 | $where |
820 | 820 | ); |
@@ -878,9 +878,9 @@ discard block |
||
878 | 878 | */ |
879 | 879 | function cacheTableRefresh(array $SETTINGS): void |
880 | 880 | { |
881 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
881 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
882 | 882 | //Connect to DB |
883 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
883 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
884 | 884 | if (defined('DB_PASSWD_CLEAR') === false) { |
885 | 885 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
886 | 886 | } |
@@ -895,12 +895,12 @@ discard block |
||
895 | 895 | $tree->register(); |
896 | 896 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
897 | 897 | // truncate table |
898 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
898 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
899 | 899 | // reload date |
900 | 900 | $rows = DB::query( |
901 | 901 | 'SELECT * |
902 | - FROM ' . prefixTable('items') . ' as i |
|
903 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
902 | + FROM ' . prefixTable('items').' as i |
|
903 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
904 | 904 | AND l.action = %s |
905 | 905 | AND i.inactif = %i', |
906 | 906 | 'at_creation', |
@@ -912,18 +912,18 @@ discard block |
||
912 | 912 | $tags = ''; |
913 | 913 | $itemTags = DB::query( |
914 | 914 | 'SELECT tag |
915 | - FROM ' . prefixTable('tags') . ' |
|
915 | + FROM ' . prefixTable('tags').' |
|
916 | 916 | WHERE item_id = %i AND tag != ""', |
917 | 917 | $record['id'] |
918 | 918 | ); |
919 | 919 | foreach ($itemTags as $itemTag) { |
920 | - $tags .= $itemTag['tag'] . ' '; |
|
920 | + $tags .= $itemTag['tag'].' '; |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | // Get renewal period |
924 | 924 | $resNT = DB::queryfirstrow( |
925 | 925 | 'SELECT renewal_period |
926 | - FROM ' . prefixTable('nested_tree') . ' |
|
926 | + FROM ' . prefixTable('nested_tree').' |
|
927 | 927 | WHERE id = %i', |
928 | 928 | $record['id_tree'] |
929 | 929 | ); |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | // Is this a User id? |
937 | 937 | $user = DB::queryfirstrow( |
938 | 938 | 'SELECT id, login |
939 | - FROM ' . prefixTable('users') . ' |
|
939 | + FROM ' . prefixTable('users').' |
|
940 | 940 | WHERE id = %i', |
941 | 941 | $elem->title |
942 | 942 | ); |
@@ -954,11 +954,11 @@ discard block |
||
954 | 954 | 'id' => $record['id'], |
955 | 955 | 'label' => $record['label'], |
956 | 956 | 'description' => $record['description'] ?? '', |
957 | - 'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0', |
|
957 | + 'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0', |
|
958 | 958 | 'tags' => $tags, |
959 | 959 | 'id_tree' => $record['id_tree'], |
960 | 960 | 'perso' => $record['perso'], |
961 | - 'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
961 | + 'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0', |
|
962 | 962 | 'login' => $record['login'] ?? '', |
963 | 963 | 'folder' => implode(' > ', $folder), |
964 | 964 | 'author' => $record['id_user'], |
@@ -980,12 +980,12 @@ discard block |
||
980 | 980 | */ |
981 | 981 | function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void |
982 | 982 | { |
983 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
983 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
984 | 984 | // Load superglobal |
985 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
985 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
986 | 986 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
987 | 987 | //Connect to DB |
988 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
988 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
989 | 989 | if (defined('DB_PASSWD_CLEAR') === false) { |
990 | 990 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
991 | 991 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | // get new value from db |
1003 | 1003 | $data = DB::queryfirstrow( |
1004 | 1004 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
1005 | - FROM ' . prefixTable('items') . ' |
|
1005 | + FROM ' . prefixTable('items').' |
|
1006 | 1006 | WHERE id=%i', |
1007 | 1007 | $ident |
1008 | 1008 | ); |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | $tags = ''; |
1011 | 1011 | $itemTags = DB::query( |
1012 | 1012 | 'SELECT tag |
1013 | - FROM ' . prefixTable('tags') . ' |
|
1013 | + FROM ' . prefixTable('tags').' |
|
1014 | 1014 | WHERE item_id = %i AND tag != ""', |
1015 | 1015 | $ident |
1016 | 1016 | ); |
1017 | 1017 | foreach ($itemTags as $itemTag) { |
1018 | - $tags .= $itemTag['tag'] . ' '; |
|
1018 | + $tags .= $itemTag['tag'].' '; |
|
1019 | 1019 | } |
1020 | 1020 | // form id_tree to full foldername |
1021 | 1021 | $folder = []; |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | // Is this a User id? |
1027 | 1027 | $user = DB::queryfirstrow( |
1028 | 1028 | 'SELECT id, login |
1029 | - FROM ' . prefixTable('users') . ' |
|
1029 | + FROM ' . prefixTable('users').' |
|
1030 | 1030 | WHERE id = %i', |
1031 | 1031 | $elem->title |
1032 | 1032 | ); |
@@ -1044,10 +1044,10 @@ discard block |
||
1044 | 1044 | 'label' => $data['label'], |
1045 | 1045 | 'description' => $data['description'], |
1046 | 1046 | 'tags' => $tags, |
1047 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
1047 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
1048 | 1048 | 'id_tree' => $data['id_tree'], |
1049 | 1049 | 'perso' => $data['perso'], |
1050 | - 'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
1050 | + 'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0', |
|
1051 | 1051 | 'login' => $data['login'] ?? '', |
1052 | 1052 | 'folder' => implode(' » ', $folder), |
1053 | 1053 | 'author' => $superGlobal->get('user_id', 'SESSION'), |
@@ -1067,14 +1067,14 @@ discard block |
||
1067 | 1067 | */ |
1068 | 1068 | function cacheTableAdd(array $SETTINGS, ?int $ident = null): void |
1069 | 1069 | { |
1070 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1070 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1071 | 1071 | // Load superglobal |
1072 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1072 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1073 | 1073 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1074 | 1074 | // Get superglobals |
1075 | 1075 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
1076 | 1076 | //Connect to DB |
1077 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1077 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1078 | 1078 | if (defined('DB_PASSWD_CLEAR') === false) { |
1079 | 1079 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
1080 | 1080 | } |
@@ -1091,8 +1091,8 @@ discard block |
||
1091 | 1091 | // get new value from db |
1092 | 1092 | $data = DB::queryFirstRow( |
1093 | 1093 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
1094 | - FROM ' . prefixTable('items') . ' as i |
|
1095 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
1094 | + FROM ' . prefixTable('items').' as i |
|
1095 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
1096 | 1096 | WHERE i.id = %i |
1097 | 1097 | AND l.action = %s', |
1098 | 1098 | $ident, |
@@ -1102,12 +1102,12 @@ discard block |
||
1102 | 1102 | $tags = ''; |
1103 | 1103 | $itemTags = DB::query( |
1104 | 1104 | 'SELECT tag |
1105 | - FROM ' . prefixTable('tags') . ' |
|
1105 | + FROM ' . prefixTable('tags').' |
|
1106 | 1106 | WHERE item_id = %i AND tag != ""', |
1107 | 1107 | $ident |
1108 | 1108 | ); |
1109 | 1109 | foreach ($itemTags as $itemTag) { |
1110 | - $tags .= $itemTag['tag'] . ' '; |
|
1110 | + $tags .= $itemTag['tag'].' '; |
|
1111 | 1111 | } |
1112 | 1112 | // form id_tree to full foldername |
1113 | 1113 | $folder = []; |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | // Is this a User id? |
1119 | 1119 | $user = DB::queryfirstrow( |
1120 | 1120 | 'SELECT id, login |
1121 | - FROM ' . prefixTable('users') . ' |
|
1121 | + FROM ' . prefixTable('users').' |
|
1122 | 1122 | WHERE id = %i', |
1123 | 1123 | $elem->title |
1124 | 1124 | ); |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | 'label' => $data['label'], |
1138 | 1138 | 'description' => $data['description'], |
1139 | 1139 | 'tags' => isset($tags) && empty($tags) === false ? $tags : 'None', |
1140 | - 'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0', |
|
1140 | + 'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0', |
|
1141 | 1141 | 'id_tree' => $data['id_tree'], |
1142 | 1142 | 'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0', |
1143 | 1143 | 'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0', |
@@ -1159,52 +1159,52 @@ discard block |
||
1159 | 1159 | function getStatisticsData(array $SETTINGS): array |
1160 | 1160 | { |
1161 | 1161 | DB::query( |
1162 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
1162 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
1163 | 1163 | 0 |
1164 | 1164 | ); |
1165 | 1165 | $counter_folders = DB::count(); |
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 | 1 |
1169 | 1169 | ); |
1170 | 1170 | $counter_folders_perso = DB::count(); |
1171 | 1171 | DB::query( |
1172 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
1172 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
1173 | 1173 | 0 |
1174 | 1174 | ); |
1175 | 1175 | $counter_items = 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 | 1 |
1179 | 1179 | ); |
1180 | 1180 | $counter_items_perso = DB::count(); |
1181 | 1181 | DB::query( |
1182 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
1182 | + 'SELECT id FROM '.prefixTable('users').'' |
|
1183 | 1183 | ); |
1184 | 1184 | $counter_users = DB::count(); |
1185 | 1185 | DB::query( |
1186 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
1186 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
1187 | 1187 | 1 |
1188 | 1188 | ); |
1189 | 1189 | $admins = DB::count(); |
1190 | 1190 | DB::query( |
1191 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
1191 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
1192 | 1192 | 1 |
1193 | 1193 | ); |
1194 | 1194 | $managers = DB::count(); |
1195 | 1195 | DB::query( |
1196 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
1196 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
1197 | 1197 | 1 |
1198 | 1198 | ); |
1199 | 1199 | $readOnly = DB::count(); |
1200 | 1200 | // list the languages |
1201 | 1201 | $usedLang = []; |
1202 | 1202 | $tp_languages = DB::query( |
1203 | - 'SELECT name FROM ' . prefixTable('languages') |
|
1203 | + 'SELECT name FROM '.prefixTable('languages') |
|
1204 | 1204 | ); |
1205 | 1205 | foreach ($tp_languages as $tp_language) { |
1206 | 1206 | DB::query( |
1207 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
1207 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
1208 | 1208 | $tp_language['name'] |
1209 | 1209 | ); |
1210 | 1210 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1213,12 +1213,12 @@ discard block |
||
1213 | 1213 | // get list of ips |
1214 | 1214 | $usedIp = []; |
1215 | 1215 | $tp_ips = DB::query( |
1216 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
1216 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
1217 | 1217 | ); |
1218 | 1218 | foreach ($tp_ips as $ip) { |
1219 | 1219 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
1220 | 1220 | $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']]; |
1221 | - } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
1221 | + } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') { |
|
1222 | 1222 | $usedIp[$ip['user_ip']] = 1; |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1284,14 +1284,14 @@ discard block |
||
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | // Load settings |
1287 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
1287 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
1288 | 1288 | // Load superglobal |
1289 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1289 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1290 | 1290 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1291 | 1291 | // Get user language |
1292 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php'; |
|
1292 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php'; |
|
1293 | 1293 | // Load library |
1294 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1294 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1295 | 1295 | // load PHPMailer |
1296 | 1296 | $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries'); |
1297 | 1297 | $mail->register(); |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | try { |
1301 | 1301 | // send to user |
1302 | - $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
1302 | + $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
1303 | 1303 | $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0; |
1304 | 1304 | $mail->Port = $SETTINGS['email_port']; |
1305 | 1305 | //COULD BE USED |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | <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;"> |
1400 | 1400 | <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;"> |
1401 | 1401 | <br><div style="float:right;">' . |
1402 | - $textMail . |
|
1402 | + $textMail. |
|
1403 | 1403 | '<br><br></td></tr></table> |
1404 | 1404 | </td></tr></table> |
1405 | 1405 | <br></body></html>'; |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | */ |
1413 | 1413 | function generateKey(): string |
1414 | 1414 | { |
1415 | - return substr(md5(rand() . rand()), 0, 15); |
|
1415 | + return substr(md5(rand().rand()), 0, 15); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | /** |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | { |
1484 | 1484 | array_walk_recursive( |
1485 | 1485 | $array, |
1486 | - static function (&$item): void { |
|
1486 | + static function(&$item): void { |
|
1487 | 1487 | if (mb_detect_encoding((string) $item, 'utf-8', true) === false) { |
1488 | 1488 | $item = utf8_encode($item); |
1489 | 1489 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | // Load superglobal |
1521 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1521 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1522 | 1522 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1523 | 1523 | // Get superglobals |
1524 | 1524 | if ($key !== null) { |
@@ -1529,9 +1529,9 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | //load ClassLoader |
1532 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1532 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1533 | 1533 | //Load AES |
1534 | - $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1534 | + $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1535 | 1535 | $aes->register(); |
1536 | 1536 | if ($type === 'encode' && is_array($data) === true) { |
1537 | 1537 | // Ensure UTF8 format |
@@ -1605,8 +1605,8 @@ discard block |
||
1605 | 1605 | */ |
1606 | 1606 | function prefixTable(string $table): string |
1607 | 1607 | { |
1608 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
1609 | - if (! empty($safeTable)) { |
|
1608 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
1609 | + if (!empty($safeTable)) { |
|
1610 | 1610 | // sanitize string |
1611 | 1611 | return $safeTable; |
1612 | 1612 | } |
@@ -1636,13 +1636,13 @@ discard block |
||
1636 | 1636 | bool $lowercase = false, |
1637 | 1637 | array $SETTINGS = [] |
1638 | 1638 | ): string { |
1639 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1640 | - $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1639 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1640 | + $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1641 | 1641 | $generator->register(); |
1642 | 1642 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
1643 | 1643 | // Is PHP7 being used? |
1644 | 1644 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
1645 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1645 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1646 | 1646 | $php7generator->register(); |
1647 | 1647 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
1648 | 1648 | } |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | function send_syslog($message, $host, $port, $component = 'teampass'): void |
1678 | 1678 | { |
1679 | 1679 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
1680 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
1680 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
1681 | 1681 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
1682 | 1682 | socket_close($sock); |
1683 | 1683 | } |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | // include librairies & connect to DB |
1704 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1704 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1705 | 1705 | if (defined('DB_PASSWD_CLEAR') === false) { |
1706 | 1706 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
1707 | 1707 | } |
@@ -1725,14 +1725,14 @@ discard block |
||
1725 | 1725 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
1726 | 1726 | if ($type === 'user_mngt') { |
1727 | 1727 | send_syslog( |
1728 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
1728 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
1729 | 1729 | $SETTINGS['syslog_host'], |
1730 | 1730 | $SETTINGS['syslog_port'], |
1731 | 1731 | 'teampass' |
1732 | 1732 | ); |
1733 | 1733 | } else { |
1734 | 1734 | send_syslog( |
1735 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
1735 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
1736 | 1736 | $SETTINGS['syslog_host'], |
1737 | 1737 | $SETTINGS['syslog_port'], |
1738 | 1738 | 'teampass' |
@@ -1766,7 +1766,7 @@ discard block |
||
1766 | 1766 | ?string $encryption_type = null |
1767 | 1767 | ): void { |
1768 | 1768 | // include librairies & connect to DB |
1769 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1769 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
1770 | 1770 | if (defined('DB_PASSWD_CLEAR') === false) { |
1771 | 1771 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
1772 | 1772 | } |
@@ -1810,7 +1810,7 @@ discard block |
||
1810 | 1810 | if (empty($item_label) === true) { |
1811 | 1811 | $dataItem = DB::queryfirstrow( |
1812 | 1812 | 'SELECT id, id_tree, label |
1813 | - FROM ' . prefixTable('items') . ' |
|
1813 | + FROM ' . prefixTable('items').' |
|
1814 | 1814 | WHERE id = %i', |
1815 | 1815 | $item_id |
1816 | 1816 | ); |
@@ -1818,11 +1818,11 @@ discard block |
||
1818 | 1818 | } |
1819 | 1819 | |
1820 | 1820 | send_syslog( |
1821 | - 'action=' . str_replace('at_', '', $action) . |
|
1822 | - ' attribute=' . str_replace('at_', '', $attribute[0]) . |
|
1823 | - ' itemno=' . $item_id . |
|
1824 | - ' user=' . is_null($login) === true ? '' : addslashes((string) $login) . |
|
1825 | - ' itemname="' . addslashes($item_label) . '"', |
|
1821 | + 'action='.str_replace('at_', '', $action). |
|
1822 | + ' attribute='.str_replace('at_', '', $attribute[0]). |
|
1823 | + ' itemno='.$item_id. |
|
1824 | + ' user='.is_null($login) === true ? '' : addslashes((string) $login). |
|
1825 | + ' itemname="'.addslashes($item_label).'"', |
|
1826 | 1826 | $SETTINGS['syslog_host'], |
1827 | 1827 | $SETTINGS['syslog_port'], |
1828 | 1828 | 'teampass' |
@@ -1850,7 +1850,7 @@ discard block |
||
1850 | 1850 | && $action === 'at_shown' |
1851 | 1851 | ) { |
1852 | 1852 | // Load superglobal |
1853 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1853 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1854 | 1854 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1855 | 1855 | // Get superglobals |
1856 | 1856 | $globalsLastname = $superGlobal->get('lastname', 'SESSION'); |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | // Get info about item |
1860 | 1860 | $dataItem = DB::queryfirstrow( |
1861 | 1861 | 'SELECT id, id_tree, label |
1862 | - FROM ' . prefixTable('items') . ' |
|
1862 | + FROM ' . prefixTable('items').' |
|
1863 | 1863 | WHERE id = %i', |
1864 | 1864 | $item_id |
1865 | 1865 | ); |
@@ -1873,9 +1873,9 @@ discard block |
||
1873 | 1873 | 'body' => str_replace( |
1874 | 1874 | ['#tp_user#', '#tp_item#', '#tp_link#'], |
1875 | 1875 | [ |
1876 | - addslashes($globalsName . ' ' . $globalsLastname), |
|
1876 | + addslashes($globalsName.' '.$globalsLastname), |
|
1877 | 1877 | addslashes($item_label), |
1878 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id, |
|
1878 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id, |
|
1879 | 1879 | ], |
1880 | 1880 | langHdl('email_on_open_notification_mail') |
1881 | 1881 | ), |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void |
1900 | 1900 | { |
1901 | 1901 | // Load superglobal |
1902 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1902 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1903 | 1903 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1904 | 1904 | // Get superglobals |
1905 | 1905 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
@@ -1909,8 +1909,8 @@ discard block |
||
1909 | 1909 | $notification = DB::queryOneColumn( |
1910 | 1910 | 'email', |
1911 | 1911 | 'SELECT * |
1912 | - FROM ' . prefixTable('notification') . ' AS n |
|
1913 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
1912 | + FROM ' . prefixTable('notification').' AS n |
|
1913 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
1914 | 1914 | WHERE n.item_id = %i AND n.user_id != %i', |
1915 | 1915 | $item_id, |
1916 | 1916 | $globalsUserId |
@@ -1921,7 +1921,7 @@ discard block |
||
1921 | 1921 | // Get list of changes |
1922 | 1922 | $htmlChanges = '<ul>'; |
1923 | 1923 | foreach ($changes as $change) { |
1924 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
1924 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
1925 | 1925 | } |
1926 | 1926 | $htmlChanges .= '</ul>'; |
1927 | 1927 | // send email |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string |
1955 | 1955 | { |
1956 | 1956 | // Class loader |
1957 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1957 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1958 | 1958 | //Load Tree |
1959 | 1959 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
1960 | 1960 | $tree->register(); |
@@ -1963,15 +1963,15 @@ discard block |
||
1963 | 1963 | $path = ''; |
1964 | 1964 | foreach ($arbo as $elem) { |
1965 | 1965 | if (empty($path) === true) { |
1966 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
1966 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
1967 | 1967 | } else { |
1968 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
1968 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
1969 | 1969 | } |
1970 | 1970 | } |
1971 | 1971 | |
1972 | 1972 | // Build text to show user |
1973 | 1973 | if (empty($label) === false) { |
1974 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
1974 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
1975 | 1975 | } |
1976 | 1976 | return empty($path) === true ? '' : $path; |
1977 | 1977 | } |
@@ -2028,9 +2028,9 @@ discard block |
||
2028 | 2028 | */ |
2029 | 2029 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
2030 | 2030 | { |
2031 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
2031 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
2032 | 2032 | // include librairies & connect to DB |
2033 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2033 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2034 | 2034 | if (defined('DB_PASSWD_CLEAR') === false) { |
2035 | 2035 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
2036 | 2036 | } |
@@ -2043,8 +2043,8 @@ discard block |
||
2043 | 2043 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
2044 | 2044 | // perform a copy |
2045 | 2045 | if (file_exists($tp_config_file)) { |
2046 | - if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
2047 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
2046 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
2047 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
2048 | 2048 | } |
2049 | 2049 | } |
2050 | 2050 | |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | $data[1] = "global \$SETTINGS;\n"; |
2055 | 2055 | $data[2] = "\$SETTINGS = array (\n"; |
2056 | 2056 | $rows = DB::query( |
2057 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
2057 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
2058 | 2058 | 'admin' |
2059 | 2059 | ); |
2060 | 2060 | foreach ($rows as $record) { |
2061 | - array_push($data, " '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n"); |
|
2061 | + array_push($data, " '".$record['intitule']."' => '".$record['valeur']."',\n"); |
|
2062 | 2062 | } |
2063 | 2063 | array_push($data, ");\n"); |
2064 | 2064 | $data = array_unique($data); |
@@ -2072,15 +2072,15 @@ discard block |
||
2072 | 2072 | break; |
2073 | 2073 | } |
2074 | 2074 | |
2075 | - if (stristr($line, "'" . $field . "' => '")) { |
|
2076 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n"; |
|
2075 | + if (stristr($line, "'".$field."' => '")) { |
|
2076 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n"; |
|
2077 | 2077 | $bFound = true; |
2078 | 2078 | break; |
2079 | 2079 | } |
2080 | 2080 | ++$inc; |
2081 | 2081 | } |
2082 | 2082 | if ($bFound === false) { |
2083 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n"; |
|
2083 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n"; |
|
2084 | 2084 | } |
2085 | 2085 | } |
2086 | 2086 | |
@@ -2110,7 +2110,7 @@ discard block |
||
2110 | 2110 | { |
2111 | 2111 | global $SETTINGS; |
2112 | 2112 | /* LOAD CPASSMAN SETTINGS */ |
2113 | - if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
2113 | + if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) { |
|
2114 | 2114 | $SETTINGS = []; |
2115 | 2115 | $SETTINGS['duplicate_folder'] = 0; |
2116 | 2116 | //by default, this is set to 0; |
@@ -2120,7 +2120,7 @@ discard block |
||
2120 | 2120 | //by default, this value is set to 5; |
2121 | 2121 | $settings = []; |
2122 | 2122 | $rows = DB::query( |
2123 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
2123 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
2124 | 2124 | [ |
2125 | 2125 | 'type' => 'admin', |
2126 | 2126 | 'type2' => 'settings', |
@@ -2152,7 +2152,7 @@ discard block |
||
2152 | 2152 | $source_cf = []; |
2153 | 2153 | $rows = DB::QUERY( |
2154 | 2154 | 'SELECT id_category |
2155 | - FROM ' . prefixTable('categories_folders') . ' |
|
2155 | + FROM ' . prefixTable('categories_folders').' |
|
2156 | 2156 | WHERE id_folder = %i', |
2157 | 2157 | $source_id |
2158 | 2158 | ); |
@@ -2163,7 +2163,7 @@ discard block |
||
2163 | 2163 | $target_cf = []; |
2164 | 2164 | $rows = DB::QUERY( |
2165 | 2165 | 'SELECT id_category |
2166 | - FROM ' . prefixTable('categories_folders') . ' |
|
2166 | + FROM ' . prefixTable('categories_folders').' |
|
2167 | 2167 | WHERE id_folder = %i', |
2168 | 2168 | $target_id |
2169 | 2169 | ); |
@@ -2198,9 +2198,9 @@ discard block |
||
2198 | 2198 | string $password = null |
2199 | 2199 | ) { |
2200 | 2200 | // Load AntiXSS |
2201 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
2202 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
2203 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
2201 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
2202 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
2203 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
2204 | 2204 | $antiXss = new voku\helper\AntiXSS(); |
2205 | 2205 | // Protect against bad inputs |
2206 | 2206 | if (is_array($source_file) === true || is_array($target_file) === true) { |
@@ -2212,7 +2212,7 @@ discard block |
||
2212 | 2212 | $target_file = $antiXss->xss_clean($target_file); |
2213 | 2213 | if (empty($password) === true || is_null($password) === true) { |
2214 | 2214 | // get KEY to define password |
2215 | - $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
2215 | + $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
2216 | 2216 | $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
2217 | 2217 | } |
2218 | 2218 | |
@@ -2257,15 +2257,15 @@ discard block |
||
2257 | 2257 | ) { |
2258 | 2258 | // load PhpEncryption library |
2259 | 2259 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
2260 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
2261 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
2262 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
2263 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
2264 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
2265 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
2266 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
2267 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
2268 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
2260 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
2261 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
2262 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
2263 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
2264 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
2265 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
2266 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
2267 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
2268 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
2269 | 2269 | try { |
2270 | 2270 | \Defuse\Crypto\File::encryptFileWithPassword( |
2271 | 2271 | $source_file, |
@@ -2302,15 +2302,15 @@ discard block |
||
2302 | 2302 | ) { |
2303 | 2303 | // load PhpEncryption library |
2304 | 2304 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
2305 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
2306 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
2307 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
2308 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
2309 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
2310 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
2311 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
2312 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
2313 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
2305 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
2306 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
2307 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
2308 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
2309 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
2310 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
2311 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
2312 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
2313 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
2314 | 2314 | try { |
2315 | 2315 | \Defuse\Crypto\File::decryptFileWithPassword( |
2316 | 2316 | $source_file, |
@@ -2357,9 +2357,9 @@ discard block |
||
2357 | 2357 | function fileDelete(string $file, array $SETTINGS): void |
2358 | 2358 | { |
2359 | 2359 | // Load AntiXSS |
2360 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
2361 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
2362 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
2360 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
2361 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
2362 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
2363 | 2363 | $antiXss = new voku\helper\AntiXSS(); |
2364 | 2364 | $file = $antiXss->xss_clean($file); |
2365 | 2365 | if (is_file($file)) { |
@@ -2409,7 +2409,7 @@ discard block |
||
2409 | 2409 | int $dirPerm = 0755 |
2410 | 2410 | ) { |
2411 | 2411 | // Check if the path exists |
2412 | - if (! file_exists($path)) { |
|
2412 | + if (!file_exists($path)) { |
|
2413 | 2413 | return false; |
2414 | 2414 | } |
2415 | 2415 | |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | */ |
2448 | 2448 | function accessToItemIsGranted(int $item_id, array $SETTINGS) |
2449 | 2449 | { |
2450 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2450 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2451 | 2451 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
2452 | 2452 | // Prepare superGlobal variables |
2453 | 2453 | $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION'); |
@@ -2455,7 +2455,7 @@ discard block |
||
2455 | 2455 | // Load item data |
2456 | 2456 | $data = DB::queryFirstRow( |
2457 | 2457 | 'SELECT id_tree |
2458 | - FROM ' . prefixTable('items') . ' |
|
2458 | + FROM ' . prefixTable('items').' |
|
2459 | 2459 | WHERE id = %i', |
2460 | 2460 | $item_id |
2461 | 2461 | ); |
@@ -2518,7 +2518,7 @@ discard block |
||
2518 | 2518 | } |
2519 | 2519 | $host .= substr(explode(".", $email[1])[0], -1, 1); |
2520 | 2520 | } |
2521 | - $email = $name . "@" . $host . "." . explode(".", $email[1])[1]; |
|
2521 | + $email = $name."@".$host.".".explode(".", $email[1])[1]; |
|
2522 | 2522 | return $email; |
2523 | 2523 | } |
2524 | 2524 | |
@@ -2534,8 +2534,8 @@ discard block |
||
2534 | 2534 | function performDBQuery(array $SETTINGS, string $fields, string $table): array |
2535 | 2535 | { |
2536 | 2536 | // include librairies & connect to DB |
2537 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
2538 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2537 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
2538 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2539 | 2539 | if (defined('DB_PASSWD_CLEAR') === false) { |
2540 | 2540 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
2541 | 2541 | } |
@@ -2547,7 +2547,7 @@ discard block |
||
2547 | 2547 | DB::$encoding = DB_ENCODING; |
2548 | 2548 | // Insert log in DB |
2549 | 2549 | return DB::query( |
2550 | - 'SELECT ' . $fields . ' |
|
2550 | + 'SELECT '.$fields.' |
|
2551 | 2551 | FROM ' . prefixTable($table) |
2552 | 2552 | ); |
2553 | 2553 | } |
@@ -2562,11 +2562,11 @@ discard block |
||
2562 | 2562 | function formatSizeUnits(int $bytes): string |
2563 | 2563 | { |
2564 | 2564 | if ($bytes >= 1073741824) { |
2565 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
2565 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
2566 | 2566 | } elseif ($bytes >= 1048576) { |
2567 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
2567 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
2568 | 2568 | } elseif ($bytes >= 1024) { |
2569 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
2569 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
2570 | 2570 | } elseif ($bytes > 1) { |
2571 | 2571 | $bytes .= ' bytes'; |
2572 | 2572 | } elseif ($bytes === 1) { |
@@ -2775,14 +2775,14 @@ discard block |
||
2775 | 2775 | |
2776 | 2776 | // Encrypt the file content |
2777 | 2777 | $plaintext = file_get_contents( |
2778 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
2778 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
2779 | 2779 | ); |
2780 | 2780 | $ciphertext = $cipher->encrypt($plaintext); |
2781 | 2781 | // Save new file |
2782 | 2782 | $hash = md5($plaintext); |
2783 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
2783 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
2784 | 2784 | file_put_contents($fileOut, $ciphertext); |
2785 | - unlink($fileInPath . '/' . $fileInName); |
|
2785 | + unlink($fileInPath.'/'.$fileInName); |
|
2786 | 2786 | return [ |
2787 | 2787 | 'fileHash' => base64_encode($hash), |
2788 | 2788 | 'objectKey' => base64_encode($objectKey), |
@@ -2800,7 +2800,7 @@ discard block |
||
2800 | 2800 | */ |
2801 | 2801 | function decryptFile(string $fileName, string $filePath, string $key): string |
2802 | 2802 | { |
2803 | - if (! defined('FILE_BUFFER_SIZE')) { |
|
2803 | + if (!defined('FILE_BUFFER_SIZE')) { |
|
2804 | 2804 | define('FILE_BUFFER_SIZE', 128 * 1024); |
2805 | 2805 | } |
2806 | 2806 | |
@@ -2819,7 +2819,7 @@ discard block |
||
2819 | 2819 | $cipher->enableContinuousBuffer(); |
2820 | 2820 | $cipher->disablePadding(); |
2821 | 2821 | // Get file content |
2822 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
2822 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
2823 | 2823 | // Decrypt file content and return |
2824 | 2824 | return base64_encode($cipher->decrypt($ciphertext)); |
2825 | 2825 | } |
@@ -2873,8 +2873,8 @@ discard block |
||
2873 | 2873 | array $SETTINGS |
2874 | 2874 | ): void { |
2875 | 2875 | // include librairies & connect to DB |
2876 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
2877 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2876 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
2877 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
2878 | 2878 | if (defined('DB_PASSWD_CLEAR') === false) { |
2879 | 2879 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
2880 | 2880 | } |
@@ -2891,7 +2891,7 @@ discard block |
||
2891 | 2891 | $post_object_id |
2892 | 2892 | ); |
2893 | 2893 | // Superglobals |
2894 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2894 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2895 | 2895 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
2896 | 2896 | // Prepare superGlobal variables |
2897 | 2897 | $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION'); |
@@ -2916,8 +2916,8 @@ discard block |
||
2916 | 2916 | // Create sharekey for each user |
2917 | 2917 | $users = DB::query( |
2918 | 2918 | 'SELECT id, public_key |
2919 | - FROM ' . prefixTable('users') . ' |
|
2920 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
2919 | + FROM ' . prefixTable('users').' |
|
2920 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
2921 | 2921 | AND public_key != ""' |
2922 | 2922 | ); |
2923 | 2923 | foreach ($users as $user) { |
@@ -2947,7 +2947,7 @@ discard block |
||
2947 | 2947 | function isBase64(string $str): bool |
2948 | 2948 | { |
2949 | 2949 | $str = (string) trim($str); |
2950 | - if (! isset($str[0])) { |
|
2950 | + if (!isset($str[0])) { |
|
2951 | 2951 | return false; |
2952 | 2952 | } |
2953 | 2953 | |
@@ -3015,13 +3015,13 @@ discard block |
||
3015 | 3015 | ], |
3016 | 3016 | ]; |
3017 | 3017 | // Load expected libraries |
3018 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
3019 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
3020 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
3021 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
3022 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
3023 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
3024 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
3018 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
3019 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
3020 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
3021 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
3022 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
3023 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
3024 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
3025 | 3025 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
3026 | 3026 | $ad->register(); |
3027 | 3027 | $connection = new Connection($config); |
@@ -3030,7 +3030,7 @@ discard block |
||
3030 | 3030 | $connection->connect(); |
3031 | 3031 | } catch (\LdapRecord\Auth\BindException $e) { |
3032 | 3032 | $error = $e->getDetailedError(); |
3033 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
3033 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
3034 | 3034 | return false; |
3035 | 3035 | } |
3036 | 3036 | |
@@ -3043,7 +3043,7 @@ discard block |
||
3043 | 3043 | } |
3044 | 3044 | } catch (\LdapRecord\Auth\BindException $e) { |
3045 | 3045 | $error = $e->getDetailedError(); |
3046 | - echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(); |
|
3046 | + echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(); |
|
3047 | 3047 | return false; |
3048 | 3048 | } |
3049 | 3049 | |
@@ -3061,8 +3061,8 @@ discard block |
||
3061 | 3061 | function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool |
3062 | 3062 | { |
3063 | 3063 | // include librairies & connect to DB |
3064 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
3065 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
3064 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
3065 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
3066 | 3066 | if (defined('DB_PASSWD_CLEAR') === false) { |
3067 | 3067 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
3068 | 3068 | } |
@@ -3120,7 +3120,7 @@ discard block |
||
3120 | 3120 | foreach (DateTimeZone::listIdentifiers() as $timezone) { |
3121 | 3121 | $now->setTimezone(new DateTimeZone($timezone)); |
3122 | 3122 | $offsets[] = $offset = $now->getOffset(); |
3123 | - $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); |
|
3123 | + $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone); |
|
3124 | 3124 | } |
3125 | 3125 | |
3126 | 3126 | array_multisort($offsets, $timezones); |
@@ -3140,7 +3140,7 @@ discard block |
||
3140 | 3140 | { |
3141 | 3141 | $hours = intval($offset / 3600); |
3142 | 3142 | $minutes = abs(intval($offset % 3600 / 60)); |
3143 | - return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
3143 | + return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); |
|
3144 | 3144 | } |
3145 | 3145 | |
3146 | 3146 | /** |