Passed
Push — teampass_3.0 ( 04f12b...91b93f )
by Nils
05:44
created
sources/find.queries.php 1 patch
Spacing   +46 added lines, -46 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,17 +42,17 @@  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'], 'items', $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';
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 if (isset($_SESSION['groupes_visibles']) === false
61 61
     || empty($_SESSION['groupes_visibles']) === true
62 62
 ) {
63
-    echo '{"sEcho": ' . intval($_GET['sEcho']) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
63
+    echo '{"sEcho": '.intval($_GET['sEcho']).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
64 64
     exit;
65 65
 }
66 66
 
67 67
 //Connect to DB
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
69 69
 if (defined('DB_PASSWD_CLEAR') === false) {
70 70
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
71 71
 }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     $folders = $_SESSION['groupes_visibles'];
90 90
 } else {
91 91
     // Build tree
92
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
92
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
93 93
     $tree->register();
94 94
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
95 95
     $folders = $tree->getDescendants(filter_var($_GET['limited'], FILTER_SANITIZE_NUMBER_INT), true);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 //Get current user "personal folder" ID
100 100
 $row = DB::query(
101
-    'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i',
101
+    'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i',
102 102
     intval($_SESSION['user_id'])
103 103
 );
104 104
 //get list of personal folders
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 $listPf = '';
108 108
 if (empty($row['id']) === false) {
109 109
     $rows = DB::query(
110
-        'SELECT id FROM ' . prefixTable('nested_tree') . '
110
+        'SELECT id FROM '.prefixTable('nested_tree').'
111 111
         WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i',
112 112
         filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT),
113 113
         filter_var($_SESSION['user_id'], FILTER_SANITIZE_NUMBER_INT)
114 114
     );
115 115
     foreach ($rows as $record) {
116
-        if (! in_array($record['id'], $arrayPf)) {
116
+        if (!in_array($record['id'], $arrayPf)) {
117 117
             //build an array of personal folders ids
118 118
             array_push($arrayPf, $record['id']);
119 119
             //build also a string with those ids
120 120
             if (empty($listPf)) {
121 121
                 $listPf = $record['id'];
122 122
             } else {
123
-                $listPf .= ', ' . $record['id'];
123
+                $listPf .= ', '.$record['id'];
124 124
             }
125 125
         }
126 126
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 //Paging
131 131
 $sLimit = '';
132 132
 if (isset($_GET['start']) === true && $_GET['length'] !== '-1') {
133
-    $sLimit = 'LIMIT ' . filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT) . ', ' . filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT) . '';
133
+    $sLimit = 'LIMIT '.filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT).', '.filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT).'';
134 134
 }
135 135
 
136 136
 //Ordering
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
     }
144 144
     $sOrder = 'ORDER BY  ';
145 145
     if ($_GET['order'][0]['column'] >= 0) {
146
-        $sOrder .= '' . $aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
147
-                . filter_var($_GET['order'][0]['dir'], FILTER_SANITIZE_STRING) . ', ';
146
+        $sOrder .= ''.$aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
147
+                . filter_var($_GET['order'][0]['dir'], FILTER_SANITIZE_STRING).', ';
148 148
     }
149 149
 
150 150
     $sOrder = substr_replace($sOrder, '', -2);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $sOrder = '';
153 153
     }
154 154
 } else {
155
-    $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC';
155
+    $sOrder = 'ORDER BY '.$aColumns[1].' ASC';
156 156
 }
157 157
 
158 158
 // Define criteria
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 if (empty($search_criteria) === false) {
175 175
     $sWhere .= ' AND (';
176 176
     for ($i = 0; $i < count($aColumns); ++$i) {
177
-        $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR ';
177
+        $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR ';
178 178
     }
179
-    $sWhere = substr_replace((string) $sWhere, '', -3) . ') ';
179
+    $sWhere = substr_replace((string) $sWhere, '', -3).') ';
180 180
     $crit = [
181 181
         'idtree' => array_unique($folders),
182 182
         '0' => $search_criteria,
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
     if (empty($sWhere) === false) {
215 215
         $sWhere .= ' AND ';
216 216
     }
217
-    $sWhere = 'WHERE ' . $sWhere . 'id_tree NOT IN %ls_pf ';
217
+    $sWhere = 'WHERE '.$sWhere.'id_tree NOT IN %ls_pf ';
218 218
 } else {
219
-    $sWhere = 'WHERE ' . $sWhere;
219
+    $sWhere = 'WHERE '.$sWhere;
220 220
 }
221 221
 
222 222
 DB::query(
223
-    'SELECT id FROM ' . prefixTable('cache') . "
223
+    'SELECT id FROM '.prefixTable('cache')."
224 224
     ${sWhere}
225 225
     ${sOrder}",
226 226
     $crit
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 $iTotal = DB::count();
229 229
 $rows = DB::query(
230 230
     'SELECT id, label, description, tags, id_tree, perso, restricted_to, login, folder, author, renewal_period, url, timestamp
231
-    FROM ' . prefixTable('cache') . "
231
+    FROM ' . prefixTable('cache')."
232 232
     ${sWhere}
233 233
     ${sOrder}
234 234
     ${sLimit}",
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 if (isset($_GET['type']) === false) {
242 242
     $sOutput = '{';
243 243
     if (isset($_GET['draw']) === true) {
244
-        $sOutput .= '"draw": ' . intval($_GET['draw']) . ', ';
244
+        $sOutput .= '"draw": '.intval($_GET['draw']).', ';
245 245
     }
246 246
     $sOutput .= '"data": [';
247 247
     $sOutputConst = '';
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             $arrTmp = [];
258 258
             foreach (explode(';', $_SESSION['fonction_id']) as $role) {
259 259
                 $access = DB::queryFirstRow(
260
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
260
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
261 261
                     $role,
262 262
                     $record['id_tree']
263 263
                 );
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             }
276 276
             $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel;
277 277
             if ($accessLevel === 0) {
278
-                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">';
278
+                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">';
279 279
             }
280 280
 
281 281
             if ((int) $accessLevel === 0) {
@@ -315,22 +315,22 @@  discard block
 block discarded – undo
315 315
             if (empty($restrictedTo)) {
316 316
                 $restrictedTo = $_SESSION['user_id'];
317 317
             } else {
318
-                $restrictedTo .= ',' . $_SESSION['user_id'];
318
+                $restrictedTo .= ','.$_SESSION['user_id'];
319 319
             }
320 320
         }
321 321
 
322 322
         //col1
323
-        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . langHdl('open_url_link') . '\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group=' . $record['id_tree'] . '&amp;id=' . $record['id'] . '&#039;\" style=\"cursor:pointer;\"></i>' .
324
-            '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . langHdl('see_item_title') . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '", ';
323
+        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.langHdl('open_url_link').'\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group='.$record['id_tree'].'&amp;id='.$record['id'].'&#039;\" style=\"cursor:pointer;\"></i>'.
324
+            '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.langHdl('see_item_title').'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'", ';
325 325
         //col2
326
-        $sOutputItem .= '"<span id=\"item_label-' . $record['id'] . '\">' . stripslashes($record['label']) . '</span>", ';
326
+        $sOutputItem .= '"<span id=\"item_label-'.$record['id'].'\">'.stripslashes($record['label']).'</span>", ';
327 327
         //col3
328
-        $sOutputItem .= '"' . str_replace('&amp;', '&', htmlspecialchars(stripslashes($record['login']), ENT_QUOTES)) . '", ';
328
+        $sOutputItem .= '"'.str_replace('&amp;', '&', htmlspecialchars(stripslashes($record['login']), ENT_QUOTES)).'", ';
329 329
         //col4
330 330
         //get restriction from ROles
331 331
         $restrictedToRole = false;
332 332
         $rTmp = DB::queryFirstColumn(
333
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i',
333
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i',
334 334
             $record['id']
335 335
         );
336 336
         // We considere here that if user has at least one group similar to the object ones
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
         } else {
349 349
             $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description']));
350 350
             if (strlen($txt) > 50) {
351
-                $sOutputItem .= '"' . substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50) . '", ';
351
+                $sOutputItem .= '"'.substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50).'", ';
352 352
             } else {
353
-                $sOutputItem .= '"' . stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt)) . '", ';
353
+                $sOutputItem .= '"'.stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt)).'", ';
354 354
             }
355 355
         }
356 356
 
357 357
         //col5 - TAGS
358
-        $sOutputItem .= '"' . htmlspecialchars(stripslashes($record['tags']), ENT_QUOTES) . '", ';
358
+        $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['tags']), ENT_QUOTES).'", ';
359 359
         // col6 - URL
360 360
         if ($record['url'] !== '0') {
361 361
             $sOutputItem .= '"'.filter_var($record['url'], FILTER_SANITIZE_URL).'", ';
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         }
365 365
 
366 366
         //col7 - Prepare the Treegrid
367
-        $sOutputItem .= '"' . htmlspecialchars(stripslashes($record['folder']), ENT_QUOTES) . '"';
367
+        $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['folder']), ENT_QUOTES).'"';
368 368
         //Finish the line
369 369
         $sOutputItem .= '], ';
370 370
         if ($getItemInList === true) {
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
             --$iTotal;
374 374
         }
375 375
     }
376
-    if (! empty($sOutputConst)) {
376
+    if (!empty($sOutputConst)) {
377 377
         $sOutput .= substr_replace($sOutputConst, '', -2);
378 378
     }
379 379
     $sOutput .= '], ';
380
-    $sOutput .= '"recordsTotal": ' . $iTotal . ', ';
381
-    $sOutput .= '"recordsFiltered": ' . $iTotal . ' }';
380
+    $sOutput .= '"recordsTotal": '.$iTotal.', ';
381
+    $sOutput .= '"recordsFiltered": '.$iTotal.' }';
382 382
     echo $sOutput;
383 383
 } elseif (isset($_GET['type']) && ($_GET['type'] === 'search_for_items' || $_GET['type'] === 'search_for_items_with_tags')) {
384 384
     include_once 'main.functions.php';
385
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
385
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
386 386
     
387 387
     $arr_data = [];
388 388
     foreach ($rows as $record) {
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
         // Anyone can modify?
404 404
         $tmp = DB::queryfirstrow(
405
-            'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i',
405
+            'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i',
406 406
             $record['id']
407 407
         );
408 408
         if (count($tmp) > 0) {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles)
434 434
         $user_is_included_in_role = 0;
435 435
         $roles = DB::query(
436
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i',
436
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i',
437 437
             $record['id']
438 438
         );
439 439
         if (count($roles) > 0) {
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             if (empty($restrictedTo)) {
457 457
                 $restrictedTo = $_SESSION['user_id'];
458 458
             } else {
459
-                $restrictedTo .= ',' . $_SESSION['user_id'];
459
+                $restrictedTo .= ','.$_SESSION['user_id'];
460 460
             }
461 461
         }
462 462
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             $arrTmp = [];
555 555
             foreach (explode(';', $_SESSION['fonction_id']) as $role) {
556 556
                 $access = DB::queryFirstRow(
557
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
557
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
558 558
                     $role,
559 559
                     $record['id_tree']
560 560
                 );
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
         ) {
604 604
             $data_item = DB::queryFirstRow(
605 605
                 'SELECT i.pw AS pw, s.share_key AS share_key
606
-                FROM ' . prefixTable('items') . ' AS i
607
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
606
+                FROM ' . prefixTable('items').' AS i
607
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
608 608
                 WHERE i.id = %i AND s.user_id = %i',
609 609
                 $record['id'],
610 610
                 $_SESSION['user_id']
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
124 124
 {
125
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
125
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
126 126
     $err = false;
127 127
     // load PhpEncryption library
128 128
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
129 129
         $path = '../includes/libraries/Encryption/Encryption/';
130 130
     } else {
131
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132 132
     }
133 133
 
134 134
     // Check if class already exists
135 135
     if (!class_exists('Defuse\Crypto\Crypto', false)) {
136
-		include_once $path . 'Crypto.php';
137
-		include_once $path . 'Encoding.php';
138
-		include_once $path . 'DerivedKeys.php';
139
-		include_once $path . 'Key.php';
140
-		include_once $path . 'KeyOrPassword.php';
141
-		include_once $path . 'File.php';
142
-		include_once $path . 'RuntimeTests.php';
143
-		include_once $path . 'KeyProtectedByPassword.php';
144
-		include_once $path . 'Core.php';
136
+		include_once $path.'Crypto.php';
137
+		include_once $path.'Encoding.php';
138
+		include_once $path.'DerivedKeys.php';
139
+		include_once $path.'Key.php';
140
+		include_once $path.'KeyOrPassword.php';
141
+		include_once $path.'File.php';
142
+		include_once $path.'RuntimeTests.php';
143
+		include_once $path.'KeyProtectedByPassword.php';
144
+		include_once $path.'Core.php';
145 145
 	}
146 146
     
147 147
     // convert KEY
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
         $path = '../includes/libraries/Encryption/Encryption/';
188 188
     }
189 189
 
190
-    include_once $path . 'Crypto.php';
191
-    include_once $path . 'Encoding.php';
192
-    include_once $path . 'DerivedKeys.php';
193
-    include_once $path . 'Key.php';
194
-    include_once $path . 'KeyOrPassword.php';
195
-    include_once $path . 'File.php';
196
-    include_once $path . 'RuntimeTests.php';
197
-    include_once $path . 'KeyProtectedByPassword.php';
198
-    include_once $path . 'Core.php';
190
+    include_once $path.'Crypto.php';
191
+    include_once $path.'Encoding.php';
192
+    include_once $path.'DerivedKeys.php';
193
+    include_once $path.'Key.php';
194
+    include_once $path.'KeyOrPassword.php';
195
+    include_once $path.'File.php';
196
+    include_once $path.'RuntimeTests.php';
197
+    include_once $path.'KeyProtectedByPassword.php';
198
+    include_once $path.'Core.php';
199 199
     $key = \Defuse\Crypto\Key::createNewRandomKey();
200 200
     $key = $key->saveToAsciiSafeString();
201 201
     return $key;
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
         $path = '../includes/libraries/Encryption/Encryption/';
218 218
     }
219 219
 
220
-    include_once $path . 'Crypto.php';
221
-    include_once $path . 'Encoding.php';
222
-    include_once $path . 'DerivedKeys.php';
223
-    include_once $path . 'Key.php';
224
-    include_once $path . 'KeyOrPassword.php';
225
-    include_once $path . 'File.php';
226
-    include_once $path . 'RuntimeTests.php';
227
-    include_once $path . 'KeyProtectedByPassword.php';
228
-    include_once $path . 'Core.php';
220
+    include_once $path.'Crypto.php';
221
+    include_once $path.'Encoding.php';
222
+    include_once $path.'DerivedKeys.php';
223
+    include_once $path.'Key.php';
224
+    include_once $path.'KeyOrPassword.php';
225
+    include_once $path.'File.php';
226
+    include_once $path.'RuntimeTests.php';
227
+    include_once $path.'KeyProtectedByPassword.php';
228
+    include_once $path.'Core.php';
229 229
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
230 230
     return $protected_key->saveToAsciiSafeString(); // save this in user table
231 231
 }
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
         $path = '../includes/libraries/Encryption/Encryption/';
248 248
     }
249 249
 
250
-    include_once $path . 'Crypto.php';
251
-    include_once $path . 'Encoding.php';
252
-    include_once $path . 'DerivedKeys.php';
253
-    include_once $path . 'Key.php';
254
-    include_once $path . 'KeyOrPassword.php';
255
-    include_once $path . 'File.php';
256
-    include_once $path . 'RuntimeTests.php';
257
-    include_once $path . 'KeyProtectedByPassword.php';
258
-    include_once $path . 'Core.php';
250
+    include_once $path.'Crypto.php';
251
+    include_once $path.'Encoding.php';
252
+    include_once $path.'DerivedKeys.php';
253
+    include_once $path.'Key.php';
254
+    include_once $path.'KeyOrPassword.php';
255
+    include_once $path.'File.php';
256
+    include_once $path.'RuntimeTests.php';
257
+    include_once $path.'KeyProtectedByPassword.php';
258
+    include_once $path.'Core.php';
259 259
     try {
260 260
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
261 261
         $user_key = $protected_key->unlockKey($psk);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function trimElement($chaine, string $element): string
296 296
 {
297
-    if (! empty($chaine)) {
297
+    if (!empty($chaine)) {
298 298
         if (is_array($chaine) === true) {
299 299
             $chaine = implode(';', $chaine);
300 300
         }
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function db_error_handler(array $params): void
342 342
 {
343
-    echo 'Error: ' . $params['error'] . "<br>\n";
344
-    echo 'Query: ' . $params['query'] . "<br>\n";
343
+    echo 'Error: '.$params['error']."<br>\n";
344
+    echo 'Query: '.$params['query']."<br>\n";
345 345
     throw new Exception('Error - Query', 1);
346 346
 }
347 347
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
     $SETTINGS
364 364
 ) {
365 365
     //load ClassLoader
366
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
366
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
367 367
     // Load superglobal
368
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
368
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
369 369
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
370 370
     //Connect to DB
371
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
371
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
372 372
     if (defined('DB_PASSWD_CLEAR') === false) {
373 373
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
374 374
     }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     DB::$port = DB_PORT;
380 380
     DB::$encoding = DB_ENCODING;
381 381
     //Build tree
382
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
382
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
383 383
     $tree->register();
384 384
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
385 385
     // Check if user is ADMINISTRATOR
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 function identAdmin($idFonctions, $SETTINGS, $tree)
423 423
 {
424 424
     // Load superglobal
425
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
425
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
426 426
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
427 427
     // Init
428 428
     $groupesVisibles = [];
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
442 442
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
443 443
     // Get list of Folders
444
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
444
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
445 445
     foreach ($rows as $record) {
446 446
         array_push($groupesVisibles, $record['id']);
447 447
     }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     }
461 461
     // Get ID of personal folder
462 462
     $persfld = DB::queryfirstrow(
463
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
463
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
464 464
         $globalsUserId
465 465
     );
466 466
     if (empty($persfld['id']) === false) {
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
     // get complete list of ROLES
482 482
     $tmp = explode(';', $idFonctions);
483 483
     $rows = DB::query(
484
-        'SELECT * FROM ' . prefixTable('roles_title') . '
484
+        'SELECT * FROM '.prefixTable('roles_title').'
485 485
         ORDER BY title ASC'
486 486
     );
487 487
     foreach ($rows as $record) {
488
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
488
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
489 489
             array_push($tmp, $record['id']);
490 490
         }
491 491
     }
492 492
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
493 493
     $superGlobal->put('is_admin', 1, 'SESSION');
494 494
     // Check if admin has created Folders and Roles
495
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
495
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
496 496
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
497
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
497
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
498 498
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
499 499
 }
500 500
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     object $tree
537 537
 ) {
538 538
     // Load superglobal
539
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
539
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
540 540
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
541 541
     // Init
542 542
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     // Get list of folders depending on Roles
565 565
     $rows = DB::query(
566 566
         'SELECT *
567
-        FROM ' . prefixTable('roles_values') . '
567
+        FROM ' . prefixTable('roles_values').'
568 568
         WHERE role_id IN %li AND type IN %ls',
569 569
         $userRoles,
570 570
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
     // Does this user is allowed to see other items
590 590
     $inc = 0;
591 591
     $rows = DB::query(
592
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
592
+        'SELECT id, id_tree FROM '.prefixTable('items').'
593 593
             WHERE restricted_to LIKE %ss AND inactif = %s'.
594 594
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
595
-        $globalsUserId . ';',
595
+        $globalsUserId.';',
596 596
         '0'
597 597
     );
598 598
     foreach ($rows as $record) {
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
     // Check for the users roles if some specific rights exist on items
607 607
     $rows = DB::query(
608 608
         'SELECT i.id_tree, r.item_id
609
-        FROM ' . prefixTable('items') . ' as i
610
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
609
+        FROM ' . prefixTable('items').' as i
610
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
611 611
         WHERE r.role_id IN %li AND i.id_tree <> ""
612 612
         ORDER BY i.id_tree ASC',
613 613
         $userRoles
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     ) {
629 629
         $persoFld = DB::queryfirstrow(
630 630
             'SELECT id
631
-            FROM ' . prefixTable('nested_tree') . '
631
+            FROM ' . prefixTable('nested_tree').'
632 632
             WHERE title = %s AND personal_folder = %i'.
633 633
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
634 634
             $globalsUserId,
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     }
663 663
     $persoFlds = DB::query(
664 664
         'SELECT id
665
-        FROM ' . prefixTable('nested_tree') . '
665
+        FROM ' . prefixTable('nested_tree').'
666 666
         WHERE %l',
667 667
         $where
668 668
     );
@@ -703,16 +703,16 @@  discard block
 block discarded – undo
703 703
         'SESSION'
704 704
     );
705 705
     // Folders and Roles numbers
706
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
706
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
707 707
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
708
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
708
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
709 709
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
710 710
     // check if change proposals on User's items
711 711
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
712 712
         DB::query(
713 713
             'SELECT *
714
-            FROM ' . prefixTable('items_change') . ' AS c
715
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
714
+            FROM ' . prefixTable('items_change').' AS c
715
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
716 716
             WHERE i.action = %s AND i.id_user = %i',
717 717
             'at_creation',
718 718
             $globalsUserId
@@ -756,9 +756,9 @@  discard block
 block discarded – undo
756 756
  */
757 757
 function cacheTableRefresh(array $SETTINGS): void
758 758
 {
759
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
759
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
760 760
     //Connect to DB
761
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
761
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
762 762
     if (defined('DB_PASSWD_CLEAR') === false) {
763 763
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
764 764
     }
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
     $tree->register();
774 774
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
775 775
     // truncate table
776
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
776
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
777 777
     // reload date
778 778
     $rows = DB::query(
779 779
         'SELECT *
780
-        FROM ' . prefixTable('items') . ' as i
781
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
780
+        FROM ' . prefixTable('items').' as i
781
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
782 782
         AND l.action = %s
783 783
         AND i.inactif = %i',
784 784
         'at_creation',
@@ -790,18 +790,18 @@  discard block
 block discarded – undo
790 790
             $tags = '';
791 791
             $itemTags = DB::query(
792 792
                 'SELECT tag
793
-                            FROM ' . prefixTable('tags') . '
793
+                            FROM ' . prefixTable('tags').'
794 794
                             WHERE item_id = %i AND tag != ""',
795 795
                 $record['id']
796 796
             );
797 797
             foreach ($itemTags as $itemTag) {
798
-                $tags .= $itemTag['tag'] . ' ';
798
+                $tags .= $itemTag['tag'].' ';
799 799
             }
800 800
 
801 801
             // Get renewal period
802 802
             $resNT = DB::queryfirstrow(
803 803
                 'SELECT renewal_period
804
-                FROM ' . prefixTable('nested_tree') . '
804
+                FROM ' . prefixTable('nested_tree').'
805 805
                 WHERE id = %i',
806 806
                 $record['id_tree']
807 807
             );
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                     // Is this a User id?
815 815
                     $user = DB::queryfirstrow(
816 816
                         'SELECT id, login
817
-                        FROM ' . prefixTable('users') . '
817
+                        FROM ' . prefixTable('users').'
818 818
                         WHERE id = %i',
819 819
                         $elem->title
820 820
                     );
@@ -832,11 +832,11 @@  discard block
 block discarded – undo
832 832
                     'id' => $record['id'],
833 833
                     'label' => $record['label'],
834 834
                     'description' => $record['description'] ?? '',
835
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
835
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
836 836
                     'tags' => $tags,
837 837
                     'id_tree' => $record['id_tree'],
838 838
                     'perso' => $record['perso'],
839
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
839
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
840 840
                     'login' => $record['login'] ?? '',
841 841
                     'folder' => implode(' > ', $folder),
842 842
                     'author' => $record['id_user'],
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
  */
857 857
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
858 858
 {
859
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
859
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
860 860
     // Load superglobal
861
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
861
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
862 862
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
863 863
     //Connect to DB
864
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
864
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
865 865
     if (defined('DB_PASSWD_CLEAR') === false) {
866 866
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
867 867
     }
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
     // get new value from db
879 879
     $data = DB::queryfirstrow(
880 880
         'SELECT label, description, id_tree, perso, restricted_to, login, url
881
-        FROM ' . prefixTable('items') . '
881
+        FROM ' . prefixTable('items').'
882 882
         WHERE id=%i',
883 883
         $ident
884 884
     );
@@ -886,12 +886,12 @@  discard block
 block discarded – undo
886 886
     $tags = '';
887 887
     $itemTags = DB::query(
888 888
         'SELECT tag
889
-            FROM ' . prefixTable('tags') . '
889
+            FROM ' . prefixTable('tags').'
890 890
             WHERE item_id = %i AND tag != ""',
891 891
         $ident
892 892
     );
893 893
     foreach ($itemTags as $itemTag) {
894
-        $tags .= $itemTag['tag'] . ' ';
894
+        $tags .= $itemTag['tag'].' ';
895 895
     }
896 896
     // form id_tree to full foldername
897 897
     $folder = [];
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
             // Is this a User id?
903 903
             $user = DB::queryfirstrow(
904 904
                 'SELECT id, login
905
-                FROM ' . prefixTable('users') . '
905
+                FROM ' . prefixTable('users').'
906 906
                 WHERE id = %i',
907 907
                 $elem->title
908 908
             );
@@ -920,10 +920,10 @@  discard block
 block discarded – undo
920 920
             'label' => $data['label'],
921 921
             'description' => $data['description'],
922 922
             'tags' => $tags,
923
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
923
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
924 924
             'id_tree' => $data['id_tree'],
925 925
             'perso' => $data['perso'],
926
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
926
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
927 927
             'login' => $data['login'] ?? '',
928 928
             'folder' => implode(' » ', $folder),
929 929
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -941,14 +941,14 @@  discard block
 block discarded – undo
941 941
  */
942 942
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
943 943
 {
944
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
944
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
945 945
     // Load superglobal
946
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
946
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
947 947
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
948 948
     // Get superglobals
949 949
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
950 950
     //Connect to DB
951
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
951
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
952 952
     if (defined('DB_PASSWD_CLEAR') === false) {
953 953
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
954 954
     }
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
     // get new value from db
966 966
     $data = DB::queryFirstRow(
967 967
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
968
-        FROM ' . prefixTable('items') . ' as i
969
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
968
+        FROM ' . prefixTable('items').' as i
969
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
970 970
         WHERE i.id = %i
971 971
         AND l.action = %s',
972 972
         $ident,
@@ -976,12 +976,12 @@  discard block
 block discarded – undo
976 976
     $tags = '';
977 977
     $itemTags = DB::query(
978 978
         'SELECT tag
979
-            FROM ' . prefixTable('tags') . '
979
+            FROM ' . prefixTable('tags').'
980 980
             WHERE item_id = %i AND tag != ""',
981 981
         $ident
982 982
     );
983 983
     foreach ($itemTags as $itemTag) {
984
-        $tags .= $itemTag['tag'] . ' ';
984
+        $tags .= $itemTag['tag'].' ';
985 985
     }
986 986
     // form id_tree to full foldername
987 987
     $folder = [];
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
             // Is this a User id?
993 993
             $user = DB::queryfirstrow(
994 994
                 'SELECT id, login
995
-                FROM ' . prefixTable('users') . '
995
+                FROM ' . prefixTable('users').'
996 996
                 WHERE id = %i',
997 997
                 $elem->title
998 998
             );
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
             'label' => $data['label'],
1012 1012
             'description' => $data['description'],
1013 1013
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1014
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1014
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1015 1015
             'id_tree' => $data['id_tree'],
1016 1016
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1017 1017
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1033,52 +1033,52 @@  discard block
 block discarded – undo
1033 1033
 function getStatisticsData(array $SETTINGS): array
1034 1034
 {
1035 1035
     DB::query(
1036
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1036
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1037 1037
         0
1038 1038
     );
1039 1039
     $counter_folders = DB::count();
1040 1040
     DB::query(
1041
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1041
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1042 1042
         1
1043 1043
     );
1044 1044
     $counter_folders_perso = DB::count();
1045 1045
     DB::query(
1046
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1046
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1047 1047
         0
1048 1048
     );
1049 1049
     $counter_items = DB::count();
1050 1050
         DB::query(
1051
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1051
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1052 1052
         1
1053 1053
     );
1054 1054
     $counter_items_perso = DB::count();
1055 1055
         DB::query(
1056
-        'SELECT id FROM ' . prefixTable('users') . ''
1056
+        'SELECT id FROM '.prefixTable('users').''
1057 1057
     );
1058 1058
     $counter_users = DB::count();
1059 1059
         DB::query(
1060
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1060
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1061 1061
         1
1062 1062
     );
1063 1063
     $admins = DB::count();
1064 1064
     DB::query(
1065
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1065
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1066 1066
         1
1067 1067
     );
1068 1068
     $managers = DB::count();
1069 1069
     DB::query(
1070
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1070
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1071 1071
         1
1072 1072
     );
1073 1073
     $readOnly = DB::count();
1074 1074
     // list the languages
1075 1075
     $usedLang = [];
1076 1076
     $tp_languages = DB::query(
1077
-        'SELECT name FROM ' . prefixTable('languages')
1077
+        'SELECT name FROM '.prefixTable('languages')
1078 1078
     );
1079 1079
     foreach ($tp_languages as $tp_language) {
1080 1080
         DB::query(
1081
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1081
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1082 1082
             $tp_language['name']
1083 1083
         );
1084 1084
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1087,12 +1087,12 @@  discard block
 block discarded – undo
1087 1087
     // get list of ips
1088 1088
     $usedIp = [];
1089 1089
     $tp_ips = DB::query(
1090
-        'SELECT user_ip FROM ' . prefixTable('users')
1090
+        'SELECT user_ip FROM '.prefixTable('users')
1091 1091
     );
1092 1092
     foreach ($tp_ips as $ip) {
1093 1093
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1094 1094
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1095
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1095
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1096 1096
             $usedIp[$ip['user_ip']] = 1;
1097 1097
         }
1098 1098
     }
@@ -1158,14 +1158,14 @@  discard block
 block discarded – undo
1158 1158
     }
1159 1159
 
1160 1160
     // Load settings
1161
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1161
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1162 1162
     // Load superglobal
1163
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1163
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1164 1164
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1165 1165
     // Get user language
1166
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1166
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1167 1167
     // Load library
1168
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1168
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1169 1169
     // load PHPMailer
1170 1170
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1171 1171
     $mail->register();
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
     
1174 1174
     try {
1175 1175
         // send to user
1176
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1176
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1177 1177
         $mail->SMTPDebug = 0;
1178 1178
         //value 1 can be used to debug - 4 for debuging connections
1179 1179
         $mail->Port = $SETTINGS['email_port'];
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
         <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;">
1266 1266
         <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;">
1267 1267
         <br><div style="float:right;">' .
1268
-        $textMail .
1268
+        $textMail.
1269 1269
         '<br><br></td></tr></table>
1270 1270
     </td></tr></table>
1271 1271
     <br></body></html>';
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
  */
1277 1277
 function generateKey(): string
1278 1278
 {
1279
-    return substr(md5(rand() . rand()), 0, 15);
1279
+    return substr(md5(rand().rand()), 0, 15);
1280 1280
 }
1281 1281
 
1282 1282
 /**
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 {
1348 1348
     array_walk_recursive(
1349 1349
         $array,
1350
-        static function (&$item): void {
1350
+        static function(&$item): void {
1351 1351
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1352 1352
                 $item = utf8_encode($item);
1353 1353
             }
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
     }
1383 1383
 
1384 1384
     // Load superglobal
1385
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1385
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1386 1386
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1387 1387
     // Get superglobals
1388 1388
     if ($key !== null) {
@@ -1393,9 +1393,9 @@  discard block
 block discarded – undo
1393 1393
     }
1394 1394
 
1395 1395
     //load ClassLoader
1396
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1396
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1397 1397
     //Load AES
1398
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1398
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1399 1399
     $aes->register();
1400 1400
     if ($type === 'encode' && is_array($data) === true) {
1401 1401
         // Ensure UTF8 format
@@ -1465,8 +1465,8 @@  discard block
 block discarded – undo
1465 1465
  */
1466 1466
 function prefixTable(string $table): string
1467 1467
 {
1468
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1469
-    if (! empty($safeTable)) {
1468
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1469
+    if (!empty($safeTable)) {
1470 1470
         // sanitize string
1471 1471
         return $safeTable;
1472 1472
     }
@@ -1494,13 +1494,13 @@  discard block
 block discarded – undo
1494 1494
     bool $lowercase = false,
1495 1495
     array $SETTINGS = []
1496 1496
 ): string {
1497
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1498
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1497
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1498
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1499 1499
     $generator->register();
1500 1500
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1501 1501
     // Is PHP7 being used?
1502 1502
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1503
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1503
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1504 1504
         $php7generator->register();
1505 1505
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1506 1506
     }
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1531 1531
 {
1532 1532
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1533
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1533
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1534 1534
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1535 1535
     socket_close($sock);
1536 1536
 }
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
     }
1553 1553
 
1554 1554
     // include librairies & connect to DB
1555
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1555
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1556 1556
     if (defined('DB_PASSWD_CLEAR') === false) {
1557 1557
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1558 1558
     }
@@ -1576,14 +1576,14 @@  discard block
 block discarded – undo
1576 1576
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1577 1577
         if ($type === 'user_mngt') {
1578 1578
             send_syslog(
1579
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1579
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1580 1580
                 $SETTINGS['syslog_host'],
1581 1581
                 $SETTINGS['syslog_port'],
1582 1582
                 'teampass'
1583 1583
             );
1584 1584
         } else {
1585 1585
             send_syslog(
1586
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1586
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1587 1587
                 $SETTINGS['syslog_host'],
1588 1588
                 $SETTINGS['syslog_port'],
1589 1589
                 'teampass'
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
     ?string $encryption_type = null
1616 1616
 ): void {
1617 1617
     // include librairies & connect to DB
1618
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1618
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1619 1619
     if (defined('DB_PASSWD_CLEAR') === false) {
1620 1620
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1621 1621
     }
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
         if (empty($item_label) === true) {
1660 1660
             $dataItem = DB::queryfirstrow(
1661 1661
                 'SELECT id, id_tree, label
1662
-                FROM ' . prefixTable('items') . '
1662
+                FROM ' . prefixTable('items').'
1663 1663
                 WHERE id = %i',
1664 1664
                 $item_id
1665 1665
             );
@@ -1667,11 +1667,11 @@  discard block
 block discarded – undo
1667 1667
         }
1668 1668
 
1669 1669
         send_syslog(
1670
-            'action=' . str_replace('at_', '', $action) .
1671
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1672
-                ' itemno=' . $item_id .
1673
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1674
-                ' itemname="' . addslashes($item_label) . '"',
1670
+            'action='.str_replace('at_', '', $action).
1671
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1672
+                ' itemno='.$item_id.
1673
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1674
+                ' itemname="'.addslashes($item_label).'"',
1675 1675
             $SETTINGS['syslog_host'],
1676 1676
             $SETTINGS['syslog_port'],
1677 1677
             'teampass'
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
         && $action === 'at_shown'
1698 1698
     ) {
1699 1699
         // Load superglobal
1700
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1700
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1701 1701
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1702 1702
         // Get superglobals
1703 1703
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
         // Get info about item
1707 1707
         $dataItem = DB::queryfirstrow(
1708 1708
             'SELECT id, id_tree, label
1709
-            FROM ' . prefixTable('items') . '
1709
+            FROM ' . prefixTable('items').'
1710 1710
             WHERE id = %i',
1711 1711
             $item_id
1712 1712
         );
@@ -1720,9 +1720,9 @@  discard block
 block discarded – undo
1720 1720
                 'body' => str_replace(
1721 1721
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1722 1722
                     [
1723
-                        addslashes($globalsName . ' ' . $globalsLastname),
1723
+                        addslashes($globalsName.' '.$globalsLastname),
1724 1724
                         addslashes($item_label),
1725
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1725
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1726 1726
                     ],
1727 1727
                     langHdl('email_on_open_notification_mail')
1728 1728
                 ),
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1745 1745
 {
1746 1746
     // Load superglobal
1747
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1747
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1748 1748
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1749 1749
     // Get superglobals
1750 1750
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1754,8 +1754,8 @@  discard block
 block discarded – undo
1754 1754
     $notification = DB::queryOneColumn(
1755 1755
         'email',
1756 1756
         'SELECT *
1757
-        FROM ' . prefixTable('notification') . ' AS n
1758
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1757
+        FROM ' . prefixTable('notification').' AS n
1758
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1759 1759
         WHERE n.item_id = %i AND n.user_id != %i',
1760 1760
         $item_id,
1761 1761
         $globalsUserId
@@ -1766,7 +1766,7 @@  discard block
 block discarded – undo
1766 1766
         // Get list of changes
1767 1767
         $htmlChanges = '<ul>';
1768 1768
         foreach ($changes as $change) {
1769
-            $htmlChanges .= '<li>' . $change . '</li>';
1769
+            $htmlChanges .= '<li>'.$change.'</li>';
1770 1770
         }
1771 1771
         $htmlChanges .= '</ul>';
1772 1772
         // send email
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1798 1798
 {
1799 1799
     // Class loader
1800
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1800
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1801 1801
     //Load Tree
1802 1802
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1803 1803
     $tree->register();
@@ -1806,15 +1806,15 @@  discard block
 block discarded – undo
1806 1806
     $path = '';
1807 1807
     foreach ($arbo as $elem) {
1808 1808
         if (empty($path) === true) {
1809
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1809
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1810 1810
         } else {
1811
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1811
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1812 1812
         }
1813 1813
     }
1814 1814
 
1815 1815
     // Build text to show user
1816 1816
     if (empty($label) === false) {
1817
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1817
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1818 1818
     }
1819 1819
     return empty($path) === true ? '' : $path;
1820 1820
 }
@@ -1869,9 +1869,9 @@  discard block
 block discarded – undo
1869 1869
  */
1870 1870
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1871 1871
 {
1872
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1872
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1873 1873
     // include librairies & connect to DB
1874
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1874
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1875 1875
     if (defined('DB_PASSWD_CLEAR') === false) {
1876 1876
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1877 1877
     }
@@ -1884,8 +1884,8 @@  discard block
 block discarded – undo
1884 1884
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1885 1885
         // perform a copy
1886 1886
         if (file_exists($tp_config_file)) {
1887
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1888
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1887
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1888
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1889 1889
             }
1890 1890
         }
1891 1891
 
@@ -1895,11 +1895,11 @@  discard block
 block discarded – undo
1895 1895
         $data[1] = "global \$SETTINGS;\n";
1896 1896
         $data[2] = "\$SETTINGS = array (\n";
1897 1897
         $rows = DB::query(
1898
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1898
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1899 1899
             'admin'
1900 1900
         );
1901 1901
         foreach ($rows as $record) {
1902
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1902
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1903 1903
         }
1904 1904
         array_push($data, ");\n");
1905 1905
         $data = array_unique($data);
@@ -1913,15 +1913,15 @@  discard block
 block discarded – undo
1913 1913
                 break;
1914 1914
             }
1915 1915
 
1916
-            if (stristr($line, "'" . $field . "' => '")) {
1917
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1916
+            if (stristr($line, "'".$field."' => '")) {
1917
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1918 1918
                 $bFound = true;
1919 1919
                 break;
1920 1920
             }
1921 1921
             ++$inc;
1922 1922
         }
1923 1923
         if ($bFound === false) {
1924
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1924
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
1925 1925
         }
1926 1926
     }
1927 1927
 
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
 {
1948 1948
     global $SETTINGS;
1949 1949
     /* LOAD CPASSMAN SETTINGS */
1950
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1950
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1951 1951
         $SETTINGS = [];
1952 1952
         $SETTINGS['duplicate_folder'] = 0;
1953 1953
         //by default, this is set to 0;
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
         //by default, this value is set to 5;
1958 1958
         $settings = [];
1959 1959
         $rows = DB::query(
1960
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1960
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1961 1961
             [
1962 1962
                 'type' => 'admin',
1963 1963
                 'type2' => 'settings',
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
     $source_cf = [];
1985 1985
     $rows = DB::QUERY(
1986 1986
         'SELECT id_category
1987
-            FROM ' . prefixTable('categories_folders') . '
1987
+            FROM ' . prefixTable('categories_folders').'
1988 1988
             WHERE id_folder = %i',
1989 1989
         $source_id
1990 1990
     );
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
     $target_cf = [];
1996 1996
     $rows = DB::QUERY(
1997 1997
         'SELECT id_category
1998
-            FROM ' . prefixTable('categories_folders') . '
1998
+            FROM ' . prefixTable('categories_folders').'
1999 1999
             WHERE id_folder = %i',
2000 2000
         $target_id
2001 2001
     );
@@ -2030,9 +2030,9 @@  discard block
 block discarded – undo
2030 2030
     $password = null
2031 2031
 ) {
2032 2032
     // Load AntiXSS
2033
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2034
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2035
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2033
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2034
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2035
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2036 2036
     $antiXss = new voku\helper\AntiXSS();
2037 2037
     // Protect against bad inputs
2038 2038
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
     $target_file = $antiXss->xss_clean($target_file);
2045 2045
     if (empty($password) === true || is_null($password) === true) {
2046 2046
         // get KEY to define password
2047
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2047
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2048 2048
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2049 2049
     }
2050 2050
 
@@ -2089,15 +2089,15 @@  discard block
 block discarded – undo
2089 2089
 ) {
2090 2090
     // load PhpEncryption library
2091 2091
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2092
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2093
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2094
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2095
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2096
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2097
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2098
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2099
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2100
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2092
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2093
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2094
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2095
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2096
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2097
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2098
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2099
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2100
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2101 2101
     try {
2102 2102
         \Defuse\Crypto\File::encryptFileWithPassword(
2103 2103
             $source_file,
@@ -2134,15 +2134,15 @@  discard block
 block discarded – undo
2134 2134
 ) {
2135 2135
     // load PhpEncryption library
2136 2136
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2137
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2138
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2139
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2140
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2141
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2142
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2143
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2144
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2145
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2137
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2138
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2139
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2140
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2141
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2142
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2143
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2144
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2145
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2146 2146
     try {
2147 2147
         \Defuse\Crypto\File::decryptFileWithPassword(
2148 2148
             $source_file,
@@ -2187,9 +2187,9 @@  discard block
 block discarded – undo
2187 2187
 function fileDelete(string $file, array $SETTINGS): void
2188 2188
 {
2189 2189
     // Load AntiXSS
2190
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2191
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2192
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2190
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2191
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2192
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2193 2193
     $antiXss = new voku\helper\AntiXSS();
2194 2194
     $file = $antiXss->xss_clean($file);
2195 2195
     if (is_file($file)) {
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 
2234 2234
 function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) {
2235 2235
     // Check if the path exists
2236
-    if (! file_exists($path)) {
2236
+    if (!file_exists($path)) {
2237 2237
         return false;
2238 2238
     }
2239 2239
 
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
  */
2269 2269
 function accessToItemIsGranted(int $item_id, $SETTINGS)
2270 2270
 {
2271
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2271
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2272 2272
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2273 2273
     // Prepare superGlobal variables
2274 2274
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
     // Load item data
2277 2277
     $data = DB::queryFirstRow(
2278 2278
         'SELECT id_tree
2279
-        FROM ' . prefixTable('items') . '
2279
+        FROM ' . prefixTable('items').'
2280 2280
         WHERE id = %i',
2281 2281
         $item_id
2282 2282
     );
@@ -2349,8 +2349,8 @@  discard block
 block discarded – undo
2349 2349
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2350 2350
 {
2351 2351
     // include librairies & connect to DB
2352
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2353
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2352
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2353
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2354 2354
     if (defined('DB_PASSWD_CLEAR') === false) {
2355 2355
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2356 2356
     }
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
     DB::$encoding = DB_ENCODING;
2363 2363
     // Insert log in DB
2364 2364
     return DB::query(
2365
-        'SELECT ' . $fields . '
2365
+        'SELECT '.$fields.'
2366 2366
         FROM ' . prefixTable($table)
2367 2367
     );
2368 2368
 }
@@ -2375,11 +2375,11 @@  discard block
 block discarded – undo
2375 2375
 function formatSizeUnits(int $bytes): string
2376 2376
 {
2377 2377
     if ($bytes >= 1073741824) {
2378
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2378
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2379 2379
     } elseif ($bytes >= 1048576) {
2380
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2380
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2381 2381
     } elseif ($bytes >= 1024) {
2382
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2382
+        $bytes = number_format($bytes / 1024, 2).' KB';
2383 2383
     } elseif ($bytes > 1) {
2384 2384
         $bytes .= ' bytes';
2385 2385
     } elseif ($bytes === 1) {
@@ -2570,14 +2570,14 @@  discard block
 block discarded – undo
2570 2570
 
2571 2571
     // Encrypt the file content
2572 2572
     $plaintext = file_get_contents(
2573
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2573
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2574 2574
     );
2575 2575
     $ciphertext = $cipher->encrypt($plaintext);
2576 2576
     // Save new file
2577 2577
     $hash = md5($plaintext);
2578
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2578
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2579 2579
     file_put_contents($fileOut, $ciphertext);
2580
-    unlink($fileInPath . '/' . $fileInName);
2580
+    unlink($fileInPath.'/'.$fileInName);
2581 2581
     return [
2582 2582
         'fileHash' => base64_encode($hash),
2583 2583
         'objectKey' => base64_encode($objectKey),
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
  */
2594 2594
 function decryptFile(string $fileName, string $filePath, string $key): string
2595 2595
 {
2596
-    if (! defined('FILE_BUFFER_SIZE')) {
2596
+    if (!defined('FILE_BUFFER_SIZE')) {
2597 2597
         define('FILE_BUFFER_SIZE', 128 * 1024);
2598 2598
     }
2599 2599
 
@@ -2612,7 +2612,7 @@  discard block
 block discarded – undo
2612 2612
     $cipher->enableContinuousBuffer();
2613 2613
     $cipher->disablePadding();
2614 2614
     // Get file content
2615
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2615
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2616 2616
     // Decrypt file content and return
2617 2617
     return base64_encode($cipher->decrypt($ciphertext));
2618 2618
 }
@@ -2662,8 +2662,8 @@  discard block
 block discarded – undo
2662 2662
     array $SETTINGS
2663 2663
 ): void {
2664 2664
     // include librairies & connect to DB
2665
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2666
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2665
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2666
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2667 2667
     if (defined('DB_PASSWD_CLEAR') === false) {
2668 2668
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2669 2669
     }
@@ -2680,7 +2680,7 @@  discard block
 block discarded – undo
2680 2680
         $post_object_id
2681 2681
     );
2682 2682
     // Superglobals
2683
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2683
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2684 2684
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2685 2685
     // Prepare superGlobal variables
2686 2686
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
         // Create sharekey for each user
2706 2706
         $users = DB::query(
2707 2707
             'SELECT id, public_key
2708
-            FROM ' . prefixTable('users') . '
2709
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2708
+            FROM ' . prefixTable('users').'
2709
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2710 2710
             AND public_key != ""'
2711 2711
         );
2712 2712
         foreach ($users as $user) {
@@ -2734,7 +2734,7 @@  discard block
 block discarded – undo
2734 2734
 function isBase64(string $str): bool
2735 2735
 {
2736 2736
     $str = (string) trim($str);
2737
-    if (! isset($str[0])) {
2737
+    if (!isset($str[0])) {
2738 2738
         return false;
2739 2739
     }
2740 2740
 
@@ -2802,13 +2802,13 @@  discard block
 block discarded – undo
2802 2802
         ],
2803 2803
     ];
2804 2804
     // Load expected libraries
2805
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2806
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2807
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2808
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2809
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2810
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2811
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2805
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2806
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2807
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2808
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2809
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2810
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2811
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2812 2812
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2813 2813
     $ad->register();
2814 2814
     $connection = new Connection($config);
@@ -2817,7 +2817,7 @@  discard block
 block discarded – undo
2817 2817
         $connection->connect();
2818 2818
     } catch (\LdapRecord\Auth\BindException $e) {
2819 2819
         $error = $e->getDetailedError();
2820
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2820
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2821 2821
         return false;
2822 2822
     }
2823 2823
 
@@ -2826,7 +2826,7 @@  discard block
 block discarded – undo
2826 2826
         $connection->auth()->attempt($SETTINGS['ldap_user_attribute'].'='.$login.','.$SETTINGS['ldap_bdn'], $password, $stayAuthenticated = true);
2827 2827
     } catch (\LdapRecord\Auth\BindException $e) {
2828 2828
         $error = $e->getDetailedError();
2829
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2829
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2830 2830
         return false;
2831 2831
     }
2832 2832
 
@@ -2844,8 +2844,8 @@  discard block
 block discarded – undo
2844 2844
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2845 2845
 {
2846 2846
     // include librairies & connect to DB
2847
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2848
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2847
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2848
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2849 2849
     if (defined('DB_PASSWD_CLEAR') === false) {
2850 2850
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2851 2851
     }
@@ -2903,7 +2903,7 @@  discard block
 block discarded – undo
2903 2903
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2904 2904
             $now->setTimezone(new DateTimeZone($timezone));
2905 2905
             $offsets[] = $offset = $now->getOffset();
2906
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2906
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2907 2907
         }
2908 2908
 
2909 2909
         array_multisort($offsets, $timezones);
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
 {
2924 2924
     $hours = intval($offset / 3600);
2925 2925
     $minutes = abs(intval($offset % 3600 / 60));
2926
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2926
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2927 2927
 }
2928 2928
 
2929 2929
 /**
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
46 46
 
47 47
 // DO CHECKS
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
51 51
 if (
52 52
     isset($post_type) === true
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
63 63
 ) {
64 64
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit();
67 67
 } elseif ((isset($_SESSION['user_id']) === true
68 68
         && isset($_SESSION['key'])) === true
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     mainQuery($SETTINGS);
75 75
 } else {
76 76
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit();
79 79
 }
80 80
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
     // Includes
92
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
93
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
94
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
95
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
92
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
93
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
94
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
96 96
 
97 97
     // Connect to mysql server
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
99 99
 
100 100
     DB::$host = DB_HOST;
101 101
     DB::$user = DB_USER;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     DB::$encoding = DB_ENCODING;
106 106
 
107 107
     // User's language loading
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
109 109
 
110 110
     // Prepare post variables
111 111
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             $pwdlib = new PasswordLib\PasswordLib();
234 234
             // generate key
235 235
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
236
-            echo '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
236
+            echo '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
237 237
             break;
238 238
 
239 239
         /*
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 )
263 263
             );
264 264
 
265
-            echo '[{"token" : "' . $token . '"}]';
265
+            echo '[{"token" : "'.$token.'"}]';
266 266
             break;
267 267
 
268 268
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     // get number of items
536 536
     DB::queryFirstRow(
537 537
         'SELECT increment_id
538
-        FROM ' . prefixTable('sharekeys_items') .
538
+        FROM ' . prefixTable('sharekeys_items').
539 539
         ' WHERE user_id = %i',
540 540
         $userId
541 541
     );
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         // check if expected security level is reached
590 590
         $dataUser = DB::queryfirstrow(
591 591
             'SELECT *
592
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
592
+            FROM ' . prefixTable('users').' WHERE id = %i',
593 593
             $post_user_id
594 594
         );
595 595
 
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
         if (empty($dataUser['fonction_id']) === false) {
611 611
             $data = DB::queryFirstRow(
612 612
                 'SELECT complexity
613
-                FROM ' . prefixTable('roles_title') . '
614
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
613
+                FROM ' . prefixTable('roles_title').'
614
+                WHERE id IN (' . $dataUser['fonction_id'].')
615 615
                 ORDER BY complexity DESC'
616 616
             );
617 617
         } else {
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
             return prepareExchangedData(
625 625
                 array(
626 626
                     'error' => true,
627
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
628
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
627
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
628
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
629 629
                 ),
630 630
                 'encode'
631 631
             );
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
         // Get data about user
727 727
         $data = DB::queryfirstrow(
728 728
             'SELECT id, email, pw
729
-            FROM ' . prefixTable('users') . '
729
+            FROM ' . prefixTable('users').'
730 730
             WHERE login = %s',
731 731
             $post_login
732 732
         );
733 733
     } else {
734 734
         $data = DB::queryfirstrow(
735 735
             'SELECT id, login, email, pw
736
-            FROM ' . prefixTable('users') . '
736
+            FROM ' . prefixTable('users').'
737 737
             WHERE id = %i',
738 738
             $post_id
739 739
         );
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
     $counter = DB::count();
744 744
 
745 745
     // load passwordLib library
746
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
746
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
747 747
     $pwdlib->register();
748 748
     $pwdlib = new PasswordLib\PasswordLib();
749 749
 
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
     }
791 791
     
792 792
     // generate new GA user code
793
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
793
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
794 794
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
795 795
     $gaSecretKey = $tfa->createSecret();
796 796
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
                 'email' => $data['email'],
833 833
                 'email_result' => str_replace(
834 834
                     '#email#',
835
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
835
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
836 836
                     addslashes(langHdl('admin_email_result_ok'))
837 837
                 ),
838 838
             ),
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
             'email' => $data['email'],
849 849
             'email_result' => str_replace(
850 850
                 '#email#',
851
-                '<b>' . obfuscateEmail($data['email']) . '</b>',
851
+                '<b>'.obfuscateEmail($data['email']).'</b>',
852 852
                 addslashes(langHdl('admin_email_result_ok'))
853 853
             ),
854 854
         ),
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
         && (int) $SETTINGS['enable_send_email_on_user_login'] === 1
865 865
     ) {
866 866
         $row = DB::queryFirstRow(
867
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
867
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
868 868
             'cron',
869 869
             'sending_emails'
870 870
         );
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
873 873
             $rows = DB::query(
874 874
                 'SELECT *
875
-                FROM ' . prefixTable('emails') .
875
+                FROM ' . prefixTable('emails').
876 876
                 ' WHERE status != %s',
877 877
                 'sent'
878 878
             );
879 879
             foreach ($rows as $record) {
880
-                echo $record['increment_id'] . " >> ";
880
+                echo $record['increment_id']." >> ";
881 881
                 // Send email
882 882
                 $ret = json_decode(
883 883
                     sendEmail(
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
     $arr_html = array();
977 977
     $rows = DB::query(
978 978
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
979
-        FROM ' . prefixTable('log_items') . ' AS l
980
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
979
+        FROM ' . prefixTable('log_items').' AS l
980
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
981 981
         WHERE l.action = %s AND l.id_user = %i
982 982
         ORDER BY l.date DESC
983 983
         LIMIT 0, 100',
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
         isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1
1011 1011
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
1012 1012
     ) {
1013
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1013
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1014 1014
         $nb_suggestions_waiting = DB::count();
1015 1015
     }
1016 1016
 
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
             if ($data === 'stat_languages') {
1047 1047
                 $tmp = '';
1048 1048
                 foreach ($stats_data[$data] as $key => $value) {
1049
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1049
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1050 1050
                 }
1051 1051
                 $statsToSend[$data] = $tmp;
1052 1052
             } elseif ($data === 'stat_country') {
1053 1053
                 $tmp = '';
1054 1054
                 foreach ($stats_data[$data] as $key => $value) {
1055
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1055
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1056 1056
                 }
1057 1057
                 $statsToSend[$data] = $tmp;
1058 1058
             } else {
@@ -1126,8 +1126,8 @@  discard block
 block discarded – undo
1126 1126
             if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) {
1127 1127
                 $url_found = substr($line, 19, strlen($line) - 22);
1128 1128
                 $tmp = parse_url($url_found);
1129
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path'];
1130
-                $line = "'cpassman_url' => '" . $anonym_url . "\n";
1129
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path'];
1130
+                $line = "'cpassman_url' => '".$anonym_url."\n";
1131 1131
             }
1132 1132
 
1133 1133
             // Anonymize all urls
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
     $teampass_errors = '';
1155 1155
     $rows = DB::query(
1156 1156
         'SELECT label, date AS error_date
1157
-        FROM ' . prefixTable('log_system') . "
1157
+        FROM ' . prefixTable('log_system')."
1158 1158
         WHERE `type` LIKE 'error'
1159 1159
         ORDER BY `date` DESC
1160 1160
         LIMIT 0, 10"
@@ -1162,9 +1162,9 @@  discard block
 block discarded – undo
1162 1162
     if (DB::count() > 0) {
1163 1163
         foreach ($rows as $record) {
1164 1164
             if (empty($teampass_errors) === true) {
1165
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1165
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1166 1166
             } else {
1167
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1167
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1168 1168
             }
1169 1169
         }
1170 1170
     }
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
     // Now prepare text
1175 1175
     $txt = '### Page on which it happened
1176
-' . $post_data['current_page'] . '
1176
+' . $post_data['current_page'].'
1177 1177
 
1178 1178
 ### Steps to reproduce
1179 1179
 1.
@@ -1188,39 +1188,39 @@  discard block
 block discarded – undo
1188 1188
 Tell us what happens instead
1189 1189
 
1190 1190
 ### Server configuration
1191
-**Operating system**: ' . php_uname() . '
1191
+**Operating system**: ' . php_uname().'
1192 1192
 
1193
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1193
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1194 1194
 
1195
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1195
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1196 1196
 
1197
-**PHP version:** ' . PHP_VERSION . '
1197
+**PHP version:** ' . PHP_VERSION.'
1198 1198
 
1199
-**Teampass version:** ' . TP_VERSION_FULL . '
1199
+**Teampass version:** ' . TP_VERSION_FULL.'
1200 1200
 
1201 1201
 **Teampass configuration file:**
1202 1202
 ```
1203
-' . $list_of_options . '
1203
+' . $list_of_options.'
1204 1204
 ```
1205 1205
 
1206 1206
 **Updated from an older Teampass or fresh install:**
1207 1207
 
1208 1208
 ### Client configuration
1209 1209
 
1210
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1210
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1211 1211
 
1212
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1212
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1213 1213
 
1214 1214
 ### Logs
1215 1215
 
1216 1216
 #### Web server error log
1217 1217
 ```
1218
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1218
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1219 1219
 ```
1220 1220
 
1221 1221
 #### Teampass 10 last system errors
1222 1222
 ```
1223
-' . $teampass_errors . '
1223
+' . $teampass_errors.'
1224 1224
 ```
1225 1225
 
1226 1226
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
         // Check if user exists
1249 1249
         $userInfo = DB::queryFirstRow(
1250 1250
             'SELECT public_key, private_key, pw, auth_type
1251
-            FROM ' . prefixTable('users') . '
1251
+            FROM ' . prefixTable('users').'
1252 1252
             WHERE id = %i',
1253 1253
             $post_user_id
1254 1254
         );
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
             // Get one item
1257 1257
             $record = DB::queryFirstRow(
1258 1258
                 'SELECT object_id
1259
-                FROM ' . prefixTable('sharekeys_items') . '
1259
+                FROM ' . prefixTable('sharekeys_items').'
1260 1260
                 WHERE user_id = %i',
1261 1261
                 $post_user_id
1262 1262
             );
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
             // Get itemKey from current user
1265 1265
             $currentUserKey = DB::queryFirstRow(
1266 1266
                 'SELECT share_key, increment_id
1267
-                FROM ' . prefixTable('sharekeys_items') . '
1267
+                FROM ' . prefixTable('sharekeys_items').'
1268 1268
                 WHERE object_id = %i AND user_id = %i',
1269 1269
                 $record['object_id'],
1270 1270
                 $post_user_id
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
             
1292 1292
             // Use the password check
1293 1293
             // load passwordLib library
1294
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1294
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1295 1295
             $pwdlib->register();
1296 1296
             $pwdlib = new PasswordLib\PasswordLib();
1297 1297
             
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
         // Get user info
1336 1336
         $userData = DB::queryFirstRow(
1337 1337
             'SELECT private_key
1338
-            FROM ' . prefixTable('users') . '
1338
+            FROM ' . prefixTable('users').'
1339 1339
             WHERE id = %i',
1340 1340
             $post_user_id
1341 1341
         );
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
             );
1363 1363
 
1364 1364
             // Load superGlobals
1365
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1365
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1366 1366
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1367 1367
 
1368 1368
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
         // Get user info
1401 1401
         $userData = DB::queryFirstRow(
1402 1402
             'SELECT email, auth_type, login
1403
-            FROM ' . prefixTable('users') . '
1403
+            FROM ' . prefixTable('users').'
1404 1404
             WHERE id = %i',
1405 1405
             $post_user_id
1406 1406
         );
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
         // Get user info
1536 1536
         $userData = DB::queryFirstRow(
1537 1537
             'SELECT email, auth_type, login
1538
-            FROM ' . prefixTable('users') . '
1538
+            FROM ' . prefixTable('users').'
1539 1539
             WHERE id = %i',
1540 1540
             $post_user_id
1541 1541
         );
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
         // Check if user exists
1599 1599
         DB::queryFirstRow(
1600 1600
             'SELECT *
1601
-            FROM ' . prefixTable('users') . '
1601
+            FROM ' . prefixTable('users').'
1602 1602
             WHERE id = %i',
1603 1603
             $post_user_id
1604 1604
         );
1605 1605
         if (DB::count() > 0) {
1606 1606
             // Include libraries
1607
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1607
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1608 1608
 
1609 1609
             // CLear old sharekeys
1610 1610
             if ($post_self_change === false) {
@@ -1656,13 +1656,13 @@  discard block
 block discarded – undo
1656 1656
         // Check if user exists
1657 1657
         $userInfo = DB::queryFirstRow(
1658 1658
             'SELECT public_key
1659
-            FROM ' . prefixTable('users') . '
1659
+            FROM ' . prefixTable('users').'
1660 1660
             WHERE id = %i',
1661 1661
             $post_user_id
1662 1662
         );
1663 1663
         if (DB::count() > 0) {
1664 1664
             // Include libraries
1665
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1665
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1666 1666
 
1667 1667
             // WHAT STEP TO PERFORM?
1668 1668
             if ($post_action === 'step0') {
@@ -1822,15 +1822,15 @@  discard block
 block discarded – undo
1822 1822
     // Loop on items
1823 1823
     $rows = DB::query(
1824 1824
         'SELECT id, pw
1825
-        FROM ' . prefixTable('items') . '
1825
+        FROM ' . prefixTable('items').'
1826 1826
         WHERE perso = 0
1827
-        LIMIT ' . $post_start . ', ' . $post_length
1827
+        LIMIT ' . $post_start.', '.$post_length
1828 1828
     );
1829 1829
     foreach ($rows as $record) {
1830 1830
         // Get itemKey from current user
1831 1831
         $currentUserKey = DB::queryFirstRow(
1832 1832
             'SELECT share_key, increment_id
1833
-            FROM ' . prefixTable('sharekeys_items') . '
1833
+            FROM ' . prefixTable('sharekeys_items').'
1834 1834
             WHERE object_id = %i AND user_id = %i',
1835 1835
             $record['id'],
1836 1836
             $_SESSION['user_id']
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1859 1859
                 $currentUserKey = DB::queryFirstRow(
1860 1860
                     'SELECT increment_id
1861
-                    FROM ' . prefixTable('sharekeys_items') . '
1861
+                    FROM ' . prefixTable('sharekeys_items').'
1862 1862
                     WHERE object_id = %i AND user_id = %i',
1863 1863
                     $record['id'],
1864 1864
                     $post_user_id
@@ -1891,7 +1891,7 @@  discard block
 block discarded – undo
1891 1891
     // SHould we change step?
1892 1892
     DB::query(
1893 1893
         'SELECT *
1894
-        FROM ' . prefixTable('items') . '
1894
+        FROM ' . prefixTable('items').'
1895 1895
         WHERE perso = 0'
1896 1896
     );
1897 1897
 
@@ -1915,15 +1915,15 @@  discard block
 block discarded – undo
1915 1915
     // Loop on logs
1916 1916
     $rows = DB::query(
1917 1917
         'SELECT increment_id
1918
-        FROM ' . prefixTable('log_items') . '
1918
+        FROM ' . prefixTable('log_items').'
1919 1919
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
1920
-        LIMIT ' . $post_start . ', ' . $post_length
1920
+        LIMIT ' . $post_start.', '.$post_length
1921 1921
     );
1922 1922
     foreach ($rows as $record) {
1923 1923
         // Get itemKey from current user
1924 1924
         $currentUserKey = DB::queryFirstRow(
1925 1925
             'SELECT share_key
1926
-            FROM ' . prefixTable('sharekeys_logs') . '
1926
+            FROM ' . prefixTable('sharekeys_logs').'
1927 1927
             WHERE object_id = %i AND user_id = %i',
1928 1928
             $record['increment_id'],
1929 1929
             $_SESSION['user_id']
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1951 1951
                 $currentUserKey = DB::queryFirstRow(
1952 1952
                     'SELECT increment_id
1953
-                    FROM ' . prefixTable('sharekeys_items') . '
1953
+                    FROM ' . prefixTable('sharekeys_items').'
1954 1954
                     WHERE object_id = %i AND user_id = %i',
1955 1955
                     $record['id'],
1956 1956
                     $post_user_id
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
     // SHould we change step?
1973 1973
     DB::query(
1974 1974
         'SELECT increment_id
1975
-        FROM ' . prefixTable('log_items') . '
1975
+        FROM ' . prefixTable('log_items').'
1976 1976
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
1977 1977
     );
1978 1978
 
@@ -1996,15 +1996,15 @@  discard block
 block discarded – undo
1996 1996
     // Loop on fields
1997 1997
     $rows = DB::query(
1998 1998
         'SELECT id
1999
-        FROM ' . prefixTable('categories_items') . '
1999
+        FROM ' . prefixTable('categories_items').'
2000 2000
         WHERE encryption_type = "teampass_aes"
2001
-        LIMIT ' . $post_start . ', ' . $post_length
2001
+        LIMIT ' . $post_start.', '.$post_length
2002 2002
     );
2003 2003
     foreach ($rows as $record) {
2004 2004
         // Get itemKey from current user
2005 2005
         $currentUserKey = DB::queryFirstRow(
2006 2006
             'SELECT share_key
2007
-            FROM ' . prefixTable('sharekeys_fields') . '
2007
+            FROM ' . prefixTable('sharekeys_fields').'
2008 2008
             WHERE object_id = %i AND user_id = %i',
2009 2009
             $record['id'],
2010 2010
             $_SESSION['user_id']
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2032 2032
                 $currentUserKey = DB::queryFirstRow(
2033 2033
                     'SELECT increment_id
2034
-                    FROM ' . prefixTable('sharekeys_items') . '
2034
+                    FROM ' . prefixTable('sharekeys_items').'
2035 2035
                     WHERE object_id = %i AND user_id = %i',
2036 2036
                     $record['id'],
2037 2037
                     $post_user_id
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
     // SHould we change step?
2054 2054
     DB::query(
2055 2055
         'SELECT *
2056
-        FROM ' . prefixTable('categories_items') . '
2056
+        FROM ' . prefixTable('categories_items').'
2057 2057
         WHERE encryption_type = "teampass_aes"'
2058 2058
     );
2059 2059
 
@@ -2077,14 +2077,14 @@  discard block
 block discarded – undo
2077 2077
     // Loop on suggestions
2078 2078
     $rows = DB::query(
2079 2079
         'SELECT id
2080
-        FROM ' . prefixTable('suggestion') . '
2081
-        LIMIT ' . $post_start . ', ' . $post_length
2080
+        FROM ' . prefixTable('suggestion').'
2081
+        LIMIT ' . $post_start.', '.$post_length
2082 2082
     );
2083 2083
     foreach ($rows as $record) {
2084 2084
         // Get itemKey from current user
2085 2085
         $currentUserKey = DB::queryFirstRow(
2086 2086
             'SELECT share_key
2087
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2087
+            FROM ' . prefixTable('sharekeys_suggestions').'
2088 2088
             WHERE object_id = %i AND user_id = %i',
2089 2089
             $record['id'],
2090 2090
             $_SESSION['user_id']
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2112 2112
                 $currentUserKey = DB::queryFirstRow(
2113 2113
                     'SELECT increment_id
2114
-                    FROM ' . prefixTable('sharekeys_items') . '
2114
+                    FROM ' . prefixTable('sharekeys_items').'
2115 2115
                     WHERE object_id = %i AND user_id = %i',
2116 2116
                     $record['id'],
2117 2117
                     $post_user_id
@@ -2156,15 +2156,15 @@  discard block
 block discarded – undo
2156 2156
     // Loop on files
2157 2157
     $rows = DB::query(
2158 2158
         'SELECT id
2159
-        FROM ' . prefixTable('files') . '
2160
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2161
-        LIMIT ' . $post_start . ', ' . $post_length
2159
+        FROM ' . prefixTable('files').'
2160
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2161
+        LIMIT ' . $post_start.', '.$post_length
2162 2162
     ); //aes_encryption
2163 2163
     foreach ($rows as $record) {
2164 2164
         // Get itemKey from current user
2165 2165
         $currentUserKey = DB::queryFirstRow(
2166 2166
             'SELECT share_key
2167
-            FROM ' . prefixTable('sharekeys_files') . '
2167
+            FROM ' . prefixTable('sharekeys_files').'
2168 2168
             WHERE object_id = %i AND user_id = %i',
2169 2169
             $record['id'],
2170 2170
             $_SESSION['user_id']
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2192 2192
                 $currentUserKey = DB::queryFirstRow(
2193 2193
                     'SELECT increment_id
2194
-                    FROM ' . prefixTable('sharekeys_items') . '
2194
+                    FROM ' . prefixTable('sharekeys_items').'
2195 2195
                     WHERE object_id = %i AND user_id = %i',
2196 2196
                     $record['id'],
2197 2197
                     $post_user_id
@@ -2213,8 +2213,8 @@  discard block
 block discarded – undo
2213 2213
     // SHould we change step?
2214 2214
     DB::query(
2215 2215
         'SELECT *
2216
-        FROM ' . prefixTable('files') . '
2217
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2216
+        FROM ' . prefixTable('files').'
2217
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2218 2218
     );
2219 2219
 
2220 2220
     $next_start = (int) $post_start + (int) $post_length;
@@ -2246,16 +2246,16 @@  discard block
 block discarded – undo
2246 2246
     if (count($_SESSION['personal_folders']) > 0) {
2247 2247
         $rows = DB::query(
2248 2248
             'SELECT id, pw
2249
-            FROM ' . prefixTable('items') . '
2249
+            FROM ' . prefixTable('items').'
2250 2250
             WHERE perso = 1 AND id_tree IN %ls
2251
-            LIMIT ' . $post_start . ', ' . $post_length,
2251
+            LIMIT ' . $post_start.', '.$post_length,
2252 2252
             $_SESSION['personal_folders']
2253 2253
         );
2254 2254
         foreach ($rows as $record) {
2255 2255
             // Get itemKey from current user
2256 2256
             $currentUserKey = DB::queryFirstRow(
2257 2257
                 'SELECT share_key, increment_id
2258
-                FROM ' . prefixTable('sharekeys_items') . '
2258
+                FROM ' . prefixTable('sharekeys_items').'
2259 2259
                 WHERE object_id = %i AND user_id = %i',
2260 2260
                 $record['id'],
2261 2261
                 $_SESSION['user_id']
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2283 2283
                     $currentUserKey = DB::queryFirstRow(
2284 2284
                         'SELECT increment_id
2285
-                        FROM ' . prefixTable('sharekeys_items') . '
2285
+                        FROM ' . prefixTable('sharekeys_items').'
2286 2286
                         WHERE object_id = %i AND user_id = %i',
2287 2287
                         $record['id'],
2288 2288
                         $post_user_id
@@ -2305,7 +2305,7 @@  discard block
 block discarded – undo
2305 2305
     // SHould we change step?
2306 2306
     DB::query(
2307 2307
         'SELECT *
2308
-        FROM ' . prefixTable('items') . '
2308
+        FROM ' . prefixTable('items').'
2309 2309
         WHERE perso = 0'
2310 2310
     );
2311 2311
 
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
         // Check if user exists
2330 2330
         $userInfo = DB::queryFirstRow(
2331 2331
             'SELECT public_key, encrypted_psk
2332
-            FROM ' . prefixTable('users') . '
2332
+            FROM ' . prefixTable('users').'
2333 2333
             WHERE id = %i',
2334 2334
             $post_user_id
2335 2335
         );
@@ -2354,9 +2354,9 @@  discard block
 block discarded – undo
2354 2354
                 // Loop on persoanl items
2355 2355
                 $rows = DB::query(
2356 2356
                     'SELECT id, pw
2357
-                    FROM ' . prefixTable('items') . '
2357
+                    FROM ' . prefixTable('items').'
2358 2358
                     WHERE perso = 1 AND id_tree IN %ls
2359
-                    LIMIT ' . $post_start . ', ' . $post_length,
2359
+                    LIMIT ' . $post_start.', '.$post_length,
2360 2360
                     $_SESSION['personal_folders']
2361 2361
                 );
2362 2362
                 $countUserPersonalItems = DB::count();
@@ -2399,7 +2399,7 @@  discard block
 block discarded – undo
2399 2399
                         // Loop on files
2400 2400
                         $rows = DB::query(
2401 2401
                             'SELECT id, file
2402
-                            FROM ' . prefixTable('files') . '
2402
+                            FROM ' . prefixTable('files').'
2403 2403
                             WHERE status != %s
2404 2404
                             AND id_item = %i',
2405 2405
                             TP_ENCRYPTION_NAME,
@@ -2410,14 +2410,14 @@  discard block
 block discarded – undo
2410 2410
                             // Now decrypt the file
2411 2411
                             prepareFileWithDefuse(
2412 2412
                                 'decrypt',
2413
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2414
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2413
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2414
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2415 2415
                                 $SETTINGS,
2416 2416
                                 $post_user_psk
2417 2417
                             );
2418 2418
 
2419 2419
                             // Encrypt the file
2420
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2420
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2421 2421
 
2422 2422
                             DB::update(
2423 2423
                                 prefixTable('files'),
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
                             );
2441 2441
 
2442 2442
                             // Unlink original file
2443
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2443
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2444 2444
                         }
2445 2445
                     }
2446 2446
                 }
@@ -2509,7 +2509,7 @@  discard block
 block discarded – undo
2509 2509
         // Get user info
2510 2510
         $userData = DB::queryFirstRow(
2511 2511
             'SELECT '.$post_fields.'
2512
-            FROM ' . prefixTable('users') . '
2512
+            FROM ' . prefixTable('users').'
2513 2513
             WHERE id = %i',
2514 2514
             $post_user_id
2515 2515
         );
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
         // Get user info
2545 2545
         $userData = DB::queryFirstRow(
2546 2546
             'SELECT auth_type, login, private_key
2547
-            FROM ' . prefixTable('users') . '
2547
+            FROM ' . prefixTable('users').'
2548 2548
             WHERE id = %i',
2549 2549
             $post_user_id
2550 2550
         );
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
             $privateKey = decryptPrivateKey($post_current_pwd, $userData['private_key']);
2556 2556
 
2557 2557
             // Load superGlobals
2558
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2558
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2559 2559
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2560 2560
 
2561 2561
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2588,7 +2588,7 @@  discard block
 block discarded – undo
2588 2588
                 return prepareExchangedData(
2589 2589
                     array(
2590 2590
                         'error' => false,
2591
-                        'message' => langHdl('done'),'',
2591
+                        'message' => langHdl('done'), '',
2592 2592
                     ),
2593 2593
                     'encode'
2594 2594
                 );
@@ -2626,7 +2626,7 @@  discard block
 block discarded – undo
2626 2626
         // Get user info
2627 2627
         $userData = DB::queryFirstRow(
2628 2628
             'SELECT auth_type, login, private_key, special
2629
-            FROM ' . prefixTable('users') . '
2629
+            FROM ' . prefixTable('users').'
2630 2630
             WHERE id = %i',
2631 2631
             $post_user_id
2632 2632
         );
@@ -2656,14 +2656,14 @@  discard block
 block discarded – undo
2656 2656
                 );
2657 2657
 
2658 2658
                 // Load superGlobals
2659
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2659
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2660 2660
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2661 2661
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2662 2662
 
2663 2663
                 return prepareExchangedData(
2664 2664
                     array(
2665 2665
                         'error' => false,
2666
-                        'message' => langHdl('done'),'',
2666
+                        'message' => langHdl('done'), '',
2667 2667
                     ),
2668 2668
                     'encode'
2669 2669
                 );
@@ -2687,14 +2687,14 @@  discard block
 block discarded – undo
2687 2687
             // Get one item
2688 2688
             $record = DB::queryFirstRow(
2689 2689
                 'SELECT id, pw
2690
-                FROM ' . prefixTable('items') . '
2690
+                FROM ' . prefixTable('items').'
2691 2691
                 WHERE perso = 0'
2692 2692
             );
2693 2693
 
2694 2694
             // Get itemKey from current user
2695 2695
             $currentUserKey = DB::queryFirstRow(
2696 2696
                 'SELECT share_key, increment_id
2697
-                FROM ' . prefixTable('sharekeys_items') . '
2697
+                FROM ' . prefixTable('sharekeys_items').'
2698 2698
                 WHERE object_id = %i AND user_id = %i',
2699 2699
                 $record['id'],
2700 2700
                 $post_user_id
@@ -2722,7 +2722,7 @@  discard block
 block discarded – undo
2722 2722
                     );
2723 2723
                     
2724 2724
                     // Load superGlobals
2725
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2725
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2726 2726
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2727 2727
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2728 2728
 
@@ -2776,7 +2776,7 @@  discard block
 block discarded – undo
2776 2776
             $_SESSION['user_id']
2777 2777
         );
2778 2778
         // Return data
2779
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
2779
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
2780 2780
     }
2781 2781
     
2782 2782
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
includes/core/load.js.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                                     console.log('User has to regenerate keys')
118 118
                                     // HIde
119 119
                                     $('.content-header, .content').addClass('hidden');
120
-                                    $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected');?>');
120
+                                    $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected'); ?>');
121 121
 
122 122
                                     // Show passwords inputs and form
123 123
                                     $('#dialog-user-temporary-code').removeClass('hidden');
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
                                     // Show passwords inputs and form
133 133
                                     $('#dialog-user-change-password-info')
134
-                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('user_has_to_change_password_info');?>')
134
+                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('user_has_to_change_password_info'); ?>')
135 135
                                         .removeClass('hidden');
136 136
                                     $('#dialog-user-change-password').removeClass('hidden');
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
                                     // Show passwords inputs and form
146 146
                                     $('#dialog-ldap-user-change-password-info')
147
-                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('ldap_user_has_changed_his_password');?>')
147
+                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('ldap_user_has_changed_his_password'); ?>')
148 148
                                         .removeClass('hidden');
149 149
                                     $('#dialog-ldap-user-change-password').removeClass('hidden');
150 150
                                     
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         console.log('User has to regenerate keys')
219 219
         // HIde
220 220
         $('.content-header, .content').addClass('hidden');
221
-        $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected');?>');
221
+        $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected'); ?>');
222 222
 
223 223
         // Show passwords inputs and form
224 224
         $('#dialog-user-temporary-code').removeClass('hidden');
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             {
297 297
                 if (step === 'psk') {
298 298
                     // Inform user
299
-                    $("#user-current-defuse-psk-progress").html('<b><?php echo langHdl('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' +
299
+                    $("#user-current-defuse-psk-progress").html('<b><?php echo langHdl('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' +
300 300
                         '... <?php echo langHdl('please_wait'); ?><i class="fas fa-spinner fa-pulse ml-3 text-primary"></i>');
301 301
 
302 302
                     var data = {'userPsk' : $('#user-current-defuse-psk').val()};
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         "sources/main.queries.php", {
306 306
                             type: "user_psk_reencryption",
307 307
                             'start': start,
308
-                            'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
308
+                            'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
309 309
                             userId: userId,
310 310
                             data: prepareExchangedData(JSON.stringify(data), "encode", "<?php echo $_SESSION['key']; ?>"),
311 311
                             key: '<?php echo $_SESSION['key']; ?>'
@@ -794,15 +794,15 @@  discard block
 block discarded – undo
794 794
             // Prepare data
795 795
             var data = {
796 796
                 'receipt': $('#temp-user-email').val(),
797
-                'subject': '[Teampass] <?php echo langHdl('your_new_password');?>',
798
-                'body': '<?php echo langHdl('email_body_temporary_login_password');?>',
797
+                'subject': '[Teampass] <?php echo langHdl('your_new_password'); ?>',
798
+                'body': '<?php echo langHdl('email_body_temporary_login_password'); ?>',
799 799
                 'pre_replace' : {
800 800
                     '#enc_code#' : $('#temp-user-pwd').val(),
801 801
                 }
802 802
             }
803 803
             console.log(data);
804 804
             // Prepare form
805
-            $('#dialog-admin-change-user-password-info').html('<?php echo langHdl('sending_email_message');?>');
805
+            $('#dialog-admin-change-user-password-info').html('<?php echo langHdl('sending_email_message'); ?>');
806 806
             toastr.remove();
807 807
             toastr.info(
808 808
                 '<?php echo langHdl('in_progress'); ?><i class="fas fa-circle-notch fa-spin fa-2x ml-3"></i>'
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
             '#warningModal',
1271 1271
             '<i class="fas fa-clock fa-lg warning mr-2"></i><?php echo langHdl('index_add_one_hour'); ?>',
1272 1272
             '<div class="form-group">' +
1273
-            '<label for="warningModal-input" class="col-form-label"><?php echo langHdl('index_session_duration') . ' (' . langHdl('minutes') . ')'; ?>:</label>' +
1273
+            '<label for="warningModal-input" class="col-form-label"><?php echo langHdl('index_session_duration').' ('.langHdl('minutes').')'; ?>:</label>' +
1274 1274
             '<input type="text" class="form-control" id="warningModal-input" value="<?php echo isset($_SESSION['user']['session_duration']) === true ? (int) $_SESSION['user']['session_duration'] / 60 : 60; ?>">' +
1275 1275
             '</div>',
1276 1276
             '<?php echo langHdl('confirm'); ?>',
@@ -1522,13 +1522,13 @@  discard block
 block discarded – undo
1522 1522
         if (step !== 'finished') {
1523 1523
             // Inform user
1524 1524
             $("#"+divIdDialog+'-progress').html('<b><?php echo langHdl('encryption_keys'); ?> - ' +
1525
-                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' +
1525
+                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' +
1526 1526
                 '... <?php echo langHdl('please_wait'); ?><i class="fas fa-spinner fa-pulse ml-3 text-primary"></i>');
1527 1527
 
1528 1528
             var data = {
1529 1529
                 'action': step,
1530 1530
                 'start': start,
1531
-                'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
1531
+                'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
1532 1532
                 'user_id': userId,
1533 1533
             }
1534 1534
             // Do query
Please login to merge, or discard this patch.