Passed
Push — teampass_3.0 ( 0b1c1e...99aa1e )
by Nils
05:25
created
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
     // Load AntiXSS
51 51
     include_once '../includes/libraries/voku/helper/AntiXSS.php';
52 52
     $antiXss = new voku\helper\AntiXSS();
53
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
54
-        header('Location: ' . $antiXss->xss_clean($url));
53
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
54
+        header('Location: '.$antiXss->xss_clean($url));
55 55
         exit;
56 56
     }
57 57
 
58 58
     //If headers are sent... do java redirect... if java disabled, do html redirect.
59 59
     echo '<script type="text/javascript">';
60
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
60
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
61 61
     echo '</script>';
62 62
     echo '<noscript>';
63
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
63
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
64 64
     echo '</noscript>';
65 65
 }
66 66
 
67 67
 // Include files
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
69 69
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
70 70
 // Prepare GET variables
71 71
 $server = [];
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     && isset($SETTINGS['enable_sts']) === true
89 89
     && (int) $SETTINGS['enable_sts'] === 1
90 90
 ) {
91
-    redirect('https://' . $server['http_host'] . $server['request_uri']);
91
+    redirect('https://'.$server['http_host'].$server['request_uri']);
92 92
 }
93 93
 
94 94
 // Load pwComplexity
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 // LOAD CPASSMAN SETTINGS
114 114
 if (
115 115
     isset($SETTINGS['cpassman_dir']) === true
116
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
116
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
117 117
 ) {
118 118
     // Should we delete folder INSTALL?
119 119
     $row = DB::queryFirstRow(
120
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
120
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
121 121
         'install',
122 122
         'clear_install_folder'
123 123
     );
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
             if ($directories !== false) {
136 136
                 $files = array_diff($directories, ['.', '..']);
137 137
                 foreach ($files as $file) {
138
-                    if (is_dir($dir . '/' . $file)) {
139
-                        delTree($dir . '/' . $file);
138
+                    if (is_dir($dir.'/'.$file)) {
139
+                        delTree($dir.'/'.$file);
140 140
                     } else {
141 141
                         try {
142
-                            unlink($dir . '/' . $file);
142
+                            unlink($dir.'/'.$file);
143 143
                         } catch (Exception $e) {
144 144
                             // do nothing... php will ignore and continue
145 145
                         }
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
             }
153 153
         }
154 154
 
155
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
155
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
156 156
             // Set the permissions on the install directory and delete
157 157
             // is server Windows or Linux?
158 158
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
159
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
159
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
160 160
             }
161
-            delTree($SETTINGS['cpassman_dir'] . '/install');
161
+            delTree($SETTINGS['cpassman_dir'].'/install');
162 162
         }
163 163
 
164 164
         // Delete temporary install table
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 // Load Languages stuff
177 177
 if (isset($languagesList) === false) {
178 178
     $languagesList = [];
179
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
179
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
180 180
     foreach ($rows as $record) {
181 181
         array_push($languagesList, $record['name']);
182 182
         if (isset($_SESSION['user_language']) && $record['name'] === $_SESSION['user_language']) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
235 235
 if (empty($_SESSION['sessionDuration']) === false) {
236 236
     $dataSession = DB::queryFirstRow(
237
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
237
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
238 238
         $_SESSION['user_id']
239 239
     );
240 240
 } else {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     && (isset($_SESSION['user_admin']) === true && $_SESSION['user_admin'] === 1)
299 299
 ) {
300 300
     $row = DB::queryFirstRow(
301
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
301
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
302 302
         [
303 303
             'type' => 'admin',
304 304
             'intitule' => 'cpassman_version',
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
         syslog(
360 360
             LOG_WARNING,
361
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
361
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
362 362
         );
363 363
         // erase session table
364 364
         $_SESSION = [];
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 if (isset($_SESSION['user_id']) === true && empty($_SESSION['user_id']) === false) {
410 410
     // query on user
411 411
     $data = DB::queryfirstrow(
412
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM ' . prefixTable('users') . ' WHERE id=%i',
412
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM '.prefixTable('users').' WHERE id=%i',
413 413
         $_SESSION['user_id']
414 414
     );
415 415
     //Check if user has been deleted or unlogged
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     $_SESSION['item_fields'] = [];
491 491
     $rows = DB::query(
492 492
         'SELECT *
493
-            FROM ' . prefixTable('categories') . '
493
+            FROM ' . prefixTable('categories').'
494 494
             WHERE level=%i',
495 495
         '0'
496 496
     );
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         // get each field
500 500
         $rows2 = DB::query(
501 501
             'SELECT *
502
-            FROM ' . prefixTable('categories') . '
502
+            FROM ' . prefixTable('categories').'
503 503
             WHERE parent_id=%i
504 504
             ORDER BY `order` ASC',
505 505
             $record['id']
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 if (
577 577
     isset($SETTINGS['roles_allowed_to_print']) === true
578 578
     && isset($_SESSION['user_roles']) === true
579
-    && (! isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout']))
579
+    && (!isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout']))
580 580
 ) {
581 581
     foreach (explode(';', $SETTINGS['roles_allowed_to_print']) as $role) {
582 582
         if (in_array($role, $_SESSION['user_roles']) === true) {
@@ -586,5 +586,5 @@  discard block
 block discarded – undo
586 586
 }
587 587
 
588 588
 /* CHECK NUMBER OF USER ONLINE */
589
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
589
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
590 590
 $_SESSION['nb_users_online'] = DB::count();
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  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'], 'options', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit;
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         array(
118 118
                             'http' => array(
119 119
                                 'ignore_errors' => true,
120
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
120
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
121 121
                             ),
122 122
                         )
123 123
                     );
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
                     $json_array = json_decode($json, true);
137 137
 
138 138
                     // About version
139
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL;
139
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL;
140 140
                     if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) {
141
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
141
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
142 142
                     }
143 143
                     $text .= '</li>';
144 144
 
145 145
                     // Libraries
146 146
                     $text .= '<li><u>Libraries</u> :</li>';
147 147
                     foreach ($json_array['libraries'] as $key => $val) {
148
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
148
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
149 149
                     }
150 150
                 }
151 151
             } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         }
157 157
         $text .= '</ul>';
158 158
 
159
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
159
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
160 160
         break;
161 161
 
162 162
         //##########################################################
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         //get through all users
189 189
         $rows = DB::query(
190 190
             'SELECT id, login, email
191
-            FROM ' . prefixTable('users') . '
191
+            FROM ' . prefixTable('users').'
192 192
             ORDER BY login ASC'
193 193
         );
194 194
         foreach ($rows as $record) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             //if folder doesn't exist then create it
206 206
             $data = DB::queryfirstrow(
207 207
                 'SELECT id
208
-                FROM ' . prefixTable('nested_tree') . '
208
+                FROM ' . prefixTable('nested_tree').'
209 209
                 WHERE title = %s AND parent_id = %i',
210 210
                 $record['id'],
211 211
                 0
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         echo prepareExchangedData(
268 268
             array(
269 269
                 'error' => false,
270
-                'message' => langHdl('last_execution') . ' ' .
271
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
270
+                'message' => langHdl('last_execution').' '.
271
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
272 272
                     '<i class="fas fa-check text-success ml-2"></i>',
273 273
             ),
274 274
             'encode'
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         }
303 303
 
304 304
         //Libraries call
305
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
305
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
306 306
 
307 307
         //init
308 308
         $foldersIds = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
         }
318 318
 
319
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
319
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
320 320
         foreach ($items as $item) {
321 321
             //Delete item
322 322
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
         // delete orphan items
338 338
         $rows = DB::query(
339 339
             'SELECT id
340
-            FROM ' . prefixTable('items') . '
340
+            FROM ' . prefixTable('items').'
341 341
             ORDER BY id ASC'
342 342
         );
343 343
         foreach ($rows as $item) {
344 344
             DB::query(
345
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
345
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
346 346
                 $item['id'],
347 347
                 'at_creation'
348 348
             );
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
         echo prepareExchangedData(
373 373
             array(
374 374
                 'error' => false,
375
-                'message' => langHdl('last_execution') . ' ' .
376
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
375
+                'message' => langHdl('last_execution').' '.
376
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
377 377
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
378 378
                     <i class="fas fa-chevron-right mr-2"></i>' .
379
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
379
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
380 380
             ),
381 381
             'encode'
382 382
         );
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
             break;
409 409
         }
410 410
 
411
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
411
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
412 412
         $return = '';
413 413
 
414 414
         //Get all tables
415 415
         $tables = array();
416 416
         $result = DB::query('SHOW TABLES');
417 417
         foreach ($result as $row) {
418
-            $tables[] = $row['Tables_in_' . $database];
418
+            $tables[] = $row['Tables_in_'.$database];
419 419
         }
420 420
 
421 421
         //cycle through
422 422
         foreach ($tables as $table) {
423 423
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
424 424
                 // Do query
425
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
425
+                $result = DB::queryRaw('SELECT * FROM '.$table);
426 426
                 DB::queryRaw(
427 427
                     'SELECT *
428 428
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
                 $numFields = DB::count();
435 435
 
436 436
                 // prepare a drop table
437
-                $return .= 'DROP TABLE ' . $table . ';';
438
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
439
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
437
+                $return .= 'DROP TABLE '.$table.';';
438
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
439
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
440 440
 
441 441
                 //prepare all fields and datas
442 442
                 for ($i = 0; $i < $numFields; ++$i) {
443 443
                     while ($row = $result->fetch_row()) {
444
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
444
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
445 445
                         for ($j = 0; $j < $numFields; ++$j) {
446 446
                             $row[$j] = addslashes($row[$j]);
447 447
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
448 448
                             if (isset($row[$j])) {
449
-                                $return .= '"' . $row[$j] . '"';
449
+                                $return .= '"'.$row[$j].'"';
450 450
                             } else {
451 451
                                 $return .= 'NULL';
452 452
                             }
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
467 467
 
468 468
             //save file
469
-            $filename = time() . '-' . $token . '.sql';
470
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
469
+            $filename = time().'-'.$token.'.sql';
470
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
471 471
             if ($handle !== false) {
472 472
                 //write file
473 473
                 fwrite($handle, $return);
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
                 // Encrypt the file
480 480
                 prepareFileWithDefuse(
481 481
                     'encrypt',
482
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
483
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
482
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
483
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
484 484
                     $SETTINGS,
485 485
                     $post_option
486 486
                 );
487 487
 
488 488
                 // Do clean
489
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
489
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
490 490
                 rename(
491
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
492
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
491
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
492
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
493 493
                 );
494 494
             }
495 495
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             //update LOG
500 500
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
501 501
 
502
-            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"}]';
502
+            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"}]';
503 503
         }
504 504
         break;
505 505
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             );
529 529
             break;
530 530
         }
531
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
531
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
532 532
 
533 533
         $dataPost = explode('&', $post_option);
534 534
         $file = htmlspecialchars($dataPost[0]);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
         // Get filename from database
538 538
         $data = DB::queryFirstRow(
539 539
             'SELECT valeur
540
-            FROM ' . prefixTable('misc') . '
540
+            FROM ' . prefixTable('misc').'
541 541
             WHERE increment_id = %i',
542 542
             $file
543 543
         );
@@ -556,22 +556,22 @@  discard block
 block discarded – undo
556 556
             // Decrypt the file
557 557
             $ret = prepareFileWithDefuse(
558 558
                 'decrypt',
559
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
560
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
559
+                $SETTINGS['path_to_files_folder'].'/'.$file,
560
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
561 561
                 $SETTINGS,
562 562
                 $key
563 563
             );
564 564
 
565 565
             if (empty($ret) === false) {
566
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
566
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
567 567
                 break;
568 568
             }
569 569
 
570 570
             // Do clean
571
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
572
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
571
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
572
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
573 573
         } else {
574
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
574
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
575 575
         }
576 576
 
577 577
         //read sql file
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         fclose($handle);
589 589
 
590 590
         //delete file
591
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
591
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
592 592
 
593 593
         //Show done
594 594
         echo '[{"result":"db_restore" , "message":""}]';
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
             foreach ($table as $i => $tablename) {
627 627
                 if (substr_count($tablename, DB_PREFIX) > 0) {
628 628
                     // launch optimization quieries
629
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
630
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
629
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
630
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
631 631
                 }
632 632
             }
633 633
         }
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
         //Clean up LOG_ITEMS table
636 636
         $rows = DB::query(
637 637
             'SELECT id
638
-            FROM ' . prefixTable('items') . '
638
+            FROM ' . prefixTable('items').'
639 639
             ORDER BY id ASC'
640 640
         );
641 641
         foreach ($rows as $item) {
642 642
             DB::query(
643
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
643
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
644 644
                 $item['id'],
645 645
                 'at_creation'
646 646
             );
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             if ($counter === 0) {
649 649
                 //Create new at_creation entry
650 650
                 $rowTmp = DB::queryFirstRow(
651
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
651
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
652 652
                     $item['id']
653 653
                 );
654 654
                 DB::insert(
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
         echo prepareExchangedData(
679 679
             array(
680 680
                 'error' => false,
681
-                'message' => langHdl('last_execution') . ' ' .
682
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
681
+                'message' => langHdl('last_execution').' '.
682
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
683 683
                     '<i class="fas fa-check text-success ml-2"></i>',
684 684
             ),
685 685
             'encode'
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
             break;
713 713
         }
714 714
 
715
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
715
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
716 716
 
717 717
         //read folder
718 718
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
719 719
             echo prepareExchangedData(
720 720
                 array(
721 721
                     'error' => true,
722
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
722
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
723 723
                 ),
724 724
                 'encode'
725 725
             );
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
             //delete file FILES
732 732
             while (false !== ($f = readdir($dir))) {
733 733
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
734
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
735
-                        fileDelete($dir . '/' . $f, $SETTINGS);
734
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
735
+                        fileDelete($dir.'/'.$f, $SETTINGS);
736 736
                     }
737 737
                 }
738 738
             }
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
             echo prepareExchangedData(
747 747
                 array(
748 748
                     'error' => true,
749
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
749
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
750 750
                 ),
751 751
                 'encode'
752 752
             );
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
             while (false !== ($f = readdir($dir))) {
761 761
                 if ($f !== '.' && $f !== '..') {
762 762
                     if (strpos($f, '_delete.') > 0) {
763
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
763
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
764 764
                     }
765 765
                 }
766 766
             }
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
         echo prepareExchangedData(
783 783
             array(
784 784
                 'error' => false,
785
-                'message' => langHdl('last_execution') . ' ' .
786
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
785
+                'message' => langHdl('last_execution').' '.
786
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
787 787
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
788 788
                     <i class="fas fa-chevron-right mr-2"></i>' .
789
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
789
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
790 790
             ),
791 791
             'encode'
792 792
         );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
             break;
820 820
         }
821 821
 
822
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
822
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
823 823
         updateCacheTable('reload', $SETTINGS, NULL);
824 824
 
825 825
         // Log
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
         echo prepareExchangedData(
836 836
             [
837 837
                 'error' => false,
838
-                'message' => langHdl('last_execution') . ' ' .
839
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
838
+                'message' => langHdl('last_execution').' '.
839
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
840 840
                     '<i class="fas fa-check text-success mr-2"></i>',
841 841
             ],
842 842
             'encode'
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         }
872 872
 
873 873
         // Perform
874
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
874
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
875 875
         $ret = handleConfigFile('rebuild', $SETTINGS);
876 876
 
877 877
         // Log
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
         echo prepareExchangedData(
899 899
             array(
900 900
                 'error' => false,
901
-                'message' => langHdl('last_execution') . ' ' .
902
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
901
+                'message' => langHdl('last_execution').' '.
902
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
903 903
                     '<i class="fas fa-check text-success ml-2"></i>',
904 904
             ),
905 905
             'encode'
@@ -939,33 +939,33 @@  discard block
 block discarded – undo
939 939
         $filename = $post_option;
940 940
         $tp_settings = [];
941 941
         //get backups infos
942
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
942
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
943 943
         foreach ($rows as $record) {
944 944
             $tp_settings[$record['intitule']] = $record['valeur'];
945 945
         }
946 946
 
947 947
         // check if backup file is in DB.
948 948
         // If YES then it is encrypted with DEFUSE
949
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
949
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
950 950
 
951 951
         //read file
952 952
         $return = '';
953
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
953
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
954 954
         if (file_exists($Fnm)) {
955 955
             if (!empty($bck) && $bck['valeur'] === $filename) {
956 956
                 $err = '';
957 957
 
958 958
                 // it means that file is DEFUSE encrypted
959
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
960
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
963
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
959
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
960
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
963
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
964 964
 
965 965
                 try {
966 966
                     \Defuse\Crypto\File::decryptFileWithPassword(
967
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
968
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
967
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
968
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
969 969
                         base64_decode($SETTINGS['bck_script_key'])
970 970
                     );
971 971
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
                 }
974 974
 
975 975
                 if (!empty($err)) {
976
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
976
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
977 977
                     break;
978 978
                 }
979 979
             } else {
@@ -995,19 +995,19 @@  discard block
 block discarded – undo
995 995
                 );
996 996
 
997 997
                 //save the file
998
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
998
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
999 999
                 if ($handle !== false) {
1000 1000
                     fwrite($handle, $return);
1001 1001
                     fclose($handle);
1002 1002
                 }
1003 1003
             }
1004 1004
             $result = 'backup_decrypt_success';
1005
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1005
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1006 1006
         } else {
1007 1007
             $result = 'backup_decrypt_fails';
1008
-            $msg = 'File not found: ' . $Fnm;
1008
+            $msg = 'File not found: '.$Fnm;
1009 1009
         }
1010
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1010
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1011 1011
         break;
1012 1012
 
1013 1013
         /*
@@ -1041,22 +1041,22 @@  discard block
 block discarded – undo
1041 1041
         require_once 'main.functions.php';
1042 1042
 
1043 1043
         // store old sk
1044
-        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1044
+        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1045 1045
 
1046 1046
         // generate new saltkey
1047
-        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1047
+        $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1048 1048
         copy(
1049
-            SECUREPATH . '/teampass-seckey.txt',
1049
+            SECUREPATH.'/teampass-seckey.txt',
1050 1050
             $old_sk_filename
1051 1051
         );
1052 1052
         $new_key = defuse_generate_key();
1053 1053
         file_put_contents(
1054
-            SECUREPATH . '/teampass-seckey.txt',
1054
+            SECUREPATH.'/teampass-seckey.txt',
1055 1055
             $new_key
1056 1056
         );
1057 1057
 
1058 1058
         // store new sk
1059
-        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1059
+        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1060 1060
 
1061 1061
         //put tool in maintenance.
1062 1062
         DB::update(
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
1073 1073
 
1074 1074
         // get number of items to change
1075
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1075
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1076 1076
         $nb_of_items = DB::count();
1077 1077
 
1078 1078
         // create backup table
1079
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1079
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1080 1080
         DB::query(
1081
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1081
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1082 1082
             `id` int(12) NOT null AUTO_INCREMENT,
1083 1083
             `current_table` varchar(100) NOT NULL,
1084 1084
             `current_field` varchar(500) NOT NULL,
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         );
1107 1107
 
1108 1108
         // delete previous backup files
1109
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1109
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1110 1110
         foreach ($files as $file) { // iterate files
1111 1111
             if (is_file($file)) {
1112 1112
                 $file_parts = pathinfo($file);
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
                 echo prepareExchangedData(
1189 1189
                     array(
1190 1190
                         'error' => true,
1191
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1191
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1192 1192
                         'nbOfItems' => '',
1193 1193
                         'nextAction' => '',
1194 1194
                     ),
@@ -1201,9 +1201,9 @@  discard block
 block discarded – undo
1201 1201
                 //change all encrypted data in Items (passwords)
1202 1202
                 $rows = DB::query(
1203 1203
                     'SELECT id, pw, pw_iv
1204
-                    FROM ' . prefixTable('items') . '
1204
+                    FROM ' . prefixTable('items').'
1205 1205
                     WHERE perso = %s
1206
-                    LIMIT ' . $post_start . ', ' . $post_length,
1206
+                    LIMIT ' . $post_start.', '.$post_length,
1207 1207
                     '0'
1208 1208
                 );
1209 1209
                 foreach ($rows as $record) {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
                             'current_field' => 'pw',
1216 1216
                             'value_id' => $record['id'],
1217 1217
                             'value' => $record['pw'],
1218
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1218
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1219 1219
                             'value2' => 'none',
1220 1220
                             'result' => 'none',
1221 1221
                         )
@@ -1264,9 +1264,9 @@  discard block
 block discarded – undo
1264 1264
                 //change all encrypted data in Logs (passwords)
1265 1265
                 $rows = DB::query(
1266 1266
                     'SELECT raison, increment_id
1267
-                    FROM ' . prefixTable('log_items') . "
1267
+                    FROM ' . prefixTable('log_items')."
1268 1268
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1269
-                    LIMIT " . $post_start . ', ' . $post_length,
1269
+                    LIMIT " . $post_start.', '.$post_length,
1270 1270
                     'at_modification'
1271 1271
                 );
1272 1272
                 foreach ($rows as $record) {
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
                             'current_field' => 'raison',
1279 1279
                             'value_id' => $record['increment_id'],
1280 1280
                             'value' => $record['raison'],
1281
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1281
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1282 1282
                             'value2' => 'none',
1283 1283
                             'result' => 'none',
1284 1284
                         )
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
                         DB::update(
1307 1307
                             prefixTable('log_items'),
1308 1308
                             array(
1309
-                                'raison' => 'at_pw :' . $encrypt['string'],
1309
+                                'raison' => 'at_pw :'.$encrypt['string'],
1310 1310
                                 'encryption_type' => 'defuse',
1311 1311
                             ),
1312 1312
                             'increment_id = %i',
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
                 //change all encrypted data in CATEGORIES (passwords)
1332 1332
                 $rows = DB::query(
1333 1333
                     'SELECT id, data
1334
-                    FROM ' . prefixTable('categories_items') . '
1335
-                    LIMIT ' . $post_start . ', ' . $post_length
1334
+                    FROM ' . prefixTable('categories_items').'
1335
+                    LIMIT ' . $post_start.', '.$post_length
1336 1336
                 );
1337 1337
                 foreach ($rows as $record) {
1338 1338
                     // backup data
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                             'current_field' => 'data',
1344 1344
                             'value_id' => $record['id'],
1345 1345
                             'value' => $record['data'],
1346
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1346
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1347 1347
                             'value2' => 'none',
1348 1348
                             'result' => 'none',
1349 1349
                         )
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
                 // Change all encrypted data in FILES (passwords)
1392 1392
                 $rows = DB::query(
1393 1393
                     'SELECT id, file, status
1394
-                    FROM ' . prefixTable('files') . "
1394
+                    FROM ' . prefixTable('files')."
1395 1395
                     WHERE status = 'encrypted'
1396
-                    LIMIT " . $post_start . ', ' . $post_length
1396
+                    LIMIT " . $post_start.', '.$post_length
1397 1397
                 );
1398 1398
                 foreach ($rows as $record) {
1399 1399
                     // backup data
@@ -1411,20 +1411,20 @@  discard block
 block discarded – undo
1411 1411
                     );
1412 1412
                     $newID = DB::insertId();
1413 1413
 
1414
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1414
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1415 1415
                         // make a copy of file
1416 1416
                         if (!copy(
1417
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1418
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1417
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1418
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1419 1419
                         )) {
1420 1420
                             $error = 'Copy not possible';
1421 1421
                             exit;
1422 1422
                         } else {
1423 1423
                             // prepare a bck of file (that will not be deleted)
1424
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1424
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1425 1425
                             copy(
1426
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1427
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1426
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1427
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1428 1428
                             );
1429 1429
                         }
1430 1430
 
@@ -1432,24 +1432,24 @@  discard block
 block discarded – undo
1432 1432
                         // STEP1 - Do decryption
1433 1433
                         prepareFileWithDefuse(
1434 1434
                             'decrypt',
1435
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1436
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1435
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1436
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1437 1437
                             $SETTINGS
1438 1438
                         );
1439 1439
 
1440 1440
                         // Do cleanup of files
1441
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1441
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1442 1442
 
1443 1443
                         // STEP2 - Do encryption
1444 1444
                         prepareFileWithDefuse(
1445 1445
                             'encryp',
1446
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1447
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1446
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1447
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1448 1448
                             $SETTINGS
1449 1449
                         );
1450 1450
 
1451 1451
                         // Do cleanup of files
1452
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1452
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1453 1453
 
1454 1454
                         // Update backup table
1455 1455
                         DB::update(
@@ -1475,13 +1475,13 @@  discard block
 block discarded – undo
1475 1475
                 // do some things for new object
1476 1476
                 if (isset($objects[0])) {
1477 1477
                     if ($objects[0] === 'logs') {
1478
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1478
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1479 1479
                     } elseif ($objects[0] === 'files') {
1480
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1480
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1481 1481
                     } elseif ($objects[0] === 'categories') {
1482
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1482
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1483 1483
                     } elseif ($objects[0] === 'custfields') {
1484
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1484
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1485 1485
                     }
1486 1486
                     $nb_of_items = DB::count();
1487 1487
                 } else {
@@ -1600,12 +1600,12 @@  discard block
 block discarded – undo
1600 1600
                 );
1601 1601
             } elseif ($record['current_table'] === 'files') {
1602 1602
                 // restore backup file
1603
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1604
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1605
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1603
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1604
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1605
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1606 1606
                         rename(
1607
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1608
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1607
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1608
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1609 1609
                         );
1610 1610
                     }
1611 1611
                 }
@@ -1616,15 +1616,15 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
         // restore saltkey file
1618 1618
         if (file_exists($previous_saltkey_filename)) {
1619
-            unlink(SECUREPATH . '/teampass-seckey.txt');
1619
+            unlink(SECUREPATH.'/teampass-seckey.txt');
1620 1620
             rename(
1621 1621
                 $previous_saltkey_filename,
1622
-                SECUREPATH . '/teampass-seckey.txt'
1622
+                SECUREPATH.'/teampass-seckey.txt'
1623 1623
             );
1624 1624
         }
1625 1625
 
1626 1626
         // drop table
1627
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1627
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1628 1628
 
1629 1629
         // Send back
1630 1630
         echo prepareExchangedData(
@@ -1667,17 +1667,17 @@  discard block
 block discarded – undo
1667 1667
         // delete files
1668 1668
         $rows = DB::query(
1669 1669
             'SELECT value, value2
1670
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1670
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1671 1671
             WHERE current_table = 'files'"
1672 1672
         );
1673 1673
         foreach ($rows as $record) {
1674
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1675
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1674
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1675
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1676 1676
             }
1677 1677
         }
1678 1678
 
1679 1679
         // drop table
1680
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1680
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1681 1681
 
1682 1682
         echo '[{"status":"done"}]';
1683 1683
         break;
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             );
1710 1710
             break;
1711 1711
         } else {
1712
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1712
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1713 1713
 
1714 1714
             //send email
1715 1715
             sendEmail(
@@ -1745,11 +1745,11 @@  discard block
 block discarded – undo
1745 1745
             break;
1746 1746
         }
1747 1747
 
1748
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1748
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1749 1749
 
1750 1750
         $rows = DB::query(
1751 1751
             'SELECT *
1752
-            FROM ' . prefixTable('emails') . '
1752
+            FROM ' . prefixTable('emails').'
1753 1753
             WHERE status = %s OR status = %s',
1754 1754
             'not_sent',
1755 1755
             ''
@@ -1834,9 +1834,9 @@  discard block
 block discarded – undo
1834 1834
             break;
1835 1835
         }
1836 1836
 
1837
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1837
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1838 1838
 
1839
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1839
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1840 1840
         foreach ($rows as $record) {
1841 1841
             //send email
1842 1842
             $ret = json_decode(
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
             break;
1905 1905
         }
1906 1906
 
1907
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1907
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1908 1908
 
1909 1909
         // init
1910 1910
         $filesList = array();
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
                 FROM ' . prefixTable('files')
1918 1918
             );
1919 1919
             foreach ($rows as $record) {
1920
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1920
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1921 1921
                     $addFile = false;
1922 1922
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1923 1923
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1982,8 +1982,8 @@  discard block
 block discarded – undo
1982 1982
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
1983 1983
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1984 1984
 
1985
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1986
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1985
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1986
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1987 1987
 
1988 1988
         $cpt = 0;
1989 1989
         $continu = true;
@@ -1991,15 +1991,15 @@  discard block
 block discarded – undo
1991 1991
         $message = '';
1992 1992
 
1993 1993
         // load PhpEncryption library
1994
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
1995
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
1996
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1997
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
1998
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1999
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2000
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2001
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2002
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
1994
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
1995
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
1996
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1997
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
1998
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1999
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2000
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2001
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2002
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2003 2003
 
2004 2004
         // treat 10 files
2005 2005
         foreach ($post_list as $file) {
@@ -2007,35 +2007,35 @@  discard block
 block discarded – undo
2007 2007
                 // Get file name
2008 2008
                 $file_info = DB::queryfirstrow(
2009 2009
                     'SELECT file
2010
-                    FROM ' . prefixTable('files') . '
2010
+                    FROM ' . prefixTable('files').'
2011 2011
                     WHERE id = %i',
2012 2012
                     $file
2013 2013
                 );
2014 2014
 
2015 2015
                 // skip file is Coherancey not respected
2016
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2016
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2017 2017
                     // Case where we want to decrypt
2018 2018
                     if ($post_option === 'decrypt') {
2019 2019
                         prepareFileWithDefuse(
2020 2020
                             'decrypt',
2021
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2022
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2021
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2022
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2023 2023
                             $SETTINGS
2024 2024
                         );
2025 2025
                         // Case where we want to encrypt
2026 2026
                     } elseif ($post_option === 'encrypt') {
2027 2027
                         prepareFileWithDefuse(
2028 2028
                             'encrypt',
2029
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2030
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2029
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2030
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2031 2031
                             $SETTINGS
2032 2032
                         );
2033 2033
                     }
2034 2034
                     // Do file cleanup
2035
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2035
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2036 2036
                     rename(
2037
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2038
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2037
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2038
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2039 2039
                     );
2040 2040
 
2041 2041
                     // store in DB
@@ -2070,8 +2070,8 @@  discard block
 block discarded – undo
2070 2070
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2071 2071
             );
2072 2072
 
2073
-            $message = langHdl('last_execution') . ' ' .
2074
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
2073
+            $message = langHdl('last_execution').' '.
2074
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
2075 2075
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2076 2076
         }
2077 2077
 
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2158 2158
 
2159 2159
             DB::query(
2160
-                'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i',
2160
+                'DELETE FROM '.prefixTable('api').' WHERE id = %i',
2161 2161
                 $post_id
2162 2162
             );
2163 2163
         }
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
             // Delete existing key
2250 2250
         } elseif (null !== $post_action && $post_action === 'delete') {
2251 2251
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2252
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id);
2252
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id);
2253 2253
         }
2254 2254
 
2255 2255
         echo prepareExchangedData(
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 
2265 2265
     case 'save_api_status':
2266 2266
         // Do query
2267
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2267
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2268 2268
         $counter = DB::count();
2269 2269
         if ($counter === 0) {
2270 2270
             DB::insert(
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
         break;
2291 2291
 
2292 2292
     case 'save_duo_status':
2293
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2293
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2294 2294
         $counter = DB::count();
2295 2295
         if ($counter === 0) {
2296 2296
             DB::insert(
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
         foreach ($dataReceived as $key => $value) {
2334 2334
             DB::query(
2335 2335
                 'SELECT * 
2336
-                FROM ' . prefixTable('misc') . '
2336
+                FROM ' . prefixTable('misc').'
2337 2337
                 WHERE type = %s AND intitule = %s',
2338 2338
                 'admin',
2339 2339
                 $key
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
         } else {
2402 2402
             $tmp = 1;
2403 2403
         }
2404
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2404
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2405 2405
         $counter = DB::count();
2406 2406
         if ($counter === 0) {
2407 2407
             DB::insert(
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
         // ga_website_name
2429 2429
         if (is_null($dataReceived['ga_website_name']) === false) {
2430
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2430
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2431 2431
             $counter = DB::count();
2432 2432
             if ($counter === 0) {
2433 2433
                 DB::insert(
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
         }
2459 2459
 
2460 2460
         // send data
2461
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2461
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2462 2462
         break;
2463 2463
 
2464 2464
     case 'save_agses_options':
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 
2482 2482
         // agses_hosted_url
2483 2483
         if (!is_null($dataReceived['agses_hosted_url'])) {
2484
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2484
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2485 2485
             $counter = DB::count();
2486 2486
             if ($counter === 0) {
2487 2487
                 DB::insert(
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
 
2511 2511
         // agses_hosted_id
2512 2512
         if (!is_null($dataReceived['agses_hosted_id'])) {
2513
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2513
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2514 2514
             $counter = DB::count();
2515 2515
             if ($counter === 0) {
2516 2516
                 DB::insert(
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 
2540 2540
         // agses_hosted_apikey
2541 2541
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2542
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2542
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2543 2543
             $counter = DB::count();
2544 2544
             if ($counter === 0) {
2545 2545
                 DB::insert(
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
         }
2568 2568
 
2569 2569
         // send data
2570
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2570
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2571 2571
         break;
2572 2572
 
2573 2573
     case 'save_option_change':
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 
2604 2604
         // Check if setting is already in DB. If NO then insert, if YES then update.
2605 2605
         $data = DB::query(
2606
-            'SELECT * FROM ' . prefixTable('misc') . '
2606
+            'SELECT * FROM '.prefixTable('misc').'
2607 2607
             WHERE type = %s AND intitule = %s',
2608 2608
             $type,
2609 2609
             $dataReceived['field']
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
                     array(
2626 2626
                         'valeur' => time(),
2627 2627
                         'type' => $type,
2628
-                        'intitule' => $dataReceived['field'] . '_time',
2628
+                        'intitule' => $dataReceived['field'].'_time',
2629 2629
                     )
2630 2630
                 );
2631 2631
             }
@@ -2643,10 +2643,10 @@  discard block
 block discarded – undo
2643 2643
             if ($dataReceived['field'] === 'send_stats') {
2644 2644
                 // Check if previous time exists, if not them insert this value in DB
2645 2645
                 DB::query(
2646
-                    'SELECT * FROM ' . prefixTable('misc') . '
2646
+                    'SELECT * FROM '.prefixTable('misc').'
2647 2647
                     WHERE type = %s AND intitule = %s',
2648 2648
                     $type,
2649
-                    $dataReceived['field'] . '_time'
2649
+                    $dataReceived['field'].'_time'
2650 2650
                 );
2651 2651
                 $counter = DB::count();
2652 2652
                 if ($counter === 0) {
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
                         array(
2656 2656
                             'valeur' => 0,
2657 2657
                             'type' => $type,
2658
-                            'intitule' => $dataReceived['field'] . '_time',
2658
+                            'intitule' => $dataReceived['field'].'_time',
2659 2659
                         )
2660 2660
                     );
2661 2661
                 } else {
@@ -2675,13 +2675,13 @@  discard block
 block discarded – undo
2675 2675
         // special Cases
2676 2676
         if ($dataReceived['field'] === 'cpassman_url') {
2677 2677
             // update also jsUrl for CSFP protection
2678
-            $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js';
2678
+            $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js';
2679 2679
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2680 2680
             $data = file_get_contents($csrfp_file);
2681 2681
             $posJsUrl = strpos($data, '"jsUrl" => "');
2682 2682
             $posEndLine = strpos($data, '",', $posJsUrl);
2683 2683
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2684
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2684
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2685 2685
             file_put_contents($csrfp_file, $newdata);
2686 2686
         } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') {
2687 2687
             DB::update(
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
         echo prepareExchangedData(
2706 2706
             array(
2707 2707
                 'error' => false,
2708
-                'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']],
2708
+                'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']],
2709 2709
             ),
2710 2710
             'encode'
2711 2711
         );
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
 
2748 2748
         // send statistics
2749 2749
         if (null !== $post_status) {
2750
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2750
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2751 2751
             $counter = DB::count();
2752 2752
             if ($counter === 0) {
2753 2753
                 DB::insert(
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
 
2780 2780
         // send statistics items
2781 2781
         if (null !== $post_list) {
2782
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2782
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2783 2783
             $counter = DB::count();
2784 2784
             if ($counter === 0) {
2785 2785
                 DB::insert(
@@ -2826,7 +2826,7 @@  discard block
 block discarded – undo
2826 2826
             break;
2827 2827
         }
2828 2828
 
2829
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2829
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2830 2830
             if (DB::count() === 1) {
2831 2831
                 echo 1;
2832 2832
             } else {
@@ -2864,7 +2864,7 @@  discard block
 block discarded – undo
2864 2864
 
2865 2865
         $rows = DB::query(
2866 2866
             'SELECT id, title
2867
-                FROM ' . prefixTable('roles_title') . '
2867
+                FROM ' . prefixTable('roles_title').'
2868 2868
                 ORDER BY title ASC'
2869 2869
         );
2870 2870
         foreach ($rows as $record) {
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit();
47 47
 }
48 48
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59 59
 header('Content-type: text/html; charset=utf-8');
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
61
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
62
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
61
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
62
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
63 63
 
64 64
 // Connect to mysql server
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
                     && $t->personal_folder == 0
133 133
                 ) {
134 134
                     // get $t->parent_id
135
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
135
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
136 136
                     if ($t->nlevel == 1) {
137 137
                         $data['title'] = langHdl('root');
138 138
                     }
139 139
 
140 140
                     // get rights on this folder
141 141
                     $arrayRights = array();
142
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
142
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
143 143
                     foreach ($rows as $record) {
144 144
                         array_push($arrayRights, $record['fonction_id']);
145 145
                     }
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
                     $node_data = DB::queryFirstRow(
157 157
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
158 158
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification
159
-                        FROM ' . prefixTable('misc') . ' AS m,
160
-                        ' . prefixTable('nested_tree') . ' AS n
159
+                        FROM ' . prefixTable('misc').' AS m,
160
+                        ' . prefixTable('nested_tree').' AS n
161 161
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
162 162
                         'complex',
163 163
                         $t->id
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                     //col7
191 191
                     $data7 = DB::queryFirstRow(
192 192
                         'SELECT bloquer_creation,bloquer_modification
193
-                        FROM ' . prefixTable('nested_tree') . '
193
+                        FROM ' . prefixTable('nested_tree').'
194 194
                         WHERE id = %i',
195 195
                         intval($t->id)
196 196
                     );
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             // Get info about this folder
326 326
             $dataFolder = DB::queryfirstrow(
327 327
                 'SELECT *
328
-                FROM ' . prefixTable('nested_tree') . '
328
+                FROM ' . prefixTable('nested_tree').'
329 329
                 WHERE id = %i',
330 330
                 $post_folder_id
331 331
             );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             //check if parent folder is personal
362 362
             $dataParent = DB::queryfirstrow(
363 363
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
364
-                FROM ' . prefixTable('nested_tree') . '
364
+                FROM ' . prefixTable('nested_tree').'
365 365
                 WHERE id = %i',
366 366
                 $post_parent_id
367 367
             );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     // get complexity level for this folder
391 391
                     $data = DB::queryfirstrow(
392 392
                         'SELECT valeur
393
-                        FROM ' . prefixTable('misc') . '
393
+                        FROM ' . prefixTable('misc').'
394 394
                         WHERE intitule = %i AND type = %s',
395 395
                         $post_parent_id,
396 396
                         'complex'
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                             array(
402 402
                                 'error' => true,
403 403
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
404
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
404
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
405 405
                             ),
406 406
                             'encode'
407 407
                         );
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             ) {
555 555
                 DB::query(
556 556
                     'SELECT *
557
-                    FROM ' . prefixTable('nested_tree') . '
557
+                    FROM ' . prefixTable('nested_tree').'
558 558
                     WHERE title = %s',
559 559
                     $post_title
560 560
                 );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             //check if parent folder is personal
575 575
             $data = DB::queryfirstrow(
576 576
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
577
-                FROM ' . prefixTable('nested_tree') . '
577
+                FROM ' . prefixTable('nested_tree').'
578 578
                 WHERE id = %i',
579 579
                 $post_parent_id
580 580
             );
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
                     // get complexity level for this folder
604 604
                     $data = DB::queryfirstrow(
605 605
                         'SELECT valeur
606
-                        FROM ' . prefixTable('misc') . '
606
+                        FROM ' . prefixTable('misc').'
607 607
                         WHERE intitule = %i AND type = %s',
608 608
                         $post_parent_id,
609 609
                         'complex'
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                             array(
614 614
                                 'error' => true,
615 615
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
616
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
616
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
617 617
                             ),
618 618
                             'encode'
619 619
                         );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                     && (int) $SETTINGS['subfolder_rights_as_parent'] === 1
688 688
                 ) {
689 689
                     //If it is a subfolder, then give access to it for all roles that allows the parent folder
690
-                    $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id);
690
+                    $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id);
691 691
                     foreach ($rows as $record) {
692 692
                         //add access to this subfolder
693 693
                         DB::insert(
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
                 }
703 703
 
704 704
                 // if parent folder has Custom Fields Categories then add to this child one too
705
-                $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id);
705
+                $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id);
706 706
                 foreach ($rows as $record) {
707 707
                     //add CF Category to this subfolder
708 708
                     DB::insert(
@@ -779,17 +779,17 @@  discard block
 block discarded – undo
779 779
                                 prefixTable('misc'),
780 780
                                 array(
781 781
                                     'type' => 'folder_deleted',
782
-                                    'intitule' => 'f' . $folder->id,
783
-                                    'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' .
784
-                                        $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' .
785
-                                        $folder->nlevel . ', 0, 0, 0, 0',
782
+                                    'intitule' => 'f'.$folder->id,
783
+                                    'valeur' => $folder->id.', '.$folder->parent_id.', '.
784
+                                        $folder->title.', '.$folder->nleft.', '.$folder->nright.', '.
785
+                                        $folder->nlevel.', 0, 0, 0, 0',
786 786
                                 )
787 787
                             );
788 788
                             //array for delete folder
789 789
                             $folderForDel[] = $folder->id;
790 790
 
791 791
                             //delete items & logs
792
-                            $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id);
792
+                            $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id);
793 793
                             foreach ($items as $item) {
794 794
                                 DB::update(
795 795
                                     prefixTable('items'),
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
             $tree->rebuild();
847 847
 
848 848
             // reload cache table
849
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
849
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
850 850
             updateCacheTable('reload', $SETTINGS, null);
851 851
 
852 852
             echo prepareExchangedData(
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                 // get complexity of current node
933 933
                 $nodeComplexity = DB::queryfirstrow(
934 934
                     'SELECT valeur
935
-                    FROM ' . prefixTable('misc') . '
935
+                    FROM ' . prefixTable('misc').'
936 936
                     WHERE intitule = %i AND type= %s',
937 937
                     $nodeInfo->id,
938 938
                     'complex'
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1008 1008
                 $rows = DB::query(
1009 1009
                     'SELECT role_id, type
1010
-                    FROM ' . prefixTable('roles_values') . '
1010
+                    FROM ' . prefixTable('roles_values').'
1011 1011
                     WHERE folder_id = %i',
1012 1012
                     $parentId
1013 1013
                 );
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                     // Add access to this subfolder after checking that it is not already set
1016 1016
                     DB::query(
1017 1017
                         'SELECT *
1018
-                        FROM ' . prefixTable('roles_values') . '
1018
+                        FROM ' . prefixTable('roles_values').'
1019 1019
                         WHERE folder_id = %i AND role_id = %i',
1020 1020
                         $newFolderId,
1021 1021
                         $record['role_id']
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                 // if parent folder has Custom Fields Categories then add to this child one too
1036 1036
                 $rows = DB::query(
1037 1037
                     'SELECT id_category
1038
-                    FROM ' . prefixTable('categories_folders') . '
1038
+                    FROM ' . prefixTable('categories_folders').'
1039 1039
                     WHERE id_folder = %i',
1040 1040
                     $nodeInfo->id
1041 1041
                 );
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                 $rows = DB::query(
1056 1056
                     'SELECT *
1057
-                    FROM ' . prefixTable('items') . '
1057
+                    FROM ' . prefixTable('items').'
1058 1058
                     WHERE id_tree = %i',
1059 1059
                     $nodeInfo->id
1060 1060
                 );
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                     // if it is then don't copy it
1064 1064
                     $item_deleted = DB::queryFirstRow(
1065 1065
                         'SELECT *
1066
-                        FROM ' . prefixTable('log_items') . '
1066
+                        FROM ' . prefixTable('log_items').'
1067 1067
                         WHERE id_item = %i AND action = %s
1068 1068
                         ORDER BY date DESC
1069 1069
                         LIMIT 0, 1',
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
                     $item_restored = DB::queryFirstRow(
1076 1076
                         'SELECT *
1077
-                        FROM ' . prefixTable('log_items') . '
1077
+                        FROM ' . prefixTable('log_items').'
1078 1078
                         WHERE id_item = %i AND action = %s
1079 1079
                         ORDER BY date DESC
1080 1080
                         LIMIT 0, 1',
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
                         // Get the ITEM object key for the user
1090 1090
                         $userKey = DB::queryFirstRow(
1091 1091
                             'SELECT share_key
1092
-                            FROM ' . prefixTable('sharekeys_items') . '
1092
+                            FROM ' . prefixTable('sharekeys_items').'
1093 1093
                             WHERE user_id = %i AND object_id = %i',
1094 1094
                             $_SESSION['user_id'],
1095 1095
                             $record['id']
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                         // Manage Custom Fields
1164 1164
                         $categories = DB::query(
1165 1165
                             'SELECT *
1166
-                            FROM ' . prefixTable('categories_items') . '
1166
+                            FROM ' . prefixTable('categories_items').'
1167 1167
                             WHERE item_id = %i',
1168 1168
                             $record['id']
1169 1169
                         );
@@ -1211,15 +1211,15 @@  discard block
 block discarded – undo
1211 1211
                         $files = DB::query(
1212 1212
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1213 1213
                             f.size AS size, f.type AS type, s.share_key AS share_key
1214
-                            FROM ' . prefixTable('files') . ' AS f
1215
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1214
+                            FROM ' . prefixTable('files').' AS f
1215
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1216 1216
                             WHERE s.user_id = %i AND f.id_item = %i',
1217 1217
                             $_SESSION['user_id'],
1218 1218
                             $record['id']
1219 1219
                         );
1220 1220
                         foreach ($files as $file) {
1221 1221
                             // Check if file still exists
1222
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1222
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1223 1223
                                 // Step1 - decrypt the file
1224 1224
                                 $fileContent = decryptFile(
1225 1225
                                     $file['file'],
@@ -1228,9 +1228,9 @@  discard block
 block discarded – undo
1228 1228
                                 );
1229 1229
 
1230 1230
                                 // Step2 - create file
1231
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1231
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1232 1232
 
1233
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1233
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1234 1234
                                 if ($outstream === false) {
1235 1235
                                     echo prepareExchangedData(
1236 1236
                                         array(
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
             $tree->rebuild();
1306 1306
 
1307 1307
             // reload cache table
1308
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1308
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1309 1309
             updateCacheTable('reload', $SETTINGS, NULL);
1310 1310
 
1311 1311
             $data = array(
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
                     // Get path
1368 1368
                     $text = '';
1369 1369
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1370
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1370
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1371 1371
                     }
1372 1372
 
1373 1373
                     // Save array
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
                             'id' => (int) $folder->id,
1378 1378
                             'label' => $folder->title,
1379 1379
                             'level' => $folder->nlevel,
1380
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1380
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1381 1381
                         )
1382 1382
                     );
1383 1383
                 }
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
46 46
 
47 47
 // DO CHECKS
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
51 51
 if (
52 52
     isset($post_type) === true
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
63 63
 ) {
64 64
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit();
67 67
 } elseif ((isset($_SESSION['user_id']) === true
68 68
         && isset($_SESSION['key'])) === true
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     mainQuery($SETTINGS);
75 75
 } else {
76 76
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit();
79 79
 }
80 80
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
     // Includes
92
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
93
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
94
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
95
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
92
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
93
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
94
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
96 96
 
97 97
     // Connect to mysql server
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
99 99
 
100 100
     DB::$host = DB_HOST;
101 101
     DB::$user = DB_USER;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     DB::$encoding = DB_ENCODING;
106 106
 
107 107
     // User's language loading
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
109 109
 
110 110
     // Prepare post variables
111 111
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             $pwdlib = new PasswordLib\PasswordLib();
250 250
             // generate key
251 251
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
252
-            echo '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
252
+            echo '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
253 253
             break;
254 254
 
255 255
         /*
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 )
279 279
             );
280 280
 
281
-            echo '[{"token" : "' . $token . '"}]';
281
+            echo '[{"token" : "'.$token.'"}]';
282 282
             break;
283 283
 
284 284
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         // check if expected security level is reached
580 580
         $dataUser = DB::queryfirstrow(
581 581
             'SELECT *
582
-            FROM ' . prefixTable('users') . '
582
+            FROM ' . prefixTable('users').'
583 583
             WHERE id = %i',
584 584
             $post_user_id
585 585
         );
@@ -601,8 +601,8 @@  discard block
 block discarded – undo
601 601
         if (empty($dataUser['fonction_id']) === false) {
602 602
             $data = DB::queryFirstRow(
603 603
                 'SELECT complexity
604
-                FROM ' . prefixTable('roles_title') . '
605
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
604
+                FROM ' . prefixTable('roles_title').'
605
+                WHERE id IN (' . $dataUser['fonction_id'].')
606 606
                 ORDER BY complexity DESC'
607 607
             );
608 608
         } else {
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
             return prepareExchangedData(
616 616
                 array(
617 617
                     'error' => true,
618
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
619
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
618
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
619
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
620 620
                 ),
621 621
                 'encode'
622 622
             );
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
         // Get data about user
718 718
         $data = DB::queryfirstrow(
719 719
             'SELECT id, email, pw
720
-            FROM ' . prefixTable('users') . '
720
+            FROM ' . prefixTable('users').'
721 721
             WHERE login = %s',
722 722
             $post_login
723 723
         );
724 724
     } else {
725 725
         $data = DB::queryfirstrow(
726 726
             'SELECT id, login, email, pw
727
-            FROM ' . prefixTable('users') . '
727
+            FROM ' . prefixTable('users').'
728 728
             WHERE id = %i',
729 729
             $post_id
730 730
         );
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
     $counter = DB::count();
735 735
 
736 736
     // load passwordLib library
737
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
737
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
738 738
     $pwdlib->register();
739 739
     $pwdlib = new PasswordLib\PasswordLib();
740 740
 
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
     }
782 782
     
783 783
     // generate new GA user code
784
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
784
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
785 785
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
786 786
     $gaSecretKey = $tfa->createSecret();
787 787
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
                 'email' => $data['email'],
824 824
                 'email_result' => str_replace(
825 825
                     '#email#',
826
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
826
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
827 827
                     addslashes(langHdl('admin_email_result_ok'))
828 828
                 ),
829 829
             ),
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
             'email' => $data['email'],
840 840
             'email_result' => str_replace(
841 841
                 '#email#',
842
-                '<b>' . obfuscateEmail($data['email']) . '</b>',
842
+                '<b>'.obfuscateEmail($data['email']).'</b>',
843 843
                 addslashes(langHdl('admin_email_result_ok'))
844 844
             ),
845 845
         ),
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
         && (int) $SETTINGS['enable_send_email_on_user_login'] === 1
856 856
     ) {
857 857
         $row = DB::queryFirstRow(
858
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
858
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
859 859
             'cron',
860 860
             'sending_emails'
861 861
         );
@@ -863,12 +863,12 @@  discard block
 block discarded – undo
863 863
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
864 864
             $rows = DB::query(
865 865
                 'SELECT *
866
-                FROM ' . prefixTable('emails') .
866
+                FROM ' . prefixTable('emails').
867 867
                 ' WHERE status != %s',
868 868
                 'sent'
869 869
             );
870 870
             foreach ($rows as $record) {
871
-                echo $record['increment_id'] . " >> ";
871
+                echo $record['increment_id']." >> ";
872 872
                 // Send email
873 873
                 $ret = json_decode(
874 874
                     sendEmail(
@@ -967,8 +967,8 @@  discard block
 block discarded – undo
967 967
     $arr_html = array();
968 968
     $rows = DB::query(
969 969
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
970
-        FROM ' . prefixTable('log_items') . ' AS l
971
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
970
+        FROM ' . prefixTable('log_items').' AS l
971
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
972 972
         WHERE l.action = %s AND l.id_user = %i
973 973
         ORDER BY l.date DESC
974 974
         LIMIT 0, 100',
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
         isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1
1002 1002
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
1003 1003
     ) {
1004
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1004
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1005 1005
         $nb_suggestions_waiting = DB::count();
1006 1006
     }
1007 1007
 
@@ -1037,13 +1037,13 @@  discard block
 block discarded – undo
1037 1037
             if ($data === 'stat_languages') {
1038 1038
                 $tmp = '';
1039 1039
                 foreach ($stats_data[$data] as $key => $value) {
1040
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1040
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1041 1041
                 }
1042 1042
                 $statsToSend[$data] = $tmp;
1043 1043
             } elseif ($data === 'stat_country') {
1044 1044
                 $tmp = '';
1045 1045
                 foreach ($stats_data[$data] as $key => $value) {
1046
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1046
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1047 1047
                 }
1048 1048
                 $statsToSend[$data] = $tmp;
1049 1049
             } else {
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
             if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) {
1118 1118
                 $url_found = substr($line, 19, strlen($line) - 22);
1119 1119
                 $tmp = parse_url($url_found);
1120
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path'];
1121
-                $line = "'cpassman_url' => '" . $anonym_url . "\n";
1120
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path'];
1121
+                $line = "'cpassman_url' => '".$anonym_url."\n";
1122 1122
             }
1123 1123
 
1124 1124
             // Anonymize all urls
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
     $teampass_errors = '';
1146 1146
     $rows = DB::query(
1147 1147
         'SELECT label, date AS error_date
1148
-        FROM ' . prefixTable('log_system') . "
1148
+        FROM ' . prefixTable('log_system')."
1149 1149
         WHERE `type` LIKE 'error'
1150 1150
         ORDER BY `date` DESC
1151 1151
         LIMIT 0, 10"
@@ -1153,9 +1153,9 @@  discard block
 block discarded – undo
1153 1153
     if (DB::count() > 0) {
1154 1154
         foreach ($rows as $record) {
1155 1155
             if (empty($teampass_errors) === true) {
1156
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1156
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1157 1157
             } else {
1158
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1158
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1159 1159
             }
1160 1160
         }
1161 1161
     }
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 
1165 1165
     // Now prepare text
1166 1166
     $txt = '### Page on which it happened
1167
-' . $post_data['current_page'] . '
1167
+' . $post_data['current_page'].'
1168 1168
 
1169 1169
 ### Steps to reproduce
1170 1170
 1.
@@ -1179,39 +1179,39 @@  discard block
 block discarded – undo
1179 1179
 Tell us what happens instead
1180 1180
 
1181 1181
 ### Server configuration
1182
-**Operating system**: ' . php_uname() . '
1182
+**Operating system**: ' . php_uname().'
1183 1183
 
1184
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1184
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1185 1185
 
1186
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1186
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1187 1187
 
1188
-**PHP version:** ' . PHP_VERSION . '
1188
+**PHP version:** ' . PHP_VERSION.'
1189 1189
 
1190
-**Teampass version:** ' . TP_VERSION_FULL . '
1190
+**Teampass version:** ' . TP_VERSION_FULL.'
1191 1191
 
1192 1192
 **Teampass configuration file:**
1193 1193
 ```
1194
-' . $list_of_options . '
1194
+' . $list_of_options.'
1195 1195
 ```
1196 1196
 
1197 1197
 **Updated from an older Teampass or fresh install:**
1198 1198
 
1199 1199
 ### Client configuration
1200 1200
 
1201
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1201
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1202 1202
 
1203
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1203
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1204 1204
 
1205 1205
 ### Logs
1206 1206
 
1207 1207
 #### Web server error log
1208 1208
 ```
1209
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1209
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1210 1210
 ```
1211 1211
 
1212 1212
 #### Teampass 10 last system errors
1213 1213
 ```
1214
-' . $teampass_errors . '
1214
+' . $teampass_errors.'
1215 1215
 ```
1216 1216
 
1217 1217
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
         // Check if user exists
1240 1240
         $userInfo = DB::queryFirstRow(
1241 1241
             'SELECT public_key, private_key, pw
1242
-            FROM ' . prefixTable('users') . '
1242
+            FROM ' . prefixTable('users').'
1243 1243
             WHERE id = %i',
1244 1244
             $post_user_id
1245 1245
         );
@@ -1247,14 +1247,14 @@  discard block
 block discarded – undo
1247 1247
             // Get one item
1248 1248
             $record = DB::queryFirstRow(
1249 1249
                 'SELECT id, pw
1250
-                FROM ' . prefixTable('items') . '
1250
+                FROM ' . prefixTable('items').'
1251 1251
                 WHERE perso = 0'
1252 1252
             );
1253 1253
 
1254 1254
             // Get itemKey from current user
1255 1255
             $currentUserKey = DB::queryFirstRow(
1256 1256
                 'SELECT share_key, increment_id
1257
-                FROM ' . prefixTable('sharekeys_items') . '
1257
+                FROM ' . prefixTable('sharekeys_items').'
1258 1258
                 WHERE object_id = %i AND user_id = %i',
1259 1259
                 $record['id'],
1260 1260
                 $post_user_id
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
             
1283 1283
             // Use the password check
1284 1284
             // load passwordLib library
1285
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1285
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1286 1286
             $pwdlib->register();
1287 1287
             $pwdlib = new PasswordLib\PasswordLib();
1288 1288
             
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
         // Get user info
1327 1327
         $userData = DB::queryFirstRow(
1328 1328
             'SELECT private_key
1329
-            FROM ' . prefixTable('users') . '
1329
+            FROM ' . prefixTable('users').'
1330 1330
             WHERE id = %i',
1331 1331
             $post_user_id
1332 1332
         );
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
             );
1354 1354
 
1355 1355
             // Load superGlobals
1356
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1356
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1357 1357
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1358 1358
 
1359 1359
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
         // Get user info
1392 1392
         $userData = DB::queryFirstRow(
1393 1393
             'SELECT email, auth_type, login
1394
-            FROM ' . prefixTable('users') . '
1394
+            FROM ' . prefixTable('users').'
1395 1395
             WHERE id = %i',
1396 1396
             $post_user_id
1397 1397
         );
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
         // Get user info
1526 1526
         $userData = DB::queryFirstRow(
1527 1527
             'SELECT email, auth_type, login
1528
-            FROM ' . prefixTable('users') . '
1528
+            FROM ' . prefixTable('users').'
1529 1529
             WHERE id = %i',
1530 1530
             $post_user_id
1531 1531
         );
@@ -1588,13 +1588,13 @@  discard block
 block discarded – undo
1588 1588
         // Check if user exists
1589 1589
         DB::queryFirstRow(
1590 1590
             'SELECT *
1591
-            FROM ' . prefixTable('users') . '
1591
+            FROM ' . prefixTable('users').'
1592 1592
             WHERE id = %i',
1593 1593
             $post_user_id
1594 1594
         );
1595 1595
         if (DB::count() > 0) {
1596 1596
             // Include libraries
1597
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1597
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1598 1598
 
1599 1599
             // CLear old sharekeys
1600 1600
             if ($post_self_change === false) {
@@ -1646,13 +1646,13 @@  discard block
 block discarded – undo
1646 1646
         // Check if user exists
1647 1647
         $userInfo = DB::queryFirstRow(
1648 1648
             'SELECT public_key
1649
-            FROM ' . prefixTable('users') . '
1649
+            FROM ' . prefixTable('users').'
1650 1650
             WHERE id = %i',
1651 1651
             $post_user_id
1652 1652
         );
1653 1653
         if (DB::count() > 0) {
1654 1654
             // Include libraries
1655
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1655
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1656 1656
 
1657 1657
             // WHAT STEP TO PERFORM?
1658 1658
             if ($post_action === 'step0') {
@@ -1811,15 +1811,15 @@  discard block
 block discarded – undo
1811 1811
     // Loop on items
1812 1812
     $rows = DB::query(
1813 1813
         'SELECT id, pw
1814
-        FROM ' . prefixTable('items') . '
1814
+        FROM ' . prefixTable('items').'
1815 1815
         WHERE perso = 0
1816
-        LIMIT ' . $post_start . ', ' . $post_length
1816
+        LIMIT ' . $post_start.', '.$post_length
1817 1817
     );
1818 1818
     foreach ($rows as $record) {
1819 1819
         // Get itemKey from current user
1820 1820
         $currentUserKey = DB::queryFirstRow(
1821 1821
             'SELECT share_key, increment_id
1822
-            FROM ' . prefixTable('sharekeys_items') . '
1822
+            FROM ' . prefixTable('sharekeys_items').'
1823 1823
             WHERE object_id = %i AND user_id = %i',
1824 1824
             $record['id'],
1825 1825
             $_SESSION['user_id']
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1848 1848
                 $currentUserKey = DB::queryFirstRow(
1849 1849
                     'SELECT increment_id
1850
-                    FROM ' . prefixTable('sharekeys_items') . '
1850
+                    FROM ' . prefixTable('sharekeys_items').'
1851 1851
                     WHERE object_id = %i AND user_id = %i',
1852 1852
                     $record['id'],
1853 1853
                     $post_user_id
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
     // SHould we change step?
1881 1881
     DB::query(
1882 1882
         'SELECT *
1883
-        FROM ' . prefixTable('items') . '
1883
+        FROM ' . prefixTable('items').'
1884 1884
         WHERE perso = 0'
1885 1885
     );
1886 1886
 
@@ -1904,15 +1904,15 @@  discard block
 block discarded – undo
1904 1904
     // Loop on logs
1905 1905
     $rows = DB::query(
1906 1906
         'SELECT increment_id
1907
-        FROM ' . prefixTable('log_items') . '
1907
+        FROM ' . prefixTable('log_items').'
1908 1908
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
1909
-        LIMIT ' . $post_start . ', ' . $post_length
1909
+        LIMIT ' . $post_start.', '.$post_length
1910 1910
     );
1911 1911
     foreach ($rows as $record) {
1912 1912
         // Get itemKey from current user
1913 1913
         $currentUserKey = DB::queryFirstRow(
1914 1914
             'SELECT share_key
1915
-            FROM ' . prefixTable('sharekeys_logs') . '
1915
+            FROM ' . prefixTable('sharekeys_logs').'
1916 1916
             WHERE object_id = %i AND user_id = %i',
1917 1917
             $record['increment_id'],
1918 1918
             $_SESSION['user_id']
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1940 1940
                 $currentUserKey = DB::queryFirstRow(
1941 1941
                     'SELECT increment_id
1942
-                    FROM ' . prefixTable('sharekeys_items') . '
1942
+                    FROM ' . prefixTable('sharekeys_items').'
1943 1943
                     WHERE object_id = %i AND user_id = %i',
1944 1944
                     $record['id'],
1945 1945
                     $post_user_id
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
     // SHould we change step?
1962 1962
     DB::query(
1963 1963
         'SELECT increment_id
1964
-        FROM ' . prefixTable('log_items') . '
1964
+        FROM ' . prefixTable('log_items').'
1965 1965
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
1966 1966
     );
1967 1967
 
@@ -1985,15 +1985,15 @@  discard block
 block discarded – undo
1985 1985
     // Loop on fields
1986 1986
     $rows = DB::query(
1987 1987
         'SELECT id
1988
-        FROM ' . prefixTable('categories_items') . '
1988
+        FROM ' . prefixTable('categories_items').'
1989 1989
         WHERE encryption_type = "teampass_aes"
1990
-        LIMIT ' . $post_start . ', ' . $post_length
1990
+        LIMIT ' . $post_start.', '.$post_length
1991 1991
     );
1992 1992
     foreach ($rows as $record) {
1993 1993
         // Get itemKey from current user
1994 1994
         $currentUserKey = DB::queryFirstRow(
1995 1995
             'SELECT share_key
1996
-            FROM ' . prefixTable('sharekeys_fields') . '
1996
+            FROM ' . prefixTable('sharekeys_fields').'
1997 1997
             WHERE object_id = %i AND user_id = %i',
1998 1998
             $record['id'],
1999 1999
             $_SESSION['user_id']
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2021 2021
                 $currentUserKey = DB::queryFirstRow(
2022 2022
                     'SELECT increment_id
2023
-                    FROM ' . prefixTable('sharekeys_items') . '
2023
+                    FROM ' . prefixTable('sharekeys_items').'
2024 2024
                     WHERE object_id = %i AND user_id = %i',
2025 2025
                     $record['id'],
2026 2026
                     $post_user_id
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
     // SHould we change step?
2043 2043
     DB::query(
2044 2044
         'SELECT *
2045
-        FROM ' . prefixTable('categories_items') . '
2045
+        FROM ' . prefixTable('categories_items').'
2046 2046
         WHERE encryption_type = "teampass_aes"'
2047 2047
     );
2048 2048
 
@@ -2066,14 +2066,14 @@  discard block
 block discarded – undo
2066 2066
     // Loop on suggestions
2067 2067
     $rows = DB::query(
2068 2068
         'SELECT id
2069
-        FROM ' . prefixTable('suggestion') . '
2070
-        LIMIT ' . $post_start . ', ' . $post_length
2069
+        FROM ' . prefixTable('suggestion').'
2070
+        LIMIT ' . $post_start.', '.$post_length
2071 2071
     );
2072 2072
     foreach ($rows as $record) {
2073 2073
         // Get itemKey from current user
2074 2074
         $currentUserKey = DB::queryFirstRow(
2075 2075
             'SELECT share_key
2076
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2076
+            FROM ' . prefixTable('sharekeys_suggestions').'
2077 2077
             WHERE object_id = %i AND user_id = %i',
2078 2078
             $record['id'],
2079 2079
             $_SESSION['user_id']
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2101 2101
                 $currentUserKey = DB::queryFirstRow(
2102 2102
                     'SELECT increment_id
2103
-                    FROM ' . prefixTable('sharekeys_items') . '
2103
+                    FROM ' . prefixTable('sharekeys_items').'
2104 2104
                     WHERE object_id = %i AND user_id = %i',
2105 2105
                     $record['id'],
2106 2106
                     $post_user_id
@@ -2145,15 +2145,15 @@  discard block
 block discarded – undo
2145 2145
     // Loop on files
2146 2146
     $rows = DB::query(
2147 2147
         'SELECT id
2148
-        FROM ' . prefixTable('files') . '
2149
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2150
-        LIMIT ' . $post_start . ', ' . $post_length
2148
+        FROM ' . prefixTable('files').'
2149
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2150
+        LIMIT ' . $post_start.', '.$post_length
2151 2151
     ); //aes_encryption
2152 2152
     foreach ($rows as $record) {
2153 2153
         // Get itemKey from current user
2154 2154
         $currentUserKey = DB::queryFirstRow(
2155 2155
             'SELECT share_key
2156
-            FROM ' . prefixTable('sharekeys_files') . '
2156
+            FROM ' . prefixTable('sharekeys_files').'
2157 2157
             WHERE object_id = %i AND user_id = %i',
2158 2158
             $record['id'],
2159 2159
             $_SESSION['user_id']
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2181 2181
                 $currentUserKey = DB::queryFirstRow(
2182 2182
                     'SELECT increment_id
2183
-                    FROM ' . prefixTable('sharekeys_items') . '
2183
+                    FROM ' . prefixTable('sharekeys_items').'
2184 2184
                     WHERE object_id = %i AND user_id = %i',
2185 2185
                     $record['id'],
2186 2186
                     $post_user_id
@@ -2202,8 +2202,8 @@  discard block
 block discarded – undo
2202 2202
     // SHould we change step?
2203 2203
     DB::query(
2204 2204
         'SELECT *
2205
-        FROM ' . prefixTable('files') . '
2206
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2205
+        FROM ' . prefixTable('files').'
2206
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2207 2207
     );
2208 2208
 
2209 2209
     $next_start = (int) $post_start + (int) $post_length;
@@ -2235,16 +2235,16 @@  discard block
 block discarded – undo
2235 2235
     if (count($_SESSION['personal_folders']) > 0) {
2236 2236
         $rows = DB::query(
2237 2237
             'SELECT id, pw
2238
-            FROM ' . prefixTable('items') . '
2238
+            FROM ' . prefixTable('items').'
2239 2239
             WHERE perso = 1 AND id_tree IN %ls
2240
-            LIMIT ' . $post_start . ', ' . $post_length,
2240
+            LIMIT ' . $post_start.', '.$post_length,
2241 2241
             $_SESSION['personal_folders']
2242 2242
         );
2243 2243
         foreach ($rows as $record) {
2244 2244
             // Get itemKey from current user
2245 2245
             $currentUserKey = DB::queryFirstRow(
2246 2246
                 'SELECT share_key, increment_id
2247
-                FROM ' . prefixTable('sharekeys_items') . '
2247
+                FROM ' . prefixTable('sharekeys_items').'
2248 2248
                 WHERE object_id = %i AND user_id = %i',
2249 2249
                 $record['id'],
2250 2250
                 $_SESSION['user_id']
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2272 2272
                     $currentUserKey = DB::queryFirstRow(
2273 2273
                         'SELECT increment_id
2274
-                        FROM ' . prefixTable('sharekeys_items') . '
2274
+                        FROM ' . prefixTable('sharekeys_items').'
2275 2275
                         WHERE object_id = %i AND user_id = %i',
2276 2276
                         $record['id'],
2277 2277
                         $post_user_id
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
     // SHould we change step?
2295 2295
     DB::query(
2296 2296
         'SELECT *
2297
-        FROM ' . prefixTable('items') . '
2297
+        FROM ' . prefixTable('items').'
2298 2298
         WHERE perso = 0'
2299 2299
     );
2300 2300
 
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
         // Check if user exists
2319 2319
         $userInfo = DB::queryFirstRow(
2320 2320
             'SELECT public_key, encrypted_psk
2321
-            FROM ' . prefixTable('users') . '
2321
+            FROM ' . prefixTable('users').'
2322 2322
             WHERE id = %i',
2323 2323
             $post_user_id
2324 2324
         );
@@ -2343,9 +2343,9 @@  discard block
 block discarded – undo
2343 2343
                 // Loop on persoanl items
2344 2344
                 $rows = DB::query(
2345 2345
                     'SELECT id, pw
2346
-                    FROM ' . prefixTable('items') . '
2346
+                    FROM ' . prefixTable('items').'
2347 2347
                     WHERE perso = 1 AND id_tree IN %ls
2348
-                    LIMIT ' . $post_start . ', ' . $post_length,
2348
+                    LIMIT ' . $post_start.', '.$post_length,
2349 2349
                     $_SESSION['personal_folders']
2350 2350
                 );
2351 2351
                 $countUserPersonalItems = DB::count();
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
                         // Loop on files
2389 2389
                         $rows = DB::query(
2390 2390
                             'SELECT id, file
2391
-                            FROM ' . prefixTable('files') . '
2391
+                            FROM ' . prefixTable('files').'
2392 2392
                             WHERE status != %s
2393 2393
                             AND id_item = %i',
2394 2394
                             TP_ENCRYPTION_NAME,
@@ -2399,14 +2399,14 @@  discard block
 block discarded – undo
2399 2399
                             // Now decrypt the file
2400 2400
                             prepareFileWithDefuse(
2401 2401
                                 'decrypt',
2402
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2403
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2402
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2403
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2404 2404
                                 $SETTINGS,
2405 2405
                                 $post_user_psk
2406 2406
                             );
2407 2407
 
2408 2408
                             // Encrypt the file
2409
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2409
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2410 2410
 
2411 2411
                             DB::update(
2412 2412
                                 prefixTable('files'),
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
                             );
2430 2430
 
2431 2431
                             // Unlink original file
2432
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2432
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2433 2433
                         }
2434 2434
                     }
2435 2435
                 }
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
         // Get user info
2499 2499
         $userData = DB::queryFirstRow(
2500 2500
             'SELECT '.$post_fields.'
2501
-            FROM ' . prefixTable('users') . '
2501
+            FROM ' . prefixTable('users').'
2502 2502
             WHERE id = %i',
2503 2503
             $post_user_id
2504 2504
         );
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
         // Get user info
2534 2534
         $userData = DB::queryFirstRow(
2535 2535
             'SELECT auth_type, login, private_key
2536
-            FROM ' . prefixTable('users') . '
2536
+            FROM ' . prefixTable('users').'
2537 2537
             WHERE id = %i',
2538 2538
             $post_user_id
2539 2539
         );
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
             $privateKey = decryptPrivateKey($post_current_pwd, $userData['private_key']);
2545 2545
 
2546 2546
             // Load superGlobals
2547
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2547
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2548 2548
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2549 2549
 
2550 2550
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2577,7 +2577,7 @@  discard block
 block discarded – undo
2577 2577
                 return prepareExchangedData(
2578 2578
                     array(
2579 2579
                         'error' => false,
2580
-                        'message' => langHdl('done'),'',
2580
+                        'message' => langHdl('done'), '',
2581 2581
                     ),
2582 2582
                     'encode'
2583 2583
                 );
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
         // Get user info
2616 2616
         $userData = DB::queryFirstRow(
2617 2617
             'SELECT auth_type, login, private_key, special
2618
-            FROM ' . prefixTable('users') . '
2618
+            FROM ' . prefixTable('users').'
2619 2619
             WHERE id = %i',
2620 2620
             $post_user_id
2621 2621
         );
@@ -2645,14 +2645,14 @@  discard block
 block discarded – undo
2645 2645
                 );
2646 2646
 
2647 2647
                 // Load superGlobals
2648
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2648
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2649 2649
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2650 2650
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2651 2651
 
2652 2652
                 return prepareExchangedData(
2653 2653
                     array(
2654 2654
                         'error' => false,
2655
-                        'message' => langHdl('done'),'',
2655
+                        'message' => langHdl('done'), '',
2656 2656
                     ),
2657 2657
                     'encode'
2658 2658
                 );
@@ -2676,14 +2676,14 @@  discard block
 block discarded – undo
2676 2676
             // Get one item
2677 2677
             $record = DB::queryFirstRow(
2678 2678
                 'SELECT id, pw
2679
-                FROM ' . prefixTable('items') . '
2679
+                FROM ' . prefixTable('items').'
2680 2680
                 WHERE perso = 0'
2681 2681
             );
2682 2682
 
2683 2683
             // Get itemKey from current user
2684 2684
             $currentUserKey = DB::queryFirstRow(
2685 2685
                 'SELECT share_key, increment_id
2686
-                FROM ' . prefixTable('sharekeys_items') . '
2686
+                FROM ' . prefixTable('sharekeys_items').'
2687 2687
                 WHERE object_id = %i AND user_id = %i',
2688 2688
                 $record['id'],
2689 2689
                 $post_user_id
@@ -2711,7 +2711,7 @@  discard block
 block discarded – undo
2711 2711
                     );
2712 2712
                     
2713 2713
                     // Load superGlobals
2714
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2714
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2715 2715
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2716 2716
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2717 2717
 
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
             $_SESSION['user_id']
2766 2766
         );
2767 2767
         // Return data
2768
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
2768
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
2769 2769
     }
2770 2770
     
2771 2771
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.