@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | // Do checks |
40 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
41 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
40 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
41 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
42 | 42 | if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'utilities.database', $SETTINGS) === false) { |
43 | 43 | // Not allowed page |
44 | 44 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; |
45 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
45 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
46 | 46 | exit(); |
47 | 47 | } |
48 | 48 | |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | date_default_timezone_set('UTC'); |
56 | 56 | } |
57 | 57 | |
58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
59 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
58 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
59 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
60 | 60 | header('Content-type: text/html; charset=utf-8'); |
61 | 61 | header('Cache-Control: no-cache, must-revalidate'); |
62 | 62 | require_once 'main.functions.php'; |
63 | 63 | |
64 | 64 | //Connect to DB |
65 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
65 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
66 | 66 | if (defined('DB_PASSWD_CLEAR') === false) { |
67 | 67 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
68 | 68 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $arrFolders = array(); |
105 | 105 | $rows = DB::query( |
106 | 106 | 'SELECT valeur, intitule |
107 | - FROM ' . prefixTable('misc') . ' |
|
107 | + FROM ' . prefixTable('misc').' |
|
108 | 108 | WHERE type = %s', |
109 | 109 | 'folder_deleted' |
110 | 110 | ); |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | 'SELECT u.login as login, u.name as name, u.lastname as lastname, |
126 | 126 | i.id as id, i.label as label, |
127 | 127 | i.id_tree as id_tree, l.date as date, n.title as folder_title |
128 | - FROM ' . prefixTable('log_items') . ' as l |
|
129 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
130 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
131 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id) |
|
128 | + FROM ' . prefixTable('log_items').' as l |
|
129 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
130 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
131 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id) |
|
132 | 132 | WHERE i.inactif = %i |
133 | 133 | AND l.action = %s', |
134 | 134 | 1, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'label' => $record['label'], |
151 | 151 | 'date' => date($SETTINGS['date_format'], (int) $record['date']), |
152 | 152 | 'login' => $record['login'], |
153 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
153 | + 'name' => $record['name'].' '.$record['lastname'], |
|
154 | 154 | 'folder_label' => $record['folder_title'], |
155 | 155 | 'folder_deleted' => $thisFolder, |
156 | 156 | ) |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | // decrypt and retrieve data in JSON format |
201 | 201 | $dataReceived = prepareExchangedData( |
202 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
202 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
203 | 203 | |
204 | 204 | // Prepare variables |
205 | 205 | $post_folders = filter_var_array($dataReceived['folders'], FILTER_SANITIZE_STRING); |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | foreach ($post_folders as $folderId) { |
210 | 210 | $data = DB::queryfirstrow( |
211 | 211 | 'SELECT valeur |
212 | - FROM ' . prefixTable('misc') . " |
|
212 | + FROM ' . prefixTable('misc')." |
|
213 | 213 | WHERE type = 'folder_deleted' |
214 | 214 | AND intitule = %s", |
215 | - 'f' . $folderId |
|
215 | + 'f'.$folderId |
|
216 | 216 | ); |
217 | 217 | if ((int) $data['valeur'] !== 0) { |
218 | 218 | $folderData = explode(', ', $data['valeur']); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | prefixTable('misc'), |
239 | 239 | 'type = %s AND intitule = %s', |
240 | 240 | 'folder_deleted', |
241 | - 'f' . $folderId |
|
241 | + 'f'.$folderId |
|
242 | 242 | ); |
243 | 243 | |
244 | 244 | // Restore all items in this folder |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // Get list of all items in thos folder |
255 | 255 | $items = DB::query( |
256 | 256 | 'SELECT id |
257 | - FROM ' . prefixTable('items') . ' |
|
257 | + FROM ' . prefixTable('items').' |
|
258 | 258 | WHERE id_tree = %i', |
259 | 259 | $folderId |
260 | 260 | ); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | // decrypt and retrieve data in JSON format |
335 | 335 | $dataReceived = prepareExchangedData( |
336 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
336 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
337 | 337 | |
338 | 338 | // Prepare variables |
339 | 339 | $post_folders = filter_var_array($dataReceived['folders'], FILTER_SANITIZE_STRING); |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | foreach ($post_folders as $folderId) { |
344 | 344 | $data = DB::queryfirstrow( |
345 | 345 | 'SELECT valeur |
346 | - FROM ' . prefixTable('misc') . " |
|
346 | + FROM ' . prefixTable('misc')." |
|
347 | 347 | WHERE type = 'folder_deleted' |
348 | 348 | AND intitule = %s", |
349 | - 'f' . $folderId |
|
349 | + 'f'.$folderId |
|
350 | 350 | ); |
351 | 351 | if ((int) $data['valeur'] !== 0) { |
352 | 352 | $folderData = explode(', ', $data['valeur']); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | prefixTable('misc'), |
379 | 379 | 'type = %s AND intitule = %s', |
380 | 380 | 'folder_deleted', |
381 | - 'f' . $folderData[0] |
|
381 | + 'f'.$folderData[0] |
|
382 | 382 | ); |
383 | 383 | |
384 | 384 | // Delete all items in this folder |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | // Get list of all items in thos folder |
393 | 393 | $items = DB::query( |
394 | 394 | 'SELECT id |
395 | - FROM ' . prefixTable('items') . ' |
|
395 | + FROM ' . prefixTable('items').' |
|
396 | 396 | WHERE id_tree = %i', |
397 | 397 | $folderData[0] |
398 | 398 | ); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | // decrypt and retrieve data in JSON format |
466 | 466 | $dataReceived = prepareExchangedData( |
467 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
467 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
468 | 468 | |
469 | 469 | // Prepare variables |
470 | 470 | $post_log_type = filter_var($dataReceived['dataType'], FILTER_SANITIZE_STRING); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | ) { |
493 | 493 | if ($post_log_type === 'items') { |
494 | 494 | DB::query( |
495 | - 'SELECT * FROM ' . prefixTable('log_items') . ' |
|
495 | + 'SELECT * FROM '.prefixTable('log_items').' |
|
496 | 496 | WHERE (date BETWEEN %i AND %i)' |
497 | 497 | . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"') |
498 | 498 | . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user), |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | } elseif ($post_log_type === 'connections') { |
513 | 513 | //db::debugmode(true); |
514 | 514 | DB::query( |
515 | - 'SELECT * FROM ' . prefixTable('log_system') . ' |
|
515 | + 'SELECT * FROM '.prefixTable('log_system').' |
|
516 | 516 | WHERE type=%s ' |
517 | 517 | . 'AND (date BETWEEN %i AND %i)' |
518 | 518 | . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action) |
@@ -535,12 +535,12 @@ discard block |
||
535 | 535 | ); |
536 | 536 | } elseif ($post_log_type === 'errors') { |
537 | 537 | //db::debugmode(true); |
538 | - echo 'SELECT * FROM ' . prefixTable('log_items') . ' |
|
538 | + echo 'SELECT * FROM '.prefixTable('log_items').' |
|
539 | 539 | WHERE (date BETWEEN '.$post_date_from.' AND '.$post_date_to.')' |
540 | 540 | . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action) |
541 | 541 | . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user); |
542 | 542 | DB::query( |
543 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
543 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
544 | 544 | 'AND (date BETWEEN %i AND %i)', |
545 | 545 | 'error', |
546 | 546 | $post_date_from, |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | ); |
558 | 558 | } elseif ($post_log_type === 'copy') { |
559 | 559 | DB::query( |
560 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' . |
|
560 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '. |
|
561 | 561 | 'AND (date BETWEEN %i AND %i)', |
562 | 562 | 'at_copy', |
563 | 563 | $post_date_from, |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | ); |
575 | 575 | } elseif ($post_log_type === 'admin') { |
576 | 576 | DB::query( |
577 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
577 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
578 | 578 | 'AND (date BETWEEN %i AND %i)', |
579 | 579 | 'admin_action', |
580 | 580 | $post_date_from, |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | ); |
592 | 592 | } elseif ($post_log_type === 'failed') { |
593 | 593 | DB::query( |
594 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
594 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
595 | 595 | 'AND (date BETWEEN %i AND %i)', |
596 | 596 | 'failed_auth', |
597 | 597 | $post_date_from, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $config->setIgnoreHeaderLine('true'); |
166 | 166 | // extract data from CSV file |
167 | 167 | $interpreter = new Interpreter(); |
168 | - $interpreter->addObserver(function (array $row) use (&$valuesToImport) { |
|
168 | + $interpreter->addObserver(function(array $row) use (&$valuesToImport) { |
|
169 | 169 | $valuesToImport[] = array( |
170 | 170 | 'Label' => $row[0], |
171 | 171 | 'Login' => $row[1], |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | |
309 | 309 | // Decrypt and retreive data in JSON format |
310 | 310 | $post_items = prepareExchangedData( |
311 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
311 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
312 | 312 | |
313 | 313 | // Init post variable |
314 | 314 | $post_folder = filter_input(INPUT_POST, 'folder', FILTER_SANITIZE_NUMBER_INT); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | |
460 | 460 | // Decrypt and retreive data in JSON format |
461 | 461 | $receivedParameters = prepareExchangedData( |
462 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
462 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
463 | 463 | |
464 | 464 | $post_folder_id = filter_var($receivedParameters['folder-id'], FILTER_SANITIZE_NUMBER_INT); |
465 | 465 | $post_operation_id = filter_var($receivedParameters['file'], FILTER_SANITIZE_STRING); |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | break; |
1187 | 1187 | } |
1188 | 1188 | |
1189 | -spl_autoload_register(function ($class) { |
|
1189 | +spl_autoload_register(function($class) { |
|
1190 | 1190 | $prefix = 'League\\Csv\\'; |
1191 | 1191 | $base_dir = __DIR__.'/src/'; |
1192 | 1192 | $len = strlen($prefix); |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | // Do checks |
40 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
41 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
40 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
41 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
42 | 42 | if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) { |
43 | 43 | // Not allowed page |
44 | 44 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; |
45 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
45 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
46 | 46 | exit(); |
47 | 47 | } |
48 | 48 | |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | date_default_timezone_set('UTC'); |
56 | 56 | } |
57 | 57 | |
58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
59 | 59 | header('Content-type: text/html; charset=utf-8'); |
60 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
61 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
62 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
60 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
61 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
62 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
63 | 63 | |
64 | 64 | // Connect to mysql server |
65 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
65 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
66 | 66 | if (defined('DB_PASSWD_CLEAR') === false) { |
67 | 67 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
68 | 68 | } |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | && $t->personal_folder == 0 |
135 | 135 | ) { |
136 | 136 | // get $t->parent_id |
137 | - $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id); |
|
137 | + $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id); |
|
138 | 138 | if ($t->nlevel == 1) { |
139 | 139 | $data['title'] = langHdl('root'); |
140 | 140 | } |
141 | 141 | |
142 | 142 | // get rights on this folder |
143 | 143 | $arrayRights = array(); |
144 | - $rows = DB::query('SELECT fonction_id FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id); |
|
144 | + $rows = DB::query('SELECT fonction_id FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id); |
|
145 | 145 | foreach ($rows as $record) { |
146 | 146 | array_push($arrayRights, $record['fonction_id']); |
147 | 147 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | $node_data = DB::queryFirstRow( |
159 | 159 | 'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period, |
160 | 160 | n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification |
161 | - FROM ' . prefixTable('misc') . ' AS m, |
|
162 | - ' . prefixTable('nested_tree') . ' AS n |
|
161 | + FROM ' . prefixTable('misc').' AS m, |
|
162 | + ' . prefixTable('nested_tree').' AS n |
|
163 | 163 | WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i', |
164 | 164 | 'complex', |
165 | 165 | $t->id |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | //col7 |
193 | 193 | $data7 = DB::queryFirstRow( |
194 | 194 | 'SELECT bloquer_creation,bloquer_modification |
195 | - FROM ' . prefixTable('nested_tree') . ' |
|
195 | + FROM ' . prefixTable('nested_tree').' |
|
196 | 196 | WHERE id = %i', |
197 | 197 | intval($t->id) |
198 | 198 | ); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | // decrypt and retrieve data in JSON format |
306 | 306 | $dataReceived = prepareExchangedData( |
307 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
307 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
308 | 308 | |
309 | 309 | // prepare variables |
310 | 310 | $post_title = filter_var($dataReceived['title'], FILTER_SANITIZE_STRING); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | // Get info about this folder |
336 | 336 | $dataFolder = DB::queryfirstrow( |
337 | 337 | 'SELECT * |
338 | - FROM ' . prefixTable('nested_tree') . ' |
|
338 | + FROM ' . prefixTable('nested_tree').' |
|
339 | 339 | WHERE id = %i', |
340 | 340 | $post_folder_id |
341 | 341 | ); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | //check if parent folder is personal |
373 | 373 | $dataParent = DB::queryfirstrow( |
374 | 374 | 'SELECT personal_folder, bloquer_creation, bloquer_modification |
375 | - FROM ' . prefixTable('nested_tree') . ' |
|
375 | + FROM ' . prefixTable('nested_tree').' |
|
376 | 376 | WHERE id = %i', |
377 | 377 | $post_parent_id |
378 | 378 | ); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | // get complexity level for this folder |
402 | 402 | $data = DB::queryfirstrow( |
403 | 403 | 'SELECT valeur |
404 | - FROM ' . prefixTable('misc') . ' |
|
404 | + FROM ' . prefixTable('misc').' |
|
405 | 405 | WHERE intitule = %i AND type = %s', |
406 | 406 | $post_parent_id, |
407 | 407 | 'complex' |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | array( |
414 | 414 | 'error' => true, |
415 | 415 | 'message' => langHdl('error_folder_complexity_lower_than_top_folder') |
416 | - . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]', |
|
416 | + . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]', |
|
417 | 417 | ), |
418 | 418 | 'encode' |
419 | 419 | ); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | // decrypt and retrieve data in JSON format |
510 | 510 | $dataReceived = prepareExchangedData( |
511 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
511 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
512 | 512 | |
513 | 513 | // prepare variables |
514 | 514 | $post_title = filter_var($dataReceived['title'], FILTER_SANITIZE_STRING); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | ) { |
573 | 573 | DB::query( |
574 | 574 | 'SELECT * |
575 | - FROM ' . prefixTable('nested_tree') . ' |
|
575 | + FROM ' . prefixTable('nested_tree').' |
|
576 | 576 | WHERE title = %s', |
577 | 577 | $post_title |
578 | 578 | ); |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | //check if parent folder is personal |
594 | 594 | $data = DB::queryfirstrow( |
595 | 595 | 'SELECT personal_folder, bloquer_creation, bloquer_modification |
596 | - FROM ' . prefixTable('nested_tree') . ' |
|
596 | + FROM ' . prefixTable('nested_tree').' |
|
597 | 597 | WHERE id = %i', |
598 | 598 | $post_parent_id |
599 | 599 | ); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | // get complexity level for this folder |
623 | 623 | $data = DB::queryfirstrow( |
624 | 624 | 'SELECT valeur |
625 | - FROM ' . prefixTable('misc') . ' |
|
625 | + FROM ' . prefixTable('misc').' |
|
626 | 626 | WHERE intitule = %i AND type = %s', |
627 | 627 | $post_parent_id, |
628 | 628 | 'complex' |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | array( |
634 | 634 | 'error' => true, |
635 | 635 | 'message' => langHdl('error_folder_complexity_lower_than_top_folder') |
636 | - . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]', |
|
636 | + . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]', |
|
637 | 637 | ), |
638 | 638 | 'encode' |
639 | 639 | ); |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | && (int) $SETTINGS['subfolder_rights_as_parent'] === 1 |
708 | 708 | ) { |
709 | 709 | //If it is a subfolder, then give access to it for all roles that allows the parent folder |
710 | - $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id); |
|
710 | + $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id); |
|
711 | 711 | foreach ($rows as $record) { |
712 | 712 | //add access to this subfolder |
713 | 713 | DB::insert( |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | } |
723 | 723 | |
724 | 724 | // if parent folder has Custom Fields Categories then add to this child one too |
725 | - $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id); |
|
725 | + $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id); |
|
726 | 726 | foreach ($rows as $record) { |
727 | 727 | //add CF Category to this subfolder |
728 | 728 | DB::insert( |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | |
778 | 778 | // decrypt and retrieve data in JSON format |
779 | 779 | $dataReceived = prepareExchangedData( |
780 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
780 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
781 | 781 | |
782 | 782 | // prepare variables |
783 | 783 | $post_folders = filter_var_array( |
@@ -803,17 +803,17 @@ discard block |
||
803 | 803 | prefixTable('misc'), |
804 | 804 | array( |
805 | 805 | 'type' => 'folder_deleted', |
806 | - 'intitule' => 'f' . $folder->id, |
|
807 | - 'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' . |
|
808 | - $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' . |
|
809 | - $folder->nlevel . ', 0, 0, 0, 0', |
|
806 | + 'intitule' => 'f'.$folder->id, |
|
807 | + 'valeur' => $folder->id.', '.$folder->parent_id.', '. |
|
808 | + $folder->title.', '.$folder->nleft.', '.$folder->nright.', '. |
|
809 | + $folder->nlevel.', 0, 0, 0, 0', |
|
810 | 810 | ) |
811 | 811 | ); |
812 | 812 | //array for delete folder |
813 | 813 | $folderForDel[] = $folder->id; |
814 | 814 | |
815 | 815 | //delete items & logs |
816 | - $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id); |
|
816 | + $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id); |
|
817 | 817 | foreach ($items as $item) { |
818 | 818 | DB::update( |
819 | 819 | prefixTable('items'), |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $tree->rebuild(); |
871 | 871 | |
872 | 872 | // reload cache table |
873 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
873 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
874 | 874 | updateCacheTable('reload', $SETTINGS, null); |
875 | 875 | |
876 | 876 | echo prepareExchangedData( |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | |
911 | 911 | // decrypt and retrieve data in JSON format |
912 | 912 | $dataReceived = prepareExchangedData( |
913 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
913 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
914 | 914 | |
915 | 915 | // Init post variables |
916 | 916 | $post_source_folder_id = filter_var($dataReceived['source_folder_id'], FILTER_SANITIZE_NUMBER_INT); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | // get complexity of current node |
962 | 962 | $nodeComplexity = DB::queryfirstrow( |
963 | 963 | 'SELECT valeur |
964 | - FROM ' . prefixTable('misc') . ' |
|
964 | + FROM ' . prefixTable('misc').' |
|
965 | 965 | WHERE intitule = %i AND type= %s', |
966 | 966 | $nodeInfo->id, |
967 | 967 | 'complex' |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | // If it is a subfolder, then give access to it for all roles that allows the parent folder |
1037 | 1037 | $rows = DB::query( |
1038 | 1038 | 'SELECT role_id, type |
1039 | - FROM ' . prefixTable('roles_values') . ' |
|
1039 | + FROM ' . prefixTable('roles_values').' |
|
1040 | 1040 | WHERE folder_id = %i', |
1041 | 1041 | $parentId |
1042 | 1042 | ); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | // Add access to this subfolder after checking that it is not already set |
1045 | 1045 | DB::query( |
1046 | 1046 | 'SELECT * |
1047 | - FROM ' . prefixTable('roles_values') . ' |
|
1047 | + FROM ' . prefixTable('roles_values').' |
|
1048 | 1048 | WHERE folder_id = %i AND role_id = %i', |
1049 | 1049 | $newFolderId, |
1050 | 1050 | $record['role_id'] |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | // if parent folder has Custom Fields Categories then add to this child one too |
1065 | 1065 | $rows = DB::query( |
1066 | 1066 | 'SELECT id_category |
1067 | - FROM ' . prefixTable('categories_folders') . ' |
|
1067 | + FROM ' . prefixTable('categories_folders').' |
|
1068 | 1068 | WHERE id_folder = %i', |
1069 | 1069 | $nodeInfo->id |
1070 | 1070 | ); |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | $rows = DB::query( |
1085 | 1085 | 'SELECT * |
1086 | - FROM ' . prefixTable('items') . ' |
|
1086 | + FROM ' . prefixTable('items').' |
|
1087 | 1087 | WHERE id_tree = %i', |
1088 | 1088 | $nodeInfo->id |
1089 | 1089 | ); |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | // if it is then don't copy it |
1093 | 1093 | $item_deleted = DB::queryFirstRow( |
1094 | 1094 | 'SELECT * |
1095 | - FROM ' . prefixTable('log_items') . ' |
|
1095 | + FROM ' . prefixTable('log_items').' |
|
1096 | 1096 | WHERE id_item = %i AND action = %s |
1097 | 1097 | ORDER BY date DESC |
1098 | 1098 | LIMIT 0, 1', |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | |
1104 | 1104 | $item_restored = DB::queryFirstRow( |
1105 | 1105 | 'SELECT * |
1106 | - FROM ' . prefixTable('log_items') . ' |
|
1106 | + FROM ' . prefixTable('log_items').' |
|
1107 | 1107 | WHERE id_item = %i AND action = %s |
1108 | 1108 | ORDER BY date DESC |
1109 | 1109 | LIMIT 0, 1', |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | // Get the ITEM object key for the user |
1119 | 1119 | $userKey = DB::queryFirstRow( |
1120 | 1120 | 'SELECT share_key |
1121 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
1121 | + FROM ' . prefixTable('sharekeys_items').' |
|
1122 | 1122 | WHERE user_id = %i AND object_id = %i', |
1123 | 1123 | $_SESSION['user_id'], |
1124 | 1124 | $record['id'] |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | // Manage Custom Fields |
1194 | 1194 | $categories = DB::query( |
1195 | 1195 | 'SELECT * |
1196 | - FROM ' . prefixTable('categories_items') . ' |
|
1196 | + FROM ' . prefixTable('categories_items').' |
|
1197 | 1197 | WHERE item_id = %i', |
1198 | 1198 | $record['id'] |
1199 | 1199 | ); |
@@ -1241,15 +1241,15 @@ discard block |
||
1241 | 1241 | $files = DB::query( |
1242 | 1242 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension, |
1243 | 1243 | f.size AS size, f.type AS type, s.share_key AS share_key |
1244 | - FROM ' . prefixTable('files') . ' AS f |
|
1245 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
1244 | + FROM ' . prefixTable('files').' AS f |
|
1245 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
1246 | 1246 | WHERE s.user_id = %i AND f.id_item = %i', |
1247 | 1247 | $_SESSION['user_id'], |
1248 | 1248 | $record['id'] |
1249 | 1249 | ); |
1250 | 1250 | foreach ($files as $file) { |
1251 | 1251 | // Check if file still exists |
1252 | - if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) { |
|
1252 | + if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) { |
|
1253 | 1253 | // Step1 - decrypt the file |
1254 | 1254 | $fileContent = decryptFile( |
1255 | 1255 | $file['file'], |
@@ -1258,9 +1258,9 @@ discard block |
||
1258 | 1258 | ); |
1259 | 1259 | |
1260 | 1260 | // Step2 - create file |
1261 | - $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension']; |
|
1261 | + $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension']; |
|
1262 | 1262 | |
1263 | - $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab'); |
|
1263 | + $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab'); |
|
1264 | 1264 | if ($outstream === false) { |
1265 | 1265 | echo prepareExchangedData( |
1266 | 1266 | $SETTINGS['cpassman_dir'], |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $tree->rebuild(); |
1337 | 1337 | |
1338 | 1338 | // reload cache table |
1339 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1339 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1340 | 1340 | updateCacheTable('reload', $SETTINGS, NULL); |
1341 | 1341 | |
1342 | 1342 | $data = array( |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | |
1346 | 1346 | // send data |
1347 | 1347 | echo prepareExchangedData( |
1348 | - $SETTINGS['cpassman_dir'],$data, 'encode'); |
|
1348 | + $SETTINGS['cpassman_dir'], $data, 'encode'); |
|
1349 | 1349 | |
1350 | 1350 | break; |
1351 | 1351 | |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | // Get path |
1402 | 1402 | $text = ''; |
1403 | 1403 | foreach ($tree->getPath($folder->id, false) as $fld) { |
1404 | - $text .= empty($text) === true ? ' [<i>' . $fld->title : ' > ' . $fld->title; |
|
1404 | + $text .= empty($text) === true ? ' [<i>'.$fld->title : ' > '.$fld->title; |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // Save array |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | 'id' => (int) $folder->id, |
1412 | 1412 | 'label' => $folder->title, |
1413 | 1413 | 'level' => $folder->nlevel, |
1414 | - 'path' => empty($text) === true ? '' : $text . '</i>]' |
|
1414 | + 'path' => empty($text) === true ? '' : $text.'</i>]' |
|
1415 | 1415 | ) |
1416 | 1416 | ); |
1417 | 1417 | } |
@@ -46,25 +46,25 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /* do checks */ |
49 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
50 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
49 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
50 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
51 | 51 | if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) { |
52 | 52 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
53 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
53 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
54 | 54 | exit; |
55 | 55 | } |
56 | 56 | |
57 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
59 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
57 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
59 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
60 | 60 | |
61 | 61 | header('Content-type: text/html; charset=utf-8'); |
62 | 62 | header('Cache-Control: no-cache, no-store, must-revalidate'); |
63 | 63 | |
64 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
64 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
65 | 65 | |
66 | 66 | // connect to the server |
67 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
67 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
68 | 68 | if (defined('DB_PASSWD_CLEAR') === false) { |
69 | 69 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
70 | 70 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | array( |
118 | 118 | 'http' => array( |
119 | 119 | 'ignore_errors' => true, |
120 | - 'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'], |
|
120 | + 'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'], |
|
121 | 121 | ), |
122 | 122 | ) |
123 | 123 | ); |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | $json_array = json_decode($json, true); |
137 | 137 | |
138 | 138 | // About version |
139 | - $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL; |
|
139 | + $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL; |
|
140 | 140 | if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) { |
141 | - $text .= ' <b>' . $LANG['please_update'] . '</b>'; |
|
141 | + $text .= ' <b>'.$LANG['please_update'].'</b>'; |
|
142 | 142 | } |
143 | 143 | $text .= '</li>'; |
144 | 144 | |
145 | 145 | // Libraries |
146 | 146 | $text .= '<li><u>Libraries</u> :</li>'; |
147 | 147 | foreach ($json_array['libraries'] as $key => $val) { |
148 | - $text .= "<li> <span class='fa fa-caret-right'></span> " . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>'; |
|
148 | + $text .= "<li> <span class='fa fa-caret-right'></span> ".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>'; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | $text .= '</ul>'; |
158 | 158 | |
159 | - echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]'; |
|
159 | + echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]'; |
|
160 | 160 | break; |
161 | 161 | |
162 | 162 | //########################################################## |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | //get through all users |
191 | 191 | $rows = DB::query( |
192 | 192 | 'SELECT id, login, email |
193 | - FROM ' . prefixTable('users') . ' |
|
193 | + FROM ' . prefixTable('users').' |
|
194 | 194 | ORDER BY login ASC' |
195 | 195 | ); |
196 | 196 | foreach ($rows as $record) { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | //if folder doesn't exist then create it |
208 | 208 | $data = DB::queryfirstrow( |
209 | 209 | 'SELECT id |
210 | - FROM ' . prefixTable('nested_tree') . ' |
|
210 | + FROM ' . prefixTable('nested_tree').' |
|
211 | 211 | WHERE title = %s AND parent_id = %i', |
212 | 212 | $record['id'], |
213 | 213 | 0 |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | $SETTINGS['cpassman_dir'], |
271 | 271 | array( |
272 | 272 | 'error' => false, |
273 | - 'message' => langHdl('last_execution') . ' ' . |
|
274 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
273 | + 'message' => langHdl('last_execution').' '. |
|
274 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
275 | 275 | '<i class="fas fa-check text-success ml-2"></i>', |
276 | 276 | ), |
277 | 277 | 'encode' |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | //Libraries call |
310 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
310 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
311 | 311 | |
312 | 312 | //init |
313 | 313 | $foldersIds = array(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | - $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds); |
|
324 | + $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds); |
|
325 | 325 | foreach ($items as $item) { |
326 | 326 | //Delete item |
327 | 327 | DB::DELETE(prefixTable('items'), 'id = %i', $item['id']); |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | // delete orphan items |
343 | 343 | $rows = DB::query( |
344 | 344 | 'SELECT id |
345 | - FROM ' . prefixTable('items') . ' |
|
345 | + FROM ' . prefixTable('items').' |
|
346 | 346 | ORDER BY id ASC' |
347 | 347 | ); |
348 | 348 | foreach ($rows as $item) { |
349 | 349 | DB::query( |
350 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
350 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
351 | 351 | $item['id'], |
352 | 352 | 'at_creation' |
353 | 353 | ); |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | $SETTINGS['cpassman_dir'], |
379 | 379 | array( |
380 | 380 | 'error' => false, |
381 | - 'message' => langHdl('last_execution') . ' ' . |
|
382 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
381 | + 'message' => langHdl('last_execution').' '. |
|
382 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
383 | 383 | '<i class="fas fa-check text-success ml-2 mr-3"></i> |
384 | 384 | <i class="fas fa-chevron-right mr-2"></i>' . |
385 | - $nbItemsDeleted . ' ' . langHdl('deleted_items'), |
|
385 | + $nbItemsDeleted.' '.langHdl('deleted_items'), |
|
386 | 386 | ), |
387 | 387 | 'encode' |
388 | 388 | ); |
@@ -416,21 +416,21 @@ discard block |
||
416 | 416 | break; |
417 | 417 | } |
418 | 418 | |
419 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
419 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
420 | 420 | $return = ''; |
421 | 421 | |
422 | 422 | //Get all tables |
423 | 423 | $tables = array(); |
424 | 424 | $result = DB::query('SHOW TABLES'); |
425 | 425 | foreach ($result as $row) { |
426 | - $tables[] = $row['Tables_in_' . $database]; |
|
426 | + $tables[] = $row['Tables_in_'.$database]; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | //cycle through |
430 | 430 | foreach ($tables as $table) { |
431 | 431 | if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) { |
432 | 432 | // Do query |
433 | - $result = DB::queryRaw('SELECT * FROM ' . $table); |
|
433 | + $result = DB::queryRaw('SELECT * FROM '.$table); |
|
434 | 434 | DB::queryRaw( |
435 | 435 | 'SELECT * |
436 | 436 | FROM INFORMATION_SCHEMA.COLUMNS |
@@ -442,19 +442,19 @@ discard block |
||
442 | 442 | $numFields = DB::count(); |
443 | 443 | |
444 | 444 | // prepare a drop table |
445 | - $return .= 'DROP TABLE ' . $table . ';'; |
|
446 | - $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table); |
|
447 | - $return .= "\n\n" . $row2['Create Table'] . ";\n\n"; |
|
445 | + $return .= 'DROP TABLE '.$table.';'; |
|
446 | + $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table); |
|
447 | + $return .= "\n\n".$row2['Create Table'].";\n\n"; |
|
448 | 448 | |
449 | 449 | //prepare all fields and datas |
450 | 450 | for ($i = 0; $i < $numFields; ++$i) { |
451 | 451 | while ($row = $result->fetch_row()) { |
452 | - $return .= 'INSERT INTO ' . $table . ' VALUES('; |
|
452 | + $return .= 'INSERT INTO '.$table.' VALUES('; |
|
453 | 453 | for ($j = 0; $j < $numFields; ++$j) { |
454 | 454 | $row[$j] = addslashes($row[$j]); |
455 | 455 | $row[$j] = preg_replace("/\n/", '\\n', $row[$j]); |
456 | 456 | if (isset($row[$j])) { |
457 | - $return .= '"' . $row[$j] . '"'; |
|
457 | + $return .= '"'.$row[$j].'"'; |
|
458 | 458 | } else { |
459 | 459 | $return .= 'NULL'; |
460 | 460 | } |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS); |
475 | 475 | |
476 | 476 | //save file |
477 | - $filename = time() . '-' . $token . '.sql'; |
|
478 | - $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+'); |
|
477 | + $filename = time().'-'.$token.'.sql'; |
|
478 | + $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+'); |
|
479 | 479 | if ($handle !== false) { |
480 | 480 | //write file |
481 | 481 | fwrite($handle, $return); |
@@ -487,17 +487,17 @@ discard block |
||
487 | 487 | // Encrypt the file |
488 | 488 | prepareFileWithDefuse( |
489 | 489 | 'encrypt', |
490 | - $SETTINGS['path_to_files_folder'] . '/' . $filename, |
|
491 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
490 | + $SETTINGS['path_to_files_folder'].'/'.$filename, |
|
491 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
492 | 492 | $SETTINGS, |
493 | 493 | $post_option |
494 | 494 | ); |
495 | 495 | |
496 | 496 | // Do clean |
497 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $filename); |
|
497 | + unlink($SETTINGS['path_to_files_folder'].'/'.$filename); |
|
498 | 498 | rename( |
499 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
500 | - $SETTINGS['path_to_files_folder'] . '/' . $filename |
|
499 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
500 | + $SETTINGS['path_to_files_folder'].'/'.$filename |
|
501 | 501 | ); |
502 | 502 | } |
503 | 503 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | //update LOG |
508 | 508 | logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']); |
509 | 509 | |
510 | - echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]'; |
|
510 | + echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]'; |
|
511 | 511 | } |
512 | 512 | break; |
513 | 513 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | ); |
539 | 539 | break; |
540 | 540 | } |
541 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
541 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
542 | 542 | |
543 | 543 | $dataPost = explode('&', $post_option); |
544 | 544 | $file = htmlspecialchars($dataPost[0]); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | // Get filename from database |
548 | 548 | $data = DB::queryFirstRow( |
549 | 549 | 'SELECT valeur |
550 | - FROM ' . prefixTable('misc') . ' |
|
550 | + FROM ' . prefixTable('misc').' |
|
551 | 551 | WHERE increment_id = %i', |
552 | 552 | $file |
553 | 553 | ); |
@@ -566,22 +566,22 @@ discard block |
||
566 | 566 | // Decrypt the file |
567 | 567 | $ret = prepareFileWithDefuse( |
568 | 568 | 'decrypt', |
569 | - $SETTINGS['path_to_files_folder'] . '/' . $file, |
|
570 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file, |
|
569 | + $SETTINGS['path_to_files_folder'].'/'.$file, |
|
570 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file, |
|
571 | 571 | $SETTINGS, |
572 | 572 | $key |
573 | 573 | ); |
574 | 574 | |
575 | 575 | if (empty($ret) === false) { |
576 | - echo '[{"result":"db_restore" , "message":"' . $ret . '"}]'; |
|
576 | + echo '[{"result":"db_restore" , "message":"'.$ret.'"}]'; |
|
577 | 577 | break; |
578 | 578 | } |
579 | 579 | |
580 | 580 | // Do clean |
581 | - fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS); |
|
582 | - $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file; |
|
581 | + fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS); |
|
582 | + $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file; |
|
583 | 583 | } else { |
584 | - $file = $SETTINGS['path_to_files_folder'] . '/' . $file; |
|
584 | + $file = $SETTINGS['path_to_files_folder'].'/'.$file; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | //read sql file |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | fclose($handle); |
599 | 599 | |
600 | 600 | //delete file |
601 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $file); |
|
601 | + unlink($SETTINGS['path_to_files_folder'].'/'.$file); |
|
602 | 602 | |
603 | 603 | //Show done |
604 | 604 | echo '[{"result":"db_restore" , "message":""}]'; |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | foreach ($table as $i => $tablename) { |
639 | 639 | if (substr_count($tablename, DB_PREFIX) > 0) { |
640 | 640 | // launch optimization quieries |
641 | - DB::query('ANALYZE TABLE `' . $tablename . '`'); |
|
642 | - DB::query('OPTIMIZE TABLE `' . $tablename . '`'); |
|
641 | + DB::query('ANALYZE TABLE `'.$tablename.'`'); |
|
642 | + DB::query('OPTIMIZE TABLE `'.$tablename.'`'); |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | } |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | //Clean up LOG_ITEMS table |
648 | 648 | $rows = DB::query( |
649 | 649 | 'SELECT id |
650 | - FROM ' . prefixTable('items') . ' |
|
650 | + FROM ' . prefixTable('items').' |
|
651 | 651 | ORDER BY id ASC' |
652 | 652 | ); |
653 | 653 | foreach ($rows as $item) { |
654 | 654 | DB::query( |
655 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
655 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
656 | 656 | $item['id'], |
657 | 657 | 'at_creation' |
658 | 658 | ); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | if ($counter === 0) { |
661 | 661 | //Create new at_creation entry |
662 | 662 | $rowTmp = DB::queryFirstRow( |
663 | - 'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC', |
|
663 | + 'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC', |
|
664 | 664 | $item['id'] |
665 | 665 | ); |
666 | 666 | DB::insert( |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | $SETTINGS['cpassman_dir'], |
692 | 692 | array( |
693 | 693 | 'error' => false, |
694 | - 'message' => langHdl('last_execution') . ' ' . |
|
695 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
694 | + 'message' => langHdl('last_execution').' '. |
|
695 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
696 | 696 | '<i class="fas fa-check text-success ml-2"></i>', |
697 | 697 | ), |
698 | 698 | 'encode' |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | break; |
728 | 728 | } |
729 | 729 | |
730 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
730 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
731 | 731 | |
732 | 732 | //read folder |
733 | 733 | if (is_dir($SETTINGS['path_to_files_folder']) === false) { |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $SETTINGS['cpassman_dir'], |
736 | 736 | array( |
737 | 737 | 'error' => true, |
738 | - 'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'], |
|
738 | + 'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'], |
|
739 | 739 | ), |
740 | 740 | 'encode' |
741 | 741 | ); |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | //delete file FILES |
748 | 748 | while (false !== ($f = readdir($dir))) { |
749 | 749 | if ($f !== '.' && $f !== '..' && $f !== '.htaccess') { |
750 | - if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) { |
|
751 | - fileDelete($dir . '/' . $f, $SETTINGS); |
|
750 | + if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) { |
|
751 | + fileDelete($dir.'/'.$f, $SETTINGS); |
|
752 | 752 | } |
753 | 753 | } |
754 | 754 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $SETTINGS['cpassman_dir'], |
764 | 764 | array( |
765 | 765 | 'error' => true, |
766 | - 'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'], |
|
766 | + 'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'], |
|
767 | 767 | ), |
768 | 768 | 'encode' |
769 | 769 | ); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | while (false !== ($f = readdir($dir))) { |
778 | 778 | if ($f !== '.' && $f !== '..') { |
779 | 779 | if (strpos($f, '_delete.') > 0) { |
780 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS); |
|
780 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS); |
|
781 | 781 | } |
782 | 782 | } |
783 | 783 | } |
@@ -800,11 +800,11 @@ discard block |
||
800 | 800 | $SETTINGS['cpassman_dir'], |
801 | 801 | array( |
802 | 802 | 'error' => false, |
803 | - 'message' => langHdl('last_execution') . ' ' . |
|
804 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
803 | + 'message' => langHdl('last_execution').' '. |
|
804 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
805 | 805 | '<i class="fas fa-check text-success ml-2 mr-3"></i> |
806 | 806 | <i class="fas fa-chevron-right mr-2"></i>' . |
807 | - $nbItemsDeleted . ' ' . langHdl('deleted_items'), |
|
807 | + $nbItemsDeleted.' '.langHdl('deleted_items'), |
|
808 | 808 | ), |
809 | 809 | 'encode' |
810 | 810 | ); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | break; |
840 | 840 | } |
841 | 841 | |
842 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
842 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
843 | 843 | updateCacheTable('reload', $SETTINGS, NULL); |
844 | 844 | |
845 | 845 | // Log |
@@ -856,8 +856,8 @@ discard block |
||
856 | 856 | $SETTINGS['cpassman_dir'], |
857 | 857 | [ |
858 | 858 | 'error' => false, |
859 | - 'message' => langHdl('last_execution') . ' ' . |
|
860 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
859 | + 'message' => langHdl('last_execution').' '. |
|
860 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
861 | 861 | '<i class="fas fa-check text-success mr-2"></i>', |
862 | 862 | ], |
863 | 863 | 'encode' |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | } |
895 | 895 | |
896 | 896 | // Perform |
897 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
897 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
898 | 898 | $ret = handleConfigFile('rebuild', $SETTINGS); |
899 | 899 | |
900 | 900 | // Log |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | $SETTINGS['cpassman_dir'], |
924 | 924 | array( |
925 | 925 | 'error' => false, |
926 | - 'message' => langHdl('last_execution') . ' ' . |
|
927 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
926 | + 'message' => langHdl('last_execution').' '. |
|
927 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
928 | 928 | '<i class="fas fa-check text-success ml-2"></i>', |
929 | 929 | ), |
930 | 930 | 'encode' |
@@ -966,33 +966,33 @@ discard block |
||
966 | 966 | $filename = $post_option; |
967 | 967 | $tp_settings = []; |
968 | 968 | //get backups infos |
969 | - $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin'); |
|
969 | + $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin'); |
|
970 | 970 | foreach ($rows as $record) { |
971 | 971 | $tp_settings[$record['intitule']] = $record['valeur']; |
972 | 972 | } |
973 | 973 | |
974 | 974 | // check if backup file is in DB. |
975 | 975 | // If YES then it is encrypted with DEFUSE |
976 | - $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename'); |
|
976 | + $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename'); |
|
977 | 977 | |
978 | 978 | //read file |
979 | 979 | $return = ''; |
980 | - $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql'; |
|
980 | + $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql'; |
|
981 | 981 | if (file_exists($Fnm)) { |
982 | 982 | if (!empty($bck) && $bck['valeur'] === $filename) { |
983 | 983 | $err = ''; |
984 | 984 | |
985 | 985 | // it means that file is DEFUSE encrypted |
986 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
987 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
988 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
989 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php'; |
|
990 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php'; |
|
986 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
987 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
988 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
989 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php'; |
|
990 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php'; |
|
991 | 991 | |
992 | 992 | try { |
993 | 993 | \Defuse\Crypto\File::decryptFileWithPassword( |
994 | - $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql', |
|
995 | - $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql', |
|
994 | + $SETTINGS['bck_script_path'].'/'.$post_option.'.sql', |
|
995 | + $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql', |
|
996 | 996 | base64_decode($SETTINGS['bck_script_key']) |
997 | 997 | ); |
998 | 998 | } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) { |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | if (!empty($err)) { |
1003 | - echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]'; |
|
1003 | + echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]'; |
|
1004 | 1004 | break; |
1005 | 1005 | } |
1006 | 1006 | } else { |
@@ -1022,19 +1022,19 @@ discard block |
||
1022 | 1022 | ); |
1023 | 1023 | |
1024 | 1024 | //save the file |
1025 | - $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+'); |
|
1025 | + $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+'); |
|
1026 | 1026 | if ($handle !== false) { |
1027 | 1027 | fwrite($handle, $return); |
1028 | 1028 | fclose($handle); |
1029 | 1029 | } |
1030 | 1030 | } |
1031 | 1031 | $result = 'backup_decrypt_success'; |
1032 | - $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql'; |
|
1032 | + $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql'; |
|
1033 | 1033 | } else { |
1034 | 1034 | $result = 'backup_decrypt_fails'; |
1035 | - $msg = 'File not found: ' . $Fnm; |
|
1035 | + $msg = 'File not found: '.$Fnm; |
|
1036 | 1036 | } |
1037 | - echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]'; |
|
1037 | + echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]'; |
|
1038 | 1038 | break; |
1039 | 1039 | |
1040 | 1040 | /* |
@@ -1070,22 +1070,22 @@ discard block |
||
1070 | 1070 | require_once 'main.functions.php'; |
1071 | 1071 | |
1072 | 1072 | // store old sk |
1073 | - $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
1073 | + $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
1074 | 1074 | |
1075 | 1075 | // generate new saltkey |
1076 | - $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time(); |
|
1076 | + $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time(); |
|
1077 | 1077 | copy( |
1078 | - SECUREPATH . '/teampass-seckey.txt', |
|
1078 | + SECUREPATH.'/teampass-seckey.txt', |
|
1079 | 1079 | $old_sk_filename |
1080 | 1080 | ); |
1081 | 1081 | $new_key = defuse_generate_key(); |
1082 | 1082 | file_put_contents( |
1083 | - SECUREPATH . '/teampass-seckey.txt', |
|
1083 | + SECUREPATH.'/teampass-seckey.txt', |
|
1084 | 1084 | $new_key |
1085 | 1085 | ); |
1086 | 1086 | |
1087 | 1087 | // store new sk |
1088 | - $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
1088 | + $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
1089 | 1089 | |
1090 | 1090 | //put tool in maintenance. |
1091 | 1091 | DB::update( |
@@ -1101,13 +1101,13 @@ discard block |
||
1101 | 1101 | logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']); |
1102 | 1102 | |
1103 | 1103 | // get number of items to change |
1104 | - DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0); |
|
1104 | + DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0); |
|
1105 | 1105 | $nb_of_items = DB::count(); |
1106 | 1106 | |
1107 | 1107 | // create backup table |
1108 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1108 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1109 | 1109 | DB::query( |
1110 | - 'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` ( |
|
1110 | + 'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` ( |
|
1111 | 1111 | `id` int(12) NOT null AUTO_INCREMENT, |
1112 | 1112 | `current_table` varchar(100) NOT NULL, |
1113 | 1113 | `current_field` varchar(500) NOT NULL, |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | ); |
1136 | 1136 | |
1137 | 1137 | // delete previous backup files |
1138 | - $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names |
|
1138 | + $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names |
|
1139 | 1139 | foreach ($files as $file) { // iterate files |
1140 | 1140 | if (is_file($file)) { |
1141 | 1141 | $file_parts = pathinfo($file); |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | $SETTINGS['cpassman_dir'], |
1223 | 1223 | array( |
1224 | 1224 | 'error' => true, |
1225 | - 'message' => 'Input `' . $objects[0] . '` is not allowed', |
|
1225 | + 'message' => 'Input `'.$objects[0].'` is not allowed', |
|
1226 | 1226 | 'nbOfItems' => '', |
1227 | 1227 | 'nextAction' => '', |
1228 | 1228 | ), |
@@ -1235,9 +1235,9 @@ discard block |
||
1235 | 1235 | //change all encrypted data in Items (passwords) |
1236 | 1236 | $rows = DB::query( |
1237 | 1237 | 'SELECT id, pw, pw_iv |
1238 | - FROM ' . prefixTable('items') . ' |
|
1238 | + FROM ' . prefixTable('items').' |
|
1239 | 1239 | WHERE perso = %s |
1240 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
1240 | + LIMIT ' . $post_start.', '.$post_length, |
|
1241 | 1241 | '0' |
1242 | 1242 | ); |
1243 | 1243 | foreach ($rows as $record) { |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | 'current_field' => 'pw', |
1250 | 1250 | 'value_id' => $record['id'], |
1251 | 1251 | 'value' => $record['pw'], |
1252 | - 'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';", |
|
1252 | + 'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';", |
|
1253 | 1253 | 'value2' => 'none', |
1254 | 1254 | 'result' => 'none', |
1255 | 1255 | ) |
@@ -1298,9 +1298,9 @@ discard block |
||
1298 | 1298 | //change all encrypted data in Logs (passwords) |
1299 | 1299 | $rows = DB::query( |
1300 | 1300 | 'SELECT raison, increment_id |
1301 | - FROM ' . prefixTable('log_items') . " |
|
1301 | + FROM ' . prefixTable('log_items')." |
|
1302 | 1302 | WHERE action = %s AND raison LIKE 'at_pw :%' |
1303 | - LIMIT " . $post_start . ', ' . $post_length, |
|
1303 | + LIMIT " . $post_start.', '.$post_length, |
|
1304 | 1304 | 'at_modification' |
1305 | 1305 | ); |
1306 | 1306 | foreach ($rows as $record) { |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | 'current_field' => 'raison', |
1313 | 1313 | 'value_id' => $record['increment_id'], |
1314 | 1314 | 'value' => $record['raison'], |
1315 | - 'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';", |
|
1315 | + 'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';", |
|
1316 | 1316 | 'value2' => 'none', |
1317 | 1317 | 'result' => 'none', |
1318 | 1318 | ) |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | DB::update( |
1341 | 1341 | prefixTable('log_items'), |
1342 | 1342 | array( |
1343 | - 'raison' => 'at_pw :' . $encrypt['string'], |
|
1343 | + 'raison' => 'at_pw :'.$encrypt['string'], |
|
1344 | 1344 | 'encryption_type' => 'defuse', |
1345 | 1345 | ), |
1346 | 1346 | 'increment_id = %i', |
@@ -1365,8 +1365,8 @@ discard block |
||
1365 | 1365 | //change all encrypted data in CATEGORIES (passwords) |
1366 | 1366 | $rows = DB::query( |
1367 | 1367 | 'SELECT id, data |
1368 | - FROM ' . prefixTable('categories_items') . ' |
|
1369 | - LIMIT ' . $post_start . ', ' . $post_length |
|
1368 | + FROM ' . prefixTable('categories_items').' |
|
1369 | + LIMIT ' . $post_start.', '.$post_length |
|
1370 | 1370 | ); |
1371 | 1371 | foreach ($rows as $record) { |
1372 | 1372 | // backup data |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | 'current_field' => 'data', |
1378 | 1378 | 'value_id' => $record['id'], |
1379 | 1379 | 'value' => $record['data'], |
1380 | - 'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';", |
|
1380 | + 'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';", |
|
1381 | 1381 | 'value2' => 'none', |
1382 | 1382 | 'result' => 'none', |
1383 | 1383 | ) |
@@ -1425,9 +1425,9 @@ discard block |
||
1425 | 1425 | // Change all encrypted data in FILES (passwords) |
1426 | 1426 | $rows = DB::query( |
1427 | 1427 | 'SELECT id, file, status |
1428 | - FROM ' . prefixTable('files') . " |
|
1428 | + FROM ' . prefixTable('files')." |
|
1429 | 1429 | WHERE status = 'encrypted' |
1430 | - LIMIT " . $post_start . ', ' . $post_length |
|
1430 | + LIMIT " . $post_start.', '.$post_length |
|
1431 | 1431 | ); |
1432 | 1432 | foreach ($rows as $record) { |
1433 | 1433 | // backup data |
@@ -1445,20 +1445,20 @@ discard block |
||
1445 | 1445 | ); |
1446 | 1446 | $newID = DB::insertId(); |
1447 | 1447 | |
1448 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
1448 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
1449 | 1449 | // make a copy of file |
1450 | 1450 | if (!copy( |
1451 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1452 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy' |
|
1451 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1452 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy' |
|
1453 | 1453 | )) { |
1454 | 1454 | $error = 'Copy not possible'; |
1455 | 1455 | exit; |
1456 | 1456 | } else { |
1457 | 1457 | // prepare a bck of file (that will not be deleted) |
1458 | - $backup_filename = $record['file'] . '.bck-change-sk.' . time(); |
|
1458 | + $backup_filename = $record['file'].'.bck-change-sk.'.time(); |
|
1459 | 1459 | copy( |
1460 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1461 | - $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename |
|
1460 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1461 | + $SETTINGS['path_to_upload_folder'].'/'.$backup_filename |
|
1462 | 1462 | ); |
1463 | 1463 | } |
1464 | 1464 | |
@@ -1466,24 +1466,24 @@ discard block |
||
1466 | 1466 | // STEP1 - Do decryption |
1467 | 1467 | prepareFileWithDefuse( |
1468 | 1468 | 'decrypt', |
1469 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1470 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
1469 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1470 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
1471 | 1471 | $SETTINGS |
1472 | 1472 | ); |
1473 | 1473 | |
1474 | 1474 | // Do cleanup of files |
1475 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']); |
|
1475 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']); |
|
1476 | 1476 | |
1477 | 1477 | // STEP2 - Do encryption |
1478 | 1478 | prepareFileWithDefuse( |
1479 | 1479 | 'encryp', |
1480 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
1481 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
1480 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
1481 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
1482 | 1482 | $SETTINGS |
1483 | 1483 | ); |
1484 | 1484 | |
1485 | 1485 | // Do cleanup of files |
1486 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'); |
|
1486 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'); |
|
1487 | 1487 | |
1488 | 1488 | // Update backup table |
1489 | 1489 | DB::update( |
@@ -1509,13 +1509,13 @@ discard block |
||
1509 | 1509 | // do some things for new object |
1510 | 1510 | if (isset($objects[0])) { |
1511 | 1511 | if ($objects[0] === 'logs') { |
1512 | - DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1512 | + DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1513 | 1513 | } elseif ($objects[0] === 'files') { |
1514 | - DB::query('SELECT id FROM ' . prefixTable('files')); |
|
1514 | + DB::query('SELECT id FROM '.prefixTable('files')); |
|
1515 | 1515 | } elseif ($objects[0] === 'categories') { |
1516 | - DB::query('SELECT id FROM ' . prefixTable('categories_items')); |
|
1516 | + DB::query('SELECT id FROM '.prefixTable('categories_items')); |
|
1517 | 1517 | } elseif ($objects[0] === 'custfields') { |
1518 | - DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1518 | + DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
1519 | 1519 | } |
1520 | 1520 | $nb_of_items = DB::count(); |
1521 | 1521 | } else { |
@@ -1640,12 +1640,12 @@ discard block |
||
1640 | 1640 | ); |
1641 | 1641 | } elseif ($record['current_table'] === 'files') { |
1642 | 1642 | // restore backup file |
1643 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) { |
|
1644 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']); |
|
1645 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1643 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) { |
|
1644 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']); |
|
1645 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1646 | 1646 | rename( |
1647 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'], |
|
1648 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value'] |
|
1647 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value2'], |
|
1648 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value'] |
|
1649 | 1649 | ); |
1650 | 1650 | } |
1651 | 1651 | } |
@@ -1656,15 +1656,15 @@ discard block |
||
1656 | 1656 | |
1657 | 1657 | // restore saltkey file |
1658 | 1658 | if (file_exists($previous_saltkey_filename)) { |
1659 | - unlink(SECUREPATH . '/teampass-seckey.txt'); |
|
1659 | + unlink(SECUREPATH.'/teampass-seckey.txt'); |
|
1660 | 1660 | rename( |
1661 | 1661 | $previous_saltkey_filename, |
1662 | - SECUREPATH . '/teampass-seckey.txt' |
|
1662 | + SECUREPATH.'/teampass-seckey.txt' |
|
1663 | 1663 | ); |
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | // drop table |
1667 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1667 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1668 | 1668 | |
1669 | 1669 | // Send back |
1670 | 1670 | echo prepareExchangedData( |
@@ -1710,17 +1710,17 @@ discard block |
||
1710 | 1710 | // delete files |
1711 | 1711 | $rows = DB::query( |
1712 | 1712 | 'SELECT value, value2 |
1713 | - FROM ' . prefixTable('sk_reencrypt_backup') . " |
|
1713 | + FROM ' . prefixTable('sk_reencrypt_backup')." |
|
1714 | 1714 | WHERE current_table = 'files'" |
1715 | 1715 | ); |
1716 | 1716 | foreach ($rows as $record) { |
1717 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1718 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']); |
|
1717 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1718 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']); |
|
1719 | 1719 | } |
1720 | 1720 | } |
1721 | 1721 | |
1722 | 1722 | // drop table |
1723 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1723 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1724 | 1724 | |
1725 | 1725 | echo '[{"status":"done"}]'; |
1726 | 1726 | break; |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | ); |
1755 | 1755 | break; |
1756 | 1756 | } else { |
1757 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1757 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1758 | 1758 | |
1759 | 1759 | //send email |
1760 | 1760 | sendEmail( |
@@ -1792,11 +1792,11 @@ discard block |
||
1792 | 1792 | break; |
1793 | 1793 | } |
1794 | 1794 | |
1795 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1795 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1796 | 1796 | |
1797 | 1797 | $rows = DB::query( |
1798 | 1798 | 'SELECT * |
1799 | - FROM ' . prefixTable('emails') . ' |
|
1799 | + FROM ' . prefixTable('emails').' |
|
1800 | 1800 | WHERE status = %s OR status = %s', |
1801 | 1801 | 'not_sent', |
1802 | 1802 | '' |
@@ -1883,9 +1883,9 @@ discard block |
||
1883 | 1883 | break; |
1884 | 1884 | } |
1885 | 1885 | |
1886 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1886 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1887 | 1887 | |
1888 | - $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1888 | + $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1889 | 1889 | foreach ($rows as $record) { |
1890 | 1890 | //send email |
1891 | 1891 | $ret = json_decode( |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | break; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1959 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1960 | 1960 | |
1961 | 1961 | // init |
1962 | 1962 | $filesList = array(); |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | FROM ' . prefixTable('files') |
1970 | 1970 | ); |
1971 | 1971 | foreach ($rows as $record) { |
1972 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
1972 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
1973 | 1973 | $addFile = false; |
1974 | 1974 | if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted') |
1975 | 1975 | || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear') |
@@ -2038,8 +2038,8 @@ discard block |
||
2038 | 2038 | $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING); |
2039 | 2039 | $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT); |
2040 | 2040 | |
2041 | - include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
2042 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
2041 | + include $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
2042 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
2043 | 2043 | |
2044 | 2044 | $cpt = 0; |
2045 | 2045 | $continu = true; |
@@ -2047,15 +2047,15 @@ discard block |
||
2047 | 2047 | $message = ''; |
2048 | 2048 | |
2049 | 2049 | // load PhpEncryption library |
2050 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
2051 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php'; |
|
2052 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
2053 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php'; |
|
2054 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
2055 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php'; |
|
2056 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php'; |
|
2057 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php'; |
|
2058 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php'; |
|
2050 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
2051 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php'; |
|
2052 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
2053 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php'; |
|
2054 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
2055 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php'; |
|
2056 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php'; |
|
2057 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php'; |
|
2058 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php'; |
|
2059 | 2059 | |
2060 | 2060 | // treat 10 files |
2061 | 2061 | foreach ($post_list as $file) { |
@@ -2063,35 +2063,35 @@ discard block |
||
2063 | 2063 | // Get file name |
2064 | 2064 | $file_info = DB::queryfirstrow( |
2065 | 2065 | 'SELECT file |
2066 | - FROM ' . prefixTable('files') . ' |
|
2066 | + FROM ' . prefixTable('files').' |
|
2067 | 2067 | WHERE id = %i', |
2068 | 2068 | $file |
2069 | 2069 | ); |
2070 | 2070 | |
2071 | 2071 | // skip file is Coherancey not respected |
2072 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) { |
|
2072 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) { |
|
2073 | 2073 | // Case where we want to decrypt |
2074 | 2074 | if ($post_option === 'decrypt') { |
2075 | 2075 | prepareFileWithDefuse( |
2076 | 2076 | 'decrypt', |
2077 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
2078 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
2077 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
2078 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
2079 | 2079 | $SETTINGS |
2080 | 2080 | ); |
2081 | 2081 | // Case where we want to encrypt |
2082 | 2082 | } elseif ($post_option === 'encrypt') { |
2083 | 2083 | prepareFileWithDefuse( |
2084 | 2084 | 'encrypt', |
2085 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
2086 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
2085 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
2086 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
2087 | 2087 | $SETTINGS |
2088 | 2088 | ); |
2089 | 2089 | } |
2090 | 2090 | // Do file cleanup |
2091 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS); |
|
2091 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS); |
|
2092 | 2092 | rename( |
2093 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
2094 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'] |
|
2093 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
2094 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'] |
|
2095 | 2095 | ); |
2096 | 2096 | |
2097 | 2097 | // store in DB |
@@ -2126,8 +2126,8 @@ discard block |
||
2126 | 2126 | $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted' |
2127 | 2127 | ); |
2128 | 2128 | |
2129 | - $message = langHdl('last_execution') . ' ' . |
|
2130 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
2129 | + $message = langHdl('last_execution').' '. |
|
2130 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
2131 | 2131 | '<i class="fas fa-check text-success ml-2 mr-3"></i>'; |
2132 | 2132 | } |
2133 | 2133 | |
@@ -2175,7 +2175,7 @@ discard block |
||
2175 | 2175 | |
2176 | 2176 | // decrypt and retrieve data in JSON format |
2177 | 2177 | $dataReceived = prepareExchangedData( |
2178 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2178 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2179 | 2179 | |
2180 | 2180 | $post_label = isset($dataReceived['label']) === true ? filter_var($dataReceived['label'], FILTER_SANITIZE_STRING) : ''; |
2181 | 2181 | $post_action = filter_var($dataReceived['action'], FILTER_SANITIZE_STRING); |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING); |
2218 | 2218 | |
2219 | 2219 | DB::query( |
2220 | - 'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i', |
|
2220 | + 'DELETE FROM '.prefixTable('api').' WHERE id = %i', |
|
2221 | 2221 | $post_id |
2222 | 2222 | ); |
2223 | 2223 | } |
@@ -2266,7 +2266,7 @@ discard block |
||
2266 | 2266 | |
2267 | 2267 | // decrypt and retrieve data in JSON format |
2268 | 2268 | $dataReceived = prepareExchangedData( |
2269 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2269 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2270 | 2270 | |
2271 | 2271 | $post_action = filter_var($dataReceived['action'], FILTER_SANITIZE_STRING); |
2272 | 2272 | |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | // Delete existing key |
2314 | 2314 | } elseif (null !== $post_action && $post_action === 'delete') { |
2315 | 2315 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING); |
2316 | - DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id); |
|
2316 | + DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id); |
|
2317 | 2317 | } |
2318 | 2318 | |
2319 | 2319 | echo prepareExchangedData( |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | |
2330 | 2330 | case 'save_api_status': |
2331 | 2331 | // Do query |
2332 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
2332 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
2333 | 2333 | $counter = DB::count(); |
2334 | 2334 | if ($counter === 0) { |
2335 | 2335 | DB::insert( |
@@ -2355,7 +2355,7 @@ discard block |
||
2355 | 2355 | break; |
2356 | 2356 | |
2357 | 2357 | case 'save_duo_status': |
2358 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo'); |
|
2358 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo'); |
|
2359 | 2359 | $counter = DB::count(); |
2360 | 2360 | if ($counter === 0) { |
2361 | 2361 | DB::insert( |
@@ -2395,12 +2395,12 @@ discard block |
||
2395 | 2395 | |
2396 | 2396 | // decrypt and retrieve data in JSON format |
2397 | 2397 | $dataReceived = prepareExchangedData( |
2398 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
2398 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
2399 | 2399 | // Store in DB |
2400 | 2400 | foreach ($dataReceived as $key => $value) { |
2401 | 2401 | DB::query( |
2402 | 2402 | 'SELECT * |
2403 | - FROM ' . prefixTable('misc') . ' |
|
2403 | + FROM ' . prefixTable('misc').' |
|
2404 | 2404 | WHERE type = %s AND intitule = %s', |
2405 | 2405 | 'admin', |
2406 | 2406 | $key |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | } else { |
2472 | 2472 | $tmp = 1; |
2473 | 2473 | } |
2474 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
2474 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
2475 | 2475 | $counter = DB::count(); |
2476 | 2476 | if ($counter === 0) { |
2477 | 2477 | DB::insert( |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | |
2498 | 2498 | // ga_website_name |
2499 | 2499 | if (is_null($dataReceived['ga_website_name']) === false) { |
2500 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
2500 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
2501 | 2501 | $counter = DB::count(); |
2502 | 2502 | if ($counter === 0) { |
2503 | 2503 | DB::insert( |
@@ -2528,7 +2528,7 @@ discard block |
||
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | // send data |
2531 | - echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]'; |
|
2531 | + echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]'; |
|
2532 | 2532 | break; |
2533 | 2533 | |
2534 | 2534 | case 'save_agses_options': |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | |
2554 | 2554 | // agses_hosted_url |
2555 | 2555 | if (!is_null($dataReceived['agses_hosted_url'])) { |
2556 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
2556 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
2557 | 2557 | $counter = DB::count(); |
2558 | 2558 | if ($counter === 0) { |
2559 | 2559 | DB::insert( |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | |
2583 | 2583 | // agses_hosted_id |
2584 | 2584 | if (!is_null($dataReceived['agses_hosted_id'])) { |
2585 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
2585 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
2586 | 2586 | $counter = DB::count(); |
2587 | 2587 | if ($counter === 0) { |
2588 | 2588 | DB::insert( |
@@ -2611,7 +2611,7 @@ discard block |
||
2611 | 2611 | |
2612 | 2612 | // agses_hosted_apikey |
2613 | 2613 | if (!is_null($dataReceived['agses_hosted_apikey'])) { |
2614 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2614 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2615 | 2615 | $counter = DB::count(); |
2616 | 2616 | if ($counter === 0) { |
2617 | 2617 | DB::insert( |
@@ -2639,7 +2639,7 @@ discard block |
||
2639 | 2639 | } |
2640 | 2640 | |
2641 | 2641 | // send data |
2642 | - echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]'; |
|
2642 | + echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]'; |
|
2643 | 2643 | break; |
2644 | 2644 | |
2645 | 2645 | case 'save_option_change': |
@@ -2677,7 +2677,7 @@ discard block |
||
2677 | 2677 | |
2678 | 2678 | // Check if setting is already in DB. If NO then insert, if YES then update. |
2679 | 2679 | $data = DB::query( |
2680 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2680 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2681 | 2681 | WHERE type = %s AND intitule = %s', |
2682 | 2682 | $type, |
2683 | 2683 | $dataReceived['field'] |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | array( |
2700 | 2700 | 'valeur' => time(), |
2701 | 2701 | 'type' => $type, |
2702 | - 'intitule' => $dataReceived['field'] . '_time', |
|
2702 | + 'intitule' => $dataReceived['field'].'_time', |
|
2703 | 2703 | ) |
2704 | 2704 | ); |
2705 | 2705 | } |
@@ -2717,10 +2717,10 @@ discard block |
||
2717 | 2717 | if ($dataReceived['field'] === 'send_stats') { |
2718 | 2718 | // Check if previous time exists, if not them insert this value in DB |
2719 | 2719 | DB::query( |
2720 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2720 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2721 | 2721 | WHERE type = %s AND intitule = %s', |
2722 | 2722 | $type, |
2723 | - $dataReceived['field'] . '_time' |
|
2723 | + $dataReceived['field'].'_time' |
|
2724 | 2724 | ); |
2725 | 2725 | $counter = DB::count(); |
2726 | 2726 | if ($counter === 0) { |
@@ -2729,7 +2729,7 @@ discard block |
||
2729 | 2729 | array( |
2730 | 2730 | 'valeur' => 0, |
2731 | 2731 | 'type' => $type, |
2732 | - 'intitule' => $dataReceived['field'] . '_time', |
|
2732 | + 'intitule' => $dataReceived['field'].'_time', |
|
2733 | 2733 | ) |
2734 | 2734 | ); |
2735 | 2735 | } else { |
@@ -2749,13 +2749,13 @@ discard block |
||
2749 | 2749 | // special Cases |
2750 | 2750 | if ($dataReceived['field'] === 'cpassman_url') { |
2751 | 2751 | // update also jsUrl for CSFP protection |
2752 | - $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2752 | + $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2753 | 2753 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
2754 | 2754 | $data = file_get_contents($csrfp_file); |
2755 | 2755 | $posJsUrl = strpos($data, '"jsUrl" => "'); |
2756 | 2756 | $posEndLine = strpos($data, '",', $posJsUrl); |
2757 | 2757 | $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2)); |
2758 | - $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data); |
|
2758 | + $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data); |
|
2759 | 2759 | file_put_contents($csrfp_file, $newdata); |
2760 | 2760 | } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') { |
2761 | 2761 | DB::update( |
@@ -2780,7 +2780,7 @@ discard block |
||
2780 | 2780 | $SETTINGS['cpassman_dir'], |
2781 | 2781 | array( |
2782 | 2782 | 'error' => false, |
2783 | - 'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']], |
|
2783 | + 'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']], |
|
2784 | 2784 | ), |
2785 | 2785 | 'encode' |
2786 | 2786 | ); |
@@ -2825,7 +2825,7 @@ discard block |
||
2825 | 2825 | |
2826 | 2826 | // send statistics |
2827 | 2827 | if (null !== $post_status) { |
2828 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2828 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2829 | 2829 | $counter = DB::count(); |
2830 | 2830 | if ($counter === 0) { |
2831 | 2831 | DB::insert( |
@@ -2857,7 +2857,7 @@ discard block |
||
2857 | 2857 | |
2858 | 2858 | // send statistics items |
2859 | 2859 | if (null !== $post_list) { |
2860 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2860 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2861 | 2861 | $counter = DB::count(); |
2862 | 2862 | if ($counter === 0) { |
2863 | 2863 | DB::insert( |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | break; |
2906 | 2906 | } |
2907 | 2907 | |
2908 | - if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) { |
|
2908 | + if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) { |
|
2909 | 2909 | if (DB::count() === 1) { |
2910 | 2910 | echo 1; |
2911 | 2911 | } else { |
@@ -2944,7 +2944,7 @@ discard block |
||
2944 | 2944 | |
2945 | 2945 | $rows = DB::query( |
2946 | 2946 | 'SELECT id, title |
2947 | - FROM ' . prefixTable('roles_title') . ' |
|
2947 | + FROM ' . prefixTable('roles_title').' |
|
2948 | 2948 | ORDER BY title ASC' |
2949 | 2949 | ); |
2950 | 2950 | foreach ($rows as $record) { |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | } |
2961 | 2961 | |
2962 | 2962 | echo prepareExchangedData( |
2963 | - $SETTINGS['cpassman_dir'],$json, 'encode'); |
|
2963 | + $SETTINGS['cpassman_dir'], $json, 'encode'); |
|
2964 | 2964 | |
2965 | 2965 | break; |
2966 | 2966 | } |
@@ -505,7 +505,7 @@ |
||
505 | 505 | |
506 | 506 | // decrypt and retrieve data in JSON format |
507 | 507 | $dataReceived = prepareExchangedData( |
508 | - $SETTINGS['cpassman_dir'],$post_data, 'decode'); |
|
508 | + $SETTINGS['cpassman_dir'], $post_data, 'decode'); |
|
509 | 509 | |
510 | 510 | // Prepare variables |
511 | 511 | $post_roleId = filter_var($dataReceived['roleId'], FILTER_SANITIZE_NUMBER_INT); |
@@ -45,26 +45,26 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /* do checks */ |
48 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
49 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
48 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
49 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
50 | 50 | if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS)) { |
51 | 51 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
52 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
52 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
53 | 53 | exit(); |
54 | 54 | } |
55 | 55 | |
56 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
57 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
56 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
57 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
59 | 59 | |
60 | 60 | header('Content-type: text/html; charset=utf-8'); |
61 | 61 | header('Cache-Control: no-cache, no-store, must-revalidate'); |
62 | 62 | |
63 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
64 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
63 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
64 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
65 | 65 | |
66 | 66 | // connect to the server |
67 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
67 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
68 | 68 | if (defined('DB_PASSWD_CLEAR') === false) { |
69 | 69 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
70 | 70 | } |
@@ -129,38 +129,38 @@ discard block |
||
129 | 129 | ]; |
130 | 130 | |
131 | 131 | // Load expected libraries |
132 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
133 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
134 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
135 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
136 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
137 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
138 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
139 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
140 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
141 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
142 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
143 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
144 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
145 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
146 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
147 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
148 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
149 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
150 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
151 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
152 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
153 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
154 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
155 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
156 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
157 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
158 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
159 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
160 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
161 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
162 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
163 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
132 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
133 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
134 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
135 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
136 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
137 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
138 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
139 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
140 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
141 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
142 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
143 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
144 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
145 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
146 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
147 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
148 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
149 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
150 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
151 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
152 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
153 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
154 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
155 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
156 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
157 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
158 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
159 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
160 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
161 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
162 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
163 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
164 | 164 | |
165 | 165 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
166 | 166 | $ad->register(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $SETTINGS['cpassman_dir'], |
177 | 177 | array( |
178 | 178 | 'error' => true, |
179 | - 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(), |
|
179 | + 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(), |
|
180 | 180 | ), |
181 | 181 | 'encode' |
182 | 182 | ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $SETTINGS['cpassman_dir'], |
196 | 196 | array( |
197 | 197 | 'error' => true, |
198 | - 'message' => "Error : ".$e->withDetailedError($e),//->detailedError(), |
|
198 | + 'message' => "Error : ".$e->withDetailedError($e), //->detailedError(), |
|
199 | 199 | ), |
200 | 200 | 'encode' |
201 | 201 | ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $SETTINGS['cpassman_dir'], |
216 | 216 | array( |
217 | 217 | 'error' => true, |
218 | - 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(), |
|
218 | + 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(), |
|
219 | 219 | ), |
220 | 220 | 'encode' |
221 | 221 | ); |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
45 | 45 | } |
46 | 46 | |
47 | -if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
47 | +if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
48 | 48 | $SETTINGS = []; |
49 | 49 | $SETTINGS['cpassman_dir'] = '..'; |
50 | 50 | } |
51 | 51 | |
52 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
53 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
54 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
52 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
53 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
54 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
55 | 55 | |
56 | 56 | // If Debug then clean the files |
57 | 57 | if (DEBUGLDAP === true) { |
58 | - define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt'); |
|
58 | + define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt'); |
|
59 | 59 | $fp = fopen(DEBUGLDAPFILE, 'w'); |
60 | 60 | fclose($fp); |
61 | 61 | } |
62 | 62 | if (DEBUGDUO === true) { |
63 | - define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt'); |
|
63 | + define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt'); |
|
64 | 64 | $fp = fopen(DEBUGDUOFILE, 'w'); |
65 | 65 | fclose($fp); |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if (defined('DB_PASSWD_CLEAR') === false) { |
77 | 77 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
78 | 78 | } |
79 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
79 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
80 | 80 | if (defined('DB_PASSWD_CLEAR') === false) { |
81 | 81 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
82 | 82 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // This step creates the DUO request encrypted key |
94 | 94 | |
95 | 95 | // load library |
96 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
96 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
97 | 97 | $sig_request = Duo::signRequest( |
98 | 98 | $SETTINGS['IKEY'], |
99 | 99 | $SETTINGS['SKEY'], |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | debugIdentify( |
105 | 105 | DEBUGDUO, |
106 | 106 | DEBUGDUOFILE, |
107 | - "\n\n-----\n\n" . |
|
108 | - 'sig request : ' . $post_login . "\n" . |
|
109 | - 'resp : ' . $sig_request . "\n" |
|
107 | + "\n\n-----\n\n". |
|
108 | + 'sig request : '.$post_login."\n". |
|
109 | + 'resp : '.$sig_request."\n" |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | // load csrfprotector |
114 | - $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php'; |
|
114 | + $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php'; |
|
115 | 115 | // return result |
116 | - echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]'; |
|
116 | + echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]'; |
|
117 | 117 | // --- |
118 | 118 | // --- |
119 | 119 | } elseif ($post_type === 'identify_duo_user_check') { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | //-------- |
124 | 124 | |
125 | 125 | // load library |
126 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
126 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
127 | 127 | $authenticated_username = Duo::verifyResponse( |
128 | 128 | $SETTINGS['duo_ikey'], |
129 | 129 | $SETTINGS['duo_skey'], |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // is user in Teampass? |
139 | 139 | DB::queryfirstrow( |
140 | 140 | 'SELECT id |
141 | - FROM ' . prefixTable('users') . ' |
|
141 | + FROM ' . prefixTable('users').' |
|
142 | 142 | WHERE login = %s', |
143 | 143 | $post_login |
144 | 144 | ); |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - echo '[{"authenticated_username" : "' . $authenticated_username . '"}]'; |
|
151 | + echo '[{"authenticated_username" : "'.$authenticated_username.'"}]'; |
|
152 | 152 | } else { |
153 | - echo '[{"authenticated_username" : "' . $authenticated_username . '"}]'; |
|
153 | + echo '[{"authenticated_username" : "'.$authenticated_username.'"}]'; |
|
154 | 154 | } |
155 | 155 | // --- |
156 | 156 | // --- |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | // Load superGlobals |
179 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
179 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
180 | 180 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
181 | 181 | // Prepare GET variables |
182 | 182 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | } else { |
267 | 267 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
268 | 268 | } |
269 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
270 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
271 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
269 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
270 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
271 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
272 | 272 | |
273 | 273 | header('Content-type: text/html; charset=utf-8'); |
274 | 274 | error_reporting(E_ERROR); |
275 | 275 | |
276 | 276 | // Load AntiXSS |
277 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
277 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
278 | 278 | $antiXss = new voku\helper\AntiXSS(); |
279 | 279 | |
280 | 280 | // Load superGlobals |
281 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
281 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
282 | 282 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
283 | 283 | |
284 | 284 | // Prepare GET variables |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER'); |
293 | 293 | |
294 | 294 | // connect to the server |
295 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
295 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
296 | 296 | DB::$host = DB_HOST; |
297 | 297 | DB::$user = DB_USER; |
298 | 298 | DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR; |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | DB::$port = DB_PORT; |
301 | 301 | DB::$encoding = DB_ENCODING; |
302 | 302 | // User's language loading |
303 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php'; |
|
303 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php'; |
|
304 | 304 | |
305 | 305 | // decrypt and retreive data in JSON format |
306 | 306 | if (empty($sessionKey) === true) { |
307 | 307 | $dataReceived = $sentData; |
308 | 308 | } else { |
309 | 309 | $dataReceived = prepareExchangedData( |
310 | - $SETTINGS['cpassman_dir'],$sentData, 'decode', $sessionKey); |
|
310 | + $SETTINGS['cpassman_dir'], $sentData, 'decode', $sessionKey); |
|
311 | 311 | $superGlobal->put('key', $sessionKey, 'SESSION'); |
312 | 312 | } |
313 | 313 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | // Check if any unsuccessfull login tries exist |
457 | 457 | $rows = DB::query( |
458 | 458 | 'SELECT date |
459 | - FROM ' . prefixTable('log_system') . " |
|
459 | + FROM ' . prefixTable('log_system')." |
|
460 | 460 | WHERE field_1 = %s |
461 | 461 | AND type = 'failed_auth' |
462 | 462 | AND label = 'password_is_not_correct' |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | foreach ($rows as $record) { |
471 | 471 | array_push( |
472 | 472 | $arrAttempts, |
473 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
473 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
474 | 474 | ); |
475 | 475 | } |
476 | 476 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | foreach ($superGlobal->get('user_roles', 'SESSION') as $role) { |
586 | 586 | $resRoles = DB::queryFirstRow( |
587 | 587 | 'SELECT title, complexity |
588 | - FROM ' . prefixTable('roles_title') . ' |
|
588 | + FROM ' . prefixTable('roles_title').' |
|
589 | 589 | WHERE id=%i', |
590 | 590 | $role |
591 | 591 | ); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | |
607 | 607 | // build complete array of roles |
608 | 608 | $superGlobal->put('arr_roles_full', [], 'SESSION'); |
609 | - $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
609 | + $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
610 | 610 | foreach ($rows as $record) { |
611 | 611 | $superGlobal->put( |
612 | 612 | $record['id'], |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | $superGlobal->put('latest_items_tab', [], 'SESSION'); |
685 | 685 | $superGlobal->put('nb_roles', 0, 'SESSION'); |
686 | 686 | foreach ($superGlobal->get('latest_items', 'SESSION') as $item) { |
687 | - if (! empty($item)) { |
|
687 | + if (!empty($item)) { |
|
688 | 688 | $dataLastItems = DB::queryFirstRow( |
689 | 689 | 'SELECT id,label,id_tree |
690 | - FROM ' . prefixTable('items') . ' |
|
690 | + FROM ' . prefixTable('items').' |
|
691 | 691 | WHERE id=%i', |
692 | 692 | $item |
693 | 693 | ); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | [ |
697 | 697 | 'id' => $item, |
698 | 698 | 'label' => $dataLastItems['label'], |
699 | - 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
699 | + 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
700 | 700 | ], |
701 | 701 | 'SESSION', |
702 | 702 | 'latest_items_tab' |
@@ -713,12 +713,12 @@ discard block |
||
713 | 713 | ) { |
714 | 714 | // get all Admin users |
715 | 715 | $receivers = ''; |
716 | - $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
716 | + $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
717 | 717 | foreach ($rows as $record) { |
718 | 718 | if (empty($receivers)) { |
719 | 719 | $receivers = $record['email']; |
720 | 720 | } else { |
721 | - $receivers = ',' . $record['email']; |
|
721 | + $receivers = ','.$record['email']; |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | // Add email to table |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | '#tp_time#', |
735 | 735 | ], |
736 | 736 | [ |
737 | - ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')', |
|
737 | + ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')', |
|
738 | 738 | date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
739 | 739 | date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
740 | 740 | ], |
@@ -1059,44 +1059,44 @@ discard block |
||
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | // Load expected libraries |
1062 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1063 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1064 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1065 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1066 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1067 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1068 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1069 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1070 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1071 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1072 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
1073 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
1074 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1075 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
1076 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1077 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1078 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1079 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1080 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
1081 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
1082 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
1083 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1084 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1085 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1086 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
1087 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
1088 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
1089 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
1090 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1091 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1092 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
1093 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
1094 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
1095 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1096 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
1097 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1098 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1099 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
1062 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1063 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1064 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1065 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1066 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1067 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1068 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1069 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1070 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1071 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1072 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
1073 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
1074 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1075 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
1076 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1077 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1078 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1079 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1080 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
1081 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
1082 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
1083 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1084 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1085 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1086 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
1087 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
1088 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
1089 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
1090 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1091 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1092 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
1093 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
1094 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
1095 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1096 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
1097 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1098 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1099 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
1100 | 1100 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
1101 | 1101 | $ad->register(); |
1102 | 1102 | $connection = new Connection($config); |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | $error = $e->getDetailedError(); |
1109 | 1109 | return [ |
1110 | 1110 | 'error' => true, |
1111 | - 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
1111 | + 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
1112 | 1112 | |
1113 | 1113 | ]; |
1114 | 1114 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | // load passwordLib library |
1139 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1139 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1140 | 1140 | $pwdlib->register(); |
1141 | 1141 | $pwdlib = new PasswordLib\PasswordLib(); |
1142 | 1142 | $hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array |
1196 | 1196 | { |
1197 | 1197 | // Load superGlobals |
1198 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1198 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1199 | 1199 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1200 | 1200 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
1201 | 1201 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | // Now check yubico validity |
1237 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1237 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1238 | 1238 | $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
1239 | 1239 | $auth = $yubi->verify($yubico_key); |
1240 | 1240 | //, null, null, null, 60 |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | 'gestionnaire' => '0', |
1287 | 1287 | 'can_manage_all_users' => '0', |
1288 | 1288 | 'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0', |
1289 | - 'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'), |
|
1289 | + 'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'), |
|
1290 | 1290 | 'groupes_interdits' => '', |
1291 | 1291 | 'groupes_visibles' => '', |
1292 | 1292 | 'last_pw_change' => (int) time(), |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | ] |
1312 | 1312 | ); |
1313 | 1313 | // Rebuild tree |
1314 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1314 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1315 | 1315 | $tree->register(); |
1316 | 1316 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
1317 | 1317 | $tree->rebuild(); |
@@ -1342,13 +1342,13 @@ discard block |
||
1342 | 1342 | && empty($dataReceived['GACode']) === false |
1343 | 1343 | ) { |
1344 | 1344 | // Load superGlobals |
1345 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1345 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1346 | 1346 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1347 | 1347 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
1348 | 1348 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
1349 | 1349 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
1350 | 1350 | // load library |
1351 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1351 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1352 | 1352 | // create new instance |
1353 | 1353 | $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']); |
1354 | 1354 | // Init |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | $mfaMessage = langHdl('ga_flash_qr_and_login'); |
1371 | 1371 | // generate new QR |
1372 | 1372 | $new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
1373 | - 'Teampass - ' . $username, |
|
1373 | + 'Teampass - '.$username, |
|
1374 | 1374 | $userInfo['ga'] |
1375 | 1375 | ); |
1376 | 1376 | // clear temporary code from DB |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | $userInfo['id'] |
1384 | 1384 | ); |
1385 | 1385 | $firstTime = [ |
1386 | - 'value' => '<img src="' . $new_2fa_qr . '">', |
|
1386 | + 'value' => '<img src="'.$new_2fa_qr.'">', |
|
1387 | 1387 | 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
1388 | 1388 | 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
1389 | 1389 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | // Set to false |
1435 | 1435 | $userPasswordVerified = false; |
1436 | 1436 | // load passwordLib library |
1437 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
1438 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
1437 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
1438 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1439 | 1439 | $pwdlib->register(); |
1440 | 1440 | $pwdlib = new PasswordLib\PasswordLib(); |
1441 | 1441 | // Check if old encryption used |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | // Brute force management |
1567 | 1567 | if ($sessionPwdAttempts > 3) { |
1568 | 1568 | // Load superGlobals |
1569 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1569 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1570 | 1570 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
1571 | 1571 | $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION'); |
1572 | 1572 | $superGlobal->put('pwd_attempts', 0, 'SESSION'); |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | // Check if user exists |
1609 | 1609 | $userInfo = DB::queryFirstRow( |
1610 | 1610 | 'SELECT * |
1611 | - FROM ' . prefixTable('users') . ' WHERE login=%s', |
|
1611 | + FROM ' . prefixTable('users').' WHERE login=%s', |
|
1612 | 1612 | $username |
1613 | 1613 | ); |
1614 | 1614 |