Passed
Push — teampass_3.0 ( 7211f6...156bc8 )
by Nils
08:39
created
sources/identify.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     // Get DUO keys
96 96
     $duoData = DB::query(
97 97
         'SELECT intitule, valeur
98
-        FROM ' . prefixTable('misc') . '
98
+        FROM ' . prefixTable('misc').'
99 99
         WHERE type = %s',
100 100
         'duoSecurity'
101 101
     );
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     // load library
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
109 109
     $sig_request = Duo::signRequest(
110 110
         $_GLOBALS['IKEY'],
111 111
         $_GLOBALS['SKEY'],
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
         debugIdentify(
117 117
             DEBUGDUO,
118 118
             DEBUGDUOFILE,
119
-            "\n\n-----\n\n" .
120
-                'sig request : ' . $post_login . "\n" .
121
-                'resp : ' . $sig_request . "\n"
119
+            "\n\n-----\n\n".
120
+                'sig request : '.$post_login."\n".
121
+                'resp : '.$sig_request."\n"
122 122
         );
123 123
     }
124 124
 
125 125
     // load csrfprotector
126
-    $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php';
126
+    $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php';
127 127
     // return result
128
-    echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]';
128
+    echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]';
129 129
 // ---
130 130
     // ---
131 131
 } elseif ($post_type === 'identify_duo_user_check') {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     //--------
136 136
 
137 137
     // load library
138
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
138
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
139 139
     $authenticated_username = Duo::verifyResponse(
140 140
         $SETTINGS['duo_ikey'],
141 141
         $SETTINGS['duo_skey'],
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
         debugIdentify(
147 147
             DEBUGDUO,
148 148
             DEBUGDUOFILE,
149
-            "\n\n-----\n\n" .
150
-                'sig response : ' . $post_sig_response . "\n" .
151
-                'resp : ' . $authenticated_username . "\n"
149
+            "\n\n-----\n\n".
150
+                'sig response : '.$post_sig_response."\n".
151
+                'resp : '.$authenticated_username."\n"
152 152
         );
153 153
     }
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // is user in Teampass?
160 160
             DB::queryfirstrow(
161 161
                 'SELECT id
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $post_login
165 165
             );
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
             }
170 170
         }
171 171
 
172
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
172
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
173 173
     } else {
174
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
174
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
175 175
     }
176 176
     // ---
177 177
     // ---
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 
199 199
     // Load superGlobals
200
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
200
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
201 201
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
202 202
     // Prepare GET variables
203 203
     $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
     } else {
286 286
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
287 287
     }
288
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
289
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
290
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
288
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
289
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
290
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
291 291
     
292 292
     header('Content-type: text/html; charset=utf-8');
293 293
     error_reporting(E_ERROR);
294 294
 
295 295
     // Load AntiXSS
296
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
296
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
297 297
     $antiXss = new voku\helper\AntiXSS();
298 298
 
299 299
     // Load superGlobals
300
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
300
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
301 301
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
302 302
 
303 303
     // Prepare GET variables
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER');
312 312
 
313 313
     // connect to the server
314
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
314
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
315 315
     DB::$host = DB_HOST;
316 316
     DB::$user = DB_USER;
317 317
     DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     DB::$port = DB_PORT;
320 320
     DB::$encoding = DB_ENCODING;
321 321
     // User's language loading
322
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
322
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
323 323
     
324 324
     // decrypt and retreive data in JSON format
325 325
     if (empty($sessionKey) === true) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
         //$arrAttempts = array();
448 448
         $rows = DB::query(
449 449
             'SELECT date
450
-            FROM ' . prefixTable('log_system') . "
450
+            FROM ' . prefixTable('log_system')."
451 451
             WHERE field_1 = %s
452 452
             AND type = 'failed_auth'
453 453
             AND label = 'user_password_not_correct'
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
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
         }
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $superGlobal->put('user_upgrade_needed', $userInfo['upgrade_needed'], 'SESSION');
500 500
         $superGlobal->put('user_force_relog', $userInfo['force-relog'], 'SESSION');
501 501
         // get personal settings
502
-        if (! isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) {
502
+        if (!isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) {
503 503
             $userInfo['treeloadstrategy'] = 'full';
504 504
         }
505 505
         $superGlobal->put('treeloadstrategy', $userInfo['treeloadstrategy'], 'SESSION', 'user');
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         foreach ($superGlobal->get('user_roles', 'SESSION') as $role) {
602 602
             $resRoles = DB::queryFirstRow(
603 603
                 'SELECT title, complexity
604
-                FROM ' . prefixTable('roles_title') . '
604
+                FROM ' . prefixTable('roles_title').'
605 605
                 WHERE id=%i',
606 606
                 $role
607 607
             );
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
         // build complete array of roles
624 624
         $superGlobal->put('arr_roles_full', [], 'SESSION');
625
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
625
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
626 626
         foreach ($rows as $record) {
627 627
             $superGlobal->put(
628 628
                 $record['id'],
@@ -713,10 +713,10 @@  discard block
 block discarded – undo
713 713
         $superGlobal->put('latest_items_tab', [], 'SESSION');
714 714
         $superGlobal->put('nb_roles', 0, 'SESSION');
715 715
         foreach ($superGlobal->get('latest_items', 'SESSION') as $item) {
716
-            if (! empty($item)) {
716
+            if (!empty($item)) {
717 717
                 $dataLastItems = DB::queryFirstRow(
718 718
                     'SELECT id,label,id_tree
719
-                    FROM ' . prefixTable('items') . '
719
+                    FROM ' . prefixTable('items').'
720 720
                     WHERE id=%i',
721 721
                     $item
722 722
                 );
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                     [
726 726
                         'id' => $item,
727 727
                         'label' => $dataLastItems['label'],
728
-                        'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item,
728
+                        'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item,
729 729
                     ],
730 730
                     'SESSION',
731 731
                     'latest_items_tab'
@@ -742,12 +742,12 @@  discard block
 block discarded – undo
742 742
         ) {
743 743
             // get all Admin users
744 744
             $receivers = '';
745
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
745
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
746 746
             foreach ($rows as $record) {
747 747
                 if (empty($receivers)) {
748 748
                     $receivers = $record['email'];
749 749
                 } else {
750
-                    $receivers = ',' . $record['email'];
750
+                    $receivers = ','.$record['email'];
751 751
                 }
752 752
             }
753 753
             // Add email to table
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
                             '#tp_time#',
764 764
                         ],
765 765
                         [
766
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
766
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
767 767
                             date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
768 768
                             date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
769 769
                         ],
@@ -977,44 +977,44 @@  discard block
 block discarded – undo
977 977
         ],
978 978
     ];
979 979
     // Load expected libraries
980
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
981
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
982
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
983
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
984
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
985
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
986
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
987
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
988
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
989
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
990
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
991
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
992
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
993
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
994
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
995
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
996
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
997
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
998
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
999
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
1000
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
1001
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
1002
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
1003
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
1004
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
1005
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
1006
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1007
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1008
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1009
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1010
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1011
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1012
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1013
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1014
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1015
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1016
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
1017
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
980
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
981
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
982
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
983
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
984
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
985
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
986
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
987
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
988
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
989
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
990
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
991
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
992
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
993
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
994
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
995
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
996
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
997
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
998
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
999
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
1000
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
1001
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
1002
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
1003
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
1004
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
1005
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
1006
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1007
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1008
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1009
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1010
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1011
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1012
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1013
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1014
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1015
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1016
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
1017
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1018 1018
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1019 1019
     $ad->register();
1020 1020
     $connection = new Connection($config);
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
         $error = $e->getDetailedError();
1027 1027
         return [
1028 1028
             'error' => true,
1029
-            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1029
+            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1030 1030
 
1031 1031
         ];
1032 1032
     }
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
     }
1055 1055
 
1056 1056
     // load passwordLib library
1057
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1057
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1058 1058
     $pwdlib->register();
1059 1059
     $pwdlib = new PasswordLib\PasswordLib();
1060 1060
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array
1120 1120
 {
1121 1121
     // Load superGlobals
1122
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1122
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1123 1123
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1124 1124
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1125 1125
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
     }
1159 1159
 
1160 1160
     // Now check yubico validity
1161
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1161
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1162 1162
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1163 1163
     $auth = $yubi->verify($yubico_key);
1164 1164
     //, null, null, null, 60
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
             'gestionnaire' => '0',
1211 1211
             'can_manage_all_users' => '0',
1212 1212
             'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0',
1213
-            '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'),
1213
+            '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'),
1214 1214
             'groupes_interdits' => '',
1215 1215
             'groupes_visibles' => '',
1216 1216
             'last_pw_change' => (int) time(),
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
             ]
1236 1236
         );
1237 1237
         // Rebuild tree
1238
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1238
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1239 1239
         $tree->register();
1240 1240
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1241 1241
         $tree->rebuild();
@@ -1266,13 +1266,13 @@  discard block
 block discarded – undo
1266 1266
         && empty($dataReceived['GACode']) === false
1267 1267
     ) {
1268 1268
         // Load superGlobals
1269
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1269
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1270 1270
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1271 1271
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1272 1272
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
1273 1273
         $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1274 1274
         // load library
1275
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1275
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1276 1276
         // create new instance
1277 1277
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
1278 1278
         // Init
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
             $mfaMessage = langHdl('ga_flash_qr_and_login');
1295 1295
             // generate new QR
1296 1296
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1297
-                'Teampass - ' . $username,
1297
+                'Teampass - '.$username,
1298 1298
                 $userInfo['ga']
1299 1299
             );
1300 1300
             // clear temporary code from DB
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                 $userInfo['id']
1308 1308
             );
1309 1309
             $firstTime = [
1310
-                'value' => '<img src="' . $new_2fa_qr . '">',
1310
+                'value' => '<img src="'.$new_2fa_qr.'">',
1311 1311
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1312 1312
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1313 1313
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1359,8 +1359,8 @@  discard block
 block discarded – undo
1359 1359
     // Set to false
1360 1360
     $userPasswordVerified = false;
1361 1361
     // load passwordLib library
1362
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1363
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1362
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1363
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1364 1364
     $pwdlib->register();
1365 1365
     $pwdlib = new PasswordLib\PasswordLib();
1366 1366
     // Check if old encryption used
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
     // Brute force management
1492 1492
     if ($sessionPwdAttempts > 3) {
1493 1493
         // Load superGlobals
1494
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1494
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1495 1495
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1496 1496
         $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION');
1497 1497
         $superGlobal->put('pwd_attempts', 0, 'SESSION');
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
     // Check if user exists
1534 1534
     $userInfo = DB::queryFirstRow(
1535 1535
         'SELECT *
1536
-        FROM ' . prefixTable('users') . ' WHERE login=%s',
1536
+        FROM ' . prefixTable('users').' WHERE login=%s',
1537 1537
         $username
1538 1538
     );
1539 1539
     
Please login to merge, or discard this patch.
includes/core/load.js.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                                     console.log('User has to regenerate keys')
118 118
                                     // HIde
119 119
                                     $('.content-header, .content').addClass('hidden');
120
-                                    $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected');?>');
120
+                                    $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected'); ?>');
121 121
 
122 122
                                     // Show passwords inputs and form
123 123
                                     $('#dialog-user-temporary-code').removeClass('hidden');
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
                                     // Show passwords inputs and form
133 133
                                     $('#dialog-user-change-password-info')
134
-                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('user_has_to_change_password_info');?>')
134
+                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('user_has_to_change_password_info'); ?>')
135 135
                                         .removeClass('hidden');
136 136
                                     $('#dialog-user-change-password').removeClass('hidden');
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
                                     // Show passwords inputs and form
146 146
                                     $('#dialog-ldap-user-change-password-info')
147
-                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('ldap_user_has_changed_his_password');?>')
147
+                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('ldap_user_has_changed_his_password'); ?>')
148 148
                                         .removeClass('hidden');
149 149
                                     $('#dialog-ldap-user-change-password').removeClass('hidden');
150 150
                                     
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         console.log('User has to regenerate keys')
219 219
         // HIde
220 220
         $('.content-header, .content').addClass('hidden');
221
-        $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected');?>');
221
+        $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected'); ?>');
222 222
 
223 223
         // Show passwords inputs and form
224 224
         $('#dialog-user-temporary-code').removeClass('hidden');
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             {
297 297
                 if (step === 'psk') {
298 298
                     // Inform user
299
-                    $("#user-current-defuse-psk-progress").html('<b><?php echo langHdl('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' +
299
+                    $("#user-current-defuse-psk-progress").html('<b><?php echo langHdl('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' +
300 300
                         '... <?php echo langHdl('please_wait'); ?><i class="fas fa-spinner fa-pulse ml-3 text-primary"></i>');
301 301
 
302 302
                     var data = {'userPsk' : $('#user-current-defuse-psk').val()};
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         "sources/main.queries.php", {
306 306
                             type: "user_psk_reencryption",
307 307
                             'start': start,
308
-                            'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
308
+                            'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
309 309
                             userId: userId,
310 310
                             data: prepareExchangedData(JSON.stringify(data), "encode", "<?php echo $_SESSION['key']; ?>"),
311 311
                             key: '<?php echo $_SESSION['key']; ?>'
@@ -794,15 +794,15 @@  discard block
 block discarded – undo
794 794
             // Prepare data
795 795
             var data = {
796 796
                 'receipt': $('#temp-user-email').val(),
797
-                'subject': '[Teampass] <?php echo langHdl('temporary_encryption_code');?>',
798
-                'body': '<?php echo langHdl('email_body_temporary_encryption_code');?>',
797
+                'subject': '[Teampass] <?php echo langHdl('temporary_encryption_code'); ?>',
798
+                'body': '<?php echo langHdl('email_body_temporary_encryption_code'); ?>',
799 799
                 'pre_replace' : {
800 800
                     '#enc_code#' : $('#temp-user-pwd').val(),
801 801
                 }
802 802
             }
803 803
 
804 804
             // Prepare form
805
-            $('#dialog-admin-change-user-password-info').html('<?php echo langHdl('sending_email_message');?>');
805
+            $('#dialog-admin-change-user-password-info').html('<?php echo langHdl('sending_email_message'); ?>');
806 806
 
807 807
             // Launch action
808 808
             $.post(
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
             '#warningModal',
1267 1267
             '<i class="fas fa-clock fa-lg warning mr-2"></i><?php echo langHdl('index_add_one_hour'); ?>',
1268 1268
             '<div class="form-group">' +
1269
-            '<label for="warningModal-input" class="col-form-label"><?php echo langHdl('index_session_duration') . ' (' . langHdl('minutes') . ')'; ?>:</label>' +
1269
+            '<label for="warningModal-input" class="col-form-label"><?php echo langHdl('index_session_duration').' ('.langHdl('minutes').')'; ?>:</label>' +
1270 1270
             '<input type="text" class="form-control" id="warningModal-input" value="<?php echo isset($_SESSION['user']['session_duration']) === true ? (int) $_SESSION['user']['session_duration'] / 60 : 60; ?>">' +
1271 1271
             '</div>',
1272 1272
             '<?php echo langHdl('confirm'); ?>',
@@ -1518,13 +1518,13 @@  discard block
 block discarded – undo
1518 1518
         if (step !== 'finished') {
1519 1519
             // Inform user
1520 1520
             $("#"+divIdDialog+'-progress').html('<b><?php echo langHdl('encryption_keys'); ?> - ' +
1521
-                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' +
1521
+                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' +
1522 1522
                 '... <?php echo langHdl('please_wait'); ?><i class="fas fa-spinner fa-pulse ml-3 text-primary"></i>');
1523 1523
 
1524 1524
             var data = {
1525 1525
                 'action': step,
1526 1526
                 'start': start,
1527
-                'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
1527
+                'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
1528 1528
                 'user_id': userId,
1529 1529
             }
1530 1530
             // Do query
Please login to merge, or discard this patch.
pages/users.js.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
         if (store.get('teampassApplication').formUserAction === "add_new_user") {
276 276
             var data = {
277 277
                 'receipt': $('#form-email').val(),
278
-                'subject': 'TEAMPASS - <?php echo langHdl('temporary_encryption_code');?>',
279
-                'body': '<?php echo langHdl('email_body_new_user');?>',
278
+                'subject': 'TEAMPASS - <?php echo langHdl('temporary_encryption_code'); ?>',
279
+                'body': '<?php echo langHdl('email_body_new_user'); ?>',
280 280
                 'pre_replace' : {
281 281
                     '#code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
282 282
                     '#login#' : store.get('teampassUser').admin_new_user_login,
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
         } else {
287 287
             var data = {
288 288
                 'receipt': $('#form-email').val(),
289
-                'subject': 'TEAMPASS - <?php echo langHdl('temporary_encryption_code');?>',
290
-                'body': '<?php echo langHdl('email_body_temporary_encryption_code');?>',
289
+                'subject': 'TEAMPASS - <?php echo langHdl('temporary_encryption_code'); ?>',
290
+                'body': '<?php echo langHdl('email_body_temporary_encryption_code'); ?>',
291 291
                 'pre_replace' : {
292 292
                     '#enc_code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
293 293
                 }
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
         if (step !== 'finished') {
459 459
             // Inform user
460 460
             $("#warningModalBody").html('<b><?php echo langHdl('encryption_keys'); ?> - ' +
461
-                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + ']<span id="warningModalBody_extra"></span> ' +
461
+                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + ']<span id="warningModalBody_extra"></span> ' +
462 462
                 '... <?php echo langHdl('please_wait'); ?><i class="fas fa-spinner fa-pulse ml-3 text-primary"></i>');
463 463
 
464 464
             var data = {
465 465
                 action: step,
466 466
                 start: start,
467
-                length: <?php echo NUMBER_ITEMS_IN_BATCH;?>,
467
+                length: <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
468 468
                 user_id: userId,
469 469
             }
470 470
 
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
                         } else {
1202 1202
                             // Show icon or not
1203 1203
                             if ($('#user-disabled').prop('checked') === true) {
1204
-                                $('#user-login-'+userID).before('<i class="fas fa-user-slash infotip text-danger mr-2" title="<?php echo langHdl('account_is_locked');?>" id="user-disable-'+userID+'"></i>');
1204
+                                $('#user-login-'+userID).before('<i class="fas fa-user-slash infotip text-danger mr-2" title="<?php echo langHdl('account_is_locked'); ?>" id="user-disable-'+userID+'"></i>');
1205 1205
                             } else {
1206 1206
                                 $('#user-disable-'+userID).remove();
1207 1207
                             }
@@ -2046,12 +2046,12 @@  discard block
 block discarded – undo
2046 2046
                         if (step !== 'finished') {
2047 2047
                             // Inform user
2048 2048
                             $("#warningModal-progress").html('<b><?php echo langHdl('encryption_keys'); ?> - ' +
2049
-                                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + ']');
2049
+                                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + ']');
2050 2050
 
2051 2051
                             var data = {
2052 2052
                                 'action': step,
2053 2053
                                 'start': start,
2054
-                                'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
2054
+                                'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
2055 2055
                                 userId: userId,
2056 2056
                             }
2057 2057
                             // Do query
Please login to merge, or discard this patch.