@@ -239,7 +239,7 @@ |
||
239 | 239 | $configManager = new ConfigManager(); |
240 | 240 | $SETTINGS = $configManager->getAllSettings(); |
241 | 241 | |
242 | - $payload = [ |
|
242 | + $payload = [ |
|
243 | 243 | 'username' => $login, |
244 | 244 | 'id' => $id, |
245 | 245 | 'exp' => (time() + $SETTINGS['api_token_duration'] + 600), |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function getUserAuth(string $login, string $password, string $apikey): array |
50 | 50 | { |
51 | 51 | // Sanitize |
52 | - include_once API_ROOT_PATH . '/../sources/main.functions.php'; |
|
52 | + include_once API_ROOT_PATH.'/../sources/main.functions.php'; |
|
53 | 53 | $inputData = dataSanitizer( |
54 | 54 | [ |
55 | 55 | 'login' => isset($login) === true ? $login : '', |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | // Check if user exists |
75 | 75 | $userInfo = DB::queryfirstrow( |
76 | 76 | "SELECT u.id, u.pw, u.login, u.admin, u.gestionnaire, u.can_manage_all_users, u.fonction_id, u.can_create_root_folder, u.public_key, u.private_key, u.personal_folder, u.fonction_id, u.groupes_visibles, u.groupes_interdits, a.value AS user_api_key, a.allowed_folders as user_api_allowed_folders, a.enabled, a.allowed_to_create, a.allowed_to_read, a.allowed_to_update, a.allowed_to_delete |
77 | - FROM " . prefixTable('users') . " AS u |
|
78 | - INNER JOIN " . prefixTable('api') . " AS a ON (a.user_id=u.id) |
|
77 | + FROM " . prefixTable('users')." AS u |
|
78 | + INNER JOIN " . prefixTable('api')." AS a ON (a.user_id=u.id) |
|
79 | 79 | WHERE login = %s", |
80 | 80 | $inputData['login'] |
81 | 81 | ); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | if (count($userFunctionId) > 0) { |
252 | 252 | $rows = DB::query( |
253 | 253 | 'SELECT * |
254 | - FROM ' . prefixTable('roles_values') . ' |
|
254 | + FROM ' . prefixTable('roles_values').' |
|
255 | 255 | WHERE role_id IN %li AND type IN ("W", "ND", "NE", "NDNE", "R")', |
256 | 256 | $userFunctionId |
257 | 257 | ); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $inc = 0; |
278 | 278 | $rows = DB::query( |
279 | 279 | 'SELECT id, id_tree |
280 | - FROM ' . prefixTable('items') . ' |
|
280 | + FROM ' . prefixTable('items').' |
|
281 | 281 | WHERE restricted_to LIKE %s'. |
282 | 282 | (count($userFunctionId) > 0 ? ' AND id_tree NOT IN %li' : ''), |
283 | 283 | $userInfo['id'], |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | // Check for the users roles if some specific rights exist on items |
293 | 293 | $rows = DB::query( |
294 | 294 | 'SELECT i.id_tree, r.item_id |
295 | - FROM ' . prefixTable('items') . ' AS i |
|
296 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (r.item_id=i.id) |
|
295 | + FROM ' . prefixTable('items').' AS i |
|
296 | + INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (r.item_id=i.id) |
|
297 | 297 | WHERE '.(count($userFunctionId) > 0 ? ' id_tree NOT IN %li AND ' : '').' i.id_tree != "" |
298 | 298 | ORDER BY i.id_tree ASC', |
299 | 299 | count($userFunctionId) > 0 ? $userFunctionId : DB::sqleval('0') |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | // Add all personal folders |
310 | 310 | $rows = DB::queryFirstRow( |
311 | 311 | 'SELECT id |
312 | - FROM ' . prefixTable('nested_tree') . ' |
|
312 | + FROM ' . prefixTable('nested_tree').' |
|
313 | 313 | WHERE title = %i AND personal_folder = 1'. |
314 | 314 | (count($userFunctionId) > 0 ? ' AND id NOT IN %li' : ''), |
315 | 315 | $userInfo['id'], |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | |
26 | 26 | use TeampassClasses\ConfigManager\ConfigManager; |
27 | 27 | |
28 | -define("API_ROOT_PATH", __DIR__ . "/.."); |
|
28 | +define("API_ROOT_PATH", __DIR__."/.."); |
|
29 | 29 | |
30 | 30 | // include main configuration file |
31 | -require API_ROOT_PATH . '/../sources/main.functions.php'; |
|
31 | +require API_ROOT_PATH.'/../sources/main.functions.php'; |
|
32 | 32 | |
33 | 33 | // include the base controller file |
34 | -require API_ROOT_PATH . "/Controller/Api/BaseController.php"; |
|
34 | +require API_ROOT_PATH."/Controller/Api/BaseController.php"; |
|
35 | 35 | |
36 | 36 | // include the use model file |
37 | -require API_ROOT_PATH . "/Model/UserModel.php"; |
|
38 | -require API_ROOT_PATH . "/Model/ItemModel.php"; |
|
39 | -require API_ROOT_PATH . "/Model/FolderModel.php"; |
|
37 | +require API_ROOT_PATH."/Model/UserModel.php"; |
|
38 | +require API_ROOT_PATH."/Model/ItemModel.php"; |
|
39 | +require API_ROOT_PATH."/Model/FolderModel.php"; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Launch expected action for ITEM |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | ); |
56 | 56 | } |
57 | 57 | // Perform the action |
58 | - require API_ROOT_PATH . "/Controller/Api/ItemController.php"; |
|
58 | + require API_ROOT_PATH."/Controller/Api/ItemController.php"; |
|
59 | 59 | $objFeedController = new ItemController(); |
60 | - $strMethodName = $actions[0] . 'Action'; |
|
60 | + $strMethodName = $actions[0].'Action'; |
|
61 | 61 | $objFeedController->{$strMethodName}($userData); |
62 | 62 | } |
63 | 63 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | ); |
79 | 79 | } |
80 | 80 | // Perform the action |
81 | - require API_ROOT_PATH . "/Controller/Api/FolderController.php"; |
|
81 | + require API_ROOT_PATH."/Controller/Api/FolderController.php"; |
|
82 | 82 | $objFeedController = new FolderController(); |
83 | - $strMethodName = $actions[0] . 'Action'; |
|
83 | + $strMethodName = $actions[0].'Action'; |
|
84 | 84 | $objFeedController->{$strMethodName}($userData); |
85 | 85 | } |
86 | 86 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | function verifyAuth(): string |
139 | 139 | { |
140 | - include_once API_ROOT_PATH . '/inc/jwt_utils.php'; |
|
140 | + include_once API_ROOT_PATH.'/inc/jwt_utils.php'; |
|
141 | 141 | $bearer_token = get_bearer_token(); |
142 | 142 | |
143 | 143 | if (empty($bearer_token) === false && is_jwt_valid($bearer_token) === true) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | function getDataFromToken(): string |
169 | 169 | { |
170 | - include_once API_ROOT_PATH . '/inc/jwt_utils.php'; |
|
170 | + include_once API_ROOT_PATH.'/inc/jwt_utils.php'; |
|
171 | 171 | $bearer_token = get_bearer_token(); |
172 | 172 | |
173 | 173 | if (empty($bearer_token) === false) { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | return DB::query( |
31 | 31 | 'SELECT * |
32 | - FROM ' . prefixTable('users') . ' |
|
32 | + FROM ' . prefixTable('users').' |
|
33 | 33 | ORDER BY id ASC LIMIT %i', |
34 | 34 | $limit |
35 | 35 | ); |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | // Get items |
51 | 51 | $rows = DB::query( |
52 | 52 | 'SELECT i.id, label, description, i.pw, i.url, i.id_tree, i.login, i.email, i.viewed_no, i.fa_icon, i.inactif, i.perso, t.title as folder_label |
53 | - FROM ' . prefixTable('items') . ' AS i |
|
53 | + FROM ' . prefixTable('items').' AS i |
|
54 | 54 | LEFT JOIN '.prefixTable('nested_tree').' as t ON (t.id = i.id_tree) '. |
55 | - $sqlExtra . |
|
56 | - " ORDER BY i.id ASC" . |
|
57 | - ($limit > 0 ? " LIMIT ". $limit : '') |
|
55 | + $sqlExtra. |
|
56 | + " ORDER BY i.id ASC". |
|
57 | + ($limit > 0 ? " LIMIT ".$limit : '') |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | $ret = []; |
61 | 61 | foreach ($rows as $row) { |
62 | 62 | $userKey = DB::queryfirstrow( |
63 | 63 | 'SELECT share_key |
64 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
64 | + FROM ' . prefixTable('sharekeys_items').' |
|
65 | 65 | WHERE user_id = %i AND object_id = %i', |
66 | 66 | $userId, |
67 | 67 | $row['id'] |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (empty($path) === true) { |
99 | 99 | $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
100 | 100 | } else { |
101 | - $path .= '/' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
101 | + $path .= '/'.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ) : array |
149 | 149 | { |
150 | 150 | try { |
151 | - include_once API_ROOT_PATH . '/../sources/main.functions.php'; |
|
151 | + include_once API_ROOT_PATH.'/../sources/main.functions.php'; |
|
152 | 152 | |
153 | 153 | // Load config |
154 | 154 | $configManager = new ConfigManager(); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | if (strlen($password) > $SETTINGS['pwd_maximum_length']) { |
274 | - throw new Exception('Password is too long (max allowed is ' . $SETTINGS['pwd_maximum_length'] . ' characters)'); |
|
274 | + throw new Exception('Password is too long (max allowed is '.$SETTINGS['pwd_maximum_length'].' characters)'); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | { |
285 | 285 | $dataFolderSettings = DB::queryFirstRow( |
286 | 286 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
287 | - FROM ' . prefixTable('nested_tree') . ' |
|
287 | + FROM ' . prefixTable('nested_tree').' |
|
288 | 288 | WHERE id = %i', |
289 | 289 | $folderId |
290 | 290 | ); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | { |
308 | 308 | $folderComplexity = DB::queryFirstRow( |
309 | 309 | 'SELECT valeur |
310 | - FROM ' . prefixTable('misc') . ' |
|
310 | + FROM ' . prefixTable('misc').' |
|
311 | 311 | WHERE type = %s AND intitule = %i', |
312 | 312 | 'complex', |
313 | 313 | $itemInfos['folderId'] |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | private function checkForDuplicates(string $label, array $SETTINGS, array $itemInfos) : void |
336 | 336 | { |
337 | 337 | DB::queryFirstRow( |
338 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
338 | + 'SELECT * FROM '.prefixTable('items').' |
|
339 | 339 | WHERE label = %s AND inactif = %i', |
340 | 340 | $label, |
341 | 341 | 0 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) { |
68 | 68 | // Not allowed page |
69 | 69 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
70 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
70 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
71 | 71 | exit; |
72 | 72 | } |
73 | 73 | |
@@ -99,25 +99,25 @@ discard block |
||
99 | 99 | // prepare list of timezones |
100 | 100 | $zones = timezone_list(); |
101 | 101 | // prepare list of languages |
102 | -$languages = DB::query('SELECT label, name FROM ' . prefixTable('languages') . ' ORDER BY label ASC'); |
|
102 | +$languages = DB::query('SELECT label, name FROM '.prefixTable('languages').' ORDER BY label ASC'); |
|
103 | 103 | // Do some stats |
104 | -DB::query('SELECT id_item FROM ' . prefixTable('log_items') . ' WHERE action = "at_creation" AND id_user = "' . $session->get('user-id') . '"'); |
|
104 | +DB::query('SELECT id_item FROM '.prefixTable('log_items').' WHERE action = "at_creation" AND id_user = "'.$session->get('user-id').'"'); |
|
105 | 105 | $userItemsNumber = DB::count(); |
106 | -DB::query('SELECT id_item FROM ' . prefixTable('log_items') . ' WHERE action = "at_modification" AND id_user = "' . $session->get('user-id') . '"'); |
|
106 | +DB::query('SELECT id_item FROM '.prefixTable('log_items').' WHERE action = "at_modification" AND id_user = "'.$session->get('user-id').'"'); |
|
107 | 107 | $userModificationNumber = DB::count(); |
108 | -DB::query('SELECT id_item FROM ' . prefixTable('log_items') . ' WHERE action = "at_shown" AND id_user = "' . $session->get('user-id') . '"'); |
|
108 | +DB::query('SELECT id_item FROM '.prefixTable('log_items').' WHERE action = "at_shown" AND id_user = "'.$session->get('user-id').'"'); |
|
109 | 109 | $userSeenItemsNumber = DB::count(); |
110 | -DB::query('SELECT id_item FROM ' . prefixTable('log_items') . ' WHERE action = "at_password_shown" AND id_user = "' . $session->get('user-id') . '"'); |
|
110 | +DB::query('SELECT id_item FROM '.prefixTable('log_items').' WHERE action = "at_password_shown" AND id_user = "'.$session->get('user-id').'"'); |
|
111 | 111 | $userSeenPasswordsNumber = DB::count(); |
112 | 112 | $userInfo = DB::queryFirstRow( |
113 | 113 | 'SELECT avatar, last_pw_change |
114 | - FROM ' . prefixTable('users') . ' |
|
115 | - WHERE id = "' . $session->get('user-id') . '"' |
|
114 | + FROM ' . prefixTable('users').' |
|
115 | + WHERE id = "' . $session->get('user-id').'"' |
|
116 | 116 | ); |
117 | 117 | if (empty($userInfo['avatar']) === true) { |
118 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
118 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
119 | 119 | } else { |
120 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $userInfo['avatar']; |
|
120 | + $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$userInfo['avatar']; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Get Groups name |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | foreach ($session->get('user-roles_array') as $role) { |
126 | 126 | $tmp = DB::queryFirstRow( |
127 | 127 | 'SELECT title |
128 | - FROM ' . prefixTable('roles_title') . ' |
|
129 | - WHERE id = "' . $role . '"' |
|
128 | + FROM ' . prefixTable('roles_title').' |
|
129 | + WHERE id = "' . $role.'"' |
|
130 | 130 | ); |
131 | 131 | if ($tmp !== null) { |
132 | 132 | array_push($userParOfGroups, $tmp['title']); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | <h3 id="profile-username" class="text-center"> |
171 | 171 | <?php |
172 | 172 | if (null !== $session->get('user-name') && empty($session->get('user-name')) === false) { |
173 | - echo $session->get('user-name') . ' ' . $session->get('user-lastname'); |
|
173 | + echo $session->get('user-name').' '.$session->get('user-lastname'); |
|
174 | 174 | } else { |
175 | 175 | echo $session->get('user-login'); |
176 | 176 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } else { |
239 | 239 | echo date('d/m/Y', (int) $session->get('user-last_connection')); |
240 | 240 | } |
241 | - echo ' ' . $lang->get('at') . ' '; |
|
241 | + echo ' '.$lang->get('at').' '; |
|
242 | 242 | if (isset($SETTINGS['time_format']) === true) { |
243 | 243 | echo date($SETTINGS['time_format'], (int) $session->get('user-last_connection')); |
244 | 244 | } else { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | </a> |
249 | 249 | </li> |
250 | 250 | <?php |
251 | - if (null !== $session->get('user-last_pw_change') && ! empty($session->get('user-last_pw_change') === true)) { |
|
251 | + if (null !== $session->get('user-last_pw_change') && !empty($session->get('user-last_pw_change') === true)) { |
|
252 | 252 | // Handle last password change string |
253 | 253 | if ($session->has('user-last_pw_change') && null !== $session->get('user-last_pw_change')) { |
254 | 254 | if (isset($SETTINGS['date_format']) === true) { |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | ) { |
269 | 269 | $numDaysBeforePwExpiration = ''; |
270 | 270 | } else { |
271 | - $numDaysBeforePwExpiration = $LANG['index_pw_expiration'] . ' ' . $session->get('user-num_days_before_exp') . ' ' . $LANG['days'] . '.'; |
|
271 | + $numDaysBeforePwExpiration = $LANG['index_pw_expiration'].' '.$session->get('user-num_days_before_exp').' '.$LANG['days'].'.'; |
|
272 | 272 | } |
273 | 273 | echo ' |
274 | 274 | <li class="list-group-item"> |
275 | - <b><i class="fas fa-calendar-alt fa-fw fa-lg mr-2"></i>' . $lang->get('index_last_pw_change') . '</b> |
|
276 | - <a class="float-right">' . $last_pw_change . ' ' . $numDaysBeforePwExpiration . '</a> |
|
275 | + <b><i class="fas fa-calendar-alt fa-fw fa-lg mr-2"></i>' . $lang->get('index_last_pw_change').'</b> |
|
276 | + <a class="float-right">' . $last_pw_change.' '.$numDaysBeforePwExpiration.'</a> |
|
277 | 277 | </li>'; |
278 | 278 | } |
279 | 279 | ?> |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if (isset($SETTINGS['api']) === true && (int) $SETTINGS['api'] === 1) { |
294 | 294 | echo ' |
295 | 295 | <li class="list-group-item"> |
296 | - <b><i class="fas fa-paper-plane fa-fw fa-lg mr-2"></i>' . $lang->get('user_profile_api_key') . '</b> |
|
296 | + <b><i class="fas fa-paper-plane fa-fw fa-lg mr-2"></i>' . $lang->get('user_profile_api_key').'</b> |
|
297 | 297 | <button class="btn btn-sm btn-primary float-right" id="copy-api-key"><i class="fa-regular fa-copy pointer"></i></button> |
298 | 298 | <a class="float-right mr-2" id="profile-user-api-token">', |
299 | 299 | null !== $session->get('user-api_key') ? $session->get('user-api_key') : '', |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | <ul class=""> |
331 | 331 | <?php |
332 | 332 | foreach ($session->get('user-unsuccessfull_login_attempts_list') as $entry) { |
333 | - echo '<li class="">' . $entry . '</li>'; |
|
333 | + echo '<li class="">'.$entry.'</li>'; |
|
334 | 334 | } ?> |
335 | 335 | </ul> |
336 | 336 | </div> |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | <?php |
344 | 344 | $rows = DB::query( |
345 | 345 | 'SELECT label AS labelAction, date, null |
346 | - FROM ' . prefixTable('log_system') . ' |
|
346 | + FROM ' . prefixTable('log_system').' |
|
347 | 347 | WHERE qui = %i |
348 | 348 | UNION |
349 | 349 | SELECT l.action, l.date, i.label AS itemLabel |
350 | - FROM ' . prefixTable('log_items') . ' AS l |
|
351 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id) |
|
350 | + FROM ' . prefixTable('log_items').' AS l |
|
351 | + INNER JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id) |
|
352 | 352 | WHERE l.id_user = %i AND l.action IN ("at_access") |
353 | 353 | ORDER BY date DESC |
354 | 354 | LIMIT 0, 40', |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | $text = $lang->get($record['labelAction']); |
363 | 363 | } |
364 | 364 | if (empty($record['NULL']) === false) { |
365 | - $text .= ' ' . $lang->get('for') . ' <span class="font-weight-light">' . addslashes($record['NULL']) . '</span>'; |
|
365 | + $text .= ' '.$lang->get('for').' <span class="font-weight-light">'.addslashes($record['NULL']).'</span>'; |
|
366 | 366 | } |
367 | - echo '<li class="list-group-item">' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' . $text . '</li>'; |
|
367 | + echo '<li class="list-group-item">'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '.$text.'</li>'; |
|
368 | 368 | } |
369 | 369 | ?> |
370 | 370 | </ul> |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | |
398 | 398 | <div class="form-group"> |
399 | - <label class="col-sm-10 control-label"><?php echo $lang->get('timezone_selection');?></label> |
|
399 | + <label class="col-sm-10 control-label"><?php echo $lang->get('timezone_selection'); ?></label> |
|
400 | 400 | <div class="col-sm-10"> |
401 | 401 | <select class="form-control" id="profile-user-timezone"> |
402 | 402 | <?php foreach ($zones as $key => $zone): ?> |
403 | 403 | <option value="<?php echo $key; ?>"<?php |
404 | 404 | if ($session->has('user-timezone')) |
405 | - if($session->get('user-timezone') === $key) |
|
405 | + if ($session->get('user-timezone') === $key) |
|
406 | 406 | echo ' selected'; |
407 | 407 | elseif ($session->get('user-timezone') === 'not_defined') |
408 | 408 | if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
@@ -418,10 +418,10 @@ discard block |
||
418 | 418 | <select class="form-control" id="profile-user-language"> |
419 | 419 | <?php |
420 | 420 | foreach ($languages as $language) { |
421 | - echo '<option value="' . $language['name'] . '"', |
|
421 | + echo '<option value="'.$language['name'].'"', |
|
422 | 422 | strtolower($session->get('user-language')) === strtolower($language['name']) ? |
423 | 423 | ' selected="selected"' : '', |
424 | - '>' . $language['label'] . '</option>'; |
|
424 | + '>'.$language['label'].'</option>'; |
|
425 | 425 | } |
426 | 426 | ?> |
427 | 427 | </select> |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | <div class="col-sm-10"> |
434 | 434 | <select class="form-control" id="profile-user-treeloadstrategy"> |
435 | 435 | |
436 | - <option value="sequential" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'sequential' ? ' selected' : '';?>> |
|
436 | + <option value="sequential" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'sequential' ? ' selected' : ''; ?>> |
|
437 | 437 | <?php echo $lang->get('sequential'); ?> |
438 | 438 | </option> |
439 | 439 | |
440 | - <option value="full" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'full' ? ' selected' : '';?>> |
|
440 | + <option value="full" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'full' ? ' selected' : ''; ?>> |
|
441 | 441 | <?php echo $lang->get('full'); ?> |
442 | 442 | </option> |
443 | 443 | </select> |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | <div class="col-sm-10"> |
450 | 450 | <select class="form-control" id="profile-user-split_view_mode"> |
451 | 451 | |
452 | - <option value="0" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && $session->get('user-split_view_mode') === 0 ? 'selected' : '';?>> |
|
452 | + <option value="0" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && $session->get('user-split_view_mode') === 0 ? 'selected' : ''; ?>> |
|
453 | 453 | <?php echo $lang->get('no'); ?> |
454 | 454 | </option> |
455 | 455 | |
456 | - <option value="1" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && (int) $session->get('user-split_view_mode') === 1 ? 'selected' : '';?>> |
|
456 | + <option value="1" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && (int) $session->get('user-split_view_mode') === 1 ? 'selected' : ''; ?>> |
|
457 | 457 | <?php echo $lang->get('yes'); ?> |
458 | 458 | </option> |
459 | 459 | </select> |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | <button type="button" class="btn btn-warning float-right ml-2" id="profile-avatar-file"><?php echo $lang->get('upload_new_avatar'); ?></button> |
489 | 489 | <?php |
490 | 490 | if (isset($SETTINGS['api']) === true && (int) $SETTINGS['api'] === 1) { |
491 | - echo '<button type="button" class="btn btn-warning float-right" id="profile-button-api_token">' . $lang->get('generate_api_token') . '</button>'; |
|
491 | + echo '<button type="button" class="btn btn-warning float-right" id="profile-button-api_token">'.$lang->get('generate_api_token').'</button>'; |
|
492 | 492 | } |
493 | 493 | ?> |
494 | 494 | <div id="profile-avatar-file-container" class="hidden"></div> |
@@ -401,12 +401,13 @@ |
||
401 | 401 | <select class="form-control" id="profile-user-timezone"> |
402 | 402 | <?php foreach ($zones as $key => $zone): ?> |
403 | 403 | <option value="<?php echo $key; ?>"<?php |
404 | - if ($session->has('user-timezone')) |
|
405 | - if($session->get('user-timezone') === $key) |
|
404 | + if ($session->has('user-timezone')) { |
|
405 | + if($session->get('user-timezone') === $key) |
|
406 | 406 | echo ' selected'; |
407 | - elseif ($session->get('user-timezone') === 'not_defined') |
|
408 | - if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
|
407 | + } elseif ($session->get('user-timezone') === 'not_defined') { |
|
408 | + if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
|
409 | 409 | echo ' selected'; |
410 | + } |
|
410 | 411 | ?>><?php echo $zone; ?></option> |
411 | 412 | <?php endforeach; ?> |
412 | 413 | </select> |
@@ -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 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) { |
130 | 130 | $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT); |
131 | 131 | $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
132 | - $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', '; |
|
132 | + $sOrder .= $aColumns[$columnIndex].' '.$dir.', '; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $sOrder = substr_replace($sOrder, '', -2); |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | |
154 | 154 | if ($letter !== '' && $letter !== 'None') { |
155 | 155 | $sWhere .= ' AND ('; |
156 | - $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR "; |
|
157 | - $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR "; |
|
158 | - $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' "; |
|
156 | + $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR "; |
|
157 | + $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR "; |
|
158 | + $sWhere .= $aColumns[3]." LIKE '".$letter."%' "; |
|
159 | 159 | $sWhere .= ')'; |
160 | 160 | } elseif ($searchValue !== '') { |
161 | 161 | $sWhere .= ' AND ('; |
162 | - $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR "; |
|
163 | - $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR "; |
|
164 | - $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' "; |
|
162 | + $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR "; |
|
163 | + $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR "; |
|
164 | + $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' "; |
|
165 | 165 | $sWhere .= ')'; |
166 | 166 | } |
167 | 167 | |
@@ -254,31 +254,29 @@ discard block |
||
254 | 254 | |
255 | 255 | // Get some infos about user |
256 | 256 | $userDisplayInfos = |
257 | - (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '') |
|
257 | + (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '') |
|
258 | 258 | . |
259 | 259 | ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ". |
260 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '') |
|
260 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '') |
|
261 | 261 | . |
262 | 262 | ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '') |
263 | 263 | . |
264 | 264 | ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '') |
265 | 265 | . |
266 | 266 | ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ? |
267 | - ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : |
|
268 | - '' |
|
267 | + ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : '' |
|
269 | 268 | ); |
270 | 269 | if ($request->query->filter('display_warnings', '', FILTER_VALIDATE_BOOLEAN) === true) { |
271 | 270 | $userDisplayInfos .= '<br>'. |
272 | 271 | ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? |
273 | - '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : |
|
274 | - '' |
|
272 | + '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : '' |
|
275 | 273 | ). |
276 | 274 | ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['pw_passwordlib'] === 1) ? '<i class=\"fa-solid fa-person-walking-luggage infotip ml-1\" style=\"color:Tomato\" title=\"Old password encryption. Shall login to initialize.\"></i>' : ''); |
277 | 275 | } |
278 | 276 | |
279 | 277 | $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'. |
280 | - (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').' '. |
|
281 | - (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : ''). |
|
278 | + (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').' '. |
|
279 | + (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : ''). |
|
282 | 280 | '\" data-auth-type=\"'.$record['auth_type'].'\" data-special=\"'.$record['special'].'\" data-mfa-enabled=\"'.$record['mfa_enabled'].'\" data-otp-provided=\"'.(isset($record['otp_provided']) === true ? $record['otp_provided'] : '').'\"></span>", '; |
283 | 281 | //col2 |
284 | 282 | $sOutput .= '"'. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // SQL where clause with folders list |
56 | 56 | if (isset($arrQueryStringParams['folders']) === true) { |
57 | 57 | // convert the folders to an array |
58 | - $arrQueryStringParams['folders'] = explode(',', str_replace( array('[',']') , '' , $arrQueryStringParams['folders'])); |
|
58 | + $arrQueryStringParams['folders'] = explode(',', str_replace(array('[', ']'), '', $arrQueryStringParams['folders'])); |
|
59 | 59 | |
60 | 60 | // ensure to only use the intersection |
61 | 61 | $foldersList = implode(',', array_intersect($arrQueryStringParams['folders'], $userData['folders_list'])); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - private function checkNewItemData(array|string $arrQueryStringParams, array $userData): array |
|
131 | + private function checkNewItemData(array | string $arrQueryStringParams, array $userData): array |
|
132 | 132 | { |
133 | 133 | // Check if $arrQueryStringParams is an array |
134 | 134 | if (!is_array($arrQueryStringParams)) { |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | // SQL where clause with item id |
274 | 274 | if (isset($arrQueryStringParams['id']) === true) { |
275 | 275 | // build sql where clause by ID |
276 | - $sqlExtra = ' WHERE i.id = '.$arrQueryStringParams['id'] . $sql_constraint; |
|
276 | + $sqlExtra = ' WHERE i.id = '.$arrQueryStringParams['id'].$sql_constraint; |
|
277 | 277 | } else if (isset($arrQueryStringParams['label']) === true) { |
278 | 278 | // build sql where clause by LABEL |
279 | - $sqlExtra = ' WHERE i.label '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['label'] : ' = '.$arrQueryStringParams['label']) . $sql_constraint; |
|
279 | + $sqlExtra = ' WHERE i.label '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['label'] : ' = '.$arrQueryStringParams['label']).$sql_constraint; |
|
280 | 280 | } else if (isset($arrQueryStringParams['description']) === true) { |
281 | 281 | // build sql where clause by LABEL |
282 | 282 | $sqlExtra = ' WHERE i.description '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['description'] : ' = '.$arrQueryStringParams['description']).$sql_constraint; |
@@ -37,45 +37,45 @@ discard block |
||
37 | 37 | * @return boolean |
38 | 38 | */ |
39 | 39 | function is_jwt_valid($jwt) { |
40 | - try { |
|
41 | - $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256')); |
|
40 | + try { |
|
41 | + $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256')); |
|
42 | 42 | |
43 | - // Check if expiration is reached |
|
44 | - if ($decoded['exp'] - time() < 0) { |
|
45 | - return false; |
|
46 | - } |
|
43 | + // Check if expiration is reached |
|
44 | + if ($decoded['exp'] - time() < 0) { |
|
45 | + return false; |
|
46 | + } |
|
47 | 47 | /* |
48 | 48 | $decoded1 = JWT::decode($jwt, new Key(DB_PASSWD, 'HS256'), $headers = new stdClass()); |
49 | 49 | print_r($headers); |
50 | 50 | */ |
51 | 51 | |
52 | - return true; |
|
53 | - } catch (InvalidArgumentException $e) { |
|
54 | - // provided key/key-array is empty or malformed. |
|
55 | - return false; |
|
56 | - } catch (DomainException $e) { |
|
57 | - // provided algorithm is unsupported OR |
|
58 | - // provided key is invalid OR |
|
59 | - // unknown error thrown in openSSL or libsodium OR |
|
60 | - // libsodium is required but not available. |
|
61 | - return false; |
|
62 | - } catch (SignatureInvalidException $e) { |
|
63 | - // provided JWT signature verification failed. |
|
64 | - return false; |
|
65 | - } catch (BeforeValidException $e) { |
|
66 | - // provided JWT is trying to be used before "nbf" claim OR |
|
67 | - // provided JWT is trying to be used before "iat" claim. |
|
68 | - return false; |
|
69 | - } catch (ExpiredException $e) { |
|
70 | - // provided JWT is trying to be used after "exp" claim. |
|
71 | - return false; |
|
72 | - } catch (UnexpectedValueException $e) { |
|
73 | - // provided JWT is malformed OR |
|
74 | - // provided JWT is missing an algorithm / using an unsupported algorithm OR |
|
75 | - // provided JWT algorithm does not match provided key OR |
|
76 | - // provided key ID in key/key-array is empty or invalid. |
|
77 | - return false; |
|
78 | - } |
|
52 | + return true; |
|
53 | + } catch (InvalidArgumentException $e) { |
|
54 | + // provided key/key-array is empty or malformed. |
|
55 | + return false; |
|
56 | + } catch (DomainException $e) { |
|
57 | + // provided algorithm is unsupported OR |
|
58 | + // provided key is invalid OR |
|
59 | + // unknown error thrown in openSSL or libsodium OR |
|
60 | + // libsodium is required but not available. |
|
61 | + return false; |
|
62 | + } catch (SignatureInvalidException $e) { |
|
63 | + // provided JWT signature verification failed. |
|
64 | + return false; |
|
65 | + } catch (BeforeValidException $e) { |
|
66 | + // provided JWT is trying to be used before "nbf" claim OR |
|
67 | + // provided JWT is trying to be used before "iat" claim. |
|
68 | + return false; |
|
69 | + } catch (ExpiredException $e) { |
|
70 | + // provided JWT is trying to be used after "exp" claim. |
|
71 | + return false; |
|
72 | + } catch (UnexpectedValueException $e) { |
|
73 | + // provided JWT is malformed OR |
|
74 | + // provided JWT is missing an algorithm / using an unsupported algorithm OR |
|
75 | + // provided JWT algorithm does not match provided key OR |
|
76 | + // provided key ID in key/key-array is empty or invalid. |
|
77 | + return false; |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | function base64url_encode($data) { |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | |
85 | 85 | function get_authorization_header() |
86 | 86 | { |
87 | - $request = symfonyRequest::createFromGlobals(); |
|
88 | - $authorizationHeader = $request->headers->get('Authorization'); |
|
89 | - $headers = null; |
|
87 | + $request = symfonyRequest::createFromGlobals(); |
|
88 | + $authorizationHeader = $request->headers->get('Authorization'); |
|
89 | + $headers = null; |
|
90 | 90 | |
91 | - // HEADER: Get the header Authorization |
|
92 | - if (!empty($authorizationHeader)) { |
|
93 | - $headers = trim($authorizationHeader); |
|
94 | - } else if (function_exists('apache_request_headers') === true) { |
|
95 | - $requestHeaders = (array) apache_request_headers(); |
|
96 | - // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) |
|
97 | - $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); |
|
91 | + // HEADER: Get the header Authorization |
|
92 | + if (!empty($authorizationHeader)) { |
|
93 | + $headers = trim($authorizationHeader); |
|
94 | + } else if (function_exists('apache_request_headers') === true) { |
|
95 | + $requestHeaders = (array) apache_request_headers(); |
|
96 | + // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) |
|
97 | + $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); |
|
98 | 98 | |
99 | - if (isset($requestHeaders['Authorization']) === true) { |
|
100 | - $headers = trim($requestHeaders['Authorization']); |
|
101 | - } |
|
102 | - } |
|
99 | + if (isset($requestHeaders['Authorization']) === true) { |
|
100 | + $headers = trim($requestHeaders['Authorization']); |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | - return $headers; |
|
104 | + return $headers; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | function get_bearer_token() { |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | |
119 | 119 | function get_bearer_data($jwt) { |
120 | 120 | // split the jwt |
121 | - $tokenParts = explode('.', $jwt); |
|
122 | - $payload = base64_decode($tokenParts[1]); |
|
121 | + $tokenParts = explode('.', $jwt); |
|
122 | + $payload = base64_decode($tokenParts[1]); |
|
123 | 123 | |
124 | 124 | // HEADER: Get the access token from the header |
125 | 125 | if (empty($payload) === false) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $processToPerform = DB::queryfirstrow( |
69 | 69 | 'SELECT * |
70 | - FROM ' . prefixTable('background_tasks') . ' |
|
70 | + FROM ' . prefixTable('background_tasks').' |
|
71 | 71 | WHERE (finished_at IS NULL OR finished_at = "") AND process_type = %s |
72 | 72 | ORDER BY increment_id ASC', |
73 | 73 | 'create_user_keys' |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | // Get total number of items |
127 | 127 | DB::query( |
128 | 128 | 'SELECT * |
129 | - FROM ' . prefixTable('items') . ' |
|
129 | + FROM ' . prefixTable('items').' |
|
130 | 130 | '.(isset($taskArgumentsArray['only_personal_items']) === true && $taskArgumentsArray['only_personal_items'] === 1 ? 'WHERE perso = 1' : '') |
131 | 131 | ); |
132 | 132 | createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | // Get total number of items |
136 | 136 | DB::query( |
137 | 137 | 'SELECT * |
138 | - FROM ' . prefixTable('log_items') . ' |
|
138 | + FROM ' . prefixTable('log_items').' |
|
139 | 139 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"' |
140 | 140 | ); |
141 | 141 | createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Get total number of items |
145 | 145 | DB::query( |
146 | 146 | 'SELECT * |
147 | - FROM ' . prefixTable('categories_items') . ' |
|
147 | + FROM ' . prefixTable('categories_items').' |
|
148 | 148 | WHERE encryption_type = "teampass_aes"' |
149 | 149 | ); |
150 | 150 | createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId); |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | // Get total number of items |
162 | 162 | DB::query( |
163 | 163 | 'SELECT * |
164 | - FROM ' . prefixTable('files') . ' AS f |
|
165 | - INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item |
|
166 | - WHERE f.status = "' . TP_ENCRYPTION_NAME . '"' |
|
164 | + FROM ' . prefixTable('files').' AS f |
|
165 | + INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item |
|
166 | + WHERE f.status = "' . TP_ENCRYPTION_NAME.'"' |
|
167 | 167 | ); |
168 | 168 | createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId); |
169 | 169 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | // Check if subtasks have to be created |
191 | 191 | DB::query( |
192 | 192 | 'SELECT * |
193 | - FROM ' . prefixTable('background_subtasks') . ' |
|
193 | + FROM ' . prefixTable('background_subtasks').' |
|
194 | 194 | WHERE task_id = %i AND task LIKE %ss', |
195 | 195 | $taskId, |
196 | 196 | $action |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | function countActiveSymfonyProcesses() { |
223 | 223 | // Compter le nombre de processus actifs |
224 | 224 | return DB::queryFirstField( |
225 | - 'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . |
|
225 | + 'SELECT COUNT(*) FROM '.prefixTable('background_subtasks'). |
|
226 | 226 | ' WHERE process_id IS NOT NULL AND finished_at IS NULL' |
227 | 227 | ); |
228 | 228 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | function getSubTasks($taskId) { |
234 | 234 | $task_to_perform = DB::query( |
235 | 235 | 'SELECT * |
236 | - FROM ' . prefixTable('background_subtasks') . ' |
|
236 | + FROM ' . prefixTable('background_subtasks').' |
|
237 | 237 | WHERE task_id = %i AND finished_at IS NULL |
238 | 238 | ORDER BY increment_id ASC', |
239 | 239 | $taskId |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | function reloadSubTask($subTaskId) { |
285 | 285 | // Récupérer les informations de la sous-tâche de la base de données |
286 | 286 | $subTask = DB::queryFirstRow( |
287 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE increment_id = %i', |
|
287 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE increment_id = %i', |
|
288 | 288 | $subTaskId |
289 | 289 | ); |
290 | 290 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | // Get all processes |
331 | 331 | $subtasks = DB::query( |
332 | 332 | 'SELECT * |
333 | - FROM ' . prefixTable('background_subtasks') . ' |
|
333 | + FROM ' . prefixTable('background_subtasks').' |
|
334 | 334 | WHERE process_id IS NOT NULL AND finished_at IS NULL' |
335 | 335 | ); |
336 | 336 |