Passed
Pull Request — master (#4682)
by Nils
06:11
created
sources/folders.queries.php 1 patch
Spacing   +39 added lines, -39 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, n.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']
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
                         // Manage Custom Fields
1198 1198
                         $categories = DB::query(
1199 1199
                             'SELECT *
1200
-                            FROM ' . prefixTable('categories_items') . '
1200
+                            FROM ' . prefixTable('categories_items').'
1201 1201
                             WHERE item_id = %i',
1202 1202
                             $record['id']
1203 1203
                         );
@@ -1243,15 +1243,15 @@  discard block
 block discarded – undo
1243 1243
                         $files = DB::query(
1244 1244
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1245 1245
                             f.size AS size, f.type AS type, s.share_key AS share_key
1246
-                            FROM ' . prefixTable('files') . ' AS f
1247
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1246
+                            FROM ' . prefixTable('files').' AS f
1247
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1248 1248
                             WHERE s.user_id = %i AND f.id_item = %i',
1249 1249
                             $session->get('user-id'),
1250 1250
                             $record['id']
1251 1251
                         );
1252 1252
                         foreach ($files as $file) {
1253 1253
                             // Check if file still exists
1254
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1254
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1255 1255
                                 // Step1 - decrypt the file
1256 1256
                                 $fileContent = decryptFile(
1257 1257
                                     $file['file'],
@@ -1272,9 +1272,9 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
                                 // Step2 - create file
1274 1274
                                 // deepcode ignore InsecureHash: Is not a password, just a random string for a file name
1275
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1275
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1276 1276
 
1277
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1277
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1278 1278
                                 if ($outstream === false) {
1279 1279
                                     echo prepareExchangedData(
1280 1280
                                         array(
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
                     // Get path
1423 1423
                     $text = '';
1424 1424
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1425
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1425
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1426 1426
                     }
1427 1427
 
1428 1428
                     // Save array
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
                             'id' => (int) $folder->id,
1433 1433
                             'label' => $folder->title,
1434 1434
                             'level' => $folder->nlevel,
1435
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1435
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1436 1436
                         )
1437 1437
                     );
1438 1438
                 }
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +124 added lines, -124 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('admin') === 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
 
@@ -133,21 +133,21 @@  discard block
 block discarded – undo
133 133
             break;
134 134
         }
135 135
 
136
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
137 137
         $return = '';
138 138
 
139 139
         //Get all tables
140 140
         $tables = array();
141 141
         $result = DB::query('SHOW TABLES');
142 142
         foreach ($result as $row) {
143
-            $tables[] = $row['Tables_in_' . DB_NAME];
143
+            $tables[] = $row['Tables_in_'.DB_NAME];
144 144
         }
145 145
 
146 146
         //cycle through
147 147
         foreach ($tables as $table) {
148 148
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
149 149
                 // Do query
150
-                $result = DB::query('SELECT * FROM ' . $table);
150
+                $result = DB::query('SELECT * FROM '.$table);
151 151
                 DB::query(
152 152
                     'SELECT *
153 153
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
                 $numFields = DB::count();
160 160
 
161 161
                 // prepare a drop table
162
-                $return .= 'DROP TABLE ' . $table . ';';
163
-                $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
164
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
162
+                $return .= 'DROP TABLE '.$table.';';
163
+                $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
164
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
165 165
 
166 166
                 //prepare all fields and datas
167 167
                 for ($i = 0; $i < $numFields; ++$i) {
168 168
                     while ($row = $result->fetch_row()) {
169
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
169
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
170 170
                         for ($j = 0; $j < $numFields; ++$j) {
171 171
                             $row[$j] = addslashes($row[$j]);
172 172
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
173 173
                             if (isset($row[$j])) {
174
-                                $return .= '"' . $row[$j] . '"';
174
+                                $return .= '"'.$row[$j].'"';
175 175
                             } else {
176 176
                                 $return .= 'NULL';
177 177
                             }
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
             $token = GenerateCryptKey(20, false, true, true, false, true);
192 192
 
193 193
             //save file
194
-            $filename = time() . '-' . $token . '.sql';
195
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
194
+            $filename = time().'-'.$token.'.sql';
195
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
196 196
             if ($handle !== false) {
197 197
                 //write file
198 198
                 fwrite($handle, $return);
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
                 // Encrypt the file
205 205
                 prepareFileWithDefuse(
206 206
                     'encrypt',
207
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
208
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
207
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
208
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
209 209
                     $post_option
210 210
                 );
211 211
 
212 212
                 // Do clean
213
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
213
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
214 214
                 rename(
215
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
216
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
215
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
216
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
217 217
                 );
218 218
             }
219 219
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             //update LOG
224 224
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login'));
225 225
 
226
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]';
226
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]';
227 227
         }
228 228
         break;
229 229
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             );
253 253
             break;
254 254
         }
255
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
255
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
256 256
 
257 257
         $dataPost = explode('&', $post_option);
258 258
         $file = htmlspecialchars($dataPost[0]);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         // Get filename from database
262 262
         $data = DB::queryFirstRow(
263 263
             'SELECT valeur
264
-            FROM ' . prefixTable('misc') . '
264
+            FROM ' . prefixTable('misc').'
265 265
             WHERE increment_id = %i',
266 266
             $file
267 267
         );
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
             // Decrypt the file
281 281
             $ret = prepareFileWithDefuse(
282 282
                 'decrypt',
283
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
284
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
283
+                $SETTINGS['path_to_files_folder'].'/'.$file,
284
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
285 285
                 $key
286 286
             );
287 287
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
             }
293 293
 
294 294
             // Do clean
295
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
296
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
295
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
296
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
297 297
         } else {
298
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
298
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
299 299
         }
300 300
 
301 301
         //read sql file
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         fclose($handle);
313 313
 
314 314
         //delete file
315
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
315
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
316 316
 
317 317
         //Show done
318 318
         echo '[{"result":"db_restore" , "message":""}]';
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
             foreach ($table as $i => $tablename) {
351 351
                 if (substr_count($tablename, DB_PREFIX) > 0) {
352 352
                     // launch optimization quieries
353
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
354
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
353
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
354
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
355 355
                 }
356 356
             }
357 357
         }
@@ -359,12 +359,12 @@  discard block
 block discarded – undo
359 359
         //Clean up LOG_ITEMS table
360 360
         $rows = DB::query(
361 361
             'SELECT id
362
-            FROM ' . prefixTable('items') . '
362
+            FROM ' . prefixTable('items').'
363 363
             ORDER BY id ASC'
364 364
         );
365 365
         foreach ($rows as $item) {
366 366
             DB::query(
367
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
367
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
368 368
                 $item['id'],
369 369
                 'at_creation'
370 370
             );
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             if ($counter === 0) {
373 373
                 //Create new at_creation entry
374 374
                 $rowTmp = DB::queryFirstRow(
375
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
375
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
376 376
                     $item['id']
377 377
                 );
378 378
                 DB::insert(
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
         echo prepareExchangedData(
403 403
             array(
404 404
                 'error' => false,
405
-                'message' => $lang->get('last_execution') . ' ' .
406
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
405
+                'message' => $lang->get('last_execution').' '.
406
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
407 407
                     '<i class="fas fa-check text-success ml-2"></i>',
408 408
             ),
409 409
             'encode'
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             break;
440 440
         }
441 441
 
442
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
442
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
443 443
         updateCacheTable('reload', NULL);
444 444
 
445 445
         // Log
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
         echo prepareExchangedData(
456 456
             [
457 457
                 'error' => false,
458
-                'message' => $lang->get('last_execution') . ' ' .
459
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
458
+                'message' => $lang->get('last_execution').' '.
459
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
460 460
                     '<i class="fas fa-check text-success mr-2"></i>',
461 461
             ],
462 462
             'encode'
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
         $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE));
499 499
 
500 500
         // generate new saltkey
501
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
501
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
502 502
         copy(
503 503
             SECUREPATH.'/'.SECUREFILE,
504 504
             $old_sk_filename
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login'));
528 528
 
529 529
         // get number of items to change
530
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
530
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
531 531
         $nb_of_items = DB::count();
532 532
 
533 533
         // create backup table
534
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
534
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
535 535
         DB::query(
536
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
536
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
537 537
             `id` int(12) NOT null AUTO_INCREMENT,
538 538
             `current_table` varchar(100) NOT NULL,
539 539
             `current_field` varchar(500) NOT NULL,
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
         );
562 562
 
563 563
         // delete previous backup files
564
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
564
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
565 565
         foreach ($files as $file) { // iterate files
566 566
             if (is_file($file)) {
567 567
                 $file_parts = pathinfo($file);
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
                 echo prepareExchangedData(
649 649
                     array(
650 650
                         'error' => true,
651
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
651
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
652 652
                         'nbOfItems' => '',
653 653
                         'nextAction' => '',
654 654
                     ),
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
                 //change all encrypted data in Items (passwords)
662 662
                 $rows = DB::query(
663 663
                     'SELECT id, pw, pw_iv
664
-                    FROM ' . prefixTable('items') . '
664
+                    FROM ' . prefixTable('items').'
665 665
                     WHERE perso = %s
666
-                    LIMIT ' . $post_start . ', ' . $post_length,
666
+                    LIMIT ' . $post_start.', '.$post_length,
667 667
                     '0'
668 668
                 );
669 669
                 foreach ($rows as $record) {
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                             'current_field' => 'pw',
676 676
                             'value_id' => $record['id'],
677 677
                             'value' => $record['pw'],
678
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
678
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
679 679
                             'value2' => 'none',
680 680
                             'result' => 'none',
681 681
                         )
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
                 //change all encrypted data in Logs (passwords)
725 725
                 $rows = DB::query(
726 726
                     'SELECT raison, increment_id
727
-                    FROM ' . prefixTable('log_items') . "
727
+                    FROM ' . prefixTable('log_items')."
728 728
                     WHERE action = %s AND raison LIKE 'at_pw :%'
729
-                    LIMIT " . $post_start . ', ' . $post_length,
729
+                    LIMIT " . $post_start.', '.$post_length,
730 730
                     'at_modification'
731 731
                 );
732 732
                 foreach ($rows as $record) {
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
                             'current_field' => 'raison',
739 739
                             'value_id' => $record['increment_id'],
740 740
                             'value' => $record['raison'],
741
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
741
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
742 742
                             'value2' => 'none',
743 743
                             'result' => 'none',
744 744
                         )
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                         DB::update(
767 767
                             prefixTable('log_items'),
768 768
                             array(
769
-                                'raison' => 'at_pw :' . $encrypt['string'],
769
+                                'raison' => 'at_pw :'.$encrypt['string'],
770 770
                                 'encryption_type' => 'defuse',
771 771
                             ),
772 772
                             'increment_id = %i',
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
                 //change all encrypted data in CATEGORIES (passwords)
792 792
                 $rows = DB::query(
793 793
                     'SELECT id, data
794
-                    FROM ' . prefixTable('categories_items') . '
795
-                    LIMIT ' . $post_start . ', ' . $post_length
794
+                    FROM ' . prefixTable('categories_items').'
795
+                    LIMIT ' . $post_start.', '.$post_length
796 796
                 );
797 797
                 foreach ($rows as $record) {
798 798
                     // backup data
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                             'current_field' => 'data',
804 804
                             'value_id' => $record['id'],
805 805
                             'value' => $record['data'],
806
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
806
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
807 807
                             'value2' => 'none',
808 808
                             'result' => 'none',
809 809
                         )
@@ -851,9 +851,9 @@  discard block
 block discarded – undo
851 851
                 // Change all encrypted data in FILES (passwords)
852 852
                 $rows = DB::query(
853 853
                     'SELECT id, file, status
854
-                    FROM ' . prefixTable('files') . "
854
+                    FROM ' . prefixTable('files')."
855 855
                     WHERE status = 'encrypted'
856
-                    LIMIT " . $post_start . ', ' . $post_length
856
+                    LIMIT " . $post_start.', '.$post_length
857 857
                 );
858 858
                 foreach ($rows as $record) {
859 859
                     // backup data
@@ -871,20 +871,20 @@  discard block
 block discarded – undo
871 871
                     );
872 872
                     $newID = DB::insertId();
873 873
 
874
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
874
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
875 875
                         // make a copy of file
876 876
                         if (!copy(
877
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
878
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
877
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
878
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
879 879
                         )) {
880 880
                             $error = 'Copy not possible';
881 881
                             exit;
882 882
                         } else {
883 883
                             // prepare a bck of file (that will not be deleted)
884
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
884
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
885 885
                             copy(
886
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
887
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
886
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
887
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
888 888
                             );
889 889
                         }
890 890
 
@@ -892,22 +892,22 @@  discard block
 block discarded – undo
892 892
                         // STEP1 - Do decryption
893 893
                         prepareFileWithDefuse(
894 894
                             'decrypt',
895
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
896
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'
895
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
896
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'
897 897
                         );
898 898
 
899 899
                         // Do cleanup of files
900
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
900
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
901 901
 
902 902
                         // STEP2 - Do encryption
903 903
                         prepareFileWithDefuse(
904 904
                             'encryp',
905
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
906
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file']
905
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
906
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file']
907 907
                         );
908 908
 
909 909
                         // Do cleanup of files
910
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
910
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
911 911
 
912 912
                         // Update backup table
913 913
                         DB::update(
@@ -933,13 +933,13 @@  discard block
 block discarded – undo
933 933
                 // do some things for new object
934 934
                 if (isset($objects[0])) {
935 935
                     if ($objects[0] === 'logs') {
936
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
936
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
937 937
                     } elseif ($objects[0] === 'files') {
938
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
938
+                        DB::query('SELECT id FROM '.prefixTable('files'));
939 939
                     } elseif ($objects[0] === 'categories') {
940
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
940
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
941 941
                     } elseif ($objects[0] === 'custfields') {
942
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
942
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
943 943
                     }
944 944
                     $nb_of_items = DB::count();
945 945
                 } else {
@@ -1059,12 +1059,12 @@  discard block
 block discarded – undo
1059 1059
                 );
1060 1060
             } elseif ($record['current_table'] === 'files') {
1061 1061
                 // restore backup file
1062
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1063
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1064
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1062
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1063
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1064
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1065 1065
                         rename(
1066
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1067
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1066
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1067
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1068 1068
                         );
1069 1069
                     }
1070 1070
                 }
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
         }
1084 1084
 
1085 1085
         // drop table
1086
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1086
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1087 1087
 
1088 1088
         // Send back
1089 1089
         echo prepareExchangedData(
@@ -1126,17 +1126,17 @@  discard block
 block discarded – undo
1126 1126
         // delete files
1127 1127
         $rows = DB::query(
1128 1128
             'SELECT value, value2
1129
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1129
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1130 1130
             WHERE current_table = 'files'"
1131 1131
         );
1132 1132
         foreach ($rows as $record) {
1133
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1134
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1133
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1134
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1135 1135
             }
1136 1136
         }
1137 1137
 
1138 1138
         // drop table
1139
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1139
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1140 1140
 
1141 1141
         echo '[{"status":"done"}]';
1142 1142
         break;
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
                 'encode'
1168 1168
             );
1169 1169
         } else {
1170
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1170
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1171 1171
 
1172 1172
             //send email
1173 1173
             $emailSettings = new EmailSettings($SETTINGS);
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
             break;
1206 1206
         }
1207 1207
 
1208
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1208
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1209 1209
         $emailSettings = new EmailSettings($SETTINGS);
1210 1210
         $emailService = new EmailService();
1211 1211
 
1212 1212
         $rows = DB::query(
1213 1213
             'SELECT *
1214
-            FROM ' . prefixTable('emails') . '
1214
+            FROM ' . prefixTable('emails').'
1215 1215
             WHERE status = %s OR status = %s',
1216 1216
             'not_sent',
1217 1217
             ''
@@ -1297,13 +1297,13 @@  discard block
 block discarded – undo
1297 1297
             break;
1298 1298
         }
1299 1299
 
1300
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1300
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1301 1301
 
1302 1302
         // Instatiate email settings and service
1303 1303
         $emailSettings = new EmailSettings($SETTINGS);
1304 1304
         $emailService = new EmailService();
1305 1305
 
1306
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1306
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1307 1307
         foreach ($rows as $record) {
1308 1308
             //send email
1309 1309
             $email = $emailService->sendMail(
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
             break;
1373 1373
         }
1374 1374
 
1375
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1375
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1376 1376
 
1377 1377
         // init
1378 1378
         $filesList = array();
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
                 FROM ' . prefixTable('files')
1386 1386
             );
1387 1387
             foreach ($rows as $record) {
1388
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1388
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1389 1389
                     $addFile = false;
1390 1390
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1391 1391
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1450,8 +1450,8 @@  discard block
 block discarded – undo
1450 1450
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1451 1451
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1452 1452
 
1453
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1454
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1453
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1454
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1455 1455
 
1456 1456
         $cpt = 0;
1457 1457
         $continu = true;
@@ -1464,33 +1464,33 @@  discard block
 block discarded – undo
1464 1464
                 // Get file name
1465 1465
                 $file_info = DB::queryFirstRow(
1466 1466
                     'SELECT file
1467
-                    FROM ' . prefixTable('files') . '
1467
+                    FROM ' . prefixTable('files').'
1468 1468
                     WHERE id = %i',
1469 1469
                     $file
1470 1470
                 );
1471 1471
 
1472 1472
                 // skip file is Coherancey not respected
1473
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1473
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1474 1474
                     // Case where we want to decrypt
1475 1475
                     if ($post_option === 'decrypt') {
1476 1476
                         prepareFileWithDefuse(
1477 1477
                             'decrypt',
1478
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1479
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1478
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1479
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1480 1480
                         );
1481 1481
                         // Case where we want to encrypt
1482 1482
                     } elseif ($post_option === 'encrypt') {
1483 1483
                         prepareFileWithDefuse(
1484 1484
                             'encrypt',
1485
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1486
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1485
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1486
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1487 1487
                         );
1488 1488
                     }
1489 1489
                     // Do file cleanup
1490
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1490
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1491 1491
                     rename(
1492
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1493
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1492
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1493
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1494 1494
                     );
1495 1495
 
1496 1496
                     // store in DB
@@ -1525,8 +1525,8 @@  discard block
 block discarded – undo
1525 1525
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1526 1526
             );
1527 1527
 
1528
-            $message = $lang->get('last_execution') . ' ' .
1529
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1528
+            $message = $lang->get('last_execution').' '.
1529
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1530 1530
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1531 1531
         }
1532 1532
 
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1621 1621
 
1622 1622
             DB::query(
1623
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1623
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1624 1624
                 $post_id
1625 1625
             );
1626 1626
         }
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
             // Delete existing key
1716 1716
         } elseif (null !== $post_action && $post_action === 'delete') {
1717 1717
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1718
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1718
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1719 1719
         }
1720 1720
 
1721 1721
         echo prepareExchangedData(
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 
1731 1731
     case 'save_api_status':
1732 1732
         // Do query
1733
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1733
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1734 1734
         $counter = DB::count();
1735 1735
         if ($counter === 0) {
1736 1736
             DB::insert(
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 
1760 1760
     case 'run_duo_config_check':
1761 1761
         //Libraries call
1762
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1762
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1763 1763
         // Check KEY
1764 1764
         if ($post_key !== $session->get('key')) {
1765 1765
             echo prepareExchangedData(
@@ -1865,7 +1865,7 @@  discard block
 block discarded – undo
1865 1865
         } else {
1866 1866
             $tmp = 1;
1867 1867
         }
1868
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1868
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1869 1869
         $counter = DB::count();
1870 1870
         if ($counter === 0) {
1871 1871
             DB::insert(
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 
1894 1894
         // ga_website_name
1895 1895
         if (is_null($dataReceived['ga_website_name']) === false) {
1896
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1896
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1897 1897
             $counter = DB::count();
1898 1898
             if ($counter === 0) {
1899 1899
                 DB::insert(
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
         }
1924 1924
 
1925 1925
         // send data
1926
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
1926
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
1927 1927
         break;
1928 1928
 
1929 1929
     case 'save_agses_options':
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 
1947 1947
         // agses_hosted_url
1948 1948
         if (!is_null($dataReceived['agses_hosted_url'])) {
1949
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1949
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1950 1950
             $counter = DB::count();
1951 1951
             if ($counter === 0) {
1952 1952
                 DB::insert(
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 
1978 1978
         // agses_hosted_id
1979 1979
         if (!is_null($dataReceived['agses_hosted_id'])) {
1980
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1980
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1981 1981
             $counter = DB::count();
1982 1982
             if ($counter === 0) {
1983 1983
                 DB::insert(
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
         // agses_hosted_apikey
2010 2010
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2011
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2011
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2012 2012
             $counter = DB::count();
2013 2013
             if ($counter === 0) {
2014 2014
                 DB::insert(
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
         }
2039 2039
 
2040 2040
         // send data
2041
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
2041
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
2042 2042
         break;
2043 2043
 
2044 2044
     case 'save_option_change':
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
 
2079 2079
         // Check if setting is already in DB. If NO then insert, if YES then update.
2080 2080
         $data = DB::query(
2081
-            'SELECT * FROM ' . prefixTable('misc') . '
2081
+            'SELECT * FROM '.prefixTable('misc').'
2082 2082
             WHERE type = %s AND intitule = %s',
2083 2083
             'admin',
2084 2084
             $post_field
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
                     array(
2102 2102
                         'valeur' => time(),
2103 2103
                         'type' => 'admin',
2104
-                        'intitule' => $post_field . '_time',
2104
+                        'intitule' => $post_field.'_time',
2105 2105
                         'updated_at' => time(),
2106 2106
                     )
2107 2107
                 );
@@ -2123,10 +2123,10 @@  discard block
 block discarded – undo
2123 2123
             if ($post_field === 'send_stats') {
2124 2124
                 // Check if previous time exists, if not them insert this value in DB
2125 2125
                 DB::query(
2126
-                    'SELECT * FROM ' . prefixTable('misc') . '
2126
+                    'SELECT * FROM '.prefixTable('misc').'
2127 2127
                     WHERE type = %s AND intitule = %s',
2128 2128
                     'admin',
2129
-                    $post_field . '_time'
2129
+                    $post_field.'_time'
2130 2130
                 );
2131 2131
                 $counter = DB::count();
2132 2132
                 if ($counter === 0) {
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
                         array(
2136 2136
                             'valeur' => 0,
2137 2137
                             'type' => 'admin',
2138
-                            'intitule' => $post_field . '_time',
2138
+                            'intitule' => $post_field.'_time',
2139 2139
                             'created_at' => time(),
2140 2140
                         )
2141 2141
                     );
@@ -2157,13 +2157,13 @@  discard block
 block discarded – undo
2157 2157
         // special Cases
2158 2158
         if ($post_field === 'cpassman_url') {
2159 2159
             // update also jsUrl for CSFP protection
2160
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2160
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2161 2161
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2162 2162
             $data = file_get_contents($csrfp_file);
2163 2163
             $posJsUrl = strpos($data, '"jsUrl" => "');
2164 2164
             $posEndLine = strpos($data, '",', $posJsUrl);
2165 2165
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2166
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2166
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2167 2167
             file_put_contents($csrfp_file, $newdata);
2168 2168
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2169 2169
             DB::update(
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
         echo prepareExchangedData(
2189 2189
             array(
2190 2190
                 'error' => false,
2191
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2191
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2192 2192
                 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '',
2193 2193
             ),
2194 2194
             'encode'
@@ -2231,7 +2231,7 @@  discard block
 block discarded – undo
2231 2231
 
2232 2232
         // send statistics
2233 2233
         if (null !== $post_status) {
2234
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2234
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2235 2235
             $counter = DB::count();
2236 2236
             if ($counter === 0) {
2237 2237
                 DB::insert(
@@ -2262,7 +2262,7 @@  discard block
 block discarded – undo
2262 2262
 
2263 2263
         // send statistics items
2264 2264
         if (null !== $post_list) {
2265
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2265
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2266 2266
             $counter = DB::count();
2267 2267
             if ($counter === 0) {
2268 2268
                 DB::insert(
@@ -2308,7 +2308,7 @@  discard block
 block discarded – undo
2308 2308
             break;
2309 2309
         }
2310 2310
 
2311
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2311
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2312 2312
             if (DB::count() === 1) {
2313 2313
                 echo 1;
2314 2314
             } else {
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
 
2347 2347
         $rows = DB::query(
2348 2348
             'SELECT id, title
2349
-                FROM ' . prefixTable('roles_title') . '
2349
+                FROM ' . prefixTable('roles_title').'
2350 2350
                 ORDER BY title ASC'
2351 2351
         );
2352 2352
         foreach ($rows as $record) {
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 function tablesIntegrityCheck(): array
2463 2463
 {
2464 2464
     // Get integrity tables file
2465
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
2465
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
2466 2466
     if (file_exists($integrityTablesFile) === false) {
2467 2467
         return [
2468 2468
             'error' => true,
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
     // Get all tables
2481 2481
     $tables = [];
2482 2482
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
2483
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
2483
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
2484 2484
     }
2485 2485
     // Prepare the integrity check
2486 2486
     $tablesInError = [];
Please login to merge, or discard this patch.