Passed
Push — dev ( 8b84d5...475726 )
by Nils
05:50
created
sources/import.queries.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 ) {
72 72
     // Not allowed page
73 73
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $lexer = new Lexer($config);
163 163
             $config->setIgnoreHeaderLine('true');
164 164
             $interpreter = new Interpreter();
165
-            $interpreter->addObserver(function (array $row) use (&$valuesToImport) {
165
+            $interpreter->addObserver(function(array $row) use (&$valuesToImport) {
166 166
                 $valuesToImport[] = array(
167 167
                     'Label' => $row[0],
168 168
                     'Login' => $row[1],
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         {
504 504
             // Manage entries
505 505
             if (isset($array['Entry']) === true) {
506
-                foreach($array['Entry'] as $key => $value) {
506
+                foreach ($array['Entry'] as $key => $value) {
507 507
                     if (isset($value['String']) === true) {
508 508
                         $itemDefinition = [];
509 509
                         $c = count($value['String']);
@@ -538,13 +538,13 @@  discard block
 block discarded – undo
538 538
             }
539 539
 
540 540
             // Manage GROUPS
541
-            if (isset($array['Group']) === true && is_array($array['Group'])=== true) {
541
+            if (isset($array['Group']) === true && is_array($array['Group']) === true) {
542 542
                 $currentFolderId = $previousFolder;
543 543
                 if (isset($array['Group']['UUID']) === true) {
544 544
                     // build expect array format
545 545
                     $array['Group'] = [$array['Group']];
546 546
                 }
547
-                foreach($array['Group'] as $key => $value){
547
+                foreach ($array['Group'] as $key => $value) {
548 548
                     // Add this new folder
549 549
                     array_push(
550 550
                         $newItemsToAdd['folders'],
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
         ];
638 638
         $startPathLevel = 1;
639 639
 
640
-        foreach($post_folders as $folder) {
640
+        foreach ($post_folders as $folder) {
641 641
             // get parent id
642 642
             $parentId = $arrFolders[$folder['parentFolderId']];
643 643
 
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
     ];
942 942
 }
943 943
 
944
-spl_autoload_register(function ($class) {
944
+spl_autoload_register(function($class) {
945 945
     $prefix = 'League\\Csv\\';
946 946
     $base_dir = __DIR__.'/src/';
947 947
     $len = strlen($prefix);
Please login to merge, or discard this patch.
sources/upload.files.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 ) {
69 69
     // Not allowed page
70 70
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     } else {
119 119
         // check if token is expired
120 120
         $data = DB::queryFirstRow(
121
-            'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s',
121
+            'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s',
122 122
             $_SESSION['user_id'],
123 123
             $post_user_token
124 124
         );
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 
143 143
 // HTTP headers for no cache etc
144 144
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
145
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
145
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
146 146
 header('Cache-Control: no-store, no-cache, must-revalidate');
147 147
 header('Cache-Control: post-check=0, pre-check=0', false);
148 148
 
149 149
 if (null !== $post_type_upload && $post_type_upload === 'upload_profile_photo') {
150
-    $targetDir = $SETTINGS['cpassman_dir'] . '/includes/avatars';
150
+    $targetDir = $SETTINGS['cpassman_dir'].'/includes/avatars';
151 151
 } else {
152 152
     $targetDir = $SETTINGS['path_to_files_folder'];
153 153
 }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
 // Validate file name (for our purposes we'll just remove invalid characters)
210 210
 $file_name = preg_replace(
211
-    '/[^' . $valid_chars_regex . '\.]/',
211
+    '/[^'.$valid_chars_regex.'\.]/',
212 212
     '',
213 213
     filter_var(
214 214
         strtolower(basename($_FILES['file']['name'])),
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     )
217 217
 );
218 218
 if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
219
-    handleUploadError('Invalid file name: ' . $file_name . '.');
219
+    handleUploadError('Invalid file name: '.$file_name.'.');
220 220
     return false;
221 221
 }
222 222
 
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
         $ext,
232 232
         explode(
233 233
             ',',
234
-            $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
235
-                ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
234
+            $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
235
+                ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
236 236
         )
237 237
     ) === false
238 238
     && $post_type_upload !== 'import_items_from_keepass'
@@ -245,28 +245,28 @@  discard block
 block discarded – undo
245 245
 
246 246
 // is destination folder writable
247 247
 if (is_writable($SETTINGS['path_to_files_folder']) === false) {
248
-    handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
248
+    handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
249 249
     return false;
250 250
 }
251 251
 
252 252
 // Clean the fileName for security reasons
253 253
 $fileName = preg_replace('/[^\w\.]+/', '_', $fileName);
254
-$fileName = preg_replace('/[^' . $valid_chars_regex . '\.]/', '', strtolower(basename($fileName)));
254
+$fileName = preg_replace('/[^'.$valid_chars_regex.'\.]/', '', strtolower(basename($fileName)));
255 255
 
256 256
 // Make sure the fileName is unique but only if chunking is disabled
257
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
257
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
258 258
     $fileNameA = substr($fileName, 0, strlen($ext));
259 259
     $fileNameB = substr($fileName, strlen($ext));
260 260
 
261 261
     $count = 1;
262
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
262
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
263 263
         ++$count;
264 264
     }
265 265
 
266
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
266
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
267 267
 }
268 268
 
269
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
269
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
270 270
 
271 271
 // Create target dir
272 272
 if (!file_exists($targetDir)) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 // Remove old temp files
281 281
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
282 282
     while (($file = readdir($dir)) !== false) {
283
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
283
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
284 284
 
285 285
         // Remove temp file if it is older than the max age and is not the current file
286 286
         if (
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 ) {
377 377
     rename(
378 378
         $filePath,
379
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
379
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
380 380
     );
381 381
 
382 382
     // Add in DB
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 ) {
406 406
     rename(
407 407
         $filePath,
408
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
408
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
409 409
     );
410 410
 
411 411
     // Add in DB
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
     // rename the file
439 439
     rename(
440 440
         $filePath,
441
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext
441
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext
442 442
     );
443 443
 
444 444
     // make thumbnail
445 445
     $ret = makeThumbnail(
446
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext,
447
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext,
446
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext,
447
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext,
448 448
         40
449 449
     );
450 450
 
@@ -455,21 +455,21 @@  discard block
 block discarded – undo
455 455
     }
456 456
 
457 457
     // get current avatar and delete it
458
-    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $_SESSION['user_id']);
459
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS);
460
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS);
458
+    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $_SESSION['user_id']);
459
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS);
460
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS);
461 461
 
462 462
     // store in DB the new avatar
463 463
     DB::query(
464
-        'UPDATE ' . prefixTable('users') . "
465
-        SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "'
464
+        'UPDATE '.prefixTable('users')."
465
+        SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."'
466 466
         WHERE id=%i",
467 467
         $_SESSION['user_id']
468 468
     );
469 469
 
470 470
     // store in session
471
-    $_SESSION['user_avatar'] = $newFileName . '.' . $ext;
472
-    $_SESSION['user_avatar_thumb'] = $newFileName . '_thumb' . '.' . $ext;
471
+    $_SESSION['user_avatar'] = $newFileName.'.'.$ext;
472
+    $_SESSION['user_avatar_thumb'] = $newFileName.'_thumb'.'.'.$ext;
473 473
 
474 474
     // return info
475 475
     echo prepareExchangedData(
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 ) {
489 489
     rename(
490 490
         $filePath,
491
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
491
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
492 492
     );
493 493
 
494 494
     // Add in DB
Please login to merge, or discard this patch.
sources/roles.queries.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 ) {
69 69
     // Not allowed page
70 70
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
                 echo prepareExchangedData(
740 740
                     array(
741 741
                         'error' => true,
742
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
742
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
743 743
                     ),
744 744
                     'encode'
745 745
                 );
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
                 $matches
756 756
             );
757 757
             $searchCriteria = [];
758
-            foreach($matches[0] as $match) {
758
+            foreach ($matches[0] as $match) {
759 759
                 $parts = [];
760 760
                 if (!str_contains($match, ',')) {
761 761
                     $tmp = explode("=", trim($match, '()'));
@@ -770,14 +770,14 @@  discard block
 block discarded – undo
770 770
 
771 771
             // check if synched with roles in Teampass
772 772
             $retAD = [];
773
-            foreach($retGroups as $key => $group) {
773
+            foreach ($retGroups as $key => $group) {
774 774
                 // exists in Teampass
775 775
                 $role_detail = DB::queryfirstrow(
776 776
                     'SELECT a.increment_id, a.role_id, r.title
777 777
                     FROM '.prefixTable('ldap_groups_roles').' AS a
778 778
                     INNER JOIN '.prefixTable('roles_title').' AS r ON r.id = a.role_id
779 779
                     WHERE ldap_group_id = %i',
780
-                    $group[(isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false ? $SETTINGS['ldap_guid_attibute']: 'gidnumber')][0]
780
+                    $group[(isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false ? $SETTINGS['ldap_guid_attibute'] : 'gidnumber')][0]
781 781
                 );
782 782
                 $counter = DB::count();
783 783
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                     [
793 793
                         'ad_group_id' => (int) $group[(isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false ? $SETTINGS['ldap_guid_attibute'] : 'gidnumber')][0],
794 794
                         'ad_group_title' => $group['cn'][0],
795
-                        'role_id' => $counter> 0 ? (int) $role_detail['role_id'] : -1,
795
+                        'role_id' => $counter > 0 ? (int) $role_detail['role_id'] : -1,
796 796
                         'id' => $counter > 0 ? (int) $role_detail['increment_id'] : -1,
797 797
                         'role_title' => $counter > 0 ? $role_detail['title'] : '',
798 798
                     ]
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
             
803 803
             // Get all groups in Teampass
804 804
             $teampassRoles = array();
805
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
805
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
806 806
             foreach ($rows as $record) {
807 807
                 array_push(
808 808
                     $teampassRoles,
Please login to merge, or discard this patch.
sources/users.datatable.php 1 patch
Spacing   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 ) {
72 72
     // Not allowed page
73 73
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 
@@ -232,22 +232,20 @@  discard block
 block discarded – undo
232 232
 
233 233
         // Get some infos about user
234 234
         $userDisplayInfos = 
235
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.langHdl('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
235
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.langHdl('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
236 236
             .
237 237
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.langHdl('index_last_seen').": ".
238
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
238
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
239 239
             .
240 240
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.langHdl('ip').": ".($record['user_ip']).'\"></i>' : '')
241 241
             .
242 242
             ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.langHdl('managed_through_ad').'\"></i>' : '')
243 243
             .
244 244
             ((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)) ?
245
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('mfa_disabled_for_user').'\"></i>') :
246
-                ''
245
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('mfa_disabled_for_user').'\"></i>') : ''
247 246
             ).
248 247
             ((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) ? 
249
-                '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('recovery_keys_not_downloaded').'\"></i>' :
250
-                ''
248
+                '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('recovery_keys_not_downloaded').'\"></i>' : ''
251 249
             );
252 250
         
253 251
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
Please login to merge, or discard this patch.
sources/ldap.activedirectory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     try {
48 48
         Container::addConnection($connection);
49 49
         // get id attribute
50
-        if (isset($SETTINGS['ldap_guid_attibute']) ===true && empty($SETTINGS['ldap_guid_attibute']) === false) {
50
+        if (isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false) {
51 51
             $idAttribute = $SETTINGS['ldap_guid_attibute'];
52 52
         } else {
53 53
             $idAttribute = 'objectguid';
Please login to merge, or discard this patch.
sources/find.queries.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 ) {
73 73
     // Not allowed page
74 74
     $_SESSION['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
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 if (isset($_SESSION['groupes_visibles']) === false
95 95
     || empty($_SESSION['groupes_visibles']) === true
96 96
 ) {
97
-    echo '{"sEcho": ' . intval($_GET['sEcho']) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
97
+    echo '{"sEcho": '.intval($_GET['sEcho']).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
98 98
     exit;
99 99
 }
100 100
 
101 101
 //Columns name
102
-$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data'];//
102
+$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data']; //
103 103
 $aSortTypes = ['ASC', 'DESC'];
104 104
 //init SQL variables
105 105
 $sOrder = $sLimit = $sWhere = '';
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 //Get current user "personal folder" ID
121 121
 $row = DB::query(
122
-    'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i',
122
+    'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i',
123 123
     intval($_SESSION['user_id'])
124 124
 );
125 125
 //get list of personal folders
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 $listPf = '';
129 129
 if (empty($row['id']) === false) {
130 130
     $rows = DB::query(
131
-        'SELECT id FROM ' . prefixTable('nested_tree') . '
131
+        'SELECT id FROM '.prefixTable('nested_tree').'
132 132
         WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i',
133 133
         filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT),
134 134
         filter_var($_SESSION['user_id'], FILTER_SANITIZE_NUMBER_INT)
135 135
     );
136 136
     foreach ($rows as $record) {
137
-        if (! in_array($record['id'], $arrayPf)) {
137
+        if (!in_array($record['id'], $arrayPf)) {
138 138
             //build an array of personal folders ids
139 139
             array_push($arrayPf, $record['id']);
140 140
             //build also a string with those ids
141 141
             if (empty($listPf)) {
142 142
                 $listPf = $record['id'];
143 143
             } else {
144
-                $listPf .= ', ' . $record['id'];
144
+                $listPf .= ', '.$record['id'];
145 145
             }
146 146
         }
147 147
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 //Paging
152 152
 $sLimit = '';
153 153
 if (isset($_GET['start']) === true && $_GET['length'] !== '-1') {
154
-    $sLimit = 'LIMIT ' . filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT) . ', ' . filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT) . '';
154
+    $sLimit = 'LIMIT '.filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT).', '.filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT).'';
155 155
 }
156 156
 
157 157
 //Ordering
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
     }
165 165
     $sOrder = 'ORDER BY  ';
166 166
     if ($_GET['order'][0]['column'] >= 0) {
167
-        $sOrder .= '' . $aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
168
-                . filter_var($_GET['order'][0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . ', ';
167
+        $sOrder .= ''.$aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
168
+                . filter_var($_GET['order'][0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS).', ';
169 169
     }
170 170
 
171 171
     $sOrder = substr_replace($sOrder, '', -2);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $sOrder = '';
174 174
     }
175 175
 } else {
176
-    $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC';
176
+    $sOrder = 'ORDER BY '.$aColumns[1].' ASC';
177 177
 }
178 178
 
179 179
 // Define criteria
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 if (empty($search_criteria) === false) {
196 196
     $sWhere .= ' AND (';
197 197
     for ($i = 0; $i < count($aColumns); ++$i) {
198
-        $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR ';
198
+        $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR ';
199 199
     }
200
-    $sWhere = substr_replace((string) $sWhere, '', -3) . ') ';
200
+    $sWhere = substr_replace((string) $sWhere, '', -3).') ';
201 201
     $crit = [
202 202
         'idtree' => array_unique($folders),
203 203
         '0' => $search_criteria,
@@ -237,16 +237,16 @@  discard block
 block discarded – undo
237 237
     if (empty($sWhere) === false) {
238 238
         $sWhere .= ' AND ';
239 239
     }
240
-    $sWhere = 'WHERE ' . $sWhere . 'c.id_tree NOT IN %ls_pf ';
240
+    $sWhere = 'WHERE '.$sWhere.'c.id_tree NOT IN %ls_pf ';
241 241
 } else {
242
-    $sWhere = 'WHERE ' . $sWhere;
242
+    $sWhere = 'WHERE '.$sWhere;
243 243
 }
244 244
 
245 245
 // Do queries
246 246
 DB::query(
247 247
     "SELECT c.id
248
-    FROM " . prefixTable('cache') . " AS c
249
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
248
+    FROM " . prefixTable('cache')." AS c
249
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
250 250
     ${sWhere}
251 251
     ${sOrder}",
252 252
     $crit
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 $iTotal = DB::count();
255 255
 $rows = DB::query(
256 256
     "SELECT c.*, ci.data, i.item_key
257
-    FROM " . prefixTable('cache') . " AS c
258
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
259
-    INNER JOIN " . prefixTable('items') . " AS i ON (i.id = c.id)
257
+    FROM " . prefixTable('cache')." AS c
258
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
259
+    INNER JOIN " . prefixTable('items')." AS i ON (i.id = c.id)
260 260
     ${sWhere}
261 261
     ${sOrder}
262 262
     ${sLimit}",
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 if (isset($_GET['type']) === false) {
281 281
     $sOutput = '{';
282 282
     if (isset($_GET['draw']) === true) {
283
-        $sOutput .= '"draw": ' . intval($_GET['draw']) . ', ';
283
+        $sOutput .= '"draw": '.intval($_GET['draw']).', ';
284 284
     }
285 285
     $sOutput .= '"data": [';
286 286
     $sOutputConst = '';
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             foreach (explode(';', $_SESSION['fonction_id']) as $role) {
298 298
                 //db::debugmode(true);
299 299
                 $access = DB::queryFirstRow(
300
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
300
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
301 301
                     $role,
302 302
                     $record['id_tree']
303 303
                 );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             }
318 318
             $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel;
319 319
             if ($accessLevel === 0) {
320
-                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">';
320
+                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">';
321 321
             }
322 322
 
323 323
             if ((int) $accessLevel === 0) {
@@ -357,22 +357,22 @@  discard block
 block discarded – undo
357 357
             if (empty($restrictedTo)) {
358 358
                 $restrictedTo = $_SESSION['user_id'];
359 359
             } else {
360
-                $restrictedTo .= ',' . $_SESSION['user_id'];
360
+                $restrictedTo .= ','.$_SESSION['user_id'];
361 361
             }
362 362
         }
363 363
         
364 364
         //col1
365
-        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . langHdl('open_url_link') . '\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group=' . $record['id_tree'] . '&amp;id=' . $record['id'] . '&#039;\" style=\"cursor:pointer;\"></i>' .
366
-        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . stripslashes(langHdl('see_item_title')) . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '",' ;
365
+        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.langHdl('open_url_link').'\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group='.$record['id_tree'].'&amp;id='.$record['id'].'&#039;\" style=\"cursor:pointer;\"></i>'.
366
+        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.stripslashes(langHdl('see_item_title')).'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'",';
367 367
         //col2
368
-        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-' . $record['id'] . '\">' . (str_replace("\\", "&#92;", (string) $record['label'])) . '</span>').'", ';   // replace backslash #3015
368
+        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-'.$record['id'].'\">'.(str_replace("\\", "&#92;", (string) $record['label'])).'</span>').'", '; // replace backslash #3015
369 369
         //col3
370
-        $sOutputItem .= '"' . base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))) . '", ';
370
+        $sOutputItem .= '"'.base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))).'", ';
371 371
         //col4
372 372
         //get restriction from ROles
373 373
         $restrictedToRole = false;
374 374
         $rTmp = DB::queryFirstColumn(
375
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i',
375
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i',
376 376
             $record['id']
377 377
         );
378 378
         // We considere here that if user has at least one group similar to the object ones
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
         } else {
391 391
             $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description']));
392 392
             if (strlen($txt) > 50) {
393
-                $sOutputItem .= '"' . base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)) . '", ';
393
+                $sOutputItem .= '"'.base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)).'", ';
394 394
             } else {
395
-                $sOutputItem .= '"' . base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))) . '", ';
395
+                $sOutputItem .= '"'.base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))).'", ';
396 396
             }
397 397
         }
398 398
 
399 399
         //col5 - TAGS
400
-        $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)) . '", ';
400
+        $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)).'", ';
401 401
         // col6 - URL
402 402
         if ($record['url'] !== '0') {
403 403
             $sOutputItem .= '"'.filter_var($record['url'], FILTER_SANITIZE_URL).'", ';
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
         }
407 407
 
408 408
         //col7 - Prepare the Treegrid
409
-        $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['folder']), ENT_QUOTES)) . '"';
409
+        $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['folder']), ENT_QUOTES)).'"';
410 410
         //Finish the line
411 411
         //$sOutputItem .= '], ';
412 412
         if ($getItemInList === true) {
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
             --$iTotal;
416 416
         }
417 417
     }
418
-    if (! empty($sOutputConst)) {
418
+    if (!empty($sOutputConst)) {
419 419
         $sOutput .= substr_replace($sOutputConst, '', -2);
420 420
     }
421 421
     $sOutput .= '], ';
422
-    $sOutput .= '"recordsTotal": ' . $iTotal . ', ';
423
-    $sOutput .= '"recordsFiltered": ' . $iTotal . ' }';
422
+    $sOutput .= '"recordsTotal": '.$iTotal.', ';
423
+    $sOutput .= '"recordsFiltered": '.$iTotal.' }';
424 424
     echo ($sOutput);
425 425
 } elseif (isset($_GET['type']) && ($_GET['type'] === 'search_for_items' || $_GET['type'] === 'search_for_items_with_tags')) {
426 426
     include_once 'main.functions.php';
427
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
427
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
428 428
 
429 429
     $arr_data = [];
430 430
     foreach ($rows as $record) {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $arr_data[$record['id']]['tree_id'] = (int) $record['id_tree'];
434 434
         $arr_data[$record['id']]['label'] = (string) $record['label'];
435 435
         $arr_data[$record['id']]['desc'] = (string) strip_tags(explode('<br>', $record['description'])[0]);
436
-        $arr_data[$record['id']]['folder'] = (string)$record['folder'];
436
+        $arr_data[$record['id']]['folder'] = (string) $record['folder'];
437 437
         $arr_data[$record['id']]['login'] = (string) strtr($record['login'], '"', '&quot;');
438 438
         $arr_data[$record['id']]['item_key'] = (string) $record['item_key'];
439 439
         $arr_data[$record['id']]['link'] = (string) $record['url'] !== '0' && empty($record['url']) === false ? filter_var($record['url'], FILTER_SANITIZE_URL) : '';
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
         // Anyone can modify?
448 448
         $tmp = DB::queryfirstrow(
449
-            'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i',
449
+            'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i',
450 450
             $record['id']
451 451
         );
452 452
         if (count($tmp) > 0) {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles)
478 478
         $user_is_included_in_role = 0;
479 479
         $roles = DB::query(
480
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i',
480
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i',
481 481
             $record['id']
482 482
         );
483 483
         if (count($roles) > 0) {
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             if (empty($restrictedTo)) {
501 501
                 $restrictedTo = $_SESSION['user_id'];
502 502
             } else {
503
-                $restrictedTo .= ',' . $_SESSION['user_id'];
503
+                $restrictedTo .= ','.$_SESSION['user_id'];
504 504
             }
505 505
         }
506 506
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             $arrTmp = [];
599 599
             foreach (explode(';', $_SESSION['fonction_id']) as $role) {
600 600
                 $access = DB::queryFirstRow(
601
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
601
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
602 602
                     $role,
603 603
                     $record['id_tree']
604 604
                 );
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
         ) {
650 650
             $data_item = DB::queryFirstRow(
651 651
                 'SELECT i.pw AS pw, s.share_key AS share_key
652
-                FROM ' . prefixTable('items') . ' AS i
653
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
652
+                FROM ' . prefixTable('items').' AS i
653
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
654 654
                 WHERE i.id = %i AND s.user_id = %i',
655 655
                 $record['id'],
656 656
                 $_SESSION['user_id']
Please login to merge, or discard this patch.
sources/del_SecureHandler.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct()
27 27
     {
28
-        if (! extension_loaded('openssl')) {
28
+        if (!extension_loaded('openssl')) {
29 29
             throw new \RuntimeException(sprintf(
30 30
                 "You need the OpenSSL extension to use %s",
31 31
                 __CLASS__
32 32
             ));
33 33
         }
34
-        if (! extension_loaded('mbstring')) {
34
+        if (!extension_loaded('mbstring')) {
35 35
             throw new \RuntimeException(sprintf(
36 36
                 "You need the Multibytes extension to use %s",
37 37
                 __CLASS__
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function open($save_path, $session_name): bool
49 49
     {
50
-        $this->key = $this->getKey('KEY_' . $session_name);
50
+        $this->key = $this->getKey('KEY_'.$session_name);
51 51
         return parent::open($save_path, $session_name);
52 52
     }
53 53
 
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
         // Authentication
95 95
         $hmac = hash_hmac(
96 96
             'SHA256',
97
-            $iv . $ciphertext,
97
+            $iv.$ciphertext,
98 98
             mb_substr($key, 32, null, '8bit'),
99 99
             true
100 100
         );
101
-        return $hmac . $iv . $ciphertext;
101
+        return $hmac.$iv.$ciphertext;
102 102
     }
103 103
 
104 104
     /**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
         // Authentication
117 117
         $hmacNew = hash_hmac(
118 118
             'SHA256',
119
-            $iv . $ciphertext,
119
+            $iv.$ciphertext,
120 120
             mb_substr($key, 32, null, '8bit'),
121 121
             true
122 122
         );
123
-        if (! hash_equals($hmac, $hmacNew)) {
123
+        if (!hash_equals($hmac, $hmacNew)) {
124 124
             throw new Exception\AuthenticationFailedException('Authentication failed');
125 125
         }
126 126
         // Decrypt
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             // if session cookie lifetime > 0 then add to current time
149 149
             // otherwise leave it as zero, honoring zero's special meaning
150 150
             // expire at browser close.
151
-            $arr_cookie_options = array (
151
+            $arr_cookie_options = array(
152 152
                 'expires' => ($cookieParam['lifetime'] > 0) ? time() + $cookieParam['lifetime'] : 0,
153 153
                 'path' => '/',
154 154
                 'secure' => true,
Please login to merge, or discard this patch.
sources/export.queries.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $_SESSION['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
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $antiXss = new AntiXSS();
95 95
 
96 96
 // User's language loading
97
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
97
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
98 98
 
99 99
 // Prepare POST variables
100 100
 $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
                         'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso,
146 146
                             i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url,
147 147
                             i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period
148
-                        FROM ' . prefixTable('items') . ' as i
149
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
150
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
148
+                        FROM ' . prefixTable('items').' as i
149
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
150
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
151 151
                         WHERE i.inactif = %i
152 152
                         AND i.id_tree= %i
153 153
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
                                 // Run query
171 171
                                 $dataItem = DB::queryfirstrow(
172 172
                                     'SELECT i.pw AS pw, s.share_key AS share_key
173
-                                    FROM ' . prefixTable('items') . ' AS i
174
-                                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
173
+                                    FROM ' . prefixTable('items').' AS i
174
+                                    INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
175 175
                                     WHERE user_id = %i AND i.id = %i',
176 176
                                     $_SESSION['user_id'],
177 177
                                     $record['id']
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
                                 $arr_kbs = [];
196 196
                                 $rows_kb = DB::query(
197 197
                                     'SELECT b.label, b.id
198
-                                    FROM ' . prefixTable('kb_items') . ' AS a
199
-                                    INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
198
+                                    FROM ' . prefixTable('kb_items').' AS a
199
+                                    INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
200 200
                                     WHERE a.item_id = %i',
201 201
                                     $record['id']
202 202
                                 );
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                                 $arr_tags = [];
209 209
                                 $rows_tag = DB::query(
210 210
                                     'SELECT tag
211
-                                    FROM ' . prefixTable('tags') . '
211
+                                    FROM ' . prefixTable('tags').'
212 212
                                     WHERE item_id = %i',
213 213
                                     $record['id']
214 214
                                 );
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
                                 $arr_trees = [];
221 221
                                 $rows_child_tree = DB::query(
222 222
                                     'SELECT t.id, t.title
223
-                                    FROM ' . prefixTable('nested_tree') . ' AS t
224
-                                    INNER JOIN ' . prefixTable('items') . ' AS i ON (t.id = i.id_tree)
223
+                                    FROM ' . prefixTable('nested_tree').' AS t
224
+                                    INNER JOIN ' . prefixTable('items').' AS i ON (t.id = i.id_tree)
225 225
                                     WHERE i.id = %i',
226 226
                                     $record['id']
227 227
                                 );
228 228
                                 foreach ($rows_child_tree as $rec_child_tree) {
229 229
                                     $stack = array();
230 230
                                     $parent = $rec_child_tree['id'];
231
-                                    while($parent != 0){
231
+                                    while ($parent != 0) {
232 232
                                         $rows_parent_tree = DB::query(
233 233
                                             'SELECT parent_id, title
234
-                                            FROM ' . prefixTable('nested_tree') . '
234
+                                            FROM ' . prefixTable('nested_tree').'
235 235
                                             WHERE id = %i',
236 236
                                             $parent
237 237
                                         );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             // Prepare variables
319 319
             $post_export_tag = filter_var($dataReceived['export_tag'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
320 320
             if (empty($post_export_tag) === false) {
321
-                DB::query('DELETE FROM ' . prefixTable('export') . ' WHERE export_tag = %s', $post_export_tag);
321
+                DB::query('DELETE FROM '.prefixTable('export').' WHERE export_tag = %s', $post_export_tag);
322 322
             }
323 323
             break;
324 324
 
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
                         l.date as date, i.pw_iv as pw_iv,
369 369
                         n.renewal_period as renewal_period,
370 370
                         i.id_tree as tree_id
371
-                        FROM ' . prefixTable('items') . ' as i
372
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
373
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
371
+                        FROM ' . prefixTable('items').' as i
372
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
373
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
374 374
                         WHERE i.inactif = %i
375 375
                         AND i.id_tree= %i
376 376
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
                             // Run query
397 397
                             $dataItem = DB::queryfirstrow(
398 398
                                 'SELECT i.pw AS pw, s.share_key AS share_key
399
-                                FROM ' . prefixTable('items') . ' AS i
400
-                                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
399
+                                FROM ' . prefixTable('items').' AS i
400
+                                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
401 401
                                 WHERE user_id = %i AND i.id = %i',
402 402
                                 $_SESSION['user_id'],
403 403
                                 $record['id']
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
                             $arr_kbs = '';
422 422
                             $rows_kb = DB::query(
423 423
                                 'SELECT b.label, b.id
424
-                                FROM ' . prefixTable('kb_items') . ' AS a
425
-                                INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
424
+                                FROM ' . prefixTable('kb_items').' AS a
425
+                                INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
426 426
                                 WHERE a.item_id = %i',
427 427
                                 $record['id']
428 428
                             );
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
                                 if (empty($arr_kbs)) {
431 431
                                     $arr_kbs = $rec_kb['label'];
432 432
                                 } else {
433
-                                    $arr_kbs .= ' | ' . $rec_kb['label'];
433
+                                    $arr_kbs .= ' | '.$rec_kb['label'];
434 434
                                 }
435 435
                             }
436 436
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                             $arr_tags = '';
439 439
                             $rows_tag = DB::query(
440 440
                                 'SELECT tag
441
-                                FROM ' . prefixTable('tags') . '
441
+                                FROM ' . prefixTable('tags').'
442 442
                                 WHERE item_id = %i',
443 443
                                 $record['id']
444 444
                             );
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
                                 if (empty($arr_tags)) {
447 447
                                     $arr_tags = $rec_tag['tag'];
448 448
                                 } else {
449
-                                    $arr_tags .= ' ' . $rec_tag['tag'];
449
+                                    $arr_tags .= ' '.$rec_tag['tag'];
450 450
                                 }
451 451
                             }
452 452
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             // query
525 525
             $rows = DB::query(
526 526
                 'SELECT * 
527
-                FROM ' . prefixTable('export') . ' 
527
+                FROM ' . prefixTable('export').' 
528 528
                 WHERE export_tag = %s',
529 529
                 $dataReceived['export_tag']
530 530
             );
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 $prev_path = '';
537 537
 
538 538
                 //Prepare the PDF file
539
-                include $SETTINGS['cpassman_dir'] . '/vendor/tecnickcom/tcpdf/tcpdf.php';
539
+                include $SETTINGS['cpassman_dir'].'/vendor/tecnickcom/tcpdf/tcpdf.php';
540 540
 
541 541
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
542 542
                 $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null);
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 
549 549
                 // set default header data
550 550
                 $pdf->SetHeaderData(
551
-                    $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png',
551
+                    $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png',
552 552
                     PDF_HEADER_LOGO_WIDTH,
553 553
                     'Teampass export',
554 554
                     $_SESSION['lastname']." ".$_SESSION['name'].' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time())
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                 logEvents($SETTINGS, 'pdf_export', '', (string) $_SESSION['user_id'], $_SESSION['login']);
659 659
 
660 660
                 //clean table
661
-                DB::query('TRUNCATE TABLE ' . prefixTable('export'));
661
+                DB::query('TRUNCATE TABLE '.prefixTable('export'));
662 662
 
663 663
                 // Clean any content of the output buffer
664 664
                 ob_end_clean();
@@ -696,13 +696,13 @@  discard block
 block discarded – undo
696 696
             // step 1:
697 697
             // - prepare export file
698 698
             // - get full list of objects id to export
699
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
699
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
700 700
             $idsList = array();
701 701
 
702 702
             // query
703 703
             $rows = DB::query(
704 704
                 'SELECT * 
705
-                FROM ' . prefixTable('export') . ' 
705
+                FROM ' . prefixTable('export').' 
706 706
                 WHERE export_tag = %s',
707 707
                 $inputData['export_tag']
708 708
             );
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
             }
740 740
             // prepare export file
741 741
             //save the file
742
-            $outstream = fopen($SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], 'w');
742
+            $outstream = fopen($SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], 'w');
743 743
             if ($outstream === false) {
744 744
                 echo (string) prepareExchangedData(
745 745
                     [
746 746
                         'error' => true,
747 747
                         'message' => langHdl('error_while_creating_file'),
748
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
748
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
749 749
                     ],
750 750
                     'encode'
751 751
                 );
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
     </style>
772 772
     </head>
773 773
     <body>
774
-    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']) . '" />
774
+    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']).'" />
775 775
     <div id="header">
776
-    ' . TP_TOOL_NAME . ' - Off Line mode
776
+    ' . TP_TOOL_NAME.' - Off Line mode
777 777
     </div>
778 778
     <div style="margin:10px; font-size:9px;">
779
-    <i>This page was generated by <b>' . $_SESSION['name'] . ' ' . $_SESSION['lastname'] . '</b>, the ' . date('Y/m/d H:i:s') . '.</i>
779
+    <i>This page was generated by <b>' . $_SESSION['name'].' '.$_SESSION['lastname'].'</b>, the '.date('Y/m/d H:i:s').'.</i>
780 780
     <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
781 781
     </div>
782 782
     <div id="information"></div>
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
     <div>
788 788
     <table id="itemsTable">
789 789
         <thead><tr>
790
-            <th style="width:15%;">' . langHdl('label') . '</th>
791
-            <th style="width:10%;">' . langHdl('pw') . '</th>
792
-            <th style="width:30%;">' . langHdl('description') . '</th>
793
-            <th style="width:5%;">' . langHdl('user_login') . '</th>
794
-            <th style="width:20%;">' . langHdl('url') . '</th>
790
+            <th style="width:15%;">' . langHdl('label').'</th>
791
+            <th style="width:10%;">' . langHdl('pw').'</th>
792
+            <th style="width:30%;">' . langHdl('description').'</th>
793
+            <th style="width:5%;">' . langHdl('user_login').'</th>
794
+            <th style="width:20%;">' . langHdl('url').'</th>
795 795
         </tr></thead>
796 796
         <tbody id="itemsTable_tbody">'
797 797
             );
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
                     'loop' => true,
806 806
                     'ids_list' => json_encode($idsList),
807 807
                     'ids_count' => count($idsList),
808
-                    'file_path' => $SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'],
809
-                    'file_link' => $SETTINGS['url_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'],
808
+                    'file_path' => $SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'],
809
+                    'file_link' => $SETTINGS['url_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'],
810 810
                     'export_tag' => $inputData['export_tag'],
811 811
                 ],
812 812
                 'encode'
@@ -846,12 +846,12 @@  discard block
 block discarded – undo
846 846
 
847 847
             $full_listing = array();
848 848
             $items_id_list = array();
849
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
849
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
850 850
 
851 851
             // query
852 852
             $rows = DB::query(
853 853
                 'SELECT * 
854
-                FROM ' . prefixTable('export') . ' 
854
+                FROM ' . prefixTable('export').' 
855 855
                 WHERE export_tag = %s AND item_id IN %ls',
856 856
                 $inputData['export_tag'],
857 857
                 $inputData['idsList']
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
                         [
866 866
                             'error' => true,
867 867
                             'message' => langHdl('error_while_creating_file'),
868
-                            'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
868
+                            'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
869 869
                         ],
870 870
                         'encode'
871 871
                     );
@@ -907,13 +907,13 @@  discard block
 block discarded – undo
907 907
                         if (empty($arboHtml)) {
908 908
                             $arboHtml = $arboHtml_tmp;
909 909
                         } else {
910
-                            $arboHtml .= ' » ' . $arboHtml_tmp;
910
+                            $arboHtml .= ' » '.$arboHtml_tmp;
911 911
                         }
912 912
                     }
913 913
                     fputs(
914 914
                         $outstream,
915 915
                         '
916
-        <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'
916
+        <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>'
917 917
                     );
918 918
                     $idTree = $record['folder_id'];
919 919
 
@@ -921,12 +921,12 @@  discard block
 block discarded – undo
921 921
                     fputs(
922 922
                         $outstream,
923 923
                         '
924
-        <tr class="' . $lineType . '">
925
-            <td>' . addslashes($record['label']) . '</td>
926
-            <td align="center"><span class="span_pw" id="span_' . $record['item_id'] . '"><a href="#" onclick="decryptme(' . $record['item_id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $record['item_id'] . '" value="' . $encPw . '" /></td>
927
-            <td>' . (empty($record['description']) === true ? '&nbsp;' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(utf8_decode($record['description']))))) . '</td>
928
-            <td align="center">' . (empty($record['login']) === true ? '&nbsp;' : addslashes($record['login'])) . '</td>
929
-            <td align="center">' . (empty($record['url']) === true ? '&nbsp;' : addslashes($record['url'])) . '</td>
924
+        <tr class="' . $lineType.'">
925
+            <td>' . addslashes($record['label']).'</td>
926
+            <td align="center"><span class="span_pw" id="span_' . $record['item_id'].'"><a href="#" onclick="decryptme('.$record['item_id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$record['item_id'].'" value="'.$encPw.'" /></td>
927
+            <td>' . (empty($record['description']) === true ? '&nbsp;' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(utf8_decode($record['description']))))).'</td>
928
+            <td align="center">' . (empty($record['login']) === true ? '&nbsp;' : addslashes($record['login'])).'</td>
929
+            <td align="center">' . (empty($record['url']) === true ? '&nbsp;' : addslashes($record['url'])).'</td>
930 930
         </tr>'
931 931
                     );
932 932
                 }
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
             $inputData['password'] = (string) filter_var($dataReceived['password'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
976 976
             
977 977
             // Load includes
978
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
978
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
979 979
 
980 980
             // read the content of the temporary file
981 981
             $handle = fopen($inputData['filename'].'.txt', 'r');
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
                     [
985 985
                         'error' => true,
986 986
                         'message' => langHdl('error_while_creating_file'),
987
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
987
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
988 988
                     ],
989 989
                     'encode'
990 990
                 );
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
                     [
997 997
                         'error' => true,
998 998
                         'message' => langHdl('error_while_creating_file'),
999
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
999
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
1000 1000
                     ],
1001 1001
                     'encode'
1002 1002
                 );
@@ -1012,9 +1012,9 @@  discard block
 block discarded – undo
1012 1012
             $chunks = explode('|#|#|', chunk_split($contents, 10000, '|#|#|'));
1013 1013
             foreach ($chunks as $chunk) {
1014 1014
                 if (empty($encrypted_text) === true) {
1015
-                    $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] );
1015
+                    $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']);
1016 1016
                 } else {
1017
-                    $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] );
1017
+                    $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']);
1018 1018
                 }
1019 1019
             }
1020 1020
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
                     [
1026 1026
                         'error' => true,
1027 1027
                         'message' => langHdl('error_while_creating_file'),
1028
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
1028
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
1029 1029
                     ],
1030 1030
                     'encode'
1031 1031
                 );
@@ -1038,9 +1038,9 @@  discard block
 block discarded – undo
1038 1038
         </table></div>
1039 1039
         <input type="button" value="Hide all" onclick="hideAll()" />
1040 1040
         <div id="footer" style="text-align:center;">
1041
-            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME . '&nbsp;' . TP_VERSION . '&nbsp;' . TP_COPYRIGHT . '</a>
1041
+            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME.'&nbsp;'.TP_VERSION.'&nbsp;'.TP_COPYRIGHT.'</a>
1042 1042
         </div>
1043
-        <div id="enc_html" style="display:none;">' . $encrypted_text . '</div>
1043
+        <div id="enc_html" style="display:none;">' . $encrypted_text.'</div>
1044 1044
         </body>
1045 1045
     </html>
1046 1046
     <script type="text/javascript">
@@ -1143,12 +1143,12 @@  discard block
 block discarded – undo
1143 1143
             fclose($outstream);
1144 1144
 
1145 1145
             //clean table
1146
-            DB::query('TRUNCATE TABLE ' . prefixTable('export'));
1146
+            DB::query('TRUNCATE TABLE '.prefixTable('export'));
1147 1147
 
1148 1148
             echo (string) prepareExchangedData(
1149 1149
                 [
1150 1150
                     'error' => false,
1151
-                    'filelink' => $inputData['file_link'] ,
1151
+                    'filelink' => $inputData['file_link'],
1152 1152
                 ],
1153 1153
                 'encode'
1154 1154
             );
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 ) {
67 67
     // Not allowed page
68 68
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
69
-    include $SETTINGS['cpassman_dir'] . '/error.php';
69
+    include $SETTINGS['cpassman_dir'].'/error.php';
70 70
     exit;
71 71
 }
72 72
 
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
                     && $t->personal_folder == 0
145 145
                 ) {
146 146
                     // get $t->parent_id
147
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
147
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
148 148
                     if ($t->nlevel == 1) {
149 149
                         $data['title'] = langHdl('root');
150 150
                     }
151 151
 
152 152
                     // get rights on this folder
153 153
                     $arrayRights = array();
154
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
154
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
155 155
                     foreach ($rows as $record) {
156 156
                         array_push($arrayRights, $record['fonction_id']);
157 157
                     }
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
170 170
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification,
171 171
                         n.fa_icon, n.fa_icon_selected
172
-                        FROM ' . prefixTable('misc') . ' AS m,
173
-                        ' . prefixTable('nested_tree') . ' AS n
172
+                        FROM ' . prefixTable('misc').' AS m,
173
+                        ' . prefixTable('nested_tree').' AS n
174 174
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
175 175
                         'complex',
176 176
                         $t->id
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                     //col7
204 204
                     $data7 = DB::queryFirstRow(
205 205
                         'SELECT bloquer_creation,bloquer_modification
206
-                        FROM ' . prefixTable('nested_tree') . '
206
+                        FROM ' . prefixTable('nested_tree').'
207 207
                         WHERE id = %i',
208 208
                         intval($t->id)
209 209
                     );
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             // Get info about this folder
343 343
             $dataFolder = DB::queryfirstrow(
344 344
                 'SELECT *
345
-                FROM ' . prefixTable('nested_tree') . '
345
+                FROM ' . prefixTable('nested_tree').'
346 346
                 WHERE id = %i',
347 347
                 $post_folder_id
348 348
             );
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             //check if parent folder is personal
379 379
             $dataParent = DB::queryfirstrow(
380 380
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
381
-                FROM ' . prefixTable('nested_tree') . '
381
+                FROM ' . prefixTable('nested_tree').'
382 382
                 WHERE id = %i',
383 383
                 $post_parent_id
384 384
             );
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                     // get complexity level for this folder
408 408
                     $data = DB::queryfirstrow(
409 409
                         'SELECT valeur
410
-                        FROM ' . prefixTable('misc') . '
410
+                        FROM ' . prefixTable('misc').'
411 411
                         WHERE intitule = %i AND type = %s',
412 412
                         $post_parent_id,
413 413
                         'complex'
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                             array(
419 419
                                 'error' => true,
420 420
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
421
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
421
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
422 422
                             ),
423 423
                             'encode'
424 424
                         );
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
             ) {
572 572
                 DB::query(
573 573
                     'SELECT *
574
-                    FROM ' . prefixTable('nested_tree') . '
574
+                    FROM ' . prefixTable('nested_tree').'
575 575
                     WHERE title = %s',
576 576
                     $post_title
577 577
                 );
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
             //check if parent folder is personal
592 592
             $data = DB::queryfirstrow(
593 593
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
594
-                FROM ' . prefixTable('nested_tree') . '
594
+                FROM ' . prefixTable('nested_tree').'
595 595
                 WHERE id = %i',
596 596
                 $post_parent_id
597 597
             );
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
                     // get complexity level for this folder
621 621
                     $data = DB::queryfirstrow(
622 622
                         'SELECT valeur
623
-                        FROM ' . prefixTable('misc') . '
623
+                        FROM ' . prefixTable('misc').'
624 624
                         WHERE intitule = %i AND type = %s',
625 625
                         $post_parent_id,
626 626
                         'complex'
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                             array(
631 631
                                 'error' => true,
632 632
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
633
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
633
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
634 634
                             ),
635 635
                             'encode'
636 636
                         );
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
                     && (int) $SETTINGS['subfolder_rights_as_parent'] === 1
781 781
                 ) {
782 782
                     //If it is a subfolder, then give access to it for all roles that allows the parent folder
783
-                    $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id);
783
+                    $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id);
784 784
                     foreach ($rows as $record) {
785 785
                         //add access to this subfolder
786 786
                         DB::insert(
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
                 }
811 811
 
812 812
                 // if parent folder has Custom Fields Categories then add to this child one too
813
-                $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id);
813
+                $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id);
814 814
                 foreach ($rows as $record) {
815 815
                     //add CF Category to this subfolder
816 816
                     DB::insert(
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
                 }
824 824
 
825 825
                 // clear cache cache for each user that have at least one similar role as the current user
826
-                $usersWithSimilarRoles = empty($_SESSION['fonction_id']) === false  ? getUsersWithRoles(
826
+                $usersWithSimilarRoles = empty($_SESSION['fonction_id']) === false ? getUsersWithRoles(
827 827
                     explode(";", $_SESSION['fonction_id'])
828 828
                 ) : [];
829 829
                 foreach ($usersWithSimilarRoles as $user) {
@@ -903,17 +903,17 @@  discard block
 block discarded – undo
903 903
                                 prefixTable('misc'),
904 904
                                 array(
905 905
                                     'type' => 'folder_deleted',
906
-                                    'intitule' => 'f' . $thisSubFolders->id,
907
-                                    'valeur' => $thisSubFolders->id . ', ' . $thisSubFolders->parent_id . ', ' .
908
-                                        $thisSubFolders->title . ', ' . $thisSubFolders->nleft . ', ' . $thisSubFolders->nright . ', ' .
909
-                                        $thisSubFolders->nlevel . ', 0, 0, 0, 0',
906
+                                    'intitule' => 'f'.$thisSubFolders->id,
907
+                                    'valeur' => $thisSubFolders->id.', '.$thisSubFolders->parent_id.', '.
908
+                                        $thisSubFolders->title.', '.$thisSubFolders->nleft.', '.$thisSubFolders->nright.', '.
909
+                                        $thisSubFolders->nlevel.', 0, 0, 0, 0',
910 910
                                 )
911 911
                             );
912 912
                             //array for delete folder
913 913
                             $folderForDel[] = $thisSubFolders->id;
914 914
 
915 915
                             //delete items & logs
916
-                            $itemsInSubFolder = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $thisSubFolders->id);
916
+                            $itemsInSubFolder = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $thisSubFolders->id);
917 917
                             foreach ($itemsInSubFolder as $item) {
918 918
                                 DB::update(
919 919
                                     prefixTable('items'),
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
                                     FROM ' . prefixTable('cache_tree').' WHERE user_id = %i',
954 954
                                     (int) $_SESSION['user_id']
955 955
                                 );
956
-                                if (DB::count()>0) {
956
+                                if (DB::count() > 0) {
957 957
                                     // remove id from folders
958 958
                                     $a_folders = json_decode($cache_tree['folders'], true);
959 959
                                     $key = array_search($item['id'], $a_folders, true);
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
             $tree->rebuild();
1000 1000
 
1001 1001
             // reload cache table
1002
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1002
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1003 1003
             updateCacheTable('reload', $SETTINGS, null);
1004 1004
 
1005 1005
             // Update timestamp
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
                 // get complexity of current node
1095 1095
                 $nodeComplexity = DB::queryfirstrow(
1096 1096
                     'SELECT valeur
1097
-                    FROM ' . prefixTable('misc') . '
1097
+                    FROM ' . prefixTable('misc').'
1098 1098
                     WHERE intitule = %i AND type= %s',
1099 1099
                     $nodeInfo->id,
1100 1100
                     'complex'
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1171 1171
                 $rows = DB::query(
1172 1172
                     'SELECT role_id, type
1173
-                    FROM ' . prefixTable('roles_values') . '
1173
+                    FROM ' . prefixTable('roles_values').'
1174 1174
                     WHERE folder_id = %i',
1175 1175
                     $parentId
1176 1176
                 );
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
                     // Add access to this subfolder after checking that it is not already set
1179 1179
                     DB::query(
1180 1180
                         'SELECT *
1181
-                        FROM ' . prefixTable('roles_values') . '
1181
+                        FROM ' . prefixTable('roles_values').'
1182 1182
                         WHERE folder_id = %i AND role_id = %i',
1183 1183
                         $newFolderId,
1184 1184
                         $record['role_id']
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
                 // if parent folder has Custom Fields Categories then add to this child one too
1199 1199
                 $rows = DB::query(
1200 1200
                     'SELECT id_category
1201
-                    FROM ' . prefixTable('categories_folders') . '
1201
+                    FROM ' . prefixTable('categories_folders').'
1202 1202
                     WHERE id_folder = %i',
1203 1203
                     $nodeInfo->id
1204 1204
                 );
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 
1218 1218
                 $rows = DB::query(
1219 1219
                     'SELECT *
1220
-                    FROM ' . prefixTable('items') . '
1220
+                    FROM ' . prefixTable('items').'
1221 1221
                     WHERE id_tree = %i',
1222 1222
                     $nodeInfo->id
1223 1223
                 );
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
                     // if it is then don't copy it
1227 1227
                     $item_deleted = DB::queryFirstRow(
1228 1228
                         'SELECT *
1229
-                        FROM ' . prefixTable('log_items') . '
1229
+                        FROM ' . prefixTable('log_items').'
1230 1230
                         WHERE id_item = %i AND action = %s
1231 1231
                         ORDER BY date DESC
1232 1232
                         LIMIT 0, 1',
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
                     $item_restored = DB::queryFirstRow(
1239 1239
                         'SELECT *
1240
-                        FROM ' . prefixTable('log_items') . '
1240
+                        FROM ' . prefixTable('log_items').'
1241 1241
                         WHERE id_item = %i AND action = %s
1242 1242
                         ORDER BY date DESC
1243 1243
                         LIMIT 0, 1',
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
                         // Get the ITEM object key for the user
1253 1253
                         $userKey = DB::queryFirstRow(
1254 1254
                             'SELECT share_key
1255
-                            FROM ' . prefixTable('sharekeys_items') . '
1255
+                            FROM ' . prefixTable('sharekeys_items').'
1256 1256
                             WHERE user_id = %i AND object_id = %i',
1257 1257
                             $_SESSION['user_id'],
1258 1258
                             $record['id']
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
                         // Manage Custom Fields
1327 1327
                         $categories = DB::query(
1328 1328
                             'SELECT *
1329
-                            FROM ' . prefixTable('categories_items') . '
1329
+                            FROM ' . prefixTable('categories_items').'
1330 1330
                             WHERE item_id = %i',
1331 1331
                             $record['id']
1332 1332
                         );
@@ -1374,15 +1374,15 @@  discard block
 block discarded – undo
1374 1374
                         $files = DB::query(
1375 1375
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1376 1376
                             f.size AS size, f.type AS type, s.share_key AS share_key
1377
-                            FROM ' . prefixTable('files') . ' AS f
1378
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1377
+                            FROM ' . prefixTable('files').' AS f
1378
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1379 1379
                             WHERE s.user_id = %i AND f.id_item = %i',
1380 1380
                             $_SESSION['user_id'],
1381 1381
                             $record['id']
1382 1382
                         );
1383 1383
                         foreach ($files as $file) {
1384 1384
                             // Check if file still exists
1385
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1385
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1386 1386
                                 // Step1 - decrypt the file
1387 1387
                                 $fileContent = decryptFile(
1388 1388
                                     $file['file'],
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
                                 );
1392 1392
 
1393 1393
                                 // Step2 - create file
1394
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1394
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1395 1395
 
1396
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1396
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1397 1397
                                 if ($outstream === false) {
1398 1398
                                     echo prepareExchangedData(
1399 1399
                                         array(
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
             $tree->rebuild();
1468 1468
 
1469 1469
             // reload cache table
1470
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1470
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1471 1471
             updateCacheTable('reload', $SETTINGS, NULL);
1472 1472
 
1473 1473
             // Update timestamp
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
                     // Get path
1543 1543
                     $text = '';
1544 1544
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1545
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1545
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1546 1546
                     }
1547 1547
 
1548 1548
                     // Save array
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
                             'id' => (int) $folder->id,
1553 1553
                             'label' => $folder->title,
1554 1554
                             'level' => $folder->nlevel,
1555
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1555
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1556 1556
                         )
1557 1557
                     );
1558 1558
                 }
Please login to merge, or discard this patch.