Test Setup Failed
Branch — wip_sessions (2e0cc8)
by Nils
10:32
created
install--ASUPPRIMER/upgrade_run_3.1.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
         $port
69 69
     );
70 70
 } else {
71
-    $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error());
72
-    echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]';
71
+    $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error());
72
+    echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]';
73 73
     mysqli_close($db_link);
74 74
     exit();
75 75
 }
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 
86 86
 // 
87 87
 // Add new setting 'enable_refresh_task_last_execution'
88
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'enable_refresh_task_last_execution'"));
88
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'enable_refresh_task_last_execution'"));
89 89
 if (intval($tmp) === 0) {
90 90
     mysqli_query(
91 91
         $db_link,
92
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_refresh_task_last_execution', '1')"
92
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_refresh_task_last_execution', '1')"
93 93
     );
94 94
 }
95 95
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 // Add new table ITEMS_OTP
101 101
 mysqli_query(
102 102
     $db_link,
103
-    'CREATE TABLE IF NOT EXISTS `' . $pre . 'items_otp` (
103
+    'CREATE TABLE IF NOT EXISTS `'.$pre.'items_otp` (
104 104
     `increment_id` int(12) NOT NULL,
105 105
     `item_id` int(12) NOT NULL,
106 106
     `secret` text NOT NULL,
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 // Alter table TOKENS
116 116
 mysqli_query(
117 117
     $db_link,
118
-    'ALTER TABLE `' . $pre . 'tokens` CHANGE `end_timestamp` `end_timestamp` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;'
118
+    'ALTER TABLE `'.$pre.'tokens` CHANGE `end_timestamp` `end_timestamp` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;'
119 119
 );
120 120
 
121 121
 
122 122
 // Alter table ldap_groups_roles
123 123
 mysqli_query(
124 124
     $db_link,
125
-    'ALTER TABLE `' . $pre . 'ldap_groups_roles` CHANGE `ldap_group_id` `ldap_group_id` VARCHAR(500) NOT NULL;'
125
+    'ALTER TABLE `'.$pre.'ldap_groups_roles` CHANGE `ldap_group_id` `ldap_group_id` VARCHAR(500) NOT NULL;'
126 126
 );
127 127
 
128 128
 //---<END 3.1.1
Please login to merge, or discard this patch.
install--ASUPPRIMER/upgrade_run_3.0.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
         $port
71 71
     );
72 72
 } else {
73
-    $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error());
74
-    echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]';
73
+    $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error());
74
+    echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]';
75 75
     mysqli_close($db_link);
76 76
     exit();
77 77
 }
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 
102 102
 // Add the INDEX process_id_idx to the processes_tasks table
103 103
 $res = checkIndexExist(
104
-    $pre . 'processes_tasks',
104
+    $pre.'processes_tasks',
105 105
     'process_id_idx',
106 106
     "ADD KEY `process_id_idx` (`process_id`)"
107 107
 );
108 108
 if (!$res) {
109
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX process_id_idx to the processes_tasks table! ' . mysqli_error($db_link) . '!"}]';
109
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX process_id_idx to the processes_tasks table! '.mysqli_error($db_link).'!"}]';
110 110
     mysqli_close($db_link);
111 111
     exit();
112 112
 }
@@ -117,38 +117,38 @@  discard block
 block discarded – undo
117 117
 
118 118
 //--->BEGIN 3.0.6
119 119
 // Add new setting 'sending_emails_job_frequency'
120
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'sending_emails_job_frequency'"));
120
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'sending_emails_job_frequency'"));
121 121
 if (intval($tmp) === 0) {
122 122
     mysqli_query(
123 123
         $db_link,
124
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'sending_emails_job_frequency', '2')"
124
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'sending_emails_job_frequency', '2')"
125 125
     );
126 126
 }
127 127
 // Add new setting 'user_keys_job_frequency'
128
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'user_keys_job_frequency'"));
128
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'user_keys_job_frequency'"));
129 129
 if (intval($tmp) === 0) {
130 130
     mysqli_query(
131 131
         $db_link,
132
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'user_keys_job_frequency', '1')"
132
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'user_keys_job_frequency', '1')"
133 133
     );
134 134
 }
135 135
 // Add new setting 'items_statistics_job_frequency'
136
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'enable_tasks_items_statistics_job_frequencymanager'"));
136
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'enable_tasks_items_statistics_job_frequencymanager'"));
137 137
 if (intval($tmp) === 0) {
138 138
     mysqli_query(
139 139
         $db_link,
140
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_statistics_job_frequency', '5')"
140
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_statistics_job_frequency', '5')"
141 141
     );
142 142
 }
143 143
 
144 144
 // Add field ongoing_process_id to USERS table
145 145
 $res = addColumnIfNotExist(
146
-    $pre . 'users',
146
+    $pre.'users',
147 147
     'ongoing_process_id',
148 148
     "varchar(100) NULL;"
149 149
 );
150 150
 if ($res === false) {
151
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field ongoing_process_id to table USERS! ' . mysqli_error($db_link) . '!"}]';
151
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field ongoing_process_id to table USERS! '.mysqli_error($db_link).'!"}]';
152 152
     mysqli_close($db_link);
153 153
     exit();
154 154
 }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 try {
162 162
     mysqli_query(
163 163
         $db_link,
164
-        'ALTER TABLE `' . $pre . 'cache_tree` CHANGE `data` `data` LONGTEXT DEFAULT NULL;'
164
+        'ALTER TABLE `'.$pre.'cache_tree` CHANGE `data` `data` LONGTEXT DEFAULT NULL;'
165 165
     );
166 166
 } catch (Exception $e) {
167 167
     // Do nothing
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 // Fix for #3679
171 171
 mysqli_query(
172 172
     $db_link,
173
-    "UPDATE `" . $pre . "users` SET `treeloadstrategy` = 'full' WHERE treeloadstrategy NOT IN ('full','sequential');"
173
+    "UPDATE `".$pre."users` SET `treeloadstrategy` = 'full' WHERE treeloadstrategy NOT IN ('full','sequential');"
174 174
 );
175 175
 
176 176
 //---<END 3.0.7
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 //--->BEGIN 3.0.8
181 181
 // Add field mfa_disabled to USERS table
182 182
 $res = addColumnIfNotExist(
183
-    $pre . 'users',
183
+    $pre.'users',
184 184
     'mfa_enabled',
185 185
     "tinyint(1) NOT null DEFAULT '1';"
186 186
 );
187 187
 if ($res === false) {
188
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field mfa_disabled to table USERS! ' . mysqli_error($db_link) . '!"}]';
188
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field mfa_disabled to table USERS! '.mysqli_error($db_link).'!"}]';
189 189
     mysqli_close($db_link);
190 190
     exit();
191 191
 }
@@ -196,124 +196,124 @@  discard block
 block discarded – undo
196 196
 
197 197
 //--->BEGIN 3.0.9
198 198
 // Add new setting 'reload_cache_table_task'
199
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'reload_cache_table_task'"));
199
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'reload_cache_table_task'"));
200 200
 if (intval($tmp) === 0) {
201 201
     mysqli_query(
202 202
         $db_link,
203
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'reload_cache_table_task', '')"
203
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'reload_cache_table_task', '')"
204 204
     );
205 205
 }
206 206
 // Add new setting 'rebuild_config_file'
207
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'rebuild_config_file'"));
207
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'rebuild_config_file'"));
208 208
 if (intval($tmp) === 0) {
209 209
     mysqli_query(
210 210
         $db_link,
211
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'rebuild_config_file', '')"
211
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'rebuild_config_file', '')"
212 212
     );
213 213
 }// Add new setting 'purge_temporary_files_task'
214
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'purge_temporary_files_task'"));
214
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'purge_temporary_files_task'"));
215 215
 if (intval($tmp) === 0) {
216 216
     mysqli_query(
217 217
         $db_link,
218
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'purge_temporary_files_task', '')"
218
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'purge_temporary_files_task', '')"
219 219
     );
220 220
 }
221 221
 // Add new setting 'clean_orphan_objects_task'
222
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'clean_orphan_objects_task'"));
222
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'clean_orphan_objects_task'"));
223 223
 if (intval($tmp) === 0) {
224 224
     mysqli_query(
225 225
         $db_link,
226
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'clean_orphan_objects_task', '')"
226
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'clean_orphan_objects_task', '')"
227 227
     );
228 228
 }
229 229
 // Add new setting 'users_personal_folder_task'
230
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'users_personal_folder_task'"));
230
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'users_personal_folder_task'"));
231 231
 if (intval($tmp) === 0) {
232 232
     mysqli_query(
233 233
         $db_link,
234
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'users_personal_folder_task', '')"
234
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'users_personal_folder_task', '')"
235 235
     );
236 236
 }
237 237
 
238 238
 // Remove unused settings
239 239
 mysqli_query(
240 240
     $db_link,
241
-    "DELETE FROM `" . $pre . "misc` WHERE `intitule`='maintenance_job_tasks';"
241
+    "DELETE FROM `".$pre."misc` WHERE `intitule`='maintenance_job_tasks';"
242 242
 );
243 243
 mysqli_query(
244 244
     $db_link,
245
-    "DELETE FROM `" . $pre . "misc` WHERE `intitule`='maintenance_job_frequency';"
245
+    "DELETE FROM `".$pre."misc` WHERE `intitule`='maintenance_job_frequency';"
246 246
 );
247 247
 
248 248
 // Add field item_key to ITEMS table
249 249
 $res = addColumnIfNotExist(
250
-    $pre . 'items',
250
+    $pre.'items',
251 251
     'item_key',
252 252
     "varchar(500) NOT NULL DEFAULT '-1';"
253 253
 );
254 254
 if ($res === false) {
255
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_key to table ITEMS! ' . mysqli_error($db_link) . '!"}]';
255
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_key to table ITEMS! '.mysqli_error($db_link).'!"}]';
256 256
     mysqli_close($db_link);
257 257
     exit();
258 258
 }
259 259
 
260 260
 // Remove column unique from ITEMS table
261 261
 $res = removeColumnIfNotExist(
262
-    $pre . 'items',
262
+    $pre.'items',
263 263
     'unique'
264 264
 );
265 265
 
266 266
 // Add field export_tag to EXPORT table
267 267
 $res = addColumnIfNotExist(
268
-    $pre . 'export',
268
+    $pre.'export',
269 269
     'export_tag',
270 270
     "varchar(20) NOT NULL;"
271 271
 );
272 272
 if ($res === false) {
273
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field export_tag to table EXPORT! ' . mysqli_error($db_link) . '!"}]';
273
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field export_tag to table EXPORT! '.mysqli_error($db_link).'!"}]';
274 274
     mysqli_close($db_link);
275 275
     exit();
276 276
 }
277 277
 
278 278
 // Add field folder_id to EXPORT table
279 279
 $res = addColumnIfNotExist(
280
-    $pre . 'export',
280
+    $pre.'export',
281 281
     'folder_id',
282 282
     "varchar(10) NOT NULL;"
283 283
 );
284 284
 if ($res === false) {
285
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field folder_id to table EXPORT! ' . mysqli_error($db_link) . '!"}]';
285
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field folder_id to table EXPORT! '.mysqli_error($db_link).'!"}]';
286 286
     mysqli_close($db_link);
287 287
     exit();
288 288
 }
289 289
 
290 290
 // Add field perso to EXPORT table
291 291
 $res = addColumnIfNotExist(
292
-    $pre . 'export',
292
+    $pre.'export',
293 293
     'perso',
294 294
     "tinyint(1) NOT NULL default '0';"
295 295
 );
296 296
 if ($res === false) {
297
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field perso to table EXPORT! ' . mysqli_error($db_link) . '!"}]';
297
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field perso to table EXPORT! '.mysqli_error($db_link).'!"}]';
298 298
     mysqli_close($db_link);
299 299
     exit();
300 300
 }
301 301
 
302 302
 // Add field restricted_to to EXPORT table
303 303
 $res = addColumnIfNotExist(
304
-    $pre . 'export',
304
+    $pre.'export',
305 305
     'restricted_to',
306 306
     "varchar(200) DEFAULT NULL;"
307 307
 );
308 308
 if ($res === false) {
309
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field restricted_to to table EXPORT! ' . mysqli_error($db_link) . '!"}]';
309
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field restricted_to to table EXPORT! '.mysqli_error($db_link).'!"}]';
310 310
     mysqli_close($db_link);
311 311
     exit();
312 312
 }
313 313
 
314 314
 // Rename column id to item_id in EXPORT table
315 315
 changeColumnName(
316
-    $pre . 'export',
316
+    $pre.'export',
317 317
     'id',
318 318
     'item_id',
319 319
     "int(12) NOT NULL"
@@ -321,42 +321,42 @@  discard block
 block discarded – undo
321 321
 
322 322
 // Add field created_at to USERS table
323 323
 $res = addColumnIfNotExist(
324
-    $pre . 'users',
324
+    $pre.'users',
325 325
     'created_at',
326 326
     "varchar(30) NULL;"
327 327
 );
328 328
 if ($res === false) {
329
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table USERS! ' . mysqli_error($db_link) . '!"}]';
329
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table USERS! '.mysqli_error($db_link).'!"}]';
330 330
     mysqli_close($db_link);
331 331
     exit();
332 332
 }
333 333
 
334 334
 // Add field updated_at to USERS table
335 335
 $res = addColumnIfNotExist(
336
-    $pre . 'users',
336
+    $pre.'users',
337 337
     'updated_at',
338 338
     "varchar(30) NULL;"
339 339
 );
340 340
 if ($res === false) {
341
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table USERS! ' . mysqli_error($db_link) . '!"}]';
341
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table USERS! '.mysqli_error($db_link).'!"}]';
342 342
     mysqli_close($db_link);
343 343
     exit();
344 344
 }
345 345
 
346 346
 // Add field deleted_at to USERS table
347 347
 $res = addColumnIfNotExist(
348
-    $pre . 'users',
348
+    $pre.'users',
349 349
     'deleted_at',
350 350
     "varchar(30) NULL;"
351 351
 );
352 352
 if ($res === false) {
353
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table USERS! ' . mysqli_error($db_link) . '!"}]';
353
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table USERS! '.mysqli_error($db_link).'!"}]';
354 354
     mysqli_close($db_link);
355 355
     exit();
356 356
 }
357 357
 
358 358
 // populate created_at, updated_at and deleted_at fields in USERS table
359
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "users` WHERE created_at IS NOT NULL"));
359
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."users` WHERE created_at IS NOT NULL"));
360 360
 if (intval($tmp) === 0) {
361 361
     populateUsersTable($pre);
362 362
 }
@@ -368,36 +368,36 @@  discard block
 block discarded – undo
368 368
 
369 369
 // Add field created_at to ITEMS table
370 370
 $res = addColumnIfNotExist(
371
-    $pre . 'items',
371
+    $pre.'items',
372 372
     'created_at',
373 373
     "varchar(30) NULL;"
374 374
 );
375 375
 if ($res === false) {
376
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table ITEMS! ' . mysqli_error($db_link) . '!"}]';
376
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table ITEMS! '.mysqli_error($db_link).'!"}]';
377 377
     mysqli_close($db_link);
378 378
     exit();
379 379
 }
380 380
 
381 381
 // Add field updated_at to ITEMS table
382 382
 $res = addColumnIfNotExist(
383
-    $pre . 'items',
383
+    $pre.'items',
384 384
     'updated_at',
385 385
     "varchar(30) NULL;"
386 386
 );
387 387
 if ($res === false) {
388
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table ITEMS! ' . mysqli_error($db_link) . '!"}]';
388
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table ITEMS! '.mysqli_error($db_link).'!"}]';
389 389
     mysqli_close($db_link);
390 390
     exit();
391 391
 }
392 392
 
393 393
 // Add field deleted_at to ITEMS table
394 394
 $res = addColumnIfNotExist(
395
-    $pre . 'items',
395
+    $pre.'items',
396 396
     'deleted_at',
397 397
     "varchar(30) NULL;"
398 398
 );
399 399
 if ($res === false) {
400
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table ITEMS! ' . mysqli_error($db_link) . '!"}]';
400
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table ITEMS! '.mysqli_error($db_link).'!"}]';
401 401
     mysqli_close($db_link);
402 402
     exit();
403 403
 }
@@ -406,29 +406,29 @@  discard block
 block discarded – undo
406 406
 try {
407 407
     mysqli_query(
408 408
         $db_link,
409
-        'ALTER TABLE `' . $pre . 'processes` CHANGE `process_type` `process_type` VARCHAR(100) NOT NULL;'
409
+        'ALTER TABLE `'.$pre.'processes` CHANGE `process_type` `process_type` VARCHAR(100) NOT NULL;'
410 410
     );
411 411
 } catch (Exception $e) {
412 412
     // Do nothing
413 413
 }
414 414
 
415 415
 // Add new setting 'maximum_session_expiration_time'
416
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'maximum_session_expiration_time'"));
416
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'maximum_session_expiration_time'"));
417 417
 if (intval($tmp) === 0) {
418 418
     mysqli_query(
419 419
         $db_link,
420
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'maximum_session_expiration_time', '60')"
420
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'maximum_session_expiration_time', '60')"
421 421
     );
422 422
 }
423 423
 
424 424
 // Add field treated_objects to processes_logs table
425 425
 $res = addColumnIfNotExist(
426
-    $pre . 'processes_logs',
426
+    $pre.'processes_logs',
427 427
     'treated_objects',
428 428
     "varchar(20) NULL;"
429 429
 );
430 430
 if ($res === false) {
431
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field treated_objects to table processes_logs! ' . mysqli_error($db_link) . '!"}]';
431
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field treated_objects to table processes_logs! '.mysqli_error($db_link).'!"}]';
432 432
     mysqli_close($db_link);
433 433
     exit();
434 434
 }
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 $resAdmin = mysqli_query(
438 438
     $db_link,
439 439
     "select name, lastname
440
-    from `" . $pre . "users`
440
+    from `" . $pre."users`
441 441
     WHERE id = 1"
442 442
 );
443 443
 $admin = mysqli_fetch_array($resAdmin);
@@ -445,54 +445,54 @@  discard block
 block discarded – undo
445 445
     // update created_at field
446 446
     mysqli_query(
447 447
         $db_link,
448
-        "UPDATE `" . $pre . "users` SET name = 'Change me', lastname = 'Change me' WHERE id = 1"
448
+        "UPDATE `".$pre."users` SET name = 'Change me', lastname = 'Change me' WHERE id = 1"
449 449
     );
450 450
 }
451 451
 
452 452
 // Add field started_at to processes table
453 453
 $res = addColumnIfNotExist(
454
-    $pre . 'processes',
454
+    $pre.'processes',
455 455
     'started_at',
456 456
     "varchar(50) NULL;"
457 457
 );
458 458
 if ($res === false) {
459
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field started_at to table processes! ' . mysqli_error($db_link) . '!"}]';
459
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field started_at to table processes! '.mysqli_error($db_link).'!"}]';
460 460
     mysqli_close($db_link);
461 461
     exit();
462 462
 }
463 463
 
464 464
 // Add field views to otv table
465 465
 $res = addColumnIfNotExist(
466
-    $pre . 'otv',
466
+    $pre.'otv',
467 467
     'views',
468 468
     "INT(10) NOT NULL DEFAULT '0';"
469 469
 );
470 470
 if ($res === false) {
471
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field views to table otv! ' . mysqli_error($db_link) . '!"}]';
471
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field views to table otv! '.mysqli_error($db_link).'!"}]';
472 472
     mysqli_close($db_link);
473 473
     exit();
474 474
 }
475 475
 
476 476
 // Add field max_views to otv table
477 477
 $res = addColumnIfNotExist(
478
-    $pre . 'otv',
478
+    $pre.'otv',
479 479
     'max_views',
480 480
     "INT(10) NULL DEFAULT NULL;"
481 481
 );
482 482
 if ($res === false) {
483
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field max_views to table otv! ' . mysqli_error($db_link) . '!"}]';
483
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field max_views to table otv! '.mysqli_error($db_link).'!"}]';
484 484
     mysqli_close($db_link);
485 485
     exit();
486 486
 }
487 487
 
488 488
 // Add field time_limit to otv table
489 489
 $res = addColumnIfNotExist(
490
-    $pre . 'otv',
490
+    $pre.'otv',
491 491
     'time_limit',
492 492
     "varchar(100) DEFAULT NULL;"
493 493
 );
494 494
 if ($res === false) {
495
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field time_limit to table otv! ' . mysqli_error($db_link) . '!"}]';
495
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field time_limit to table otv! '.mysqli_error($db_link).'!"}]';
496 496
     mysqli_close($db_link);
497 497
     exit();
498 498
 }
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
 // delete old otv
501 501
 mysqli_query(
502 502
     $db_link,
503
-    "DELETE FROM `" . $pre . "otv` WHERE max_views IS NULL;"
503
+    "DELETE FROM `".$pre."otv` WHERE max_views IS NULL;"
504 504
 );
505 505
 
506 506
 // Alter encrypted_psk in Users
507 507
 try {
508 508
     mysqli_query(
509 509
         $db_link,
510
-        'ALTER TABLE `' . $pre . 'users` CHANGE `encrypted_psk` `encrypted_psk` text NULL DEFAULT NULL;'
510
+        'ALTER TABLE `'.$pre.'users` CHANGE `encrypted_psk` `encrypted_psk` text NULL DEFAULT NULL;'
511 511
     );
512 512
 } catch (Exception $e) {
513 513
     // Do nothing
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 try {
518 518
     mysqli_query(
519 519
         $db_link,
520
-        'ALTER TABLE `' . $pre . 'items` CHANGE `url` `url` TEXT NULL DEFAULT NULL;'
520
+        'ALTER TABLE `'.$pre.'items` CHANGE `url` `url` TEXT NULL DEFAULT NULL;'
521 521
     );
522 522
 } catch (Exception $e) {
523 523
     // Do nothing
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 try {
528 528
     mysqli_query(
529 529
         $db_link,
530
-        'ALTER TABLE `' . $pre . 'cache` CHANGE `url` `url` TEXT NULL DEFAULT NULL;'
530
+        'ALTER TABLE `'.$pre.'cache` CHANGE `url` `url` TEXT NULL DEFAULT NULL;'
531 531
     );
532 532
 } catch (Exception $e) {
533 533
     // Do nothing
@@ -535,12 +535,12 @@  discard block
 block discarded – undo
535 535
 
536 536
 // Add field item_id to processes table
537 537
 $res = addColumnIfNotExist(
538
-    $pre . 'processes',
538
+    $pre.'processes',
539 539
     'item_id',
540 540
     "INT(12) NULL;"
541 541
 );
542 542
 if ($res === false) {
543
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_id to table processes! ' . mysqli_error($db_link) . '!"}]';
543
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_id to table processes! '.mysqli_error($db_link).'!"}]';
544 544
     mysqli_close($db_link);
545 545
     exit();
546 546
 }
@@ -549,18 +549,18 @@  discard block
 block discarded – undo
549 549
 try {
550 550
     mysqli_query(
551 551
         $db_link,
552
-        'ALTER TABLE `' . $pre . 'users` CHANGE `login` `login` VARCHAR(500) NOT NULL;'
552
+        'ALTER TABLE `'.$pre.'users` CHANGE `login` `login` VARCHAR(500) NOT NULL;'
553 553
     );
554 554
 } catch (Exception $e) {
555 555
     // Do nothing
556 556
 }
557 557
 
558 558
 // Add new setting 'items_ops_job_frequency'
559
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'items_ops_job_frequency'"));
559
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'items_ops_job_frequency'"));
560 560
 if (intval($tmp) === 0) {
561 561
     mysqli_query(
562 562
         $db_link,
563
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_ops_job_frequency', '1')"
563
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_ops_job_frequency', '1')"
564 564
     );
565 565
 }
566 566
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 try {
569 569
     mysqli_query(
570 570
         $db_link,
571
-        'ALTER TABLE `' . $pre . 'log_items` CHANGE `raison_iv` `old_value` MEDIUMTEXT NULL DEFAULT NULL;'
571
+        'ALTER TABLE `'.$pre.'log_items` CHANGE `raison_iv` `old_value` MEDIUMTEXT NULL DEFAULT NULL;'
572 572
     );
573 573
 } catch (Exception $e) {
574 574
     // Do nothing
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 try {
579 579
     mysqli_query(
580 580
         $db_link,
581
-        'ALTER TABLE `' . $pre . 'cache` CHANGE `description` `description` MEDIUMTEXT NULL DEFAULT NULL;'
581
+        'ALTER TABLE `'.$pre.'cache` CHANGE `description` `description` MEDIUMTEXT NULL DEFAULT NULL;'
582 582
     );
583 583
 } catch (Exception $e) {
584 584
     // Do nothing
@@ -586,24 +586,24 @@  discard block
 block discarded – undo
586 586
 
587 587
 // Add field shared_globaly to otv table
588 588
 $res = addColumnIfNotExist(
589
-    $pre . 'otv',
589
+    $pre.'otv',
590 590
     'shared_globaly',
591 591
     "INT(1) NOT NULL DEFAULT '0';"
592 592
 );
593 593
 if ($res === false) {
594
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field shared_globaly to table otv! ' . mysqli_error($db_link) . '!"}]';
594
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field shared_globaly to table otv! '.mysqli_error($db_link).'!"}]';
595 595
     mysqli_close($db_link);
596 596
     exit();
597 597
 }
598 598
 
599 599
 // Add field keys_recovery_time to users table
600 600
 $res = addColumnIfNotExist(
601
-    $pre . 'users',
601
+    $pre.'users',
602 602
     'keys_recovery_time',
603 603
     "VARCHAR(500) NULL DEFAULT NULL;"
604 604
 );
605 605
 if ($res === false) {
606
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field keys_recovery_time to table users! ' . mysqli_error($db_link) . '!"}]';
606
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field keys_recovery_time to table users! '.mysqli_error($db_link).'!"}]';
607 607
     mysqli_close($db_link);
608 608
     exit();
609 609
 }
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 try {
613 613
     mysqli_query(
614 614
         $db_link,
615
-        'ALTER TABLE `' . $pre . 'users` CHANGE `favourites` `favourites` varchar(1000) NULL DEFAULT NULL;'
615
+        'ALTER TABLE `'.$pre.'users` CHANGE `favourites` `favourites` varchar(1000) NULL DEFAULT NULL;'
616 616
     );
617 617
 } catch (Exception $e) {
618 618
     // Do nothing
@@ -620,12 +620,12 @@  discard block
 block discarded – undo
620 620
 
621 621
 // Add field aes_iv to users table
622 622
 $res = addColumnIfNotExist(
623
-    $pre . 'users',
623
+    $pre.'users',
624 624
     'aes_iv',
625 625
     "TEXT NULL DEFAULT NULL;"
626 626
 );
627 627
 if ($res === false) {
628
-    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field aes_iv to table users! ' . mysqli_error($db_link) . '!"}]';
628
+    echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field aes_iv to table users! '.mysqli_error($db_link).'!"}]';
629 629
     mysqli_close($db_link);
630 630
     exit();
631 631
 }
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 try {
635 635
     mysqli_query(
636 636
         $db_link,
637
-        'ALTER TABLE `' . $pre . 'users` CHANGE `psk` `psk` VARCHAR(400) NULL DEFAULT NULL;'
637
+        'ALTER TABLE `'.$pre.'users` CHANGE `psk` `psk` VARCHAR(400) NULL DEFAULT NULL;'
638 638
     );
639 639
 } catch (Exception $e) {
640 640
     // Do nothing
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 
643 643
 // Now removing all old libraries
644 644
 deleteAll([
645
-    "Illuminate","Encryption","Tightenco","portable-ascii-master","Pdf","ForceUTF8","portable-utf8-master","GO","Symfony","Elegant","Firebase","Database","anti-xss-master","LdapRecord","misc","PasswordGenerator","Authentication","Goodby","Plupload","PHPMailer","TiBeN","protect","Cron","PasswordLib","Fork","Carbon","Tree","Webmozart"
645
+    "Illuminate", "Encryption", "Tightenco", "portable-ascii-master", "Pdf", "ForceUTF8", "portable-utf8-master", "GO", "Symfony", "Elegant", "Firebase", "Database", "anti-xss-master", "LdapRecord", "misc", "PasswordGenerator", "Authentication", "Goodby", "Plupload", "PHPMailer", "TiBeN", "protect", "Cron", "PasswordLib", "Fork", "Carbon", "Tree", "Webmozart"
646 646
 ]);
647 647
 
648 648
 //---<END 3.0.10
@@ -650,16 +650,16 @@  discard block
 block discarded – undo
650 650
 //---------------------------------------------------------------------
651 651
 
652 652
 // Save timestamp
653
-$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'upgrade_timestamp'"));
653
+$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'upgrade_timestamp'"));
654 654
 if (intval($tmp) === 0) {
655 655
     mysqli_query(
656 656
         $db_link,
657
-        "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'upgrade_timestamp', ".time().")"
657
+        "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'upgrade_timestamp', ".time().")"
658 658
     );
659 659
 } else {
660 660
     mysqli_query(
661 661
         $db_link,
662
-        "UPDATE `" . $pre . "misc` SET valeur = ".time()." WHERE type = 'admin' AND intitule = 'upgrade_timestamp'"
662
+        "UPDATE `".$pre."misc` SET valeur = ".time()." WHERE type = 'admin' AND intitule = 'upgrade_timestamp'"
663 663
     );
664 664
 }
665 665
 
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
     $users = mysqli_query(
682 682
         $db_link,
683 683
         "select u.id as uid, ls.date as datetime
684
-        from `" . $pre . "users` as u
685
-        inner join `" . $pre . "log_system` as ls on ls.field_1 = u.id
684
+        from `" . $pre."users` as u
685
+        inner join `" . $pre."log_system` as ls on ls.field_1 = u.id
686 686
         WHERE ls.type = 'user_mngt' AND ls.label = 'at_user_added'"
687 687
     );
688 688
     while ($user = mysqli_fetch_assoc($users)) {
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             // update created_at field
691 691
             mysqli_query(
692 692
                 $db_link,
693
-                "UPDATE `" . $pre . "users` SET created_at = '".$user['datetime']."' WHERE id = ".$user['uid']
693
+                "UPDATE `".$pre."users` SET created_at = '".$user['datetime']."' WHERE id = ".$user['uid']
694 694
             );
695 695
         }
696 696
     }
@@ -698,14 +698,14 @@  discard block
 block discarded – undo
698 698
     // loop on users - updated_at
699 699
     $users = mysqli_query(
700 700
         $db_link,
701
-        "select u.id as uid, (select date from " . $pre . "log_system where type = 'user_mngt' and field_1=uid order by date DESC limit 1) as datetime from `" . $pre . "users` as u;"
701
+        "select u.id as uid, (select date from ".$pre."log_system where type = 'user_mngt' and field_1=uid order by date DESC limit 1) as datetime from `".$pre."users` as u;"
702 702
     );
703 703
     while ($user = mysqli_fetch_assoc($users)) {
704 704
         if (empty((string) $user['datetime']) === false && is_null($user['datetime']) === false) {
705 705
             // update updated_at field
706 706
             mysqli_query(
707 707
                 $db_link,
708
-                "UPDATE `" . $pre . "users` SET updated_at = '".$user['datetime']."' WHERE id = ".$user['uid']
708
+                "UPDATE `".$pre."users` SET updated_at = '".$user['datetime']."' WHERE id = ".$user['uid']
709 709
             );
710 710
         }
711 711
     }
Please login to merge, or discard this patch.
install--ASUPPRIMER/libs/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.
install--ASUPPRIMER/upgrade_ajax.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 // Do we need to rewrite the settings.php file?
68 68
 if (defined("DB_PASSWD") === false) {
69
-	$settingsFile = '../includes/config/settings.php';
69
+    $settingsFile = '../includes/config/settings.php';
70 70
     if (null !== SECUREPATH) { //3.0.0.23
71 71
         //Do a copy of the existing file
72 72
         if (!copy(
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");';
192 192
 define("SECUREFILE", "' . SECUREFILE. '");
193 193
 
194
-		if (defined('IKEY') === true) $settingsTxt .= '
194
+        if (defined('IKEY') === true) $settingsTxt .= '
195 195
 define("IKEY", "' . IKEY . '");';
196
-		else $settingsTxt .= '
196
+        else $settingsTxt .= '
197 197
 define("IKEY", "");';
198
-		if (defined('SKEY') === true) $settingsTxt .= '
198
+        if (defined('SKEY') === true) $settingsTxt .= '
199 199
 define("SKEY", "' . SKEY . '");';
200
-		else $settingsTxt .= '
200
+        else $settingsTxt .= '
201 201
 define("SKEY", "");';
202
-		if (defined('HOST') === true) $settingsTxt .= '
202
+        if (defined('HOST') === true) $settingsTxt .= '
203 203
 define("HOST", "' . HOST . '");';
204
-		else $settingsTxt .= '
204
+        else $settingsTxt .= '
205 205
 define("HOST", "");';
206 206
 
207 207
 
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         //Do a copy of the existing file
72 72
         if (!copy(
73 73
             $settingsFile,
74
-            $settingsFile . '.' . date(
74
+            $settingsFile.'.'.date(
75 75
                 'Y_m_d_H_i_s',
76 76
                 mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y'))
77 77
             )
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         // CHeck if old sk.php exists.
89 89
         // If yes then get keys to database and delete it
90 90
         if (empty($post_sk_path) === false || defined('SECUREPATH') === true) {
91
-            $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH) . '/sk.php';
91
+            $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/sk.php';
92 92
             if (file_exists($filename)) {
93 93
                 include_once $filename;
94 94
                 unlink($filename);
@@ -97,63 +97,63 @@  discard block
 block discarded – undo
97 97
                 // SKEY
98 98
                 $tmp = mysqli_query(
99 99
                     $db_link,
100
-                    "SELECT INTO `" . $pre . "misc`
100
+                    "SELECT INTO `".$pre."misc`
101 101
                     WHERE type = 'admin' AND intitule = 'duo_skey'"
102 102
                 );
103 103
                 if ($tmp) {
104 104
                     mysqli_query(
105 105
                         $db_link,
106
-                        "UPDATE `" . $pre . "misc`
107
-                        set valeur = '" . SKEY . "', type = 'admin', intitule = 'duo_skey'"
106
+                        "UPDATE `".$pre."misc`
107
+                        set valeur = '" . SKEY."', type = 'admin', intitule = 'duo_skey'"
108 108
                     );
109 109
                 } else {
110 110
                     mysqli_query(
111 111
                         $db_link,
112
-                        "INSERT INTO `" . $pre . "misc`
112
+                        "INSERT INTO `".$pre."misc`
113 113
                         (`valeur`, `type`, `intitule`)
114
-                        VALUES ('" . SKEY . "', 'admin', 'duo_skey')"
114
+                        VALUES ('" . SKEY."', 'admin', 'duo_skey')"
115 115
                     );
116 116
                 }
117 117
 
118 118
                 // IKEY
119 119
                 $tmp = mysqli_query(
120 120
                     $db_link,
121
-                    "SELECT INTO `" . $pre . "misc`
121
+                    "SELECT INTO `".$pre."misc`
122 122
                     WHERE type = 'admin' AND intitule = 'duo_ikey'"
123 123
                 );
124 124
                 if ($tmp) {
125 125
                     mysqli_query(
126 126
                         $db_link,
127
-                        "UPDATE `" . $pre . "misc`
128
-                        set valeur = '" . IKEY . "', type = 'admin', intitule = 'duo_ikey'"
127
+                        "UPDATE `".$pre."misc`
128
+                        set valeur = '" . IKEY."', type = 'admin', intitule = 'duo_ikey'"
129 129
                     );
130 130
                 } else {
131 131
                     mysqli_query(
132 132
                         $db_link,
133
-                        "INSERT INTO `" . $pre . "misc`
133
+                        "INSERT INTO `".$pre."misc`
134 134
                         (`valeur`, `type`, `intitule`)
135
-                        VALUES ('" . IKEY . "', 'admin', 'duo_ikey')"
135
+                        VALUES ('" . IKEY."', 'admin', 'duo_ikey')"
136 136
                     );
137 137
                 }
138 138
 
139 139
                 // HOST
140 140
                 $tmp = mysqli_query(
141 141
                     $db_link,
142
-                    "SELECT INTO `" . $pre . "misc`
142
+                    "SELECT INTO `".$pre."misc`
143 143
                     WHERE type = 'admin' AND intitule = 'duo_host'"
144 144
                 );
145 145
                 if ($tmp) {
146 146
                     mysqli_query(
147 147
                         $db_link,
148
-                        "UPDATE `" . $pre . "misc`
149
-                        set valeur = '" . HOST . "', type = 'admin', intitule = 'duo_host'"
148
+                        "UPDATE `".$pre."misc`
149
+                        set valeur = '" . HOST."', type = 'admin', intitule = 'duo_host'"
150 150
                     );
151 151
                 } else {
152 152
                     mysqli_query(
153 153
                         $db_link,
154
-                        "INSERT INTO `" . $pre . "misc`
154
+                        "INSERT INTO `".$pre."misc`
155 155
                         (`valeur`, `type`, `intitule`)
156
-                        VALUES ('" . HOST . "', 'admin', 'duo_host')"
156
+                        VALUES ('" . HOST."', 'admin', 'duo_host')"
157 157
                     );
158 158
                 }
159 159
             }
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
         
170 170
         $settingsTxt = '<?php
171 171
 // DATABASE connexion parameters
172
-define("DB_HOST", "' . $server . '");
173
-define("DB_USER", "' . $user . '");
174
-define("DB_PASSWD", "' . $pass . '");
175
-define("DB_NAME", "' . $database . '");
176
-define("DB_PREFIX", "' . $pre . '");
177
-define("DB_PORT", "' . $port . '");
178
-define("DB_ENCODING", "' . $encoding . '");
172
+define("DB_HOST", "' . $server.'");
173
+define("DB_USER", "' . $user.'");
174
+define("DB_PASSWD", "' . $pass.'");
175
+define("DB_NAME", "' . $database.'");
176
+define("DB_PREFIX", "' . $pre.'");
177
+define("DB_PORT", "' . $port.'");
178
+define("DB_ENCODING", "' . $encoding.'");
179 179
 define("DB_SSL", false); // if DB over SSL then comment this line
180 180
 // if DB over SSL then uncomment the following lines
181 181
 //define("DB_SSL", array(
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 define("DB_CONNECT_OPTIONS", array(
189 189
     MYSQLI_OPT_CONNECT_TIMEOUT => 10
190 190
 ));
191
-define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");';
191
+define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH).'");';
192 192
 define("SECUREFILE", "' . SECUREFILE. '");
193 193
 
194 194
 		if (defined('IKEY') === true) $settingsTxt .= '
195
-define("IKEY", "' . IKEY . '");';
195
+define("IKEY", "' . IKEY.'");';
196 196
 		else $settingsTxt .= '
197 197
 define("IKEY", "");';
198 198
 		if (defined('SKEY') === true) $settingsTxt .= '
199
-define("SKEY", "' . SKEY . '");';
199
+define("SKEY", "' . SKEY.'");';
200 200
 		else $settingsTxt .= '
201 201
 define("SKEY", "");';
202 202
 		if (defined('HOST') === true) $settingsTxt .= '
203
-define("HOST", "' . HOST . '");';
203
+define("HOST", "' . HOST.'");';
204 204
 		else $settingsTxt .= '
205 205
 define("HOST", "");';
206 206
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                     '}]';
297 297
                     break;
298 298
                 }
299
-                if (!file_exists(SECUREPATH . '/sk.php')) {
299
+                if (!file_exists(SECUREPATH.'/sk.php')) {
300 300
                     echo '[{'.
301 301
                         '"error" : "Error in settings.php file!<br>Check correctness of path indicated in file `includes/config/settings.php`.<br>Reload this page and retry.",'.
302 302
                         '"index" : ""'.
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
             $user_info = mysqli_fetch_array(
313 313
                 mysqli_query(
314 314
                     $db_link,
315
-                    'SELECT id, pw, admin FROM ' . $pre . "users
316
-                    WHERE login='" . mysqli_escape_string($db_link, stripslashes($post_login)) . "'"
315
+                    'SELECT id, pw, admin FROM '.$pre."users
316
+                    WHERE login='" . mysqli_escape_string($db_link, stripslashes($post_login))."'"
317 317
                 )
318 318
             );
319 319
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
                     echo '[{'.
333 333
                         '"error" : "",'.
334 334
                         '"index" : 1,'.
335
-                        '"info" : "' . base64_encode(json_encode(
335
+                        '"info" : "'.base64_encode(json_encode(
336 336
                             array(mysqli_escape_string($db_link, stripslashes($post_login)), $post_pwd, $user_info['id'])
337
-                        )) . '"'.
337
+                        )).'"'.
338 338
                     '}]';
339 339
                 } else {
340 340
                     $superGlobal->put('user_granted', false, 'SESSION');
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
             $txt = '';
368 368
             $var_x = 1;
369 369
             $tab = array(
370
-                $abspath . '/includes/config/settings.php',
371
-                $abspath . '/includes/libraries/csrfp/libs/',
372
-                $abspath . '/install/',
373
-                $abspath . '/includes/',
374
-                $abspath . '/includes/config/',
375
-                $abspath . '/includes/avatars/',
376
-                $abspath . '/files/',
377
-                $abspath . '/upload/',
370
+                $abspath.'/includes/config/settings.php',
371
+                $abspath.'/includes/libraries/csrfp/libs/',
372
+                $abspath.'/install/',
373
+                $abspath.'/includes/',
374
+                $abspath.'/includes/config/',
375
+                $abspath.'/includes/avatars/',
376
+                $abspath.'/files/',
377
+                $abspath.'/upload/',
378 378
             );
379 379
             foreach ($tab as $elem) {
380 380
                 // try to create it if not existing
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
                 }
384 384
                 // check if writable
385 385
                 if (is_writable($elem)) {
386
-                    $txt .= '<span>' .
387
-                        $elem . '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
386
+                    $txt .= '<span>'.
387
+                        $elem.'<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
388 388
                 } else {
389
-                    $txt .= '<span>' .
390
-                        $elem . '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
389
+                    $txt .= '<span>'.
390
+                        $elem.'<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
391 391
                     $okWritable = false;
392 392
                 }
393 393
                 ++$var_x;
@@ -395,105 +395,105 @@  discard block
 block discarded – undo
395 395
 
396 396
             if (!extension_loaded('openssl')) {
397 397
                 //$okExtensions = false;
398
-                $txt .= '<span>PHP extension \"openssl\"' .
398
+                $txt .= '<span>PHP extension \"openssl\"'.
399 399
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
400 400
             } else {
401
-                $txt .= '<span>PHP extension \"openssl\"' .
401
+                $txt .= '<span>PHP extension \"openssl\"'.
402 402
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
403 403
             }
404 404
             if (!extension_loaded('gd')) {
405 405
                 //$okExtensions = false;
406
-                $txt .= '<span>PHP extension \"gd\"' .
406
+                $txt .= '<span>PHP extension \"gd\"'.
407 407
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
408 408
             } else {
409
-                $txt .= '<span>PHP extension \"gd\"' .
409
+                $txt .= '<span>PHP extension \"gd\"'.
410 410
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
411 411
             }
412 412
             if (!extension_loaded('mbstring')) {
413 413
                 //$okExtensions = false;
414
-                $txt .= '<span>PHP extension \"mbstring\"' .
414
+                $txt .= '<span>PHP extension \"mbstring\"'.
415 415
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
416 416
             } else {
417
-                $txt .= '<span>PHP extension \"mbstring\"' .
417
+                $txt .= '<span>PHP extension \"mbstring\"'.
418 418
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
419 419
             }
420 420
             if (!extension_loaded('bcmath')) {
421 421
                 //$okExtensions = false;
422
-                $txt .= '<span>PHP extension \"bcmath\"' .
422
+                $txt .= '<span>PHP extension \"bcmath\"'.
423 423
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
424 424
             } else {
425
-                $txt .= '<span>PHP extension \"bcmath\"' .
425
+                $txt .= '<span>PHP extension \"bcmath\"'.
426 426
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
427 427
             }
428 428
             if (!extension_loaded('iconv')) {
429 429
                 //$okExtensions = false;
430
-                $txt .= '<span>PHP extension \"iconv\"' .
430
+                $txt .= '<span>PHP extension \"iconv\"'.
431 431
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
432 432
             } else {
433
-                $txt .= '<span>PHP extension \"iconv\"' .
433
+                $txt .= '<span>PHP extension \"iconv\"'.
434 434
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
435 435
             }
436 436
             if (!extension_loaded('xml')) {
437 437
                 //$okExtensions = false;
438
-                $txt .= '<span>PHP extension \"xml\"' .
438
+                $txt .= '<span>PHP extension \"xml\"'.
439 439
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
440 440
             } else {
441
-                $txt .= '<span>PHP extension \"xml\"' .
441
+                $txt .= '<span>PHP extension \"xml\"'.
442 442
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
443 443
             }
444 444
             if (!extension_loaded('curl')) {
445
-                $txt .= '<span>PHP extension \"curl\"' .
445
+                $txt .= '<span>PHP extension \"curl\"'.
446 446
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
447 447
             } else {
448
-                $txt .= '<span>PHP extension \"curl\"' .
448
+                $txt .= '<span>PHP extension \"curl\"'.
449 449
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
450 450
             }
451 451
             if (!extension_loaded('gmp')) {
452
-                $txt .= '<span>PHP extension \"gmp\"' .
452
+                $txt .= '<span>PHP extension \"gmp\"'.
453 453
                     '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />';
454 454
             } else {
455
-                $txt .= '<span>PHP extension \"gmp\"' .
455
+                $txt .= '<span>PHP extension \"gmp\"'.
456 456
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
457 457
             }
458 458
             if (ini_get('max_execution_time') < 30) {
459
-                $txt .= '<span>PHP \"Maximum ' .
460
-                    'execution time\" is set to ' . ini_get('max_execution_time') . ' seconds.' .
461
-                    ' Please try to set to 60s at least until Upgrade is finished.&nbsp;' .
459
+                $txt .= '<span>PHP \"Maximum '.
460
+                    'execution time\" is set to '.ini_get('max_execution_time').' seconds.'.
461
+                    ' Please try to set to 60s at least until Upgrade is finished.&nbsp;'.
462 462
                     '&nbsp;<img src=\"images/minus-circle.png\"></span> <br />';
463 463
             } else {
464
-                $txt .= '<span>PHP \"Maximum ' .
465
-                    'execution time\" is set to ' . ini_get('max_execution_time') . ' seconds' .
464
+                $txt .= '<span>PHP \"Maximum '.
465
+                    'execution time\" is set to '.ini_get('max_execution_time').' seconds'.
466 466
                     '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />';
467 467
             }
468 468
             if (version_compare(phpversion(), MIN_PHP_VERSION, '<')) {
469
-                $txt .= '<span>PHP version ' .
470
-                    phpversion() . ' is not OK (minimum is '.MIN_PHP_VERSION.') &nbsp;&nbsp;' .
469
+                $txt .= '<span>PHP version '.
470
+                    phpversion().' is not OK (minimum is '.MIN_PHP_VERSION.') &nbsp;&nbsp;'.
471 471
                     '<img src=\"images/minus-circle.png\"></span><br />';
472 472
             } else {
473
-                $txt .= '<span>PHP version ' .
474
-                    phpversion() . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' .
473
+                $txt .= '<span>PHP version '.
474
+                    phpversion().' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'.
475 475
                     '</span><br />';
476 476
             }
477
-            $mysqlVersion = version_compare($db_link -> server_version, MIN_MYSQL_VERSION, '<') ;
478
-            $mariadbVersion = version_compare($db_link -> server_version, MIN_MARIADB_VERSION, '<') ;
477
+            $mysqlVersion = version_compare($db_link -> server_version, MIN_MYSQL_VERSION, '<');
478
+            $mariadbVersion = version_compare($db_link -> server_version, MIN_MARIADB_VERSION, '<');
479 479
             if ($mysqlVersion && $mariadbVersion) {
480 480
                 if ($mariadbVersion === '') {
481
-                    $txt .= '<span>MySQL version ' .
482
-                        $db_link -> server_version . ' is not OK (minimum is '.MIN_MYSQL_VERSION.') &nbsp;&nbsp;' .
481
+                    $txt .= '<span>MySQL version '.
482
+                        $db_link -> server_version.' is not OK (minimum is '.MIN_MYSQL_VERSION.') &nbsp;&nbsp;'.
483 483
                         '<img src=\"images/minus-circle.png\"></span><br />';
484 484
                 } else {
485
-                    $txt .= '<span>MySQL version ' .
486
-                        $db_link -> server_version . ' is not OK (minimum is '.MIN_MARIADB_VERSION.') &nbsp;&nbsp;' .
485
+                    $txt .= '<span>MySQL version '.
486
+                        $db_link -> server_version.' is not OK (minimum is '.MIN_MARIADB_VERSION.') &nbsp;&nbsp;'.
487 487
                         '<img src=\"images/minus-circle.png\"></span><br />';
488 488
                 }
489 489
             } else {
490 490
                 if ($mariadbVersion === '') {
491
-                    $txt .= '<span>MySQL version ' .
492
-                        $db_link -> server_info . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' .
491
+                    $txt .= '<span>MySQL version '.
492
+                        $db_link -> server_info.' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'.
493 493
                         '</span><br />';
494 494
                 } else {
495
-                    $txt .= '<span>MySQL version ' .
496
-                        $db_link -> server_info . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' .
495
+                    $txt .= '<span>MySQL version '.
496
+                        $db_link -> server_info.' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'.
497 497
                         '</span><br />';
498 498
                 }
499 499
                 
@@ -503,22 +503,22 @@  discard block
 block discarded – undo
503 503
             // check if 2.1.27 already installed
504 504
             if (defined(SECUREPATH) === true) {
505 505
                 $okEncryptKey = false;
506
-                $defuse_file = SECUREPATH . '/teampass-seckey.txt';
506
+                $defuse_file = SECUREPATH.'/teampass-seckey.txt';
507 507
                 if (file_exists($defuse_file)) {
508 508
                     $okEncryptKey = true;
509 509
                     $superGlobal->put('tp_defuse_installed', true, 'SESSION');
510
-                    $txt .= '<span>Defuse encryption key is defined<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' .
510
+                    $txt .= '<span>Defuse encryption key is defined<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'.
511 511
                         '</span><br />';
512 512
                 }
513 513
 
514 514
                 if ($okEncryptKey === false) {
515 515
                     $superGlobal->put('tp_defuse_installed', false, 'SESSION');
516
-                    $txt .= '<span>Encryption Key (SALT) ' .
517
-                        ' could not be recovered from ' . $defuse_file . '&nbsp;&nbsp;' .
516
+                    $txt .= '<span>Encryption Key (SALT) '.
517
+                        ' could not be recovered from '.$defuse_file.'&nbsp;&nbsp;'.
518 518
                         '<img src=\"images/minus-circle.png\"></span><br />';
519 519
                 } else {
520 520
                     $okEncryptKey = true;
521
-                    $txt .= '<span>Encryption Key (SALT) is available<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' .
521
+                    $txt .= '<span>Encryption Key (SALT) is available<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'.
522 522
                         '</span><br />';
523 523
                 }
524 524
             } else {
@@ -534,10 +534,10 @@  discard block
 block discarded – undo
534 534
             }
535 535
 
536 536
             echo '[{'.
537
-                '"error" : "' . $error . '",'.
538
-                '"info" : "' . $txt . '",'.
537
+                '"error" : "'.$error.'",'.
538
+                '"info" : "'.$txt.'",'.
539 539
                 '"index" : "'.($error === "" ? "" : $nextStep).'",'.
540
-                '"infos" : "' . $okWritable." ; ".$okExtensions." ; ".$okEncryptKey." ; " . '"'.
540
+                '"infos" : "'.$okWritable." ; ".$okExtensions." ; ".$okEncryptKey." ; ".'"'.
541 541
             '}]';
542 542
             break;
543 543
 
@@ -562,14 +562,14 @@  discard block
 block discarded – undo
562 562
             if (@mysqli_fetch_row(
563 563
                 mysqli_query(
564 564
                     $db_link,
565
-                    'SELECT valeur FROM ' . $pre . "misc
565
+                    'SELECT valeur FROM '.$pre."misc
566 566
                     WHERE type='admin' AND intitule = 'utf8_enabled'"
567 567
                 )
568 568
             )) {
569 569
                 $cpmIsUTF8 = mysqli_fetch_row(
570 570
                     mysqli_query(
571 571
                         $db_link,
572
-                        'SELECT valeur FROM ' . $pre . "misc
572
+                        'SELECT valeur FROM '.$pre."misc
573 573
                         WHERE type='admin' AND intitule = 'utf8_enabled'"
574 574
                     )
575 575
                 );
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
             // put TP in maintenance mode or not
580 580
             @mysqli_query(
581 581
                 $db_link,
582
-                "UPDATE `" . $pre . "misc`
582
+                "UPDATE `".$pre."misc`
583 583
                 SET `valeur` = 'maintenance_mode'
584
-                WHERE type = 'admin' AND intitule = '" . $post_no_maintenance_mode . "'"
584
+                WHERE type = 'admin' AND intitule = '" . $post_no_maintenance_mode."'"
585 585
             );
586 586
 
587 587
             echo '[{'.
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
             if (isset($post_prefix_before_convert) && $post_prefix_before_convert == 'true') {
609 609
                 $tables = mysqli_query($db_link, 'SHOW TABLES');
610 610
                 while ($table = mysqli_fetch_row($tables)) {
611
-                    if (tableExists('old_' . $table[0]) != 1 && substr($table[0], 0, 4) != 'old_') {
612
-                        mysqli_query($db_link, 'CREATE TABLE old_' . $table[0] . ' LIKE ' . $table[0]);
613
-                        mysqli_query($db_link, 'INSERT INTO old_' . $table[0] . ' SELECT * FROM ' . $table[0]);
611
+                    if (tableExists('old_'.$table[0]) != 1 && substr($table[0], 0, 4) != 'old_') {
612
+                        mysqli_query($db_link, 'CREATE TABLE old_'.$table[0].' LIKE '.$table[0]);
613
+                        mysqli_query($db_link, 'INSERT INTO old_'.$table[0].' SELECT * FROM '.$table[0]);
614 614
                     }
615 615
                 }
616 616
             }
@@ -618,22 +618,22 @@  discard block
 block discarded – undo
618 618
             //convert database
619 619
             mysqli_query(
620 620
                 $db_link,
621
-                'ALTER DATABASE `' . $database . '`
621
+                'ALTER DATABASE `'.$database.'`
622 622
                 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'
623 623
             );
624 624
 
625 625
             //convert tables
626
-            $res = mysqli_query($db_link, 'SHOW TABLES FROM `' . $database . '`');
626
+            $res = mysqli_query($db_link, 'SHOW TABLES FROM `'.$database.'`');
627 627
             while ($table = mysqli_fetch_row($res)) {
628 628
                 if (substr($table[0], 0, 4) != 'old_') {
629 629
                     mysqli_query(
630 630
                         $db_link,
631
-                        'ALTER TABLE ' . $database . '.`{$table[0]}`
631
+                        'ALTER TABLE '.$database.'.`{$table[0]}`
632 632
                         CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'
633 633
                     );
634 634
                     mysqli_query(
635 635
                         $db_link,
636
-                        'ALTER TABLE' . $database . '.`{$table[0]}`
636
+                        'ALTER TABLE'.$database.'.`{$table[0]}`
637 637
                         DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'
638 638
                     );
639 639
                 }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
                 //Do a copy of the existing file
671 671
                 if (!copy(
672 672
                     $settingsFile,
673
-                    $settingsFile . '.' . date(
673
+                    $settingsFile.'.'.date(
674 674
                         'Y_m_d_H_i_s',
675 675
                         mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y'))
676 676
                     )
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                 // CHeck if old sk.php exists.
688 688
                 // If yes then get keys to database and delete it
689 689
                 if (empty($post_sk_path) === false || defined('SECUREPATH') === true) {
690
-                    $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH) . '/sk.php';
690
+                    $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/sk.php';
691 691
                     if (file_exists($filename)) {
692 692
                         include_once $filename;
693 693
                         unlink($filename);
@@ -696,63 +696,63 @@  discard block
 block discarded – undo
696 696
                         // SKEY
697 697
                         $tmp = mysqli_query(
698 698
                             $db_link,
699
-                            "SELECT INTO `" . $pre . "misc`
699
+                            "SELECT INTO `".$pre."misc`
700 700
                             WHERE type = 'admin' AND intitule = 'duo_skey'"
701 701
                         );
702 702
                         if ($tmp) {
703 703
                             mysqli_query(
704 704
                                 $db_link,
705
-                                "UPDATE `" . $pre . "misc`
706
-                                set valeur = '" . SKEY . "', type = 'admin', intitule = 'duo_skey'"
705
+                                "UPDATE `".$pre."misc`
706
+                                set valeur = '" . SKEY."', type = 'admin', intitule = 'duo_skey'"
707 707
                             );
708 708
                         } else {
709 709
                             mysqli_query(
710 710
                                 $db_link,
711
-                                "INSERT INTO `" . $pre . "misc`
711
+                                "INSERT INTO `".$pre."misc`
712 712
                                 (`valeur`, `type`, `intitule`)
713
-                                VALUES ('" . SKEY . "', 'admin', 'duo_skey')"
713
+                                VALUES ('" . SKEY."', 'admin', 'duo_skey')"
714 714
                             );
715 715
                         }
716 716
 
717 717
                         // IKEY
718 718
                         $tmp = mysqli_query(
719 719
                             $db_link,
720
-                            "SELECT INTO `" . $pre . "misc`
720
+                            "SELECT INTO `".$pre."misc`
721 721
                             WHERE type = 'admin' AND intitule = 'duo_ikey'"
722 722
                         );
723 723
                         if ($tmp) {
724 724
                             mysqli_query(
725 725
                                 $db_link,
726
-                                "UPDATE `" . $pre . "misc`
727
-                                set valeur = '" . IKEY . "', type = 'admin', intitule = 'duo_ikey'"
726
+                                "UPDATE `".$pre."misc`
727
+                                set valeur = '" . IKEY."', type = 'admin', intitule = 'duo_ikey'"
728 728
                             );
729 729
                         } else {
730 730
                             mysqli_query(
731 731
                                 $db_link,
732
-                                "INSERT INTO `" . $pre . "misc`
732
+                                "INSERT INTO `".$pre."misc`
733 733
                                 (`valeur`, `type`, `intitule`)
734
-                                VALUES ('" . IKEY . "', 'admin', 'duo_ikey')"
734
+                                VALUES ('" . IKEY."', 'admin', 'duo_ikey')"
735 735
                             );
736 736
                         }
737 737
 
738 738
                         // HOST
739 739
                         $tmp = mysqli_query(
740 740
                             $db_link,
741
-                            "SELECT INTO `" . $pre . "misc`
741
+                            "SELECT INTO `".$pre."misc`
742 742
                             WHERE type = 'admin' AND intitule = 'duo_host'"
743 743
                         );
744 744
                         if ($tmp) {
745 745
                             mysqli_query(
746 746
                                 $db_link,
747
-                                "UPDATE `" . $pre . "misc`
748
-                                set valeur = '" . HOST . "', type = 'admin', intitule = 'duo_host'"
747
+                                "UPDATE `".$pre."misc`
748
+                                set valeur = '" . HOST."', type = 'admin', intitule = 'duo_host'"
749 749
                             );
750 750
                         } else {
751 751
                             mysqli_query(
752 752
                                 $db_link,
753
-                                "INSERT INTO `" . $pre . "misc`
753
+                                "INSERT INTO `".$pre."misc`
754 754
                                 (`valeur`, `type`, `intitule`)
755
-                                VALUES ('" . HOST . "', 'admin', 'duo_host')"
755
+                                VALUES ('" . HOST."', 'admin', 'duo_host')"
756 756
                             );
757 757
                         }
758 758
                     }
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
                     utf8_encode(
772 772
                         '<?php
773 773
     // DATABASE connexion parameters
774
-    define("DB_HOST", "' . DB_HOST . '");
775
-    define("DB_USER", "' . DB_USER . '");
776
-    define("DB_PASSWD", "' . defuse_return_decrypted(DB_PASSWD) . '");
777
-    define("DB_NAME", "' . DB_NAME . '");
778
-    define("DB_PREFIX", "' . DB_PREFIX . '");
779
-    define("DB_PORT", "' . DB_PORT . '");
780
-    define("DB_ENCODING", "' . DB_ENCODING . '");
774
+    define("DB_HOST", "' . DB_HOST.'");
775
+    define("DB_USER", "' . DB_USER.'");
776
+    define("DB_PASSWD", "' . defuse_return_decrypted(DB_PASSWD).'");
777
+    define("DB_NAME", "' . DB_NAME.'");
778
+    define("DB_PREFIX", "' . DB_PREFIX.'");
779
+    define("DB_PORT", "' . DB_PORT.'");
780
+    define("DB_ENCODING", "' . DB_ENCODING.'");
781 781
     define("DB_SSL", false); // if DB over SSL then comment this line
782 782
     // if DB over SSL then uncomment the following lines
783 783
     //define("DB_SSL", array(
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
     define("DB_CONNECT_OPTIONS", array(
791 791
         MYSQLI_OPT_CONNECT_TIMEOUT => 10
792 792
     ));
793
-    define("SECUREPATH", "' . SECUREPATH. '");
793
+    define("SECUREPATH", "' . SECUREPATH.'");
794 794
 
795 795
     if (isset($_SESSION[\'settings\'][\'timezone\']) === true) {
796 796
     date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']);
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
                     if (
886 886
                         copy(
887 887
                             $csrfp_file,
888
-                            $csrfp_file . '.' . date(
888
+                            $csrfp_file.'.'.date(
889 889
                                 'Y_m_d_H_i_s',
890 890
                                 mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y'))
891 891
                             )
@@ -904,17 +904,17 @@  discard block
 block discarded – undo
904 904
                 unlink($csrfp_file); // delete existing csrfp.config file
905 905
                 copy($csrfp_file_sample, $csrfp_file); // make a copy of csrfp.config.sample file
906 906
                 $data = file_get_contents('../includes/libraries/csrfp/libs/csrfp.config.php');
907
-                $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "' . bin2hex(openssl_random_pseudo_bytes(25)) . '"', $data);
907
+                $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "'.bin2hex(openssl_random_pseudo_bytes(25)).'"', $data);
908 908
                 $newdata = str_replace('"tokenLength" => "25"', '"tokenLength" => "50"', $newdata);
909
-                $jsUrl = $post_url_path . '/includes/libraries/csrfp/js/csrfprotector.js';
910
-                $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "' . $jsUrl . '"', $newdata);
909
+                $jsUrl = $post_url_path.'/includes/libraries/csrfp/js/csrfprotector.js';
910
+                $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "'.$jsUrl.'"', $newdata);
911 911
                 $newdata = str_replace('"verifyGetFor" => array()', '"verifyGetFor" => array("*page=items&type=duo_check*")', $newdata);
912 912
                 file_put_contents('../includes/libraries/csrfp/libs/csrfp.config.php', $newdata);
913 913
 
914 914
                 // Mark a tag to force Install stuff (folders, files and table) to be cleanup while first login
915 915
                 mysqli_query(
916 916
                     $db_link,
917
-                    'INSERT INTO `' . $pre . 'misc` (`type`, `intitule`, `valeur`) VALUES ("install", "clear_install_folder", "true")'
917
+                    'INSERT INTO `'.$pre.'misc` (`type`, `intitule`, `valeur`) VALUES ("install", "clear_install_folder", "true")'
918 918
                 );
919 919
 
920 920
                 array_push(
@@ -936,19 +936,19 @@  discard block
 block discarded – undo
936 936
 
937 937
             // update with correct version
938 938
             // 1st - check if teampass_version exists
939
-            $data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre . "misc WHERE type = 'admin' AND intitule = 'teampass_version';"));
939
+            $data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre."misc WHERE type = 'admin' AND intitule = 'teampass_version';"));
940 940
             if ((int) $data[0] === 0) {
941 941
                 // change variable name and put version
942 942
                 mysqli_query(
943 943
                     $db_link,
944
-                    "UPDATE `" . $pre . "misc`
944
+                    "UPDATE `".$pre."misc`
945 945
                     SET `valeur` = '".TP_VERSION."', `intitule` = 'teampass_version'
946 946
                     WHERE intitule = 'cpassman_version' AND type = 'admin';"
947 947
                 );
948 948
             } else {
949 949
                 mysqli_query(
950 950
                     $db_link,
951
-                    "UPDATE `" . $pre . "misc`
951
+                    "UPDATE `".$pre."misc`
952 952
                     SET `valeur` = '".TP_VERSION."'
953 953
                     WHERE intitule = 'teampass_version' AND type = 'admin';"
954 954
                 );
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
                             ->setDayOfMonth('*')
979 979
                             ->setMonths('*')
980 980
                             ->setDayOfWeek('*')
981
-                            ->setTaskCommandLine($phpLocation['path'] . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php')
981
+                            ->setTaskCommandLine($phpLocation['path'].' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php')
982 982
                             ->setComments('Teampass scheduler');
983 983
                         
984 984
                         $crontabRepository->addJob($crontabJob);
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
             $mysqli = new mysqli($server, $user, $pass, $database, $port);
1036 1036
             if ($mysqli->connect_error) {
1037
-                die('Error : (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
1037
+                die('Error : ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
1038 1038
             }
1039 1039
 
1040 1040
             $results = $mysqli->query('SHOW TABLES');
@@ -1044,11 +1044,11 @@  discard block
 block discarded – undo
1044 1044
             }
1045 1045
 
1046 1046
             // Prepare file
1047
-            $backup_file_name = 'sql-backup-' . date('d-m-Y--h-i-s') . '.sql';
1048
-            $fp = fopen('../files/' . $backup_file_name, 'a');
1047
+            $backup_file_name = 'sql-backup-'.date('d-m-Y--h-i-s').'.sql';
1048
+            $fp = fopen('../files/'.$backup_file_name, 'a');
1049 1049
 
1050 1050
             foreach ($mtables as $table) {
1051
-                $contents = '-- Table `' . $table . "` --\n";
1051
+                $contents = '-- Table `'.$table."` --\n";
1052 1052
                 if (fwrite($fp, $contents) === false) {
1053 1053
                     echo '[{'.
1054 1054
                         '"error" : "Backup fails - please do it manually",'.
@@ -1058,9 +1058,9 @@  discard block
 block discarded – undo
1058 1058
                     return false;
1059 1059
                 }
1060 1060
 
1061
-                $results = $mysqli->query('SHOW CREATE TABLE ' . $table);
1061
+                $results = $mysqli->query('SHOW CREATE TABLE '.$table);
1062 1062
                 while ($row = $results->fetch_array()) {
1063
-                    $contents = $row[1] . ";\n\n";
1063
+                    $contents = $row[1].";\n\n";
1064 1064
                     if (fwrite($fp, $contents) === false) {
1065 1065
                         echo '[{'.
1066 1066
                             '"error" : "Backup fails - please do it manually",'.
@@ -1071,14 +1071,14 @@  discard block
 block discarded – undo
1071 1071
                     }
1072 1072
                 }
1073 1073
 
1074
-                $results = $mysqli->query('SELECT * FROM ' . $table);
1074
+                $results = $mysqli->query('SELECT * FROM '.$table);
1075 1075
                 $row_count = $results->num_rows;
1076 1076
                 $fields = $results->fetch_fields();
1077 1077
                 $fields_count = count($fields);
1078 1078
 
1079
-                $insert_head = 'INSERT INTO `' . $table . '` (';
1079
+                $insert_head = 'INSERT INTO `'.$table.'` (';
1080 1080
                 for ($i = 0; $i < $fields_count; ++$i) {
1081
-                    $insert_head .= '`' . $fields[$i]->name . '`';
1081
+                    $insert_head .= '`'.$fields[$i]->name.'`';
1082 1082
                     if ($i < $fields_count - 1) {
1083 1083
                         $insert_head .= ', ';
1084 1084
                     }
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
                                     break;
1128 1128
                                 default:
1129 1129
                                     //$contents .= "'".$row_content."'";
1130
-                                    if (fwrite($fp, "'" . $row_content . "'") === false) {
1130
+                                    if (fwrite($fp, "'".$row_content."'") === false) {
1131 1131
                                         echo '[{'.
1132 1132
                                             '"error" : "Backup fails - please do it manually",'.
1133 1133
                                             '"index" : ""'.
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -191,18 +191,27 @@
 block discarded – undo
191 191
 define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");';
192 192
 define("SECUREFILE", "' . SECUREFILE. '");
193 193
 
194
-		if (defined('IKEY') === true) $settingsTxt .= '
194
+		if (defined('IKEY') === true) {
195
+		    $settingsTxt .= '
195 196
 define("IKEY", "' . IKEY . '");';
196
-		else $settingsTxt .= '
197
+		} else {
198
+		    $settingsTxt .= '
197 199
 define("IKEY", "");';
198
-		if (defined('SKEY') === true) $settingsTxt .= '
200
+		}
201
+		if (defined('SKEY') === true) {
202
+		    $settingsTxt .= '
199 203
 define("SKEY", "' . SKEY . '");';
200
-		else $settingsTxt .= '
204
+		} else {
205
+		    $settingsTxt .= '
201 206
 define("SKEY", "");';
202
-		if (defined('HOST') === true) $settingsTxt .= '
207
+		}
208
+		if (defined('HOST') === true) {
209
+		    $settingsTxt .= '
203 210
 define("HOST", "' . HOST . '");';
204
-		else $settingsTxt .= '
211
+		} else {
212
+		    $settingsTxt .= '
205 213
 define("HOST", "");';
214
+		}
206 215
 
207 216
 
208 217
         $settingsTxt .= '
Please login to merge, or discard this patch.
install--ASUPPRIMER/upgrade_operations.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
         $port
82 82
     );
83 83
 } else {
84
-    $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error());
85
-    echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]';
84
+    $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error());
85
+    echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]';
86 86
     mysqli_close($db_link);
87 87
     exit();
88 88
 }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             // OPERATION - 20231017_1 - remove all existing keys
148 148
             // if item is personal and user is not owner
149 149
 
150
-            installPurgeUnnecessaryKeys(true, 0,$pre);
150
+            installPurgeUnnecessaryKeys(true, 0, $pre);
151 151
     }
152 152
     // Return back
153 153
     echo '[{"finish":"'.$finish.'" , "next":"", "error":"", "total":"'.$total.'"}]';
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
     $items = mysqli_query(
162 162
         $db_link,
163 163
         "select i.id as id, ls.date as datetime
164
-        from `" . $pre . "items` as i
165
-        inner join `" . $pre . "log_items` as ls on ls.id_item = i.id
164
+        from `" . $pre."items` as i
165
+        inner join `" . $pre."log_items` as ls on ls.id_item = i.id
166 166
         WHERE ls.action = 'at_creation' AND i.created_at IS NULL
167 167
         LIMIT " . $post_nb.";"
168 168
     );
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             // update created_at field
172 172
             mysqli_query(
173 173
                 $db_link,
174
-                "UPDATE `" . $pre . "items` SET created_at = '".$item['datetime']."' WHERE id = ".$item['id']
174
+                "UPDATE `".$pre."items` SET created_at = '".$item['datetime']."' WHERE id = ".$item['id']
175 175
             );
176 176
         }
177 177
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     $remainingItems = mysqli_num_rows(
181 181
         mysqli_query(
182 182
             $db_link,
183
-            "SELECT * FROM `" . $pre . "items` WHERE created_at IS NULL"
183
+            "SELECT * FROM `".$pre."items` WHERE created_at IS NULL"
184 184
         )
185 185
     );
186 186
     return $remainingItems > 0 ? 0 : 1;
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
     // loop on items - updated_at
193 193
     $items = mysqli_query(
194 194
         $db_link,
195
-        "select i.id as id, (select date from " . $pre . "log_items where action = 'at_modification' and id_item=id order by date DESC limit 1) as datetime 
196
-        from `" . $pre . "items` as i;"
195
+        "select i.id as id, (select date from ".$pre."log_items where action = 'at_modification' and id_item=id order by date DESC limit 1) as datetime 
196
+        from `" . $pre."items` as i;"
197 197
     );
198 198
     while ($item = mysqli_fetch_assoc($items)) {
199 199
         if (is_null($item['datetime']) === false) {
200 200
             // update updated_at field
201 201
             mysqli_query(
202 202
                 $db_link,
203
-                "UPDATE `" . $pre . "items` SET updated_at = '".$item['datetime']."' WHERE id = ".$item['id']
203
+                "UPDATE `".$pre."items` SET updated_at = '".$item['datetime']."' WHERE id = ".$item['id']
204 204
             );
205 205
         }
206 206
     }
@@ -214,15 +214,15 @@  discard block
 block discarded – undo
214 214
     // loop on items - deleted_at
215 215
     $items = mysqli_query(
216 216
         $db_link,
217
-        "select i.id as id, (select date from " . $pre . "log_items where action = 'at_deleted' and id_item=id order by date DESC limit 1) as datetime
218
-        from `" . $pre . "items` as i;"
217
+        "select i.id as id, (select date from ".$pre."log_items where action = 'at_deleted' and id_item=id order by date DESC limit 1) as datetime
218
+        from `" . $pre."items` as i;"
219 219
     );
220 220
     while ($item = mysqli_fetch_assoc($items)) {
221 221
         if (is_null($item['datetime']) === false) {
222 222
             // update updated_at field
223 223
             mysqli_query(
224 224
                 $db_link,
225
-                "UPDATE `" . $pre . "items` SET deleted_at = '".$item['datetime']."' WHERE id = ".$item['id']
225
+                "UPDATE `".$pre."items` SET deleted_at = '".$item['datetime']."' WHERE id = ".$item['id']
226 226
             );
227 227
         }
228 228
     }
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
  * @param integer $user_id
239 239
  * @return void
240 240
  */
241
-function installPurgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0, string $pre)
241
+function installPurgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0, string $pre)
242 242
 {
243 243
     global $db_link;
244 244
     if ($allUsers === true) {
245 245
         $users = mysqli_query(
246 246
             $db_link,
247 247
             'SELECT id
248
-            FROM ' . $pre . 'users
248
+            FROM ' . $pre.'users
249 249
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
250 250
             ORDER BY login ASC'
251 251
         );
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
  * @param integer $user_id
264 264
  * @return void
265 265
  */
266
-function installPurgeUnnecessaryKeysForUser(int $user_id=0, string $pre)
266
+function installPurgeUnnecessaryKeysForUser(int $user_id = 0, string $pre)
267 267
 {
268 268
     global $db_link;
269 269
     if ($user_id === 0) {
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
     $result = mysqli_query(
274 274
         $db_link,
275 275
         'SELECT id
276
-        FROM ' . $pre . 'items AS i
277
-        INNER JOIN ' . $pre . 'log_items AS li ON li.id_item = i.id
276
+        FROM ' . $pre.'items AS i
277
+        INNER JOIN ' . $pre.'log_items AS li ON li.id_item = i.id
278 278
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN ('.TP_USER_ID.', '.$user_id.')',
279 279
     );
280 280
     $rowcount = mysqli_num_rows($result);
@@ -290,25 +290,25 @@  discard block
 block discarded – undo
290 290
         // Item keys
291 291
         mysqli_query(
292 292
             $db_link,
293
-            'DELETE FROM ' . $pre . 'sharekeys_items
293
+            'DELETE FROM '.$pre.'sharekeys_items
294 294
             WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')'
295 295
         );
296 296
         // Files keys
297 297
         mysqli_query(
298 298
             $db_link,
299
-            'DELETE FROM ' . $pre . 'sharekeys_files
299
+            'DELETE FROM '.$pre.'sharekeys_files
300 300
             WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')'
301 301
         );
302 302
         // Fields keys
303 303
         mysqli_query(
304 304
             $db_link,
305
-            'DELETE FROM ' . $pre . 'sharekeys_fields
305
+            'DELETE FROM '.$pre.'sharekeys_fields
306 306
             WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')'
307 307
         );
308 308
         // Logs keys
309 309
         mysqli_query(
310 310
             $db_link,
311
-            'DELETE FROM ' . $pre . 'sharekeys_logs
311
+            'DELETE FROM '.$pre.'sharekeys_logs
312 312
             WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')'
313 313
         );
314 314
     }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     // force full list of folders
341 341
     if (count($folderIds) === 0) {
342 342
         $result = $mysqli2->query('SELECT id
343
-            FROM ' . $pre . 'nested_tree
343
+            FROM ' . $pre.'nested_tree
344 344
             WHERE personal_folder = 0',
345 345
         );
346 346
         $rowcount = $result->num_rows;
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
         $arrCatList = array();
362 362
         $result = $mysqli2->query('SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
363 363
             f.id_category AS category_id
364
-            FROM ' . $pre . 'categories_folders AS f
365
-            INNER JOIN ' . $pre . 'categories AS c ON (f.id_category = c.parent_id)
364
+            FROM ' . $pre.'categories_folders AS f
365
+            INNER JOIN ' . $pre.'categories AS c ON (f.id_category = c.parent_id)
366 366
             WHERE id_folder = '.$folder
367 367
         );
368 368
         $rowcount = $result->num_rows;
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
         // Now get complexity
388 388
         $valTemp = '';
389 389
         $result = $mysqli2->query('SELECT valeur
390
-            FROM ' . $pre . 'misc
390
+            FROM ' . $pre.'misc
391 391
             WHERE type = "complex" AND intitule = '.$folder
392 392
         );
393 393
         $rowcount = $result->num_rows;
@@ -404,21 +404,21 @@  discard block
 block discarded – undo
404 404
         // Now get Roles
405 405
         $valTemp = '';
406 406
         $result = $mysqli2->query('SELECT t.title
407
-            FROM ' . $pre . 'roles_values as v
408
-            INNER JOIN ' . $pre . 'roles_title as t ON (v.role_id = t.id)
407
+            FROM ' . $pre.'roles_values as v
408
+            INNER JOIN ' . $pre.'roles_title as t ON (v.role_id = t.id)
409 409
             WHERE v.folder_id = '.$folder.'
410 410
             GROUP BY title'
411 411
         );
412 412
         $rowcount = $result->num_rows;
413 413
         if ($rowcount > 0) {
414 414
             while ($row = $result->fetch_assoc()) {
415
-                $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $row['title'];
415
+                $valTemp .= (empty($valTemp) === true ? '' : ' - ').$row['title'];
416 416
             }
417 417
         }
418 418
         $arr_data['visibilityRoles'] = $valTemp;
419 419
 
420 420
         // now save in DB
421
-        $mysqli2->query("UPDATE " . $pre . "nested_tree SET categories = '".json_encode($arr_data)."' WHERE id = ".$folder);
421
+        $mysqli2->query("UPDATE ".$pre."nested_tree SET categories = '".json_encode($arr_data)."' WHERE id = ".$folder);
422 422
     }
423 423
     
424 424
     mysqli_close($mysqli2);
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
  */
438 438
 function installHandleConfigFile($action, $SETTINGS, $field = null, $value = null)
439 439
 {
440
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
440
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
441 441
     $filename = '../includes/config/settings.php';
442 442
     include_once '../sources/main.functions.php';
443 443
     $pass = defuse_return_decrypted(DB_PASSWD);
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
453 453
         // perform a copy
454 454
         if (file_exists($tp_config_file)) {
455
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
456
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
455
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
456
+                return "ERROR: Could not copy file '".$tp_config_file."'";
457 457
             }
458 458
         }
459 459
 
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
         $data[2] = "\$SETTINGS = array (\n";
465 465
 
466 466
         $result = $mysqli2->query('SELECT *
467
-            FROM ' . $pre . 'misc
467
+            FROM ' . $pre.'misc
468 468
             WHERE type = "admin"'
469 469
         );
470 470
         $rowcount = $result->num_rows;
471 471
         if ($rowcount > 0) {
472 472
             while ($row = $result->fetch_assoc()) {
473
-                array_push($data, "    '" . $row['intitule'] . "' => '" . htmlspecialchars_decode($row['valeur'], ENT_COMPAT) . "',\n");
473
+                array_push($data, "    '".$row['intitule']."' => '".htmlspecialchars_decode($row['valeur'], ENT_COMPAT)."',\n");
474 474
             }
475 475
         }
476 476
         array_push($data, ");\n");
@@ -485,15 +485,15 @@  discard block
 block discarded – undo
485 485
                 break;
486 486
             }
487 487
 
488
-            if (stristr($line, "'" . $field . "' => '")) {
489
-                $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT) . "',\n";
488
+            if (stristr($line, "'".$field."' => '")) {
489
+                $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n";
490 490
                 $bFound = true;
491 491
                 break;
492 492
             }
493 493
             ++$inc;
494 494
         }
495 495
         if ($bFound === false) {
496
-            $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT). "',\n);\n";
496
+            $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n);\n";
497 497
         }
498 498
     }
499 499
     mysqli_close($mysqli2);
Please login to merge, or discard this patch.
install--ASUPPRIMER/migrate_users_to_v3.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,4 +41,4 @@
 block discarded – undo
41 41
 } else {
42 42
     $finished = 0;
43 43
 }
44
-echo '[{"finish":"' . $finished . '", "scriptname":"' . $scripts_list[$post_file_number][0] . '", "parameter":"' . $scripts_list[$post_file_number][1] . '"}]';
44
+echo '[{"finish":"'.$finished.'", "scriptname":"'.$scripts_list[$post_file_number][0].'", "parameter":"'.$scripts_list[$post_file_number][1].'"}]';
Please login to merge, or discard this patch.
install--ASUPPRIMER/install.php 2 patches
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -39,68 +39,68 @@  discard block
 block discarded – undo
39 39
 
40 40
 <body>
41 41
 	<?php
42
-	// define root path
43
-	$abs_path = rtrim(
44
-		filter_var($_SERVER['DOCUMENT_ROOT'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
45
-		'/'
46
-	) . substr(
47
-		filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
48
-		0,
49
-		strlen(filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)) - 20
50
-	);
51
-	if (isset($_SERVER['HTTPS'])) {
52
-		$protocol = 'https://';
53
-	} else {
54
-		$protocol = 'http://';
55
-	}
42
+    // define root path
43
+    $abs_path = rtrim(
44
+        filter_var($_SERVER['DOCUMENT_ROOT'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
45
+        '/'
46
+    ) . substr(
47
+        filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
48
+        0,
49
+        strlen(filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)) - 20
50
+    );
51
+    if (isset($_SERVER['HTTPS'])) {
52
+        $protocol = 'https://';
53
+    } else {
54
+        $protocol = 'http://';
55
+    }
56 56
 
57 57
 
58
-	$post_step = filter_input(INPUT_POST, 'step', FILTER_SANITIZE_NUMBER_INT);
59
-	$post_db_host = filter_input(INPUT_POST, 'db_host', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
60
-	if (empty($post_db_host) === true) {
61
-		$post_db_host = filter_input(INPUT_POST, 'hid_db_host', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
62
-	}
63
-	$post_db_login = filter_input(INPUT_POST, 'db_login', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
64
-	if (empty($post_db_login) === true) {
65
-		$post_db_login = filter_input(INPUT_POST, 'hid_db_login', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
66
-	}
67
-	$post_db_pwd = filter_input(INPUT_POST, 'db_pwd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
68
-	if (empty($post_db_pwd) === true) {
69
-		$post_db_pwd = filter_input(INPUT_POST, 'hid_db_pwd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
70
-	}
71
-	$post_db_port = filter_input(INPUT_POST, 'db_port', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
72
-	if (empty($post_db_port) === true) {
73
-		$post_db_port = filter_input(INPUT_POST, 'hid_db_port', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
74
-	}
75
-	$post_db_bdd = filter_input(INPUT_POST, 'db_bdd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
76
-	if (empty($post_db_bdd) === true) {
77
-		$post_db_bdd = filter_input(INPUT_POST, 'hid_db_bdd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
78
-	}
79
-	$post_db_pre = filter_input(INPUT_POST, 'db_pre', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
80
-	if (empty($post_db_pre) === true) {
81
-		$post_db_pre = filter_input(INPUT_POST, 'hid_db_pre', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
82
-	}
83
-	$post_absolute_path = filter_input(INPUT_POST, 'absolute_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
84
-	if (empty($post_absolute_path) === true) {
85
-		$post_absolute_path = filter_input(INPUT_POST, 'hid_absolute_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
86
-	}
87
-	$post_url_path = filter_input(INPUT_POST, 'url_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
88
-	if (empty($post_url_path) === true) {
89
-		$post_url_path = filter_input(INPUT_POST, 'hid_url_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
90
-	}
91
-	$post_sk_path = filter_input(INPUT_POST, 'sk_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
92
-	if (empty($post_sk_path) === true) {
93
-		$post_sk_path = filter_input(INPUT_POST, 'hid_sk_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
94
-	}
58
+    $post_step = filter_input(INPUT_POST, 'step', FILTER_SANITIZE_NUMBER_INT);
59
+    $post_db_host = filter_input(INPUT_POST, 'db_host', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
60
+    if (empty($post_db_host) === true) {
61
+        $post_db_host = filter_input(INPUT_POST, 'hid_db_host', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
62
+    }
63
+    $post_db_login = filter_input(INPUT_POST, 'db_login', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
64
+    if (empty($post_db_login) === true) {
65
+        $post_db_login = filter_input(INPUT_POST, 'hid_db_login', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
66
+    }
67
+    $post_db_pwd = filter_input(INPUT_POST, 'db_pwd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
68
+    if (empty($post_db_pwd) === true) {
69
+        $post_db_pwd = filter_input(INPUT_POST, 'hid_db_pwd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
70
+    }
71
+    $post_db_port = filter_input(INPUT_POST, 'db_port', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
72
+    if (empty($post_db_port) === true) {
73
+        $post_db_port = filter_input(INPUT_POST, 'hid_db_port', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
74
+    }
75
+    $post_db_bdd = filter_input(INPUT_POST, 'db_bdd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
76
+    if (empty($post_db_bdd) === true) {
77
+        $post_db_bdd = filter_input(INPUT_POST, 'hid_db_bdd', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
78
+    }
79
+    $post_db_pre = filter_input(INPUT_POST, 'db_pre', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
80
+    if (empty($post_db_pre) === true) {
81
+        $post_db_pre = filter_input(INPUT_POST, 'hid_db_pre', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
82
+    }
83
+    $post_absolute_path = filter_input(INPUT_POST, 'absolute_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
84
+    if (empty($post_absolute_path) === true) {
85
+        $post_absolute_path = filter_input(INPUT_POST, 'hid_absolute_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
86
+    }
87
+    $post_url_path = filter_input(INPUT_POST, 'url_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
88
+    if (empty($post_url_path) === true) {
89
+        $post_url_path = filter_input(INPUT_POST, 'hid_url_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
90
+    }
91
+    $post_sk_path = filter_input(INPUT_POST, 'sk_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
92
+    if (empty($post_sk_path) === true) {
93
+        $post_sk_path = filter_input(INPUT_POST, 'hid_sk_path', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
94
+    }
95 95
 
96
-	// Get some data
97
-	include "../includes/config/include.php";
96
+    // Get some data
97
+    include "../includes/config/include.php";
98 98
 
99
-	// # LOADER
100
-	echo '
99
+    // # LOADER
100
+    echo '
101 101
     <div style="position:absolute;top:49%;left:49%;display:none;z-index:9999999;" id="loader"><img src="images/76.gif" /></div>';
102
-	// # HEADER ##
103
-	echo '
102
+    // # HEADER ##
103
+    echo '
104 104
 	<div id="top">
105 105
 		<div id="logo" class="lcol"><img src="../includes/images/teampass-logo2-home.png" /></div>
106 106
 		<div class="lcol">
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
                 </h3>
132 132
             </div>
133 133
             <div class="card-body">';
134
-	if (!isset($_GET['step']) && !isset($post_step)) {
135
-		//ETAPE O
136
-		echo '
134
+    if (!isset($_GET['step']) && !isset($post_step)) {
135
+        //ETAPE O
136
+        echo '
137 137
 				<div class="row">
138 138
                     <div class="callout callout-warning col-12">
139 139
                         <h5><i class="fas fa-info-circle text-warning mr-2"></i>Welcome to Teampass installation</h5>
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 						<p><a class="text-primary" target="_blank" href="https://spdx.org/licenses/GPL-3.0-only.html#licenseText">Read complete license</a>
160 160
                     </div>
161 161
                 </div>';
162
-		// STEP1
163
-	} elseif ((isset($post_step) && $post_step == 2)
164
-		|| (isset($_GET['step']) && $_GET['step'] == 2)
165
-		&& $post_user_granted === '1'
166
-	) {
167
-		//ETAPE 1
168
-		echo '
162
+        // STEP1
163
+    } elseif ((isset($post_step) && $post_step == 2)
164
+        || (isset($_GET['step']) && $_GET['step'] == 2)
165
+        && $post_user_granted === '1'
166
+    ) {
167
+        //ETAPE 1
168
+        echo '
169 169
 	<div class="row">
170 170
 		<div class="col-12">
171 171
 			<div class="card card-primary">
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		</div>
187 187
 	</div>';
188 188
 
189
-	echo '
189
+    echo '
190 190
 	<div class="row">
191 191
 		<div class="col-12">
192 192
 			<div class="card card-primary">
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 			</div>
226 226
 		</div>
227 227
 	</div>';
228
-		// STEP2
229
-	} elseif ((isset($post_step) && $post_step == 3)
230
-		|| (isset($_GET['step']) && $_GET['step'] == 3)
231
-		&& $post_user_granted === '1'
232
-	) {
233
-		//ETAPE 2
234
-		echo '
228
+        // STEP2
229
+    } elseif ((isset($post_step) && $post_step == 3)
230
+        || (isset($_GET['step']) && $_GET['step'] == 3)
231
+        && $post_user_granted === '1'
232
+    ) {
233
+        //ETAPE 2
234
+        echo '
235 235
 	<div class="row">
236 236
 		<div class="col-12">
237 237
 			<div class="card card-primary">
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		</div>
269 269
 	</div>';
270 270
 
271
-		// STEP3
272
-	} elseif ((isset($post_step) && $post_step == 4)
273
-		|| (isset($_GET['step']) && $_GET['step'] == 4)
274
-		&& $post_user_granted === '1'
275
-	) {
276
-		//ETAPE 3
277
-		echo '
271
+        // STEP3
272
+    } elseif ((isset($post_step) && $post_step == 4)
273
+        || (isset($_GET['step']) && $_GET['step'] == 4)
274
+        && $post_user_granted === '1'
275
+    ) {
276
+        //ETAPE 3
277
+        echo '
278 278
 	<div class="row">
279 279
 		<div class="col-12">
280 280
 			<div class="card card-primary">
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
 	</div>';
311 311
 
312 312
 
313
-		// STEP4
314
-	} elseif ((isset($post_step) && $post_step == 5)
315
-		|| (isset($_GET['step']) && $_GET['step'] == 5)
316
-		&& $post_user_granted === '1'
317
-	) {
318
-		//ETAPE 4
319
-		echo '
313
+        // STEP4
314
+    } elseif ((isset($post_step) && $post_step == 5)
315
+        || (isset($_GET['step']) && $_GET['step'] == 5)
316
+        && $post_user_granted === '1'
317
+    ) {
318
+        //ETAPE 4
319
+        echo '
320 320
 	<div class="row">
321 321
 		<div class="col-12">
322 322
 			<div class="card card-primary">
@@ -330,13 +330,13 @@  discard block
 block discarded – undo
330 330
 		</div>
331 331
 	</div>';
332 332
 
333
-		// STEP5
334
-	} elseif ((isset($post_step) && $post_step == 6)
335
-		|| (isset($_GET['step']) && $_GET['step'] == 6)
336
-		&& $post_user_granted === '1'
337
-	) {
338
-		//ETAPE 5
339
-		echo '
333
+        // STEP5
334
+    } elseif ((isset($post_step) && $post_step == 6)
335
+        || (isset($_GET['step']) && $_GET['step'] == 6)
336
+        && $post_user_granted === '1'
337
+    ) {
338
+        //ETAPE 5
339
+        echo '
340 340
 	<div class="row">
341 341
 		<div class="col-12">
342 342
 			<div class="card card-primary">
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
 		</div>
358 358
 	</div>';
359 359
 
360
-		// STEP6
361
-	} elseif ((isset($post_step) && $post_step == 7)
362
-		|| (isset($_GET['step']) && $_GET['step'] == 7)
363
-		&& $post_user_granted === '1'
364
-	) {
365
-		//ETAPE 6
366
-		echo '
360
+        // STEP6
361
+    } elseif ((isset($post_step) && $post_step == 7)
362
+        || (isset($_GET['step']) && $_GET['step'] == 7)
363
+        && $post_user_granted === '1'
364
+    ) {
365
+        //ETAPE 6
366
+        echo '
367 367
 	<div class="row">
368 368
 		<div class="callout callout-primary col-12">
369 369
 			<h4>Thank you for installing <b>Teampass</b>.</h4>
@@ -391,32 +391,32 @@  discard block
 block discarded – undo
391 391
 			</div>
392 392
 		</div>
393 393
 	</div>';
394
-	}
394
+    }
395 395
 
396
-	echo '	
396
+    echo '	
397 397
 	</div>	
398 398
         <div class="card-footer">';
399
-	//buttons
400
-	if (!isset($post_step)) {
401
-		echo '
399
+    //buttons
400
+    if (!isset($post_step)) {
401
+        echo '
402 402
             <input type="button" class="btn btn-primary" id="but_next" target_id="2" class="button" value="START" />
403 403
             <input type="button" class="btn btn-primary" id="but_start" onclick="document.location = \'' . $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8) . '\'" class="button" style="display: none;" value="Start" />';
404
-	} elseif ($post_step == 7) {
405
-		// Nothong to do
406
-	} else {
407
-		echo '
404
+    } elseif ($post_step == 7) {
405
+        // Nothong to do
406
+    } else {
407
+        echo '
408 408
             <input type="button" id="but_launch" onclick="checkPage(\'step' . $post_step . '\')" class="btn btn-primary" value="START" />
409 409
             <input type="button" id="but_next" target_id="' . (intval($post_step) + 1) . '" class="btn btn-primary" value="NEXT" disabled="disabled">
410 410
 			<input type="button" class="btn btn-primary" id="but_restart" onclick="document.location = \'install.php\'" class="button" value="RESTART" />';
411
-	}
411
+    }
412 412
 
413
-	echo '
413
+    echo '
414 414
         </div>
415 415
 	</form>
416 416
 	</div>';
417 417
 
418
-	//FOOTER
419
-	echo '
418
+    //FOOTER
419
+    echo '
420 420
     <div id="footer">
421 421
         <div style="width:500px; font-size:16px;">
422 422
             ' . TP_TOOL_NAME . ' ' . TP_VERSION . ' <i class="far fa-copyright"></i> copyright 2009-2019
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         <div style="float:right;margin-top:-15px;">
425 425
         </div>
426 426
     </div>';
427
-	?>
427
+    ?>
428 428
 </body>
429 429
 
430 430
 </html>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	$abs_path = rtrim(
44 44
 		filter_var($_SERVER['DOCUMENT_ROOT'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
45 45
 		'/'
46
-	) . substr(
46
+	).substr(
47 47
 		filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
48 48
 		0,
49 49
 		strlen(filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)) - 20
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	<div id="top">
105 105
 		<div id="logo" class="lcol"><img src="../includes/images/teampass-logo2-home.png" /></div>
106 106
 		<div class="lcol">
107
-			<span class="header-title">' . strtoupper(TP_TOOL_NAME) . '</span>
107
+			<span class="header-title">' . strtoupper(TP_TOOL_NAME).'</span>
108 108
 		</div>
109 109
 		
110 110
         <div id="content">
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                         <h5><i class="fas fa-info-circle text-warning mr-2"></i>Welcome to Teampass installation</h5>
140 140
     
141 141
                         <p>This seems to be the 1st time Teampass will be installed on this server.<br>
142
-						It will proceed with installation of release <b>' . TP_VERSION . '</b>.</p>
142
+						It will proceed with installation of release <b>' . TP_VERSION.'</b>.</p>
143 143
                     </div>
144 144
 
145 145
                     <div class="callout callout-info col-12 mt-3">
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 				<div class="card-body">
176 176
 					<div class="form-group">
177 177
 						<label>Absolute path to TeamPass folder</label>
178
-						<input type="text" class="form-control" name="absolute_path" id="absolute_path" class="ui-widget" value="' . $abs_path . '">
178
+						<input type="text" class="form-control" name="absolute_path" id="absolute_path" class="ui-widget" value="' . $abs_path.'">
179 179
 					</div>
180 180
 					<div class="form-group">
181 181
 						<label>Full URL to TeamPass</label>
182
-						<input type="text" class="form-control" name="url_path" id="url_path" class="ui-widget" value="' . $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8) . '">
182
+						<input type="text" class="form-control" name="url_path" id="url_path" class="ui-widget" value="' . $protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8).'">
183 183
 					</div>
184 184
 				</div>
185 185
 			</div>
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
 	if (!isset($post_step)) {
401 401
 		echo '
402 402
             <input type="button" class="btn btn-primary" id="but_next" target_id="2" class="button" value="START" />
403
-            <input type="button" class="btn btn-primary" id="but_start" onclick="document.location = \'' . $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8) . '\'" class="button" style="display: none;" value="Start" />';
403
+            <input type="button" class="btn btn-primary" id="but_start" onclick="document.location = \'' . $protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8).'\'" class="button" style="display: none;" value="Start" />';
404 404
 	} elseif ($post_step == 7) {
405 405
 		// Nothong to do
406 406
 	} else {
407 407
 		echo '
408
-            <input type="button" id="but_launch" onclick="checkPage(\'step' . $post_step . '\')" class="btn btn-primary" value="START" />
409
-            <input type="button" id="but_next" target_id="' . (intval($post_step) + 1) . '" class="btn btn-primary" value="NEXT" disabled="disabled">
408
+            <input type="button" id="but_launch" onclick="checkPage(\'step' . $post_step.'\')" class="btn btn-primary" value="START" />
409
+            <input type="button" id="but_next" target_id="' . (intval($post_step) + 1).'" class="btn btn-primary" value="NEXT" disabled="disabled">
410 410
 			<input type="button" class="btn btn-primary" id="but_restart" onclick="document.location = \'install.php\'" class="button" value="RESTART" />';
411 411
 	}
412 412
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	echo '
420 420
     <div id="footer">
421 421
         <div style="width:500px; font-size:16px;">
422
-            ' . TP_TOOL_NAME . ' ' . TP_VERSION . ' <i class="far fa-copyright"></i> copyright 2009-2019
422
+            ' . TP_TOOL_NAME.' '.TP_VERSION.' <i class="far fa-copyright"></i> copyright 2009-2019
423 423
         </div>
424 424
         <div style="float:right;margin-top:-15px;">
425 425
         </div>
Please login to merge, or discard this patch.
install--ASUPPRIMER/upgrade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     echo '
276 276
         <div class="row">
277 277
             <div class="col-12">
278
-                <div class="card card-',$dbSettings === true ? 'primary' : 'warning','">
278
+                <div class="card card-',$dbSettings === true ? 'primary' : 'warning', '">
279 279
                     <div class="card-header">
280 280
                         <h5>DataBase Informations</h5>
281 281
                     </div>
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
     console.log("> "+step+" - Number: "+number + " - Previous step: "+previousStep);
803 803
     console.log(usersList);
804 804
     var d = new Date(),
805
-        count_in_loop = <?php echo (int) NUMBER_ITEMS_IN_BATCH;?>,
805
+        count_in_loop = <?php echo (int) NUMBER_ITEMS_IN_BATCH; ?>,
806 806
         userSteps = {};
807 807
 
808 808
 
Please login to merge, or discard this patch.
install--ASUPPRIMER/tp.functions.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
         
35 35
         $settingsTxt = '<?php
36 36
 // DATABASE connexion parameters
37
-define("DB_HOST", "' . DB_HOST . '");
38
-define("DB_USER", "' . DB_USER . '");
39
-define("DB_PASSWD", "' . DB_PASSWD . '");
40
-define("DB_NAME", "' . DB_NAME . '");
41
-define("DB_PREFIX", "' . DB_PREFIX . '");
42
-define("DB_PORT", "' . DB_PORT . '");
43
-define("DB_ENCODING", "' . DB_ENCODING . '");';
37
+define("DB_HOST", "' . DB_HOST.'");
38
+define("DB_USER", "' . DB_USER.'");
39
+define("DB_PASSWD", "' . DB_PASSWD.'");
40
+define("DB_NAME", "' . DB_NAME.'");
41
+define("DB_PREFIX", "' . DB_PREFIX.'");
42
+define("DB_PORT", "' . DB_PORT.'");
43
+define("DB_ENCODING", "' . DB_ENCODING.'");';
44 44
 
45 45
 if (isset(DB_SSL['key']) === true && empty(DB_SSL['key']) === false) {
46 46
     $settingsTxt .= '
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 define("DB_CONNECT_OPTIONS", array(
71 71
     MYSQLI_OPT_CONNECT_TIMEOUT => 10
72 72
 ));
73
-define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");
74
-define("SECUREFILE", "' . SECUREFILE. '");';
73
+define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH).'");
74
+define("SECUREFILE", "' . SECUREFILE.'");';
75 75
 
76 76
         if (defined('IKEY') === true) $settingsTxt .= '
77
-define("IKEY", "' . IKEY . '");';
77
+define("IKEY", "' . IKEY.'");';
78 78
         else $settingsTxt .= '
79 79
 define("IKEY", "");';
80 80
         if (defined('SKEY') === true) $settingsTxt .= '
81
-define("SKEY", "' . SKEY . '");';
81
+define("SKEY", "' . SKEY.'");';
82 82
         else $settingsTxt .= '
83 83
 define("SKEY", "");';
84 84
         if (defined('HOST') === true) $settingsTxt .= '
85
-define("HOST", "' . HOST . '");';
85
+define("HOST", "' . HOST.'");';
86 86
         else $settingsTxt .= '
87 87
 define("HOST", "");';
88 88
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     global $db_link;
408 408
 
409 409
     // check if column already exists
410
-    $columns = mysqli_query($db_link, "show columns from `" . $table . "`");
410
+    $columns = mysqli_query($db_link, "show columns from `".$table."`");
411 411
     while ($col = mysqli_fetch_assoc($columns)) {
412 412
         if ((string) $col['Field'] === $oldName) {
413 413
             // change column name
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     // Essayer de trouver le fichier binaire de PHP dans les chemins de recherche standards
433 433
     $paths = explode(PATH_SEPARATOR, getenv('PATH'));
434 434
     foreach ($paths as $path) {
435
-        $phpBinary = $path . DIRECTORY_SEPARATOR . 'php';
435
+        $phpBinary = $path.DIRECTORY_SEPARATOR.'php';
436 436
         if (is_executable($phpBinary)) {
437 437
         $phpPath = $phpBinary;
438 438
         break;
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 function deleteAll(array $folders)
468 468
 {
469 469
 
470
-    foreach($folders as $folder) {
470
+    foreach ($folders as $folder) {
471 471
         deleteAllFolder($folder);
472 472
     }
473 473
 }
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
         $scan = glob(rtrim($str, '/').'/*'); 
494 494
 
495 495
         // Loop through the list of files 
496
-        foreach($scan as $index=>$path) { 
496
+        foreach ($scan as $index=>$path) { 
497 497
 
498 498
             // Call recursive function 
499 499
             deleteAllFolder($path); 
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,18 +73,27 @@
 block discarded – undo
73 73
 define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");
74 74
 define("SECUREFILE", "' . SECUREFILE. '");';
75 75
 
76
-        if (defined('IKEY') === true) $settingsTxt .= '
76
+        if (defined('IKEY') === true) {
77
+            $settingsTxt .= '
77 78
 define("IKEY", "' . IKEY . '");';
78
-        else $settingsTxt .= '
79
+        } else {
80
+            $settingsTxt .= '
79 81
 define("IKEY", "");';
80
-        if (defined('SKEY') === true) $settingsTxt .= '
82
+        }
83
+        if (defined('SKEY') === true) {
84
+            $settingsTxt .= '
81 85
 define("SKEY", "' . SKEY . '");';
82
-        else $settingsTxt .= '
86
+        } else {
87
+            $settingsTxt .= '
83 88
 define("SKEY", "");';
84
-        if (defined('HOST') === true) $settingsTxt .= '
89
+        }
90
+        if (defined('HOST') === true) {
91
+            $settingsTxt .= '
85 92
 define("HOST", "' . HOST . '");';
86
-        else $settingsTxt .= '
93
+        } else {
94
+            $settingsTxt .= '
87 95
 define("HOST", "");';
96
+        }
88 97
 
89 98
 
90 99
         $settingsTxt .= '
Please login to merge, or discard this patch.