Passed
Push — teampass_3.0 ( b1a175...7deae0 )
by Nils
05:48 queued 12s
created
sources/expired.datatables.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 require_once 'SecureHandler.php';
29 29
 session_name('teampass_session');
30 30
 session_start();
31
-if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) {
31
+if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) {
32 32
     die('Hacking attempt...');
33 33
 }
34 34
 
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // Do checks
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
48 48
     // Not allowed page
49 49
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
55
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
55
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
56 56
 header('Content-type: text/html; charset=utf-8');
57 57
 header('Cache-Control: no-cache, must-revalidate');
58 58
 require_once 'main.functions.php';
59 59
 // Connect to mysql server
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
61 61
 if (defined('DB_PASSWD_CLEAR') === false) {
62 62
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
63 63
 }
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 DB::$port = DB_PORT;
69 69
 DB::$encoding = DB_ENCODING;
70 70
 // Class loader
71
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
71
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
72 72
 //Build tree
73
-$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
73
+$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
74 74
 $tree->register();
75 75
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
76 76
 //Columns name
@@ -81,22 +81,22 @@  discard block
 block discarded – undo
81 81
 $sOrder = $sLimit = '';
82 82
 // Is a date sent?
83 83
 if (isset($_GET['dateCriteria']) === true && empty($_GET['dateCriteria']) === false) {
84
-    $sWhere .= ' AND a.del_value < ' . round(filter_var($_GET['dateCriteria'], FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
84
+    $sWhere .= ' AND a.del_value < '.round(filter_var($_GET['dateCriteria'], FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
85 85
 }
86 86
 //echo $sWhere;
87 87
 /* BUILD QUERY */
88 88
 //Paging
89 89
 $sLimit = '';
90 90
 if (isset($_GET['length']) === true && (int) $_GET['length'] !== -1) {
91
-    $sLimit = ' LIMIT ' . filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT) . ', ' . filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT) . '';
91
+    $sLimit = ' LIMIT '.filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT).', '.filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT).'';
92 92
 }
93 93
 
94 94
 //Ordering
95 95
 if (isset($_GET['order'][0]['dir']) && in_array($_GET['order'][0]['dir'], $aSortTypes)) {
96 96
     $sOrder = 'ORDER BY  ';
97 97
     if (preg_match('#^(asc|desc)$#i', $_GET['order'][0]['column'])) {
98
-        $sOrder .= '' . $aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
99
-            . filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_STRING) . ', ';
98
+        $sOrder .= ''.$aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
99
+            . filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_STRING).', ';
100 100
     }
101 101
 
102 102
     $sOrder = substr_replace($sOrder, '', -2);
@@ -117,29 +117,29 @@  discard block
 block discarded – undo
117 117
     && $_GET['letter'] !== 'None'
118 118
 ) {
119 119
     $sWhere .= ' AND ';
120
-    $sWhere .= $aColumns[1] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' OR ";
121
-    $sWhere .= $aColumns[2] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' OR ";
122
-    $sWhere .= $aColumns[3] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' ";
120
+    $sWhere .= $aColumns[1]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' OR ";
121
+    $sWhere .= $aColumns[2]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' OR ";
122
+    $sWhere .= $aColumns[3]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' ";
123 123
 } elseif (isset($_GET['search']['value']) === true && $_GET['search']['value'] !== '') {
124 124
     $sWhere = ' AND ';
125
-    $sWhere .= $aColumns[1] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' OR ";
126
-    $sWhere .= $aColumns[2] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' OR ";
127
-    $sWhere .= $aColumns[3] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' ";
125
+    $sWhere .= $aColumns[1]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' OR ";
126
+    $sWhere .= $aColumns[2]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' OR ";
127
+    $sWhere .= $aColumns[3]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' ";
128 128
 }
129 129
 
130 130
 $rows = DB::query(
131 131
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
132
-    FROM ' . prefixTable('automatic_del') . ' AS a
133
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
132
+    FROM ' . prefixTable('automatic_del').' AS a
133
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
134 134
     $sWhere.
135 135
     (string) $sOrder
136 136
 );
137 137
 $iTotal = DB::count();
138 138
 $rows = DB::query(
139 139
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
140
-    FROM ' . prefixTable('automatic_del') . ' AS a
141
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
142
-        $sWhere .
140
+    FROM ' . prefixTable('automatic_del').' AS a
141
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
142
+        $sWhere.
143 143
         $sLimit
144 144
 );
145 145
 $iFilteredTotal = DB::count();
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
     // start the line
158 158
     $sOutput .= '[';
159 159
     // Column 1
160
-    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\"  data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", ';
160
+    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\"  data-item-tree-id=\"'.$record['id_tree'].'\"></i>", ';
161 161
     // Column 2
162
-    $sOutput .= '"' . $record['label'] . '", ';
162
+    $sOutput .= '"'.$record['label'].'", ';
163 163
     // Column 3
164
-    $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['del_value']) . '", ';
164
+    $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['del_value']).'", ';
165 165
     // Column 4
166 166
     $path = [];
167 167
     $treeDesc = $tree->getPath($record['id_tree'], true);
168 168
     foreach ($treeDesc as $t) {
169 169
         array_push($path, $t->title);
170 170
     }
171
-    $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],';
171
+    $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],';
172 172
 }
173 173
 
174 174
 if ($iTotal > 0) {
@@ -181,4 +181,4 @@  discard block
 block discarded – undo
181 181
 }
182 182
 
183 183
 // finalize output
184
-echo '{"recordsTotal": ' . $iTotal . ', "recordsFiltered": ' . $iFilteredTotal . ', "data": ' . $sOutput;
184
+echo '{"recordsTotal": '.$iTotal.', "recordsFiltered": '.$iFilteredTotal.', "data": '.$sOutput;
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'], time()) .
270
+                'message' => langHdl('last_execution').' '.
271
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], 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'], time()) .
375
+                'message' => langHdl('last_execution').' '.
376
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], 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', $_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'], time()) .
681
+                'message' => langHdl('last_execution').' '.
682
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], 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'], time()) .
785
+                'message' => langHdl('last_execution').' '.
786
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], 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, '');
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'], time()) .
838
+                'message' => langHdl('last_execution').' '.
839
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], 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'], time()) .
901
+                'message' => langHdl('last_execution').' '.
902
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], 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', $_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
             $ret = json_decode(
@@ -1748,11 +1748,11 @@  discard block
 block discarded – undo
1748 1748
             break;
1749 1749
         }
1750 1750
 
1751
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1751
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1752 1752
 
1753 1753
         $rows = DB::query(
1754 1754
             'SELECT *
1755
-            FROM ' . prefixTable('emails') . '
1755
+            FROM ' . prefixTable('emails').'
1756 1756
             WHERE status = %s OR status = %s',
1757 1757
             'not_sent',
1758 1758
             ''
@@ -1837,9 +1837,9 @@  discard block
 block discarded – undo
1837 1837
             break;
1838 1838
         }
1839 1839
 
1840
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1840
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1841 1841
 
1842
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1842
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1843 1843
         foreach ($rows as $record) {
1844 1844
             //send email
1845 1845
             $ret = json_decode(
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
             break;
1908 1908
         }
1909 1909
 
1910
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1910
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1911 1911
 
1912 1912
         // init
1913 1913
         $filesList = array();
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
                 FROM ' . prefixTable('files')
1921 1921
             );
1922 1922
             foreach ($rows as $record) {
1923
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1923
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1924 1924
                     $addFile = false;
1925 1925
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1926 1926
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1985,8 +1985,8 @@  discard block
 block discarded – undo
1985 1985
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
1986 1986
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1987 1987
 
1988
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1989
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1988
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1989
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1990 1990
 
1991 1991
         $cpt = 0;
1992 1992
         $continu = true;
@@ -1994,15 +1994,15 @@  discard block
 block discarded – undo
1994 1994
         $message = '';
1995 1995
 
1996 1996
         // load PhpEncryption library
1997
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
1998
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
1999
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2000
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
2001
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2002
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2003
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2004
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2005
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
1997
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
1998
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
1999
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2000
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
2001
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2002
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2003
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2004
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2005
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2006 2006
 
2007 2007
         // treat 10 files
2008 2008
         foreach ($post_list as $file) {
@@ -2010,35 +2010,35 @@  discard block
 block discarded – undo
2010 2010
                 // Get file name
2011 2011
                 $file_info = DB::queryfirstrow(
2012 2012
                     'SELECT file
2013
-                    FROM ' . prefixTable('files') . '
2013
+                    FROM ' . prefixTable('files').'
2014 2014
                     WHERE id = %i',
2015 2015
                     $file
2016 2016
                 );
2017 2017
 
2018 2018
                 // skip file is Coherancey not respected
2019
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2019
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2020 2020
                     // Case where we want to decrypt
2021 2021
                     if ($post_option === 'decrypt') {
2022 2022
                         prepareFileWithDefuse(
2023 2023
                             'decrypt',
2024
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2025
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2024
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2025
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2026 2026
                             $SETTINGS
2027 2027
                         );
2028 2028
                         // Case where we want to encrypt
2029 2029
                     } elseif ($post_option === 'encrypt') {
2030 2030
                         prepareFileWithDefuse(
2031 2031
                             'encrypt',
2032
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2033
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2032
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2033
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2034 2034
                             $SETTINGS
2035 2035
                         );
2036 2036
                     }
2037 2037
                     // Do file cleanup
2038
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2038
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2039 2039
                     rename(
2040
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2041
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2040
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2041
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2042 2042
                     );
2043 2043
 
2044 2044
                     // store in DB
@@ -2073,8 +2073,8 @@  discard block
 block discarded – undo
2073 2073
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2074 2074
             );
2075 2075
 
2076
-            $message = langHdl('last_execution') . ' ' .
2077
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
2076
+            $message = langHdl('last_execution').' '.
2077
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
2078 2078
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2079 2079
         }
2080 2080
 
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2162 2162
 
2163 2163
             DB::query(
2164
-                'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i',
2164
+                'DELETE FROM '.prefixTable('api').' WHERE id = %i',
2165 2165
                 $post_id
2166 2166
             );
2167 2167
         }
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
             // Delete existing key
2254 2254
         } elseif (null !== $post_action && $post_action === 'delete') {
2255 2255
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2256
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id);
2256
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id);
2257 2257
         }
2258 2258
 
2259 2259
         echo prepareExchangedData(
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
 
2269 2269
     case 'save_api_status':
2270 2270
         // Do query
2271
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2271
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2272 2272
         $counter = DB::count();
2273 2273
         if ($counter === 0) {
2274 2274
             DB::insert(
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
         break;
2295 2295
 
2296 2296
     case 'save_duo_status':
2297
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2297
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2298 2298
         $counter = DB::count();
2299 2299
         if ($counter === 0) {
2300 2300
             DB::insert(
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
         foreach ($dataReceived as $key => $value) {
2338 2338
             DB::query(
2339 2339
                 'SELECT * 
2340
-                FROM ' . prefixTable('misc') . '
2340
+                FROM ' . prefixTable('misc').'
2341 2341
                 WHERE type = %s AND intitule = %s',
2342 2342
                 'admin',
2343 2343
                 $key
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
         } else {
2406 2406
             $tmp = 1;
2407 2407
         }
2408
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2408
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2409 2409
         $counter = DB::count();
2410 2410
         if ($counter === 0) {
2411 2411
             DB::insert(
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 
2432 2432
         // ga_website_name
2433 2433
         if (is_null($dataReceived['ga_website_name']) === false) {
2434
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2434
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2435 2435
             $counter = DB::count();
2436 2436
             if ($counter === 0) {
2437 2437
                 DB::insert(
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
         }
2463 2463
 
2464 2464
         // send data
2465
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2465
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2466 2466
         break;
2467 2467
 
2468 2468
     case 'save_agses_options':
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
 
2486 2486
         // agses_hosted_url
2487 2487
         if (!is_null($dataReceived['agses_hosted_url'])) {
2488
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2488
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2489 2489
             $counter = DB::count();
2490 2490
             if ($counter === 0) {
2491 2491
                 DB::insert(
@@ -2514,7 +2514,7 @@  discard block
 block discarded – undo
2514 2514
 
2515 2515
         // agses_hosted_id
2516 2516
         if (!is_null($dataReceived['agses_hosted_id'])) {
2517
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2517
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2518 2518
             $counter = DB::count();
2519 2519
             if ($counter === 0) {
2520 2520
                 DB::insert(
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 
2544 2544
         // agses_hosted_apikey
2545 2545
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2546
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2546
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2547 2547
             $counter = DB::count();
2548 2548
             if ($counter === 0) {
2549 2549
                 DB::insert(
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
         }
2572 2572
 
2573 2573
         // send data
2574
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2574
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2575 2575
         break;
2576 2576
 
2577 2577
     case 'save_option_change':
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 
2608 2608
         // Check if setting is already in DB. If NO then insert, if YES then update.
2609 2609
         $data = DB::query(
2610
-            'SELECT * FROM ' . prefixTable('misc') . '
2610
+            'SELECT * FROM '.prefixTable('misc').'
2611 2611
             WHERE type = %s AND intitule = %s',
2612 2612
             $type,
2613 2613
             $dataReceived['field']
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
                     array(
2630 2630
                         'valeur' => time(),
2631 2631
                         'type' => $type,
2632
-                        'intitule' => $dataReceived['field'] . '_time',
2632
+                        'intitule' => $dataReceived['field'].'_time',
2633 2633
                     )
2634 2634
                 );
2635 2635
             }
@@ -2647,10 +2647,10 @@  discard block
 block discarded – undo
2647 2647
             if ($dataReceived['field'] === 'send_stats') {
2648 2648
                 // Check if previous time exists, if not them insert this value in DB
2649 2649
                 DB::query(
2650
-                    'SELECT * FROM ' . prefixTable('misc') . '
2650
+                    'SELECT * FROM '.prefixTable('misc').'
2651 2651
                     WHERE type = %s AND intitule = %s',
2652 2652
                     $type,
2653
-                    $dataReceived['field'] . '_time'
2653
+                    $dataReceived['field'].'_time'
2654 2654
                 );
2655 2655
                 $counter = DB::count();
2656 2656
                 if ($counter === 0) {
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
                         array(
2660 2660
                             'valeur' => 0,
2661 2661
                             'type' => $type,
2662
-                            'intitule' => $dataReceived['field'] . '_time',
2662
+                            'intitule' => $dataReceived['field'].'_time',
2663 2663
                         )
2664 2664
                     );
2665 2665
                 } else {
@@ -2679,13 +2679,13 @@  discard block
 block discarded – undo
2679 2679
         // special Cases
2680 2680
         if ($dataReceived['field'] === 'cpassman_url') {
2681 2681
             // update also jsUrl for CSFP protection
2682
-            $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js';
2682
+            $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js';
2683 2683
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2684 2684
             $data = file_get_contents($csrfp_file);
2685 2685
             $posJsUrl = strpos($data, '"jsUrl" => "');
2686 2686
             $posEndLine = strpos($data, '",', $posJsUrl);
2687 2687
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2688
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2688
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2689 2689
             file_put_contents($csrfp_file, $newdata);
2690 2690
         } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') {
2691 2691
             DB::update(
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
         echo prepareExchangedData(
2710 2710
             array(
2711 2711
                 'error' => false,
2712
-                'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']],
2712
+                'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']],
2713 2713
             ),
2714 2714
             'encode'
2715 2715
         );
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 
2752 2752
         // send statistics
2753 2753
         if (null !== $post_status) {
2754
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2754
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2755 2755
             $counter = DB::count();
2756 2756
             if ($counter === 0) {
2757 2757
                 DB::insert(
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
 
2784 2784
         // send statistics items
2785 2785
         if (null !== $post_list) {
2786
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2786
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2787 2787
             $counter = DB::count();
2788 2788
             if ($counter === 0) {
2789 2789
                 DB::insert(
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
             break;
2831 2831
         }
2832 2832
 
2833
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2833
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2834 2834
             if (DB::count() === 1) {
2835 2835
                 echo 1;
2836 2836
             } else {
@@ -2868,7 +2868,7 @@  discard block
 block discarded – undo
2868 2868
 
2869 2869
         $rows = DB::query(
2870 2870
             'SELECT id, title
2871
-                FROM ' . prefixTable('roles_title') . '
2871
+                FROM ' . prefixTable('roles_title').'
2872 2872
                 ORDER BY title ASC'
2873 2873
         );
2874 2874
         foreach ($rows as $record) {
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING);
53 53
 if (
54 54
     checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         || $isprofileupdate === false
60 60
     ) {
61 61
         $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
62
-        include $SETTINGS['cpassman_dir'] . '/error.php';
62
+        include $SETTINGS['cpassman_dir'].'/error.php';
63 63
         exit();
64 64
     } else {
65 65
         // Do special check to allow user to change attributes of his profile
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
             || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
69 69
         ) {
70 70
             $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
71
-            include $SETTINGS['cpassman_dir'] . '/error.php';
71
+            include $SETTINGS['cpassman_dir'].'/error.php';
72 72
             exit();
73 73
         }
74 74
     }
75 75
 }
76 76
 
77
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
77
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
78 78
 header('Content-type: text/html; charset=utf-8');
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
80
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
81
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
80
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
81
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
82 82
 
83 83
 // Connect to mysql server
84
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
84
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
85 85
 if (defined('DB_PASSWD_CLEAR') === false) {
86 86
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
87 87
 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             // Prepare variables
131 131
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
132 132
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
133
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
133
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
134 134
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
135 135
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
136 136
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // Check if user already exists
160 160
             $data = DB::query(
161 161
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $login
165 165
             );
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
             // Get info about user to delete
391 391
             $data_user = DB::queryfirstrow(
392
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
392
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
393 393
                 WHERE id = %i',
394 394
                 $post_id
395 395
             );
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 );
409 409
                 // delete personal folder and subfolders
410 410
                 $data = DB::queryfirstrow(
411
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
411
+                    'SELECT id FROM '.prefixTable('nested_tree').'
412 412
                     WHERE title = %s AND personal_folder = %i',
413 413
                     $post_id,
414 414
                     '1'
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
422 422
                         // delete items & logs
423 423
                         $items = DB::query(
424
-                            'SELECT id FROM ' . prefixTable('items') . '
424
+                            'SELECT id FROM '.prefixTable('items').'
425 425
                             WHERE id_tree=%i AND perso = %i',
426 426
                             $folder->id,
427 427
                             '1'
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             // Get info about user to delete
480 480
             $data_user = DB::queryfirstrow(
481
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
481
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
482 482
                 WHERE id = %i',
483 483
                 $post_id
484 484
             );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
             // Get info about user to delete
522 522
             $data_user = DB::queryfirstrow(
523
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
523
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
524 524
                 WHERE id = %i',
525 525
                 $post_id
526 526
             );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // Get info about user to delete
564 564
             $data_user = DB::queryfirstrow(
565 565
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
566
-                FROM ' . prefixTable('users') . '
566
+                FROM ' . prefixTable('users').'
567 567
                 WHERE id = %i',
568 568
                 $post_id
569 569
             );
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
             // Get info about user to delete
609 609
             $data_user = DB::queryfirstrow(
610
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
610
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
611 611
                 WHERE id = %i',
612 612
                 $post_id
613 613
             );
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
             // Get info about user to delete
651 651
             $data_user = DB::queryfirstrow(
652 652
                 'SELECT admin, isAdministratedByRole, gestionnaire
653
-                FROM ' . prefixTable('users') . '
653
+                FROM ' . prefixTable('users').'
654 654
                 WHERE id = %i',
655 655
                 $post_id
656 656
             );
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
             // Get info about user to delete
694 694
             $data_user = DB::queryfirstrow(
695 695
                 'SELECT admin, isAdministratedByRole, gestionnaire
696
-                FROM ' . prefixTable('users') . '
696
+                FROM ' . prefixTable('users').'
697 697
                 WHERE id = %i',
698 698
                 $post_id
699 699
             );
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
             // Get info about user to delete
734 734
             $data_user = DB::queryfirstrow(
735 735
                 'SELECT admin, isAdministratedByRole, gestionnaire
736
-                FROM ' . prefixTable('users') . '
736
+                FROM ' . prefixTable('users').'
737 737
                 WHERE id = %i',
738 738
                 $post_id
739 739
             );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $return = array();
773 773
             // Check if folder exists
774 774
             $data = DB::query(
775
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
775
+                'SELECT * FROM '.prefixTable('nested_tree').'
776 776
                 WHERE title = %s AND parent_id = %i',
777 777
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
778 778
                 '0'
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             }
786 786
             // Check if role exists
787 787
             $data = DB::query(
788
-                'SELECT * FROM ' . prefixTable('roles_title') . '
788
+                'SELECT * FROM '.prefixTable('roles_title').'
789 789
                 WHERE title = %s',
790 790
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
791 791
             );
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         case 'user_log_items':
806 806
             $nb_pages = 1;
807 807
             $logs = $sql_filter = '';
808
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
808
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
809 809
 
810 810
             // Prepare POST variables
811 811
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
818 818
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
819 819
                 ) {
820
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
820
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
821 821
                 }
822 822
                 // get number of pages
823 823
                 DB::query(
824 824
                     'SELECT *
825
-                    FROM ' . prefixTable('log_items') . ' as l
826
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
827
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
825
+                    FROM ' . prefixTable('log_items').' as l
826
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
827
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
828 828
                     WHERE l.id_user = %i ' . $sql_filter,
829 829
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
830 830
                 );
@@ -842,19 +842,19 @@  discard block
 block discarded – undo
842 842
                 // launch query
843 843
                 $rows = DB::query(
844 844
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
845
-                    FROM ' . prefixTable('log_items') . ' as l
846
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
847
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
848
-                    WHERE l.id_user = %i ' . $sql_filter . '
845
+                    FROM ' . prefixTable('log_items').' as l
846
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
847
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
848
+                    WHERE l.id_user = %i ' . $sql_filter.'
849 849
                     ORDER BY date DESC
850
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
850
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
851 851
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
852 852
                 );
853 853
             } else {
854 854
                 // get number of pages
855 855
                 DB::query(
856 856
                     'SELECT *
857
-                    FROM ' . prefixTable('log_system') . '
857
+                    FROM ' . prefixTable('log_system').'
858 858
                     WHERE type = %s AND field_1=%i',
859 859
                     'user_mngt',
860 860
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                 // launch query
874 874
                 $rows = DB::query(
875 875
                     'SELECT *
876
-                    FROM ' . prefixTable('log_system') . '
876
+                    FROM ' . prefixTable('log_system').'
877 877
                     WHERE type = %s AND field_1 = %i
878 878
                     ORDER BY date DESC
879 879
                     LIMIT %i, %i',
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             if (isset($counter) && $counter != 0) {
888 888
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
889 889
                 for ($i = 1; $i <= $nb_pages; ++$i) {
890
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
890
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
891 891
                 }
892 892
             }
893 893
             $pages .= '</tr></table>';
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
                     if ($post_scope === 'user_mngt') {
897 897
                         $user = DB::queryfirstrow(
898 898
                             'SELECT login
899
-                            from ' . prefixTable('users') . '
899
+                            from ' . prefixTable('users').'
900 900
                             WHERE id=%i',
901 901
                             $record['qui']
902 902
                         );
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
907 907
                             $label = langHdl('log_user_initial_pwd_changed');
908 908
                         } elseif ($tmp[0] == 'at_user_email_changed') {
909
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
909
+                            $label = langHdl('log_user_email_changed').$tmp[1];
910 910
                         } elseif ($tmp[0] == 'at_user_added') {
911 911
                             $label = langHdl('log_user_created');
912 912
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
                             $label = langHdl('log_user_pwd_changed');
918 918
                         }
919 919
                         // prepare log
920
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
920
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
921 921
                     } else {
922
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
922
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
923 923
                     }
924 924
                 }
925 925
             }
926 926
 
927
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
927
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
928 928
             break;
929 929
 
930 930
             /*
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             } else {
950 950
                 // Get folder id for Admin
951 951
                 $admin_folder = DB::queryFirstRow(
952
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
952
+                    'SELECT id FROM '.prefixTable('nested_tree').'
953 953
                     WHERE title = %i AND personal_folder = %i',
954 954
                     intval($_SESSION['user_id']),
955 955
                     '1'
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
                     // Get each Items in PF
961 961
                     $rows = DB::query(
962 962
                         'SELECT i.pw, i.label, l.id_user
963
-                        FROM ' . prefixTable('items') . ' as i
964
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
963
+                        FROM ' . prefixTable('items').' as i
964
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
965 965
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
966 966
                         'at_creation',
967 967
                         '1',
968 968
                         intval($folder->id)
969 969
                     );
970 970
                     foreach ($rows as $record) {
971
-                        echo $record['label'] . ' - ';
971
+                        echo $record['label'].' - ';
972 972
                         // Change user
973 973
                         DB::update(
974 974
                             prefixTable('log_items'),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
             // Get info about user to delete
1004 1004
             $data_user = DB::queryfirstrow(
1005 1005
                 'SELECT admin, isAdministratedByRole, gestionnaire
1006
-                FROM ' . prefixTable('users') . '
1006
+                FROM ' . prefixTable('users').'
1007 1007
                 WHERE id = %i',
1008 1008
                 $post_user_id
1009 1009
             );
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
             // Do
1042 1042
             $rows = DB::query(
1043
-                'SELECT id FROM ' . prefixTable('users') . '
1043
+                'SELECT id FROM '.prefixTable('users').'
1044 1044
                 WHERE timestamp != %s AND admin != %i',
1045 1045
                 '',
1046 1046
                 '1'
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
                 // Get info about user to delete
1050 1050
                 $data_user = DB::queryfirstrow(
1051 1051
                     'SELECT admin, isAdministratedByRole, gestionnaire
1052
-                    FROM ' . prefixTable('users') . '
1052
+                    FROM ' . prefixTable('users').'
1053 1053
                     WHERE id = %i',
1054 1054
                     $record['id']
1055 1055
                 );
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
             // Get info about user
1104 1104
             $rowUser = DB::queryfirstrow(
1105 1105
                 'SELECT *
1106
-                FROM ' . prefixTable('users') . '
1106
+                FROM ' . prefixTable('users').'
1107 1107
                 WHERE id = %i',
1108 1108
                 $post_id
1109 1109
             );
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                 $arrFldAllowed = array();
1122 1122
 
1123 1123
                 //Build tree
1124
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1124
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1125 1125
                 $tree->register();
1126 1126
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1127 1127
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                 // array of roles for actual user
1133 1133
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1134 1134
 
1135
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1135
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1136 1136
                 foreach ($rows as $record) {
1137 1137
                     if (
1138 1138
                         (int) $_SESSION['is_admin'] === 1
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
                 $rolesList = array();
1169 1169
                 $managedBy = array();
1170 1170
                 $selected = '';
1171
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1171
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1172 1172
                 foreach ($rows as $reccord) {
1173 1173
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1174 1174
                 }
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                         array_push(
1200 1200
                             $managedBy,
1201 1201
                             array(
1202
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1202
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1203 1203
                                 'id' => $fonction['id'],
1204 1204
                                 'selected' => $selected,
1205 1205
                             )
@@ -1281,9 +1281,9 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
                 // get USER STATUS
1283 1283
                 if ($rowUser['disabled'] == 1) {
1284
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>';
1284
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>';
1285 1285
                 } else {
1286
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1286
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1287 1287
                 }
1288 1288
 
1289 1289
                 $arrData['error'] = false;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
                 // count number of admins
1376 1376
                 $users = DB::query(
1377 1377
                     'SELECT id
1378
-                    FROM ' . prefixTable('users') . '
1378
+                    FROM ' . prefixTable('users').'
1379 1379
                     WHERE admin = 1 AND email != "" AND pw != ""'
1380 1380
                 );
1381 1381
                 if (DB::count() === 1) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
             // Get info about user to delete
1463 1463
             $data_user = DB::queryfirstrow(
1464
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1464
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1465 1465
                 WHERE id = %i',
1466 1466
                 $post_id
1467 1467
             );
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                     );
1483 1483
                     // delete personal folder and subfolders
1484 1484
                     $data = DB::queryfirstrow(
1485
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1485
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1486 1486
                         WHERE title = %s AND personal_folder = %i',
1487 1487
                         $post_id,
1488 1488
                         '1'
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1496 1496
                             // delete items & logs
1497 1497
                             $items = DB::query(
1498
-                                'SELECT id FROM ' . prefixTable('items') . '
1498
+                                'SELECT id FROM '.prefixTable('items').'
1499 1499
                                 WHERE id_tree=%i AND perso = %i',
1500 1500
                                 $folder->id,
1501 1501
                                 '1'
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
                 } else {
1517 1517
                     // Get old data about user
1518 1518
                     $oldData = DB::queryfirstrow(
1519
-                        'SELECT * FROM ' . prefixTable('users') . '
1519
+                        'SELECT * FROM '.prefixTable('users').'
1520 1520
                         WHERE id = %i',
1521 1521
                         $post_id
1522 1522
                     );
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
                     // update LOG
1548 1548
                     if ($oldData['email'] !== $post_email) {
1549
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], intval($_SESSION['user_id']), $_SESSION['login'], $post_id);
1549
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], intval($_SESSION['user_id']), $_SESSION['login'], $post_id);
1550 1550
                     }
1551 1551
                 }
1552 1552
                 echo prepareExchangedData(
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
             // Get info about user to delete
1603 1603
             $data_user = DB::queryfirstrow(
1604
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1604
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1605 1605
                 WHERE id = %i',
1606 1606
                 $post_id
1607 1607
             );
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
             }
1652 1652
 
1653 1653
             DB::queryfirstrow(
1654
-                'SELECT * FROM ' . prefixTable('users') . '
1654
+                'SELECT * FROM '.prefixTable('users').'
1655 1655
                 WHERE login = %s',
1656 1656
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1657 1657
             );
@@ -1700,14 +1700,14 @@  discard block
 block discarded – undo
1700 1700
             $arrData = array();
1701 1701
 
1702 1702
             //Build tree
1703
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1703
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1704 1704
             $tree->register();
1705 1705
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1706 1706
 
1707 1707
             // get User info
1708 1708
             $rowUser = DB::queryFirstRow(
1709 1709
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1710
-                FROM ' . prefixTable('users') . '
1710
+                FROM ' . prefixTable('users').'
1711 1711
                 WHERE id = %i',
1712 1712
                 $post_id
1713 1713
             );
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
                 // refine folders based upon roles
1726 1726
                 $rows = DB::query(
1727 1727
                     'SELECT folder_id, type
1728
-                    FROM ' . prefixTable('roles_values') . '
1728
+                    FROM ' . prefixTable('roles_values').'
1729 1729
                     WHERE role_id IN %ls
1730 1730
                     ORDER BY folder_id ASC',
1731 1731
                     $arrData['functions']
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
                             // get folder name
1755 1755
                             $row = DB::queryFirstRow(
1756 1756
                                 'SELECT title, nlevel, id
1757
-                                FROM ' . prefixTable('nested_tree') . '
1757
+                                FROM ' . prefixTable('nested_tree').'
1758 1758
                                 WHERE id = %i',
1759 1759
                                 $fld['id']
1760 1760
                             );
@@ -1767,34 +1767,34 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
                             // manage right icon
1769 1769
                             if ($fld['type'] == 'W') {
1770
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1771
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1772
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1770
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1771
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1772
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1773 1773
                             } elseif ($fld['type'] == 'ND') {
1774
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1775
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1776
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1774
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1775
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1776
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1777 1777
                             } elseif ($fld['type'] == 'NE') {
1778
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1779
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1780
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1778
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1779
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1780
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1781 1781
                             } elseif ($fld['type'] == 'NDNE') {
1782
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1783
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1784
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1782
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1783
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1784
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1785 1785
                             } else {
1786
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1786
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1787 1787
                             }
1788 1788
 
1789
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1790
-                                ' <small>[' . $row['id'] . ']</small></td><td>' . $label . '</td></tr>';
1789
+                            $html .= '<tr><td>'.$ident.$row['title'].
1790
+                                ' <small>['.$row['id'].']</small></td><td>'.$label.'</td></tr>';
1791 1791
                             break;
1792 1792
                         }
1793 1793
                     }
1794 1794
                 }
1795 1795
 
1796
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1797
-                    $html . '</tbody></table>';
1796
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1797
+                    $html.'</tbody></table>';
1798 1798
             } else {
1799 1799
                 $html_full = '';
1800 1800
             }
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1841 1841
                 $rows = DB::query(
1842 1842
                     'SELECT *
1843
-                    FROM ' . prefixTable('users') . '
1843
+                    FROM ' . prefixTable('users').'
1844 1844
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1845 1845
                     '0',
1846 1846
                     array_filter($_SESSION['user_roles'])
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
             } else {
1849 1849
                 $rows = DB::query(
1850 1850
                     'SELECT *
1851
-                    FROM ' . prefixTable('users') . '
1851
+                    FROM ' . prefixTable('users').'
1852 1852
                     WHERE admin = %i',
1853 1853
                     '0'
1854 1854
                 );
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
                 $groupIds = [];
1861 1861
                 foreach (explode(';', $record['fonction_id']) as $group) {
1862 1862
                     $tmp = DB::queryfirstrow(
1863
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1863
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1864 1864
                         WHERE id = %i',
1865 1865
                         $group
1866 1866
                     );
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
 
1873 1873
                 // Get managed_by
1874 1874
                 $managedBy = DB::queryfirstrow(
1875
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1875
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1876 1876
                     WHERE id = %i',
1877 1877
                     $record['isAdministratedByRole']
1878 1878
                 );
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
                 $foldersAllowedIds = [];
1883 1883
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1884 1884
                     $tmp = DB::queryfirstrow(
1885
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1885
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1886 1886
                         WHERE id = %i',
1887 1887
                         $role
1888 1888
                     );
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
                 $foldersForbiddenIds = [];
1896 1896
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1897 1897
                     $tmp = DB::queryfirstrow(
1898
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1898
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1899 1899
                         WHERE id = %i',
1900 1900
                         $role
1901 1901
                     );
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
                         'login' => $record['login'],
1914 1914
                         'groups' => implode(', ', $groups),
1915 1915
                         'groupIds' => $groupIds,
1916
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1916
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1917 1917
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1918 1918
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1919 1919
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
 
1992 1992
             // Get info about user
1993 1993
             $data_user = DB::queryfirstrow(
1994
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1994
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1995 1995
                 WHERE id = %i',
1996 1996
                 $post_source_id
1997 1997
             );
@@ -2151,14 +2151,14 @@  discard block
 block discarded – undo
2151 2151
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2152 2152
                 $data_user = DB::queryfirstrow(
2153 2153
                     'SELECT fonction_id
2154
-                    FROM ' . prefixTable('users') . '
2154
+                    FROM ' . prefixTable('users').'
2155 2155
                     WHERE id = %i',
2156 2156
                     $post_user_id
2157 2157
                 );
2158 2158
 
2159 2159
                 if ($data_user) {
2160 2160
                     // Ensure array is unique
2161
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2161
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2162 2162
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2163 2163
                 } else {
2164 2164
                     // User not found
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2214 2214
                 $record = DB::queryFirstRow(
2215 2215
                     'SELECT user_ip_lastdate
2216
-                    FROM ' . prefixTable('users') . '
2216
+                    FROM ' . prefixTable('users').'
2217 2217
                     WHERE id = %i',
2218 2218
                     $_SESSION['user_id']
2219 2219
                 );
@@ -2305,38 +2305,38 @@  discard block
 block discarded – undo
2305 2305
             ];
2306 2306
 
2307 2307
             // Load expected libraries
2308
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2312
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2313
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2314
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2315
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2316
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2318
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2320
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2321
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2322
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2323
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2324
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2325
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2326
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2327
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2328
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2329
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2330
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2331
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2332
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2333
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2334
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2335
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2336
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2337
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2338
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2339
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2308
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2312
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2313
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2314
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2315
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2316
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2318
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2320
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2321
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2322
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2323
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2324
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2325
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2326
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2327
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2328
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2329
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2330
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2331
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2332
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2333
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2334
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2335
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2336
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2337
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2338
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2339
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2340 2340
 
2341 2341
             $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2342 2342
             $ad->register();
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
                 echo prepareExchangedData(
2353 2353
                     array(
2354 2354
                         'error' => true,
2355
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2355
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2356 2356
                     ),
2357 2357
                     'encode'
2358 2358
                 );
@@ -2372,11 +2372,11 @@  discard block
 block discarded – undo
2372 2372
                 ['objectclass', '=', 'inetorgperson'],
2373 2373
             ])->get();
2374 2374
             
2375
-            foreach($users as $i => $adUser) {
2375
+            foreach ($users as $i => $adUser) {
2376 2376
                 //print_r($user);
2377 2377
 
2378 2378
                 // Build the list of all groups in AD
2379
-                foreach($adUser['memberof'] as $j => $adUserGroup) {
2379
+                foreach ($adUser['memberof'] as $j => $adUserGroup) {
2380 2380
                     if (empty($adUserGroup) === false) {
2381 2381
                         $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2382 2382
                         if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
                     // Get his ID
2392 2392
                     DB::queryfirstrow(
2393 2393
                         'SELECT id, fonction_id, auth_type
2394
-                        FROM ' . prefixTable('users') . '
2394
+                        FROM ' . prefixTable('users').'
2395 2395
                         WHERE login = %s',
2396 2396
                         $userLogin
2397 2397
                     );
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
             }
2427 2427
 
2428 2428
             // Get all groups in Teampass
2429
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2429
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2430 2430
             foreach ($rows as $record) {
2431 2431
                 array_push(
2432 2432
                     $teampassRoles,
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
             // Check if user already exists
2493 2493
             $data = DB::query(
2494 2494
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2495
-                FROM ' . prefixTable('users') . '
2495
+                FROM ' . prefixTable('users').'
2496 2496
                 WHERE login = %s',
2497 2497
                 $post_login
2498 2498
             );
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
                 );
2597 2597
 
2598 2598
                 // Rebuild tree
2599
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2599
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2600 2600
                 $tree->register();
2601 2601
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2602 2602
                 $tree->rebuild();
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
             // Check if user already exists
2665 2665
             DB::query(
2666 2666
                 'SELECT id
2667
-                FROM ' . prefixTable('users') . '
2667
+                FROM ' . prefixTable('users').'
2668 2668
                 WHERE id = %i',
2669 2669
                 $post_id
2670 2670
             );
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
             // Check if user already exists
2741 2741
             $userInfo = DB::queryfirstrow(
2742 2742
                 'SELECT id, private_key, public_key
2743
-                FROM ' . prefixTable('users') . '
2743
+                FROM ' . prefixTable('users').'
2744 2744
                 WHERE id = %i',
2745 2745
                 $post_userid
2746 2746
             );
@@ -2775,7 +2775,7 @@  discard block
 block discarded – undo
2775 2775
             if (count($_SESSION['personal_folders']) > 0) {
2776 2776
                 DB::query(
2777 2777
                     'SELECT id
2778
-                    FROM ' . prefixTable('items') . '
2778
+                    FROM ' . prefixTable('items').'
2779 2779
                     WHERE id_tree IN %ls',
2780 2780
                     $_SESSION['personal_folders']
2781 2781
                 );
@@ -2853,7 +2853,7 @@  discard block
 block discarded – undo
2853 2853
             // Check if user already exists
2854 2854
             DB::query(
2855 2855
                 'SELECT id
2856
-                FROM ' . prefixTable('users') . '
2856
+                FROM ' . prefixTable('users').'
2857 2857
                 WHERE id = %i',
2858 2858
                 $post_id
2859 2859
             );
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
 
2908 2908
     // Get info about user
2909 2909
     $data_user = DB::queryfirstrow(
2910
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2910
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2911 2911
         WHERE id = %i',
2912 2912
         $value[1]
2913 2913
     );
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
             logEvents(
2941 2941
                 $SETTINGS,
2942 2942
                 'user_mngt',
2943
-                'at_user_new_' . $value[0] . ':' . $value[1],
2943
+                'at_user_new_'.$value[0].':'.$value[1],
2944 2944
                 $_SESSION['user_id'],
2945 2945
                 $_SESSION['login'],
2946 2946
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
     // Get info about user
2974 2974
     $data_user = DB::queryfirstrow(
2975
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2975
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2976 2976
         WHERE id = %i',
2977 2977
         $value[1]
2978 2978
     );
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
121 121
 {
122
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
122
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
123 123
     $err = false;
124 124
     // load PhpEncryption library
125 125
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
126 126
         $path = '../includes/libraries/Encryption/Encryption/';
127 127
     } else {
128
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
129
-    }
130
-
131
-    include_once $path . 'Crypto.php';
132
-    include_once $path . 'Encoding.php';
133
-    include_once $path . 'DerivedKeys.php';
134
-    include_once $path . 'Key.php';
135
-    include_once $path . 'KeyOrPassword.php';
136
-    include_once $path . 'File.php';
137
-    include_once $path . 'RuntimeTests.php';
138
-    include_once $path . 'KeyProtectedByPassword.php';
139
-    include_once $path . 'Core.php';
128
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
129
+    }
130
+
131
+    include_once $path.'Crypto.php';
132
+    include_once $path.'Encoding.php';
133
+    include_once $path.'DerivedKeys.php';
134
+    include_once $path.'Key.php';
135
+    include_once $path.'KeyOrPassword.php';
136
+    include_once $path.'File.php';
137
+    include_once $path.'RuntimeTests.php';
138
+    include_once $path.'KeyProtectedByPassword.php';
139
+    include_once $path.'Core.php';
140 140
     // convert KEY
141 141
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
142 142
     try {
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
         $path = '../includes/libraries/Encryption/Encryption/';
181 181
     }
182 182
 
183
-    include_once $path . 'Crypto.php';
184
-    include_once $path . 'Encoding.php';
185
-    include_once $path . 'DerivedKeys.php';
186
-    include_once $path . 'Key.php';
187
-    include_once $path . 'KeyOrPassword.php';
188
-    include_once $path . 'File.php';
189
-    include_once $path . 'RuntimeTests.php';
190
-    include_once $path . 'KeyProtectedByPassword.php';
191
-    include_once $path . 'Core.php';
183
+    include_once $path.'Crypto.php';
184
+    include_once $path.'Encoding.php';
185
+    include_once $path.'DerivedKeys.php';
186
+    include_once $path.'Key.php';
187
+    include_once $path.'KeyOrPassword.php';
188
+    include_once $path.'File.php';
189
+    include_once $path.'RuntimeTests.php';
190
+    include_once $path.'KeyProtectedByPassword.php';
191
+    include_once $path.'Core.php';
192 192
     $key = \Defuse\Crypto\Key::createNewRandomKey();
193 193
     $key = $key->saveToAsciiSafeString();
194 194
     return $key;
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
         $path = '../includes/libraries/Encryption/Encryption/';
211 211
     }
212 212
 
213
-    include_once $path . 'Crypto.php';
214
-    include_once $path . 'Encoding.php';
215
-    include_once $path . 'DerivedKeys.php';
216
-    include_once $path . 'Key.php';
217
-    include_once $path . 'KeyOrPassword.php';
218
-    include_once $path . 'File.php';
219
-    include_once $path . 'RuntimeTests.php';
220
-    include_once $path . 'KeyProtectedByPassword.php';
221
-    include_once $path . 'Core.php';
213
+    include_once $path.'Crypto.php';
214
+    include_once $path.'Encoding.php';
215
+    include_once $path.'DerivedKeys.php';
216
+    include_once $path.'Key.php';
217
+    include_once $path.'KeyOrPassword.php';
218
+    include_once $path.'File.php';
219
+    include_once $path.'RuntimeTests.php';
220
+    include_once $path.'KeyProtectedByPassword.php';
221
+    include_once $path.'Core.php';
222 222
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
223 223
     return $protected_key->saveToAsciiSafeString(); // save this in user table
224 224
 }
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
         $path = '../includes/libraries/Encryption/Encryption/';
241 241
     }
242 242
 
243
-    include_once $path . 'Crypto.php';
244
-    include_once $path . 'Encoding.php';
245
-    include_once $path . 'DerivedKeys.php';
246
-    include_once $path . 'Key.php';
247
-    include_once $path . 'KeyOrPassword.php';
248
-    include_once $path . 'File.php';
249
-    include_once $path . 'RuntimeTests.php';
250
-    include_once $path . 'KeyProtectedByPassword.php';
251
-    include_once $path . 'Core.php';
243
+    include_once $path.'Crypto.php';
244
+    include_once $path.'Encoding.php';
245
+    include_once $path.'DerivedKeys.php';
246
+    include_once $path.'Key.php';
247
+    include_once $path.'KeyOrPassword.php';
248
+    include_once $path.'File.php';
249
+    include_once $path.'RuntimeTests.php';
250
+    include_once $path.'KeyProtectedByPassword.php';
251
+    include_once $path.'Core.php';
252 252
     try {
253 253
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
254 254
         $user_key = $protected_key->unlockKey($psk);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function trimElement($chaine, string $element): string
289 289
 {
290
-    if (! empty($chaine)) {
290
+    if (!empty($chaine)) {
291 291
         if (is_array($chaine) === true) {
292 292
             $chaine = implode(';', $chaine);
293 293
         }
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
  */
334 334
 function db_error_handler(array $params): void
335 335
 {
336
-    echo 'Error: ' . $params['error'] . "<br>\n";
337
-    echo 'Query: ' . $params['query'] . "<br>\n";
336
+    echo 'Error: '.$params['error']."<br>\n";
337
+    echo 'Query: '.$params['query']."<br>\n";
338 338
     throw new Exception('Error - Query', 1);
339 339
 }
340 340
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
     $SETTINGS
357 357
 ) {
358 358
     //load ClassLoader
359
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
359
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
360 360
     // Load superglobal
361
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
361
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
362 362
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
363 363
     //Connect to DB
364
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
364
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
365 365
     if (defined('DB_PASSWD_CLEAR') === false) {
366 366
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
367 367
     }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     DB::$port = DB_PORT;
373 373
     DB::$encoding = DB_ENCODING;
374 374
     //Build tree
375
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
375
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
376 376
     $tree->register();
377 377
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
378 378
     // Check if user is ADMINISTRATOR
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 function identAdmin($idFonctions, $SETTINGS, $tree)
416 416
 {
417 417
     // Load superglobal
418
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
418
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
419 419
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
420 420
     // Init
421 421
     $groupesVisibles = [];
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
435 435
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
436 436
     // Get list of Folders
437
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
437
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
438 438
     foreach ($rows as $record) {
439 439
         array_push($groupesVisibles, $record['id']);
440 440
     }
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     }
454 454
     // Get ID of personal folder
455 455
     $persfld = DB::queryfirstrow(
456
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
456
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
457 457
         $globalsUserId
458 458
     );
459 459
     if (empty($persfld['id']) === false) {
@@ -474,20 +474,20 @@  discard block
 block discarded – undo
474 474
     // get complete list of ROLES
475 475
     $tmp = explode(';', $idFonctions);
476 476
     $rows = DB::query(
477
-        'SELECT * FROM ' . prefixTable('roles_title') . '
477
+        'SELECT * FROM '.prefixTable('roles_title').'
478 478
         ORDER BY title ASC'
479 479
     );
480 480
     foreach ($rows as $record) {
481
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
481
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
482 482
             array_push($tmp, $record['id']);
483 483
         }
484 484
     }
485 485
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
486 486
     $superGlobal->put('is_admin', 1, 'SESSION');
487 487
     // Check if admin has created Folders and Roles
488
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
488
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
489 489
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
490
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
490
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
491 491
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
492 492
 }
493 493
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
     object $tree
530 530
 ) {
531 531
     // Load superglobal
532
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
532
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
533 533
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
534 534
     // Init
535 535
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     // Get list of folders depending on Roles
558 558
     $rows = DB::query(
559 559
         'SELECT *
560
-        FROM ' . prefixTable('roles_values') . '
560
+        FROM ' . prefixTable('roles_values').'
561 561
         WHERE role_id IN %li AND type IN %ls',
562 562
         $userRoles,
563 563
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
     // Does this user is allowed to see other items
583 583
     $inc = 0;
584 584
     $rows = DB::query(
585
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
585
+        'SELECT id, id_tree FROM '.prefixTable('items').'
586 586
             WHERE restricted_to LIKE %ss AND inactif = %s',
587
-        $globalsUserId . ';',
587
+        $globalsUserId.';',
588 588
         '0'
589 589
     );
590 590
     foreach ($rows as $record) {
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
     // Check for the users roles if some specific rights exist on items
599 599
     $rows = DB::query(
600 600
         'SELECT i.id_tree, r.item_id
601
-        FROM ' . prefixTable('items') . ' as i
602
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
601
+        FROM ' . prefixTable('items').' as i
602
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
603 603
         WHERE r.role_id IN %li
604 604
         ORDER BY i.id_tree ASC',
605 605
         $userRoles
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
     ) {
621 621
         $persoFld = DB::queryfirstrow(
622 622
             'SELECT id
623
-            FROM ' . prefixTable('nested_tree') . '
623
+            FROM ' . prefixTable('nested_tree').'
624 624
             WHERE title = %s AND personal_folder = %i',
625 625
             $globalsUserId,
626 626
             1
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     }
654 654
     $persoFlds = DB::query(
655 655
         'SELECT id
656
-        FROM ' . prefixTable('nested_tree') . '
656
+        FROM ' . prefixTable('nested_tree').'
657 657
         WHERE %l',
658 658
         $where
659 659
     );
@@ -694,16 +694,16 @@  discard block
 block discarded – undo
694 694
         'SESSION'
695 695
     );
696 696
     // Folders and Roles numbers
697
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
697
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
698 698
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
699
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
699
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
700 700
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
701 701
     // check if change proposals on User's items
702 702
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
703 703
         DB::query(
704 704
             'SELECT *
705
-            FROM ' . prefixTable('items_change') . ' AS c
706
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
705
+            FROM ' . prefixTable('items_change').' AS c
706
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
707 707
             WHERE i.action = %s AND i.id_user = %i',
708 708
             'at_creation',
709 709
             $globalsUserId
@@ -747,9 +747,9 @@  discard block
 block discarded – undo
747 747
  */
748 748
 function cacheTableRefresh(array $SETTINGS): void
749 749
 {
750
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
750
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
751 751
     //Connect to DB
752
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
752
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
753 753
     if (defined('DB_PASSWD_CLEAR') === false) {
754 754
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
755 755
     }
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
     $tree->register();
765 765
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
766 766
     // truncate table
767
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
767
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
768 768
     // reload date
769 769
     $rows = DB::query(
770 770
         'SELECT *
771
-        FROM ' . prefixTable('items') . ' as i
772
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
771
+        FROM ' . prefixTable('items').' as i
772
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
773 773
         AND l.action = %s
774 774
         AND i.inactif = %i',
775 775
         'at_creation',
@@ -781,18 +781,18 @@  discard block
 block discarded – undo
781 781
             $tags = '';
782 782
             $itemTags = DB::query(
783 783
                 'SELECT tag
784
-                            FROM ' . prefixTable('tags') . '
784
+                            FROM ' . prefixTable('tags').'
785 785
                             WHERE item_id = %i AND tag != ""',
786 786
                 $record['id']
787 787
             );
788 788
             foreach ($itemTags as $itemTag) {
789
-                $tags .= $itemTag['tag'] . ' ';
789
+                $tags .= $itemTag['tag'].' ';
790 790
             }
791 791
 
792 792
             // Get renewal period
793 793
             $resNT = DB::queryfirstrow(
794 794
                 'SELECT renewal_period
795
-                FROM ' . prefixTable('nested_tree') . '
795
+                FROM ' . prefixTable('nested_tree').'
796 796
                 WHERE id = %i',
797 797
                 $record['id_tree']
798 798
             );
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
                     // Is this a User id?
806 806
                     $user = DB::queryfirstrow(
807 807
                         'SELECT id, login
808
-                        FROM ' . prefixTable('users') . '
808
+                        FROM ' . prefixTable('users').'
809 809
                         WHERE id = %i',
810 810
                         $elem->title
811 811
                     );
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
                     'id' => $record['id'],
824 824
                     'label' => $record['label'],
825 825
                     'description' => $record['description'] ?? '',
826
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
826
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
827 827
                     'tags' => $tags,
828 828
                     'id_tree' => $record['id_tree'],
829 829
                     'perso' => $record['perso'],
830
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
830
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
831 831
                     'login' => $record['login'] ?? '',
832 832
                     'folder' => implode(' > ', $folder),
833 833
                     'author' => $record['id_user'],
@@ -847,12 +847,12 @@  discard block
 block discarded – undo
847 847
  */
848 848
 function cacheTableUpdate(array $SETTINGS, ?string $ident = null): void
849 849
 {
850
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
850
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
851 851
     // Load superglobal
852
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
852
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
853 853
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
854 854
     //Connect to DB
855
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
855
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
856 856
     if (defined('DB_PASSWD_CLEAR') === false) {
857 857
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
858 858
     }
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
     // get new value from db
870 870
     $data = DB::queryfirstrow(
871 871
         'SELECT label, description, id_tree, perso, restricted_to, login, url
872
-        FROM ' . prefixTable('items') . '
872
+        FROM ' . prefixTable('items').'
873 873
         WHERE id=%i',
874 874
         $ident
875 875
     );
@@ -877,12 +877,12 @@  discard block
 block discarded – undo
877 877
     $tags = '';
878 878
     $itemTags = DB::query(
879 879
         'SELECT tag
880
-            FROM ' . prefixTable('tags') . '
880
+            FROM ' . prefixTable('tags').'
881 881
             WHERE item_id = %i AND tag != ""',
882 882
         $ident
883 883
     );
884 884
     foreach ($itemTags as $itemTag) {
885
-        $tags .= $itemTag['tag'] . ' ';
885
+        $tags .= $itemTag['tag'].' ';
886 886
     }
887 887
     // form id_tree to full foldername
888 888
     $folder = [];
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
             // Is this a User id?
894 894
             $user = DB::queryfirstrow(
895 895
                 'SELECT id, login
896
-                FROM ' . prefixTable('users') . '
896
+                FROM ' . prefixTable('users').'
897 897
                 WHERE id = %i',
898 898
                 $elem->title
899 899
             );
@@ -911,10 +911,10 @@  discard block
 block discarded – undo
911 911
             'label' => $data['label'],
912 912
             'description' => $data['description'],
913 913
             'tags' => $tags,
914
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
914
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
915 915
             'id_tree' => $data['id_tree'],
916 916
             'perso' => $data['perso'],
917
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
917
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
918 918
             'login' => $data['login'] ?? '',
919 919
             'folder' => implode(' » ', $folder),
920 920
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -932,14 +932,14 @@  discard block
 block discarded – undo
932 932
  */
933 933
 function cacheTableAdd(array $SETTINGS, ?string $ident = null): void
934 934
 {
935
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
935
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
936 936
     // Load superglobal
937
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
937
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
938 938
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
939 939
     // Get superglobals
940 940
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
941 941
     //Connect to DB
942
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
942
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
943 943
     if (defined('DB_PASSWD_CLEAR') === false) {
944 944
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
945 945
     }
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
     // get new value from db
957 957
     $data = DB::queryFirstRow(
958 958
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
959
-        FROM ' . prefixTable('items') . ' as i
960
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
959
+        FROM ' . prefixTable('items').' as i
960
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
961 961
         WHERE i.id = %i
962 962
         AND l.action = %s',
963 963
         $ident,
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
     $tags = '';
968 968
     $itemTags = DB::query(
969 969
         'SELECT tag
970
-            FROM ' . prefixTable('tags') . '
970
+            FROM ' . prefixTable('tags').'
971 971
             WHERE item_id = %i AND tag != ""',
972 972
         $ident
973 973
     );
974 974
     foreach ($itemTags as $itemTag) {
975
-        $tags .= $itemTag['tag'] . ' ';
975
+        $tags .= $itemTag['tag'].' ';
976 976
     }
977 977
     // form id_tree to full foldername
978 978
     $folder = [];
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
             // Is this a User id?
984 984
             $user = DB::queryfirstrow(
985 985
                 'SELECT id, login
986
-                FROM ' . prefixTable('users') . '
986
+                FROM ' . prefixTable('users').'
987 987
                 WHERE id = %i',
988 988
                 $elem->title
989 989
             );
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
             'label' => $data['label'],
1003 1003
             'description' => $data['description'],
1004 1004
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1005
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1005
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1006 1006
             'id_tree' => $data['id_tree'],
1007 1007
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1008 1008
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1024,52 +1024,52 @@  discard block
 block discarded – undo
1024 1024
 function getStatisticsData(array $SETTINGS): array
1025 1025
 {
1026 1026
     DB::query(
1027
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1027
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1028 1028
         0
1029 1029
     );
1030 1030
     $counter_folders = DB::count();
1031 1031
     DB::query(
1032
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1032
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1033 1033
         1
1034 1034
     );
1035 1035
     $counter_folders_perso = DB::count();
1036 1036
     DB::query(
1037
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1037
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1038 1038
         0
1039 1039
     );
1040 1040
     $counter_items = DB::count();
1041 1041
         DB::query(
1042
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1042
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1043 1043
         1
1044 1044
     );
1045 1045
     $counter_items_perso = DB::count();
1046 1046
         DB::query(
1047
-        'SELECT id FROM ' . prefixTable('users') . ''
1047
+        'SELECT id FROM '.prefixTable('users').''
1048 1048
     );
1049 1049
     $counter_users = DB::count();
1050 1050
         DB::query(
1051
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1051
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1052 1052
         1
1053 1053
     );
1054 1054
     $admins = DB::count();
1055 1055
     DB::query(
1056
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1056
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1057 1057
         1
1058 1058
     );
1059 1059
     $managers = DB::count();
1060 1060
     DB::query(
1061
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1061
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1062 1062
         1
1063 1063
     );
1064 1064
     $readOnly = DB::count();
1065 1065
     // list the languages
1066 1066
     $usedLang = [];
1067 1067
     $tp_languages = DB::query(
1068
-        'SELECT name FROM ' . prefixTable('languages')
1068
+        'SELECT name FROM '.prefixTable('languages')
1069 1069
     );
1070 1070
     foreach ($tp_languages as $tp_language) {
1071 1071
         DB::query(
1072
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1072
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1073 1073
             $tp_language['name']
1074 1074
         );
1075 1075
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1078,12 +1078,12 @@  discard block
 block discarded – undo
1078 1078
     // get list of ips
1079 1079
     $usedIp = [];
1080 1080
     $tp_ips = DB::query(
1081
-        'SELECT user_ip FROM ' . prefixTable('users')
1081
+        'SELECT user_ip FROM '.prefixTable('users')
1082 1082
     );
1083 1083
     foreach ($tp_ips as $ip) {
1084 1084
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1085 1085
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1086
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1086
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1087 1087
             $usedIp[$ip['user_ip']] = 1;
1088 1088
         }
1089 1089
     }
@@ -1149,21 +1149,21 @@  discard block
 block discarded – undo
1149 1149
     }
1150 1150
 
1151 1151
     // Load settings
1152
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1152
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1153 1153
     // Load superglobal
1154
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1154
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1155 1155
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1156 1156
     // Get user language
1157
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1157
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1158 1158
     // Load library
1159
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1159
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1160 1160
     // load PHPMailer
1161 1161
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1162 1162
     $mail->register();
1163 1163
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1164 1164
     try {
1165 1165
         // send to user
1166
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1166
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1167 1167
         $mail->SMTPDebug = 0;
1168 1168
         //value 1 can be used to debug - 4 for debuging connections
1169 1169
         $mail->Port = $SETTINGS['email_port'];
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1256 1256
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1257 1257
         <br><div style="float:right;">' .
1258
-        $textMail .
1258
+        $textMail.
1259 1259
         '<br><br></td></tr></table>
1260 1260
     </td></tr></table>
1261 1261
     <br></body></html>';
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
  */
1267 1267
 function generateKey(): string
1268 1268
 {
1269
-    return substr(md5(rand() . rand()), 0, 15);
1269
+    return substr(md5(rand().rand()), 0, 15);
1270 1270
 }
1271 1271
 
1272 1272
 /**
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 {
1338 1338
     array_walk_recursive(
1339 1339
         $array,
1340
-        static function (&$item): void {
1340
+        static function(&$item): void {
1341 1341
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1342 1342
                 $item = utf8_encode($item);
1343 1343
             }
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
     }
1373 1373
 
1374 1374
     // Load superglobal
1375
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1375
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1376 1376
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1377 1377
     // Get superglobals
1378 1378
     if ($key !== null) {
@@ -1383,9 +1383,9 @@  discard block
 block discarded – undo
1383 1383
     }
1384 1384
 
1385 1385
     //load ClassLoader
1386
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1386
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1387 1387
     //Load AES
1388
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1388
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1389 1389
     $aes->register();
1390 1390
     if ($type === 'encode' && is_array($data) === true) {
1391 1391
         // Ensure UTF8 format
@@ -1472,8 +1472,8 @@  discard block
 block discarded – undo
1472 1472
  */
1473 1473
 function prefixTable(string $table): string
1474 1474
 {
1475
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1476
-    if (! empty($safeTable)) {
1475
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1476
+    if (!empty($safeTable)) {
1477 1477
         // sanitize string
1478 1478
         return $safeTable;
1479 1479
     }
@@ -1501,13 +1501,13 @@  discard block
 block discarded – undo
1501 1501
     bool $lowercase = false,
1502 1502
     array $SETTINGS = []
1503 1503
 ): string {
1504
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1505
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1504
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1505
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1506 1506
     $generator->register();
1507 1507
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1508 1508
     // Is PHP7 being used?
1509 1509
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1510
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1510
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1511 1511
         $php7generator->register();
1512 1512
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1513 1513
     }
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1538 1538
 {
1539 1539
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1540
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1540
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1541 1541
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1542 1542
     socket_close($sock);
1543 1543
 }
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
     }
1560 1560
 
1561 1561
     // include librairies & connect to DB
1562
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1562
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1563 1563
     if (defined('DB_PASSWD_CLEAR') === false) {
1564 1564
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1565 1565
     }
@@ -1583,14 +1583,14 @@  discard block
 block discarded – undo
1583 1583
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1584 1584
         if ($type === 'user_mngt') {
1585 1585
             send_syslog(
1586
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1586
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1587 1587
                 $SETTINGS['syslog_host'],
1588 1588
                 $SETTINGS['syslog_port'],
1589 1589
                 'teampass'
1590 1590
             );
1591 1591
         } else {
1592 1592
             send_syslog(
1593
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1593
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1594 1594
                 $SETTINGS['syslog_host'],
1595 1595
                 $SETTINGS['syslog_port'],
1596 1596
                 'teampass'
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
     ?string $encryption_type = null
1623 1623
 ): void {
1624 1624
     // include librairies & connect to DB
1625
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1625
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1626 1626
     if (defined('DB_PASSWD_CLEAR') === false) {
1627 1627
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1628 1628
     }
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
         if (empty($item_label) === true) {
1667 1667
             $dataItem = DB::queryfirstrow(
1668 1668
                 'SELECT id, id_tree, label
1669
-                FROM ' . prefixTable('items') . '
1669
+                FROM ' . prefixTable('items').'
1670 1670
                 WHERE id = %i',
1671 1671
                 $item_id
1672 1672
             );
@@ -1674,11 +1674,11 @@  discard block
 block discarded – undo
1674 1674
         }
1675 1675
 
1676 1676
         send_syslog(
1677
-            'action=' . str_replace('at_', '', $action) .
1678
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1679
-                ' itemno=' . $item_id .
1680
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1681
-                ' itemname="' . addslashes($item_label) . '"',
1677
+            'action='.str_replace('at_', '', $action).
1678
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1679
+                ' itemno='.$item_id.
1680
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1681
+                ' itemname="'.addslashes($item_label).'"',
1682 1682
             $SETTINGS['syslog_host'],
1683 1683
             $SETTINGS['syslog_port'],
1684 1684
             'teampass'
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         && $action === 'at_shown'
1705 1705
     ) {
1706 1706
         // Load superglobal
1707
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1707
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1708 1708
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1709 1709
         // Get superglobals
1710 1710
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
         // Get info about item
1714 1714
         $dataItem = DB::queryfirstrow(
1715 1715
             'SELECT id, id_tree, label
1716
-            FROM ' . prefixTable('items') . '
1716
+            FROM ' . prefixTable('items').'
1717 1717
             WHERE id = %i',
1718 1718
             $item_id
1719 1719
         );
@@ -1727,9 +1727,9 @@  discard block
 block discarded – undo
1727 1727
                 'body' => str_replace(
1728 1728
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1729 1729
                     [
1730
-                        addslashes($globalsName . ' ' . $globalsLastname),
1730
+                        addslashes($globalsName.' '.$globalsLastname),
1731 1731
                         addslashes($item_label),
1732
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1732
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1733 1733
                     ],
1734 1734
                     langHdl('email_on_open_notification_mail')
1735 1735
                 ),
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1752 1752
 {
1753 1753
     // Load superglobal
1754
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1754
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1755 1755
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1756 1756
     // Get superglobals
1757 1757
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1761,8 +1761,8 @@  discard block
 block discarded – undo
1761 1761
     $notification = DB::queryOneColumn(
1762 1762
         'email',
1763 1763
         'SELECT *
1764
-        FROM ' . prefixTable('notification') . ' AS n
1765
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1764
+        FROM ' . prefixTable('notification').' AS n
1765
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1766 1766
         WHERE n.item_id = %i AND n.user_id != %i',
1767 1767
         $item_id,
1768 1768
         $globalsUserId
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
         // Get list of changes
1774 1774
         $htmlChanges = '<ul>';
1775 1775
         foreach ($changes as $change) {
1776
-            $htmlChanges .= '<li>' . $change . '</li>';
1776
+            $htmlChanges .= '<li>'.$change.'</li>';
1777 1777
         }
1778 1778
         $htmlChanges .= '</ul>';
1779 1779
         // send email
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1805 1805
 {
1806 1806
     // Class loader
1807
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1807
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1808 1808
     //Load Tree
1809 1809
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1810 1810
     $tree->register();
@@ -1813,15 +1813,15 @@  discard block
 block discarded – undo
1813 1813
     $path = '';
1814 1814
     foreach ($arbo as $elem) {
1815 1815
         if (empty($path) === true) {
1816
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1816
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1817 1817
         } else {
1818
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1818
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1819 1819
         }
1820 1820
     }
1821 1821
 
1822 1822
     // Build text to show user
1823 1823
     if (empty($label) === false) {
1824
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1824
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1825 1825
     }
1826 1826
     return empty($path) === true ? '' : $path;
1827 1827
 }
@@ -1876,9 +1876,9 @@  discard block
 block discarded – undo
1876 1876
  */
1877 1877
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1878 1878
 {
1879
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1879
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1880 1880
     // include librairies & connect to DB
1881
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1881
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1882 1882
     if (defined('DB_PASSWD_CLEAR') === false) {
1883 1883
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1884 1884
     }
@@ -1891,8 +1891,8 @@  discard block
 block discarded – undo
1891 1891
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1892 1892
         // perform a copy
1893 1893
         if (file_exists($tp_config_file)) {
1894
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1895
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1894
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1895
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1896 1896
             }
1897 1897
         }
1898 1898
 
@@ -1902,11 +1902,11 @@  discard block
 block discarded – undo
1902 1902
         $data[1] = "global \$SETTINGS;\n";
1903 1903
         $data[2] = "\$SETTINGS = array (\n";
1904 1904
         $rows = DB::query(
1905
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1905
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1906 1906
             'admin'
1907 1907
         );
1908 1908
         foreach ($rows as $record) {
1909
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1909
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1910 1910
         }
1911 1911
         array_push($data, ");\n");
1912 1912
         $data = array_unique($data);
@@ -1920,15 +1920,15 @@  discard block
 block discarded – undo
1920 1920
                 break;
1921 1921
             }
1922 1922
 
1923
-            if (stristr($line, "'" . $field . "' => '")) {
1924
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1923
+            if (stristr($line, "'".$field."' => '")) {
1924
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1925 1925
                 $bFound = true;
1926 1926
                 break;
1927 1927
             }
1928 1928
             ++$inc;
1929 1929
         }
1930 1930
         if ($bFound === false) {
1931
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1931
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
1932 1932
         }
1933 1933
     }
1934 1934
 
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 {
1955 1955
     global $SETTINGS;
1956 1956
     /* LOAD CPASSMAN SETTINGS */
1957
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1957
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1958 1958
         $SETTINGS = [];
1959 1959
         $SETTINGS['duplicate_folder'] = 0;
1960 1960
         //by default, this is set to 0;
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
         //by default, this value is set to 5;
1965 1965
         $settings = [];
1966 1966
         $rows = DB::query(
1967
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1967
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1968 1968
             [
1969 1969
                 'type' => 'admin',
1970 1970
                 'type2' => 'settings',
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
     $source_cf = [];
1992 1992
     $rows = DB::QUERY(
1993 1993
         'SELECT id_category
1994
-            FROM ' . prefixTable('categories_folders') . '
1994
+            FROM ' . prefixTable('categories_folders').'
1995 1995
             WHERE id_folder = %i',
1996 1996
         $source_id
1997 1997
     );
@@ -2002,7 +2002,7 @@  discard block
 block discarded – undo
2002 2002
     $target_cf = [];
2003 2003
     $rows = DB::QUERY(
2004 2004
         'SELECT id_category
2005
-            FROM ' . prefixTable('categories_folders') . '
2005
+            FROM ' . prefixTable('categories_folders').'
2006 2006
             WHERE id_folder = %i',
2007 2007
         $target_id
2008 2008
     );
@@ -2037,9 +2037,9 @@  discard block
 block discarded – undo
2037 2037
     $password = null
2038 2038
 ) {
2039 2039
     // Load AntiXSS
2040
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2041
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2042
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2040
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2041
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2042
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2043 2043
     $antiXss = new voku\helper\AntiXSS();
2044 2044
     // Protect against bad inputs
2045 2045
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
     $target_file = $antiXss->xss_clean($target_file);
2052 2052
     if (empty($password) === true || is_null($password) === true) {
2053 2053
         // get KEY to define password
2054
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2054
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2055 2055
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2056 2056
     }
2057 2057
 
@@ -2096,15 +2096,15 @@  discard block
 block discarded – undo
2096 2096
 ) {
2097 2097
     // load PhpEncryption library
2098 2098
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2099
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2100
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2101
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2102
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2103
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2104
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2105
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2106
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2107
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2099
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2100
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2101
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2102
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2103
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2104
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2105
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2106
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2107
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2108 2108
     try {
2109 2109
         \Defuse\Crypto\File::encryptFileWithPassword(
2110 2110
             $source_file,
@@ -2141,15 +2141,15 @@  discard block
 block discarded – undo
2141 2141
 ) {
2142 2142
     // load PhpEncryption library
2143 2143
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2144
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2145
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2146
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2147
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2148
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2149
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2150
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2151
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2152
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2144
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2145
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2146
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2147
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2148
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2149
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2150
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2151
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2152
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2153 2153
     try {
2154 2154
         \Defuse\Crypto\File::decryptFileWithPassword(
2155 2155
             $source_file,
@@ -2194,9 +2194,9 @@  discard block
 block discarded – undo
2194 2194
 function fileDelete(string $file, array $SETTINGS): void
2195 2195
 {
2196 2196
     // Load AntiXSS
2197
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2198
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2199
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2197
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2198
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2199
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2200 2200
     $antiXss = new voku\helper\AntiXSS();
2201 2201
     $file = $antiXss->xss_clean($file);
2202 2202
     if (is_file($file)) {
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 
2241 2241
 function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) {
2242 2242
     // Check if the path exists
2243
-    if (! file_exists($path)) {
2243
+    if (!file_exists($path)) {
2244 2244
         return false;
2245 2245
     }
2246 2246
 
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
  */
2276 2276
 function accessToItemIsGranted(int $item_id, $SETTINGS)
2277 2277
 {
2278
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2278
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2279 2279
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2280 2280
     // Prepare superGlobal variables
2281 2281
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
     // Load item data
2284 2284
     $data = DB::queryFirstRow(
2285 2285
         'SELECT id_tree
2286
-        FROM ' . prefixTable('items') . '
2286
+        FROM ' . prefixTable('items').'
2287 2287
         WHERE id = %i',
2288 2288
         $item_id
2289 2289
     );
@@ -2356,8 +2356,8 @@  discard block
 block discarded – undo
2356 2356
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2357 2357
 {
2358 2358
     // include librairies & connect to DB
2359
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2360
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2359
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2360
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2361 2361
     if (defined('DB_PASSWD_CLEAR') === false) {
2362 2362
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2363 2363
     }
@@ -2369,7 +2369,7 @@  discard block
 block discarded – undo
2369 2369
     DB::$encoding = DB_ENCODING;
2370 2370
     // Insert log in DB
2371 2371
     return DB::query(
2372
-        'SELECT ' . $fields . '
2372
+        'SELECT '.$fields.'
2373 2373
         FROM ' . prefixTable($table)
2374 2374
     );
2375 2375
 }
@@ -2382,11 +2382,11 @@  discard block
 block discarded – undo
2382 2382
 function formatSizeUnits(int $bytes): string
2383 2383
 {
2384 2384
     if ($bytes >= 1073741824) {
2385
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2385
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2386 2386
     } elseif ($bytes >= 1048576) {
2387
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2387
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2388 2388
     } elseif ($bytes >= 1024) {
2389
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2389
+        $bytes = number_format($bytes / 1024, 2).' KB';
2390 2390
     } elseif ($bytes > 1) {
2391 2391
         $bytes .= ' bytes';
2392 2392
     } elseif ($bytes === 1) {
@@ -2577,14 +2577,14 @@  discard block
 block discarded – undo
2577 2577
 
2578 2578
     // Encrypt the file content
2579 2579
     $plaintext = file_get_contents(
2580
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2580
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2581 2581
     );
2582 2582
     $ciphertext = $cipher->encrypt($plaintext);
2583 2583
     // Save new file
2584 2584
     $hash = md5($plaintext);
2585
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2585
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2586 2586
     file_put_contents($fileOut, $ciphertext);
2587
-    unlink($fileInPath . '/' . $fileInName);
2587
+    unlink($fileInPath.'/'.$fileInName);
2588 2588
     return [
2589 2589
         'fileHash' => base64_encode($hash),
2590 2590
         'objectKey' => base64_encode($objectKey),
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
  */
2601 2601
 function decryptFile(string $fileName, string $filePath, string $key): string
2602 2602
 {
2603
-    if (! defined('FILE_BUFFER_SIZE')) {
2603
+    if (!defined('FILE_BUFFER_SIZE')) {
2604 2604
         define('FILE_BUFFER_SIZE', 128 * 1024);
2605 2605
     }
2606 2606
 
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
     $cipher->enableContinuousBuffer();
2620 2620
     $cipher->disablePadding();
2621 2621
     // Get file content
2622
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2622
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2623 2623
     // Decrypt file content and return
2624 2624
     return base64_encode($cipher->decrypt($ciphertext));
2625 2625
 }
@@ -2669,8 +2669,8 @@  discard block
 block discarded – undo
2669 2669
     array $SETTINGS
2670 2670
 ): void {
2671 2671
     // include librairies & connect to DB
2672
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2673
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2672
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2673
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2674 2674
     if (defined('DB_PASSWD_CLEAR') === false) {
2675 2675
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2676 2676
     }
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
         $post_object_id
2688 2688
     );
2689 2689
     // Superglobals
2690
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2690
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2691 2691
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2692 2692
     // Prepare superGlobal variables
2693 2693
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2712,8 +2712,8 @@  discard block
 block discarded – undo
2712 2712
         // Create sharekey for each user
2713 2713
         $users = DB::query(
2714 2714
             'SELECT id, public_key
2715
-            FROM ' . prefixTable('users') . '
2716
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2715
+            FROM ' . prefixTable('users').'
2716
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2717 2717
             AND public_key != ""'
2718 2718
         );
2719 2719
         foreach ($users as $user) {
@@ -2741,7 +2741,7 @@  discard block
 block discarded – undo
2741 2741
 function isBase64(string $str): bool
2742 2742
 {
2743 2743
     $str = (string) trim($str);
2744
-    if (! isset($str[0])) {
2744
+    if (!isset($str[0])) {
2745 2745
         return false;
2746 2746
     }
2747 2747
 
@@ -2809,13 +2809,13 @@  discard block
 block discarded – undo
2809 2809
         ],
2810 2810
     ];
2811 2811
     // Load expected libraries
2812
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2813
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2814
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2815
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2816
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2817
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2818
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2812
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2813
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2814
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2815
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2816
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2817
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2818
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2819 2819
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2820 2820
     $ad->register();
2821 2821
     $connection = new Connection($config);
@@ -2824,7 +2824,7 @@  discard block
 block discarded – undo
2824 2824
         $connection->connect();
2825 2825
     } catch (\LdapRecord\Auth\BindException $e) {
2826 2826
         $error = $e->getDetailedError();
2827
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2827
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2828 2828
         return false;
2829 2829
     }
2830 2830
 
@@ -2833,7 +2833,7 @@  discard block
 block discarded – undo
2833 2833
         $connection->auth()->attempt($SETTINGS['ldap_user_attribute'].'='.$login.','.$SETTINGS['ldap_bdn'], $password, $stayAuthenticated = true);
2834 2834
     } catch (\LdapRecord\Auth\BindException $e) {
2835 2835
         $error = $e->getDetailedError();
2836
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2836
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2837 2837
         return false;
2838 2838
     }
2839 2839
 
@@ -2851,8 +2851,8 @@  discard block
 block discarded – undo
2851 2851
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2852 2852
 {
2853 2853
     // include librairies & connect to DB
2854
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2855
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2854
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2855
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2856 2856
     if (defined('DB_PASSWD_CLEAR') === false) {
2857 2857
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2858 2858
     }
@@ -2910,7 +2910,7 @@  discard block
 block discarded – undo
2910 2910
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2911 2911
             $now->setTimezone(new DateTimeZone($timezone));
2912 2912
             $offsets[] = $offset = $now->getOffset();
2913
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2913
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2914 2914
         }
2915 2915
 
2916 2916
         array_multisort($offsets, $timezones);
@@ -2930,7 +2930,7 @@  discard block
 block discarded – undo
2930 2930
 {
2931 2931
     $hours = intval($offset / 3600);
2932 2932
     $minutes = abs(intval($offset % 3600 / 60));
2933
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2933
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2934 2934
 }
2935 2935
 
2936 2936
 /**
Please login to merge, or discard this patch.