Passed
Push — master ( 200b53...7a7b23 )
by Nils
05:13
created
pages/admin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // Load template
45
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
45
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
46 46
 /* do checks */
47
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
47
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
48 48
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'admin', $SETTINGS) === false) {
49 49
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
                     <div class="card-body">
187 187
                         <?php
188 188
                         // Display information about server
189
-                        $dbSize = DB::queryFirstRow("SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'size' FROM information_schema.TABLES WHERE table_schema = '" . DB_NAME . "'");
189
+                        $dbSize = DB::queryFirstRow("SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'size' FROM information_schema.TABLES WHERE table_schema = '".DB_NAME."'");
190 190
                         echo 
191
-                        '<p><i class="fa-brands fa-php mr-2"></i>PHP version: ' . phpversion().
191
+                        '<p><i class="fa-brands fa-php mr-2"></i>PHP version: '.phpversion().
192 192
                             '<br><span class="ml-4">Memory limit: '.(ini_get('memory_limit')).'</span>'.
193 193
                             '<br><span class="ml-4">Memory usage: '.formatSizeUnits(memory_get_usage()).'</span>'.
194 194
                             '<br><span class="ml-4">Maximum time execution: '.ini_get('max_execution_time').'</span>'.
195 195
                             '<br><span class="ml-4">Maximum file size upload: '.ini_get('upload_max_filesize').'</span>'.
196 196
                         '</p>'.
197
-                        '<p><i class="fa-solid fa-server mr-2"></i>Server version: ' . DB::serverVersion().
197
+                        '<p><i class="fa-solid fa-server mr-2"></i>Server version: '.DB::serverVersion().
198 198
                             '<br><span class="ml-4">Database size: '.($dbSize['size']).'MB</span>'.
199 199
                         '</p>';
200 200
                         ?>
Please login to merge, or discard this patch.
pages/search.js.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@
 block discarded – undo
2 2
 
3 3
 declare(strict_types=1);
4 4
 
5
- /**
6
-  * Teampass - a collaborative passwords manager.
7
-  * ---
8
-  * This library is distributed in the hope that it will be useful,
9
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
-  * ---
12
-  *
13
-  * @project   Teampass
14
- * @version   3.0.5
15
-  *
16
-  * @file      search.js.php
17
-  * ---
18
-  *
19
-  * @author    Nils LaumaillĂ© ([email protected])
20
-  *
21
-  * @copyright 2009-2023 Teampass.net
22
-  *
23
-  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
24
-  * ---
25
-  *
26
-  * @see       https://www.teampass.net
27
-  */
28
-
29
- $var = [];
5
+    /**
6
+     * Teampass - a collaborative passwords manager.
7
+     * ---
8
+     * This library is distributed in the hope that it will be useful,
9
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
+     * ---
12
+     *
13
+     * @project   Teampass
14
+     * @version   3.0.5
15
+     *
16
+     * @file      search.js.php
17
+     * ---
18
+     *
19
+     * @author    Nils LaumaillĂ© ([email protected])
20
+     *
21
+     * @copyright 2009-2023 Teampass.net
22
+     *
23
+     * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
24
+     * ---
25
+     *
26
+     * @see       https://www.teampass.net
27
+     */
28
+
29
+    $var = [];
30 30
 $var['hidden_asterisk'] = '<i class="fas fa-asterisk mr-2"></i><i class="fas fa-asterisk mr-2"></i><i class="fas fa-asterisk mr-2"></i><i class="fas fa-asterisk mr-2"></i><i class="fas fa-asterisk"></i>';
31 31
 
32 32
 ?>
Please login to merge, or discard this patch.
includes/core/login.php 1 patch
Spacing   +31 added lines, -32 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
39 39
 $get = [];
40 40
 $get['post_type'] = $superGlobal->get('post_type', 'GET');
41
-if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo' ) {
41
+if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo') {
42 42
     $get['duo_state'] = $superGlobal->get('state', 'GET');
43 43
     $get['duo_code'] = $superGlobal->get('duo_code', 'GET');
44 44
 }
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
 <div class="login-box">
49 49
     <div class="login-logo"><div style="margin:30px;">',
50 50
     isset($SETTINGS['custom_logo']) === true && empty($SETTINGS['custom_logo']) === false ?
51
-        '<img src="' . (string) $SETTINGS['custom_logo'] . '" alt="" style="text-align:center; max-width:100px;" />' :
52
-        '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">',
51
+        '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="text-align:center; max-width:100px;" />' : '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">',
53 52
         '
54 53
         </div>
55 54
         <div style="font-weight:bold;">
@@ -76,7 +75,7 @@  discard block
 block discarded – undo
76 75
     isset($SETTINGS['enable_http_request_login']) === true
77 76
     && (int) $SETTINGS['enable_http_request_login'] === 1
78 77
     && $superGlobal('PHP_AUTH_USER', 'SERVER') !== null
79
-    && ! (isset($SETTINGS['maintenance_mode']) === true
78
+    && !(isset($SETTINGS['maintenance_mode']) === true
80 79
         && (int) $SETTINGS['maintenance_mode'] === 1)
81 80
 ) {
82 81
     if (strpos($superGlobal('PHP_AUTH_USER', 'SERVER'), '@') !== false) {
@@ -90,22 +89,22 @@  discard block
 block discarded – undo
90 89
             <input type="text" id="login" class="form-control" placeholder="', filter_var($username, FILTER_SANITIZE_FULL_SPECIAL_CHARS), '" readonly>';
91 90
 } else {
92 91
     echo '
93
-            <input type="text" id="login" class="form-control" placeholder="' . langHdl('index_login') . '">';
92
+            <input type="text" id="login" class="form-control" placeholder="' . langHdl('index_login').'">';
94 93
 }
95 94
 
96 95
 echo '
97 96
         </div>';
98
-if (! (isset($SETTINGS['enable_http_request_login']) === true
97
+if (!(isset($SETTINGS['enable_http_request_login']) === true
99 98
     && (int) $SETTINGS['enable_http_request_login'] === 1
100 99
     && $superGlobal('PHP_AUTH_USER', 'SERVER') !== null
101
-    && ! (isset($SETTINGS['maintenance_mode']) === true
100
+    && !(isset($SETTINGS['maintenance_mode']) === true
102 101
         && (int) $SETTINGS['maintenance_mode'] === 1))) {
103 102
     echo '
104 103
         <div class="input-group has-feedback mb-2">
105 104
             <div class="input-group-prepend">
106 105
                 <span class="input-group-text"><i class="fas fa-lock fa-fw"></i></span>
107 106
             </div>
108
-            <input type="password" id="pw" class="form-control submit-button" placeholder="' . langHdl('index_password') . '">
107
+            <input type="password" id="pw" class="form-control submit-button" placeholder="' . langHdl('index_password').'">
109 108
         </div>';
110 109
 }
111 110
 
@@ -115,7 +114,7 @@  discard block
 block discarded – undo
115 114
                 <span class="input-group-text"><i class="fas fa-clock fa-fw"></i></span>
116 115
             </div>
117 116
             <input type="text" id="session_duration" class="form-control submit-button" 
118
-            placeholder="' . langHdl('index_session_duration') .'&nbsp;(' . langHdl('minutes') . ')" 
117
+            placeholder="' . langHdl('index_session_duration').'&nbsp;('.langHdl('minutes').')" 
119 118
             value="', isset($SETTINGS['default_session_expiration_time']) === true ? $SETTINGS['default_session_expiration_time'] : '', '">
120 119
         </div>';
121 120
 // 2FA auth selector
@@ -125,7 +124,7 @@  discard block
 block discarded – undo
125 124
         <input type="hidden" id="duo_state" value="', isset($get['duo_state']) === true && is_null($get['duo_state']) === false ? $get['duo_state'] : '', '">
126 125
         <div class="row mb-3 hidden" id="2fa_methods_selector">
127 126
             <div class="col-12">
128
-                <h8 class="login-box-msg">' . langHdl('2fa_authentication_selector') . '</h8>
127
+                <h8 class="login-box-msg">' . langHdl('2fa_authentication_selector').'</h8>
129 128
                 <div class="2fa-methods text-center mt-2">',
130 129
     isset($SETTINGS['google_authentication']) === true && (int) $SETTINGS['google_authentication'] === 1 ?
131 130
         '
@@ -169,11 +168,11 @@  discard block
 block discarded – undo
169 168
                 <div class="col-1">
170 169
                 </div>
171 170
                 <div class="col-8">
172
-                    <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . langHdl('ga_identification_code') . '" />
171
+                    <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . langHdl('ga_identification_code').'" />
173 172
                 </div>
174 173
                 <div class="col-1">
175 174
                     <i class="fas fa-envelope form-control-feedback pointer infotip text-info" 
176
-                    title="' . langHdl('i_need_to_generate_new_ga_code') . '" onclick="send_user_new_temporary_ga_code()"></i>
175
+                    title="' . langHdl('i_need_to_generate_new_ga_code').'" onclick="send_user_new_temporary_ga_code()"></i>
177 176
                 </div>
178 177
             </div>
179 178
             <div id="div-2fa-google-qr" class="row mt-2 "></div>
@@ -190,7 +189,7 @@  discard block
 block discarded – undo
190 189
 <script>
191 190
 var seconds = 1;
192 191
 function updateLogonButton(timeToGo){
193
-    document.getElementById("but_identify_user").value = "' . langHdl('duration_login_attempt') . ' " + timeToGo;
192
+    document.getElementById("but_identify_user").value = "' . langHdl('duration_login_attempt').' " + timeToGo;
194 193
 }
195 194
 $( window ).on( "load", function() {
196 195
     updateLogonButton(seconds);
@@ -199,7 +198,7 @@  discard block
 block discarded – undo
199 198
         if (seconds >= 0) {
200 199
             updateLogonButton(seconds);
201 200
         } else if(seconds === 0) {
202
-            launchIdentify("", "' . $nextUrl . '");
201
+            launchIdentify("", "' . $nextUrl.'");
203 202
         }
204 203
         updateLogonButton(seconds);
205 204
     },
@@ -220,15 +219,15 @@  discard block
 block discarded – undo
220 219
             <div class="col-8">
221 220
                 <div id="yubiko-new-key" class="alert alert-info hidden">
222 221
                     <p>
223
-                        <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . langHdl('yubico_user_id') . '">
222
+                        <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . langHdl('yubico_user_id').'">
224 223
                     </p>
225 224
                     <p>
226
-                    <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . langHdl('yubico_user_key') . '">
225
+                    <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . langHdl('yubico_user_key').'">
227 226
                     </p>
228 227
                 </div>
229
-                <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . langHdl('press_your_yubico_key') . '">
228
+                <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . langHdl('press_your_yubico_key').'">
230 229
                 <div class="row">
231
-                    <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . langHdl('register_new_yubiko_key') . '</span>
230
+                    <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . langHdl('register_new_yubiko_key').'</span>
232 231
                 </div>
233 232
             </div>
234 233
         </div>';
@@ -237,22 +236,22 @@  discard block
 block discarded – undo
237 236
 echo '
238 237
         <div class="row mb-3 mt-5">
239 238
             <div class="col-12">
240
-                <button id="but_identify_user" class="btn btn-primary btn-block">' . langHdl('log_in') . '</button>
239
+                <button id="but_identify_user" class="btn btn-primary btn-block">' . langHdl('log_in').'</button>
241 240
                 
242 241
                 <!-- In case of upgrade, the user has to provide his One Time Code -->
243 242
                 <div class="card-body user-one-time-code-card-body hidden">
244
-                    <h5 class="login-box-msg">' . langHdl('provide_personal_one_time_code') . '</h5>
243
+                    <h5 class="login-box-msg">' . langHdl('provide_personal_one_time_code').'</h5>
245 244
 
246 245
                     <div class="input-group has-feedback mb-2 mt-4">
247 246
                         <div class="input-group-prepend">
248 247
                             <span class="input-group-text"><i class="fas fa-unlock-alt"></i></span>
249 248
                         </div>
250
-                        <input type="password" id="user-one-time-code" class="form-control" placeholder="' . langHdl('one_time_code') . '">
249
+                        <input type="password" id="user-one-time-code" class="form-control" placeholder="' . langHdl('one_time_code').'">
251 250
                     </div>
252 251
 
253 252
                     <div class="row mb-3">
254 253
                         <div class="col-12">
255
-                            <button id="but_confirm_otc" class="btn btn-primary btn-block">' . langHdl('confirm') . '</button>
254
+                            <button id="but_confirm_otc" class="btn btn-primary btn-block">' . langHdl('confirm').'</button>
256 255
                         </div>
257 256
                     </div>
258 257
                 </div>
@@ -267,10 +266,10 @@  discard block
 block discarded – undo
267 266
 // In case of password change
268 267
 echo '
269 268
     <div class="card-body confirm-password-card-body hidden">
270
-        <h5 class="login-box-msg">' . langHdl('new_password_required') . '</h5>
269
+        <h5 class="login-box-msg">' . langHdl('new_password_required').'</h5>
271 270
 
272 271
         <div class="alert alert-info">
273
-            <div class="text-center"><i class="icon fa fa-info"></i>' . langHdl('password_strength') . '
272
+            <div class="text-center"><i class="icon fa fa-info"></i>' . langHdl('password_strength').'
274 273
             <span id="confirm-password-level" class="ml-2 font-weight-bold"></span></div>
275 274
         </div>
276 275
 
@@ -280,20 +279,20 @@  discard block
 block discarded – undo
280 279
                     <div class="input-group-prepend">
281 280
                         <span class="input-group-text"><i class="fa fa-key"></i></span>
282 281
                     </div>
283
-                    <input type="password" id="current-user-password" class="form-control" placeholder="' . langHdl('current_password') . '">
282
+                    <input type="password" id="current-user-password" class="form-control" placeholder="' . langHdl('current_password').'">
284 283
                 </div>
285 284
             </div>
286 285
             <div class="input-group has-feedback mb-2 mt-4">
287 286
                 <div class="input-group-prepend">
288 287
                     <span class="input-group-text"><i class="fa fa-key"></i></span>
289 288
                 </div>
290
-                <input type="password" id="new-user-password" class="form-control" placeholder="' . langHdl('index_new_pw') . '">
289
+                <input type="password" id="new-user-password" class="form-control" placeholder="' . langHdl('index_new_pw').'">
291 290
             </div>
292 291
             <div class="input-group has-feedback mb-2">
293 292
                 <div class="input-group-prepend">
294 293
                     <span class="input-group-text"><i class="fa fa-key"></i></span>
295 294
                 </div>
296
-                <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . langHdl('index_change_pw_confirmation') . '">
295
+                <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . langHdl('index_change_pw_confirmation').'">
297 296
             </div>
298 297
             <div class="row mb-3">
299 298
                 <div class="col-md-12 offset-sm-4 text-center">
@@ -304,7 +303,7 @@  discard block
 block discarded – undo
304 303
             </div>
305 304
             <div class="row mb-3">
306 305
                 <div class="col-12">
307
-                    <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . langHdl('confirm') . '</button>
306
+                    <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . langHdl('confirm').'</button>
308 307
                 </div>
309 308
             </div>
310 309
         </div>
@@ -312,20 +311,20 @@  discard block
 block discarded – undo
312 311
 
313 312
     <div class="card-body hidden" id="card-user-treat-psk">
314 313
         <div class="alert alert-info">
315
-            <div class="text-center"><i class="icon fa fa-info"></i>' . langHdl('user_has_psk_info') . '</div>
314
+            <div class="text-center"><i class="icon fa fa-info"></i>' . langHdl('user_has_psk_info').'</div>
316 315
         </div>
317 316
         <div class="input-group has-feedback mb-2">
318 317
             <div class="input-group-prepend">
319 318
                 <span class="input-group-text"><i class="fa fa-key"></i></span>
320 319
             </div>
321
-            <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . langHdl('home_personal_saltkey') . '">
320
+            <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . langHdl('home_personal_saltkey').'">
322 321
         </div>
323 322
         <div class="row mb-3 mt-4">
324 323
             <div class="col-12">
325
-                <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . langHdl('launch') . '</button>
324
+                <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . langHdl('launch').'</button>
326 325
             </div>
327 326
             <div class="col-12 mt-3">
328
-                <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . langHdl('i_cannot_remember') . '</button>
327
+                <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . langHdl('i_cannot_remember').'</button>
329 328
             </div>
330 329
         </div>
331 330
     </div>
Please login to merge, or discard this patch.
includes/core/otv.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 } else {
49 49
     throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
50 50
 }
51
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
51
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
52 52
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
53 53
 ?>
54 54
 <body class="hold-transition login-page ">
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         WHERE code = %s',
99 99
         filter_input(INPUT_GET, 'code', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
100 100
     );
101
-    if (DB::count() > 0  && (int) $data['timestamp'] === (int) filter_input(INPUT_GET, 'stamp', FILTER_VALIDATE_INT)) {
101
+    if (DB::count() > 0 && (int) $data['timestamp'] === (int) filter_input(INPUT_GET, 'stamp', FILTER_VALIDATE_INT)) {
102 102
         // otv is too old
103 103
         if ($data['timestamp'] < time() - ($SETTINGS['otv_expiration_period'] * 86400)) {
104 104
             $html = 'Link is too old!';
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -38,23 +38,23 @@  discard block
 block discarded – undo
38 38
 }
39 39
 
40 40
 // Do checks
41
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
42
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
41
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
42
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
43 43
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS) === false) {
44 44
     // Not allowed page
45 45
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
46
-    include $SETTINGS['cpassman_dir'] . '/error.php';
46
+    include $SETTINGS['cpassman_dir'].'/error.php';
47 47
     exit();
48 48
 }
49 49
 
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
51
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
52 52
 header('Content-type: text/html; charset=utf-8');
53 53
 header('Cache-Control: no-cache, must-revalidate');
54 54
 require_once 'main.functions.php';
55 55
 
56 56
 // Connect to mysql server
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
58 58
 DB::$host = DB_HOST;
59 59
 DB::$user = DB_USER;
60 60
 DB::$password = DB_PASSWD_CLEAR;
@@ -112,21 +112,21 @@  discard block
 block discarded – undo
112 112
             // Prepare variables
113 113
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
114 114
 
115
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
115
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
116 116
             $return = '';
117 117
 
118 118
             //Get all tables
119 119
             $tables = array();
120 120
             $result = DB::query('SHOW TABLES');
121 121
             foreach ($result as $row) {
122
-                $tables[] = $row['Tables_in_' . DB_NAME];
122
+                $tables[] = $row['Tables_in_'.DB_NAME];
123 123
             }
124 124
 
125 125
             //cycle through
126 126
             foreach ($tables as $table) {
127 127
                 if (empty($pre) || substr_count($table, $pre) > 0) {
128 128
                     // Do query
129
-                    $result = DB::queryRaw('SELECT * FROM ' . $table);
129
+                    $result = DB::queryRaw('SELECT * FROM '.$table);
130 130
                     DB::queryRaw(
131 131
                         'SELECT *
132 132
                         FROM INFORMATION_SCHEMA.COLUMNS
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
                     $numFields = DB::count();
139 139
 
140 140
                     // prepare a drop table
141
-                    $return .= 'DROP TABLE ' . $table . ';';
142
-                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
143
-                    $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
141
+                    $return .= 'DROP TABLE '.$table.';';
142
+                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
143
+                    $return .= "\n\n".$row2['Create Table'].";\n\n";
144 144
 
145 145
                     //prepare all fields and datas
146 146
                     for ($i = 0; $i < $numFields; ++$i) {
147 147
                         while ($row = $result->fetch_row()) {
148
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
148
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
149 149
                             for ($j = 0; $j < $numFields; ++$j) {
150 150
                                 $row[$j] = is_null($row[$j]) === false ? addslashes($row[$j]) : '';
151 151
                                 $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
152 152
                                 if (isset($row[$j])) {
153
-                                    $return .= '"' . $row[$j] . '"';
153
+                                    $return .= '"'.$row[$j].'"';
154 154
                                 } else {
155 155
                                     $return .= 'NULL';
156 156
                                 }
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
                 $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
171 171
 
172 172
                 //save file
173
-                $filename = time() . '-' . $token . '.sql';
174
-                $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
173
+                $filename = time().'-'.$token.'.sql';
174
+                $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
175 175
                 if ($handle !== false) {
176 176
                     //write file
177 177
                     fwrite($handle, $return);
@@ -183,17 +183,17 @@  discard block
 block discarded – undo
183 183
                     // Encrypt the file
184 184
                     prepareFileWithDefuse(
185 185
                         'encrypt',
186
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename,
187
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
186
+                        $SETTINGS['path_to_files_folder'].'/'.$filename,
187
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
188 188
                         $SETTINGS,
189 189
                         $post_key
190 190
                     );
191 191
 
192 192
                     // Do clean
193
-                    unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
193
+                    unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
194 194
                     rename(
195
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
196
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename
195
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
196
+                        $SETTINGS['path_to_files_folder'].'/'.$filename
197 197
                     );
198 198
                 }
199 199
 
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
                     array(
215 215
                         'error' => false,
216 216
                         'message' => '',
217
-                        'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
218
-                            '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' .
219
-                            $_SESSION['key_tmp'] . '&pathIsFiles=1',
217
+                        'download' => 'sources/downloadFile.php?name='.urlencode($filename).
218
+                            '&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.
219
+                            $_SESSION['key_tmp'].'&pathIsFiles=1',
220 220
                     ),
221 221
                     'encode'
222 222
                 );
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
270 270
             $post_backupFile = filter_var($dataReceived['backupFile'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
271 271
 
272
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
272
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
273 273
 
274 274
             // Get filename from database
275 275
             $data = DB::queryFirstRow(
276 276
                 'SELECT valeur
277
-                FROM ' . prefixTable('misc') . '
277
+                FROM ' . prefixTable('misc').'
278 278
                 WHERE increment_id = %i',
279 279
                 $post_backupFile
280 280
             );
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
                 // Decrypt the file
294 294
                 $ret = prepareFileWithDefuse(
295 295
                     'decrypt',
296
-                    $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
297
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
296
+                    $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
297
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
298 298
                     $SETTINGS,
299 299
                     $post_key
300 300
                 );
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
                 }
313 313
 
314 314
                 // Do clean
315
-                fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
316
-                $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
315
+                fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
316
+                $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
317 317
             } else {
318
-                $post_backupFile = $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile;
318
+                $post_backupFile = $SETTINGS['path_to_files_folder'].'/'.$post_backupFile;
319 319
             }
320 320
 
321 321
             //read sql file
Please login to merge, or discard this patch.
sources/checks.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
     throw new Exception('Error file "/includes/config/tp.config.php" not exists', 1);
35 35
 }
36 36
 
37
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
38
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
37
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
38
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
39 39
 
40 40
 // Prepare sanitization
41 41
 $data = [
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $csrfp_array = include '../includes/libraries/csrfp/libs/csrfp.config.php';
72 72
 
73 73
             // Send back CSRFP info
74
-            echo $csrfp_array['CSRFP_TOKEN'] . ';' . filter_input(INPUT_POST, $csrfp_array['CSRFP_TOKEN'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
74
+            echo $csrfp_array['CSRFP_TOKEN'].';'.filter_input(INPUT_POST, $csrfp_array['CSRFP_TOKEN'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
75 75
         }
76 76
 
77 77
         break;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 function curPage($SETTINGS)
86 86
 {
87 87
     // Load libraries
88
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
88
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
89 89
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
90 90
 
91 91
     // Parse the url
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
     }
150 150
 
151 151
     // Load
152
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
153
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
152
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
153
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
154 154
 
155 155
     // Load libraries
156
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
156
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
157 157
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
158 158
 
159 159
     // Securize language
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
         $superGlobal->put('user_language', 'english', 'SESSION', 'user');
165 165
     }
166 166
 
167
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION', 'user') . '.php';
167
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION', 'user').'.php';
168 168
     include_once 'SplClassLoader.php';
169 169
     include_once 'main.functions.php';
170 170
 
171 171
     // Connect to mysql server
172
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
172
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
173 173
     if (defined('DB_PASSWD_CLEAR') === false) {
174 174
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
175 175
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
     // load user's data
186 186
     $data = DB::queryfirstrow(
187
-        'SELECT login, key_tempo, admin, gestionnaire, can_manage_all_users FROM ' . prefixTable('users') . ' WHERE id = %i',
187
+        'SELECT login, key_tempo, admin, gestionnaire, can_manage_all_users FROM '.prefixTable('users').' WHERE id = %i',
188 188
         $userId
189 189
     );
190 190
 
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
53 53
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
54
-    include $SETTINGS['cpassman_dir'] . '/error.php';
54
+    include $SETTINGS['cpassman_dir'].'/error.php';
55 55
     exit;
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
61 61
 
62 62
 header('Content-type: text/html; charset=utf-8');
63 63
 header('Cache-Control: no-cache, no-store, must-revalidate');
64 64
 
65
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
65
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
66 66
 
67 67
 // connect to the server
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
69 69
 if (defined('DB_PASSWD_CLEAR') === false) {
70 70
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
71 71
 }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                         array(
121 121
                             'http' => array(
122 122
                                 'ignore_errors' => true,
123
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
123
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
124 124
                             ),
125 125
                         )
126 126
                     );
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
                     $json_array = json_decode($json, true);
140 140
 
141 141
                     // About version
142
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION;
142
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION;
143 143
                     if (floatval(TP_VERSION) < floatval($json_array['info']['version'])) {
144
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
144
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
145 145
                     }
146 146
                     $text .= '</li>';
147 147
 
148 148
                     // Libraries
149 149
                     $text .= '<li><u>Libraries</u> :</li>';
150 150
                     foreach ($json_array['libraries'] as $key => $val) {
151
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
151
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
152 152
                     }
153 153
                 }
154 154
             } else {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         }
160 160
         $text .= '</ul>';
161 161
 
162
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
162
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
163 163
         break;
164 164
 
165 165
         //##########################################################
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         //get through all users
194 194
         $rows = DB::query(
195 195
             'SELECT id, login, email
196
-            FROM ' . prefixTable('users') . '
196
+            FROM ' . prefixTable('users').'
197 197
             ORDER BY login ASC'
198 198
         );
199 199
         foreach ($rows as $record) {
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             //if folder doesn't exist then create it
211 211
             $data = DB::queryfirstrow(
212 212
                 'SELECT id
213
-                FROM ' . prefixTable('nested_tree') . '
213
+                FROM ' . prefixTable('nested_tree').'
214 214
                 WHERE title = %s AND parent_id = %i',
215 215
                 $record['id'],
216 216
                 0
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     $SETTINGS['cpassman_dir'],
275 275
             array(
276 276
                 'error' => false,
277
-                'message' => langHdl('last_execution') . ' ' .
278
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
277
+                'message' => langHdl('last_execution').' '.
278
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
279 279
                     '<i class="fas fa-check text-success ml-2"></i>',
280 280
             ),
281 281
             'encode'
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
         //Libraries call
314
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
314
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
315 315
 
316 316
         //init
317 317
         $foldersIds = array();
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             }
326 326
         }
327 327
 
328
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
328
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
329 329
         foreach ($items as $item) {
330 330
             //Delete item
331 331
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
         // delete orphan items
347 347
         $rows = DB::query(
348 348
             'SELECT id
349
-            FROM ' . prefixTable('items') . '
349
+            FROM ' . prefixTable('items').'
350 350
             ORDER BY id ASC'
351 351
         );
352 352
         foreach ($rows as $item) {
353 353
             DB::query(
354
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
354
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
355 355
                 $item['id'],
356 356
                 'at_creation'
357 357
             );
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
     $SETTINGS['cpassman_dir'],
383 383
             array(
384 384
                 'error' => false,
385
-                'message' => langHdl('last_execution') . ' ' .
386
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
385
+                'message' => langHdl('last_execution').' '.
386
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
387 387
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
388 388
                     <i class="fas fa-chevron-right mr-2"></i>' .
389
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
389
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
390 390
             ),
391 391
             'encode'
392 392
         );
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
             break;
421 421
         }
422 422
 
423
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
423
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
424 424
         $return = '';
425 425
 
426 426
         //Get all tables
427 427
         $tables = array();
428 428
         $result = DB::query('SHOW TABLES');
429 429
         foreach ($result as $row) {
430
-            $tables[] = $row['Tables_in_' . $database];
430
+            $tables[] = $row['Tables_in_'.$database];
431 431
         }
432 432
 
433 433
         //cycle through
434 434
         foreach ($tables as $table) {
435 435
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
436 436
                 // Do query
437
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
437
+                $result = DB::queryRaw('SELECT * FROM '.$table);
438 438
                 DB::queryRaw(
439 439
                     'SELECT *
440 440
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -446,19 +446,19 @@  discard block
 block discarded – undo
446 446
                 $numFields = DB::count();
447 447
 
448 448
                 // prepare a drop table
449
-                $return .= 'DROP TABLE ' . $table . ';';
450
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
451
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
449
+                $return .= 'DROP TABLE '.$table.';';
450
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
451
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
452 452
 
453 453
                 //prepare all fields and datas
454 454
                 for ($i = 0; $i < $numFields; ++$i) {
455 455
                     while ($row = $result->fetch_row()) {
456
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
456
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
457 457
                         for ($j = 0; $j < $numFields; ++$j) {
458 458
                             $row[$j] = addslashes($row[$j]);
459 459
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
460 460
                             if (isset($row[$j])) {
461
-                                $return .= '"' . $row[$j] . '"';
461
+                                $return .= '"'.$row[$j].'"';
462 462
                             } else {
463 463
                                 $return .= 'NULL';
464 464
                             }
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
479 479
 
480 480
             //save file
481
-            $filename = time() . '-' . $token . '.sql';
482
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
481
+            $filename = time().'-'.$token.'.sql';
482
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
483 483
             if ($handle !== false) {
484 484
                 //write file
485 485
                 fwrite($handle, $return);
@@ -491,17 +491,17 @@  discard block
 block discarded – undo
491 491
                 // Encrypt the file
492 492
                 prepareFileWithDefuse(
493 493
                     'encrypt',
494
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
495
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
494
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
495
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
496 496
                     $SETTINGS,
497 497
                     $post_option
498 498
                 );
499 499
 
500 500
                 // Do clean
501
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
501
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
502 502
                 rename(
503
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
504
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
503
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
504
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
505 505
                 );
506 506
             }
507 507
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
             //update LOG
512 512
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
513 513
 
514
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
514
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
515 515
         }
516 516
         break;
517 517
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
             );
543 543
             break;
544 544
         }
545
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
545
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
546 546
 
547 547
         $dataPost = explode('&', $post_option);
548 548
         $file = htmlspecialchars($dataPost[0]);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         // Get filename from database
552 552
         $data = DB::queryFirstRow(
553 553
             'SELECT valeur
554
-            FROM ' . prefixTable('misc') . '
554
+            FROM ' . prefixTable('misc').'
555 555
             WHERE increment_id = %i',
556 556
             $file
557 557
         );
@@ -570,22 +570,22 @@  discard block
 block discarded – undo
570 570
             // Decrypt the file
571 571
             $ret = prepareFileWithDefuse(
572 572
                 'decrypt',
573
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
574
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
573
+                $SETTINGS['path_to_files_folder'].'/'.$file,
574
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
575 575
                 $SETTINGS,
576 576
                 $key
577 577
             );
578 578
 
579 579
             if (empty($ret) === false) {
580
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
580
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
581 581
                 break;
582 582
             }
583 583
 
584 584
             // Do clean
585
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
586
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
585
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
586
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
587 587
         } else {
588
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
588
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
589 589
         }
590 590
 
591 591
         //read sql file
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         fclose($handle);
603 603
 
604 604
         //delete file
605
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
605
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
606 606
 
607 607
         //Show done
608 608
         echo '[{"result":"db_restore" , "message":""}]';
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
             foreach ($table as $i => $tablename) {
643 643
                 if (substr_count($tablename, DB_PREFIX) > 0) {
644 644
                     // launch optimization quieries
645
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
646
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
645
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
646
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
647 647
                 }
648 648
             }
649 649
         }
@@ -651,12 +651,12 @@  discard block
 block discarded – undo
651 651
         //Clean up LOG_ITEMS table
652 652
         $rows = DB::query(
653 653
             'SELECT id
654
-            FROM ' . prefixTable('items') . '
654
+            FROM ' . prefixTable('items').'
655 655
             ORDER BY id ASC'
656 656
         );
657 657
         foreach ($rows as $item) {
658 658
             DB::query(
659
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
659
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
660 660
                 $item['id'],
661 661
                 'at_creation'
662 662
             );
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
             if ($counter === 0) {
665 665
                 //Create new at_creation entry
666 666
                 $rowTmp = DB::queryFirstRow(
667
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
667
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
668 668
                     $item['id']
669 669
                 );
670 670
                 DB::insert(
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
     $SETTINGS['cpassman_dir'],
696 696
             array(
697 697
                 'error' => false,
698
-                'message' => langHdl('last_execution') . ' ' .
699
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
698
+                'message' => langHdl('last_execution').' '.
699
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
700 700
                     '<i class="fas fa-check text-success ml-2"></i>',
701 701
             ),
702 702
             'encode'
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
             break;
732 732
         }
733 733
 
734
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
734
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
735 735
 
736 736
         //read folder
737 737
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
     $SETTINGS['cpassman_dir'],
740 740
                 array(
741 741
                     'error' => true,
742
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
742
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
743 743
                 ),
744 744
                 'encode'
745 745
             );
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
             //delete file FILES
752 752
             while (false !== ($f = readdir($dir))) {
753 753
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
754
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
755
-                        fileDelete($dir . '/' . $f, $SETTINGS);
754
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
755
+                        fileDelete($dir.'/'.$f, $SETTINGS);
756 756
                     }
757 757
                 }
758 758
             }
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
     $SETTINGS['cpassman_dir'],
768 768
                 array(
769 769
                     'error' => true,
770
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
770
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
771 771
                 ),
772 772
                 'encode'
773 773
             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
             while (false !== ($f = readdir($dir))) {
782 782
                 if ($f !== '.' && $f !== '..') {
783 783
                     if (strpos($f, '_delete.') > 0) {
784
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
784
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
785 785
                     }
786 786
                 }
787 787
             }
@@ -804,11 +804,11 @@  discard block
 block discarded – undo
804 804
     $SETTINGS['cpassman_dir'],
805 805
             array(
806 806
                 'error' => false,
807
-                'message' => langHdl('last_execution') . ' ' .
808
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
807
+                'message' => langHdl('last_execution').' '.
808
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
809 809
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
810 810
                     <i class="fas fa-chevron-right mr-2"></i>' .
811
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
811
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
812 812
             ),
813 813
             'encode'
814 814
         );
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
             break;
844 844
         }
845 845
 
846
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
846
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
847 847
         updateCacheTable('reload', $SETTINGS, NULL);
848 848
 
849 849
         // Log
@@ -860,8 +860,8 @@  discard block
 block discarded – undo
860 860
     $SETTINGS['cpassman_dir'],
861 861
             [
862 862
                 'error' => false,
863
-                'message' => langHdl('last_execution') . ' ' .
864
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
863
+                'message' => langHdl('last_execution').' '.
864
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
865 865
                     '<i class="fas fa-check text-success mr-2"></i>',
866 866
             ],
867 867
             'encode'
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
         }
899 899
 
900 900
         // Perform
901
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
901
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
902 902
         $ret = handleConfigFile('rebuild', $SETTINGS);
903 903
 
904 904
         // Log
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
     $SETTINGS['cpassman_dir'],
928 928
             array(
929 929
                 'error' => false,
930
-                'message' => langHdl('last_execution') . ' ' .
931
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
930
+                'message' => langHdl('last_execution').' '.
931
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
932 932
                     '<i class="fas fa-check text-success ml-2"></i>',
933 933
             ),
934 934
             'encode'
@@ -970,33 +970,33 @@  discard block
 block discarded – undo
970 970
         $filename = $post_option;
971 971
         $tp_settings = [];
972 972
         //get backups infos
973
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
973
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
974 974
         foreach ($rows as $record) {
975 975
             $tp_settings[$record['intitule']] = $record['valeur'];
976 976
         }
977 977
 
978 978
         // check if backup file is in DB.
979 979
         // If YES then it is encrypted with DEFUSE
980
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
980
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
981 981
 
982 982
         //read file
983 983
         $return = '';
984
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
984
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
985 985
         if (file_exists($Fnm)) {
986 986
             if (!empty($bck) && $bck['valeur'] === $filename) {
987 987
                 $err = '';
988 988
 
989 989
                 // it means that file is DEFUSE encrypted
990
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
991
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
992
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
993
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
994
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
990
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
991
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
992
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
993
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
994
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
995 995
 
996 996
                 try {
997 997
                     \Defuse\Crypto\File::decryptFileWithPassword(
998
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
999
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
998
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
999
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
1000 1000
                         base64_decode($SETTINGS['bck_script_key'])
1001 1001
                     );
1002 1002
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
                 }
1005 1005
 
1006 1006
                 if (!empty($err)) {
1007
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
1007
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
1008 1008
                     break;
1009 1009
                 }
1010 1010
             } else {
@@ -1026,19 +1026,19 @@  discard block
 block discarded – undo
1026 1026
                 );
1027 1027
 
1028 1028
                 //save the file
1029
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
1029
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
1030 1030
                 if ($handle !== false) {
1031 1031
                     fwrite($handle, $return);
1032 1032
                     fclose($handle);
1033 1033
                 }
1034 1034
             }
1035 1035
             $result = 'backup_decrypt_success';
1036
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1036
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1037 1037
         } else {
1038 1038
             $result = 'backup_decrypt_fails';
1039
-            $msg = 'File not found: ' . $Fnm;
1039
+            $msg = 'File not found: '.$Fnm;
1040 1040
         }
1041
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1041
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1042 1042
         break;
1043 1043
 
1044 1044
         /*
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
         $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
1078 1078
 
1079 1079
         // generate new saltkey
1080
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1080
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1081 1081
         copy(
1082 1082
             SECUREPATH.'/'.SECUREFILE,
1083 1083
             $old_sk_filename
@@ -1105,13 +1105,13 @@  discard block
 block discarded – undo
1105 1105
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
1106 1106
 
1107 1107
         // get number of items to change
1108
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1108
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1109 1109
         $nb_of_items = DB::count();
1110 1110
 
1111 1111
         // create backup table
1112
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1112
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1113 1113
         DB::query(
1114
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1114
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1115 1115
             `id` int(12) NOT null AUTO_INCREMENT,
1116 1116
             `current_table` varchar(100) NOT NULL,
1117 1117
             `current_field` varchar(500) NOT NULL,
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
         );
1140 1140
 
1141 1141
         // delete previous backup files
1142
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1142
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1143 1143
         foreach ($files as $file) { // iterate files
1144 1144
             if (is_file($file)) {
1145 1145
                 $file_parts = pathinfo($file);
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
     $SETTINGS['cpassman_dir'],
1227 1227
                     array(
1228 1228
                         'error' => true,
1229
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1229
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1230 1230
                         'nbOfItems' => '',
1231 1231
                         'nextAction' => '',
1232 1232
                     ),
@@ -1239,9 +1239,9 @@  discard block
 block discarded – undo
1239 1239
                 //change all encrypted data in Items (passwords)
1240 1240
                 $rows = DB::query(
1241 1241
                     'SELECT id, pw, pw_iv
1242
-                    FROM ' . prefixTable('items') . '
1242
+                    FROM ' . prefixTable('items').'
1243 1243
                     WHERE perso = %s
1244
-                    LIMIT ' . $post_start . ', ' . $post_length,
1244
+                    LIMIT ' . $post_start.', '.$post_length,
1245 1245
                     '0'
1246 1246
                 );
1247 1247
                 foreach ($rows as $record) {
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
                             'current_field' => 'pw',
1254 1254
                             'value_id' => $record['id'],
1255 1255
                             'value' => $record['pw'],
1256
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1256
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1257 1257
                             'value2' => 'none',
1258 1258
                             'result' => 'none',
1259 1259
                         )
@@ -1302,9 +1302,9 @@  discard block
 block discarded – undo
1302 1302
                 //change all encrypted data in Logs (passwords)
1303 1303
                 $rows = DB::query(
1304 1304
                     'SELECT raison, increment_id
1305
-                    FROM ' . prefixTable('log_items') . "
1305
+                    FROM ' . prefixTable('log_items')."
1306 1306
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1307
-                    LIMIT " . $post_start . ', ' . $post_length,
1307
+                    LIMIT " . $post_start.', '.$post_length,
1308 1308
                     'at_modification'
1309 1309
                 );
1310 1310
                 foreach ($rows as $record) {
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
                             'current_field' => 'raison',
1317 1317
                             'value_id' => $record['increment_id'],
1318 1318
                             'value' => $record['raison'],
1319
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1319
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1320 1320
                             'value2' => 'none',
1321 1321
                             'result' => 'none',
1322 1322
                         )
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
                         DB::update(
1345 1345
                             prefixTable('log_items'),
1346 1346
                             array(
1347
-                                'raison' => 'at_pw :' . $encrypt['string'],
1347
+                                'raison' => 'at_pw :'.$encrypt['string'],
1348 1348
                                 'encryption_type' => 'defuse',
1349 1349
                             ),
1350 1350
                             'increment_id = %i',
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
                 //change all encrypted data in CATEGORIES (passwords)
1370 1370
                 $rows = DB::query(
1371 1371
                     'SELECT id, data
1372
-                    FROM ' . prefixTable('categories_items') . '
1373
-                    LIMIT ' . $post_start . ', ' . $post_length
1372
+                    FROM ' . prefixTable('categories_items').'
1373
+                    LIMIT ' . $post_start.', '.$post_length
1374 1374
                 );
1375 1375
                 foreach ($rows as $record) {
1376 1376
                     // backup data
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
                             'current_field' => 'data',
1382 1382
                             'value_id' => $record['id'],
1383 1383
                             'value' => $record['data'],
1384
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1384
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1385 1385
                             'value2' => 'none',
1386 1386
                             'result' => 'none',
1387 1387
                         )
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
                 // Change all encrypted data in FILES (passwords)
1430 1430
                 $rows = DB::query(
1431 1431
                     'SELECT id, file, status
1432
-                    FROM ' . prefixTable('files') . "
1432
+                    FROM ' . prefixTable('files')."
1433 1433
                     WHERE status = 'encrypted'
1434
-                    LIMIT " . $post_start . ', ' . $post_length
1434
+                    LIMIT " . $post_start.', '.$post_length
1435 1435
                 );
1436 1436
                 foreach ($rows as $record) {
1437 1437
                     // backup data
@@ -1449,20 +1449,20 @@  discard block
 block discarded – undo
1449 1449
                     );
1450 1450
                     $newID = DB::insertId();
1451 1451
 
1452
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1452
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1453 1453
                         // make a copy of file
1454 1454
                         if (!copy(
1455
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1456
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1455
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1456
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1457 1457
                         )) {
1458 1458
                             $error = 'Copy not possible';
1459 1459
                             exit;
1460 1460
                         } else {
1461 1461
                             // prepare a bck of file (that will not be deleted)
1462
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1462
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1463 1463
                             copy(
1464
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1465
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1464
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1465
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1466 1466
                             );
1467 1467
                         }
1468 1468
 
@@ -1470,24 +1470,24 @@  discard block
 block discarded – undo
1470 1470
                         // STEP1 - Do decryption
1471 1471
                         prepareFileWithDefuse(
1472 1472
                             'decrypt',
1473
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1474
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1473
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1474
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1475 1475
                             $SETTINGS
1476 1476
                         );
1477 1477
 
1478 1478
                         // Do cleanup of files
1479
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1479
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1480 1480
 
1481 1481
                         // STEP2 - Do encryption
1482 1482
                         prepareFileWithDefuse(
1483 1483
                             'encryp',
1484
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1485
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1484
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1485
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1486 1486
                             $SETTINGS
1487 1487
                         );
1488 1488
 
1489 1489
                         // Do cleanup of files
1490
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1490
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1491 1491
 
1492 1492
                         // Update backup table
1493 1493
                         DB::update(
@@ -1513,13 +1513,13 @@  discard block
 block discarded – undo
1513 1513
                 // do some things for new object
1514 1514
                 if (isset($objects[0])) {
1515 1515
                     if ($objects[0] === 'logs') {
1516
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1516
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1517 1517
                     } elseif ($objects[0] === 'files') {
1518
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1518
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1519 1519
                     } elseif ($objects[0] === 'categories') {
1520
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1520
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1521 1521
                     } elseif ($objects[0] === 'custfields') {
1522
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1522
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1523 1523
                     }
1524 1524
                     $nb_of_items = DB::count();
1525 1525
                 } else {
@@ -1644,12 +1644,12 @@  discard block
 block discarded – undo
1644 1644
                 );
1645 1645
             } elseif ($record['current_table'] === 'files') {
1646 1646
                 // restore backup file
1647
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1648
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1649
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1647
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1648
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1649
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1650 1650
                         rename(
1651
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1652
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1651
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1652
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1653 1653
                         );
1654 1654
                     }
1655 1655
                 }
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
         }
1669 1669
 
1670 1670
         // drop table
1671
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1671
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1672 1672
 
1673 1673
         // Send back
1674 1674
         echo prepareExchangedData(
@@ -1714,17 +1714,17 @@  discard block
 block discarded – undo
1714 1714
         // delete files
1715 1715
         $rows = DB::query(
1716 1716
             'SELECT value, value2
1717
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1717
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1718 1718
             WHERE current_table = 'files'"
1719 1719
         );
1720 1720
         foreach ($rows as $record) {
1721
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1722
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1721
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1722
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1723 1723
             }
1724 1724
         }
1725 1725
 
1726 1726
         // drop table
1727
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1727
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1728 1728
 
1729 1729
         echo '[{"status":"done"}]';
1730 1730
         break;
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
             );
1759 1759
             break;
1760 1760
         } else {
1761
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1761
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1762 1762
 
1763 1763
             //send email
1764 1764
             sendEmail(
@@ -1796,11 +1796,11 @@  discard block
 block discarded – undo
1796 1796
             break;
1797 1797
         }
1798 1798
 
1799
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1799
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1800 1800
 
1801 1801
         $rows = DB::query(
1802 1802
             'SELECT *
1803
-            FROM ' . prefixTable('emails') . '
1803
+            FROM ' . prefixTable('emails').'
1804 1804
             WHERE status = %s OR status = %s',
1805 1805
             'not_sent',
1806 1806
             ''
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
             break;
1888 1888
         }
1889 1889
 
1890
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1890
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1891 1891
 
1892
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1892
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1893 1893
         foreach ($rows as $record) {
1894 1894
             //send email
1895 1895
             $ret = json_decode(
@@ -1960,7 +1960,7 @@  discard block
 block discarded – undo
1960 1960
             break;
1961 1961
         }
1962 1962
 
1963
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1963
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1964 1964
 
1965 1965
         // init
1966 1966
         $filesList = array();
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
                 FROM ' . prefixTable('files')
1974 1974
             );
1975 1975
             foreach ($rows as $record) {
1976
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1976
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1977 1977
                     $addFile = false;
1978 1978
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1979 1979
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -2042,8 +2042,8 @@  discard block
 block discarded – undo
2042 2042
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
2043 2043
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
2044 2044
 
2045
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2046
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2045
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2046
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2047 2047
 
2048 2048
         $cpt = 0;
2049 2049
         $continu = true;
@@ -2051,15 +2051,15 @@  discard block
 block discarded – undo
2051 2051
         $message = '';
2052 2052
 
2053 2053
         // load PhpEncryption library
2054
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
2055
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
2056
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2057
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
2058
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2059
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2060
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2061
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2062
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
2054
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
2055
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
2056
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2057
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
2058
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2059
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2060
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2061
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2062
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2063 2063
 
2064 2064
         // treat 10 files
2065 2065
         foreach ($post_list as $file) {
@@ -2067,35 +2067,35 @@  discard block
 block discarded – undo
2067 2067
                 // Get file name
2068 2068
                 $file_info = DB::queryfirstrow(
2069 2069
                     'SELECT file
2070
-                    FROM ' . prefixTable('files') . '
2070
+                    FROM ' . prefixTable('files').'
2071 2071
                     WHERE id = %i',
2072 2072
                     $file
2073 2073
                 );
2074 2074
 
2075 2075
                 // skip file is Coherancey not respected
2076
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2076
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2077 2077
                     // Case where we want to decrypt
2078 2078
                     if ($post_option === 'decrypt') {
2079 2079
                         prepareFileWithDefuse(
2080 2080
                             'decrypt',
2081
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2082
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2081
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2082
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2083 2083
                             $SETTINGS
2084 2084
                         );
2085 2085
                         // Case where we want to encrypt
2086 2086
                     } elseif ($post_option === 'encrypt') {
2087 2087
                         prepareFileWithDefuse(
2088 2088
                             'encrypt',
2089
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2090
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2089
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2090
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2091 2091
                             $SETTINGS
2092 2092
                         );
2093 2093
                     }
2094 2094
                     // Do file cleanup
2095
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2095
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2096 2096
                     rename(
2097
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2098
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2097
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2098
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2099 2099
                     );
2100 2100
 
2101 2101
                     // store in DB
@@ -2130,8 +2130,8 @@  discard block
 block discarded – undo
2130 2130
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2131 2131
             );
2132 2132
 
2133
-            $message = langHdl('last_execution') . ' ' .
2134
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
2133
+            $message = langHdl('last_execution').' '.
2134
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
2135 2135
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2136 2136
         }
2137 2137
 
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
2230 2230
 
2231 2231
             DB::query(
2232
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
2232
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
2233 2233
                 $post_id
2234 2234
             );
2235 2235
         }
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
             // Delete existing key
2329 2329
         } elseif (null !== $post_action && $post_action === 'delete') {
2330 2330
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
2331
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
2331
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
2332 2332
         }
2333 2333
 
2334 2334
         echo prepareExchangedData(
@@ -2344,7 +2344,7 @@  discard block
 block discarded – undo
2344 2344
 
2345 2345
     case 'save_api_status':
2346 2346
         // Do query
2347
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2347
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2348 2348
         $counter = DB::count();
2349 2349
         if ($counter === 0) {
2350 2350
             DB::insert(
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
 
2372 2372
     case 'run_duo_config_check':
2373 2373
         //Libraries call
2374
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2374
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2375 2375
         // Check KEY
2376 2376
         if ($post_key !== $_SESSION['key']) {
2377 2377
             echo prepareExchangedData(
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
                 $SETTINGS['cpassman_dir'],
2428 2428
                     array(
2429 2429
                         'error' => true,
2430
-                        'message' => langHdl('duo_config_error') . "<br/>Duo: " . $e->getMessage(),
2430
+                        'message' => langHdl('duo_config_error')."<br/>Duo: ".$e->getMessage(),
2431 2431
                     ),
2432 2432
                     'encode'
2433 2433
             );
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
                 $duo_error = langHdl('duo_error_secure');
2448 2448
                 $data["duo_check"] = "failed";
2449 2449
             }*/
2450
-            $duo_error = langHdl('duo_error_check_config') . "<br/>Duo: " . $e->getMessage();
2450
+            $duo_error = langHdl('duo_error_check_config')."<br/>Duo: ".$e->getMessage();
2451 2451
             echo prepareExchangedData(
2452 2452
                 $SETTINGS['cpassman_dir'],
2453 2453
                     array(
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
         } else {
2497 2497
             $tmp = 1;
2498 2498
         }
2499
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2499
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2500 2500
         $counter = DB::count();
2501 2501
         if ($counter === 0) {
2502 2502
             DB::insert(
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
 
2523 2523
         // ga_website_name
2524 2524
         if (is_null($dataReceived['ga_website_name']) === false) {
2525
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2525
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2526 2526
             $counter = DB::count();
2527 2527
             if ($counter === 0) {
2528 2528
                 DB::insert(
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
         }
2554 2554
 
2555 2555
         // send data
2556
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2556
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2557 2557
         break;
2558 2558
 
2559 2559
     case 'save_agses_options':
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
 
2579 2579
         // agses_hosted_url
2580 2580
         if (!is_null($dataReceived['agses_hosted_url'])) {
2581
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2581
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2582 2582
             $counter = DB::count();
2583 2583
             if ($counter === 0) {
2584 2584
                 DB::insert(
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 
2608 2608
         // agses_hosted_id
2609 2609
         if (!is_null($dataReceived['agses_hosted_id'])) {
2610
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2610
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2611 2611
             $counter = DB::count();
2612 2612
             if ($counter === 0) {
2613 2613
                 DB::insert(
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
 
2637 2637
         // agses_hosted_apikey
2638 2638
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2639
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2639
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2640 2640
             $counter = DB::count();
2641 2641
             if ($counter === 0) {
2642 2642
                 DB::insert(
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
         }
2665 2665
 
2666 2666
         // send data
2667
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2667
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2668 2668
         break;
2669 2669
 
2670 2670
     case 'save_option_change':
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
 
2706 2706
         // Check if setting is already in DB. If NO then insert, if YES then update.
2707 2707
         $data = DB::query(
2708
-            'SELECT * FROM ' . prefixTable('misc') . '
2708
+            'SELECT * FROM '.prefixTable('misc').'
2709 2709
             WHERE type = %s AND intitule = %s',
2710 2710
             'admin',
2711 2711
             $post_field
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                     array(
2728 2728
                         'valeur' => time(),
2729 2729
                         'type' => 'admin',
2730
-                        'intitule' => $post_field . '_time',
2730
+                        'intitule' => $post_field.'_time',
2731 2731
                     )
2732 2732
                 );
2733 2733
             }
@@ -2745,10 +2745,10 @@  discard block
 block discarded – undo
2745 2745
             if ($post_field === 'send_stats') {
2746 2746
                 // Check if previous time exists, if not them insert this value in DB
2747 2747
                 DB::query(
2748
-                    'SELECT * FROM ' . prefixTable('misc') . '
2748
+                    'SELECT * FROM '.prefixTable('misc').'
2749 2749
                     WHERE type = %s AND intitule = %s',
2750 2750
                     'admin',
2751
-                    $post_field . '_time'
2751
+                    $post_field.'_time'
2752 2752
                 );
2753 2753
                 $counter = DB::count();
2754 2754
                 if ($counter === 0) {
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
                         array(
2758 2758
                             'valeur' => 0,
2759 2759
                             'type' => 'admin',
2760
-                            'intitule' => $post_field . '_time',
2760
+                            'intitule' => $post_field.'_time',
2761 2761
                         )
2762 2762
                     );
2763 2763
                 } else {
@@ -2777,13 +2777,13 @@  discard block
 block discarded – undo
2777 2777
         // special Cases
2778 2778
         if ($post_field === 'cpassman_url') {
2779 2779
             // update also jsUrl for CSFP protection
2780
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2780
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2781 2781
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2782 2782
             $data = file_get_contents($csrfp_file);
2783 2783
             $posJsUrl = strpos($data, '"jsUrl" => "');
2784 2784
             $posEndLine = strpos($data, '",', $posJsUrl);
2785 2785
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2786
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2786
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2787 2787
             file_put_contents($csrfp_file, $newdata);
2788 2788
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2789 2789
             DB::update(
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
             $SETTINGS['cpassman_dir'],
2814 2814
             array(
2815 2815
                 'error' => false,
2816
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2816
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2817 2817
             ),
2818 2818
             'encode'
2819 2819
         );
@@ -2858,7 +2858,7 @@  discard block
 block discarded – undo
2858 2858
 
2859 2859
         // send statistics
2860 2860
         if (null !== $post_status) {
2861
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2861
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2862 2862
             $counter = DB::count();
2863 2863
             if ($counter === 0) {
2864 2864
                 DB::insert(
@@ -2890,7 +2890,7 @@  discard block
 block discarded – undo
2890 2890
 
2891 2891
         // send statistics items
2892 2892
         if (null !== $post_list) {
2893
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2893
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2894 2894
             $counter = DB::count();
2895 2895
             if ($counter === 0) {
2896 2896
                 DB::insert(
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
             break;
2939 2939
         }
2940 2940
 
2941
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2941
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2942 2942
             if (DB::count() === 1) {
2943 2943
                 echo 1;
2944 2944
             } else {
@@ -2977,7 +2977,7 @@  discard block
 block discarded – undo
2977 2977
 
2978 2978
         $rows = DB::query(
2979 2979
             'SELECT id, title
2980
-                FROM ' . prefixTable('roles_title') . '
2980
+                FROM ' . prefixTable('roles_title').'
2981 2981
                 ORDER BY title ASC'
2982 2982
         );
2983 2983
         foreach ($rows as $record) {
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +274 added lines, -276 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 // Load config if $SETTINGS not defined
36 36
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
37
-    include_once __DIR__ . '/../includes/config/tp.config.php';
37
+    include_once __DIR__.'/../includes/config/tp.config.php';
38 38
 }
39 39
 
40 40
 header('Content-type: text/html; charset=utf-8');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             and improve performance by avoiding to include the file for every missing strings.
73 73
         */
74 74
         if (isset($_SESSION['teampass']) === false || isset($_SESSION['teampass']['en_lang'][trim($string)]) === false) {
75
-            $_SESSION['teampass']['en_lang'] = include_once __DIR__. '/../includes/language/english.php';
75
+            $_SESSION['teampass']['en_lang'] = include_once __DIR__.'/../includes/language/english.php';
76 76
             $session_language = isset($_SESSION['teampass']['en_lang'][trim($string)]) === false ? '' : $_SESSION['teampass']['en_lang'][trim($string)];
77 77
         } else {
78 78
             $session_language = $_SESSION['teampass']['en_lang'][trim($string)];
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
     
131 131
     $path = __DIR__.'/../includes/libraries/Encryption/Encryption/';
132 132
 
133
-    include_once $path . 'Exception/CryptoException.php';
134
-    include_once $path . 'Exception/BadFormatException.php';
135
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
136
-    include_once $path . 'Exception/IOException.php';
137
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
138
-    include_once $path . 'Crypto.php';
139
-    include_once $path . 'Encoding.php';
140
-    include_once $path . 'DerivedKeys.php';
141
-    include_once $path . 'Key.php';
142
-    include_once $path . 'KeyOrPassword.php';
143
-    include_once $path . 'File.php';
144
-    include_once $path . 'RuntimeTests.php';
145
-    include_once $path . 'KeyProtectedByPassword.php';
146
-    include_once $path . 'Core.php';
133
+    include_once $path.'Exception/CryptoException.php';
134
+    include_once $path.'Exception/BadFormatException.php';
135
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
136
+    include_once $path.'Exception/IOException.php';
137
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
138
+    include_once $path.'Crypto.php';
139
+    include_once $path.'Encoding.php';
140
+    include_once $path.'DerivedKeys.php';
141
+    include_once $path.'Key.php';
142
+    include_once $path.'KeyOrPassword.php';
143
+    include_once $path.'File.php';
144
+    include_once $path.'RuntimeTests.php';
145
+    include_once $path.'KeyProtectedByPassword.php';
146
+    include_once $path.'Core.php';
147 147
     
148 148
     // convert KEY
149 149
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
         $path = '../includes/libraries/Encryption/Encryption/';
189 189
     }
190 190
 
191
-    include_once $path . 'Exception/CryptoException.php';
192
-    include_once $path . 'Exception/BadFormatException.php';
193
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
194
-    include_once $path . 'Exception/IOException.php';
195
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
196
-    include_once $path . 'Crypto.php';
197
-    include_once $path . 'Encoding.php';
198
-    include_once $path . 'DerivedKeys.php';
199
-    include_once $path . 'Key.php';
200
-    include_once $path . 'KeyOrPassword.php';
201
-    include_once $path . 'File.php';
202
-    include_once $path . 'RuntimeTests.php';
203
-    include_once $path . 'KeyProtectedByPassword.php';
204
-    include_once $path . 'Core.php';
191
+    include_once $path.'Exception/CryptoException.php';
192
+    include_once $path.'Exception/BadFormatException.php';
193
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
194
+    include_once $path.'Exception/IOException.php';
195
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
196
+    include_once $path.'Crypto.php';
197
+    include_once $path.'Encoding.php';
198
+    include_once $path.'DerivedKeys.php';
199
+    include_once $path.'Key.php';
200
+    include_once $path.'KeyOrPassword.php';
201
+    include_once $path.'File.php';
202
+    include_once $path.'RuntimeTests.php';
203
+    include_once $path.'KeyProtectedByPassword.php';
204
+    include_once $path.'Core.php';
205 205
 
206 206
     $key = \Defuse\Crypto\Key::createNewRandomKey();
207 207
     $key = $key->saveToAsciiSafeString();
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
         $path = '../includes/libraries/Encryption/Encryption/';
227 227
     }
228 228
 
229
-    include_once $path . 'Exception/CryptoException.php';
230
-    include_once $path . 'Exception/BadFormatException.php';
231
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
232
-    include_once $path . 'Exception/IOException.php';
233
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
234
-    include_once $path . 'Crypto.php';
235
-    include_once $path . 'Encoding.php';
236
-    include_once $path . 'DerivedKeys.php';
237
-    include_once $path . 'Key.php';
238
-    include_once $path . 'KeyOrPassword.php';
239
-    include_once $path . 'File.php';
240
-    include_once $path . 'RuntimeTests.php';
241
-    include_once $path . 'KeyProtectedByPassword.php';
242
-    include_once $path . 'Core.php';
229
+    include_once $path.'Exception/CryptoException.php';
230
+    include_once $path.'Exception/BadFormatException.php';
231
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
232
+    include_once $path.'Exception/IOException.php';
233
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
234
+    include_once $path.'Crypto.php';
235
+    include_once $path.'Encoding.php';
236
+    include_once $path.'DerivedKeys.php';
237
+    include_once $path.'Key.php';
238
+    include_once $path.'KeyOrPassword.php';
239
+    include_once $path.'File.php';
240
+    include_once $path.'RuntimeTests.php';
241
+    include_once $path.'KeyProtectedByPassword.php';
242
+    include_once $path.'Core.php';
243 243
     
244 244
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
245 245
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -264,20 +264,20 @@  discard block
 block discarded – undo
264 264
         $path = '../includes/libraries/Encryption/Encryption/';
265 265
     }
266 266
 
267
-    include_once $path . 'Exception/CryptoException.php';
268
-    include_once $path . 'Exception/BadFormatException.php';
269
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
270
-    include_once $path . 'Exception/IOException.php';
271
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
272
-    include_once $path . 'Crypto.php';
273
-    include_once $path . 'Encoding.php';
274
-    include_once $path . 'DerivedKeys.php';
275
-    include_once $path . 'Key.php';
276
-    include_once $path . 'KeyOrPassword.php';
277
-    include_once $path . 'File.php';
278
-    include_once $path . 'RuntimeTests.php';
279
-    include_once $path . 'KeyProtectedByPassword.php';
280
-    include_once $path . 'Core.php';
267
+    include_once $path.'Exception/CryptoException.php';
268
+    include_once $path.'Exception/BadFormatException.php';
269
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
270
+    include_once $path.'Exception/IOException.php';
271
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
272
+    include_once $path.'Crypto.php';
273
+    include_once $path.'Encoding.php';
274
+    include_once $path.'DerivedKeys.php';
275
+    include_once $path.'Key.php';
276
+    include_once $path.'KeyOrPassword.php';
277
+    include_once $path.'File.php';
278
+    include_once $path.'RuntimeTests.php';
279
+    include_once $path.'KeyProtectedByPassword.php';
280
+    include_once $path.'Core.php';
281 281
 
282 282
     try {
283 283
         $protected_key_encoded = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  */
320 320
 function trimElement($chaine, string $element): string
321 321
 {
322
-    if (! empty($chaine)) {
322
+    if (!empty($chaine)) {
323 323
         if (is_array($chaine) === true) {
324 324
             $chaine = implode(';', $chaine);
325 325
         }
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
  */
368 368
 function db_error_handler(array $params): void
369 369
 {
370
-    echo 'Error: ' . $params['error'] . "<br>\n";
371
-    echo 'Query: ' . $params['query'] . "<br>\n";
370
+    echo 'Error: '.$params['error']."<br>\n";
371
+    echo 'Query: '.$params['query']."<br>\n";
372 372
     throw new Exception('Error - Query', 1);
373 373
 }
374 374
 
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
     $SETTINGS
391 391
 ) {
392 392
     //load ClassLoader
393
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
393
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
394 394
     // Load superglobal
395
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
395
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
396 396
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
397 397
     //Connect to DB
398
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
398
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
399 399
     if (defined('DB_PASSWD_CLEAR') === false) {
400 400
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
401 401
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     DB::$ssl = DB_SSL;
409 409
     DB::$connect_options = DB_CONNECT_OPTIONS;
410 410
     //Build tree
411
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
411
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
412 412
     $tree->register();
413 413
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
414 414
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 function identAdmin($idFonctions, $SETTINGS, $tree)
454 454
 {
455 455
     // Load superglobal
456
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
456
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
457 457
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
458 458
     // Init
459 459
     $groupesVisibles = [];
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
473 473
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
474 474
     // Get list of Folders
475
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
475
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
476 476
     foreach ($rows as $record) {
477 477
         array_push($groupesVisibles, $record['id']);
478 478
     }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     }
492 492
     // Get ID of personal folder
493 493
     $persfld = DB::queryfirstrow(
494
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
494
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
495 495
         $globalsUserId
496 496
     );
497 497
     if (empty($persfld['id']) === false) {
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
     // get complete list of ROLES
513 513
     $tmp = explode(';', $idFonctions);
514 514
     $rows = DB::query(
515
-        'SELECT * FROM ' . prefixTable('roles_title') . '
515
+        'SELECT * FROM '.prefixTable('roles_title').'
516 516
         ORDER BY title ASC'
517 517
     );
518 518
     foreach ($rows as $record) {
519
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
519
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
520 520
             array_push($tmp, $record['id']);
521 521
         }
522 522
     }
523 523
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
524 524
     $superGlobal->put('is_admin', 1, 'SESSION');
525 525
     // Check if admin has created Folders and Roles
526
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
526
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
527 527
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
528
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
528
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
529 529
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
530 530
 
531 531
     return true;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
     object $tree
572 572
 ) {
573 573
     // Load superglobal
574
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
574
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
575 575
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
576 576
     // Init
577 577
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
     // Does this user is allowed to see other items
611 611
     $inc = 0;
612 612
     $rows = DB::query(
613
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
613
+        'SELECT id, id_tree FROM '.prefixTable('items').'
614 614
             WHERE restricted_to LIKE %ss AND inactif = %s'.
615 615
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
616
-        $globalsUserId . ';',
616
+        $globalsUserId.';',
617 617
         '0'
618 618
     );
619 619
     foreach ($rows as $record) {
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
     // Check for the users roles if some specific rights exist on items
628 628
     $rows = DB::query(
629 629
         'SELECT i.id_tree, r.item_id
630
-        FROM ' . prefixTable('items') . ' as i
631
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
630
+        FROM ' . prefixTable('items').' as i
631
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
632 632
         WHERE r.role_id IN %li AND i.id_tree <> ""
633 633
         ORDER BY i.id_tree ASC',
634 634
         $userRoles
@@ -682,16 +682,16 @@  discard block
 block discarded – undo
682 682
         'SESSION'
683 683
     );
684 684
     // Folders and Roles numbers
685
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
685
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
686 686
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
687
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
687
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
688 688
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
689 689
     // check if change proposals on User's items
690 690
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
691 691
         $countNewItems = DB::query(
692 692
             'SELECT COUNT(*)
693
-            FROM ' . prefixTable('items_change') . ' AS c
694
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
693
+            FROM ' . prefixTable('items_change').' AS c
694
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
695 695
             WHERE i.action = %s AND i.id_user = %i',
696 696
             'at_creation',
697 697
             $globalsUserId
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 {
719 719
     $rows = DB::query(
720 720
         'SELECT *
721
-        FROM ' . prefixTable('roles_values') . '
721
+        FROM ' . prefixTable('roles_values').'
722 722
         WHERE role_id IN %li AND type IN %ls',
723 723
         $userRoles,
724 724
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     ) {
786 786
         $persoFld = DB::queryfirstrow(
787 787
             'SELECT id
788
-            FROM ' . prefixTable('nested_tree') . '
788
+            FROM ' . prefixTable('nested_tree').'
789 789
             WHERE title = %s AND personal_folder = %i'.
790 790
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
791 791
             $globalsUserId,
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
     }
819 819
     $persoFlds = DB::query(
820 820
         'SELECT id
821
-        FROM ' . prefixTable('nested_tree') . '
821
+        FROM ' . prefixTable('nested_tree').'
822 822
         WHERE %l',
823 823
         $where
824 824
     );
@@ -882,9 +882,9 @@  discard block
 block discarded – undo
882 882
  */
883 883
 function cacheTableRefresh(array $SETTINGS): void
884 884
 {
885
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
885
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
886 886
     //Connect to DB
887
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
887
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
888 888
     if (defined('DB_PASSWD_CLEAR') === false) {
889 889
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
890 890
     }
@@ -901,12 +901,12 @@  discard block
 block discarded – undo
901 901
     $tree->register();
902 902
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
903 903
     // truncate table
904
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
904
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
905 905
     // reload date
906 906
     $rows = DB::query(
907 907
         'SELECT *
908
-        FROM ' . prefixTable('items') . ' as i
909
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
908
+        FROM ' . prefixTable('items').' as i
909
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
910 910
         AND l.action = %s
911 911
         AND i.inactif = %i',
912 912
         'at_creation',
@@ -918,18 +918,18 @@  discard block
 block discarded – undo
918 918
             $tags = '';
919 919
             $itemTags = DB::query(
920 920
                 'SELECT tag
921
-                FROM ' . prefixTable('tags') . '
921
+                FROM ' . prefixTable('tags').'
922 922
                 WHERE item_id = %i AND tag != ""',
923 923
                 $record['id']
924 924
             );
925 925
             foreach ($itemTags as $itemTag) {
926
-                $tags .= $itemTag['tag'] . ' ';
926
+                $tags .= $itemTag['tag'].' ';
927 927
             }
928 928
 
929 929
             // Get renewal period
930 930
             $resNT = DB::queryfirstrow(
931 931
                 'SELECT renewal_period
932
-                FROM ' . prefixTable('nested_tree') . '
932
+                FROM ' . prefixTable('nested_tree').'
933 933
                 WHERE id = %i',
934 934
                 $record['id_tree']
935 935
             );
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
                     // Is this a User id?
943 943
                     $user = DB::queryfirstrow(
944 944
                         'SELECT id, login
945
-                        FROM ' . prefixTable('users') . '
945
+                        FROM ' . prefixTable('users').'
946 946
                         WHERE id = %i',
947 947
                         $elem->title
948 948
                     );
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
                     'id' => $record['id'],
961 961
                     'label' => $record['label'],
962 962
                     'description' => $record['description'] ?? '',
963
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
963
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
964 964
                     'tags' => $tags,
965 965
                     'id_tree' => $record['id_tree'],
966 966
                     'perso' => $record['perso'],
967
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
967
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
968 968
                     'login' => $record['login'] ?? '',
969 969
                     'folder' => implode(' > ', $folder),
970 970
                     'author' => $record['id_user'],
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
  */
987 987
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
988 988
 {
989
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
989
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
990 990
     // Load superglobal
991
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
991
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
992 992
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
993 993
     //Connect to DB
994
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
994
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
995 995
     if (defined('DB_PASSWD_CLEAR') === false) {
996 996
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
997 997
     }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
     // get new value from db
1011 1011
     $data = DB::queryfirstrow(
1012 1012
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1013
-        FROM ' . prefixTable('items') . '
1013
+        FROM ' . prefixTable('items').'
1014 1014
         WHERE id=%i',
1015 1015
         $ident
1016 1016
     );
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
     $tags = '';
1019 1019
     $itemTags = DB::query(
1020 1020
         'SELECT tag
1021
-            FROM ' . prefixTable('tags') . '
1021
+            FROM ' . prefixTable('tags').'
1022 1022
             WHERE item_id = %i AND tag != ""',
1023 1023
         $ident
1024 1024
     );
1025 1025
     foreach ($itemTags as $itemTag) {
1026
-        $tags .= $itemTag['tag'] . ' ';
1026
+        $tags .= $itemTag['tag'].' ';
1027 1027
     }
1028 1028
     // form id_tree to full foldername
1029 1029
     $folder = [];
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
             // Is this a User id?
1035 1035
             $user = DB::queryfirstrow(
1036 1036
                 'SELECT id, login
1037
-                FROM ' . prefixTable('users') . '
1037
+                FROM ' . prefixTable('users').'
1038 1038
                 WHERE id = %i',
1039 1039
                 $elem->title
1040 1040
             );
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
             'label' => $data['label'],
1053 1053
             'description' => $data['description'],
1054 1054
             'tags' => $tags,
1055
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1055
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1056 1056
             'id_tree' => $data['id_tree'],
1057 1057
             'perso' => $data['perso'],
1058
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1058
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1059 1059
             'login' => $data['login'] ?? '',
1060 1060
             'folder' => implode(' » ', $folder),
1061 1061
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1075,14 +1075,14 @@  discard block
 block discarded – undo
1075 1075
  */
1076 1076
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1077 1077
 {
1078
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1078
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1079 1079
     // Load superglobal
1080
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1080
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1081 1081
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1082 1082
     // Get superglobals
1083 1083
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1084 1084
     //Connect to DB
1085
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1085
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1086 1086
     if (defined('DB_PASSWD_CLEAR') === false) {
1087 1087
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1088 1088
     }
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
     // get new value from db
1102 1102
     $data = DB::queryFirstRow(
1103 1103
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1104
-        FROM ' . prefixTable('items') . ' as i
1105
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1104
+        FROM ' . prefixTable('items').' as i
1105
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1106 1106
         WHERE i.id = %i
1107 1107
         AND l.action = %s',
1108 1108
         $ident,
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
     $tags = '';
1113 1113
     $itemTags = DB::query(
1114 1114
         'SELECT tag
1115
-            FROM ' . prefixTable('tags') . '
1115
+            FROM ' . prefixTable('tags').'
1116 1116
             WHERE item_id = %i AND tag != ""',
1117 1117
         $ident
1118 1118
     );
1119 1119
     foreach ($itemTags as $itemTag) {
1120
-        $tags .= $itemTag['tag'] . ' ';
1120
+        $tags .= $itemTag['tag'].' ';
1121 1121
     }
1122 1122
     // form id_tree to full foldername
1123 1123
     $folder = [];
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
             // Is this a User id?
1129 1129
             $user = DB::queryfirstrow(
1130 1130
                 'SELECT id, login
1131
-                FROM ' . prefixTable('users') . '
1131
+                FROM ' . prefixTable('users').'
1132 1132
                 WHERE id = %i',
1133 1133
                 $elem->title
1134 1134
             );
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
             'label' => $data['label'],
1148 1148
             'description' => $data['description'],
1149 1149
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1150
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1150
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1151 1151
             'id_tree' => $data['id_tree'],
1152 1152
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1153 1153
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1169,52 +1169,52 @@  discard block
 block discarded – undo
1169 1169
 function getStatisticsData(array $SETTINGS): array
1170 1170
 {
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1172
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1173 1173
         0
1174 1174
     );
1175 1175
     $counter_folders = DB::count();
1176 1176
     DB::query(
1177
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1177
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1178 1178
         1
1179 1179
     );
1180 1180
     $counter_folders_perso = DB::count();
1181 1181
     DB::query(
1182
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1182
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1183 1183
         0
1184 1184
     );
1185 1185
     $counter_items = DB::count();
1186 1186
         DB::query(
1187
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1187
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1188 1188
         1
1189 1189
     );
1190 1190
     $counter_items_perso = DB::count();
1191 1191
         DB::query(
1192
-        'SELECT id FROM ' . prefixTable('users') . ''
1192
+        'SELECT id FROM '.prefixTable('users').''
1193 1193
     );
1194 1194
     $counter_users = DB::count();
1195 1195
         DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $admins = DB::count();
1200 1200
     DB::query(
1201
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1201
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1202 1202
         1
1203 1203
     );
1204 1204
     $managers = DB::count();
1205 1205
     DB::query(
1206
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1206
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1207 1207
         1
1208 1208
     );
1209 1209
     $readOnly = DB::count();
1210 1210
     // list the languages
1211 1211
     $usedLang = [];
1212 1212
     $tp_languages = DB::query(
1213
-        'SELECT name FROM ' . prefixTable('languages')
1213
+        'SELECT name FROM '.prefixTable('languages')
1214 1214
     );
1215 1215
     foreach ($tp_languages as $tp_language) {
1216 1216
         DB::query(
1217
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1217
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1218 1218
             $tp_language['name']
1219 1219
         );
1220 1220
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1223,12 +1223,12 @@  discard block
 block discarded – undo
1223 1223
     // get list of ips
1224 1224
     $usedIp = [];
1225 1225
     $tp_ips = DB::query(
1226
-        'SELECT user_ip FROM ' . prefixTable('users')
1226
+        'SELECT user_ip FROM '.prefixTable('users')
1227 1227
     );
1228 1228
     foreach ($tp_ips as $ip) {
1229 1229
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1230 1230
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1231
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1231
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1232 1232
             $usedIp[$ip['user_ip']] = 1;
1233 1233
         }
1234 1234
     }
@@ -1391,19 +1391,19 @@  discard block
 block discarded – undo
1391 1391
     // Load settings
1392 1392
     //include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1393 1393
     // Load superglobal
1394
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1394
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1395 1395
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1396 1396
     // Get user language
1397
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . (null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english') . '.php';
1397
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.(null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english').'.php';
1398 1398
     // Load library
1399
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1399
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1400 1400
     // load PHPMailer
1401
-    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1401
+    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'].'/includes/libraries');
1402 1402
     $mail->register();
1403 1403
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1404 1404
 
1405 1405
     // send to user
1406
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1406
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1407 1407
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true && $cron === false && $silent === false ? $SETTINGS['email_debug_level'] : 0;
1408 1408
     $mail->Port = (int) $SETTINGS['email_port'];
1409 1409
     //COULD BE USED
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
         <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;">
1494 1494
         <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;">
1495 1495
         <br><div style="float:right;">' .
1496
-        $textMail .
1496
+        $textMail.
1497 1497
         '<br><br></td></tr></table>
1498 1498
     </td></tr></table>
1499 1499
     <br></body></html>';
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
  */
1507 1507
 function generateKey(): string
1508 1508
 {
1509
-    return substr(md5(rand() . rand()), 0, 15);
1509
+    return substr(md5(rand().rand()), 0, 15);
1510 1510
 }
1511 1511
 
1512 1512
 /**
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
 {
1578 1578
     array_walk_recursive(
1579 1579
         $array,
1580
-        static function (&$item): void {
1580
+        static function(&$item): void {
1581 1581
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1582 1582
                 $item = utf8_encode($item);
1583 1583
             }
@@ -1598,9 +1598,9 @@  discard block
 block discarded – undo
1598 1598
  */
1599 1599
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1600 1600
 {
1601
-    $teampassDir = __DIR__ . '/..';
1601
+    $teampassDir = __DIR__.'/..';
1602 1602
     // Load superglobal
1603
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1603
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1604 1604
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1605 1605
     // Get superglobals
1606 1606
     if ($key !== null) {
@@ -1611,10 +1611,10 @@  discard block
 block discarded – undo
1611 1611
     }
1612 1612
 
1613 1613
     //load Encoding
1614
-    include_once $teampassDir . '/includes/libraries/ForceUTF8/Encoding.php';
1614
+    include_once $teampassDir.'/includes/libraries/ForceUTF8/Encoding.php';
1615 1615
     
1616 1616
     //Load CRYPTOJS
1617
-    include_once $teampassDir . '/includes/libraries/Encryption/CryptoJs/Encryption.php';
1617
+    include_once $teampassDir.'/includes/libraries/Encryption/CryptoJs/Encryption.php';
1618 1618
 
1619 1619
     // Perform
1620 1620
     if ($type === 'encode' && is_array($data) === true) {
@@ -1686,8 +1686,8 @@  discard block
 block discarded – undo
1686 1686
  */
1687 1687
 function prefixTable(string $table): string
1688 1688
 {
1689
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1690
-    if (! empty($safeTable)) {
1689
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1690
+    if (!empty($safeTable)) {
1691 1691
         // sanitize string
1692 1692
         return $safeTable;
1693 1693
     }
@@ -1717,13 +1717,13 @@  discard block
 block discarded – undo
1717 1717
     bool $lowercase = false,
1718 1718
     array $SETTINGS = []
1719 1719
 ): string {
1720
-    include_once __DIR__ . '/../sources/SplClassLoader.php';
1721
-    $generator = new SplClassLoader('PasswordGenerator\Generator', __DIR__. '/../includes/libraries');
1720
+    include_once __DIR__.'/../sources/SplClassLoader.php';
1721
+    $generator = new SplClassLoader('PasswordGenerator\Generator', __DIR__.'/../includes/libraries');
1722 1722
     $generator->register();
1723 1723
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1724 1724
     // Is PHP7 being used?
1725 1725
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1726
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', __DIR__ . '/../includes/libraries');
1726
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', __DIR__.'/../includes/libraries');
1727 1727
         $php7generator->register();
1728 1728
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1729 1729
     }
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1759 1759
 {
1760 1760
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1761
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1761
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1762 1762
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1763 1763
     socket_close($sock);
1764 1764
 }
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
     }
1783 1783
 
1784 1784
     // include librairies & connect to DB
1785
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1785
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1786 1786
     if (defined('DB_PASSWD_CLEAR') === false) {
1787 1787
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1788 1788
     }
@@ -1808,14 +1808,14 @@  discard block
 block discarded – undo
1808 1808
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1809 1809
         if ($type === 'user_mngt') {
1810 1810
             send_syslog(
1811
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1811
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1812 1812
                 $SETTINGS['syslog_host'],
1813 1813
                 $SETTINGS['syslog_port'],
1814 1814
                 'teampass'
1815 1815
             );
1816 1816
         } else {
1817 1817
             send_syslog(
1818
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1818
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1819 1819
                 $SETTINGS['syslog_host'],
1820 1820
                 $SETTINGS['syslog_port'],
1821 1821
                 'teampass'
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
     ?string $encryption_type = null
1850 1850
 ): void {
1851 1851
     // include librairies & connect to DB
1852
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1852
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1853 1853
     if (defined('DB_PASSWD_CLEAR') === false) {
1854 1854
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1855 1855
     }
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
         if (empty($item_label) === true) {
1896 1896
             $dataItem = DB::queryfirstrow(
1897 1897
                 'SELECT id, id_tree, label
1898
-                FROM ' . prefixTable('items') . '
1898
+                FROM ' . prefixTable('items').'
1899 1899
                 WHERE id = %i',
1900 1900
                 $item_id
1901 1901
             );
@@ -1903,11 +1903,11 @@  discard block
 block discarded – undo
1903 1903
         }
1904 1904
 
1905 1905
         send_syslog(
1906
-            'action=' . str_replace('at_', '', $action) .
1907
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1908
-                ' itemno=' . $item_id .
1909
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1910
-                ' itemname="' . addslashes($item_label) . '"',
1906
+            'action='.str_replace('at_', '', $action).
1907
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1908
+                ' itemno='.$item_id.
1909
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1910
+                ' itemname="'.addslashes($item_label).'"',
1911 1911
             $SETTINGS['syslog_host'],
1912 1912
             $SETTINGS['syslog_port'],
1913 1913
             'teampass'
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1987 1987
 {
1988 1988
     // Load superglobal
1989
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1989
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1990 1990
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1991 1991
     // Get superglobals
1992 1992
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1996,8 +1996,8 @@  discard block
 block discarded – undo
1996 1996
     $notification = DB::queryOneColumn(
1997 1997
         'email',
1998 1998
         'SELECT *
1999
-        FROM ' . prefixTable('notification') . ' AS n
2000
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1999
+        FROM ' . prefixTable('notification').' AS n
2000
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
2001 2001
         WHERE n.item_id = %i AND n.user_id != %i',
2002 2002
         $item_id,
2003 2003
         $globalsUserId
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
         // Get list of changes
2009 2009
         $htmlChanges = '<ul>';
2010 2010
         foreach ($changes as $change) {
2011
-            $htmlChanges .= '<li>' . $change . '</li>';
2011
+            $htmlChanges .= '<li>'.$change.'</li>';
2012 2012
         }
2013 2013
         $htmlChanges .= '</ul>';
2014 2014
         // send email
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
2042 2042
 {
2043 2043
     // Class loader
2044
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
2044
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
2045 2045
     //Load Tree
2046 2046
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
2047 2047
     $tree->register();
@@ -2050,15 +2050,15 @@  discard block
 block discarded – undo
2050 2050
     $path = '';
2051 2051
     foreach ($arbo as $elem) {
2052 2052
         if (empty($path) === true) {
2053
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
2053
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
2054 2054
         } else {
2055
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2055
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2056 2056
         }
2057 2057
     }
2058 2058
 
2059 2059
     // Build text to show user
2060 2060
     if (empty($label) === false) {
2061
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
2061
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
2062 2062
     }
2063 2063
     return empty($path) === true ? '' : $path;
2064 2064
 }
@@ -2115,9 +2115,9 @@  discard block
 block discarded – undo
2115 2115
  */
2116 2116
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2117 2117
 {
2118
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2118
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2119 2119
     // include librairies & connect to DB
2120
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2120
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2121 2121
     if (defined('DB_PASSWD_CLEAR') === false) {
2122 2122
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2123 2123
     }
@@ -2132,8 +2132,8 @@  discard block
 block discarded – undo
2132 2132
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2133 2133
         // perform a copy
2134 2134
         if (file_exists($tp_config_file)) {
2135
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2136
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2135
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2136
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2137 2137
             }
2138 2138
         }
2139 2139
 
@@ -2143,11 +2143,11 @@  discard block
 block discarded – undo
2143 2143
         $data[1] = "global \$SETTINGS;\n";
2144 2144
         $data[2] = "\$SETTINGS = array (\n";
2145 2145
         $rows = DB::query(
2146
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2146
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2147 2147
             'admin'
2148 2148
         );
2149 2149
         foreach ($rows as $record) {
2150
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2150
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2151 2151
         }
2152 2152
         array_push($data, ");\n");
2153 2153
         $data = array_unique($data);
@@ -2161,15 +2161,15 @@  discard block
 block discarded – undo
2161 2161
                 break;
2162 2162
             }
2163 2163
 
2164
-            if (stristr($line, "'" . $field . "' => '")) {
2165
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "',\n";
2164
+            if (stristr($line, "'".$field."' => '")) {
2165
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."',\n";
2166 2166
                 $bFound = true;
2167 2167
                 break;
2168 2168
             }
2169 2169
             ++$inc;
2170 2170
         }
2171 2171
         if ($bFound === false) {
2172
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "',\n);\n";
2172
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."',\n);\n";
2173 2173
         }
2174 2174
     }
2175 2175
 
@@ -2199,7 +2199,7 @@  discard block
 block discarded – undo
2199 2199
 {
2200 2200
     global $SETTINGS;
2201 2201
     /* LOAD CPASSMAN SETTINGS */
2202
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2202
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2203 2203
         $SETTINGS = [];
2204 2204
         $SETTINGS['duplicate_folder'] = 0;
2205 2205
         //by default, this is set to 0;
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
         //by default, this value is set to 5;
2210 2210
         $settings = [];
2211 2211
         $rows = DB::query(
2212
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2212
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2213 2213
             [
2214 2214
                 'type' => 'admin',
2215 2215
                 'type2' => 'settings',
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
     $source_cf = [];
2242 2242
     $rows = DB::QUERY(
2243 2243
         'SELECT id_category
2244
-            FROM ' . prefixTable('categories_folders') . '
2244
+            FROM ' . prefixTable('categories_folders').'
2245 2245
             WHERE id_folder = %i',
2246 2246
         $source_id
2247 2247
     );
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
     $target_cf = [];
2253 2253
     $rows = DB::QUERY(
2254 2254
         'SELECT id_category
2255
-            FROM ' . prefixTable('categories_folders') . '
2255
+            FROM ' . prefixTable('categories_folders').'
2256 2256
             WHERE id_folder = %i',
2257 2257
         $target_id
2258 2258
     );
@@ -2287,9 +2287,9 @@  discard block
 block discarded – undo
2287 2287
     string $password = null
2288 2288
 ) {
2289 2289
     // Load AntiXSS
2290
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2291
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2290
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2291
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2292
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2293 2293
     $antiXss = new voku\helper\AntiXSS();
2294 2294
     // Protect against bad inputs
2295 2295
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2346,20 +2346,20 @@  discard block
 block discarded – undo
2346 2346
 ) {
2347 2347
     // load PhpEncryption library
2348 2348
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2349
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2350
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2351
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2352
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2353
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2354
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2355
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2356
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2357
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2358
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2359
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2360
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2361
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2362
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2349
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2350
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2351
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2352
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2353
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2354
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2355
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2356
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2357
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2358
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2359
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2360
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2361
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2362
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2363 2363
     try {
2364 2364
         \Defuse\Crypto\File::encryptFileWithPassword(
2365 2365
             $source_file,
@@ -2396,20 +2396,20 @@  discard block
 block discarded – undo
2396 2396
 ) {
2397 2397
     // load PhpEncryption library
2398 2398
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2399
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2400
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2401
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2402
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2403
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2404
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2405
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2406
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2407
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2408
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2409
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2410
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2411
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2412
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2399
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2400
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2401
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2402
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2403
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2404
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2405
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2406
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2407
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2408
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2409
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2410
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2411
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2412
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2413 2413
     try {
2414 2414
         \Defuse\Crypto\File::decryptFileWithPassword(
2415 2415
             $source_file,
@@ -2456,9 +2456,9 @@  discard block
 block discarded – undo
2456 2456
 function fileDelete(string $file, array $SETTINGS): void
2457 2457
 {
2458 2458
     // Load AntiXSS
2459
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2460
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2461
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2459
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2460
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2461
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2462 2462
     $antiXss = new voku\helper\AntiXSS();
2463 2463
     $file = $antiXss->xss_clean($file);
2464 2464
     if (is_file($file)) {
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
     int  $dirPerm = 0755
2509 2509
 ) {
2510 2510
     // Check if the path exists
2511
-    if (! file_exists($path)) {
2511
+    if (!file_exists($path)) {
2512 2512
         return false;
2513 2513
     }
2514 2514
 
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
  */
2547 2547
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2548 2548
 {
2549
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2549
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2550 2550
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2551 2551
     // Prepare superGlobal variables
2552 2552
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
     // Load item data
2555 2555
     $data = DB::queryFirstRow(
2556 2556
         'SELECT id_tree
2557
-        FROM ' . prefixTable('items') . '
2557
+        FROM ' . prefixTable('items').'
2558 2558
         WHERE id = %i',
2559 2559
         $item_id
2560 2560
     );
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
         }
2618 2618
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2619 2619
     }
2620
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2620
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2621 2621
     return $email;
2622 2622
 }
2623 2623
 
@@ -2633,8 +2633,8 @@  discard block
 block discarded – undo
2633 2633
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2634 2634
 {
2635 2635
     // include librairies & connect to DB
2636
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2637
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2636
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2637
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2638 2638
     if (defined('DB_PASSWD_CLEAR') === false) {
2639 2639
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2640 2640
     }
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
     DB::$connect_options = DB_CONNECT_OPTIONS;
2649 2649
     // Insert log in DB
2650 2650
     return DB::query(
2651
-        'SELECT ' . $fields . '
2651
+        'SELECT '.$fields.'
2652 2652
         FROM ' . prefixTable($table)
2653 2653
     );
2654 2654
 }
@@ -2663,11 +2663,11 @@  discard block
 block discarded – undo
2663 2663
 function formatSizeUnits(int $bytes): string
2664 2664
 {
2665 2665
     if ($bytes >= 1073741824) {
2666
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2666
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2667 2667
     } elseif ($bytes >= 1048576) {
2668
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2668
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2669 2669
     } elseif ($bytes >= 1024) {
2670
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2670
+        $bytes = number_format($bytes / 1024, 2).' KB';
2671 2671
     } elseif ($bytes > 1) {
2672 2672
         $bytes .= ' bytes';
2673 2673
     } elseif ($bytes === 1) {
@@ -2882,14 +2882,14 @@  discard block
 block discarded – undo
2882 2882
 
2883 2883
     // Encrypt the file content
2884 2884
     $plaintext = file_get_contents(
2885
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2885
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2886 2886
     );
2887 2887
     $ciphertext = $cipher->encrypt($plaintext);
2888 2888
     // Save new file
2889 2889
     $hash = md5($plaintext);
2890
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2890
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2891 2891
     file_put_contents($fileOut, $ciphertext);
2892
-    unlink($fileInPath . '/' . $fileInName);
2892
+    unlink($fileInPath.'/'.$fileInName);
2893 2893
     return [
2894 2894
         'fileHash' => base64_encode($hash),
2895 2895
         'objectKey' => base64_encode($objectKey),
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
  */
2908 2908
 function decryptFile(string $fileName, string $filePath, string $key): string
2909 2909
 {
2910
-    if (! defined('FILE_BUFFER_SIZE')) {
2910
+    if (!defined('FILE_BUFFER_SIZE')) {
2911 2911
         define('FILE_BUFFER_SIZE', 128 * 1024);
2912 2912
     }
2913 2913
 
@@ -2926,7 +2926,7 @@  discard block
 block discarded – undo
2926 2926
     $cipher->enableContinuousBuffer();
2927 2927
     $cipher->disablePadding();
2928 2928
     // Get file content
2929
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2929
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2930 2930
     // Decrypt file content and return
2931 2931
     return base64_encode($cipher->decrypt($ciphertext));
2932 2932
 }
@@ -2980,8 +2980,8 @@  discard block
 block discarded – undo
2980 2980
     array $SETTINGS
2981 2981
 ): void {
2982 2982
     // include librairies & connect to DB
2983
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2984
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2983
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2984
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2985 2985
     if (defined('DB_PASSWD_CLEAR') === false) {
2986 2986
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2987 2987
     }
@@ -3000,7 +3000,7 @@  discard block
 block discarded – undo
3000 3000
         $post_object_id
3001 3001
     );
3002 3002
     // Superglobals
3003
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3003
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3004 3004
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
3005 3005
     // Prepare superGlobal variables
3006 3006
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -3025,8 +3025,8 @@  discard block
 block discarded – undo
3025 3025
         // Create sharekey for each user
3026 3026
         $users = DB::query(
3027 3027
             'SELECT id, public_key
3028
-            FROM ' . prefixTable('users') . '
3029
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
3028
+            FROM ' . prefixTable('users').'
3029
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
3030 3030
             AND public_key != ""'
3031 3031
         );
3032 3032
         foreach ($users as $user) {
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
 function isBase64(string $str): bool
3057 3057
 {
3058 3058
     $str = (string) trim($str);
3059
-    if (! isset($str[0])) {
3059
+    if (!isset($str[0])) {
3060 3060
         return false;
3061 3061
     }
3062 3062
 
@@ -3124,12 +3124,12 @@  discard block
 block discarded – undo
3124 3124
         ],
3125 3125
     ];
3126 3126
     // Load expected libraries
3127
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3128
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3129
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3130
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3131
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3132
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3127
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3128
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3129
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3130
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3131
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3132
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3133 3133
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3134 3134
     $ad->register();
3135 3135
     $connection = new Connection($config);
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
         $connection->connect();
3139 3139
     } catch (\LdapRecord\Auth\BindException $e) {
3140 3140
         $error = $e->getDetailedError();
3141
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3141
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3142 3142
         return false;
3143 3143
     }
3144 3144
 
@@ -3151,7 +3151,7 @@  discard block
 block discarded – undo
3151 3151
         }
3152 3152
     } catch (\LdapRecord\Auth\BindException $e) {
3153 3153
         $error = $e->getDetailedError();
3154
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3154
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3155 3155
         return false;
3156 3156
     }
3157 3157
 
@@ -3169,8 +3169,8 @@  discard block
 block discarded – undo
3169 3169
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3170 3170
 {
3171 3171
     // include librairies & connect to DB
3172
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3173
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3172
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3173
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3174 3174
     if (defined('DB_PASSWD_CLEAR') === false) {
3175 3175
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3176 3176
     }
@@ -3230,7 +3230,7 @@  discard block
 block discarded – undo
3230 3230
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3231 3231
             $now->setTimezone(new DateTimeZone($timezone));
3232 3232
             $offsets[] = $offset = $now->getOffset();
3233
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3233
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3234 3234
         }
3235 3235
 
3236 3236
         array_multisort($offsets, $timezones);
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
 {
3251 3251
     $hours = intval($offset / 3600);
3252 3252
     $minutes = abs(intval($offset % 3600 / 60));
3253
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3253
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3254 3254
 }
3255 3255
 
3256 3256
 /**
@@ -3350,8 +3350,7 @@  discard block
 block discarded – undo
3350 3350
 {
3351 3351
     if (isset($array[$key]) === true
3352 3352
         && (is_int($value) === true ?
3353
-            (int) $array[$key] === $value :
3354
-            (string) $array[$key] === $value)
3353
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3355 3354
     ) {
3356 3355
         return true;
3357 3356
     }
@@ -3373,8 +3372,7 @@  discard block
 block discarded – undo
3373 3372
 {
3374 3373
     if (isset($var) === false
3375 3374
         || (is_int($value) === true ?
3376
-            (int) $var === $value :
3377
-            (string) $var === $value)
3375
+            (int) $var === $value : (string) $var === $value)
3378 3376
     ) {
3379 3377
         return true;
3380 3378
     }
@@ -3425,7 +3423,7 @@  discard block
 block discarded – undo
3425 3423
  */
3426 3424
 function isSetArrayOfValues(array $arrayOfValues): bool
3427 3425
 {
3428
-    foreach($arrayOfValues as $value) {
3426
+    foreach ($arrayOfValues as $value) {
3429 3427
         if (isset($value) === false) {
3430 3428
             return false;
3431 3429
         }
@@ -3447,7 +3445,7 @@  discard block
 block discarded – undo
3447 3445
     /*PHP8 - integer|string*/$value
3448 3446
 ) : bool
3449 3447
 {
3450
-    foreach($arrayOfVars as $variable) {
3448
+    foreach ($arrayOfVars as $variable) {
3451 3449
         if ($variable !== $value) {
3452 3450
             return false;
3453 3451
         }
@@ -3467,7 +3465,7 @@  discard block
 block discarded – undo
3467 3465
     /*PHP8 - integer|string*/$value
3468 3466
 ) : bool
3469 3467
 {
3470
-    foreach($arrayOfVars as $variable) {
3468
+    foreach ($arrayOfVars as $variable) {
3471 3469
         if ($variable === $value) {
3472 3470
             return true;
3473 3471
         }
@@ -3540,16 +3538,16 @@  discard block
 block discarded – undo
3540 3538
 ): array
3541 3539
 {
3542 3540
     // Load Sanitizer library
3543
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3544
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3545
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3546
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3547
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3548
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3549
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3550
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3551
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3552
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3541
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3542
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3543
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3544
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3545
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3546
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3547
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3548
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3549
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3550
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3553 3551
 
3554 3552
     // Sanitize post and get variables
3555 3553
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
@@ -3567,9 +3565,9 @@  discard block
 block discarded – undo
3567 3565
  */
3568 3566
 function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS, string $field_update = '')
3569 3567
 {
3570
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
3568
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
3571 3569
     //Connect to DB
3572
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3570
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3573 3571
     if (defined('DB_PASSWD_CLEAR') === false) {
3574 3572
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3575 3573
     }
@@ -3585,7 +3583,7 @@  discard block
 block discarded – undo
3585 3583
     // Exists ?
3586 3584
     $userCacheId = DB::queryfirstrow(
3587 3585
         'SELECT increment_id
3588
-        FROM ' . prefixTable('cache_tree') . '
3586
+        FROM ' . prefixTable('cache_tree').'
3589 3587
         WHERE user_id = %i',
3590 3588
         $user_id
3591 3589
     );
@@ -3634,7 +3632,7 @@  discard block
 block discarded – undo
3634 3632
  */
3635 3633
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3636 3634
 { 
3637
-    $resultat = ($nombre/$total) * $pourcentage;
3635
+    $resultat = ($nombre / $total) * $pourcentage;
3638 3636
     return round($resultat);
3639 3637
 }
3640 3638
 
@@ -3662,7 +3660,7 @@  discard block
 block discarded – undo
3662 3660
 
3663 3661
     // Get last folder update
3664 3662
     $lastFolderChange = DB::queryfirstrow(
3665
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3663
+        'SELECT valeur FROM '.prefixTable('misc').'
3666 3664
         WHERE type = %s AND intitule = %s',
3667 3665
         'timestamp',
3668 3666
         'last_folder_change'
@@ -3692,7 +3690,7 @@  discard block
 block discarded – undo
3692 3690
     // Does this user has a tree cache
3693 3691
     $userCacheTree = DB::queryfirstrow(
3694 3692
         'SELECT '.$fieldName.'
3695
-        FROM ' . prefixTable('cache_tree') . '
3693
+        FROM ' . prefixTable('cache_tree').'
3696 3694
         WHERE user_id = %i',
3697 3695
         $_SESSION['user_id']
3698 3696
     );
@@ -3721,10 +3719,10 @@  discard block
 block discarded – undo
3721 3719
 )
3722 3720
 {
3723 3721
     //load ClassLoader
3724
-    include_once __DIR__. '/../sources/SplClassLoader.php';
3722
+    include_once __DIR__.'/../sources/SplClassLoader.php';
3725 3723
     
3726 3724
     //Connect to DB
3727
-    include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php';
3725
+    include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php';
3728 3726
     if (defined('DB_PASSWD_CLEAR') === false) {
3729 3727
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, []));
3730 3728
     }
@@ -3743,7 +3741,7 @@  discard block
 block discarded – undo
3743 3741
     if (count($folderIds) === 0) {
3744 3742
         $folderIds = DB::queryFirstColumn(
3745 3743
             'SELECT id
3746
-            FROM ' . prefixTable('nested_tree') . '
3744
+            FROM ' . prefixTable('nested_tree').'
3747 3745
             WHERE personal_folder=%i',
3748 3746
             0
3749 3747
         );
@@ -3760,8 +3758,8 @@  discard block
 block discarded – undo
3760 3758
         $rows_tmp = DB::query(
3761 3759
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3762 3760
             f.id_category AS category_id
3763
-            FROM ' . prefixTable('categories_folders') . ' AS f
3764
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3761
+            FROM ' . prefixTable('categories_folders').' AS f
3762
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3765 3763
             WHERE id_folder=%i',
3766 3764
             $folder
3767 3765
         );
@@ -3787,7 +3785,7 @@  discard block
 block discarded – undo
3787 3785
         $valTemp = '';
3788 3786
         $data = DB::queryFirstRow(
3789 3787
             'SELECT valeur
3790
-            FROM ' . prefixTable('misc') . '
3788
+            FROM ' . prefixTable('misc').'
3791 3789
             WHERE type = %s AND intitule=%i',
3792 3790
             'complex',
3793 3791
             $folder
@@ -3804,14 +3802,14 @@  discard block
 block discarded – undo
3804 3802
         $valTemp = '';
3805 3803
         $rows_tmp = DB::query(
3806 3804
             'SELECT t.title
3807
-            FROM ' . prefixTable('roles_values') . ' as v
3808
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3805
+            FROM ' . prefixTable('roles_values').' as v
3806
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3809 3807
             WHERE v.folder_id = %i
3810 3808
             GROUP BY title',
3811 3809
             $folder
3812 3810
         );
3813 3811
         foreach ($rows_tmp as $record) {
3814
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3812
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3815 3813
         }
3816 3814
         $arr_data['visibilityRoles'] = $valTemp;
3817 3815
 
@@ -3843,7 +3841,7 @@  discard block
 block discarded – undo
3843 3841
         // loop on users and check if user has this role
3844 3842
         $rows = DB::query(
3845 3843
             'SELECT id, fonction_id
3846
-            FROM ' . prefixTable('users') . '
3844
+            FROM ' . prefixTable('users').'
3847 3845
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3848 3846
             $_SESSION['user_id']
3849 3847
         );
@@ -3874,12 +3872,12 @@  discard block
 block discarded – undo
3874 3872
 function upgradeRequired(): bool
3875 3873
 {
3876 3874
     // Get settings.php
3877
-    include_once __DIR__. '/../includes/config/settings.php';
3875
+    include_once __DIR__.'/../includes/config/settings.php';
3878 3876
 
3879 3877
     // Get timestamp in DB
3880 3878
     $val = DB::queryfirstrow(
3881 3879
         'SELECT valeur
3882
-        FROM ' . prefixTable('misc') . '
3880
+        FROM ' . prefixTable('misc').'
3883 3881
         WHERE type = %s AND intitule = %s',
3884 3882
         'admin',
3885 3883
         'upgrade_timestamp'
Please login to merge, or discard this patch.
sources/ldap.queries.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -46,26 +46,26 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 /* do checks */
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
50
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
51 51
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit();
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
65
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
66 66
 
67 67
 // connect to the server
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
69 69
 if (defined('DB_PASSWD_CLEAR') === false) {
70 70
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
71 71
 }
@@ -103,38 +103,38 @@  discard block
 block discarded – undo
103 103
         );
104 104
 
105 105
         // Load expected libraries
106
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
107
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
108
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
109
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
110
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
111
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
112
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
113
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
114
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
115
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
116
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
117
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
118
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
119
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
120
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
121
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
122
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
123
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
124
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
125
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
126
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
127
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
128
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
129
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
130
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
131
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
132
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
133
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
134
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
135
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
136
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
137
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
106
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
107
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
108
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
109
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
110
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
111
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
112
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
113
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
114
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
115
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
116
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
117
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
118
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
119
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
120
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
121
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
122
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
123
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
124
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
125
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
126
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
127
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
128
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
129
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
130
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
131
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
132
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
133
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
134
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
135
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
137
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
138 138
 
139 139
         // prepare variables
140 140
         $post_username = filter_var($dataReceived['username'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                 $SETTINGS['cpassman_dir'],
175 175
                 array(
176 176
                     'error' => true,
177
-                    'message' => "Error : ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
177
+                    'message' => "Error : ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
178 178
                 ),
179 179
                 'encode'
180 180
             );
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         // We want to isolate attribute ldap_user_attribute
198 198
         try {
199 199
             $user = $connection->query()
200
-            ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'distinguishedname', '=', $post_username)
200
+            ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'distinguishedname', '=', $post_username)
201 201
             ->firstOrFail();
202 202
             //print_r($user);
203 203
         } catch (\LdapRecord\LdapRecordException $e) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                 $SETTINGS['cpassman_dir'],
208 208
                 array(
209 209
                     'error' => true,
210
-                    'message' => langHdl('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
210
+                    'message' => langHdl('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
211 211
                 ),
212 212
                 'encode'
213 213
             );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                 $SETTINGS['cpassman_dir'],
234 234
                 array(
235 235
                     'error' => true,
236
-                    'message' => langHdl('error').' : '.(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
236
+                    'message' => langHdl('error').' : '.(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
237 237
                 ),
238 238
                 'encode'
239 239
             );
Please login to merge, or discard this patch.