@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | || isset($SETTINGS['allow_import']) === false || (int) $SETTINGS['allow_import'] !== 1) { |
71 | 71 | // Not allowed page |
72 | 72 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
73 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
73 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
74 | 74 | exit; |
75 | 75 | } |
76 | 76 | |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | |
86 | 86 | if ((int) $session->get('user-admin') === 1) { |
87 | 87 | $folderOptions = ''; |
88 | - $rows = DB::query('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
88 | + $rows = DB::query('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
89 | 89 | foreach ($rows as $record) { |
90 | - $folderOptions .= '<option value="' . $record['id'] . '">' . htmlspecialchars($record['title'], ENT_QUOTES, 'UTF-8') . '</option>'; |
|
90 | + $folderOptions .= '<option value="'.$record['id'].'">'.htmlspecialchars($record['title'], ENT_QUOTES, 'UTF-8').'</option>'; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | <?php |
190 | 190 | $complexitySelect = ''; |
191 | 191 | foreach (TP_PW_COMPLEXITY as $level) { |
192 | - $complexitySelect .= '<option value="' . $level[0] . '">' . $level[1] . '</option>'; |
|
192 | + $complexitySelect .= '<option value="'.$level[0].'">'.$level[1].'</option>'; |
|
193 | 193 | } |
194 | 194 | echo $complexitySelect; |
195 | 195 | ?> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('import') === false) { |
73 | 73 | // Not allowed page |
74 | 74 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
75 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
75 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
76 | 76 | exit; |
77 | 77 | } |
78 | 78 | ?> |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | const errorMessages = JSON.parse(response.message); |
512 | 512 | let errorHtml = '<ul>'; |
513 | 513 | errorMessages.forEach(function(error) { |
514 | - errorHtml += '<li><?php echo $lang->get('import_error_folder_creation');?> "<b>'+error.errorPath+'</b>": '+error.errorMessage+'</li>'; |
|
514 | + errorHtml += '<li><?php echo $lang->get('import_error_folder_creation'); ?> "<b>'+error.errorPath+'</b>": '+error.errorMessage+'</li>'; |
|
515 | 515 | }); |
516 | 516 | |
517 | 517 | $('#import-feedback-progress-text').html( |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | // Isolate first item |
998 | 998 | if (itemsList.length > 0) { |
999 | 999 | $('#import-feedback-progress-text') |
1000 | - .html('<i class="fa-solid fa-cog fa-spin ml-4 mr-2"></i><?php echo $lang->get('operation_progress');?> ('+((counter*100)/itemsNumber).toFixed(0)+'%)'); |
|
1000 | + .html('<i class="fa-solid fa-cog fa-spin ml-4 mr-2"></i><?php echo $lang->get('operation_progress'); ?> ('+((counter*100)/itemsNumber).toFixed(0)+'%)'); |
|
1001 | 1001 | |
1002 | 1002 | data = { |
1003 | 1003 | 'edit-all': $('#import-keepass-edit-all-checkbox').prop('checked') === true ? 1 : 0, |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ) { |
77 | 77 | // Not allowed page |
78 | 78 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
79 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
79 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
80 | 80 | exit; |
81 | 81 | } |
82 | 82 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // Is a date sent? |
102 | 102 | $dateCriteria = $request->query->get('dateCriteria'); |
103 | 103 | if ($dateCriteria !== null && !empty($dateCriteria)) { |
104 | - $sWhere .= ' AND a.del_value < ' . round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0); |
|
104 | + $sWhere .= ' AND a.del_value < '.round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0); |
|
105 | 105 | } |
106 | 106 | //echo $sWhere; |
107 | 107 | /* BUILD QUERY */ |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $start = $request->query->getInt('start', 0); |
111 | 111 | $length = $request->query->getInt('length', -1); |
112 | 112 | if ($length !== -1) { |
113 | - $sLimit = ' LIMIT ' . $start . ', ' . $length; |
|
113 | + $sLimit = ' LIMIT '.$start.', '.$length; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | //Ordering |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $columnIndex = filter_var($order[0]['column'], FILTER_SANITIZE_NUMBER_INT); |
124 | 124 | |
125 | 125 | if (array_key_exists($columnIndex, $aColumns)) { |
126 | - $sOrder .= $aColumns[$columnIndex] . ' ' . $order[0]['dir']; |
|
126 | + $sOrder .= $aColumns[$columnIndex].' '.$order[0]['dir']; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // Supprimez la virgule finale si elle existe |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | |
148 | 148 | if ($letter !== '' && $letter !== 'None') { |
149 | 149 | $sWhere .= ' AND '; |
150 | - $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR "; |
|
151 | - $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR "; |
|
152 | - $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' "; |
|
150 | + $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR "; |
|
151 | + $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR "; |
|
152 | + $sWhere .= $aColumns[3]." LIKE '".$letter."%' "; |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -160,26 +160,26 @@ discard block |
||
160 | 160 | |
161 | 161 | if ($searchValue !== '') { |
162 | 162 | $sWhere = ' AND '; |
163 | - $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR "; |
|
164 | - $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR "; |
|
165 | - $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' "; |
|
163 | + $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR "; |
|
164 | + $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR "; |
|
165 | + $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' "; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | $rows = DB::query( |
171 | 171 | 'SELECT a.item_id, i.label, a.del_value, i.id_tree |
172 | - FROM ' . prefixTable('automatic_del') . ' AS a |
|
173 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' . |
|
172 | + FROM ' . prefixTable('automatic_del').' AS a |
|
173 | + INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'. |
|
174 | 174 | $sWhere. |
175 | 175 | (string) $sOrder |
176 | 176 | ); |
177 | 177 | $iTotal = DB::count(); |
178 | 178 | $rows = DB::query( |
179 | 179 | 'SELECT a.item_id, i.label, a.del_value, i.id_tree |
180 | - FROM ' . prefixTable('automatic_del') . ' AS a |
|
181 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' . |
|
182 | - $sWhere . |
|
180 | + FROM ' . prefixTable('automatic_del').' AS a |
|
181 | + INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'. |
|
182 | + $sWhere. |
|
183 | 183 | $sLimit |
184 | 184 | ); |
185 | 185 | $iFilteredTotal = DB::count(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * Output |
188 | 188 | */ |
189 | 189 | $sOutput = '{'; |
190 | -$sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
190 | +$sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
191 | 191 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
192 | 192 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
193 | 193 | $sOutput .= '"aaData": '; |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | // start the line |
202 | 202 | $sOutput .= '['; |
203 | 203 | // Column 1 |
204 | - $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\" data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", '; |
|
204 | + $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\" data-item-tree-id=\"'.$record['id_tree'].'\"></i>", '; |
|
205 | 205 | // Column 2 |
206 | - $sOutput .= '"' . $record['label'] . '", '; |
|
206 | + $sOutput .= '"'.$record['label'].'", '; |
|
207 | 207 | // Column 3 |
208 | - $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['del_value']) . '", '; |
|
208 | + $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['del_value']).'", '; |
|
209 | 209 | // Column 4 |
210 | 210 | $path = []; |
211 | 211 | $treeDesc = $tree->getPath($record['id_tree'], true); |
212 | 212 | foreach ($treeDesc as $t) { |
213 | 213 | array_push($path, $t->title); |
214 | 214 | } |
215 | - $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],'; |
|
215 | + $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | if (count($rows) > 0) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ) { |
78 | 78 | // Not allowed page |
79 | 79 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
80 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
80 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $arrFolders = array(); |
129 | 129 | $rows = DB::query( |
130 | 130 | 'SELECT valeur, intitule |
131 | - FROM ' . prefixTable('misc') . ' |
|
131 | + FROM ' . prefixTable('misc').' |
|
132 | 132 | WHERE type = %s', |
133 | 133 | 'folder_deleted' |
134 | 134 | ); |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | i.id as id, i.label as label, |
152 | 152 | i.id_tree as id_tree, l.date as date, n.title as folder_title, |
153 | 153 | a.del_enabled as del_enabled, a.del_value as del_value, a.del_type as del_type |
154 | - FROM ' . prefixTable('log_items') . ' as l |
|
155 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
156 | - LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
157 | - LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id) |
|
158 | - INNER JOIN ' . prefixTable('automatic_del') . ' as a ON (l.id_item = a.item_id) |
|
154 | + FROM ' . prefixTable('log_items').' as l |
|
155 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
156 | + LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
157 | + LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id) |
|
158 | + INNER JOIN ' . prefixTable('automatic_del').' as a ON (l.id_item = a.item_id) |
|
159 | 159 | WHERE i.inactif = %i |
160 | 160 | AND l.action = %s', |
161 | 161 | 1, |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | 'label' => $record['label'], |
178 | 178 | 'date' => date($SETTINGS['date_format'], (int) $record['date']), |
179 | 179 | 'login' => $record['login'], |
180 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
180 | + 'name' => $record['name'].' '.$record['lastname'], |
|
181 | 181 | 'folder_label' => $record['folder_title'], |
182 | 182 | 'folder_deleted' => $thisFolder, |
183 | 183 | 'del_enabled' => (bool) $record['del_enabled'], |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | foreach ($post_folders as $folderId) { |
239 | 239 | $data = DB::queryFirstRow( |
240 | 240 | 'SELECT valeur |
241 | - FROM ' . prefixTable('misc') . " |
|
241 | + FROM ' . prefixTable('misc')." |
|
242 | 242 | WHERE type = 'folder_deleted' |
243 | 243 | AND intitule = %s", |
244 | - 'f' . $folderId |
|
244 | + 'f'.$folderId |
|
245 | 245 | ); |
246 | 246 | if ((int) $data['valeur'] !== 0) { |
247 | 247 | $folderData = explode(', ', $data['valeur']); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | prefixTable('misc'), |
269 | 269 | 'type = %s AND intitule = %s', |
270 | 270 | 'folder_deleted', |
271 | - 'f' . $folderId |
|
271 | + 'f'.$folderId |
|
272 | 272 | ); |
273 | 273 | |
274 | 274 | // Restore all items in this folder |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | // Get list of all items in thos folder |
285 | 285 | $items = DB::query( |
286 | 286 | 'SELECT id |
287 | - FROM ' . prefixTable('items') . ' |
|
287 | + FROM ' . prefixTable('items').' |
|
288 | 288 | WHERE id_tree = %i', |
289 | 289 | $folderId |
290 | 290 | ); |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | foreach ($post_folders as $folderId) { |
374 | 374 | $data = DB::queryFirstRow( |
375 | 375 | 'SELECT valeur |
376 | - FROM ' . prefixTable('misc') . " |
|
376 | + FROM ' . prefixTable('misc')." |
|
377 | 377 | WHERE type = 'folder_deleted' |
378 | 378 | AND intitule = %s", |
379 | - 'f' . $folderId |
|
379 | + 'f'.$folderId |
|
380 | 380 | ); |
381 | 381 | if ((int) $data['valeur'] !== 0) { |
382 | 382 | $exploded = explode(',', $data['valeur']); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | prefixTable('misc'), |
388 | 388 | 'type = %s AND intitule = %s', |
389 | 389 | 'folder_deleted', |
390 | - 'f' . $folderData[0] |
|
390 | + 'f'.$folderData[0] |
|
391 | 391 | ); |
392 | 392 | |
393 | 393 | // Delete all items in this folder |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | // Get list of all items in thos folder |
402 | 402 | $items = DB::query( |
403 | 403 | 'SELECT id |
404 | - FROM ' . prefixTable('items') . ' |
|
404 | + FROM ' . prefixTable('items').' |
|
405 | 405 | WHERE id_tree = %i', |
406 | 406 | $folderData[0] |
407 | 407 | ); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | // Delete all fields |
419 | 419 | $fields = DB::query( |
420 | 420 | 'SELECT id |
421 | - FROM ' . prefixTable('categories_items') . ' |
|
421 | + FROM ' . prefixTable('categories_items').' |
|
422 | 422 | WHERE item_id = %i', |
423 | 423 | $folderData[0] |
424 | 424 | ); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | // Delete all files |
439 | 439 | $files = DB::query( |
440 | 440 | 'SELECT id |
441 | - FROM ' . prefixTable('files') . ' |
|
441 | + FROM ' . prefixTable('files').' |
|
442 | 442 | WHERE id_item = %i', |
443 | 443 | $folderData[0] |
444 | 444 | ); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | // Delete sharekey fields |
496 | 496 | $itemFields = DB::query( |
497 | 497 | 'SELECT id |
498 | - FROM ' . prefixTable('categories_items') . ' |
|
498 | + FROM ' . prefixTable('categories_items').' |
|
499 | 499 | WHERE item_id = %i', |
500 | 500 | $itemId |
501 | 501 | ); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | // Delete sharekey files |
511 | 511 | $itemFiles = DB::query( |
512 | 512 | 'SELECT id |
513 | - FROM ' . prefixTable('files') . ' |
|
513 | + FROM ' . prefixTable('files').' |
|
514 | 514 | WHERE id_item = %i', |
515 | 515 | $itemId |
516 | 516 | ); |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | ) { |
588 | 588 | if ($post_log_type === 'items') { |
589 | 589 | DB::query( |
590 | - 'SELECT * FROM ' . prefixTable('log_items') . ' |
|
590 | + 'SELECT * FROM '.prefixTable('log_items').' |
|
591 | 591 | WHERE (date BETWEEN %i AND %i)' |
592 | 592 | . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"') |
593 | 593 | . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user), |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | } elseif ($post_log_type === 'connections') { |
608 | 608 | //db::debugmode(true); |
609 | 609 | DB::query( |
610 | - 'SELECT * FROM ' . prefixTable('log_system') . ' |
|
610 | + 'SELECT * FROM '.prefixTable('log_system').' |
|
611 | 611 | WHERE type=%s ' |
612 | 612 | . 'AND (date BETWEEN %i AND %i)' |
613 | 613 | . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action) |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | ); |
631 | 631 | } elseif ($post_log_type === 'errors') { |
632 | 632 | DB::query( |
633 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
633 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
634 | 634 | 'AND (date BETWEEN %i AND %i)', |
635 | 635 | 'error', |
636 | 636 | $post_date_from, |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | ); |
648 | 648 | } elseif ($post_log_type === 'copy') { |
649 | 649 | DB::query( |
650 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' . |
|
650 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '. |
|
651 | 651 | 'AND (date BETWEEN %i AND %i)', |
652 | 652 | 'at_copy', |
653 | 653 | $post_date_from, |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | ); |
665 | 665 | } elseif ($post_log_type === 'admin') { |
666 | 666 | DB::query( |
667 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
667 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
668 | 668 | 'AND (date BETWEEN %i AND %i)', |
669 | 669 | 'admin_action', |
670 | 670 | $post_date_from, |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | ); |
682 | 682 | } elseif ($post_log_type === 'failed') { |
683 | 683 | DB::query( |
684 | - 'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' . |
|
684 | + 'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '. |
|
685 | 685 | 'AND (date BETWEEN %i AND %i)', |
686 | 686 | 'failed_auth', |
687 | 687 | $post_date_from, |
@@ -752,19 +752,19 @@ discard block |
||
752 | 752 | // Get info about task |
753 | 753 | $taskInfo = DB::queryFirstRow( |
754 | 754 | 'SELECT p.process_type as process_type |
755 | - FROM ' . prefixTable('background_tasks') . ' as p |
|
755 | + FROM ' . prefixTable('background_tasks').' as p |
|
756 | 756 | WHERE p.increment_id = %i', |
757 | 757 | $post_id |
758 | 758 | ); |
759 | 759 | if ($taskInfo !== null) { |
760 | 760 | // delete task |
761 | 761 | DB::query( |
762 | - 'DELETE FROM ' . prefixTable('background_subtasks') . ' |
|
762 | + 'DELETE FROM '.prefixTable('background_subtasks').' |
|
763 | 763 | WHERE task_id = %i', |
764 | 764 | $post_id |
765 | 765 | ); |
766 | 766 | DB::query( |
767 | - 'DELETE FROM ' . prefixTable('background_tasks') . ' |
|
767 | + 'DELETE FROM '.prefixTable('background_tasks').' |
|
768 | 768 | WHERE increment_id = %i', |
769 | 769 | $post_id |
770 | 770 | ); |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | ->setDayOfMonth('*') |
832 | 832 | ->setMonths('*') |
833 | 833 | ->setDayOfWeek('*') |
834 | - ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php') |
|
834 | + ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php') |
|
835 | 835 | ->setComments('Teampass scheduler'); |
836 | 836 | |
837 | 837 | $crontabRepository->addJob($crontabJob); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $requestUri = $request->getRequestUri(); |
48 | 48 | |
49 | 49 | $uri = parse_url($requestUri, PHP_URL_PATH); |
50 | - $uri = explode( '/', $uri ); |
|
50 | + $uri = explode('/', $uri); |
|
51 | 51 | return $this->sanitizeUrl(array_slice($uri, ((int) array_search('index.php', $uri) + 1))); |
52 | 52 | } |
53 | 53 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $request = symfonyRequest::createFromGlobals(); |
62 | 62 | $queryString = $request->getQueryString(); |
63 | -<<<<<<< HEAD |
|
63 | +<< << <<< HEAD |
|
64 | 64 | if ($request->getContentTypeFormat() !== 'json') { |
65 | 65 | ======= |
66 | 66 | if ($request->getContentTypeFormat() != 'application/json') { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) { |
73 | 73 | // Not allowed page |
74 | 74 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
75 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
75 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
76 | 76 | exit; |
77 | 77 | } |
78 | 78 | |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | break; |
134 | 134 | } |
135 | 135 | |
136 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
136 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
137 | 137 | $return = ''; |
138 | 138 | |
139 | 139 | //Get all tables |
140 | 140 | $tables = array(); |
141 | 141 | $result = DB::query('SHOW TABLES'); |
142 | 142 | foreach ($result as $row) { |
143 | - $tables[] = $row['Tables_in_' . DB_NAME]; |
|
143 | + $tables[] = $row['Tables_in_'.DB_NAME]; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | //cycle through |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) { |
149 | 149 | $table = (is_string($table) ? $table : strval($table)); |
150 | 150 | // Do query |
151 | - $result = DB::query('SELECT * FROM ' . $table); |
|
151 | + $result = DB::query('SELECT * FROM '.$table); |
|
152 | 152 | DB::query( |
153 | 153 | 'SELECT * |
154 | 154 | FROM INFORMATION_SCHEMA.COLUMNS |
@@ -160,20 +160,20 @@ discard block |
||
160 | 160 | $numFields = DB::count(); |
161 | 161 | |
162 | 162 | // prepare a drop table |
163 | - $return .= 'DROP TABLE ' . $table . ';'; |
|
164 | - $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table); |
|
165 | - $return .= "\n\n" . strval($row2['Create Table']) . ";\n\n"; |
|
163 | + $return .= 'DROP TABLE '.$table.';'; |
|
164 | + $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table); |
|
165 | + $return .= "\n\n".strval($row2['Create Table']).";\n\n"; |
|
166 | 166 | |
167 | 167 | //prepare all fields and datas |
168 | 168 | for ($i = 0; $i < $numFields; ++$i) { |
169 | 169 | if (is_object($result)) { |
170 | 170 | while ($row = $result->fetch_row()) { |
171 | - $return .= 'INSERT INTO ' . $table . ' VALUES('; |
|
171 | + $return .= 'INSERT INTO '.$table.' VALUES('; |
|
172 | 172 | for ($j = 0; $j < $numFields; ++$j) { |
173 | 173 | $row[$j] = addslashes($row[$j]); |
174 | 174 | $row[$j] = preg_replace("/\n/", '\\n', $row[$j]); |
175 | 175 | if (isset($row[$j])) { |
176 | - $return .= '"' . $row[$j] . '"'; |
|
176 | + $return .= '"'.$row[$j].'"'; |
|
177 | 177 | } else { |
178 | 178 | $return .= 'NULL'; |
179 | 179 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $token = GenerateCryptKey(20, false, true, true, false, true); |
195 | 195 | |
196 | 196 | //save file |
197 | - $filename = time() . '-' . $token . '.sql'; |
|
198 | - $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+'); |
|
197 | + $filename = time().'-'.$token.'.sql'; |
|
198 | + $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+'); |
|
199 | 199 | if ($handle !== false) { |
200 | 200 | //write file |
201 | 201 | fwrite($handle, $return); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | // Encrypt the file |
208 | 208 | prepareFileWithDefuse( |
209 | 209 | 'encrypt', |
210 | - $SETTINGS['path_to_files_folder'] . '/' . $filename, |
|
211 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
210 | + $SETTINGS['path_to_files_folder'].'/'.$filename, |
|
211 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
212 | 212 | $post_option |
213 | 213 | ); |
214 | 214 | |
215 | 215 | // Do clean |
216 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $filename); |
|
216 | + unlink($SETTINGS['path_to_files_folder'].'/'.$filename); |
|
217 | 217 | rename( |
218 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
219 | - $SETTINGS['path_to_files_folder'] . '/' . $filename |
|
218 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
219 | + $SETTINGS['path_to_files_folder'].'/'.$filename |
|
220 | 220 | ); |
221 | 221 | } |
222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | //update LOG |
227 | 227 | logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login')); |
228 | 228 | |
229 | - echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]'; |
|
229 | + echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]'; |
|
230 | 230 | } |
231 | 231 | break; |
232 | 232 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ); |
256 | 256 | break; |
257 | 257 | } |
258 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
258 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
259 | 259 | |
260 | 260 | $dataPost = explode('&', $post_option); |
261 | 261 | $file = htmlspecialchars($dataPost[0]); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | // Get filename from database |
265 | 265 | $data = DB::queryFirstRow( |
266 | 266 | 'SELECT valeur |
267 | - FROM ' . prefixTable('misc') . ' |
|
267 | + FROM ' . prefixTable('misc').' |
|
268 | 268 | WHERE increment_id = %i', |
269 | 269 | $file |
270 | 270 | ); |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | // Decrypt the file |
284 | 284 | $ret = prepareFileWithDefuse( |
285 | 285 | 'decrypt', |
286 | - $SETTINGS['path_to_files_folder'] . '/' . $file, |
|
287 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file, |
|
286 | + $SETTINGS['path_to_files_folder'].'/'.$file, |
|
287 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file, |
|
288 | 288 | $key |
289 | 289 | ); |
290 | 290 | |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | // Do clean |
298 | - fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS); |
|
299 | - $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file; |
|
298 | + fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS); |
|
299 | + $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file; |
|
300 | 300 | } else { |
301 | - $file = $SETTINGS['path_to_files_folder'] . '/' . $file; |
|
301 | + $file = $SETTINGS['path_to_files_folder'].'/'.$file; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | //read sql file |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | fclose($handle); |
316 | 316 | |
317 | 317 | //delete file |
318 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $file); |
|
318 | + unlink($SETTINGS['path_to_files_folder'].'/'.$file); |
|
319 | 319 | |
320 | 320 | //Show done |
321 | 321 | echo '[{"result":"db_restore" , "message":""}]'; |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | $tablename = (is_string($tablename) ? $tablename : strval($tablename)); |
355 | 355 | if (substr_count($tablename, DB_PREFIX) > 0) { |
356 | 356 | // launch optimization quieries |
357 | - DB::query('ANALYZE TABLE `' . $tablename . '`'); |
|
358 | - DB::query('OPTIMIZE TABLE `' . $tablename . '`'); |
|
357 | + DB::query('ANALYZE TABLE `'.$tablename.'`'); |
|
358 | + DB::query('OPTIMIZE TABLE `'.$tablename.'`'); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | } |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | //Clean up LOG_ITEMS table |
364 | 364 | $rows = DB::query( |
365 | 365 | 'SELECT id |
366 | - FROM ' . prefixTable('items') . ' |
|
366 | + FROM ' . prefixTable('items').' |
|
367 | 367 | ORDER BY id ASC' |
368 | 368 | ); |
369 | 369 | foreach ($rows as $item) { |
370 | 370 | DB::query( |
371 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
371 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
372 | 372 | $item['id'], |
373 | 373 | 'at_creation' |
374 | 374 | ); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | if ($counter === 0) { |
377 | 377 | //Create new at_creation entry |
378 | 378 | $rowTmp = DB::queryFirstRow( |
379 | - 'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC', |
|
379 | + 'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC', |
|
380 | 380 | $item['id'] |
381 | 381 | ); |
382 | 382 | DB::insert( |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | echo prepareExchangedData( |
407 | 407 | array( |
408 | 408 | 'error' => false, |
409 | - 'message' => $lang->get('last_execution') . ' ' . |
|
410 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
409 | + 'message' => $lang->get('last_execution').' '. |
|
410 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
411 | 411 | '<i class="fas fa-check text-success ml-2"></i>', |
412 | 412 | ), |
413 | 413 | 'encode' |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | break; |
444 | 444 | } |
445 | 445 | |
446 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
446 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
447 | 447 | updateCacheTable('reload', NULL); |
448 | 448 | |
449 | 449 | // Log |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | echo prepareExchangedData( |
460 | 460 | [ |
461 | 461 | 'error' => false, |
462 | - 'message' => $lang->get('last_execution') . ' ' . |
|
463 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
462 | + 'message' => $lang->get('last_execution').' '. |
|
463 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
464 | 464 | '<i class="fas fa-check text-success mr-2"></i>', |
465 | 465 | ], |
466 | 466 | 'encode' |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE)); |
503 | 503 | |
504 | 504 | // generate new saltkey |
505 | - $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time(); |
|
505 | + $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time(); |
|
506 | 506 | copy( |
507 | 507 | SECUREPATH.'/'.SECUREFILE, |
508 | 508 | $old_sk_filename |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login')); |
532 | 532 | |
533 | 533 | // get number of items to change |
534 | - DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0); |
|
534 | + DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0); |
|
535 | 535 | $nb_of_items = DB::count(); |
536 | 536 | |
537 | 537 | // create backup table |
538 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
538 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
539 | 539 | DB::query( |
540 | - 'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` ( |
|
540 | + 'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` ( |
|
541 | 541 | `id` int(12) NOT null AUTO_INCREMENT, |
542 | 542 | `current_table` varchar(100) NOT NULL, |
543 | 543 | `current_field` varchar(500) NOT NULL, |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ); |
566 | 566 | |
567 | 567 | // delete previous backup files |
568 | - $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names |
|
568 | + $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names |
|
569 | 569 | foreach ($files as $file) { // iterate files |
570 | 570 | if (is_file($file)) { |
571 | 571 | $file_parts = pathinfo($file); |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | echo prepareExchangedData( |
653 | 653 | array( |
654 | 654 | 'error' => true, |
655 | - 'message' => 'Input `' . $objects[0] . '` is not allowed', |
|
655 | + 'message' => 'Input `'.$objects[0].'` is not allowed', |
|
656 | 656 | 'nbOfItems' => '', |
657 | 657 | 'nextAction' => '', |
658 | 658 | ), |
@@ -665,9 +665,9 @@ discard block |
||
665 | 665 | //change all encrypted data in Items (passwords) |
666 | 666 | $rows = DB::query( |
667 | 667 | 'SELECT id, pw, pw_iv |
668 | - FROM ' . prefixTable('items') . ' |
|
668 | + FROM ' . prefixTable('items').' |
|
669 | 669 | WHERE perso = %s |
670 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
670 | + LIMIT ' . $post_start.', '.$post_length, |
|
671 | 671 | '0' |
672 | 672 | ); |
673 | 673 | foreach ($rows as $record) { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | 'current_field' => 'pw', |
680 | 680 | 'value_id' => $record['id'], |
681 | 681 | 'value' => $record['pw'], |
682 | - 'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';", |
|
682 | + 'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';", |
|
683 | 683 | 'value2' => 'none', |
684 | 684 | 'result' => 'none', |
685 | 685 | ) |
@@ -728,9 +728,9 @@ discard block |
||
728 | 728 | //change all encrypted data in Logs (passwords) |
729 | 729 | $rows = DB::query( |
730 | 730 | 'SELECT raison, increment_id |
731 | - FROM ' . prefixTable('log_items') . " |
|
731 | + FROM ' . prefixTable('log_items')." |
|
732 | 732 | WHERE action = %s AND raison LIKE 'at_pw :%' |
733 | - LIMIT " . $post_start . ', ' . $post_length, |
|
733 | + LIMIT " . $post_start.', '.$post_length, |
|
734 | 734 | 'at_modification' |
735 | 735 | ); |
736 | 736 | foreach ($rows as $record) { |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | 'current_field' => 'raison', |
743 | 743 | 'value_id' => $record['increment_id'], |
744 | 744 | 'value' => $record['raison'], |
745 | - 'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';", |
|
745 | + 'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';", |
|
746 | 746 | 'value2' => 'none', |
747 | 747 | 'result' => 'none', |
748 | 748 | ) |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | DB::update( |
771 | 771 | prefixTable('log_items'), |
772 | 772 | array( |
773 | - 'raison' => 'at_pw :' . $encrypt['string'], |
|
773 | + 'raison' => 'at_pw :'.$encrypt['string'], |
|
774 | 774 | 'encryption_type' => 'defuse', |
775 | 775 | ), |
776 | 776 | 'increment_id = %i', |
@@ -795,8 +795,8 @@ discard block |
||
795 | 795 | //change all encrypted data in CATEGORIES (passwords) |
796 | 796 | $rows = DB::query( |
797 | 797 | 'SELECT id, data |
798 | - FROM ' . prefixTable('categories_items') . ' |
|
799 | - LIMIT ' . $post_start . ', ' . $post_length |
|
798 | + FROM ' . prefixTable('categories_items').' |
|
799 | + LIMIT ' . $post_start.', '.$post_length |
|
800 | 800 | ); |
801 | 801 | foreach ($rows as $record) { |
802 | 802 | // backup data |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | 'current_field' => 'data', |
808 | 808 | 'value_id' => $record['id'], |
809 | 809 | 'value' => $record['data'], |
810 | - 'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';", |
|
810 | + 'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';", |
|
811 | 811 | 'value2' => 'none', |
812 | 812 | 'result' => 'none', |
813 | 813 | ) |
@@ -855,9 +855,9 @@ discard block |
||
855 | 855 | // Change all encrypted data in FILES (passwords) |
856 | 856 | $rows = DB::query( |
857 | 857 | 'SELECT id, file, status |
858 | - FROM ' . prefixTable('files') . " |
|
858 | + FROM ' . prefixTable('files')." |
|
859 | 859 | WHERE status = 'encrypted' |
860 | - LIMIT " . $post_start . ', ' . $post_length |
|
860 | + LIMIT " . $post_start.', '.$post_length |
|
861 | 861 | ); |
862 | 862 | foreach ($rows as $record) { |
863 | 863 | // backup data |
@@ -875,20 +875,20 @@ discard block |
||
875 | 875 | ); |
876 | 876 | $newID = DB::insertId(); |
877 | 877 | |
878 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
878 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
879 | 879 | // make a copy of file |
880 | 880 | if (!copy( |
881 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
882 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy' |
|
881 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
882 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy' |
|
883 | 883 | )) { |
884 | 884 | $error = 'Copy not possible'; |
885 | 885 | exit; |
886 | 886 | } else { |
887 | 887 | // prepare a bck of file (that will not be deleted) |
888 | - $backup_filename = $record['file'] . '.bck-change-sk.' . time(); |
|
888 | + $backup_filename = $record['file'].'.bck-change-sk.'.time(); |
|
889 | 889 | copy( |
890 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
891 | - $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename |
|
890 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
891 | + $SETTINGS['path_to_upload_folder'].'/'.$backup_filename |
|
892 | 892 | ); |
893 | 893 | } |
894 | 894 | |
@@ -896,22 +896,22 @@ discard block |
||
896 | 896 | // STEP1 - Do decryption |
897 | 897 | prepareFileWithDefuse( |
898 | 898 | 'decrypt', |
899 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
900 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted' |
|
899 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
900 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted' |
|
901 | 901 | ); |
902 | 902 | |
903 | 903 | // Do cleanup of files |
904 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']); |
|
904 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']); |
|
905 | 905 | |
906 | 906 | // STEP2 - Do encryption |
907 | 907 | prepareFileWithDefuse( |
908 | 908 | 'encryp', |
909 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
910 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] |
|
909 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
910 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'] |
|
911 | 911 | ); |
912 | 912 | |
913 | 913 | // Do cleanup of files |
914 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'); |
|
914 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'); |
|
915 | 915 | |
916 | 916 | // Update backup table |
917 | 917 | DB::update( |
@@ -937,13 +937,13 @@ discard block |
||
937 | 937 | // do some things for new object |
938 | 938 | if (isset($objects[0])) { |
939 | 939 | if ($objects[0] === 'logs') { |
940 | - DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
940 | + DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
941 | 941 | } elseif ($objects[0] === 'files') { |
942 | - DB::query('SELECT id FROM ' . prefixTable('files')); |
|
942 | + DB::query('SELECT id FROM '.prefixTable('files')); |
|
943 | 943 | } elseif ($objects[0] === 'categories') { |
944 | - DB::query('SELECT id FROM ' . prefixTable('categories_items')); |
|
944 | + DB::query('SELECT id FROM '.prefixTable('categories_items')); |
|
945 | 945 | } elseif ($objects[0] === 'custfields') { |
946 | - DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
946 | + DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
947 | 947 | } |
948 | 948 | $nb_of_items = DB::count(); |
949 | 949 | } else { |
@@ -1063,12 +1063,12 @@ discard block |
||
1063 | 1063 | ); |
1064 | 1064 | } elseif ($record['current_table'] === 'files') { |
1065 | 1065 | // restore backup file |
1066 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) { |
|
1067 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']); |
|
1068 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1066 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) { |
|
1067 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']); |
|
1068 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1069 | 1069 | rename( |
1070 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'], |
|
1071 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value'] |
|
1070 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value2'], |
|
1071 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value'] |
|
1072 | 1072 | ); |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | // drop table |
1090 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1090 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1091 | 1091 | |
1092 | 1092 | // Send back |
1093 | 1093 | echo prepareExchangedData( |
@@ -1130,17 +1130,17 @@ discard block |
||
1130 | 1130 | // delete files |
1131 | 1131 | $rows = DB::query( |
1132 | 1132 | 'SELECT value, value2 |
1133 | - FROM ' . prefixTable('sk_reencrypt_backup') . " |
|
1133 | + FROM ' . prefixTable('sk_reencrypt_backup')." |
|
1134 | 1134 | WHERE current_table = 'files'" |
1135 | 1135 | ); |
1136 | 1136 | foreach ($rows as $record) { |
1137 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1138 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']); |
|
1137 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1138 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']); |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | // drop table |
1143 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1143 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1144 | 1144 | |
1145 | 1145 | echo '[{"status":"done"}]'; |
1146 | 1146 | break; |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | 'encode' |
1172 | 1172 | ); |
1173 | 1173 | } else { |
1174 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1174 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1175 | 1175 | |
1176 | 1176 | //send email |
1177 | 1177 | $emailSettings = new EmailSettings($SETTINGS); |
@@ -1209,13 +1209,13 @@ discard block |
||
1209 | 1209 | break; |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1212 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1213 | 1213 | $emailSettings = new EmailSettings($SETTINGS); |
1214 | 1214 | $emailService = new EmailService(); |
1215 | 1215 | |
1216 | 1216 | $rows = DB::query( |
1217 | 1217 | 'SELECT * |
1218 | - FROM ' . prefixTable('emails') . ' |
|
1218 | + FROM ' . prefixTable('emails').' |
|
1219 | 1219 | WHERE status = %s OR status = %s', |
1220 | 1220 | 'not_sent', |
1221 | 1221 | '' |
@@ -1301,13 +1301,13 @@ discard block |
||
1301 | 1301 | break; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1304 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1305 | 1305 | |
1306 | 1306 | // Instatiate email settings and service |
1307 | 1307 | $emailSettings = new EmailSettings($SETTINGS); |
1308 | 1308 | $emailService = new EmailService(); |
1309 | 1309 | |
1310 | - $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1310 | + $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1311 | 1311 | foreach ($rows as $record) { |
1312 | 1312 | //send email |
1313 | 1313 | $email = $emailService->sendMail( |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | break; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1379 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1380 | 1380 | |
1381 | 1381 | // init |
1382 | 1382 | $filesList = array(); |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | FROM ' . prefixTable('files') |
1390 | 1390 | ); |
1391 | 1391 | foreach ($rows as $record) { |
1392 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
1392 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
1393 | 1393 | $addFile = false; |
1394 | 1394 | if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted') |
1395 | 1395 | || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear') |
@@ -1454,8 +1454,8 @@ discard block |
||
1454 | 1454 | $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
1455 | 1455 | $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT); |
1456 | 1456 | |
1457 | - include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
1458 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1457 | + include $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
1458 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1459 | 1459 | |
1460 | 1460 | $cpt = 0; |
1461 | 1461 | $continu = true; |
@@ -1468,33 +1468,33 @@ discard block |
||
1468 | 1468 | // Get file name |
1469 | 1469 | $file_info = DB::queryFirstRow( |
1470 | 1470 | 'SELECT file |
1471 | - FROM ' . prefixTable('files') . ' |
|
1471 | + FROM ' . prefixTable('files').' |
|
1472 | 1472 | WHERE id = %i', |
1473 | 1473 | $file |
1474 | 1474 | ); |
1475 | 1475 | |
1476 | 1476 | // skip file is Coherancey not respected |
1477 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) { |
|
1477 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) { |
|
1478 | 1478 | // Case where we want to decrypt |
1479 | 1479 | if ($post_option === 'decrypt') { |
1480 | 1480 | prepareFileWithDefuse( |
1481 | 1481 | 'decrypt', |
1482 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
1483 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
1482 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
1483 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
1484 | 1484 | ); |
1485 | 1485 | // Case where we want to encrypt |
1486 | 1486 | } elseif ($post_option === 'encrypt') { |
1487 | 1487 | prepareFileWithDefuse( |
1488 | 1488 | 'encrypt', |
1489 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
1490 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
1489 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
1490 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
1491 | 1491 | ); |
1492 | 1492 | } |
1493 | 1493 | // Do file cleanup |
1494 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS); |
|
1494 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS); |
|
1495 | 1495 | rename( |
1496 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
1497 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'] |
|
1496 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
1497 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'] |
|
1498 | 1498 | ); |
1499 | 1499 | |
1500 | 1500 | // store in DB |
@@ -1529,8 +1529,8 @@ discard block |
||
1529 | 1529 | $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted' |
1530 | 1530 | ); |
1531 | 1531 | |
1532 | - $message = $lang->get('last_execution') . ' ' . |
|
1533 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
1532 | + $message = $lang->get('last_execution').' '. |
|
1533 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
1534 | 1534 | '<i class="fas fa-check text-success ml-2 mr-3"></i>'; |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT); |
1625 | 1625 | |
1626 | 1626 | DB::query( |
1627 | - 'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i', |
|
1627 | + 'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i', |
|
1628 | 1628 | $post_id |
1629 | 1629 | ); |
1630 | 1630 | } |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | // Delete existing key |
1720 | 1720 | } elseif (null !== $post_action && $post_action === 'delete') { |
1721 | 1721 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
1722 | - DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id); |
|
1722 | + DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | echo prepareExchangedData( |
@@ -1734,7 +1734,7 @@ discard block |
||
1734 | 1734 | |
1735 | 1735 | case 'save_api_status': |
1736 | 1736 | // Do query |
1737 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
1737 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
1738 | 1738 | $counter = DB::count(); |
1739 | 1739 | if ($counter === 0) { |
1740 | 1740 | DB::insert( |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | case 'run_duo_config_check': |
1765 | 1765 | //Libraries call |
1766 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1766 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1767 | 1767 | // Check KEY |
1768 | 1768 | if ($post_key !== $session->get('key')) { |
1769 | 1769 | echo prepareExchangedData( |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | } else { |
1870 | 1870 | $tmp = 1; |
1871 | 1871 | } |
1872 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
1872 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
1873 | 1873 | $counter = DB::count(); |
1874 | 1874 | if ($counter === 0) { |
1875 | 1875 | DB::insert( |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | |
1898 | 1898 | // ga_website_name |
1899 | 1899 | if (is_null($dataReceived['ga_website_name']) === false) { |
1900 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
1900 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
1901 | 1901 | $counter = DB::count(); |
1902 | 1902 | if ($counter === 0) { |
1903 | 1903 | DB::insert( |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | // send data |
1930 | - echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]'; |
|
1930 | + echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]'; |
|
1931 | 1931 | break; |
1932 | 1932 | |
1933 | 1933 | case 'save_agses_options': |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | |
1951 | 1951 | // agses_hosted_url |
1952 | 1952 | if (!is_null($dataReceived['agses_hosted_url'])) { |
1953 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
1953 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
1954 | 1954 | $counter = DB::count(); |
1955 | 1955 | if ($counter === 0) { |
1956 | 1956 | DB::insert( |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | |
1982 | 1982 | // agses_hosted_id |
1983 | 1983 | if (!is_null($dataReceived['agses_hosted_id'])) { |
1984 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
1984 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
1985 | 1985 | $counter = DB::count(); |
1986 | 1986 | if ($counter === 0) { |
1987 | 1987 | DB::insert( |
@@ -2012,7 +2012,7 @@ discard block |
||
2012 | 2012 | |
2013 | 2013 | // agses_hosted_apikey |
2014 | 2014 | if (!is_null($dataReceived['agses_hosted_apikey'])) { |
2015 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2015 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2016 | 2016 | $counter = DB::count(); |
2017 | 2017 | if ($counter === 0) { |
2018 | 2018 | DB::insert( |
@@ -2042,7 +2042,7 @@ discard block |
||
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | // send data |
2045 | - echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]'; |
|
2045 | + echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]'; |
|
2046 | 2046 | break; |
2047 | 2047 | |
2048 | 2048 | case 'save_option_change': |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | |
2084 | 2084 | // Check if setting is already in DB. If NO then insert, if YES then update. |
2085 | 2085 | $data = DB::query( |
2086 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2086 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2087 | 2087 | WHERE type = %s AND intitule = %s', |
2088 | 2088 | 'admin', |
2089 | 2089 | $post_field |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | array( |
2107 | 2107 | 'valeur' => time(), |
2108 | 2108 | 'type' => 'admin', |
2109 | - 'intitule' => $post_field . '_time', |
|
2109 | + 'intitule' => $post_field.'_time', |
|
2110 | 2110 | 'updated_at' => time(), |
2111 | 2111 | ) |
2112 | 2112 | ); |
@@ -2128,10 +2128,10 @@ discard block |
||
2128 | 2128 | if ($post_field === 'send_stats') { |
2129 | 2129 | // Check if previous time exists, if not them insert this value in DB |
2130 | 2130 | DB::query( |
2131 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2131 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2132 | 2132 | WHERE type = %s AND intitule = %s', |
2133 | 2133 | 'admin', |
2134 | - $post_field . '_time' |
|
2134 | + $post_field.'_time' |
|
2135 | 2135 | ); |
2136 | 2136 | $counter = DB::count(); |
2137 | 2137 | if ($counter === 0) { |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | array( |
2141 | 2141 | 'valeur' => 0, |
2142 | 2142 | 'type' => 'admin', |
2143 | - 'intitule' => $post_field . '_time', |
|
2143 | + 'intitule' => $post_field.'_time', |
|
2144 | 2144 | 'created_at' => time(), |
2145 | 2145 | ) |
2146 | 2146 | ); |
@@ -2162,13 +2162,13 @@ discard block |
||
2162 | 2162 | // special Cases |
2163 | 2163 | if ($post_field === 'cpassman_url') { |
2164 | 2164 | // update also jsUrl for CSFP protection |
2165 | - $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2165 | + $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2166 | 2166 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
2167 | 2167 | $data = file_get_contents($csrfp_file); |
2168 | 2168 | $posJsUrl = strpos($data, '"jsUrl" => "'); |
2169 | 2169 | $posEndLine = strpos($data, '",', $posJsUrl); |
2170 | 2170 | $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2)); |
2171 | - $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data); |
|
2171 | + $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data); |
|
2172 | 2172 | file_put_contents($csrfp_file, $newdata); |
2173 | 2173 | } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) { |
2174 | 2174 | DB::update( |
@@ -2187,7 +2187,7 @@ discard block |
||
2187 | 2187 | echo prepareExchangedData( |
2188 | 2188 | array( |
2189 | 2189 | 'error' => false, |
2190 | - 'misc' => $counter . ' ; ' . $SETTINGS[$post_field], |
|
2190 | + 'misc' => $counter.' ; '.$SETTINGS[$post_field], |
|
2191 | 2191 | 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '', |
2192 | 2192 | ), |
2193 | 2193 | 'encode' |
@@ -2230,7 +2230,7 @@ discard block |
||
2230 | 2230 | |
2231 | 2231 | // send statistics |
2232 | 2232 | if (null !== $post_status) { |
2233 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2233 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2234 | 2234 | $counter = DB::count(); |
2235 | 2235 | if ($counter === 0) { |
2236 | 2236 | DB::insert( |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | |
2262 | 2262 | // send statistics items |
2263 | 2263 | if (null !== $post_list) { |
2264 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2264 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2265 | 2265 | $counter = DB::count(); |
2266 | 2266 | if ($counter === 0) { |
2267 | 2267 | DB::insert( |
@@ -2307,7 +2307,7 @@ discard block |
||
2307 | 2307 | break; |
2308 | 2308 | } |
2309 | 2309 | |
2310 | - if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) { |
|
2310 | + if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) { |
|
2311 | 2311 | if (DB::count() === 1) { |
2312 | 2312 | echo 1; |
2313 | 2313 | } else { |
@@ -2368,7 +2368,7 @@ discard block |
||
2368 | 2368 | |
2369 | 2369 | $rows = DB::query( |
2370 | 2370 | 'SELECT id, title |
2371 | - FROM ' . prefixTable('roles_title') . ' |
|
2371 | + FROM ' . prefixTable('roles_title').' |
|
2372 | 2372 | ORDER BY title ASC' |
2373 | 2373 | ); |
2374 | 2374 | foreach ($rows as $record) { |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | |
2501 | 2501 | $ignoredFiles = DB::queryFirstField( |
2502 | 2502 | 'SELECT valeur |
2503 | - FROM ' . prefixTable('misc') . ' |
|
2503 | + FROM ' . prefixTable('misc').' |
|
2504 | 2504 | WHERE type = %s AND intitule = %s', |
2505 | 2505 | 'admin', |
2506 | 2506 | 'ignored_unknown_files' |
@@ -2543,7 +2543,7 @@ discard block |
||
2543 | 2543 | // Get ignored unknown files |
2544 | 2544 | $existingData = DB::queryFirstRow( |
2545 | 2545 | 'SELECT valeur |
2546 | - FROM ' . prefixTable('misc') . ' |
|
2546 | + FROM ' . prefixTable('misc').' |
|
2547 | 2547 | WHERE type = %s AND intitule = %s', |
2548 | 2548 | 'admin', |
2549 | 2549 | 'ignored_unknown_files' |
@@ -2600,7 +2600,7 @@ discard block |
||
2600 | 2600 | // Get the list of files to delete |
2601 | 2601 | $filesToDelete = DB::queryFirstField( |
2602 | 2602 | 'SELECT valeur |
2603 | - FROM ' . prefixTable('misc') . ' |
|
2603 | + FROM ' . prefixTable('misc').' |
|
2604 | 2604 | WHERE type = %s AND intitule = %s', |
2605 | 2605 | 'admin', |
2606 | 2606 | 'unknown_files' |
@@ -2646,7 +2646,7 @@ discard block |
||
2646 | 2646 | // Get some TP USER info |
2647 | 2647 | $userInfo = DB::queryFirstRow( |
2648 | 2648 | 'SELECT id, public_key, private_key, pw |
2649 | - FROM ' . prefixTable('users') . ' |
|
2649 | + FROM ' . prefixTable('users').' |
|
2650 | 2650 | WHERE id = %i', |
2651 | 2651 | TP_USER_ID, |
2652 | 2652 | ); |
@@ -2695,7 +2695,7 @@ discard block |
||
2695 | 2695 | $lang = new Language($session->get('user-language') ?? 'english'); |
2696 | 2696 | |
2697 | 2697 | $results = []; |
2698 | - $fullPath = __DIR__ . '/../'; |
|
2698 | + $fullPath = __DIR__.'/../'; |
|
2699 | 2699 | |
2700 | 2700 | foreach ($files as $file) { |
2701 | 2701 | // Normalize path separators for cross-platform compatibility |
@@ -2744,7 +2744,7 @@ discard block |
||
2744 | 2744 | } |
2745 | 2745 | |
2746 | 2746 | // Try to delete the file |
2747 | - $deleteResult = '';//@unlink($normalizedPath); |
|
2747 | + $deleteResult = ''; //@unlink($normalizedPath); |
|
2748 | 2748 | |
2749 | 2749 | if ($deleteResult) { |
2750 | 2750 | $results[$normalizedPath] = [ |
@@ -2774,7 +2774,7 @@ discard block |
||
2774 | 2774 | */ |
2775 | 2775 | function filesIntegrityCheck($baseDir): array |
2776 | 2776 | { |
2777 | - $referenceFile = __DIR__ . '/../files_reference.txt'; |
|
2777 | + $referenceFile = __DIR__.'/../files_reference.txt'; |
|
2778 | 2778 | |
2779 | 2779 | $unknownFiles = findUnknownFiles($baseDir, $referenceFile); |
2780 | 2780 | |
@@ -2812,7 +2812,7 @@ discard block |
||
2812 | 2812 | $dir, |
2813 | 2813 | FilesystemIterator::SKIP_DOTS |
2814 | 2814 | ), |
2815 | - function ($current, $key, $iterator) { |
|
2815 | + function($current, $key, $iterator) { |
|
2816 | 2816 | // Ignore hidden files and folders |
2817 | 2817 | if ($current->getFilename()[0] === '.') { |
2818 | 2818 | return false; |
@@ -2826,7 +2826,7 @@ discard block |
||
2826 | 2826 | foreach ($iterator as $file) { |
2827 | 2827 | try { |
2828 | 2828 | if ($file->isFile()) { |
2829 | - $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
2829 | + $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
2830 | 2830 | $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux |
2831 | 2831 | |
2832 | 2832 | // Split relatif path into parts |
@@ -2892,7 +2892,7 @@ discard block |
||
2892 | 2892 | // Get ignored files |
2893 | 2893 | $ignoredFiles = DB::queryFirstField( |
2894 | 2894 | 'SELECT valeur |
2895 | - FROM ' . prefixTable('misc') . ' |
|
2895 | + FROM ' . prefixTable('misc').' |
|
2896 | 2896 | WHERE type = %s AND intitule = %s', |
2897 | 2897 | 'admin', |
2898 | 2898 | 'ignored_unknown_files' |
@@ -2911,7 +2911,7 @@ discard block |
||
2911 | 2911 | function tablesIntegrityCheck(): array |
2912 | 2912 | { |
2913 | 2913 | // Get integrity tables file |
2914 | - $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json'; |
|
2914 | + $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json'; |
|
2915 | 2915 | if (file_exists($integrityTablesFile) === false) { |
2916 | 2916 | return [ |
2917 | 2917 | 'error' => true, |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | // Get all tables |
2930 | 2930 | $tables = []; |
2931 | 2931 | foreach (DB::queryFirstColumn("SHOW TABLES") as $table) { |
2932 | - $tables[] = str_replace(DB_PREFIX, "", $table);; |
|
2932 | + $tables[] = str_replace(DB_PREFIX, "", $table); ; |
|
2933 | 2933 | } |
2934 | 2934 | // Prepare the integrity check |
2935 | 2935 | $tablesInError = []; |
@@ -2995,7 +2995,7 @@ discard block |
||
2995 | 2995 | |
2996 | 2996 | // Compare hashes |
2997 | 2997 | $expectedHash = $referenceData[$file]; |
2998 | - $actualHash = md5_file($baseDir . '/' . $file); |
|
2998 | + $actualHash = md5_file($baseDir.'/'.$file); |
|
2999 | 2999 | |
3000 | 3000 | if ($expectedHash !== $actualHash) { |
3001 | 3001 | $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)"; |
@@ -3048,7 +3048,7 @@ discard block |
||
3048 | 3048 | foreach ($iterator as $file) { |
3049 | 3049 | if ($file->isFile()) { |
3050 | 3050 | // Build relative path |
3051 | - $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
3051 | + $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
3052 | 3052 | $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows |
3053 | 3053 | // Calculate hash |
3054 | 3054 | $files[$relativePath] = md5_file($file->getPathname()); |
@@ -3078,8 +3078,8 @@ discard block |
||
3078 | 3078 | // Loop on items |
3079 | 3079 | $item = DB::queryFirstRow( |
3080 | 3080 | 'SELECT i.id, i.pw, s.share_key, s.increment_id |
3081 | - FROM ' . prefixTable('items') . ' i |
|
3082 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' s ON i.id = s.object_id |
|
3081 | + FROM ' . prefixTable('items').' i |
|
3082 | + INNER JOIN ' . prefixTable('sharekeys_items').' s ON i.id = s.object_id |
|
3083 | 3083 | WHERE i.perso = %i |
3084 | 3084 | AND s.user_id = %i |
3085 | 3085 | ORDER BY RAND() |
@@ -3108,7 +3108,7 @@ discard block |
||
3108 | 3108 | // Get all items in database |
3109 | 3109 | $rows = DB::queryFirstRow( |
3110 | 3110 | 'SELECT count(*) as counter |
3111 | - FROM ' . prefixTable('sharekeys_items') . ' s |
|
3111 | + FROM ' . prefixTable('sharekeys_items').' s |
|
3112 | 3112 | WHERE s.user_id = %i', |
3113 | 3113 | TP_USER_ID |
3114 | 3114 | ); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | require_once __DIR__.'/traits/ItemHandlerTrait.php'; |
33 | 33 | require_once __DIR__.'/traits/UserHandlerTrait.php'; |
34 | 34 | require_once __DIR__.'/traits/EmailTrait.php'; |
35 | -require_once __DIR__ . '/taskLogger.php'; |
|
35 | +require_once __DIR__.'/taskLogger.php'; |
|
36 | 36 | |
37 | 37 | class TaskWorker { |
38 | 38 | use ItemHandlerTrait; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function execute() { |
66 | 66 | try { |
67 | - if (LOG_TASKS=== true) $this->logger->log('Processing task: ' . print_r($this->taskData, true), 'DEBUG'); |
|
67 | + if (LOG_TASKS === true) $this->logger->log('Processing task: '.print_r($this->taskData, true), 'DEBUG'); |
|
68 | 68 | // Dispatch selon le type de processus |
69 | 69 | switch ($this->processType) { |
70 | 70 | case 'item_copy': |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $arguments = ''; |
137 | 137 | } |
138 | 138 | |
139 | - if (LOG_TASKS=== true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
139 | + if (LOG_TASKS === true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
140 | 140 | |
141 | 141 | // Add 'arguments' only if not empty |
142 | 142 | if (!empty($arguments)) { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'increment_id = %i', |
151 | 151 | $this->taskId |
152 | 152 | ); |
153 | - if (LOG_TASKS=== true) $this->logger->log('Finishing task: ' . $this->taskId, 'DEBUG'); |
|
153 | + if (LOG_TASKS === true) $this->logger->log('Finishing task: '.$this->taskId, 'DEBUG'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | 'increment_id = %i', |
174 | 174 | $this->taskId |
175 | 175 | ); |
176 | - $this->logger->log('Task failure: ' . $e->getMessage(), 'ERROR'); |
|
176 | + $this->logger->log('Task failure: '.$e->getMessage(), 'ERROR'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | * @return void |
186 | 186 | */ |
187 | 187 | private function processSubTasks($arguments) { |
188 | - if (LOG_TASKS=== true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
188 | + if (LOG_TASKS === true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
189 | 189 | // Get all subtasks related to this task |
190 | 190 | $subtasks = DB::query( |
191 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
191 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
192 | 192 | $this->taskId |
193 | 193 | ); |
194 | 194 | |
195 | 195 | // Check if there are any subtasks to process |
196 | 196 | if (empty($subtasks)) { |
197 | - if (LOG_TASKS=== true) $this->logger->log('No subtask was found for task: ' . $this->taskId, 'DEBUG'); |
|
197 | + if (LOG_TASKS === true) $this->logger->log('No subtask was found for task: '.$this->taskId, 'DEBUG'); |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | // Get the subtask data |
205 | 205 | $subtaskData = json_decode($subtask['task'], true); |
206 | 206 | |
207 | - if (LOG_TASKS=== true) $this->logger->log('Processing subtask: ' . $subtaskData['step'], 'DEBUG'); |
|
207 | + if (LOG_TASKS === true) $this->logger->log('Processing subtask: '.$subtaskData['step'], 'DEBUG'); |
|
208 | 208 | |
209 | 209 | // Mark subtask as in progress |
210 | 210 | DB::update( |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | $subtask['increment_id'] |
257 | 257 | ); |
258 | 258 | |
259 | - $this->logger->log('processSubTasks : ' . $e->getMessage(), 'ERROR'); |
|
259 | + $this->logger->log('processSubTasks : '.$e->getMessage(), 'ERROR'); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | 263 | // Are all subtasks completed? |
264 | 264 | $remainingSubtasks = DB::queryFirstField( |
265 | - 'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0', |
|
265 | + 'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0', |
|
266 | 266 | $this->taskId |
267 | 267 | ); |
268 | 268 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | error_log("Usage: php background_tasks___worker.php <task_id> <process_type> [<task_data>]"); |
279 | 279 | exit(1); |
280 | 280 | } |
281 | -$taskId = (int)$argv[1]; |
|
281 | +$taskId = (int) $argv[1]; |
|
282 | 282 | $processType = $argv[2]; |
283 | 283 | $taskData = $argv[3] ?? null; |
284 | 284 | if ($taskData) { |
@@ -64,7 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function execute() { |
66 | 66 | try { |
67 | - if (LOG_TASKS=== true) $this->logger->log('Processing task: ' . print_r($this->taskData, true), 'DEBUG'); |
|
67 | + if (LOG_TASKS=== true) { |
|
68 | + $this->logger->log('Processing task: ' . print_r($this->taskData, true), 'DEBUG'); |
|
69 | + } |
|
68 | 70 | // Dispatch selon le type de processus |
69 | 71 | switch ($this->processType) { |
70 | 72 | case 'item_copy': |
@@ -136,7 +138,9 @@ discard block |
||
136 | 138 | $arguments = ''; |
137 | 139 | } |
138 | 140 | |
139 | - if (LOG_TASKS=== true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
141 | + if (LOG_TASKS=== true) { |
|
142 | + $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
143 | + } |
|
140 | 144 | |
141 | 145 | // Add 'arguments' only if not empty |
142 | 146 | if (!empty($arguments)) { |
@@ -150,7 +154,9 @@ discard block |
||
150 | 154 | 'increment_id = %i', |
151 | 155 | $this->taskId |
152 | 156 | ); |
153 | - if (LOG_TASKS=== true) $this->logger->log('Finishing task: ' . $this->taskId, 'DEBUG'); |
|
157 | + if (LOG_TASKS=== true) { |
|
158 | + $this->logger->log('Finishing task: ' . $this->taskId, 'DEBUG'); |
|
159 | + } |
|
154 | 160 | } |
155 | 161 | |
156 | 162 | /** |
@@ -185,7 +191,9 @@ discard block |
||
185 | 191 | * @return void |
186 | 192 | */ |
187 | 193 | private function processSubTasks($arguments) { |
188 | - if (LOG_TASKS=== true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
194 | + if (LOG_TASKS=== true) { |
|
195 | + $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
196 | + } |
|
189 | 197 | // Get all subtasks related to this task |
190 | 198 | $subtasks = DB::query( |
191 | 199 | 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
@@ -194,7 +202,9 @@ discard block |
||
194 | 202 | |
195 | 203 | // Check if there are any subtasks to process |
196 | 204 | if (empty($subtasks)) { |
197 | - if (LOG_TASKS=== true) $this->logger->log('No subtask was found for task: ' . $this->taskId, 'DEBUG'); |
|
205 | + if (LOG_TASKS=== true) { |
|
206 | + $this->logger->log('No subtask was found for task: ' . $this->taskId, 'DEBUG'); |
|
207 | + } |
|
198 | 208 | return; |
199 | 209 | } |
200 | 210 | |
@@ -204,7 +214,9 @@ discard block |
||
204 | 214 | // Get the subtask data |
205 | 215 | $subtaskData = json_decode($subtask['task'], true); |
206 | 216 | |
207 | - if (LOG_TASKS=== true) $this->logger->log('Processing subtask: ' . $subtaskData['step'], 'DEBUG'); |
|
217 | + if (LOG_TASKS=== true) { |
|
218 | + $this->logger->log('Processing subtask: ' . $subtaskData['step'], 'DEBUG'); |
|
219 | + } |
|
208 | 220 | |
209 | 221 | // Mark subtask as in progress |
210 | 222 | DB::update( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) { |
69 | 69 | // Not allowed page |
70 | 70 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
71 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
71 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | // error |
174 | 174 | toastr.remove(); |
175 | 175 | toastr.error( |
176 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
176 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
177 | 177 | '', { |
178 | 178 | closeButton: true, |
179 | 179 | positionClass: 'toast-bottom-right' |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | // error |
256 | 256 | toastr.remove(); |
257 | 257 | toastr.error( |
258 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
258 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
259 | 259 | '', { |
260 | 260 | closeButton: true, |
261 | 261 | positionClass: 'toast-bottom-right' |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | // error |
319 | 319 | toastr.remove(); |
320 | 320 | toastr.error( |
321 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
321 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
322 | 322 | '', { |
323 | 323 | closeButton: true, |
324 | 324 | positionClass: 'toast-bottom-right' |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | // error |
418 | 418 | toastr.remove(); |
419 | 419 | toastr.error( |
420 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
420 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
421 | 421 | '', { |
422 | 422 | closeButton: true, |
423 | 423 | positionClass: 'toast-bottom-right' |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | //const className = result.success ? 'success' : 'error'; |
448 | 448 | const icon = result.success ? '<i class="fa-solid fa-check text-success mr-1"></i>' : '<i class="fa-solid fa-xmark text-danger mr-1"></i>'; |
449 | - const message = result.success ? '<?php echo $lang->get('server_returned_data');?>' : 'Error: ' + result.error; |
|
449 | + const message = result.success ? '<?php echo $lang->get('server_returned_data'); ?>' : 'Error: ' + result.error; |
|
450 | 450 | |
451 | 451 | output += '<li>' + icon + '<b>' + file + '</b><br/>' + message + '</li>'; |
452 | 452 | }); |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | // error |
478 | 478 | toastr.remove(); |
479 | 479 | toastr.error( |
480 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
480 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
481 | 481 | '', { |
482 | 482 | closeButton: true, |
483 | 483 | positionClass: 'toast-bottom-right' |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | // error |
542 | 542 | toastr.remove(); |
543 | 543 | toastr.error( |
544 | - '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error, |
|
544 | + '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error, |
|
545 | 545 | '', { |
546 | 546 | closeButton: true, |
547 | 547 | positionClass: 'toast-bottom-right' |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ) { |
74 | 74 | // Not allowed page |
75 | 75 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
76 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
76 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
77 | 77 | exit; |
78 | 78 | } |
79 | 79 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | if (null === $session->get('user-accessible_folders') |
93 | 93 | || empty($session->get('user-accessible_folders')) === true |
94 | 94 | ) { |
95 | - echo '{"sEcho": ' . $request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }'; |
|
95 | + echo '{"sEcho": '.$request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }'; |
|
96 | 96 | exit; |
97 | 97 | } |
98 | 98 | |
99 | 99 | //Columns name |
100 | -$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data'];// |
|
100 | +$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data']; // |
|
101 | 101 | $aSortTypes = ['ASC', 'DESC']; |
102 | 102 | //init SQL variables |
103 | 103 | $sOrder = $sLimit = $sWhere = ''; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | //Get current user "personal folder" ID |
119 | 119 | $row = DB::query( |
120 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i', |
|
120 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i', |
|
121 | 121 | intval($session->get('user-id')) |
122 | 122 | ); |
123 | 123 | //get list of personal folders |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | $listPf = ''; |
127 | 127 | if (empty($row['id']) === false) { |
128 | 128 | $rows = DB::query( |
129 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
129 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
130 | 130 | WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i', |
131 | 131 | filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT), |
132 | 132 | filter_var($session->get('user-id'), FILTER_SANITIZE_NUMBER_INT) |
133 | 133 | ); |
134 | 134 | foreach ($rows as $record) { |
135 | - if (! in_array($record['id'], $arrayPf)) { |
|
135 | + if (!in_array($record['id'], $arrayPf)) { |
|
136 | 136 | //build an array of personal folders ids |
137 | 137 | array_push($arrayPf, $record['id']); |
138 | 138 | //build also a string with those ids |
139 | 139 | if (empty($listPf)) { |
140 | 140 | $listPf = $record['id']; |
141 | 141 | } else { |
142 | - $listPf .= ', ' . $record['id']; |
|
142 | + $listPf .= ', '.$record['id']; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | //Paging |
150 | 150 | $sLimit = ''; |
151 | 151 | if (null !== $request->query->get('start') && $request->query->get('length') !== '-1') { |
152 | - $sLimit = 'LIMIT ' . $request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT) . ', ' . $request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT) . ''; |
|
152 | + $sLimit = 'LIMIT '.$request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT).', '.$request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT).''; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //Ordering |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | } |
164 | 164 | $sOrder = 'ORDER BY '; |
165 | 165 | if ($orderParam[0]['column'] >= 0) { |
166 | - $sOrder .= '' . $aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' ' |
|
167 | - . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . ', '; |
|
166 | + $sOrder .= ''.$aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)].' ' |
|
167 | + . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS).', '; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $sOrder = substr_replace($sOrder, '', -2); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $sOrder = ''; |
173 | 173 | } |
174 | 174 | } else { |
175 | - $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC'; |
|
175 | + $sOrder = 'ORDER BY '.$aColumns[1].' ASC'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | // Define criteria |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | if (empty($search_criteria) === false) { |
197 | 197 | $sWhere .= ' AND ('; |
198 | 198 | for ($i = 0; $i < count($aColumns); ++$i) { |
199 | - $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR '; |
|
199 | + $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR '; |
|
200 | 200 | } |
201 | - $sWhere = substr_replace((string) $sWhere, '', -3) . ') '; |
|
201 | + $sWhere = substr_replace((string) $sWhere, '', -3).') '; |
|
202 | 202 | $crit = [ |
203 | 203 | 'idtree' => array_unique($folders), |
204 | 204 | '0' => $search_criteria, |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | |
236 | 236 | // Do NOT show the items in PERSONAL FOLDERS |
237 | 237 | if (empty($listPf) === false) { |
238 | - $sWhere = 'WHERE ' . $sWhere . ' AND c.id_tree NOT IN %ls_pf '; |
|
238 | + $sWhere = 'WHERE '.$sWhere.' AND c.id_tree NOT IN %ls_pf '; |
|
239 | 239 | } else { |
240 | - $sWhere = 'WHERE ' . $sWhere; |
|
240 | + $sWhere = 'WHERE '.$sWhere; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Do queries |
244 | 244 | DB::query( |
245 | 245 | "SELECT c.id |
246 | - FROM " . prefixTable('cache') . " AS c |
|
247 | - LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id) |
|
246 | + FROM " . prefixTable('cache')." AS c |
|
247 | + LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id) |
|
248 | 248 | {$sWhere} |
249 | 249 | {$sOrder}", |
250 | 250 | $crit |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | $iTotal = DB::count(); |
253 | 253 | $rows = DB::query( |
254 | 254 | "SELECT c.*, ci.data, i.item_key |
255 | - FROM " . prefixTable('cache') . " AS c |
|
256 | - LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id) |
|
257 | - INNER JOIN " . prefixTable('items') . " AS i ON (i.id = c.id) |
|
255 | + FROM " . prefixTable('cache')." AS c |
|
256 | + LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id) |
|
257 | + INNER JOIN " . prefixTable('items')." AS i ON (i.id = c.id) |
|
258 | 258 | {$sWhere} |
259 | 259 | {$sOrder} |
260 | 260 | {$sLimit}", |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (null === $request->query->get('type')) { |
280 | 280 | $sOutput = '{'; |
281 | 281 | if (null !== $request->query->get('draw')) { |
282 | - $sOutput .= '"draw": ' . $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
282 | + $sOutput .= '"draw": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
283 | 283 | } |
284 | 284 | $sOutput .= '"data": ['; |
285 | 285 | $sOutputConst = ''; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | foreach (explode(';', $session->get('user-roles')) as $role) { |
297 | 297 | //db::debugmode(true); |
298 | 298 | $access = DB::queryFirstRow( |
299 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
299 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
300 | 300 | $role, |
301 | 301 | $record['id_tree'] |
302 | 302 | ); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel; |
318 | 318 | if ($accessLevel === 0) { |
319 | - $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">'; |
|
319 | + $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">'; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | if ((int) $accessLevel === 0) { |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | if (empty($restrictedTo)) { |
357 | 357 | $restrictedTo = $session->get('user-id'); |
358 | 358 | } else { |
359 | - $restrictedTo .= ',' . $session->get('user-id'); |
|
359 | + $restrictedTo .= ','.$session->get('user-id'); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | 363 | //col1 |
364 | - $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . $lang->get('open_url_link') . '\" onClick=\"window.location.href='index.php?page=items&group=' . $record['id_tree'] . '&id=' . $record['id'] . ''\" style=\"cursor:pointer;\"></i>' . |
|
365 | - '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . stripslashes($lang->get('see_item_title')) . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '",' ; |
|
364 | + $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.$lang->get('open_url_link').'\" onClick=\"window.location.href='index.php?page=items&group='.$record['id_tree'].'&id='.$record['id'].''\" style=\"cursor:pointer;\"></i>'. |
|
365 | + '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.stripslashes($lang->get('see_item_title')).'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'",'; |
|
366 | 366 | //col2 |
367 | - $sOutputItem .= '"'.base64_encode('<span id=\"item_label-' . $record['id'] . '\">' . (str_replace("\\", "\", (string) $record['label'])) . '</span>').'", '; // replace backslash #3015 |
|
367 | + $sOutputItem .= '"'.base64_encode('<span id=\"item_label-'.$record['id'].'\">'.(str_replace("\\", "\", (string) $record['label'])).'</span>').'", '; // replace backslash #3015 |
|
368 | 368 | //col3 |
369 | - $sOutputItem .= '"' . base64_encode(str_replace('&', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))) . '", '; |
|
369 | + $sOutputItem .= '"'.base64_encode(str_replace('&', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))).'", '; |
|
370 | 370 | //col4 |
371 | 371 | //get restriction from ROles |
372 | 372 | $restrictedToRole = false; |
373 | 373 | $rTmp = DB::queryFirstColumn( |
374 | - 'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', |
|
374 | + 'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', |
|
375 | 375 | $record['id'] |
376 | 376 | ); |
377 | 377 | // We considere here that if user has at least one group similar to the object ones |
@@ -389,14 +389,14 @@ discard block |
||
389 | 389 | } else { |
390 | 390 | $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description'])); |
391 | 391 | if (strlen($txt) > 50) { |
392 | - $sOutputItem .= '"' . base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)) . '", '; |
|
392 | + $sOutputItem .= '"'.base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)).'", '; |
|
393 | 393 | } else { |
394 | - $sOutputItem .= '"' . base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))) . '", '; |
|
394 | + $sOutputItem .= '"'.base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))).'", '; |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
398 | 398 | //col5 - TAGS |
399 | - $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)) . '", '; |
|
399 | + $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)).'", '; |
|
400 | 400 | // col6 - URL |
401 | 401 | if ($record['url'] !== '0') { |
402 | 402 | $sOutputItem .= '"'.htmlspecialchars(filter_var($record['url'], FILTER_SANITIZE_URL)).'", '; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | //col7 - Prepare the Treegrid |
408 | - $sOutputItem .= '"' . base64_encode(stripslashes((string) $record['folder'])) . '"'; |
|
408 | + $sOutputItem .= '"'.base64_encode(stripslashes((string) $record['folder'])).'"'; |
|
409 | 409 | //Finish the line |
410 | 410 | //$sOutputItem .= '], '; |
411 | 411 | if ($getItemInList === true) { |
@@ -414,17 +414,17 @@ discard block |
||
414 | 414 | --$iTotal; |
415 | 415 | } |
416 | 416 | } |
417 | - if (! empty($sOutputConst)) { |
|
417 | + if (!empty($sOutputConst)) { |
|
418 | 418 | $sOutput .= substr_replace($sOutputConst, '', -2); |
419 | 419 | } |
420 | 420 | $sOutput .= '], '; |
421 | - $sOutput .= '"recordsTotal": ' . $iTotal . ', '; |
|
422 | - $sOutput .= '"recordsFiltered": ' . $iTotal . ' }'; |
|
421 | + $sOutput .= '"recordsTotal": '.$iTotal.', '; |
|
422 | + $sOutput .= '"recordsFiltered": '.$iTotal.' }'; |
|
423 | 423 | // file deepcode ignore XSS: data is secured |
424 | 424 | echo ($sOutput); |
425 | 425 | } elseif (null !== $request->query->get('type') && ($request->query->get('type') === 'search_for_items' || $request->query->get('type') === 'search_for_items_with_tags')) { |
426 | 426 | include_once 'main.functions.php'; |
427 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
427 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
428 | 428 | |
429 | 429 | $totalItems = $request->query->filter('totalItems', null, FILTER_SANITIZE_NUMBER_INT); |
430 | 430 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $arr_data[$record['id']]['tree_id'] = (int) $record['id_tree']; |
436 | 436 | $arr_data[$record['id']]['label'] = (string) $record['label']; |
437 | 437 | $arr_data[$record['id']]['desc'] = (string) strip_tags(explode('<br>', $record['description'])[0]); |
438 | - $arr_data[$record['id']]['folder'] = (string)$record['folder']; |
|
438 | + $arr_data[$record['id']]['folder'] = (string) $record['folder']; |
|
439 | 439 | $arr_data[$record['id']]['login'] = (string) strtr($record['login'], '"', '"'); |
440 | 440 | $arr_data[$record['id']]['item_key'] = (string) $record['item_key']; |
441 | 441 | $arr_data[$record['id']]['link'] = (string) $record['url'] !== '0' && empty($record['url']) === false ? filter_var($record['url'], FILTER_SANITIZE_URL) : ''; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | |
449 | 449 | // Anyone can modify? |
450 | 450 | $tmp = DB::queryFirstRow( |
451 | - 'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i', |
|
451 | + 'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i', |
|
452 | 452 | $record['id'] |
453 | 453 | ); |
454 | 454 | if (count($tmp) > 0) { |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $displayItem = $need_sk = $canMove = $item_is_restricted_to_role = 0; |
478 | 478 | $user_is_included_in_role = 0; |
479 | 479 | $roles = DB::query( |
480 | - 'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i', |
|
480 | + 'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i', |
|
481 | 481 | $record['id'] |
482 | 482 | ); |
483 | 483 | if (count($roles) > 0) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | if (empty($restrictedTo)) { |
501 | 501 | $restrictedTo = $session->get('user-id'); |
502 | 502 | } else { |
503 | - $restrictedTo .= ',' . $session->get('user-id'); |
|
503 | + $restrictedTo .= ','.$session->get('user-id'); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $arrTmp = []; |
617 | 617 | foreach (explode(';', $session->get('user-roles')) as $role) { |
618 | 618 | $access = DB::queryFirstRow( |
619 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
619 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
620 | 620 | $role, |
621 | 621 | $record['id_tree'] |
622 | 622 | ); |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | ) { |
668 | 668 | $data_item = DB::queryFirstRow( |
669 | 669 | 'SELECT i.pw AS pw, s.share_key AS share_key |
670 | - FROM ' . prefixTable('items') . ' AS i |
|
671 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
670 | + FROM ' . prefixTable('items').' AS i |
|
671 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
672 | 672 | WHERE i.id = %i AND s.user_id = %i', |
673 | 673 | $record['id'], |
674 | 674 | $session->get('user-id') |