Passed
Pull Request — master (#4765)
by Nils
05:55
created
sources/find.queries.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 ) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 if (null === $session->get('user-accessible_folders')
93 93
     || empty($session->get('user-accessible_folders')) === true
94 94
 ) {
95
-    echo '{"sEcho": ' . $request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
95
+    echo '{"sEcho": '.$request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
96 96
     exit;
97 97
 }
98 98
 
99 99
 //Columns name
100
-$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data'];//
100
+$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data']; //
101 101
 $aSortTypes = ['ASC', 'DESC'];
102 102
 //init SQL variables
103 103
 $sOrder = $sLimit = $sWhere = '';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 //Get current user "personal folder" ID
119 119
 $row = DB::query(
120
-    'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i',
120
+    'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i',
121 121
     intval($session->get('user-id'))
122 122
 );
123 123
 //get list of personal folders
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 $listPf = '';
127 127
 if (empty($row['id']) === false) {
128 128
     $rows = DB::query(
129
-        'SELECT id FROM ' . prefixTable('nested_tree') . '
129
+        'SELECT id FROM '.prefixTable('nested_tree').'
130 130
         WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i',
131 131
         filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT),
132 132
         filter_var($session->get('user-id'), FILTER_SANITIZE_NUMBER_INT)
133 133
     );
134 134
     foreach ($rows as $record) {
135
-        if (! in_array($record['id'], $arrayPf)) {
135
+        if (!in_array($record['id'], $arrayPf)) {
136 136
             //build an array of personal folders ids
137 137
             array_push($arrayPf, $record['id']);
138 138
             //build also a string with those ids
139 139
             if (empty($listPf)) {
140 140
                 $listPf = $record['id'];
141 141
             } else {
142
-                $listPf .= ', ' . $record['id'];
142
+                $listPf .= ', '.$record['id'];
143 143
             }
144 144
         }
145 145
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 //Paging
150 150
 $sLimit = '';
151 151
 if (null !== $request->query->get('start') && $request->query->get('length') !== '-1') {
152
-    $sLimit = 'LIMIT ' . $request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT) . ', ' . $request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT) . '';
152
+    $sLimit = 'LIMIT '.$request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT).', '.$request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT).'';
153 153
 }
154 154
 
155 155
 //Ordering
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
     }
164 164
     $sOrder = 'ORDER BY  ';
165 165
     if ($orderParam[0]['column'] >= 0) {
166
-        $sOrder .= '' . $aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
167
-                . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . ', ';
166
+        $sOrder .= ''.$aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
167
+                . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS).', ';
168 168
     }
169 169
 
170 170
     $sOrder = substr_replace($sOrder, '', -2);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $sOrder = '';
173 173
     }
174 174
 } else {
175
-    $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC';
175
+    $sOrder = 'ORDER BY '.$aColumns[1].' ASC';
176 176
 }
177 177
 
178 178
 // Define criteria
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 if (empty($search_criteria) === false) {
197 197
     $sWhere .= ' AND (';
198 198
     for ($i = 0; $i < count($aColumns); ++$i) {
199
-        $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR ';
199
+        $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR ';
200 200
     }
201
-    $sWhere = substr_replace((string) $sWhere, '', -3) . ') ';
201
+    $sWhere = substr_replace((string) $sWhere, '', -3).') ';
202 202
     $crit = [
203 203
         'idtree' => array_unique($folders),
204 204
         '0' => $search_criteria,
@@ -235,16 +235,16 @@  discard block
 block discarded – undo
235 235
 
236 236
 // Do NOT show the items in PERSONAL FOLDERS
237 237
 if (empty($listPf) === false) {
238
-    $sWhere = 'WHERE ' . $sWhere . ' AND c.id_tree NOT IN %ls_pf ';
238
+    $sWhere = 'WHERE '.$sWhere.' AND c.id_tree NOT IN %ls_pf ';
239 239
 } else {
240
-    $sWhere = 'WHERE ' . $sWhere;
240
+    $sWhere = 'WHERE '.$sWhere;
241 241
 }
242 242
 
243 243
 // Do queries
244 244
 DB::query(
245 245
     "SELECT c.id
246
-    FROM " . prefixTable('cache') . " AS c
247
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
246
+    FROM " . prefixTable('cache')." AS c
247
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
248 248
     {$sWhere}
249 249
     {$sOrder}",
250 250
     $crit
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 $iTotal = DB::count();
253 253
 $rows = DB::query(
254 254
     "SELECT c.*, ci.data, i.item_key
255
-    FROM " . prefixTable('cache') . " AS c
256
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
257
-    INNER JOIN " . prefixTable('items') . " AS i ON (i.id = c.id)
255
+    FROM " . prefixTable('cache')." AS c
256
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
257
+    INNER JOIN " . prefixTable('items')." AS i ON (i.id = c.id)
258 258
     {$sWhere}
259 259
     {$sOrder}
260 260
     {$sLimit}",
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 if (null === $request->query->get('type')) {
280 280
     $sOutput = '{';
281 281
     if (null !== $request->query->get('draw')) {
282
-        $sOutput .= '"draw": ' . $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
282
+        $sOutput .= '"draw": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
283 283
     }
284 284
     $sOutput .= '"data": [';
285 285
     $sOutputConst = '';
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             foreach (explode(';', $session->get('user-roles')) as $role) {
297 297
                 //db::debugmode(true);
298 298
                 $access = DB::queryFirstRow(
299
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
299
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
300 300
                     $role,
301 301
                     $record['id_tree']
302 302
                 );
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
             $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel;
318 318
             if ($accessLevel === 0) {
319
-                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">';
319
+                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">';
320 320
             }
321 321
 
322 322
             if ((int) $accessLevel === 0) {
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
             if (empty($restrictedTo)) {
357 357
                 $restrictedTo = $session->get('user-id');
358 358
             } else {
359
-                $restrictedTo .= ',' . $session->get('user-id');
359
+                $restrictedTo .= ','.$session->get('user-id');
360 360
             }
361 361
         }
362 362
         
363 363
         //col1
364
-        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . $lang->get('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>' .
365
-        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . stripslashes($lang->get('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 . '",' ;
364
+        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.$lang->get('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>'.
365
+        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.stripslashes($lang->get('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.'",';
366 366
         //col2
367
-        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-' . $record['id'] . '\">' . (str_replace("\\", "&#92;", (string) $record['label'])) . '</span>').'", ';   // replace backslash #3015
367
+        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-'.$record['id'].'\">'.(str_replace("\\", "&#92;", (string) $record['label'])).'</span>').'", '; // replace backslash #3015
368 368
         //col3
369
-        $sOutputItem .= '"' . base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))) . '", ';
369
+        $sOutputItem .= '"'.base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))).'", ';
370 370
         //col4
371 371
         //get restriction from ROles
372 372
         $restrictedToRole = false;
373 373
         $rTmp = DB::queryFirstColumn(
374
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i',
374
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i',
375 375
             $record['id']
376 376
         );
377 377
         // We considere here that if user has at least one group similar to the object ones
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
         } else {
390 390
             $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description']));
391 391
             if (strlen($txt) > 50) {
392
-                $sOutputItem .= '"' . base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)) . '", ';
392
+                $sOutputItem .= '"'.base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)).'", ';
393 393
             } else {
394
-                $sOutputItem .= '"' . base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))) . '", ';
394
+                $sOutputItem .= '"'.base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))).'", ';
395 395
             }
396 396
         }
397 397
 
398 398
         //col5 - TAGS
399
-        $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)) . '", ';
399
+        $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)).'", ';
400 400
         // col6 - URL
401 401
         if ($record['url'] !== '0') {
402 402
             $sOutputItem .= '"'.htmlspecialchars(filter_var($record['url'], FILTER_SANITIZE_URL)).'", ';
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         }
406 406
 
407 407
         //col7 - Prepare the Treegrid
408
-        $sOutputItem .= '"' . base64_encode(stripslashes((string) $record['folder'])) . '"';
408
+        $sOutputItem .= '"'.base64_encode(stripslashes((string) $record['folder'])).'"';
409 409
         //Finish the line
410 410
         //$sOutputItem .= '], ';
411 411
         if ($getItemInList === true) {
@@ -414,17 +414,17 @@  discard block
 block discarded – undo
414 414
             --$iTotal;
415 415
         }
416 416
     }
417
-    if (! empty($sOutputConst)) {
417
+    if (!empty($sOutputConst)) {
418 418
         $sOutput .= substr_replace($sOutputConst, '', -2);
419 419
     }
420 420
     $sOutput .= '], ';
421
-    $sOutput .= '"recordsTotal": ' . $iTotal . ', ';
422
-    $sOutput .= '"recordsFiltered": ' . $iTotal . ' }';
421
+    $sOutput .= '"recordsTotal": '.$iTotal.', ';
422
+    $sOutput .= '"recordsFiltered": '.$iTotal.' }';
423 423
     // file deepcode ignore XSS: data is secured
424 424
     echo ($sOutput);
425 425
 } elseif (null !== $request->query->get('type') && ($request->query->get('type') === 'search_for_items' || $request->query->get('type') === 'search_for_items_with_tags')) {
426 426
     include_once 'main.functions.php';
427
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
427
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
428 428
 
429 429
     $totalItems = $request->query->filter('totalItems', null, FILTER_SANITIZE_NUMBER_INT);
430 430
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         $arr_data[$record['id']]['tree_id'] = (int) $record['id_tree'];
436 436
         $arr_data[$record['id']]['label'] = (string) $record['label'];
437 437
         $arr_data[$record['id']]['desc'] = (string) strip_tags(explode('<br>', $record['description'])[0]);
438
-        $arr_data[$record['id']]['folder'] = (string)$record['folder'];
438
+        $arr_data[$record['id']]['folder'] = (string) $record['folder'];
439 439
         $arr_data[$record['id']]['login'] = (string) strtr($record['login'], '"', '&quot;');
440 440
         $arr_data[$record['id']]['item_key'] = (string) $record['item_key'];
441 441
         $arr_data[$record['id']]['link'] = (string) $record['url'] !== '0' && empty($record['url']) === false ? filter_var($record['url'], FILTER_SANITIZE_URL) : '';
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
         // Anyone can modify?
450 450
         $tmp = DB::queryFirstRow(
451
-            'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i',
451
+            'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i',
452 452
             $record['id']
453 453
         );
454 454
         if (count($tmp) > 0) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles)
480 480
         $user_is_included_in_role = 0;
481 481
         $roles = DB::query(
482
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i',
482
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i',
483 483
             $record['id']
484 484
         );
485 485
         if (count($roles) > 0) {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             if (empty($restrictedTo)) {
503 503
                 $restrictedTo = $session->get('user-id');
504 504
             } else {
505
-                $restrictedTo .= ',' . $session->get('user-id');
505
+                $restrictedTo .= ','.$session->get('user-id');
506 506
             }
507 507
         }
508 508
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
             $arrTmp = [];
601 601
             foreach (explode(';', $session->get('user-roles')) as $role) {
602 602
                 $access = DB::queryFirstRow(
603
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
603
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
604 604
                     $role,
605 605
                     $record['id_tree']
606 606
                 );
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
         ) {
652 652
             $data_item = DB::queryFirstRow(
653 653
                 'SELECT i.pw AS pw, s.share_key AS share_key
654
-                FROM ' . prefixTable('items') . ' AS i
655
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
654
+                FROM ' . prefixTable('items').' AS i
655
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
656 656
                 WHERE i.id = %i AND s.user_id = %i',
657 657
                 $record['id'],
658 658
                 $session->get('user-id')
Please login to merge, or discard this patch.
scripts/task_maintenance_clean_orphan_objects.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -72,37 +72,37 @@
 block discarded – undo
72 72
 {
73 73
     // Delete all item keys for which no user exist
74 74
     DB::query(
75
-        'DELETE k.* FROM ' . prefixTable('sharekeys_items') . ' k
76
-        LEFT JOIN ' . prefixTable('users') . ' u ON k.user_id = u.id
75
+        'DELETE k.* FROM '.prefixTable('sharekeys_items').' k
76
+        LEFT JOIN ' . prefixTable('users').' u ON k.user_id = u.id
77 77
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
78 78
     );
79 79
 
80 80
     // Delete all files keys for which no item exist
81 81
     DB::query(
82
-        'DELETE k.* FROM ' . prefixTable('sharekeys_files') . ' k
83
-        LEFT JOIN ' . prefixTable('items') . ' i ON k.object_id = i.id
82
+        'DELETE k.* FROM '.prefixTable('sharekeys_files').' k
83
+        LEFT JOIN ' . prefixTable('items').' i ON k.object_id = i.id
84 84
         WHERE i.id IS NULL'
85 85
     );
86 86
 
87 87
     // Delete all fields keys for which no item exist
88 88
     DB::query(
89
-        'DELETE k.* FROM ' . prefixTable('sharekeys_fields') . ' k
90
-        LEFT JOIN ' . prefixTable('categories_items') . ' c ON k.object_id = c.id
91
-        LEFT JOIN ' . prefixTable('items') . ' i ON c.item_id = i.id
89
+        'DELETE k.* FROM '.prefixTable('sharekeys_fields').' k
90
+        LEFT JOIN ' . prefixTable('categories_items').' c ON k.object_id = c.id
91
+        LEFT JOIN ' . prefixTable('items').' i ON c.item_id = i.id
92 92
         WHERE c.id IS NULL OR i.id IS NULL'
93 93
     );
94 94
 
95 95
     // Delete all item logs for which no user exist
96 96
     DB::query(
97
-        'DELETE l.* FROM ' . prefixTable('log_items') . ' l
98
-        LEFT JOIN ' . prefixTable('items') . ' i ON l.id_item = i.id
97
+        'DELETE l.* FROM '.prefixTable('log_items').' l
98
+        LEFT JOIN ' . prefixTable('items').' i ON l.id_item = i.id
99 99
         WHERE i.id IS NULL'
100 100
     );
101 101
 
102 102
     // Delete all system logs for which no user exist
103 103
     DB::query(
104
-        'DELETE l.* FROM ' . prefixTable('log_system') . ' l
105
-        LEFT JOIN ' . prefixTable('users') . ' u ON l.qui = u.id
104
+        'DELETE l.* FROM '.prefixTable('log_system').' l
105
+        LEFT JOIN ' . prefixTable('users').' u ON l.qui = u.id
106 106
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
107 107
     );
108 108
 
Please login to merge, or discard this patch.
scripts/task_maintenance_purge_old_files.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 {
74 74
     global $SETTINGS;
75 75
     // Load expected files
76
-    require_once __DIR__. '/../sources/main.functions.php';
76
+    require_once __DIR__.'/../sources/main.functions.php';
77 77
     $SETTINGS = $SETTINGS ?? [];
78 78
 
79 79
     // $SETTINGS is set then read folder
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             //delete file FILES
84 84
             while (false !== ($f = readdir($dir))) {
85 85
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
86
-                    $filePath = $SETTINGS['path_to_files_folder'] . '/' . $f;
86
+                    $filePath = $SETTINGS['path_to_files_folder'].'/'.$f;
87 87
                     if (file_exists($filePath) && ((time() - filectime($filePath)) > 604800)) {
88 88
                         fileDelete($filePath, $SETTINGS);
89 89
                     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             while (false !== ($f = readdir($dir))) {
105 105
                 if ($f !== '.' && $f !== '..') {
106 106
                     if (strpos($f, '_delete.') > 0) {
107
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
107
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
108 108
                     }
109 109
                 }
110 110
             }
Please login to merge, or discard this patch.
sources/items.queries.php 2 patches
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1234,7 +1234,9 @@  discard block
 block discarded – undo
1234 1234
                 );
1235 1235
 
1236 1236
                 // Create a task to create sharekeys for users
1237
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1237
+                if (WIP=== true) {
1238
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1239
+                }
1238 1240
                 $tasksToBePerformed = ['item_password'];
1239 1241
                 $encryptionTaskIsRequested = true;
1240 1242
             } else {
@@ -1554,7 +1556,9 @@  discard block
 block discarded – undo
1554 1556
 
1555 1557
             // create a task for all fields updated
1556 1558
             if ($encryptionTaskIsRequested === true) {
1557
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1559
+                if (WIP === true) {
1560
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1561
+                }
1558 1562
                 createTaskForItem(
1559 1563
                     'item_update_create_keys',
1560 1564
                     array_unique($tasksToBePerformed),
@@ -2055,7 +2059,9 @@  discard block
 block discarded – undo
2055 2059
                 $inputData['itemId']
2056 2060
             );
2057 2061
             foreach ($rows as $record) {
2058
-                if ($record['raison'] === NULL) continue;
2062
+                if ($record['raison'] === NULL) {
2063
+                    continue;
2064
+                }
2059 2065
                 $reason = explode(':', $record['raison']);
2060 2066
                 if (count($reason) > 0) {
2061 2067
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4757,8 +4763,9 @@  discard block
 block discarded – undo
4757 4763
                 $ids = $tree->getDescendants($folder['id'], true, false, true);
4758 4764
 
4759 4765
                 // This folder is owned by user
4760
-                if (in_array($inputData['folderId'], $ids))
4761
-                    $accessLevel = 30;
4766
+                if (in_array($inputData['folderId'], $ids)) {
4767
+                                    $accessLevel = 30;
4768
+                }
4762 4769
             }
4763 4770
         }
4764 4771
 
Please login to merge, or discard this patch.
Spacing   +276 added lines, -277 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     date_default_timezone_set('UTC');
105 105
 }
106 106
 
107
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
107
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
108 108
 header('Content-type: text/html; charset=utf-8');
109 109
 header('Cache-Control: no-cache, must-revalidate');
110 110
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             // About special settings
366 366
             $dataFolderSettings = DB::queryFirstRow(
367 367
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
368
-                FROM ' . prefixTable('nested_tree') . ' 
368
+                FROM ' . prefixTable('nested_tree').' 
369 369
                 WHERE id = %i',
370 370
                 $inputData['folderId']
371 371
             );
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             // Get folder complexity
383 383
             $folderComplexity = DB::queryFirstRow(
384 384
                 'SELECT valeur
385
-                FROM ' . prefixTable('misc') . '
385
+                FROM ' . prefixTable('misc').'
386 386
                 WHERE type = %s AND intitule = %i',
387 387
                 'complex',
388 388
                 $inputData['folderId']
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             $itemExists = 0;
408 408
             $newID = '';
409 409
             $data = DB::queryFirstRow(
410
-                'SELECT * FROM ' . prefixTable('items') . '
410
+                'SELECT * FROM '.prefixTable('items').'
411 411
                 WHERE label = %s AND inactif = %i',
412 412
                 $inputData['label'],
413 413
                 0
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
                     (int) $post_folder_is_personal,
489 489
                     (int) $newID,
490 490
                     $cryptedStuff['objectKey'],
491
-                    true,   // only for the item creator
492
-                    false,  // no delete all
491
+                    true, // only for the item creator
492
+                    false, // no delete all
493 493
                 );
494 494
 
495 495
                 // update fields
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                             // should we encrypt the data
503 503
                             $dataTmp = DB::queryFirstRow(
504 504
                                 'SELECT encrypted_data
505
-                                FROM ' . prefixTable('categories') . '
505
+                                FROM ' . prefixTable('categories').'
506 506
                                 WHERE id = %i',
507 507
                                 $field['id']
508 508
                             );
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
                                     (int) $post_folder_is_personal,
532 532
                                     (int) $newObjectId,
533 533
                                     $cryptedStuff['objectKey'],
534
-                                    true,   // only for the item creator
535
-                                    false,  // no delete all
534
+                                    true, // only for the item creator
535
+                                    false, // no delete all
536 536
                                 );
537 537
 
538 538
                                 array_push(
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                 ) {
569 569
                     DB::queryFirstRow(
570 570
                         'SELECT *
571
-                        FROM ' . prefixTable('templates') . '
571
+                        FROM ' . prefixTable('templates').'
572 572
                         WHERE item_id = %i',
573 573
                         $newID
574 574
                     );
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
                 ) {
638 638
                     foreach ($post_restricted_to as $userRest) {
639 639
                         if (empty($userRest) === false) {
640
-                            $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
640
+                            $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
641 641
                             if (empty($listOfRestricted)) {
642 642
                                 $listOfRestricted = $dataTmp['login'];
643 643
                             } else {
644
-                                $listOfRestricted .= ';' . $dataTmp['login'];
644
+                                $listOfRestricted .= ';'.$dataTmp['login'];
645 645
                             }
646 646
                         }
647 647
                     }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                             if (empty($userRest) === false) {
658 658
                                 $dataTmp = DB::queryFirstRow(
659 659
                                     'SELECT login
660
-                                    FROM ' . prefixTable('users') . '
660
+                                    FROM ' . prefixTable('users').'
661 661
                                     WHERE id= %i',
662 662
                                     $userRest
663 663
                                 );
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                                 if (empty($oldRestrictionList) === true) {
666 666
                                     $oldRestrictionList = $dataTmp['login'];
667 667
                                 } else {
668
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
668
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
669 669
                                 }
670 670
                             }
671 671
                         }
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
                 if (empty($post_uploaded_file_id) === false) {
729 729
                     $rows = DB::query(
730 730
                         'SELECT id
731
-                        FROM ' . prefixTable('files') . '
731
+                        FROM ' . prefixTable('files').'
732 732
                         WHERE id_item = %s',
733 733
                         $post_uploaded_file_id
734 734
                     );
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
                                     $lang->get('email_subject_item_updated'),
785 785
                                     str_replace(
786 786
                                         array('#label', '#link'),
787
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']),
787
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']),
788 788
                                             $lang->get('new_item_email_body')
789 789
                                     ),
790 790
                                     $emailAddress,
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
         // Prepare variables
889 889
         $itemInfos = array();
890 890
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
891
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
891
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
892 892
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
893 893
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
894
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
895
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
894
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
895
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896 896
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
897 897
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
898 898
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -923,8 +923,7 @@  discard block
 block discarded – undo
923 923
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
924 924
                 $dataReceived['to_be_deleted_after_date'],
925 925
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
926
-            ) :
927
-            '';
926
+            ) : '';
928 927
         $post_fields = (filter_var_array(
929 928
             $dataReceived['fields'],
930 929
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -984,7 +983,7 @@  discard block
 block discarded – undo
984 983
         // About special settings
985 984
         $dataFolderSettings = DB::queryFirstRow(
986 985
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
987
-            FROM ' . prefixTable('nested_tree') . ' 
986
+            FROM ' . prefixTable('nested_tree').' 
988 987
             WHERE id = %i',
989 988
             $inputData['folderId']
990 989
         );
@@ -1000,7 +999,7 @@  discard block
 block discarded – undo
1000 999
         // Get folder complexity
1001 1000
         $folderComplexity = DB::queryFirstRow(
1002 1001
             'SELECT valeur
1003
-            FROM ' . prefixTable('misc') . '
1002
+            FROM ' . prefixTable('misc').'
1004 1003
             WHERE type = %s AND intitule = %i',
1005 1004
             'complex',
1006 1005
             $inputData['folderId']
@@ -1045,8 +1044,8 @@  discard block
 block discarded – undo
1045 1044
         // Get all informations for this item
1046 1045
         $dataItem = DB::queryFirstRow(
1047 1046
             'SELECT *
1048
-            FROM ' . prefixTable('items') . ' as i
1049
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1047
+            FROM ' . prefixTable('items').' as i
1048
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1050 1049
             WHERE i.id=%i AND l.action = %s',
1051 1050
             $inputData['itemId'],
1052 1051
             'at_creation'
@@ -1089,7 +1088,7 @@  discard block
 block discarded – undo
1089 1088
         //db::debugmode(true);
1090 1089
         DB::query(
1091 1090
             'SELECT *
1092
-            FROM ' . prefixTable('sharekeys_items') . '
1091
+            FROM ' . prefixTable('sharekeys_items').'
1093 1092
             WHERE object_id = %i AND user_id = %s',
1094 1093
             $inputData['itemId'],
1095 1094
             $session->get('user-id')
@@ -1149,9 +1148,9 @@  discard block
 block discarded – undo
1149 1148
                 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1150 1149
                 i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1151 1150
                 u.login as user_login, u.email as user_email
1152
-                FROM ' . prefixTable('items') . ' as i
1153
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1154
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1151
+                FROM ' . prefixTable('items').' as i
1152
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1153
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1155 1154
                 WHERE i.id=%i',
1156 1155
                 $inputData['itemId']
1157 1156
             );
@@ -1159,7 +1158,7 @@  discard block
 block discarded – undo
1159 1158
             // Should we log a password change?
1160 1159
             $userKey = DB::queryFirstRow(
1161 1160
                 'SELECT share_key
1162
-                FROM ' . prefixTable('sharekeys_items') . '
1161
+                FROM ' . prefixTable('sharekeys_items').'
1163 1162
                 WHERE user_id = %i AND object_id = %i',
1164 1163
                 $session->get('user-id'),
1165 1164
                 $inputData['itemId']
@@ -1223,12 +1222,12 @@  discard block
 block discarded – undo
1223 1222
                     (int) $post_folder_is_personal,
1224 1223
                     (int) $inputData['itemId'],
1225 1224
                     $encrypted_password_key,
1226
-                    true,   // only for the item creator
1227
-                    true,   // delete all
1225
+                    true, // only for the item creator
1226
+                    true, // delete all
1228 1227
                 );
1229 1228
 
1230 1229
                 // Create a task to create sharekeys for users
1231
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1230
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1232 1231
                 $tasksToBePerformed = ['item_password'];
1233 1232
                 $encryptionTaskIsRequested = true;
1234 1233
             } else {
@@ -1239,7 +1238,7 @@  discard block
 block discarded – undo
1239 1238
             // Get list of tags
1240 1239
             $itemTags = DB::queryFirstColumn(
1241 1240
                 'SELECT tag
1242
-                FROM ' . prefixTable('tags') . '
1241
+                FROM ' . prefixTable('tags').'
1243 1242
                 WHERE item_id = %i',
1244 1243
                 $inputData['itemId']
1245 1244
             );
@@ -1285,7 +1284,7 @@  discard block
 block discarded – undo
1285 1284
                     $session->get('user-id'),
1286 1285
                     'at_modification',
1287 1286
                     $session->get('user-login'),
1288
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1287
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1289 1288
                 );
1290 1289
             }
1291 1290
 
@@ -1325,8 +1324,8 @@  discard block
 block discarded – undo
1325 1324
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1326 1325
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1327 1326
                             c.masked AS masked, i.id AS field_item_id
1328
-                            FROM ' . prefixTable('categories_items') . ' AS i
1329
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1327
+                            FROM ' . prefixTable('categories_items').' AS i
1328
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1330 1329
                             WHERE i.field_id = %i AND i.item_id = %i',
1331 1330
                             $field['id'],
1332 1331
                             $inputData['itemId']
@@ -1342,7 +1341,7 @@  discard block
 block discarded – undo
1342 1341
                             // Perform new query
1343 1342
                             $dataTmpCat = DB::queryFirstRow(
1344 1343
                                 'SELECT id, title, encrypted_data, masked
1345
-                                FROM ' . prefixTable('categories') . '
1344
+                                FROM ' . prefixTable('categories').'
1346 1345
                                 WHERE id = %i',
1347 1346
                                 $field['id']
1348 1347
                             );
@@ -1372,8 +1371,8 @@  discard block
 block discarded – undo
1372 1371
                                     (int) $post_folder_is_personal,
1373 1372
                                     (int) $newId,
1374 1373
                                     $cryptedStuff['objectKey'],
1375
-                                    true,   // only for the item creator
1376
-                                    true,   // delete all
1374
+                                    true, // only for the item creator
1375
+                                    true, // delete all
1377 1376
                                 );
1378 1377
 
1379 1378
                                 // update value
@@ -1423,7 +1422,7 @@  discard block
 block discarded – undo
1423 1422
                                 $session->get('user-id'),
1424 1423
                                 'at_modification',
1425 1424
                                 $session->get('user-login'),
1426
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1425
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1427 1426
                             );
1428 1427
                         } else {
1429 1428
                             // Case where the field already exists
@@ -1432,7 +1431,7 @@  discard block
 block discarded – undo
1432 1431
                                 // Get user sharekey for this field
1433 1432
                                 $userKey = DB::queryFirstRow(
1434 1433
                                     'SELECT share_key
1435
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1434
+                                    FROM ' . prefixTable('sharekeys_fields').'
1436 1435
                                     WHERE user_id = %i AND object_id = %i',
1437 1436
                                     $session->get('user-id'),
1438 1437
                                     $dataTmpCat['field_item_id']
@@ -1471,8 +1470,8 @@  discard block
 block discarded – undo
1471 1470
                                         (int) $post_folder_is_personal,
1472 1471
                                         (int) $dataTmpCat['field_item_id'],
1473 1472
                                         $cryptedStuff['objectKey'],
1474
-                                        true,   // only for the item creator
1475
-                                        true,   // delete all
1473
+                                        true, // only for the item creator
1474
+                                        true, // delete all
1476 1475
                                     );
1477 1476
 
1478 1477
                                     if ($encryptedFieldIsChanged === false) {
@@ -1514,7 +1513,7 @@  discard block
 block discarded – undo
1514 1513
                                     $session->get('user-id'),
1515 1514
                                     'at_modification',
1516 1515
                                     $session->get('user-login'),
1517
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1516
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1518 1517
                                 );
1519 1518
                             }
1520 1519
                         }
@@ -1568,7 +1567,7 @@  discard block
 block discarded – undo
1568 1567
             ) {
1569 1568
                 DB::queryFirstRow(
1570 1569
                     'SELECT *
1571
-                    FROM ' . prefixTable('templates') . '
1570
+                    FROM ' . prefixTable('templates').'
1572 1571
                     WHERE item_id = %i',
1573 1572
                     $inputData['itemId']
1574 1573
                 );
@@ -1611,7 +1610,7 @@  discard block
 block discarded – undo
1611 1610
                 // check if elem exists in Table. If not add it or update it.
1612 1611
                 DB::query(
1613 1612
                     'SELECT *
1614
-                    FROM ' . prefixTable('automatic_del') . '
1613
+                    FROM ' . prefixTable('automatic_del').'
1615 1614
                     WHERE item_id = %i',
1616 1615
                     $inputData['itemId']
1617 1616
                 );
@@ -1638,7 +1637,7 @@  discard block
 block discarded – undo
1638 1637
                         // Store updates performed
1639 1638
                         array_push(
1640 1639
                             $arrayOfChanges,
1641
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1640
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1642 1641
                         );
1643 1642
 
1644 1643
                         // update LOG
@@ -1681,7 +1680,7 @@  discard block
 block discarded – undo
1681 1680
                         // Store updates performed
1682 1681
                         array_push(
1683 1682
                             $arrayOfChanges,
1684
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1683
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1685 1684
                         );
1686 1685
 
1687 1686
                         // update LOG
@@ -1709,7 +1708,7 @@  discard block
 block discarded – undo
1709 1708
                     if (empty($userId) === false) {
1710 1709
                         $dataTmp = DB::queryFirstRow(
1711 1710
                             'SELECT id, name, lastname
1712
-                            FROM ' . prefixTable('users') . '
1711
+                            FROM ' . prefixTable('users').'
1713 1712
                             WHERE id= %i',
1714 1713
                             $userId
1715 1714
                         );
@@ -1717,7 +1716,7 @@  discard block
 block discarded – undo
1717 1716
                         // Add to array
1718 1717
                         array_push(
1719 1718
                             $arrayOfUsersRestriction,
1720
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1719
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1721 1720
                         );
1722 1721
                         array_push(
1723 1722
                             $arrayOfUsersIdRestriction,
@@ -1748,8 +1747,8 @@  discard block
 block discarded – undo
1748 1747
                 // get values before deleting them
1749 1748
                 $rows = DB::query(
1750 1749
                     'SELECT t.title, t.id AS id
1751
-                    FROM ' . prefixTable('roles_title') . ' as t
1752
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1750
+                    FROM ' . prefixTable('roles_title').' as t
1751
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1753 1752
                     WHERE r.item_id = %i
1754 1753
                     ORDER BY t.title ASC',
1755 1754
                     $inputData['itemId']
@@ -1783,7 +1782,7 @@  discard block
 block discarded – undo
1783 1782
                         );
1784 1783
                         $dataTmp = DB::queryFirstRow(
1785 1784
                             'SELECT title
1786
-                            FROM ' . prefixTable('roles_title') . '
1785
+                            FROM ' . prefixTable('roles_title').'
1787 1786
                             WHERE id = %i',
1788 1787
                             $role
1789 1788
                         );
@@ -1811,7 +1810,7 @@  discard block
 block discarded – undo
1811 1810
             // Get current status
1812 1811
             $otpStatus = DB::queryFirstRow(
1813 1812
                 'SELECT enabled as otp_is_enabled
1814
-                FROM ' . prefixTable('items_otp') . '
1813
+                FROM ' . prefixTable('items_otp').'
1815 1814
                 WHERE item_id = %i',
1816 1815
                 $inputData['itemId']
1817 1816
             );
@@ -1842,7 +1841,7 @@  discard block
 block discarded – undo
1842 1841
                     $session->get('user-id'),
1843 1842
                     'at_modification',
1844 1843
                     $session->get('user-login'),
1845
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1844
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1846 1845
                 );
1847 1846
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1848 1847
                 // Create the entry in items_otp table
@@ -1886,8 +1885,8 @@  discard block
 block discarded – undo
1886 1885
                     $session->get('user-id'),
1887 1886
                     'at_modification',
1888 1887
                     $session->get('user-login'),
1889
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1890
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1888
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1889
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1891 1890
                 );
1892 1891
             }
1893 1892
 
@@ -1907,7 +1906,7 @@  discard block
 block discarded – undo
1907 1906
                     $session->get('user-id'),
1908 1907
                     'at_modification',
1909 1908
                     $session->get('user-login'),
1910
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1909
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1911 1910
                 );
1912 1911
             }
1913 1912
             // LOGIN
@@ -1926,7 +1925,7 @@  discard block
 block discarded – undo
1926 1925
                     $session->get('user-id'),
1927 1926
                     'at_modification',
1928 1927
                     $session->get('user-login'),
1929
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1928
+                    'at_login : '.$data['login'].' => '.$post_login
1930 1929
                 );
1931 1930
             }
1932 1931
             // EMAIL
@@ -1945,7 +1944,7 @@  discard block
 block discarded – undo
1945 1944
                     $session->get('user-id'),
1946 1945
                     'at_modification',
1947 1946
                     $session->get('user-login'),
1948
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1947
+                    'at_email : '.$data['email'].' => '.$post_email
1949 1948
                 );
1950 1949
             }
1951 1950
             // URL
@@ -1964,7 +1963,7 @@  discard block
 block discarded – undo
1964 1963
                     $session->get('user-id'),
1965 1964
                     'at_modification',
1966 1965
                     $session->get('user-login'),
1967
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1966
+                    'at_url : '.$data['url'].' => '.$post_url
1968 1967
                 );
1969 1968
             }
1970 1969
             // DESCRIPTION
@@ -1990,7 +1989,7 @@  discard block
 block discarded – undo
1990 1989
             // FOLDER
1991 1990
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1992 1991
                 // Get name of folders
1993
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1992
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1994 1993
 
1995 1994
                 // Store updates performed
1996 1995
                 array_push(
@@ -2006,7 +2005,7 @@  discard block
 block discarded – undo
2006 2005
                     $session->get('user-id'),
2007 2006
                     'at_modification',
2008 2007
                     $session->get('user-login'),
2009
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2008
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2010 2009
                 );
2011 2010
             }
2012 2011
             // ANYONE_CAN_MODIFY
@@ -2014,7 +2013,7 @@  discard block
 block discarded – undo
2014 2013
                 // Store updates performed
2015 2014
                 array_push(
2016 2015
                     $arrayOfChanges,
2017
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2016
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2018 2017
                 );
2019 2018
 
2020 2019
                 // Log
@@ -2025,15 +2024,15 @@  discard block
 block discarded – undo
2025 2024
                     $session->get('user-id'),
2026 2025
                     'at_modification',
2027 2026
                     $session->get('user-login'),
2028
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2027
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2029 2028
                 );
2030 2029
             }
2031 2030
 
2032 2031
             // Reload new values
2033 2032
             $dataItem = DB::queryFirstRow(
2034 2033
                 'SELECT *
2035
-                FROM ' . prefixTable('items') . ' as i
2036
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2034
+                FROM ' . prefixTable('items').' as i
2035
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2037 2036
                 WHERE i.id = %i AND l.action = %s',
2038 2037
                 $inputData['itemId'],
2039 2038
                 'at_creation'
@@ -2042,8 +2041,8 @@  discard block
 block discarded – undo
2042 2041
             $history = '';
2043 2042
             $rows = DB::query(
2044 2043
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2045
-                FROM ' . prefixTable('log_items') . ' as l
2046
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2044
+                FROM ' . prefixTable('log_items').' as l
2045
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2047 2046
                 WHERE l.action <> %s AND id_item=%s',
2048 2047
                 'at_shown',
2049 2048
                 $inputData['itemId']
@@ -2052,14 +2051,14 @@  discard block
 block discarded – undo
2052 2051
                 if ($record['raison'] === NULL) continue;
2053 2052
                 $reason = explode(':', $record['raison']);
2054 2053
                 if (count($reason) > 0) {
2055
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2056
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2057
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2054
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2055
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2056
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2058 2057
                             : $lang->get(trim($reason[0]))) : '');
2059 2058
                     if (empty($history)) {
2060 2059
                         $history = $sentence;
2061 2060
                     } else {
2062
-                        $history .= '<br />' . $sentence;
2061
+                        $history .= '<br />'.$sentence;
2063 2062
                     }
2064 2063
                 }
2065 2064
             }
@@ -2197,7 +2196,7 @@  discard block
 block discarded – undo
2197 2196
         ) {
2198 2197
             // load the original record into an array
2199 2198
             $originalRecord = DB::queryFirstRow(
2200
-                'SELECT * FROM ' . prefixTable('items') . '
2199
+                'SELECT * FROM '.prefixTable('items').'
2201 2200
                 WHERE id = %i',
2202 2201
                 $inputData['itemId']
2203 2202
             );
@@ -2216,7 +2215,7 @@  discard block
 block discarded – undo
2216 2215
 
2217 2216
             // Load the destination folder record into an array
2218 2217
             $dataDestination = DB::queryFirstRow(
2219
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2218
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2220 2219
                 WHERE id = %i',
2221 2220
                 $post_dest_id
2222 2221
             );
@@ -2224,7 +2223,7 @@  discard block
 block discarded – undo
2224 2223
             // Get the ITEM object key for the user
2225 2224
             $userKey = DB::queryFirstRow(
2226 2225
                 'SELECT share_key
2227
-                FROM ' . prefixTable('sharekeys_items') . '
2226
+                FROM ' . prefixTable('sharekeys_items').'
2228 2227
                 WHERE user_id = %i AND object_id = %i',
2229 2228
                 $session->get('user-id'),
2230 2229
                 $inputData['itemId']
@@ -2301,8 +2300,8 @@  discard block
 block discarded – undo
2301 2300
             // Manage Custom Fields
2302 2301
             $rows = DB::query(
2303 2302
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2304
-                FROM ' . prefixTable('categories_items') . ' AS ci
2305
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2303
+                FROM ' . prefixTable('categories_items').' AS ci
2304
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2306 2305
                 WHERE ci.item_id = %i',
2307 2306
                 $inputData['itemId']
2308 2307
             );
@@ -2314,7 +2313,7 @@  discard block
 block discarded – undo
2314 2313
                     // Get user key
2315 2314
                     $userKey = DB::queryFirstRow(
2316 2315
                         'SELECT share_key
2317
-                        FROM ' . prefixTable('sharekeys_fields') . '
2316
+                        FROM ' . prefixTable('sharekeys_fields').'
2318 2317
                         WHERE user_id = %i AND object_id = %i',
2319 2318
                         $session->get('user-id'),
2320 2319
                         $field['id']
@@ -2381,15 +2380,15 @@  discard block
 block discarded – undo
2381 2380
             $rows = DB::query(
2382 2381
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2383 2382
                 f.size AS size, f.type AS type, s.share_key AS share_key
2384
-                FROM ' . prefixTable('files') . ' AS f
2385
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2383
+                FROM ' . prefixTable('files').' AS f
2384
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2386 2385
                 WHERE s.user_id = %i AND f.id_item = %i',
2387 2386
                 $session->get('user-id'),
2388 2387
                 $inputData['itemId']
2389 2388
             );
2390 2389
             foreach ($rows as $record) {
2391 2390
                 // Check if file still exists
2392
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2391
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2393 2392
                     // Step1 - decrypt the file
2394 2393
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2395 2394
                     $fileContent = decryptFile(
@@ -2400,8 +2399,8 @@  discard block
 block discarded – undo
2400 2399
 
2401 2400
                     // Step2 - create file
2402 2401
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2403
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2404
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2402
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2403
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2405 2404
                     if ($outstream === false) {
2406 2405
                         echo prepareExchangedData(
2407 2406
                             array(
@@ -2474,7 +2473,7 @@  discard block
 block discarded – undo
2474 2473
 
2475 2474
             // -------------------------
2476 2475
             // Add specific restrictions
2477
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2476
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2478 2477
             foreach ($rows as $record) {
2479 2478
                 DB::insert(
2480 2479
                     prefixTable('restriction_to_roles'),
@@ -2486,7 +2485,7 @@  discard block
 block discarded – undo
2486 2485
             }
2487 2486
 
2488 2487
             // Add Tags
2489
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2488
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2490 2489
             foreach ($rows as $record) {
2491 2490
                 DB::insert(
2492 2491
                     prefixTable('tags'),
@@ -2588,7 +2587,7 @@  discard block
 block discarded – undo
2588 2587
         // then we can show it
2589 2588
         $item_deleted = DB::queryFirstRow(
2590 2589
             'SELECT *
2591
-            FROM ' . prefixTable('log_items') . '
2590
+            FROM ' . prefixTable('log_items').'
2592 2591
             WHERE id_item = %i AND action = %s
2593 2592
             ORDER BY date DESC
2594 2593
             LIMIT 0, 1',
@@ -2599,7 +2598,7 @@  discard block
 block discarded – undo
2599 2598
 
2600 2599
         $item_restored = DB::queryFirstRow(
2601 2600
             'SELECT *
2602
-            FROM ' . prefixTable('log_items') . '
2601
+            FROM ' . prefixTable('log_items').'
2603 2602
             WHERE id_item = %i AND action = %s
2604 2603
             ORDER BY date DESC
2605 2604
             LIMIT 0, 1',
@@ -2623,8 +2622,8 @@  discard block
 block discarded – undo
2623 2622
         // Get all informations for this item
2624 2623
         $dataItem = DB::queryFirstRow(
2625 2624
             'SELECT *
2626
-            FROM ' . prefixTable('items') . ' as i
2627
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2625
+            FROM ' . prefixTable('items').' as i
2626
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2628 2627
             WHERE i.id = %i AND l.action = %s',
2629 2628
             $inputData['id'],
2630 2629
             'at_creation'
@@ -2633,7 +2632,7 @@  discard block
 block discarded – undo
2633 2632
         // Notification
2634 2633
         DB::queryFirstRow(
2635 2634
             'SELECT *
2636
-            FROM ' . prefixTable('notification') . '
2635
+            FROM ' . prefixTable('notification').'
2637 2636
             WHERE item_id = %i AND user_id = %i',
2638 2637
             $inputData['id'],
2639 2638
             $session->get('user-id')
@@ -2652,7 +2651,7 @@  discard block
 block discarded – undo
2652 2651
 
2653 2652
         // manage case of API user
2654 2653
         if ($dataItem['id_user'] === API_USER_ID) {
2655
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2654
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2656 2655
             $arrData['id_user'] = API_USER_ID;
2657 2656
             $arrData['author_email'] = '';
2658 2657
             $arrData['notification_status'] = false;
@@ -2662,7 +2661,7 @@  discard block
 block discarded – undo
2662 2661
         $tags = array();
2663 2662
         $rows = DB::query(
2664 2663
             'SELECT tag
2665
-            FROM ' . prefixTable('tags') . '
2664
+            FROM ' . prefixTable('tags').'
2666 2665
             WHERE item_id = %i',
2667 2666
             $inputData['id']
2668 2667
         );
@@ -2687,7 +2686,7 @@  discard block
 block discarded – undo
2687 2686
         // Check if user has a role that is accepted
2688 2687
         $rows_tmp = DB::query(
2689 2688
             'SELECT role_id
2690
-            FROM ' . prefixTable('restriction_to_roles') . '
2689
+            FROM ' . prefixTable('restriction_to_roles').'
2691 2690
             WHERE item_id=%i',
2692 2691
             $inputData['id']
2693 2692
         );
@@ -2701,7 +2700,7 @@  discard block
 block discarded – undo
2701 2700
         // Get the object key for the user
2702 2701
         $userKey = DB::queryFirstRow(
2703 2702
             'SELECT share_key
2704
-            FROM ' . prefixTable('sharekeys_items') . '
2703
+            FROM ' . prefixTable('sharekeys_items').'
2705 2704
             WHERE user_id = %i AND object_id = %i',
2706 2705
             $session->get('user-id'),
2707 2706
             $inputData['id']
@@ -2798,8 +2797,8 @@  discard block
 block discarded – undo
2798 2797
                 // Add restriction if item is restricted to roles
2799 2798
                 $rows = DB::query(
2800 2799
                     'SELECT t.title, t.id
2801
-                    FROM ' . prefixTable('roles_title') . ' AS t
2802
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2800
+                    FROM ' . prefixTable('roles_title').' AS t
2801
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2803 2802
                     WHERE r.item_id = %i
2804 2803
                     ORDER BY t.title ASC',
2805 2804
                     $inputData['id']
@@ -2815,8 +2814,8 @@  discard block
 block discarded – undo
2815 2814
                 $tmp = array();
2816 2815
                 $rows = DB::query(
2817 2816
                     'SELECT k.label, k.id
2818
-                    FROM ' . prefixTable('kb_items') . ' as i
2819
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2817
+                    FROM ' . prefixTable('kb_items').' as i
2818
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2820 2819
                     WHERE i.item_id = %i
2821 2820
                     ORDER BY k.label ASC',
2822 2821
                     $inputData['id']
@@ -2899,7 +2898,7 @@  discard block
 block discarded – undo
2899 2898
                 $arrCatList = array();
2900 2899
                 $rows_tmp = DB::query(
2901 2900
                     'SELECT id_category
2902
-                    FROM ' . prefixTable('categories_folders') . '
2901
+                    FROM ' . prefixTable('categories_folders').'
2903 2902
                     WHERE id_folder=%i',
2904 2903
                     $inputData['folderId']
2905 2904
                 );
@@ -2914,8 +2913,8 @@  discard block
 block discarded – undo
2914 2913
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2915 2914
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2916 2915
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2917
-                        FROM ' . prefixTable('categories_items') . ' AS i
2918
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2916
+                        FROM ' . prefixTable('categories_items').' AS i
2917
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2919 2918
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2920 2919
                         $inputData['id'],
2921 2920
                         $arrCatList
@@ -2926,7 +2925,7 @@  discard block
 block discarded – undo
2926 2925
                         //db::debugmode(true);
2927 2926
                         $userKey = DB::queryFirstRow(
2928 2927
                             'SELECT share_key
2929
-                            FROM ' . prefixTable('sharekeys_fields') . '
2928
+                            FROM ' . prefixTable('sharekeys_fields').'
2930 2929
                             WHERE user_id = %i AND object_id = %i',
2931 2930
                             $session->get('user-id'),
2932 2931
                             $row['id']
@@ -2944,7 +2943,7 @@  discard block
 block discarded – undo
2944 2943
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2945 2944
                             // Data is not encrypted in DB
2946 2945
                             $fieldText = [
2947
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2946
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2948 2947
                                 'encrypted' => false,
2949 2948
                                 'error' => false,
2950 2949
                             ];
@@ -2989,7 +2988,7 @@  discard block
 block discarded – undo
2989 2988
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2990 2989
                 $rows_tmp = DB::queryFirstRow(
2991 2990
                     'SELECT category_id
2992
-                    FROM ' . prefixTable('templates') . '
2991
+                    FROM ' . prefixTable('templates').'
2993 2992
                     WHERE item_id = %i',
2994 2993
                     $inputData['id']
2995 2994
                 );
@@ -3006,7 +3005,7 @@  discard block
 block discarded – undo
3006 3005
             // Evaluate if item is ready for all users
3007 3006
             $rows_tmp = DB::queryFirstRow(
3008 3007
                 'SELECT finished_at
3009
-                FROM ' . prefixTable('background_tasks') . '
3008
+                FROM ' . prefixTable('background_tasks').'
3010 3009
                 WHERE item_id = %i',
3011 3010
                 $inputData['id']
3012 3011
             );
@@ -3023,7 +3022,7 @@  discard block
 block discarded – undo
3023 3022
                 // Is the Item to be deleted?
3024 3023
                 $dataDelete = DB::queryFirstRow(
3025 3024
                     'SELECT * 
3026
-                    FROM ' . prefixTable('automatic_del') . '
3025
+                    FROM ' . prefixTable('automatic_del').'
3027 3026
                     WHERE item_id = %i',
3028 3027
                     $inputData['id']
3029 3028
                 );
@@ -3104,14 +3103,14 @@  discard block
 block discarded – undo
3104 3103
                     if (empty($userRest) === false) {
3105 3104
                         $dataTmp = DB::queryFirstRow(
3106 3105
                             'SELECT login
3107
-                            FROM ' . prefixTable('users') . '
3106
+                            FROM ' . prefixTable('users').'
3108 3107
                             WHERE id= %i',
3109 3108
                             $userRest
3110 3109
                         );
3111 3110
                         if (empty($listOfRestricted)) {
3112 3111
                             $listOfRestricted = $dataTmp['login'];
3113 3112
                         } else {
3114
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3113
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3115 3114
                         }
3116 3115
                     }
3117 3116
                 }
@@ -3185,9 +3184,9 @@  discard block
 block discarded – undo
3185 3184
         // Load item data
3186 3185
         $dataItem = DB::queryFirstRow(
3187 3186
             'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret
3188
-            FROM ' . prefixTable('items') . ' AS i
3189
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3190
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3187
+            FROM ' . prefixTable('items').' AS i
3188
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3189
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3191 3190
             WHERE i.id = %i',
3192 3191
             $inputData['id']
3193 3192
         );
@@ -3209,7 +3208,7 @@  discard block
 block discarded – undo
3209 3208
         // Check if user has a role that is accepted
3210 3209
         $rows_tmp = DB::query(
3211 3210
             'SELECT role_id
3212
-            FROM ' . prefixTable('restriction_to_roles') . '
3211
+            FROM ' . prefixTable('restriction_to_roles').'
3213 3212
             WHERE item_id=%i',
3214 3213
             $inputData['id']
3215 3214
         );
@@ -3241,12 +3240,12 @@  discard block
 block discarded – undo
3241 3240
             // launch query
3242 3241
             $rows = DB::query(
3243 3242
                 'SELECT id, name, file, extension, size
3244
-                FROM ' . prefixTable('files') . '
3243
+                FROM ' . prefixTable('files').'
3245 3244
                 WHERE id_item = %i AND confirmed = 1',
3246 3245
                 $inputData['id']
3247 3246
             );
3248 3247
             foreach ($rows as $record) {
3249
-                $filename = basename($record['name'], '.' . $record['extension']);
3248
+                $filename = basename($record['name'], '.'.$record['extension']);
3250 3249
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3251 3250
 
3252 3251
                 array_push(
@@ -3259,7 +3258,7 @@  discard block
 block discarded – undo
3259 3258
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3260 3259
                         'id' => $record['id'],
3261 3260
                         'key' => $session->get('user-key_tmp'),
3262
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3261
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3263 3262
                     )
3264 3263
                 );
3265 3264
             }
@@ -3297,7 +3296,7 @@  discard block
 block discarded – undo
3297 3296
                     array(
3298 3297
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3299 3298
                     ),
3300
-                    'id=' . $session->get('user-id')
3299
+                    'id='.$session->get('user-id')
3301 3300
                 );
3302 3301
             }
3303 3302
 
@@ -3306,8 +3305,8 @@  discard block
 block discarded – undo
3306 3305
             $listOptionsForRoles = array();
3307 3306
             $rows = DB::query(
3308 3307
                 'SELECT r.role_id AS role_id, t.title AS title
3309
-                FROM ' . prefixTable('roles_values') . ' AS r
3310
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3308
+                FROM ' . prefixTable('roles_values').' AS r
3309
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3311 3310
                 WHERE r.folder_id = %i',
3312 3311
                 $dataItem['id_tree']
3313 3312
             );
@@ -3321,9 +3320,9 @@  discard block
 block discarded – undo
3321 3320
                 );
3322 3321
                 $rows2 = DB::query(
3323 3322
                     'SELECT id, login, fonction_id, email, name, lastname
3324
-                    FROM ' . prefixTable('users') . '
3323
+                    FROM ' . prefixTable('users').'
3325 3324
                     WHERE fonction_id LIKE %s',
3326
-                    '%' . $record['role_id'] . '%'
3325
+                    '%'.$record['role_id'].'%'
3327 3326
                 );
3328 3327
                 foreach ($rows2 as $record2) {
3329 3328
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3336,7 +3335,7 @@  discard block
 block discarded – undo
3336 3335
                                 array(
3337 3336
                                     'id' => (int) $record2['id'],
3338 3337
                                     'login' => $record2['login'],
3339
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3338
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3340 3339
                                     'email' => $record2['email'],
3341 3340
                                 )
3342 3341
                             );
@@ -3355,16 +3354,16 @@  discard block
 block discarded – undo
3355 3354
                 $path = '';
3356 3355
                 foreach ($arbo as $elem) {
3357 3356
                     if (empty($path) === true) {
3358
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3357
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3359 3358
                     } else {
3360
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3359
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3361 3360
                     }
3362 3361
                 }
3363 3362
                 // Build text to show user
3364 3363
                 if (empty($path) === true) {
3365 3364
                     $path = addslashes($dataItem['label']);
3366 3365
                 } else {
3367
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3366
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3368 3367
                 }
3369 3368
 
3370 3369
                 // Add Admins to notification list if expected
@@ -3387,7 +3386,7 @@  discard block
 block discarded – undo
3387 3386
                         array(
3388 3387
                             addslashes($session->get('user-login')),
3389 3388
                             $path,
3390
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3389
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3391 3390
                         ),
3392 3391
                         $lang->get('email_on_open_notification_mail')
3393 3392
                     ),
@@ -3397,7 +3396,7 @@  discard block
 block discarded – undo
3397 3396
             }
3398 3397
 
3399 3398
             // has this item a change proposal
3400
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3399
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3401 3400
             $returnArray['has_change_proposal'] = DB::count();
3402 3401
 
3403 3402
             // Setting
@@ -3408,7 +3407,7 @@  discard block
 block discarded – undo
3408 3407
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3409 3408
                 DB::query(
3410 3409
                     'SELECT *
3411
-                    FROM ' . prefixTable('otv') . '
3410
+                    FROM ' . prefixTable('otv').'
3412 3411
                     WHERE item_id = %i
3413 3412
                     AND time_limit > %i',
3414 3413
                     $inputData['id'],
@@ -3507,7 +3506,7 @@  discard block
 block discarded – undo
3507 3506
         // Load item data
3508 3507
         $data = DB::queryFirstRow(
3509 3508
             'SELECT id_tree, id, label
3510
-            FROM ' . prefixTable('items') . '
3509
+            FROM ' . prefixTable('items').'
3511 3510
             WHERE id = %i OR item_key = %s',
3512 3511
             $inputData['itemId'],
3513 3512
             $inputData['itemKey']
@@ -3598,7 +3597,7 @@  discard block
 block discarded – undo
3598 3597
         // Load item data
3599 3598
         $dataItem = DB::queryFirstRow(
3600 3599
             'SELECT secret, enabled
3601
-            FROM ' . prefixTable('items_otp') . '
3600
+            FROM ' . prefixTable('items_otp').'
3602 3601
             WHERE item_id = %i',
3603 3602
             $inputData['id']
3604 3603
         );
@@ -3680,13 +3679,13 @@  discard block
 block discarded – undo
3680 3679
 
3681 3680
         // Check if user is allowed to access this folder
3682 3681
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3683
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3682
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3684 3683
             break;
3685 3684
         }
3686 3685
 
3687 3686
         // Check if title doesn't contains html codes
3688 3687
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3689
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3688
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3690 3689
             break;
3691 3690
         }
3692 3691
         // check that title is not numeric
@@ -3697,9 +3696,9 @@  discard block
 block discarded – undo
3697 3696
 
3698 3697
         // Check if duplicate folders name are allowed
3699 3698
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3700
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3699
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3701 3700
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3702
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3701
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3703 3702
                 break;
3704 3703
             }
3705 3704
         }
@@ -3707,7 +3706,7 @@  discard block
 block discarded – undo
3707 3706
         // query on folder
3708 3707
         $data = DB::queryFirstRow(
3709 3708
             'SELECT parent_id, personal_folder
3710
-            FROM ' . prefixTable('nested_tree') . '
3709
+            FROM ' . prefixTable('nested_tree').'
3711 3710
             WHERE id = %i',
3712 3711
             $inputData['folderId']
3713 3712
         );
@@ -3717,20 +3716,20 @@  discard block
 block discarded – undo
3717 3716
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3718 3717
             $data = DB::queryFirstRow(
3719 3718
                 'SELECT valeur
3720
-                FROM ' . prefixTable('misc') . '
3719
+                FROM ' . prefixTable('misc').'
3721 3720
                 WHERE intitule = %i AND type = %s',
3722 3721
                 $data['parent_id'],
3723 3722
                 'complex'
3724 3723
             );
3725 3724
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3726
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3725
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3727 3726
                 break;
3728 3727
             }
3729 3728
         }
3730 3729
 
3731 3730
         // update Folders table
3732 3731
         $tmp = DB::queryFirstRow(
3733
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3732
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3734 3733
             $dataReceived['folder']
3735 3734
         );
3736 3735
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3844,7 +3843,7 @@  discard block
 block discarded – undo
3844 3843
             $uniqueLoadData['path'] = $arr_arbo;
3845 3844
 
3846 3845
             // store last folder accessed in cookie
3847
-            $arr_cookie_options = array (
3846
+            $arr_cookie_options = array(
3848 3847
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3849 3848
                 'path' => '/', 
3850 3849
                 'secure' => true,
@@ -3859,7 +3858,7 @@  discard block
 block discarded – undo
3859 3858
             foreach ($session->get('user-roles_array') as $role) {
3860 3859
                 $roleQ = DB::queryFirstRow(
3861 3860
                     'SELECT allow_pw_change
3862
-                    FROM ' . prefixTable('roles_title') . '
3861
+                    FROM ' . prefixTable('roles_title').'
3863 3862
                     WHERE id = %i',
3864 3863
                     $role
3865 3864
                 );
@@ -3890,11 +3889,11 @@  discard block
 block discarded – undo
3890 3889
                 
3891 3890
                 foreach ($session->get('user-roles_array') as $role) {
3892 3891
                     $access = DB::queryFirstRow(
3893
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3892
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3894 3893
                         $role,
3895 3894
                         $inputData['id']
3896 3895
                     );
3897
-                    if (DB::count()>0) {
3896
+                    if (DB::count() > 0) {
3898 3897
                         if ($access['type'] === 'R') {
3899 3898
                             array_push($arrTmp, 10);
3900 3899
                         } elseif ($access['type'] === 'W') {
@@ -3959,7 +3958,7 @@  discard block
 block discarded – undo
3959 3958
             } else {
3960 3959
                 DB::query(
3961 3960
                     'SELECT *
3962
-                    FROM ' . prefixTable('items') . '
3961
+                    FROM ' . prefixTable('items').'
3963 3962
                     WHERE inactif = %i',
3964 3963
                     0
3965 3964
                 );
@@ -3969,7 +3968,7 @@  discard block
 block discarded – undo
3969 3968
 
3970 3969
             // Get folder complexity
3971 3970
             $folderComplexity = DB::queryFirstRow(
3972
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3971
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3973 3972
                 'complex',
3974 3973
                 $inputData['id']
3975 3974
             );
@@ -3981,7 +3980,7 @@  discard block
 block discarded – undo
3981 3980
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3982 3981
                 $folderRow = DB::query(
3983 3982
                     'SELECT id_category
3984
-                    FROM ' . prefixTable('categories_folders') . '
3983
+                    FROM ' . prefixTable('categories_folders').'
3985 3984
                     WHERE id_folder = %i',
3986 3985
                     $inputData['id']
3987 3986
                 );
@@ -4096,15 +4095,15 @@  discard block
 block discarded – undo
4096 4095
             // List all ITEMS
4097 4096
             if ($folderIsPf === false) {
4098 4097
                 $where->add('i.inactif=%i', 0);
4099
-                $sql_e='(SELECT date FROM ' . prefixTable('log_items') 
4098
+                $sql_e = '(SELECT date FROM '.prefixTable('log_items') 
4100 4099
                     . " WHERE action = 'at_creation' AND id_item=i.id " 
4101
-                    . 'union all SELECT date FROM '. prefixTable('log_items') 
4100
+                    . 'union all SELECT date FROM '.prefixTable('log_items') 
4102 4101
                     . " WHERE action = 'at_modification' AND raison = 'at_pw'
4103 4102
                     AND id_item=i.id ORDER BY date DESC LIMIT 1)";
4104 4103
                 $where->add('l.date=%l', $sql_e);
4105 4104
 
4106
-                $query_limit = ' LIMIT ' .
4107
-                    $start . ',' .
4105
+                $query_limit = ' LIMIT '.
4106
+                    $start.','.
4108 4107
                     $post_nb_items_to_display_once;
4109 4108
                 //db::debugmode(true);
4110 4109
                 $rows = DB::query(
@@ -4116,9 +4115,9 @@  discard block
 block discarded – undo
4116 4115
                     l.id_user AS log_user,
4117 4116
                     i.url AS link,
4118 4117
                     i.email AS email
4119
-                    FROM ' . prefixTable('items') . ' AS i
4120
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4121
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4118
+                    FROM ' . prefixTable('items').' AS i
4119
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4120
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4122 4121
                     WHERE %l
4123 4122
                     GROUP BY i.id, l.date, l.id_user, l.action
4124 4123
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4138,9 +4137,9 @@  discard block
 block discarded – undo
4138 4137
                     l.id_user AS log_user,
4139 4138
                     i.url AS link,
4140 4139
                     i.email AS email
4141
-                    FROM ' . prefixTable('items') . ' AS i
4142
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4143
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4140
+                    FROM ' . prefixTable('items').' AS i
4141
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4142
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4144 4143
                     WHERE %l
4145 4144
                     GROUP BY i.id, l.date, l.id_user, l.action
4146 4145
                     ORDER BY i.label ASC, l.date DESC',
@@ -4171,7 +4170,7 @@  discard block
 block discarded – undo
4171 4170
                     $item_is_restricted_to_role = false;
4172 4171
                     DB::queryFirstRow(
4173 4172
                         'SELECT role_id
4174
-                        FROM ' . prefixTable('restriction_to_roles') . '
4173
+                        FROM ' . prefixTable('restriction_to_roles').'
4175 4174
                         WHERE item_id = %i',
4176 4175
                         $record['id']
4177 4176
                     );
@@ -4183,7 +4182,7 @@  discard block
 block discarded – undo
4183 4182
                     $user_is_included_in_role = false;
4184 4183
                     DB::query(
4185 4184
                         'SELECT role_id
4186
-                        FROM ' . prefixTable('restriction_to_roles') . '
4185
+                        FROM ' . prefixTable('restriction_to_roles').'
4187 4186
                         WHERE item_id = %i AND role_id IN %ls',
4188 4187
                         $record['id'],
4189 4188
                         $session->get('user-roles_array')
@@ -4393,9 +4392,9 @@  discard block
 block discarded – undo
4393 4392
         if ((int) $start === 0) {
4394 4393
             DB::query(
4395 4394
                 'SELECT i.id
4396
-                FROM ' . prefixTable('items') . ' as i
4397
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4398
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4395
+                FROM ' . prefixTable('items').' as i
4396
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4397
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4399 4398
                 WHERE %l
4400 4399
                 ORDER BY i.label ASC, l.date DESC',
4401 4400
                 $where
@@ -4460,8 +4459,8 @@  discard block
 block discarded – undo
4460 4459
         $dataItem = DB::queryFirstRow(
4461 4460
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4462 4461
                     i.label AS label, i.id_tree AS id_tree
4463
-            FROM ' . prefixTable('items') . ' AS i
4464
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4462
+            FROM ' . prefixTable('items').' AS i
4463
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4465 4464
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4466 4465
             $session->get('user-id'),
4467 4466
             $inputData['itemKey'] ?? '',
@@ -4572,7 +4571,7 @@  discard block
 block discarded – undo
4572 4571
         // do query on this folder
4573 4572
         $data_this_folder = DB::queryFirstRow(
4574 4573
             'SELECT id, personal_folder, title
4575
-            FROM ' . prefixTable('nested_tree') . '
4574
+            FROM ' . prefixTable('nested_tree').'
4576 4575
             WHERE id = %s',
4577 4576
             $inputData['folderId']
4578 4577
         );
@@ -4612,8 +4611,8 @@  discard block
 block discarded – undo
4612 4611
         $visibilite = '';
4613 4612
         $data = DB::queryFirstRow(
4614 4613
             'SELECT m.valeur, n.personal_folder
4615
-            FROM ' . prefixTable('misc') . ' AS m
4616
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4614
+            FROM ' . prefixTable('misc').' AS m
4615
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4617 4616
             WHERE type=%s AND intitule = %s',
4618 4617
             'complex',
4619 4618
             $inputData['folderId']
@@ -4626,8 +4625,8 @@  discard block
 block discarded – undo
4626 4625
             // Prepare Item actual visibility (what Users/Roles can see it)
4627 4626
             $rows = DB::query(
4628 4627
                 'SELECT t.title
4629
-                FROM ' . prefixTable('roles_values') . ' as v
4630
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4628
+                FROM ' . prefixTable('roles_values').' as v
4629
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4631 4630
                 WHERE v.folder_id = %i
4632 4631
                 GROUP BY title',
4633 4632
                 $inputData['folderId']
@@ -4636,7 +4635,7 @@  discard block
 block discarded – undo
4636 4635
                 if (empty($visibilite)) {
4637 4636
                     $visibilite = $record['title'];
4638 4637
                 } else {
4639
-                    $visibilite .= ' - ' . $record['title'];
4638
+                    $visibilite .= ' - '.$record['title'];
4640 4639
                 }
4641 4640
             }
4642 4641
         } else {
@@ -4646,14 +4645,14 @@  discard block
 block discarded – undo
4646 4645
             // do new query to know if current folder is pf
4647 4646
             $data_pf = DB::queryFirstRow(
4648 4647
                 'SELECT personal_folder
4649
-                FROM ' . prefixTable('nested_tree') . '
4648
+                FROM ' . prefixTable('nested_tree').'
4650 4649
                 WHERE id = %s',
4651 4650
                 $inputData['folderId']
4652 4651
             );
4653 4652
             
4654 4653
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4655 4654
             
4656
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4655
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4657 4656
         }
4658 4657
 
4659 4658
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4663,8 +4662,8 @@  discard block
 block discarded – undo
4663 4662
         $listOptionsForRoles = array();
4664 4663
         $rows = DB::query(
4665 4664
             'SELECT r.role_id AS role_id, t.title AS title
4666
-            FROM ' . prefixTable('roles_values') . ' AS r
4667
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4665
+            FROM ' . prefixTable('roles_values').' AS r
4666
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4668 4667
             WHERE r.folder_id = %i',
4669 4668
             $inputData['folderId']
4670 4669
         );
@@ -4678,7 +4677,7 @@  discard block
 block discarded – undo
4678 4677
             );
4679 4678
             $rows2 = DB::query(
4680 4679
                 'SELECT id, login, fonction_id, email, name, lastname
4681
-                FROM ' . prefixTable('users') . '
4680
+                FROM ' . prefixTable('users').'
4682 4681
                 WHERE admin = 0 AND fonction_id is not null'
4683 4682
             );
4684 4683
             foreach ($rows2 as $record2) {
@@ -4692,7 +4691,7 @@  discard block
 block discarded – undo
4692 4691
                             array(
4693 4692
                                 'id' => $record2['id'],
4694 4693
                                 'login' => $record2['login'],
4695
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4694
+                                'name' => $record2['name'].' '.$record2['lastname'],
4696 4695
                                 'email' => $record2['email'],
4697 4696
                             )
4698 4697
                         );
@@ -4709,13 +4708,13 @@  discard block
 block discarded – undo
4709 4708
                 //db::debugmode(true);
4710 4709
                 $access = DB::queryFirstRow(
4711 4710
                     'SELECT type
4712
-                    FROM ' . prefixTable('roles_values') . '
4711
+                    FROM ' . prefixTable('roles_values').'
4713 4712
                     WHERE role_id = %i AND folder_id = %i',
4714 4713
                     $role,
4715 4714
                     $inputData['folderId']
4716 4715
                 );
4717 4716
                 //db::debugmode(false);
4718
-                if (DB::count()>0) {
4717
+                if (DB::count() > 0) {
4719 4718
                     if ($access['type'] === 'R') {
4720 4719
                         array_push($arrTmp, 10);
4721 4720
                     } elseif ($access['type'] === 'W') {
@@ -4743,7 +4742,7 @@  discard block
 block discarded – undo
4743 4742
             // Check if personal folder is owned by user
4744 4743
             $folder = DB::queryFirstRow(
4745 4744
                 'SELECT id
4746
-                FROM ' . prefixTable('nested_tree') . '
4745
+                FROM ' . prefixTable('nested_tree').'
4747 4746
                 WHERE title = %s',
4748 4747
                 $session->get('user-id'),
4749 4748
             );
@@ -4848,7 +4847,7 @@  discard block
 block discarded – undo
4848 4847
         // Get some info before deleting
4849 4848
         $data = DB::queryFirstRow(
4850 4849
             'SELECT name, id_item, file
4851
-            FROM ' . prefixTable('files') . '
4850
+            FROM ' . prefixTable('files').'
4852 4851
             WHERE id = %i',
4853 4852
             $fileId
4854 4853
         );
@@ -4856,7 +4855,7 @@  discard block
 block discarded – undo
4856 4855
         // Load item data
4857 4856
         $data_item = DB::queryFirstRow(
4858 4857
             'SELECT id_tree
4859
-            FROM ' . prefixTable('items') . '
4858
+            FROM ' . prefixTable('items').'
4860 4859
             WHERE id = %i',
4861 4860
             $data['id_item']
4862 4861
         );
@@ -4886,7 +4885,7 @@  discard block
 block discarded – undo
4886 4885
                 $session->get('user-id'),
4887 4886
                 'at_modification',
4888 4887
                 $session->get('user-login'),
4889
-                'at_del_file : ' . $data['name']
4888
+                'at_del_file : '.$data['name']
4890 4889
             );
4891 4890
 
4892 4891
             // DElete sharekeys
@@ -4897,7 +4896,7 @@  discard block
 block discarded – undo
4897 4896
             );
4898 4897
 
4899 4898
             // Delete file from server
4900
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
4899
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
4901 4900
             $fileToDelete = realpath($fileToDelete);
4902 4901
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
4903 4902
                 fileDelete($fileToDelete, $SETTINGS);
@@ -4951,7 +4950,7 @@  discard block
 block discarded – undo
4951 4950
             // Update SESSION with this new favourite
4952 4951
             $data = DB::queryFirstRow(
4953 4952
                 'SELECT label,id_tree
4954
-                FROM ' . prefixTable('items') . '
4953
+                FROM ' . prefixTable('items').'
4955 4954
                 WHERE id = %i',
4956 4955
                 $inputData['itemId']
4957 4956
             );
@@ -4960,7 +4959,7 @@  discard block
 block discarded – undo
4960 4959
                 [
4961 4960
                     $inputData['itemId'] => [
4962 4961
                         'label' => $data['label'],
4963
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4962
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4964 4963
                     ],
4965 4964
                 ],
4966 4965
                 'add'
@@ -5029,8 +5028,8 @@  discard block
 block discarded – undo
5029 5028
         // get data about item
5030 5029
         $dataSource = DB::queryFirstRow(
5031 5030
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5032
-            FROM ' . prefixTable('items') . ' as i
5033
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5031
+            FROM ' . prefixTable('items').' as i
5032
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5034 5033
             WHERE i.id=%i',
5035 5034
             $inputData['itemId']
5036 5035
         );
@@ -5074,7 +5073,7 @@  discard block
 block discarded – undo
5074 5073
         // get data about new folder
5075 5074
         $dataDestination = DB::queryFirstRow(
5076 5075
             'SELECT personal_folder, title
5077
-            FROM ' . prefixTable('nested_tree') . '
5076
+            FROM ' . prefixTable('nested_tree').'
5078 5077
             WHERE id = %i',
5079 5078
             $inputData['folderId']
5080 5079
         );
@@ -5127,7 +5126,7 @@  discard block
 block discarded – undo
5127 5126
             // Get fields for this Item
5128 5127
             $rows = DB::query(
5129 5128
                 'SELECT id
5130
-                FROM ' . prefixTable('categories_items') . '
5129
+                FROM ' . prefixTable('categories_items').'
5131 5130
                 WHERE item_id = %i',
5132 5131
                 $inputData['itemId']
5133 5132
             );
@@ -5144,7 +5143,7 @@  discard block
 block discarded – undo
5144 5143
             // Get FILES for this Item
5145 5144
             $rows = DB::query(
5146 5145
                 'SELECT id
5147
-                FROM ' . prefixTable('files') . '
5146
+                FROM ' . prefixTable('files').'
5148 5147
                 WHERE id_item = %i',
5149 5148
                 $inputData['itemId']
5150 5149
             );
@@ -5191,7 +5190,7 @@  discard block
 block discarded – undo
5191 5190
             // Get the ITEM object key for the user
5192 5191
             $userKey = DB::queryFirstRow(
5193 5192
                 'SELECT share_key
5194
-                FROM ' . prefixTable('sharekeys_items') . '
5193
+                FROM ' . prefixTable('sharekeys_items').'
5195 5194
                 WHERE user_id = %i AND object_id = %i',
5196 5195
                 $session->get('user-id'),
5197 5196
                 $inputData['itemId']
@@ -5202,7 +5201,7 @@  discard block
 block discarded – undo
5202 5201
                 // This is a public object
5203 5202
                 $users = DB::query(
5204 5203
                     'SELECT id, public_key
5205
-                    FROM ' . prefixTable('users') . '
5204
+                    FROM ' . prefixTable('users').'
5206 5205
                     WHERE id NOT IN %li
5207 5206
                     AND public_key != ""',
5208 5207
                     $tpUsersIDs
@@ -5225,14 +5224,14 @@  discard block
 block discarded – undo
5225 5224
             // Get fields for this Item
5226 5225
             $rows = DB::query(
5227 5226
                 'SELECT id
5228
-                FROM ' . prefixTable('categories_items') . '
5227
+                FROM ' . prefixTable('categories_items').'
5229 5228
                 WHERE item_id = %i',
5230 5229
                 $inputData['itemId']
5231 5230
             );
5232 5231
             foreach ($rows as $field) {
5233 5232
                 $userKey = DB::queryFirstRow(
5234 5233
                     'SELECT share_key
5235
-                    FROM ' . prefixTable('sharekeys_fields') . '
5234
+                    FROM ' . prefixTable('sharekeys_fields').'
5236 5235
                     WHERE user_id = %i AND object_id = %i',
5237 5236
                     $session->get('user-id'),
5238 5237
                     $field['id']
@@ -5243,7 +5242,7 @@  discard block
 block discarded – undo
5243 5242
                     // This is a public object
5244 5243
                     $users = DB::query(
5245 5244
                         'SELECT id, public_key
5246
-                        FROM ' . prefixTable('users') . '
5245
+                        FROM ' . prefixTable('users').'
5247 5246
                         WHERE id NOT IN %li
5248 5247
                         AND public_key != ""',
5249 5248
                         $tpUsersIDs
@@ -5266,14 +5265,14 @@  discard block
 block discarded – undo
5266 5265
             // Get FILES for this Item
5267 5266
             $rows = DB::query(
5268 5267
                 'SELECT id
5269
-                FROM ' . prefixTable('files') . '
5268
+                FROM ' . prefixTable('files').'
5270 5269
                 WHERE id_item = %i',
5271 5270
                 $inputData['itemId']
5272 5271
             );
5273 5272
             foreach ($rows as $attachment) {
5274 5273
                 $userKey = DB::queryFirstRow(
5275 5274
                     'SELECT share_key
5276
-                    FROM ' . prefixTable('sharekeys_files') . '
5275
+                    FROM ' . prefixTable('sharekeys_files').'
5277 5276
                     WHERE user_id = %i AND object_id = %i',
5278 5277
                     $session->get('user-id'),
5279 5278
                     $attachment['id']
@@ -5284,7 +5283,7 @@  discard block
 block discarded – undo
5284 5283
                     // This is a public object
5285 5284
                     $users = DB::query(
5286 5285
                         'SELECT id, public_key
5287
-                        FROM ' . prefixTable('users') . '
5286
+                        FROM ' . prefixTable('users').'
5288 5287
                         WHERE id NOT IN %li
5289 5288
                         AND public_key != ""',
5290 5289
                         $tpUsersIDs
@@ -5325,7 +5324,7 @@  discard block
 block discarded – undo
5325 5324
             $session->get('user-id'),
5326 5325
             'at_modification',
5327 5326
             $session->get('user-login'),
5328
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5327
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5329 5328
         );
5330 5329
 
5331 5330
         // Update cache table
@@ -5384,8 +5383,8 @@  discard block
 block discarded – undo
5384 5383
                 // get data about item
5385 5384
                 $dataSource = DB::queryFirstRow(
5386 5385
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5387
-                    FROM ' . prefixTable('items') . ' as i
5388
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5386
+                    FROM ' . prefixTable('items').' as i
5387
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5389 5388
                     WHERE i.id=%i',
5390 5389
                     $item_id
5391 5390
                 );
@@ -5407,7 +5406,7 @@  discard block
 block discarded – undo
5407 5406
 
5408 5407
                 // get data about new folder
5409 5408
                 $dataDestination = DB::queryFirstRow(
5410
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5409
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5411 5410
                     $inputData['folderId']
5412 5411
                 );
5413 5412
 
@@ -5449,7 +5448,7 @@  discard block
 block discarded – undo
5449 5448
                     // Get fields for this Item
5450 5449
                     $rows = DB::query(
5451 5450
                         'SELECT id
5452
-                        FROM ' . prefixTable('categories_items') . '
5451
+                        FROM ' . prefixTable('categories_items').'
5453 5452
                         WHERE item_id = %i',
5454 5453
                         $item_id
5455 5454
                     );
@@ -5466,7 +5465,7 @@  discard block
 block discarded – undo
5466 5465
                     // Get FILES for this Item
5467 5466
                     $rows = DB::query(
5468 5467
                         'SELECT id
5469
-                        FROM ' . prefixTable('files') . '
5468
+                        FROM ' . prefixTable('files').'
5470 5469
                         WHERE id_item = %i',
5471 5470
                         $item_id
5472 5471
                     );
@@ -5521,7 +5520,7 @@  discard block
 block discarded – undo
5521 5520
                     // Get the ITEM object key for the user
5522 5521
                     $userKey = DB::queryFirstRow(
5523 5522
                         'SELECT share_key
5524
-                        FROM ' . prefixTable('sharekeys_items') . '
5523
+                        FROM ' . prefixTable('sharekeys_items').'
5525 5524
                         WHERE user_id = %i AND object_id = %i',
5526 5525
                         $session->get('user-id'),
5527 5526
                         $item_id
@@ -5532,7 +5531,7 @@  discard block
 block discarded – undo
5532 5531
                         // This is a public object
5533 5532
                         $users = DB::query(
5534 5533
                             'SELECT id, public_key
5535
-                            FROM ' . prefixTable('users') . '
5534
+                            FROM ' . prefixTable('users').'
5536 5535
                             WHERE id NOT IN %li
5537 5536
                             AND public_key != ""',
5538 5537
                             $tpUsersIDs
@@ -5555,14 +5554,14 @@  discard block
 block discarded – undo
5555 5554
                     // Get fields for this Item
5556 5555
                     $rows = DB::query(
5557 5556
                         'SELECT id
5558
-                        FROM ' . prefixTable('categories_items') . '
5557
+                        FROM ' . prefixTable('categories_items').'
5559 5558
                         WHERE item_id = %i',
5560 5559
                         $item_id
5561 5560
                     );
5562 5561
                     foreach ($rows as $field) {
5563 5562
                         $userKey = DB::queryFirstRow(
5564 5563
                             'SELECT share_key
5565
-                            FROM ' . prefixTable('sharekeys_fields') . '
5564
+                            FROM ' . prefixTable('sharekeys_fields').'
5566 5565
                             WHERE user_id = %i AND object_id = %i',
5567 5566
                             $session->get('user-id'),
5568 5567
                             $field['id']
@@ -5573,7 +5572,7 @@  discard block
 block discarded – undo
5573 5572
                             // This is a public object
5574 5573
                             $users = DB::query(
5575 5574
                                 'SELECT id, public_key
5576
-                                FROM ' . prefixTable('users') . '
5575
+                                FROM ' . prefixTable('users').'
5577 5576
                                 WHERE id NOT IN %li
5578 5577
                                 AND public_key != ""',
5579 5578
                                 $tpUsersIDs
@@ -5597,14 +5596,14 @@  discard block
 block discarded – undo
5597 5596
                     // Get FILES for this Item
5598 5597
                     $rows = DB::query(
5599 5598
                         'SELECT id
5600
-                        FROM ' . prefixTable('files') . '
5599
+                        FROM ' . prefixTable('files').'
5601 5600
                         WHERE id_item = %i',
5602 5601
                         $item_id
5603 5602
                     );
5604 5603
                     foreach ($rows as $attachment) {
5605 5604
                         $userKey = DB::queryFirstRow(
5606 5605
                             'SELECT share_key
5607
-                            FROM ' . prefixTable('sharekeys_files') . '
5606
+                            FROM ' . prefixTable('sharekeys_files').'
5608 5607
                             WHERE user_id = %i AND object_id = %i',
5609 5608
                             $session->get('user-id'),
5610 5609
                             $attachment['id']
@@ -5615,7 +5614,7 @@  discard block
 block discarded – undo
5615 5614
                             // This is a public object
5616 5615
                             $users = DB::query(
5617 5616
                                 'SELECT id, public_key
5618
-                                FROM ' . prefixTable('users') . '
5617
+                                FROM ' . prefixTable('users').'
5619 5618
                                 WHERE id NOT IN %li
5620 5619
                                 AND public_key != ""',
5621 5620
                                 $tpUsersIDs
@@ -5655,13 +5654,13 @@  discard block
 block discarded – undo
5655 5654
                     $session->get('user-id'),
5656 5655
                     'at_modification',
5657 5656
                     $session->get('user-login'),
5658
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5657
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5659 5658
                 );
5660 5659
             }
5661 5660
         }
5662 5661
 
5663 5662
         // reload cache table
5664
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5663
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5665 5664
         updateCacheTable('reload', null);
5666 5665
 
5667 5666
         echo (string) prepareExchangedData(
@@ -5725,7 +5724,7 @@  discard block
 block discarded – undo
5725 5724
                 // get info
5726 5725
                 $dataSource = DB::queryFirstRow(
5727 5726
                     'SELECT label, id_tree
5728
-                    FROM ' . prefixTable('items') . '
5727
+                    FROM ' . prefixTable('items').'
5729 5728
                     WHERE id=%i',
5730 5729
                     $item_id
5731 5730
                 );
@@ -5826,14 +5825,14 @@  discard block
 block discarded – undo
5826 5825
             // Variables
5827 5826
             $dataAuthor = DB::queryFirstRow(
5828 5827
                 'SELECT email,login
5829
-                FROM ' . prefixTable('users') . '
5828
+                FROM ' . prefixTable('users').'
5830 5829
                 WHERE id = %i',
5831 5830
                 $post_content[1]
5832 5831
             );
5833 5832
 
5834 5833
             $dataItem = DB::queryFirstRow(
5835 5834
                 'SELECT label, id_tree
5836
-                FROM ' . prefixTable('items') . '
5835
+                FROM ' . prefixTable('items').'
5837 5836
                 WHERE id = %i',
5838 5837
                 $post_content[0]
5839 5838
             );
@@ -5850,7 +5849,7 @@  discard block
 block discarded – undo
5850 5849
                 $lang->get('email_request_access_subject'),
5851 5850
                 str_replace(
5852 5851
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5853
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5852
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5854 5853
                     $lang->get('email_request_access_mail')
5855 5854
                 ),
5856 5855
                 $dataAuthor['email'],
@@ -5859,7 +5858,7 @@  discard block
 block discarded – undo
5859 5858
         } elseif ($inputData['cat'] === 'share_this_item') {
5860 5859
             $dataItem = DB::queryFirstRow(
5861 5860
                 'SELECT label,id_tree
5862
-                FROM ' . prefixTable('items') . '
5861
+                FROM ' . prefixTable('items').'
5863 5862
                 WHERE id= %i',
5864 5863
                 $inputData['id']
5865 5864
             );
@@ -5882,7 +5881,7 @@  discard block
 block discarded – undo
5882 5881
                     ),
5883 5882
                     array(
5884 5883
                         empty($SETTINGS['email_server_url']) === false ?
5885
-                            $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
5884
+                            $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
5886 5885
                         addslashes($session->get('user-login')),
5887 5886
                         addslashes($path),
5888 5887
                     ),
@@ -5931,8 +5930,8 @@  discard block
 block discarded – undo
5931 5930
         // Get all informations for this item
5932 5931
         $dataItem = DB::queryFirstRow(
5933 5932
             'SELECT *
5934
-            FROM ' . prefixTable('items') . ' as i
5935
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5933
+            FROM ' . prefixTable('items').' as i
5934
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5936 5935
             WHERE i.id=%i AND l.action = %s',
5937 5936
             $item_id,
5938 5937
             'at_creation'
@@ -5961,18 +5960,18 @@  discard block
 block discarded – undo
5961 5960
                 $session->get('user-login'),
5962 5961
                 htmlspecialchars_decode($label, ENT_QUOTES),
5963 5962
                 null,
5964
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
5963
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
5965 5964
             );
5966 5965
             // Prepare new line
5967 5966
             $data = DB::queryFirstRow(
5968
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5967
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5969 5968
                 $item_id
5970 5969
             );
5971
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
5970
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
5972 5971
             // send back
5973 5972
             $data = array(
5974 5973
                 'error' => '',
5975
-                'new_line' => '<br>' . addslashes($historic),
5974
+                'new_line' => '<br>'.addslashes($historic),
5976 5975
             );
5977 5976
             echo (string) prepareExchangedData(
5978 5977
                 $data,
@@ -6047,8 +6046,8 @@  discard block
 block discarded – undo
6047 6046
         // Should we log a password change?
6048 6047
         $itemQ = DB::queryFirstRow(
6049 6048
             'SELECT s.share_key, i.pw
6050
-            FROM ' . prefixTable('items') . ' AS i
6051
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6049
+            FROM ' . prefixTable('items').' AS i
6050
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6052 6051
             WHERE s.user_id = %i AND s.object_id = %i',
6053 6052
             $session->get('user-id'),
6054 6053
             $dataReceived['id']
@@ -6103,7 +6102,7 @@  discard block
 block discarded – undo
6103 6102
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6104 6103
             $SETTINGS['otv_expiration_period'] = 7;
6105 6104
         }
6106
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6105
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6107 6106
 
6108 6107
         echo json_encode(
6109 6108
             array(
@@ -6134,7 +6133,7 @@  discard block
 block discarded – undo
6134 6133
         // get parameters from original link
6135 6134
         $url = $dataReceived['original_link'];
6136 6135
         $parts = parse_url($url);
6137
-        if(isset($parts['query'])){
6136
+        if (isset($parts['query'])) {
6138 6137
             parse_str($parts['query'], $orignal_link_parameters);
6139 6138
         } else {
6140 6139
             $orignal_link_parameters = array();
@@ -6165,13 +6164,13 @@  discard block
 block discarded – undo
6165 6164
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6166 6165
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6167 6166
             if (str_contains($domain_host, 'www.') === true) {
6168
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6167
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6169 6168
             } else {
6170
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6169
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6171 6170
             }
6172
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6171
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6173 6172
         } else {
6174
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6173
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6175 6174
         }
6176 6175
 
6177 6176
         echo (string) prepareExchangedData(
@@ -6206,8 +6205,8 @@  discard block
 block discarded – undo
6206 6205
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6207 6206
             f.extension AS extension, f.type AS type,
6208 6207
             s.share_key AS share_key
6209
-            FROM ' . prefixTable('files') . ' AS f
6210
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6208
+            FROM ' . prefixTable('files').' AS f
6209
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6211 6210
             WHERE s.user_id = %i AND s.object_id = %i',
6212 6211
             $session->get('user-id'),
6213 6212
             $inputData['id']
@@ -6228,7 +6227,7 @@  discard block
 block discarded – undo
6228 6227
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6229 6228
 
6230 6229
         // prepare image info
6231
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6230
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6232 6231
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6233 6232
         
6234 6233
         // Get image content
@@ -6255,7 +6254,7 @@  discard block
 block discarded – undo
6255 6254
         echo (string) prepareExchangedData(
6256 6255
             array(
6257 6256
                 'error' => false,
6258
-                'filename' => $post_title . '.' . $file_info['extension'],
6257
+                'filename' => $post_title.'.'.$file_info['extension'],
6259 6258
                 'file_type' => $file_info['type'],
6260 6259
                 'file_content' => $fileContent,
6261 6260
             ),
@@ -6369,7 +6368,7 @@  discard block
 block discarded – undo
6369 6368
                     $arbo = $tree->getPath($folder->id, false);
6370 6369
                     $path = '';
6371 6370
                     foreach ($arbo as $elem) {
6372
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6371
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6373 6372
                     }
6374 6373
 
6375 6374
                     // Build array
@@ -6438,7 +6437,7 @@  discard block
 block discarded – undo
6438 6437
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6439 6438
             $rows = DB::query(
6440 6439
                 'SELECT id, categories
6441
-                FROM ' . prefixTable('nested_tree') . '
6440
+                FROM ' . prefixTable('nested_tree').'
6442 6441
                 WHERE id IN (%l)',
6443 6442
                 implode(',', $foldersArray)
6444 6443
             );
@@ -6480,7 +6479,7 @@  discard block
 block discarded – undo
6480 6479
         // get item info
6481 6480
         $dataItem = DB::queryFirstRow(
6482 6481
             'SELECT *
6483
-            FROM ' . prefixTable('items') . '
6482
+            FROM ' . prefixTable('items').'
6484 6483
             WHERE id=%i',
6485 6484
             $inputData['itemId']
6486 6485
         );
@@ -6492,8 +6491,8 @@  discard block
 block discarded – undo
6492 6491
             'SELECT l.date as date, l.action as action, l.raison as raison,
6493 6492
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6494 6493
                 l.old_value as old_value
6495
-            FROM ' . prefixTable('log_items') . ' as l
6496
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6494
+            FROM ' . prefixTable('log_items').' as l
6495
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6497 6496
             WHERE id_item=%i AND l.action NOT IN (%l)
6498 6497
             ORDER BY date DESC',
6499 6498
             $inputData['itemId'],
@@ -6508,18 +6507,18 @@  discard block
 block discarded – undo
6508 6507
             
6509 6508
             // imported via API
6510 6509
             if (empty($record['login']) === true) {
6511
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6510
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6512 6511
             }
6513 6512
             
6514 6513
             // Prepare avatar
6515 6514
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6516
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6517
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6515
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6516
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6518 6517
                 } else {
6519
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6518
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6520 6519
                 }
6521 6520
             } else {
6522
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6521
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6523 6522
             }
6524 6523
 
6525 6524
             // Prepare action
@@ -6539,7 +6538,7 @@  discard block
 block discarded – undo
6539 6538
                         $previous_passwords, 
6540 6539
                         [
6541 6540
                             'password' => htmlentities($previous_pwd['string']),
6542
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6541
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6543 6542
                         ]
6544 6543
                     );
6545 6544
                 }
@@ -6552,19 +6551,19 @@  discard block
 block discarded – undo
6552 6551
                 $action = $lang->get($reason[0]);
6553 6552
                 if ($reason[0] === 'at_moved') {
6554 6553
                     $tmp = explode(' -> ', $reason[1]);
6555
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6554
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6556 6555
                 } elseif ($reason[0] === 'at_field') {
6557 6556
                     $tmp = explode(' => ', $reason[1]);
6558 6557
                     if (count($tmp) > 1) {
6559
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6560
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6558
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6559
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6561 6560
                     } else {
6562 6561
                         $detail = trim($reason[1]);
6563 6562
                     }
6564 6563
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6565 6564
                     $tmp = explode(' => ', $reason[1]);
6566 6565
                     $detail = empty(trim($tmp[0])) === true ?
6567
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6566
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6568 6567
                 } elseif ($reason[0] === 'at_automatic_del') {
6569 6568
                     $detail = $lang->get($reason[1]);
6570 6569
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6573,7 +6572,7 @@  discard block
 block discarded – undo
6573 6572
                     $tmp = explode(':', $reason[1]);
6574 6573
                     $tmp = explode('.', $tmp[0]);
6575 6574
                     $detail = isBase64($tmp[0]) === true ?
6576
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6575
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6577 6576
                 } elseif ($reason[0] === 'at_import') {
6578 6577
                     $detail = '';
6579 6578
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6592,8 +6591,8 @@  discard block
 block discarded – undo
6592 6591
                 array(
6593 6592
                     'avatar' => $avatar,
6594 6593
                     'login' => $record['login'],
6595
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6596
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6594
+                    'name' => $record['name'].' '.$record['lastname'],
6595
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6597 6596
                     'action' => $action,
6598 6597
                     'detail' => $detail,
6599 6598
                 )
@@ -6681,11 +6680,11 @@  discard block
 block discarded – undo
6681 6680
 
6682 6681
         // get some info to add to the notification email
6683 6682
         $resp_user = DB::queryFirstRow(
6684
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6683
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6685 6684
             $session->get('user-id')
6686 6685
         );
6687 6686
         $resp_folder = DB::queryFirstRow(
6688
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6687
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6689 6688
             $folder
6690 6689
         );
6691 6690
 
@@ -6694,7 +6693,7 @@  discard block
 block discarded – undo
6694 6693
         $emailService = new EmailService();
6695 6694
         $rows = DB::query(
6696 6695
             'SELECT email
6697
-            FROM ' . prefixTable('users') . '
6696
+            FROM ' . prefixTable('users').'
6698 6697
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6699 6698
             1
6700 6699
         );
@@ -6740,7 +6739,7 @@  discard block
 block discarded – undo
6740 6739
         // Send email
6741 6740
         $dataItem = DB::queryFirstRow(
6742 6741
             'SELECT label, id_tree
6743
-            FROM ' . prefixTable('items') . '
6742
+            FROM ' . prefixTable('items').'
6744 6743
             WHERE id = %i',
6745 6744
             $inputData['itemId']
6746 6745
         );
@@ -6794,7 +6793,7 @@  discard block
 block discarded – undo
6794 6793
 
6795 6794
         DB::query(
6796 6795
             'SELECT *
6797
-            FROM ' . prefixTable('notification') . '
6796
+            FROM ' . prefixTable('notification').'
6798 6797
             WHERE item_id = %i AND user_id = %i',
6799 6798
             $inputData['itemId'],
6800 6799
             $session->get('user-id')
@@ -6866,7 +6865,7 @@  discard block
 block discarded – undo
6866 6865
         // And related logs
6867 6866
         $rows = DB::query(
6868 6867
             'SELECT id, file AS filename
6869
-            FROM ' . prefixTable('files') . '
6868
+            FROM ' . prefixTable('files').'
6870 6869
             WHERE id_item = %i AND confirmed = %i',
6871 6870
             $inputData['itemId'],
6872 6871
             0
@@ -6880,12 +6879,12 @@  discard block
 block discarded – undo
6880 6879
             );
6881 6880
 
6882 6881
             // Delete file on server
6883
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6882
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6884 6883
 
6885 6884
             // Delete related logs
6886 6885
             $logFile = DB::query(
6887 6886
                 'SELECT increment_id, raison
6888
-                FROM ' . prefixTable('log_items') . '
6887
+                FROM ' . prefixTable('log_items').'
6889 6888
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6890 6889
                 $inputData['itemId'],
6891 6890
                 $session->get('user-id'),
@@ -6944,7 +6943,7 @@  discard block
 block discarded – undo
6944 6943
         // Confirm attachments
6945 6944
         $rows = DB::query(
6946 6945
             'SELECT id, file AS filename
6947
-            FROM ' . prefixTable('files') . '
6946
+            FROM ' . prefixTable('files').'
6948 6947
             WHERE id_item = %i AND confirmed = %i',
6949 6948
             $inputData['itemId'],
6950 6949
             0
@@ -7026,15 +7025,15 @@  discard block
 block discarded – undo
7026 7025
         case 'autocomplete_tags':
7027 7026
             // Get a list off all existing TAGS
7028 7027
             $listOfTags = '';
7029
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7028
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7030 7029
             foreach ($rows as $record) {
7031 7030
                 if (empty($listOfTags)) {
7032
-                    $listOfTags = '"' . $record['tag'] . '"';
7031
+                    $listOfTags = '"'.$record['tag'].'"';
7033 7032
                 } else {
7034
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7033
+                    $listOfTags .= ', "'.$record['tag'].'"';
7035 7034
                 }
7036 7035
             }
7037
-            echo '[' . $listOfTags . ']';
7036
+            echo '['.$listOfTags.']';
7038 7037
             break;
7039 7038
     }
7040 7039
 }
@@ -7050,7 +7049,7 @@  discard block
 block discarded – undo
7050 7049
 {
7051 7050
     $data = DB::queryFirstRow(
7052 7051
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7053
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7052
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7054 7053
         $groupe
7055 7054
     );
7056 7055
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7163,7 +7162,7 @@  discard block
 block discarded – undo
7163 7162
     $now = time();
7164 7163
     $editionLocks = DB::query(
7165 7164
         'SELECT timestamp, user_id, increment_id
7166
-         FROM ' . prefixTable('items_edition') . '
7165
+         FROM ' . prefixTable('items_edition').'
7167 7166
          WHERE item_id = %i 
7168 7167
          ORDER BY increment_id DESC',
7169 7168
         $itemId
@@ -7209,7 +7208,7 @@  discard block
 block discarded – undo
7209 7208
 
7210 7209
         // Delete related background tasks if any
7211 7210
         $task = DB::queryFirstRow(
7212
-            'SELECT increment_id FROM ' . prefixTable('background_tasks') . '
7211
+            'SELECT increment_id FROM '.prefixTable('background_tasks').'
7213 7212
              WHERE item_id = %i AND finished_at = ""',
7214 7213
             $itemId
7215 7214
         );
@@ -7222,7 +7221,7 @@  discard block
 block discarded – undo
7222 7221
         // Check if encryption process is still running
7223 7222
         DB::queryFirstRow(
7224 7223
             'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
7225
-             FROM ' . prefixTable('background_tasks') . '
7224
+             FROM ' . prefixTable('background_tasks').'
7226 7225
              WHERE item_id = %i AND finished_at = ""
7227 7226
              ORDER BY increment_id DESC',
7228 7227
             $itemId
@@ -7243,7 +7242,7 @@  discard block
 block discarded – undo
7243 7242
         }
7244 7243
 
7245 7244
         return [
7246
-            'status' => true,   // Encryption in progress
7245
+            'status' => true, // Encryption in progress
7247 7246
             'delay' => $delay - $elapsed, // Time remaining before the lock expires
7248 7247
         ];
7249 7248
     }
@@ -7288,7 +7287,7 @@  discard block
 block discarded – undo
7288 7287
 {
7289 7288
     // Check if there's an ongoing background encryption process for the item
7290 7289
     $ongoingProcess = DB::queryFirstRow(
7291
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7290
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7292 7291
         $itemId
7293 7292
     );
7294 7293
 
@@ -7306,7 +7305,7 @@  discard block
 block discarded – undo
7306 7305
 function getUserVisibleFolders(int $userId): array
7307 7306
 {
7308 7307
     // Query to retrieve visible folders for the user
7309
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7308
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7310 7309
     
7311 7310
     // Decode JSON data into an array; return an empty array if the data is invalid
7312 7311
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7330,7 +7329,7 @@  discard block
 block discarded – undo
7330 7329
 
7331 7330
     // Query the access rights for the given roles and folder
7332 7331
     $accessTypes = DB::queryFirstColumn(
7333
-        'SELECT DISTINCT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7332
+        'SELECT DISTINCT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7334 7333
         $roles, 
7335 7334
         $treeId
7336 7335
     );
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
         
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
         
143 143
             // get a token
144 144
             $token = GenerateCryptKey(20, false, true, true, false, true);
145 145
         
146 146
             //save file
147
-            $filename = time() . '-' . $token . '.sql';
148
-            $filepath = $SETTINGS['path_to_files_folder'] . '/' . $filename;
147
+            $filename = time().'-'.$token.'.sql';
148
+            $filepath = $SETTINGS['path_to_files_folder'].'/'.$filename;
149 149
             $handle = fopen($filepath, 'w+');
150 150
             
151 151
             if ($handle === false) {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $tables = array();
164 164
             $result = DB::query('SHOW TABLES');
165 165
             foreach ($result as $row) {
166
-                $tables[] = $row['Tables_in_' . DB_NAME];
166
+                $tables[] = $row['Tables_in_'.DB_NAME];
167 167
             }
168 168
         
169 169
             $backupSuccess = true;
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
                 if (empty($pre) || substr_count($table, $pre) > 0) {
174 174
                     $table = safeString($table);
175 175
                     // Write table drop and creation
176
-                    fwrite($handle, 'DROP TABLE IF EXISTS ' . $table . ";\n");
177
-                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
178
-                    fwrite($handle, safeString($row2['Create Table']) . ";\n\n");
176
+                    fwrite($handle, 'DROP TABLE IF EXISTS '.$table.";\n");
177
+                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
178
+                    fwrite($handle, safeString($row2['Create Table']).";\n\n");
179 179
         
180 180
                     // Get field information
181 181
                     DB::query(
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                         }
201 201
                         
202 202
                         foreach ($rows as $record) {
203
-                            $insertQuery = 'INSERT INTO ' . $table . ' VALUES(';
203
+                            $insertQuery = 'INSERT INTO '.$table.' VALUES(';
204 204
                             $values = array();
205 205
                             
206 206
                             foreach ($record as $value) {
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
                                 if ($value === null) {
209 209
                                     $values[] = 'NULL';
210 210
                                 } else {
211
-                                    $values[] = '"' . addslashes(preg_replace("/\n/", '\\n', $value)) . '"';
211
+                                    $values[] = '"'.addslashes(preg_replace("/\n/", '\\n', $value)).'"';
212 212
                                 }
213 213
                             }
214 214
                             
215
-                            $insertQuery .= implode(',', $values) . ");\n";
215
+                            $insertQuery .= implode(',', $values).");\n";
216 216
                             fwrite($handle, $insertQuery);
217 217
                             
218 218
                             // Flush buffer periodically to free memory
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
                 prepareFileWithDefuse(
243 243
                     'encrypt',
244 244
                     $filepath,
245
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
245
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
246 246
                     $post_key
247 247
                 );
248 248
         
249 249
                 // Do clean
250 250
                 unlink($filepath);
251 251
                 rename(
252
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
252
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
253 253
                     $filepath
254 254
                 );
255 255
             }
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
                 array(
271 271
                     'error' => false,
272 272
                     'message' => '',
273
-                    'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
274
-                        '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
275
-                        $session->get('user-key_tmp') . '&pathIsFiles=1',
273
+                    'download' => 'sources/downloadFile.php?name='.urlencode($filename).
274
+                        '&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
275
+                        $session->get('user-key_tmp').'&pathIsFiles=1',
276 276
                 ),
277 277
                 'encode'
278 278
             );
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
                 error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
334 334
             }
335 335
         
336
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
336
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
337 337
         
338 338
             if (empty($post_clearFilename) === true) {
339 339
                 // Get filename from database
340 340
                 $data = DB::queryFirstRow(
341 341
                     'SELECT valeur
342
-                    FROM ' . prefixTable('misc') . '
342
+                    FROM ' . prefixTable('misc').'
343 343
                     WHERE increment_id = %i',
344 344
                     $post_backupFile
345 345
                 );
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 $post_backupFile = safeString($data['valeur']);
367 367
                 
368 368
                 // Verify file exists
369
-                if (!file_exists($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile)) {
369
+                if (!file_exists($SETTINGS['path_to_files_folder'].'/'.$post_backupFile)) {
370 370
                     echo prepareExchangedData(
371 371
                         array(
372 372
                             'error' => true,
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
                     // Decrypt the file
384 384
                     $ret = prepareFileWithDefuse(
385 385
                         'decrypt',
386
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
387
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
386
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
387
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
388 388
                         $post_key
389 389
                     );
390 390
                     
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
                     }
402 402
         
403 403
                     // Do clean
404
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
405
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
404
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
405
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
406 406
                 } else {
407 407
                     echo prepareExchangedData(
408 408
                         array(
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                                 DB::query($query);
485 485
                                 $executedQueries++;
486 486
                             } catch (Exception $e) {
487
-                                $errors[] = "Error executing query: " . $e->getMessage() . " - Query: " . substr($query, 0, 100) . "...";
487
+                                $errors[] = "Error executing query: ".$e->getMessage()." - Query: ".substr($query, 0, 100)."...";
488 488
                             }
489 489
                             $query = '';
490 490
                         }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             } catch (Exception $e) {
501 501
                 // Rollback transaction on any exception
502 502
                 DB::rollback();
503
-                $errors[] = "Transaction failed: " . $e->getMessage();
503
+                $errors[] = "Transaction failed: ".$e->getMessage();
504 504
             }
505 505
         
506 506
             // Calculate the new offset
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                 echo prepareExchangedData(
516 516
                     array(
517 517
                         'error' => true,
518
-                        'message' => 'Errors occurred during import: ' . implode('; ', $errors),
518
+                        'message' => 'Errors occurred during import: '.implode('; ', $errors),
519 519
                         'newOffset' => $newOffset,
520 520
                         'totalSize' => $post_totalSize,
521 521
                         'clearFilename' => $post_backupFile,
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
                     && $t->personal_folder == 0
138 138
                 ) {
139 139
                     // get $t->parent_id
140
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
140
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
141 141
                     if ($t->nlevel == 1) {
142 142
                         $data['title'] = $lang->get('root');
143 143
                     }
144 144
 
145 145
                     // get rights on this folder
146 146
                     $arrayRights = array();
147
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
147
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
148 148
                     foreach ($rows as $record) {
149 149
                         array_push($arrayRights, $record['fonction_id']);
150 150
                     }
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
163 163
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification,
164 164
                         n.fa_icon AS fa_icon, n.fa_icon_selected AS fa_icon_selected
165
-                        FROM ' . prefixTable('misc') . ' AS m,
166
-                        ' . prefixTable('nested_tree') . ' AS n
165
+                        FROM ' . prefixTable('misc').' AS m,
166
+                        ' . prefixTable('nested_tree').' AS n
167 167
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
168 168
                         'complex',
169 169
                         $t->id
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
                         $arrayColumns['folderComplexity'] = '';
192 192
                     }
193 193
 
194
-                    if (is_null($node_data)=== false) {
194
+                    if (is_null($node_data) === false) {
195 195
                         $arrayColumns['renewalPeriod'] = (int) $node_data['renewal_period'];
196 196
                     } else {
197
-                        $arrayColumns['renewalPeriod']=0;
197
+                        $arrayColumns['renewalPeriod'] = 0;
198 198
                     }
199 199
 
200 200
                     //col7
201 201
                     $data7 = DB::queryFirstRow(
202 202
                         'SELECT bloquer_creation,bloquer_modification
203
-                        FROM ' . prefixTable('nested_tree') . '
203
+                        FROM ' . prefixTable('nested_tree').'
204 204
                         WHERE id = %i',
205 205
                         intval($t->id)
206 206
                     );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             // Get info about this folder
359 359
             $dataFolder = DB::queryFirstRow(
360 360
                 'SELECT *
361
-                FROM ' . prefixTable('nested_tree') . '
361
+                FROM ' . prefixTable('nested_tree').'
362 362
                 WHERE id = %i',
363 363
                 $inputData['id']
364 364
             );
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             //check if parent folder is personal
395 395
             $dataParent = DB::queryFirstRow(
396 396
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
397
-                FROM ' . prefixTable('nested_tree') . '
397
+                FROM ' . prefixTable('nested_tree').'
398 398
                 WHERE id = %i',
399 399
                 $inputData['parentId']
400 400
             );
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                     // get complexity level for this folder
424 424
                     $data = DB::queryFirstRow(
425 425
                         'SELECT valeur
426
-                        FROM ' . prefixTable('misc') . '
426
+                        FROM ' . prefixTable('misc').'
427 427
                         WHERE intitule = %i AND type = %s',
428 428
                         $inputData['parentId'],
429 429
                         'complex'
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                             array(
435 435
                                 'error' => true,
436 436
                                 'message' => $lang->get('error_folder_complexity_lower_than_top_folder')
437
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
437
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
438 438
                             ),
439 439
                             'encode'
440 440
                         );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             // Check if parent folder is personal
595 595
             $dataParent = DB::queryFirstRow(
596 596
                 'SELECT personal_folder
597
-                FROM ' . prefixTable('nested_tree') . '
597
+                FROM ' . prefixTable('nested_tree').'
598 598
                 WHERE id = %i',
599 599
                 $inputData['parentId']
600 600
             );
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
             echo prepareExchangedData(
635 635
                 array(
636 636
                     'error' => $creationStatus['error'],
637
-                    'message' => $creationStatus['error'] === true ? $lang->get('error_not_allowed_to') : $lang->get('folder_created') ,
637
+                    'message' => $creationStatus['error'] === true ? $lang->get('error_not_allowed_to') : $lang->get('folder_created'),
638 638
                     'newId' => $creationStatus['newId'],
639 639
                 ),
640 640
                 'encode'
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                 echo prepareExchangedData(
683 683
                     array(
684 684
                         'error' => true,
685
-                        'message' => $lang->get('error_not_allowed_to'). " (You can't delete the root folder)",
685
+                        'message' => $lang->get('error_not_allowed_to')." (You can't delete the root folder)",
686 686
                     ),
687 687
                     'encode'
688 688
                 );
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
             // Ensure that user has access to all folders
693 693
             $foldersAccessible = DB::query(
694 694
                 'SELECT id
695
-                FROM ' . prefixTable('nested_tree') . '
695
+                FROM ' . prefixTable('nested_tree').'
696 696
                 WHERE id IN %li AND id IN %li',
697 697
                 $post_folders,
698 698
                 $session->get('user-accessible_folders')
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
                 echo prepareExchangedData(
707 707
                     array(
708 708
                         'error' => true,
709
-                        'message' => $lang->get('error_not_allowed_to') . ' (The following folders are not accessible or do not exist: ' . implode(', ', $missingFolders) . ')',
709
+                        'message' => $lang->get('error_not_allowed_to').' (The following folders are not accessible or do not exist: '.implode(', ', $missingFolders).')',
710 710
                     ),
711 711
                     'encode'
712 712
                 );
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
                 // Check if parent folder is personal
724 724
                 $dataParent = DB::queryFirstRow(
725 725
                     'SELECT personal_folder
726
-                    FROM ' . prefixTable('nested_tree') . '
726
+                    FROM ' . prefixTable('nested_tree').'
727 727
                     WHERE id = %i',
728 728
                     $folderId
729 729
                 );
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
                                 prefixTable('misc'),
770 770
                                 array(
771 771
                                     'type' => 'folder_deleted',
772
-                                    'intitule' => 'f' . $thisSubFolders->id,
773
-                                    'valeur' => $thisSubFolders->id . ', ' . $thisSubFolders->parent_id . ', ' .
774
-                                        $thisSubFolders->title . ', ' . $thisSubFolders->nleft . ', ' . $thisSubFolders->nright . ', ' .
775
-                                        $thisSubFolders->nlevel . ', 0, 0, 0, 0',
772
+                                    'intitule' => 'f'.$thisSubFolders->id,
773
+                                    'valeur' => $thisSubFolders->id.', '.$thisSubFolders->parent_id.', '.
774
+                                        $thisSubFolders->title.', '.$thisSubFolders->nleft.', '.$thisSubFolders->nright.', '.
775
+                                        $thisSubFolders->nlevel.', 0, 0, 0, 0',
776 776
                                     'created_at' => time(),
777 777
                                 )
778 778
                             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 
782 782
                             //delete items & logs
783 783
                             $itemsInSubFolder = DB::query(
784
-                                'SELECT id FROM ' . prefixTable('items') . ' 
784
+                                'SELECT id FROM '.prefixTable('items').' 
785 785
                                 WHERE id_tree=%i', 
786 786
                                 $thisSubFolders->id
787 787
                             );
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                                 }
812 812
 
813 813
                                 //Update CACHE table
814
-                                updateCacheTable('delete_value',(int) $item['id']);
814
+                                updateCacheTable('delete_value', (int) $item['id']);
815 815
                             }
816 816
 
817 817
                             //Actualize the variable
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
             // Check if target parent folder is personal
922 922
             $dataParent = DB::queryFirstRow(
923 923
                 'SELECT personal_folder
924
-                FROM ' . prefixTable('nested_tree') . '
924
+                FROM ' . prefixTable('nested_tree').'
925 925
                 WHERE id = %i',
926 926
                 $post_target_folder_id
927 927
             );
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
                 // get complexity of current node
976 976
                 $nodeComplexity = DB::queryFirstRow(
977 977
                     'SELECT valeur
978
-                    FROM ' . prefixTable('misc') . '
978
+                    FROM ' . prefixTable('misc').'
979 979
                     WHERE intitule = %i AND type= %s',
980 980
                     $nodeInfo->id,
981 981
                     'complex'
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1053 1053
                 $rows = DB::query(
1054 1054
                     'SELECT role_id, type
1055
-                    FROM ' . prefixTable('roles_values') . '
1055
+                    FROM ' . prefixTable('roles_values').'
1056 1056
                     WHERE folder_id = %i',
1057 1057
                     $parentId
1058 1058
                 );
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
                 // if parent folder has Custom Fields Categories then add to this child one too
1072 1072
                 $rows = DB::query(
1073 1073
                     'SELECT id_category
1074
-                    FROM ' . prefixTable('categories_folders') . '
1074
+                    FROM ' . prefixTable('categories_folders').'
1075 1075
                     WHERE id_folder = %i',
1076 1076
                     $nodeInfo->id
1077 1077
                 );
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
                 $rows = DB::query(
1092 1092
                     'SELECT *
1093
-                    FROM ' . prefixTable('items') . '
1093
+                    FROM ' . prefixTable('items').'
1094 1094
                     WHERE id_tree = %i',
1095 1095
                     $nodeInfo->id
1096 1096
                 );
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                     // if it is then don't copy it
1100 1100
                     $item_deleted = DB::queryFirstRow(
1101 1101
                         'SELECT *
1102
-                        FROM ' . prefixTable('log_items') . '
1102
+                        FROM ' . prefixTable('log_items').'
1103 1103
                         WHERE id_item = %i AND action = %s
1104 1104
                         ORDER BY date DESC
1105 1105
                         LIMIT 0, 1',
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 
1111 1111
                     $item_restored = DB::queryFirstRow(
1112 1112
                         'SELECT *
1113
-                        FROM ' . prefixTable('log_items') . '
1113
+                        FROM ' . prefixTable('log_items').'
1114 1114
                         WHERE id_item = %i AND action = %s
1115 1115
                         ORDER BY date DESC
1116 1116
                         LIMIT 0, 1',
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
                         // Get the ITEM object key for the user
1126 1126
                         $userKey = DB::queryFirstRow(
1127 1127
                             'SELECT share_key
1128
-                            FROM ' . prefixTable('sharekeys_items') . '
1128
+                            FROM ' . prefixTable('sharekeys_items').'
1129 1129
                             WHERE user_id = %i AND object_id = %i',
1130 1130
                             $session->get('user-id'),
1131 1131
                             $record['id']
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
                     // Get path
1288 1288
                     $text = '';
1289 1289
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1290
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1290
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1291 1291
                     }
1292 1292
 
1293 1293
                     // Save array
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
                             'id' => (int) $folder->id,
1298 1298
                             'label' => $folder->title,
1299 1299
                             'level' => $folder->nlevel,
1300
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1300
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1301 1301
                         )
1302 1302
                     );
1303 1303
                 }
Please login to merge, or discard this patch.
pages/users.js.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === false) {
73 73
     // Not allowed page
74 74
     $session->set('system-error_code', ERR_NOT_ALLOWED);
75
-    include $SETTINGS['cpassman_dir'] . '/error.php';
75
+    include $SETTINGS['cpassman_dir'].'/error.php';
76 76
     exit;
77 77
 }
78 78
 ?>
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
         if (store.get('teampassApplication').formUserAction === "add_new_user") {
326 326
             var data = {
327 327
                 'receipt': $('#form-email').val(),
328
-                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code');?>',
329
-                'body': '<?php echo $lang->get('email_body_new_user');?>',
328
+                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code'); ?>',
329
+                'body': '<?php echo $lang->get('email_body_new_user'); ?>',
330 330
                 'pre_replace' : {
331 331
                     '#code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
332 332
                     '#login#' : store.get('teampassUser').admin_new_user_login,
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
         } else {
337 337
             var data = {
338 338
                 'receipt': $('#form-email').val(),
339
-                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code');?>',
340
-                'body': '<?php echo $lang->get('email_body_temporary_encryption_code');?>',
339
+                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code'); ?>',
340
+                'body': '<?php echo $lang->get('email_body_temporary_encryption_code'); ?>',
341 341
                 'pre_replace' : {
342 342
                     '#enc_code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
343 343
                 }
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
             }
533 533
             // Inform user
534 534
             $("#warningModalBody").html('<b><?php echo $lang->get('encryption_keys'); ?> - ' +
535
-                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + ']<span id="warningModalBody_extra">' + $nbItemsToConvert + '</span> ' +
535
+                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + ']<span id="warningModalBody_extra">' + $nbItemsToConvert + '</span> ' +
536 536
                 '... <?php echo $lang->get('please_wait'); ?><i class="fa-solid fa-spinner fa-pulse ml-3 text-primary"></i>');
537 537
 
538 538
             // If expected, show the OPT to the admin
539 539
             if (constVisibleOTP === true) {
540 540
                 toastr.info(
541
-                    '<?php echo $lang->get('show_encryption_code_to_admin');?> <div><input class="form-control form-item-control flex-nowrap" value="' + userTemporaryCode + '" readonly></div>'
542
-                    + '<br /><button type="button" class="btn clear"><?php echo $lang->get('close');?></button>',
541
+                    '<?php echo $lang->get('show_encryption_code_to_admin'); ?> <div><input class="form-control form-item-control flex-nowrap" value="' + userTemporaryCode + '" readonly></div>'
542
+                    + '<br /><button type="button" class="btn clear"><?php echo $lang->get('close'); ?></button>',
543 543
                     '<?php echo $lang->get('information'); ?>',
544 544
                     {
545 545
                         extendedTimeOut: 0,
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
             var data = {
559 559
                 action: step,
560 560
                 start: start,
561
-                length: <?php echo NUMBER_ITEMS_IN_BATCH;?>,
561
+                length: <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
562 562
                 user_id: userId,
563 563
             }
564 564
             if (debugJavascript === true) {
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
                         } else {
1396 1396
                             // Show icon or not
1397 1397
                             if ($('#user-disabled').prop('checked') === true) {
1398
-                                $('#user-login-'+userID).before('<i class="fa-solid fa-user-slash infotip text-danger mr-2" title="<?php echo $lang->get('account_is_locked');?>" id="user-disable-'+userID+'"></i>');
1398
+                                $('#user-login-'+userID).before('<i class="fa-solid fa-user-slash infotip text-danger mr-2" title="<?php echo $lang->get('account_is_locked'); ?>" id="user-disable-'+userID+'"></i>');
1399 1399
                             } else {
1400 1400
                                 $('#user-disable-'+userID).remove();
1401 1401
                             }
Please login to merge, or discard this patch.
pages/users.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 // If administrator then all roles are shown
93 93
 // else only the Roles the users is associated to.
94 94
 if ((int) $session->get('user-admin') === 1) {
95
-    $optionsManagedBy .= '<option value="0">' . $lang->get('administrators_only') . '</option>';
95
+    $optionsManagedBy .= '<option value="0">'.$lang->get('administrators_only').'</option>';
96 96
 }
97 97
 
98 98
 $rows = DB::query(
99 99
     'SELECT id, title, creator_id
100
-    FROM ' . prefixTable('roles_title') . '
100
+    FROM ' . prefixTable('roles_title').'
101 101
     ORDER BY title ASC'
102 102
 );
103 103
 foreach ($rows as $record) {
104 104
     if ((int) $session->get('user-admin') === 1 || in_array($record['id'], $session->get('user-roles_array')) === true) {
105
-        $optionsManagedBy .= '<option value="' . $record['id'] . '">' . $lang->get('managers_of') . ' ' . addslashes($record['title']) . '</option>';
105
+        $optionsManagedBy .= '<option value="'.$record['id'].'">'.$lang->get('managers_of').' '.addslashes($record['title']).'</option>';
106 106
     }
107 107
     if (
108 108
         (int) $session->get('user-admin') === 1
109 109
         || (((int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1)
110 110
             && (in_array($record['id'], $userRoles) === true) || (int) $record['creator_id'] === (int) $session->get('user-id'))
111 111
     ) {
112
-        $optionsRoles .= '<option value="' . $record['id'] . '">' . addslashes($record['title']) . '</option>';
112
+        $optionsRoles .= '<option value="'.$record['id'].'">'.addslashes($record['title']).'</option>';
113 113
     }
114 114
 }
115 115
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         for ($y = 1; $y < $t->nlevel; ++$y) {
125 125
             $ident .= '&nbsp;&nbsp;';
126 126
         }
127
-        $foldersList .= '<option value="' . $t->id . '">' . $ident . htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8') . '</option>';
127
+        $foldersList .= '<option value="'.$t->id.'">'.$ident.htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8').'</option>';
128 128
     }
129 129
 }
130 130
 
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
                         </button><?php
162 162
                                     echo isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && (int) $session->get('user-admin') === 1 ?
163 163
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="ldap-sync">
164
-                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization') . '
164
+                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization').'
165 165
                         </button>' : '';
166 166
                                     ?>
167 167
                         </button><?php
168 168
                                     echo isset($SETTINGS['oauth2_enabled']) === true && (int) $SETTINGS['oauth2_enabled'] === 1 && (int) $session->get('user-admin') === 1 ?
169 169
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="oauth2-sync">
170
-                            <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization') . '
170
+                            <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization').'
171 171
                         </button>' : '';
172 172
                                     ?>
173 173
                     </h3>
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
                 <!-- /.card-header -->
177 177
                 <div class="card-body form" id="users-list">
178
-                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons');?></span></label>
178
+                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons'); ?></span></label>
179 179
                     <table id="table-users" class="table table-striped nowrap table-responsive-sm">
180 180
                         <thead>
181 181
                             <tr>
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                                             <?php
240 240
                                             foreach (TP_PW_COMPLEXITY as $entry) {
241 241
                                                 echo '
242
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
242
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
243 243
                                             }
244 244
                                             ?>
245 245
                                         </select>
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                                             <?php
317 317
                                             foreach (TP_PW_COMPLEXITY as $entry) {
318 318
                                                 echo '
319
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
319
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
320 320
                                             }
321 321
                                             ?>
322 322
                                         </select>
Please login to merge, or discard this patch.
sources/users.datatable.php 1 patch
Spacing   +15 added lines, -17 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) {
129 129
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
130 130
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
131
-        $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', ';
131
+        $sOrder .= $aColumns[$columnIndex].' '.$dir.', ';
132 132
     }
133 133
 
134 134
     $sOrder = substr_replace($sOrder, '', -2);
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 
153 153
 if ($letter !== '' && $letter !== 'None') {
154 154
     $sWhere .= ' AND (';
155
-    $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
156
-    $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
157
-    $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
155
+    $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
156
+    $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
157
+    $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
158 158
     $sWhere .= ')';
159 159
 } elseif ($searchValue !== '') {
160 160
     $sWhere .= ' AND (';
161
-    $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
162
-    $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
163
-    $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
161
+    $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
162
+    $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
163
+    $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
164 164
     $sWhere .= ')';
165 165
 }
166 166
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         // Check for existing lock
247 247
         $unlock_at = DB::queryFirstField(
248 248
             'SELECT MAX(unlock_at)
249
-             FROM ' . prefixTable('auth_failures') . '
249
+             FROM ' . prefixTable('auth_failures').'
250 250
              WHERE unlock_at > %s AND source = %s AND value = %s',
251 251
             date('Y-m-d H:i:s', time()),
252 252
             'login',
@@ -255,33 +255,31 @@  discard block
 block discarded – undo
255 255
 
256 256
         // Get some infos about user
257 257
         $userDisplayInfos = 
258
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
258
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
259 259
             .
260 260
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ".
261
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
261
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
262 262
             .
263 263
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '')
264 264
             .
265 265
             (($record['auth_type'] === 'ldap' || $record['auth_type'] === 'oauth2') ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '')
266 266
             .
267 267
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ?
268
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') :
269
-                ''
268
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : ''
270 269
                 )
271 270
             .
272 271
             (($unlock_at) ? '<i class=\"fas fa-solid text-red fa-lock infotip text-info ml-1\" title=\"'.$lang->get('bruteforce_unlock_at').$unlock_at.'\"></i>' : '');
273 272
         if ($request->query->filter('display_warnings', '', FILTER_VALIDATE_BOOLEAN) === true) {
274 273
             $userDisplayInfos .= '<br>'.
275 274
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? 
276
-                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' :
277
-                    ''
275
+                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : ''
278 276
                 ).
279 277
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['pw_passwordlib'] === 1) ? '<i class=\"fa-solid fa-person-walking-luggage infotip ml-1\" style=\"color:Tomato\" title=\"Old password encryption. Shall login to initialize.\"></i>' : '');
280 278
         }
281 279
 
282 280
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
283
-            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').' '.
284
-            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').
281
+            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').' '.
282
+            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').
285 283
             '\" data-auth-type=\"'.$record['auth_type'].'\" data-special=\"'.$record['special'].'\" data-mfa-enabled=\"'.$record['mfa_enabled'].'\" data-otp-provided=\"'.(isset($record['otp_provided']) === true ? $record['otp_provided'] : '').'\"></span>", ';
286 284
         //col2
287 285
         $sOutput .= '"'.
Please login to merge, or discard this patch.