@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('options') === false) { |
| 70 | 70 | // Not allowed page |
| 71 | 71 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 72 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 72 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 73 | 73 | exit; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | // get list of all timezones |
| 253 | 253 | foreach ($zones as $key => $zone) { |
| 254 | 254 | echo ' |
| 255 | - <option value="' . $key . '"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>' . $zone . '</option>'; |
|
| 255 | + <option value="' . $key.'"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>'.$zone.'</option>'; |
|
| 256 | 256 | } |
| 257 | 257 | ?> |
| 258 | 258 | </select> |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $languagesList = $languagesList ?? []; |
| 305 | 305 | foreach ($languagesList as $teampassLang) { |
| 306 | 306 | echo ' |
| 307 | - <option value="' . $teampassLang . '"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>' . $teampassLang . '</option>'; |
|
| 307 | + <option value="' . $teampassLang.'"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>'.$teampassLang.'</option>'; |
|
| 308 | 308 | } |
| 309 | 309 | ?> |
| 310 | 310 | </select> |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | $roles = getRolesTitles(); |
| 930 | 930 | foreach ($roles as $role) { |
| 931 | 931 | echo ' |
| 932 | - <option value="' . htmlspecialchars($role['id']) . '"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>' . htmlspecialchars(addslashes($role['title'])) . '</option>'; |
|
| 932 | + <option value="' . htmlspecialchars($role['id']).'"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>'.htmlspecialchars(addslashes($role['title'])).'</option>'; |
|
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | 935 | ?> |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | <?php |
| 968 | 968 | foreach (TP_PW_COMPLEXITY as $complex) { |
| 969 | 969 | echo ' |
| 970 | - <option value="' . $complex[0] . '"', isset($SETTINGS['offline_key_level']) === true && (int) $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>'; |
|
| 970 | + <option value="' . $complex[0].'"', isset($SETTINGS['offline_key_level']) === true && (int) $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>'; |
|
| 971 | 971 | } |
| 972 | 972 | ?> |
| 973 | 973 | </select> |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | * @see https://www.teampass.net |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | - // TO REMOVE |
|
| 32 | - // - selected_items_to_be_imported |
|
| 31 | + // TO REMOVE |
|
| 32 | + // - selected_items_to_be_imported |
|
| 33 | 33 | |
| 34 | 34 | return array( |
| 35 | 35 | 'an_error_occurred' => 'An error occurred', |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ) { |
| 80 | 80 | // Not allowed page |
| 81 | 81 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 82 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 82 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 83 | 83 | exit; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | // Get current user hash |
| 277 | 277 | $userHash = DB::queryFirstRow( |
| 278 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;", |
|
| 278 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;", |
|
| 279 | 279 | $session->get('user-id') |
| 280 | 280 | )['pw']; |
| 281 | 281 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * @param string $post_key |
| 332 | 332 | * @return string |
| 333 | 333 | */ |
| 334 | -function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string |
|
| 334 | +function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string |
|
| 335 | 335 | { |
| 336 | 336 | $session = SessionManager::getSession(); |
| 337 | 337 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | if (isset($dataReceived['user_id'])) { |
| 367 | 367 | // Get info about user to modify |
| 368 | 368 | $targetUserInfos = DB::queryFirstRow( |
| 369 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 369 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 370 | 370 | WHERE id = %i', |
| 371 | 371 | $dataReceived['user_id'] |
| 372 | 372 | ); |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | case 'mail_me'://action_mail |
| 516 | 516 | // Get info about user to send email |
| 517 | 517 | $data_user = DB::queryFirstRow( |
| 518 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 518 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 519 | 519 | WHERE email = %s', |
| 520 | 520 | filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
| 521 | 521 | ); |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | if (isset($dataReceived['user_id'])) { |
| 636 | 636 | // Get info about user to modify |
| 637 | 637 | $targetUserInfos = DB::queryFirstRow( |
| 638 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 638 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 639 | 639 | WHERE id = %i', |
| 640 | 640 | $dataReceived['user_id'] |
| 641 | 641 | ); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | // Get current user hash |
| 721 | 721 | $userHash = DB::queryFirstRow( |
| 722 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;", |
|
| 722 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;", |
|
| 723 | 723 | $session->get('user-id') |
| 724 | 724 | )['pw']; |
| 725 | 725 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | |
| 758 | 758 | // Get current user hash |
| 759 | 759 | $userHash = DB::queryFirstRow( |
| 760 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;", |
|
| 760 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;", |
|
| 761 | 761 | $session->get('user-id') |
| 762 | 762 | )['pw']; |
| 763 | 763 | |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | |
| 803 | 803 | // Get current user hash |
| 804 | 804 | $userHash = DB::queryFirstRow( |
| 805 | - "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;", |
|
| 805 | + "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;", |
|
| 806 | 806 | $session->get('user-id') |
| 807 | 807 | )['pw']; |
| 808 | 808 | |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | * @param array $SETTINGS |
| 854 | 854 | * @return string |
| 855 | 855 | */ |
| 856 | -function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string |
|
| 856 | +function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string |
|
| 857 | 857 | { |
| 858 | 858 | $session = SessionManager::getSession(); |
| 859 | 859 | switch ($post_type) { |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | ) |
| 955 | 955 | ); |
| 956 | 956 | |
| 957 | - return '[{"token" : "' . $token . '"}]'; |
|
| 957 | + return '[{"token" : "'.$token.'"}]'; |
|
| 958 | 958 | |
| 959 | 959 | /* |
| 960 | 960 | * Default case |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
| 973 | -function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string |
|
| 973 | +function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string |
|
| 974 | 974 | { |
| 975 | 975 | switch ($post_type) { |
| 976 | 976 | /* |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | array( |
| 1040 | 1040 | 'error' => false, |
| 1041 | 1041 | 'timestamp' => $session->get('user-session_duration'), |
| 1042 | - 'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60), |
|
| 1042 | + 'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60), |
|
| 1043 | 1043 | 'max_session_duration' => $maximum_session_expiration_time, |
| 1044 | 1044 | ), |
| 1045 | 1045 | 'encode' |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | // get number of items |
| 1092 | 1092 | DB::queryFirstRow( |
| 1093 | 1093 | 'SELECT increment_id |
| 1094 | - FROM ' . prefixTable('sharekeys_items') . |
|
| 1094 | + FROM ' . prefixTable('sharekeys_items'). |
|
| 1095 | 1095 | ' WHERE user_id = %i', |
| 1096 | 1096 | $userId |
| 1097 | 1097 | ); |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | // check if expected security level is reached |
| 1147 | 1147 | $dataUser = DB::queryFirstRow( |
| 1148 | 1148 | 'SELECT * |
| 1149 | - FROM ' . prefixTable('users') . ' WHERE id = %i', |
|
| 1149 | + FROM ' . prefixTable('users').' WHERE id = %i', |
|
| 1150 | 1150 | $post_user_id |
| 1151 | 1151 | ); |
| 1152 | 1152 | |
@@ -1167,8 +1167,8 @@ discard block |
||
| 1167 | 1167 | if (empty($dataUser['fonction_id']) === false) { |
| 1168 | 1168 | $data = DB::queryFirstRow( |
| 1169 | 1169 | 'SELECT complexity |
| 1170 | - FROM ' . prefixTable('roles_title') . ' |
|
| 1171 | - WHERE id IN (' . $dataUser['fonction_id'] . ') |
|
| 1170 | + FROM ' . prefixTable('roles_title').' |
|
| 1171 | + WHERE id IN (' . $dataUser['fonction_id'].') |
|
| 1172 | 1172 | ORDER BY complexity DESC' |
| 1173 | 1173 | ); |
| 1174 | 1174 | } else { |
@@ -1181,8 +1181,8 @@ discard block |
||
| 1181 | 1181 | return prepareExchangedData( |
| 1182 | 1182 | array( |
| 1183 | 1183 | 'error' => true, |
| 1184 | - 'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' . |
|
| 1185 | - $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>', |
|
| 1184 | + 'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'. |
|
| 1185 | + $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>', |
|
| 1186 | 1186 | ), |
| 1187 | 1187 | 'encode' |
| 1188 | 1188 | ); |
@@ -1286,14 +1286,14 @@ discard block |
||
| 1286 | 1286 | // Get data about user |
| 1287 | 1287 | $dataUser = DB::queryFirstRow( |
| 1288 | 1288 | 'SELECT id, email, pw |
| 1289 | - FROM ' . prefixTable('users') . ' |
|
| 1289 | + FROM ' . prefixTable('users').' |
|
| 1290 | 1290 | WHERE login = %s', |
| 1291 | 1291 | $post_login |
| 1292 | 1292 | ); |
| 1293 | 1293 | } else { |
| 1294 | 1294 | $dataUser = DB::queryFirstRow( |
| 1295 | 1295 | 'SELECT id, login, email, pw |
| 1296 | - FROM ' . prefixTable('users') . ' |
|
| 1296 | + FROM ' . prefixTable('users').' |
|
| 1297 | 1297 | WHERE id = %i', |
| 1298 | 1298 | $post_id |
| 1299 | 1299 | ); |
@@ -1347,7 +1347,7 @@ discard block |
||
| 1347 | 1347 | // Check if token already used |
| 1348 | 1348 | $dataToken = DB::queryFirstRow( |
| 1349 | 1349 | 'SELECT end_timestamp, reason |
| 1350 | - FROM ' . prefixTable('tokens') . ' |
|
| 1350 | + FROM ' . prefixTable('tokens').' |
|
| 1351 | 1351 | WHERE token = %s AND user_id = %i', |
| 1352 | 1352 | $post_token, |
| 1353 | 1353 | $dataUser['id'] |
@@ -1358,11 +1358,11 @@ discard block |
||
| 1358 | 1358 | return prepareExchangedData( |
| 1359 | 1359 | array( |
| 1360 | 1360 | 'error' => true, |
| 1361 | - 'message' => 'TOKEN already used',//$lang->get('no_email_set'), |
|
| 1361 | + 'message' => 'TOKEN already used', //$lang->get('no_email_set'), |
|
| 1362 | 1362 | ), |
| 1363 | 1363 | 'encode' |
| 1364 | 1364 | ); |
| 1365 | - } elseif(DB::count() === 0) { |
|
| 1365 | + } elseif (DB::count() === 0) { |
|
| 1366 | 1366 | // Store token for this action |
| 1367 | 1367 | DB::insert( |
| 1368 | 1368 | prefixTable('tokens'), |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | 'email' => $dataUser['email'], |
| 1425 | 1425 | 'email_result' => str_replace( |
| 1426 | 1426 | '#email#', |
| 1427 | - '<b>' . obfuscateEmail($dataUser['email']) . '</b>', |
|
| 1427 | + '<b>'.obfuscateEmail($dataUser['email']).'</b>', |
|
| 1428 | 1428 | addslashes($lang->get('admin_email_result_ok')) |
| 1429 | 1429 | ), |
| 1430 | 1430 | ), |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | 'email' => $dataUser['email'], |
| 1441 | 1441 | 'email_result' => str_replace( |
| 1442 | 1442 | '#email#', |
| 1443 | - '<b>' . obfuscateEmail($dataUser['email']) . '</b>', |
|
| 1443 | + '<b>'.obfuscateEmail($dataUser['email']).'</b>', |
|
| 1444 | 1444 | addslashes($lang->get('admin_email_result_ok')) |
| 1445 | 1445 | ), |
| 1446 | 1446 | ), |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | |
| 1458 | 1458 | if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) { |
| 1459 | 1459 | $row = DB::queryFirstRow( |
| 1460 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', |
|
| 1460 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', |
|
| 1461 | 1461 | 'cron', |
| 1462 | 1462 | 'sending_emails' |
| 1463 | 1463 | ); |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) { |
| 1466 | 1466 | $rows = DB::query( |
| 1467 | 1467 | 'SELECT * |
| 1468 | - FROM ' . prefixTable('emails') . |
|
| 1468 | + FROM ' . prefixTable('emails'). |
|
| 1469 | 1469 | ' WHERE status != %s', |
| 1470 | 1470 | 'sent' |
| 1471 | 1471 | ); |
@@ -1517,8 +1517,8 @@ discard block |
||
| 1517 | 1517 | $arr_html = array(); |
| 1518 | 1518 | $rows = DB::query( |
| 1519 | 1519 | 'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted |
| 1520 | - FROM ' . prefixTable('log_items') . ' AS l |
|
| 1521 | - RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id) |
|
| 1520 | + FROM ' . prefixTable('log_items').' AS l |
|
| 1521 | + RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id) |
|
| 1522 | 1522 | WHERE l.action = %s AND l.id_user = %i |
| 1523 | 1523 | ORDER BY l.date DESC |
| 1524 | 1524 | LIMIT 0, 100', |
@@ -1550,7 +1550,7 @@ discard block |
||
| 1550 | 1550 | if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true |
| 1551 | 1551 | && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1) |
| 1552 | 1552 | ) { |
| 1553 | - DB::query('SELECT * FROM ' . prefixTable('suggestion')); |
|
| 1553 | + DB::query('SELECT * FROM '.prefixTable('suggestion')); |
|
| 1554 | 1554 | $nb_suggestions_waiting = DB::count(); |
| 1555 | 1555 | } |
| 1556 | 1556 | |
@@ -1585,13 +1585,13 @@ discard block |
||
| 1585 | 1585 | if ($data === 'stat_languages') { |
| 1586 | 1586 | $tmp = ''; |
| 1587 | 1587 | foreach ($stats_data[$data] as $key => $value) { |
| 1588 | - $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value; |
|
| 1588 | + $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value; |
|
| 1589 | 1589 | } |
| 1590 | 1590 | $statsToSend[$data] = $tmp; |
| 1591 | 1591 | } elseif ($data === 'stat_country') { |
| 1592 | 1592 | $tmp = ''; |
| 1593 | 1593 | foreach ($stats_data[$data] as $key => $value) { |
| 1594 | - $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value; |
|
| 1594 | + $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value; |
|
| 1595 | 1595 | } |
| 1596 | 1596 | $statsToSend[$data] = $tmp; |
| 1597 | 1597 | } else { |
@@ -1678,7 +1678,7 @@ discard block |
||
| 1678 | 1678 | $url_found = $value; |
| 1679 | 1679 | if (empty($url_found) === false) { |
| 1680 | 1680 | $tmp = parse_url($url_found); |
| 1681 | - $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : ''); |
|
| 1681 | + $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : ''); |
|
| 1682 | 1682 | $value = $anonym_url; |
| 1683 | 1683 | } else { |
| 1684 | 1684 | $value = ''; |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | $teampass_errors = ''; |
| 1709 | 1709 | $rows = DB::query( |
| 1710 | 1710 | 'SELECT label, date AS error_date |
| 1711 | - FROM ' . prefixTable('log_system') . " |
|
| 1711 | + FROM ' . prefixTable('log_system')." |
|
| 1712 | 1712 | WHERE `type` LIKE 'error' |
| 1713 | 1713 | ORDER BY `date` DESC |
| 1714 | 1714 | LIMIT 0, 10" |
@@ -1716,9 +1716,9 @@ discard block |
||
| 1716 | 1716 | if (DB::count() > 0) { |
| 1717 | 1717 | foreach ($rows as $record) { |
| 1718 | 1718 | if (empty($teampass_errors) === true) { |
| 1719 | - $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label']; |
|
| 1719 | + $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label']; |
|
| 1720 | 1720 | } else { |
| 1721 | - $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label']; |
|
| 1721 | + $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label']; |
|
| 1722 | 1722 | } |
| 1723 | 1723 | } |
| 1724 | 1724 | } |
@@ -1730,7 +1730,7 @@ discard block |
||
| 1730 | 1730 | |
| 1731 | 1731 | // Now prepare text |
| 1732 | 1732 | $txt = '### Page on which it happened |
| 1733 | -' . $data['current_page'] . ' |
|
| 1733 | +' . $data['current_page'].' |
|
| 1734 | 1734 | |
| 1735 | 1735 | ### Steps to reproduce |
| 1736 | 1736 | 1. |
@@ -1745,39 +1745,39 @@ discard block |
||
| 1745 | 1745 | Tell us what happens instead |
| 1746 | 1746 | |
| 1747 | 1747 | ### Server configuration |
| 1748 | -**Operating system**: ' . php_uname() . ' |
|
| 1748 | +**Operating system**: ' . php_uname().' |
|
| 1749 | 1749 | |
| 1750 | -**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . ' |
|
| 1750 | +**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].' |
|
| 1751 | 1751 | |
| 1752 | -**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . ' |
|
| 1752 | +**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).' |
|
| 1753 | 1753 | |
| 1754 | -**PHP version:** ' . PHP_VERSION . ' |
|
| 1754 | +**PHP version:** ' . PHP_VERSION.' |
|
| 1755 | 1755 | |
| 1756 | -**Teampass version:** ' . TP_VERSION . '.' . TP_VERSION_MINOR . ' |
|
| 1756 | +**Teampass version:** ' . TP_VERSION.'.'.TP_VERSION_MINOR.' |
|
| 1757 | 1757 | |
| 1758 | 1758 | **Teampass configuration variables:** |
| 1759 | 1759 | ``` |
| 1760 | -' . $list_of_options . ' |
|
| 1760 | +' . $list_of_options.' |
|
| 1761 | 1761 | ``` |
| 1762 | 1762 | |
| 1763 | 1763 | **Updated from an older Teampass or fresh install:** |
| 1764 | 1764 | |
| 1765 | 1765 | ### Client configuration |
| 1766 | 1766 | |
| 1767 | -**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . ' |
|
| 1767 | +**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].' |
|
| 1768 | 1768 | |
| 1769 | -**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits |
|
| 1769 | +**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits |
|
| 1770 | 1770 | |
| 1771 | 1771 | ### Logs |
| 1772 | 1772 | |
| 1773 | 1773 | #### Web server error log |
| 1774 | 1774 | ``` |
| 1775 | -' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ') |
|
| 1775 | +' . $err['message'].' - '.$err['file'].' ('.$err['line'].') |
|
| 1776 | 1776 | ``` |
| 1777 | 1777 | |
| 1778 | 1778 | #### Teampass 10 last system errors |
| 1779 | 1779 | ``` |
| 1780 | -' . $teampass_errors . ' |
|
| 1780 | +' . $teampass_errors.' |
|
| 1781 | 1781 | ``` |
| 1782 | 1782 | |
| 1783 | 1783 | #### Log from the web-browser developer console (CTRL + SHIFT + i) |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | // Check if user exists |
| 1820 | 1820 | $userInfo = DB::queryFirstRow( |
| 1821 | 1821 | 'SELECT public_key, private_key, pw, auth_type |
| 1822 | - FROM ' . prefixTable('users') . ' |
|
| 1822 | + FROM ' . prefixTable('users').' |
|
| 1823 | 1823 | WHERE id = %i', |
| 1824 | 1824 | $post_user_id |
| 1825 | 1825 | ); |
@@ -1828,9 +1828,9 @@ discard block |
||
| 1828 | 1828 | // Get one item |
| 1829 | 1829 | $currentUserKey = DB::queryFirstRow( |
| 1830 | 1830 | 'SELECT object_id, share_key, increment_id |
| 1831 | - FROM ' . prefixTable('sharekeys_items') . ' AS si |
|
| 1832 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = si.object_id) |
|
| 1833 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON (i.id_tree = nt.id) |
|
| 1831 | + FROM ' . prefixTable('sharekeys_items').' AS si |
|
| 1832 | + INNER JOIN ' . prefixTable('items').' AS i ON (i.id = si.object_id) |
|
| 1833 | + INNER JOIN ' . prefixTable('nested_tree').' AS nt ON (i.id_tree = nt.id) |
|
| 1834 | 1834 | WHERE user_id = %i AND nt.personal_folder = %i', |
| 1835 | 1835 | $post_user_id, |
| 1836 | 1836 | 0 |
@@ -1949,7 +1949,7 @@ discard block |
||
| 1949 | 1949 | // Get user info |
| 1950 | 1950 | $userData = DB::queryFirstRow( |
| 1951 | 1951 | 'SELECT private_key |
| 1952 | - FROM ' . prefixTable('users') . ' |
|
| 1952 | + FROM ' . prefixTable('users').' |
|
| 1953 | 1953 | WHERE id = %i', |
| 1954 | 1954 | $post_user_id |
| 1955 | 1955 | ); |
@@ -2030,7 +2030,7 @@ discard block |
||
| 2030 | 2030 | // Get user info |
| 2031 | 2031 | $userData = DB::queryFirstRow( |
| 2032 | 2032 | 'SELECT email, auth_type, login |
| 2033 | - FROM ' . prefixTable('users') . ' |
|
| 2033 | + FROM ' . prefixTable('users').' |
|
| 2034 | 2034 | WHERE id = %i', |
| 2035 | 2035 | $post_user_id |
| 2036 | 2036 | ); |
@@ -2128,7 +2128,7 @@ discard block |
||
| 2128 | 2128 | // Get user info |
| 2129 | 2129 | $userData = DB::queryFirstRow( |
| 2130 | 2130 | 'SELECT email, auth_type, login |
| 2131 | - FROM ' . prefixTable('users') . ' |
|
| 2131 | + FROM ' . prefixTable('users').' |
|
| 2132 | 2132 | WHERE id = %i', |
| 2133 | 2133 | $userId |
| 2134 | 2134 | ); |
@@ -2194,7 +2194,7 @@ discard block |
||
| 2194 | 2194 | // Check if user exists |
| 2195 | 2195 | DB::queryFirstRow( |
| 2196 | 2196 | 'SELECT * |
| 2197 | - FROM ' . prefixTable('users') . ' |
|
| 2197 | + FROM ' . prefixTable('users').' |
|
| 2198 | 2198 | WHERE id = %i', |
| 2199 | 2199 | $post_user_id |
| 2200 | 2200 | ); |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | // Check if user exists |
| 2265 | 2265 | $userInfo = DB::queryFirstRow( |
| 2266 | 2266 | 'SELECT public_key |
| 2267 | - FROM ' . prefixTable('users') . ' |
|
| 2267 | + FROM ' . prefixTable('users').' |
|
| 2268 | 2268 | WHERE id = %i', |
| 2269 | 2269 | $post_user_id |
| 2270 | 2270 | ); |
@@ -2412,15 +2412,15 @@ discard block |
||
| 2412 | 2412 | // Loop on items |
| 2413 | 2413 | $rows = DB::query( |
| 2414 | 2414 | 'SELECT id, pw |
| 2415 | - FROM ' . prefixTable('items') . ' |
|
| 2415 | + FROM ' . prefixTable('items').' |
|
| 2416 | 2416 | WHERE perso = 0 |
| 2417 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2417 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2418 | 2418 | ); |
| 2419 | 2419 | foreach ($rows as $record) { |
| 2420 | 2420 | // Get itemKey from current user |
| 2421 | 2421 | $currentUserKey = DB::queryFirstRow( |
| 2422 | 2422 | 'SELECT share_key, increment_id |
| 2423 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2423 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2424 | 2424 | WHERE object_id = %i AND user_id = %i', |
| 2425 | 2425 | $record['id'], |
| 2426 | 2426 | $session->get('user-id') |
@@ -2452,7 +2452,7 @@ discard block |
||
| 2452 | 2452 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2453 | 2453 | $currentUserKey = DB::queryFirstRow( |
| 2454 | 2454 | 'SELECT increment_id |
| 2455 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2455 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2456 | 2456 | WHERE object_id = %i AND user_id = %i', |
| 2457 | 2457 | $record['id'], |
| 2458 | 2458 | $post_user_id |
@@ -2485,7 +2485,7 @@ discard block |
||
| 2485 | 2485 | // SHould we change step? |
| 2486 | 2486 | DB::query( |
| 2487 | 2487 | 'SELECT * |
| 2488 | - FROM ' . prefixTable('items') . ' |
|
| 2488 | + FROM ' . prefixTable('items').' |
|
| 2489 | 2489 | WHERE perso = 0' |
| 2490 | 2490 | ); |
| 2491 | 2491 | |
@@ -2510,15 +2510,15 @@ discard block |
||
| 2510 | 2510 | // Loop on logs |
| 2511 | 2511 | $rows = DB::query( |
| 2512 | 2512 | 'SELECT increment_id |
| 2513 | - FROM ' . prefixTable('log_items') . ' |
|
| 2513 | + FROM ' . prefixTable('log_items').' |
|
| 2514 | 2514 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes" |
| 2515 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2515 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2516 | 2516 | ); |
| 2517 | 2517 | foreach ($rows as $record) { |
| 2518 | 2518 | // Get itemKey from current user |
| 2519 | 2519 | $currentUserKey = DB::queryFirstRow( |
| 2520 | 2520 | 'SELECT share_key |
| 2521 | - FROM ' . prefixTable('sharekeys_logs') . ' |
|
| 2521 | + FROM ' . prefixTable('sharekeys_logs').' |
|
| 2522 | 2522 | WHERE object_id = %i AND user_id = %i', |
| 2523 | 2523 | $record['increment_id'], |
| 2524 | 2524 | $session->get('user-id') |
@@ -2550,7 +2550,7 @@ discard block |
||
| 2550 | 2550 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2551 | 2551 | $currentUserKey = DB::queryFirstRow( |
| 2552 | 2552 | 'SELECT increment_id |
| 2553 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2553 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2554 | 2554 | WHERE object_id = %i AND user_id = %i', |
| 2555 | 2555 | $record['id'], |
| 2556 | 2556 | $post_user_id |
@@ -2572,7 +2572,7 @@ discard block |
||
| 2572 | 2572 | // SHould we change step? |
| 2573 | 2573 | DB::query( |
| 2574 | 2574 | 'SELECT increment_id |
| 2575 | - FROM ' . prefixTable('log_items') . ' |
|
| 2575 | + FROM ' . prefixTable('log_items').' |
|
| 2576 | 2576 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"' |
| 2577 | 2577 | ); |
| 2578 | 2578 | |
@@ -2597,15 +2597,15 @@ discard block |
||
| 2597 | 2597 | // Loop on fields |
| 2598 | 2598 | $rows = DB::query( |
| 2599 | 2599 | 'SELECT id |
| 2600 | - FROM ' . prefixTable('categories_items') . ' |
|
| 2600 | + FROM ' . prefixTable('categories_items').' |
|
| 2601 | 2601 | WHERE encryption_type = "teampass_aes" |
| 2602 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2602 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2603 | 2603 | ); |
| 2604 | 2604 | foreach ($rows as $record) { |
| 2605 | 2605 | // Get itemKey from current user |
| 2606 | 2606 | $currentUserKey = DB::queryFirstRow( |
| 2607 | 2607 | 'SELECT share_key |
| 2608 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 2608 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 2609 | 2609 | WHERE object_id = %i AND user_id = %i', |
| 2610 | 2610 | $record['id'], |
| 2611 | 2611 | $session->get('user-id') |
@@ -2637,7 +2637,7 @@ discard block |
||
| 2637 | 2637 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2638 | 2638 | $currentUserKey = DB::queryFirstRow( |
| 2639 | 2639 | 'SELECT increment_id |
| 2640 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2640 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2641 | 2641 | WHERE object_id = %i AND user_id = %i', |
| 2642 | 2642 | $record['id'], |
| 2643 | 2643 | $post_user_id |
@@ -2659,7 +2659,7 @@ discard block |
||
| 2659 | 2659 | // SHould we change step? |
| 2660 | 2660 | DB::query( |
| 2661 | 2661 | 'SELECT * |
| 2662 | - FROM ' . prefixTable('categories_items') . ' |
|
| 2662 | + FROM ' . prefixTable('categories_items').' |
|
| 2663 | 2663 | WHERE encryption_type = "teampass_aes"' |
| 2664 | 2664 | ); |
| 2665 | 2665 | |
@@ -2684,14 +2684,14 @@ discard block |
||
| 2684 | 2684 | // Loop on suggestions |
| 2685 | 2685 | $rows = DB::query( |
| 2686 | 2686 | 'SELECT id |
| 2687 | - FROM ' . prefixTable('suggestion') . ' |
|
| 2688 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2687 | + FROM ' . prefixTable('suggestion').' |
|
| 2688 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2689 | 2689 | ); |
| 2690 | 2690 | foreach ($rows as $record) { |
| 2691 | 2691 | // Get itemKey from current user |
| 2692 | 2692 | $currentUserKey = DB::queryFirstRow( |
| 2693 | 2693 | 'SELECT share_key |
| 2694 | - FROM ' . prefixTable('sharekeys_suggestions') . ' |
|
| 2694 | + FROM ' . prefixTable('sharekeys_suggestions').' |
|
| 2695 | 2695 | WHERE object_id = %i AND user_id = %i', |
| 2696 | 2696 | $record['id'], |
| 2697 | 2697 | $session->get('user-id') |
@@ -2723,7 +2723,7 @@ discard block |
||
| 2723 | 2723 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2724 | 2724 | $currentUserKey = DB::queryFirstRow( |
| 2725 | 2725 | 'SELECT increment_id |
| 2726 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2726 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2727 | 2727 | WHERE object_id = %i AND user_id = %i', |
| 2728 | 2728 | $record['id'], |
| 2729 | 2729 | $post_user_id |
@@ -2769,15 +2769,15 @@ discard block |
||
| 2769 | 2769 | // Loop on files |
| 2770 | 2770 | $rows = DB::query( |
| 2771 | 2771 | 'SELECT id |
| 2772 | - FROM ' . prefixTable('files') . ' |
|
| 2773 | - WHERE status = "' . TP_ENCRYPTION_NAME . '" |
|
| 2774 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 2772 | + FROM ' . prefixTable('files').' |
|
| 2773 | + WHERE status = "' . TP_ENCRYPTION_NAME.'" |
|
| 2774 | + LIMIT ' . $post_start.', '.$post_length |
|
| 2775 | 2775 | ); //aes_encryption |
| 2776 | 2776 | foreach ($rows as $record) { |
| 2777 | 2777 | // Get itemKey from current user |
| 2778 | 2778 | $currentUserKey = DB::queryFirstRow( |
| 2779 | 2779 | 'SELECT share_key |
| 2780 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 2780 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 2781 | 2781 | WHERE object_id = %i AND user_id = %i', |
| 2782 | 2782 | $record['id'], |
| 2783 | 2783 | $session->get('user-id') |
@@ -2809,7 +2809,7 @@ discard block |
||
| 2809 | 2809 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2810 | 2810 | $currentUserKey = DB::queryFirstRow( |
| 2811 | 2811 | 'SELECT increment_id |
| 2812 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2812 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2813 | 2813 | WHERE object_id = %i AND user_id = %i', |
| 2814 | 2814 | $record['id'], |
| 2815 | 2815 | $post_user_id |
@@ -2831,8 +2831,8 @@ discard block |
||
| 2831 | 2831 | // SHould we change step? |
| 2832 | 2832 | DB::query( |
| 2833 | 2833 | 'SELECT * |
| 2834 | - FROM ' . prefixTable('files') . ' |
|
| 2835 | - WHERE status = "' . TP_ENCRYPTION_NAME . '"' |
|
| 2834 | + FROM ' . prefixTable('files').' |
|
| 2835 | + WHERE status = "' . TP_ENCRYPTION_NAME.'"' |
|
| 2836 | 2836 | ); |
| 2837 | 2837 | |
| 2838 | 2838 | $next_start = (int) $post_start + (int) $post_length; |
@@ -2865,9 +2865,9 @@ discard block |
||
| 2865 | 2865 | if (count($session->get('user-personal_folders')) > 0) { |
| 2866 | 2866 | $rows = DB::query( |
| 2867 | 2867 | 'SELECT id, pw |
| 2868 | - FROM ' . prefixTable('items') . ' |
|
| 2868 | + FROM ' . prefixTable('items').' |
|
| 2869 | 2869 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s |
| 2870 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
| 2870 | + LIMIT ' . $post_start.', '.$post_length, |
|
| 2871 | 2871 | $session->get('user-personal_folders'), |
| 2872 | 2872 | "defuse" |
| 2873 | 2873 | ); |
@@ -2875,7 +2875,7 @@ discard block |
||
| 2875 | 2875 | // Get itemKey from current user |
| 2876 | 2876 | $currentUserKey = DB::queryFirstRow( |
| 2877 | 2877 | 'SELECT share_key, increment_id |
| 2878 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2878 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2879 | 2879 | WHERE object_id = %i AND user_id = %i', |
| 2880 | 2880 | $record['id'], |
| 2881 | 2881 | $session->get('user-id') |
@@ -2902,7 +2902,7 @@ discard block |
||
| 2902 | 2902 | if ((int) $post_user_id !== (int) $session->get('user-id')) { |
| 2903 | 2903 | $currentUserKey = DB::queryFirstRow( |
| 2904 | 2904 | 'SELECT increment_id |
| 2905 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2905 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2906 | 2906 | WHERE object_id = %i AND user_id = %i', |
| 2907 | 2907 | $record['id'], |
| 2908 | 2908 | $post_user_id |
@@ -2925,7 +2925,7 @@ discard block |
||
| 2925 | 2925 | // SHould we change step? |
| 2926 | 2926 | DB::query( |
| 2927 | 2927 | 'SELECT * |
| 2928 | - FROM ' . prefixTable('items') . ' |
|
| 2928 | + FROM ' . prefixTable('items').' |
|
| 2929 | 2929 | WHERE perso = 0' |
| 2930 | 2930 | ); |
| 2931 | 2931 | |
@@ -2953,7 +2953,7 @@ discard block |
||
| 2953 | 2953 | // Check if user exists |
| 2954 | 2954 | $userInfo = DB::queryFirstRow( |
| 2955 | 2955 | 'SELECT public_key, encrypted_psk |
| 2956 | - FROM ' . prefixTable('users') . ' |
|
| 2956 | + FROM ' . prefixTable('users').' |
|
| 2957 | 2957 | WHERE id = %i', |
| 2958 | 2958 | $post_user_id |
| 2959 | 2959 | ); |
@@ -2979,7 +2979,7 @@ discard block |
||
| 2979 | 2979 | if ($post_counterItemsToTreat === -1) { |
| 2980 | 2980 | DB::query( |
| 2981 | 2981 | 'SELECT id |
| 2982 | - FROM ' . prefixTable('items') . ' |
|
| 2982 | + FROM ' . prefixTable('items').' |
|
| 2983 | 2983 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s', |
| 2984 | 2984 | $session->get('user-personal_folders'), |
| 2985 | 2985 | 'teampass_aes' |
@@ -2992,7 +2992,7 @@ discard block |
||
| 2992 | 2992 | // Loop on persoanl items |
| 2993 | 2993 | $rows = DB::query( |
| 2994 | 2994 | 'SELECT id, pw |
| 2995 | - FROM ' . prefixTable('items') . ' |
|
| 2995 | + FROM ' . prefixTable('items').' |
|
| 2996 | 2996 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s |
| 2997 | 2997 | LIMIT ' . $post_length, |
| 2998 | 2998 | $session->get('user-personal_folders'), |
@@ -3036,7 +3036,7 @@ discard block |
||
| 3036 | 3036 | // Loop on files |
| 3037 | 3037 | $rows = DB::query( |
| 3038 | 3038 | 'SELECT id, file |
| 3039 | - FROM ' . prefixTable('files') . ' |
|
| 3039 | + FROM ' . prefixTable('files').' |
|
| 3040 | 3040 | WHERE status != %s |
| 3041 | 3041 | AND id_item = %i', |
| 3042 | 3042 | TP_ENCRYPTION_NAME, |
@@ -3047,13 +3047,13 @@ discard block |
||
| 3047 | 3047 | // Now decrypt the file |
| 3048 | 3048 | prepareFileWithDefuse( |
| 3049 | 3049 | 'decrypt', |
| 3050 | - $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'], |
|
| 3051 | - $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete', |
|
| 3050 | + $SETTINGS['path_to_upload_folder'].'/'.$record2['file'], |
|
| 3051 | + $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete', |
|
| 3052 | 3052 | $post_user_psk |
| 3053 | 3053 | ); |
| 3054 | 3054 | |
| 3055 | 3055 | // Encrypt the file |
| 3056 | - $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']); |
|
| 3056 | + $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']); |
|
| 3057 | 3057 | |
| 3058 | 3058 | DB::update( |
| 3059 | 3059 | prefixTable('files'), |
@@ -3076,7 +3076,7 @@ discard block |
||
| 3076 | 3076 | ); |
| 3077 | 3077 | |
| 3078 | 3078 | // Unlink original file |
| 3079 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']); |
|
| 3079 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']); |
|
| 3080 | 3080 | } |
| 3081 | 3081 | } |
| 3082 | 3082 | |
@@ -3084,7 +3084,7 @@ discard block |
||
| 3084 | 3084 | $next_start = (int) $post_start + (int) $post_length; |
| 3085 | 3085 | DB::query( |
| 3086 | 3086 | 'SELECT id |
| 3087 | - FROM ' . prefixTable('items') . ' |
|
| 3087 | + FROM ' . prefixTable('items').' |
|
| 3088 | 3088 | WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s', |
| 3089 | 3089 | $session->get('user-personal_folders'), |
| 3090 | 3090 | 'teampass_aes' |
@@ -3154,7 +3154,7 @@ discard block |
||
| 3154 | 3154 | // Get user info |
| 3155 | 3155 | $userData = DB::queryFirstRow( |
| 3156 | 3156 | 'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time |
| 3157 | - FROM ' . prefixTable('users') . ' |
|
| 3157 | + FROM ' . prefixTable('users').' |
|
| 3158 | 3158 | WHERE id = %i', |
| 3159 | 3159 | $post_user_id |
| 3160 | 3160 | ); |
@@ -3201,7 +3201,7 @@ discard block |
||
| 3201 | 3201 | // Get user info |
| 3202 | 3202 | $userData = DB::queryFirstRow( |
| 3203 | 3203 | 'SELECT auth_type, login, private_key |
| 3204 | - FROM ' . prefixTable('users') . ' |
|
| 3204 | + FROM ' . prefixTable('users').' |
|
| 3205 | 3205 | WHERE id = %i', |
| 3206 | 3206 | $post_user_id |
| 3207 | 3207 | ); |
@@ -3251,7 +3251,7 @@ discard block |
||
| 3251 | 3251 | return prepareExchangedData( |
| 3252 | 3252 | array( |
| 3253 | 3253 | 'error' => false, |
| 3254 | - 'message' => $lang->get('done'),'', |
|
| 3254 | + 'message' => $lang->get('done'), '', |
|
| 3255 | 3255 | ), |
| 3256 | 3256 | 'encode' |
| 3257 | 3257 | ); |
@@ -3300,7 +3300,7 @@ discard block |
||
| 3300 | 3300 | // Get user info |
| 3301 | 3301 | $userData = DB::queryFirstRow( |
| 3302 | 3302 | 'SELECT u.auth_type, u.login, u.private_key, u.special |
| 3303 | - FROM ' . prefixTable('users') . ' AS u |
|
| 3303 | + FROM ' . prefixTable('users').' AS u |
|
| 3304 | 3304 | WHERE u.id = %i', |
| 3305 | 3305 | $post_user_id |
| 3306 | 3306 | ); |
@@ -3336,7 +3336,7 @@ discard block |
||
| 3336 | 3336 | return prepareExchangedData( |
| 3337 | 3337 | array( |
| 3338 | 3338 | 'error' => false, |
| 3339 | - 'message' => $lang->get('done'),'', |
|
| 3339 | + 'message' => $lang->get('done'), '', |
|
| 3340 | 3340 | ), |
| 3341 | 3341 | 'encode' |
| 3342 | 3342 | ); |
@@ -3358,8 +3358,8 @@ discard block |
||
| 3358 | 3358 | // Get one itemKey from current user |
| 3359 | 3359 | $currentUserKey = DB::queryFirstRow( |
| 3360 | 3360 | 'SELECT ski.share_key, ski.increment_id, l.id_user |
| 3361 | - FROM ' . prefixTable('sharekeys_items') . ' AS ski |
|
| 3362 | - INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item |
|
| 3361 | + FROM ' . prefixTable('sharekeys_items').' AS ski |
|
| 3362 | + INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item |
|
| 3363 | 3363 | WHERE ski.user_id = %i |
| 3364 | 3364 | ORDER BY RAND() |
| 3365 | 3365 | LIMIT 1', |
@@ -3426,8 +3426,8 @@ discard block |
||
| 3426 | 3426 | 'process_type' => 'create_user_keys', |
| 3427 | 3427 | 'arguments' => json_encode([ |
| 3428 | 3428 | 'new_user_id' => (int) $post_user_id, |
| 3429 | - 'new_user_pwd' => cryption($post_previous_pwd, '','encrypt')['string'], |
|
| 3430 | - 'new_user_private_key' => cryption($validPreviousKey['private_key'], '','encrypt')['string'], |
|
| 3429 | + 'new_user_pwd' => cryption($post_previous_pwd, '', 'encrypt')['string'], |
|
| 3430 | + 'new_user_private_key' => cryption($validPreviousKey['private_key'], '', 'encrypt')['string'], |
|
| 3431 | 3431 | 'send_email' => 0, |
| 3432 | 3432 | 'otp_provided_new_value' => 0, |
| 3433 | 3433 | 'user_self_change' => 1, |
@@ -3496,7 +3496,7 @@ discard block |
||
| 3496 | 3496 | id, |
| 3497 | 3497 | private_key, |
| 3498 | 3498 | created_at |
| 3499 | - FROM " . prefixTable('user_private_keys') . " |
|
| 3499 | + FROM " . prefixTable('user_private_keys')." |
|
| 3500 | 3500 | WHERE user_id = %i |
| 3501 | 3501 | ORDER BY created_at DESC, id DESC", |
| 3502 | 3502 | $userId |
@@ -3518,9 +3518,9 @@ discard block |
||
| 3518 | 3518 | // Select one personal item share_key to test decryption |
| 3519 | 3519 | $currentUserItemKey = DB::queryFirstRow( |
| 3520 | 3520 | 'SELECT si.share_key, si.increment_id, l.id_user, i.perso |
| 3521 | - FROM ' . prefixTable('sharekeys_items') . ' AS si |
|
| 3522 | - INNER JOIN ' . prefixTable('log_items') . ' AS l ON si.object_id = l.id_item |
|
| 3523 | - INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = l.id_item |
|
| 3521 | + FROM ' . prefixTable('sharekeys_items').' AS si |
|
| 3522 | + INNER JOIN ' . prefixTable('log_items').' AS l ON si.object_id = l.id_item |
|
| 3523 | + INNER JOIN ' . prefixTable('items').' AS i ON i.id = l.id_item |
|
| 3524 | 3524 | WHERE si.user_id = %i AND i.perso = 1 AND si.share_key != "" |
| 3525 | 3525 | ORDER BY RAND() |
| 3526 | 3526 | LIMIT 1', |
@@ -3571,7 +3571,7 @@ discard block |
||
| 3571 | 3571 | $session->get('user-id') |
| 3572 | 3572 | ); |
| 3573 | 3573 | // Return data |
| 3574 | - return '[{"new_value":"' . $session->get('user-session_duration') . '"}]'; |
|
| 3574 | + return '[{"new_value":"'.$session->get('user-session_duration').'"}]'; |
|
| 3575 | 3575 | } |
| 3576 | 3576 | |
| 3577 | 3577 | return '[{"new_value":"expired"}]'; |
@@ -3621,8 +3621,8 @@ discard block |
||
| 3621 | 3621 | { |
| 3622 | 3622 | $personalItems = DB::query( |
| 3623 | 3623 | 'SELECT i.id, i.pw, s.share_key, s.increment_id |
| 3624 | - FROM ' . prefixTable('items') . ' i |
|
| 3625 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' s ON i.id = s.object_id |
|
| 3624 | + FROM ' . prefixTable('items').' i |
|
| 3625 | + INNER JOIN ' . prefixTable('sharekeys_items').' s ON i.id = s.object_id |
|
| 3626 | 3626 | WHERE i.perso = %i |
| 3627 | 3627 | AND s.user_id = %i', |
| 3628 | 3628 | 1, |
@@ -3687,8 +3687,8 @@ discard block |
||
| 3687 | 3687 | 'process_type' => 'create_user_keys', |
| 3688 | 3688 | 'arguments' => json_encode([ |
| 3689 | 3689 | 'new_user_id' => (int) $userId, |
| 3690 | - 'new_user_pwd' => cryption($userCurrentPwd, '','encrypt')['string'], |
|
| 3691 | - 'new_user_private_key' => cryption($validPreviousKey['private_key'], '','encrypt')['string'], |
|
| 3690 | + 'new_user_pwd' => cryption($userCurrentPwd, '', 'encrypt')['string'], |
|
| 3691 | + 'new_user_private_key' => cryption($validPreviousKey['private_key'], '', 'encrypt')['string'], |
|
| 3692 | 3692 | 'send_email' => 0, |
| 3693 | 3693 | 'otp_provided_new_value' => 0, |
| 3694 | 3694 | 'user_self_change' => 1, |
@@ -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) : ''; |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | $dataItem = DB::query( |
| 457 | 457 | 'SELECT i.anyone_can_modify, i.perso, r.role_id |
| 458 | - FROM ' . prefixTable('items') . ' i |
|
| 459 | - LEFT JOIN ' . prefixTable('restriction_to_roles') . ' r ON i.id = r.item_id |
|
| 458 | + FROM ' . prefixTable('items').' i |
|
| 459 | + LEFT JOIN ' . prefixTable('restriction_to_roles').' r ON i.id = r.item_id |
|
| 460 | 460 | WHERE i.id = %i', |
| 461 | 461 | $record['id'] |
| 462 | 462 | ); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | if (empty($restrictedTo)) { |
| 513 | 513 | $restrictedTo = $session->get('user-id'); |
| 514 | 514 | } else { |
| 515 | - $restrictedTo .= ',' . $session->get('user-id'); |
|
| 515 | + $restrictedTo .= ','.$session->get('user-id'); |
|
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | $arr_data[$record['id']]['restricted'] = $restrictedTo; |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $arrTmp = []; |
| 626 | 626 | foreach (explode(';', $session->get('user-roles')) as $role) { |
| 627 | 627 | $access = DB::queryFirstRow( |
| 628 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
| 628 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
| 629 | 629 | $role, |
| 630 | 630 | $record['id_tree'] |
| 631 | 631 | ); |
@@ -676,8 +676,8 @@ discard block |
||
| 676 | 676 | ) { |
| 677 | 677 | $data_item = DB::queryFirstRow( |
| 678 | 678 | 'SELECT i.pw AS pw, s.share_key AS share_key |
| 679 | - FROM ' . prefixTable('items') . ' AS i |
|
| 680 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
| 679 | + FROM ' . prefixTable('items').' AS i |
|
| 680 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
| 681 | 681 | WHERE i.id = %i AND s.user_id = %i', |
| 682 | 682 | $record['id'], |
| 683 | 683 | $session->get('user-id') |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) { |
| 75 | 75 | // Not allowed page |
| 76 | 76 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 77 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 77 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 78 | 78 | exit; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // Get info about user to modify |
| 147 | 147 | $targetUserInfos = DB::queryFirstRow( |
| 148 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 148 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 149 | 149 | WHERE id = %i', |
| 150 | 150 | (int) $dataReceived['user_id'] |
| 151 | 151 | ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // Check if user already exists |
| 278 | 278 | $data = DB::query( |
| 279 | 279 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
| 280 | - FROM ' . prefixTable('users') . ' |
|
| 280 | + FROM ' . prefixTable('users').' |
|
| 281 | 281 | WHERE login = %s |
| 282 | 282 | AND deleted_at IS NULL', |
| 283 | 283 | $login |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | // Get info about user to delete |
| 498 | 498 | $data_user = DB::queryFirstRow( |
| 499 | - 'SELECT login, admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 499 | + 'SELECT login, admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 500 | 500 | WHERE id = %i', |
| 501 | 501 | $post_id |
| 502 | 502 | ); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | ); |
| 531 | 531 | // delete personal folder and subfolders |
| 532 | 532 | $data = DB::queryFirstRow( |
| 533 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 533 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 534 | 534 | WHERE title = %s AND personal_folder = %i', |
| 535 | 535 | $post_id, |
| 536 | 536 | '1' |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
| 544 | 544 | // delete items & logs |
| 545 | 545 | $items = DB::query( |
| 546 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
| 546 | + 'SELECT id FROM '.prefixTable('items').' |
|
| 547 | 547 | WHERE id_tree=%i AND perso = %i', |
| 548 | 548 | $folder->id, |
| 549 | 549 | '1' |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | // Delete any process related to user |
| 568 | 568 | $processes = DB::query( |
| 569 | 569 | 'SELECT increment_id |
| 570 | - FROM ' . prefixTable('background_tasks') . ' |
|
| 570 | + FROM ' . prefixTable('background_tasks').' |
|
| 571 | 571 | WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i', |
| 572 | 572 | $post_id |
| 573 | 573 | ); |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | $return = array(); |
| 621 | 621 | // Check if folder exists |
| 622 | 622 | $data = DB::query( |
| 623 | - 'SELECT * FROM ' . prefixTable('nested_tree') . ' |
|
| 623 | + 'SELECT * FROM '.prefixTable('nested_tree').' |
|
| 624 | 624 | WHERE title = %s AND parent_id = %i', |
| 625 | 625 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS), |
| 626 | 626 | '0' |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | } |
| 634 | 634 | // Check if role exists |
| 635 | 635 | $data = DB::query( |
| 636 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 636 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 637 | 637 | WHERE title = %s', |
| 638 | 638 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
| 639 | 639 | ); |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | // Get info about user to delete |
| 663 | 663 | $data_user = DB::queryFirstRow( |
| 664 | 664 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 665 | - FROM ' . prefixTable('users') . ' |
|
| 665 | + FROM ' . prefixTable('users').' |
|
| 666 | 666 | WHERE id = %i', |
| 667 | 667 | $post_user_id |
| 668 | 668 | ); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | // Get info about user |
| 719 | 719 | $rowUser = DB::queryFirstRow( |
| 720 | 720 | 'SELECT * |
| 721 | - FROM ' . prefixTable('users') . ' |
|
| 721 | + FROM ' . prefixTable('users').' |
|
| 722 | 722 | WHERE id = %i', |
| 723 | 723 | $post_id |
| 724 | 724 | ); |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | $session->set('user-roles_array', explode(';', $session->get('user-roles'))); |
| 747 | 747 | $rows = DB::query(' |
| 748 | 748 | SELECT id,title,creator_id |
| 749 | - FROM ' . prefixTable('roles_title') .' |
|
| 749 | + FROM ' . prefixTable('roles_title').' |
|
| 750 | 750 | WHERE id IN %li', |
| 751 | 751 | $session->get('user-roles_array') |
| 752 | 752 | ); |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | $rolesList = array(); |
| 785 | 785 | $managedBy = array(); |
| 786 | 786 | $selected = ''; |
| 787 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
| 787 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
| 788 | 788 | foreach ($rows as $reccord) { |
| 789 | 789 | $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']); |
| 790 | 790 | } |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | array_push( |
| 816 | 816 | $managedBy, |
| 817 | 817 | array( |
| 818 | - 'title' => $lang->get('managers_of') . ' ' . $fonction['title'], |
|
| 818 | + 'title' => $lang->get('managers_of').' '.$fonction['title'], |
|
| 819 | 819 | 'id' => $fonction['id'], |
| 820 | 820 | 'selected' => $selected, |
| 821 | 821 | ) |
@@ -897,9 +897,9 @@ discard block |
||
| 897 | 897 | |
| 898 | 898 | // get USER STATUS |
| 899 | 899 | if ($rowUser['disabled'] == 1) { |
| 900 | - $arrData['info'] = $lang->get('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">' . $lang->get('user_info_unlock_question') . '</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . $lang->get('user_info_delete_question') . '</label>'; |
|
| 900 | + $arrData['info'] = $lang->get('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">'.$lang->get('user_info_unlock_question').'</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.$lang->get('user_info_delete_question').'</label>'; |
|
| 901 | 901 | } else { |
| 902 | - $arrData['info'] = $lang->get('user_info_active') . '<br><input type="checkbox" value="lock" class="chk"> ' . $lang->get('user_info_lock_question'); |
|
| 902 | + $arrData['info'] = $lang->get('user_info_active').'<br><input type="checkbox" value="lock" class="chk"> '.$lang->get('user_info_lock_question'); |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | $arrData['error'] = false; |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | |
| 987 | 987 | // Get info about user to modify |
| 988 | 988 | $data_user = DB::queryFirstRow( |
| 989 | - 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 989 | + 'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 990 | 990 | WHERE id = %i', |
| 991 | 991 | $post_id |
| 992 | 992 | ); |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | // count number of admins |
| 998 | 998 | $users = DB::query( |
| 999 | 999 | 'SELECT id |
| 1000 | - FROM ' . prefixTable('users') . ' |
|
| 1000 | + FROM ' . prefixTable('users').' |
|
| 1001 | 1001 | WHERE admin = 1 AND email != "" AND pw != "" AND id != %i', |
| 1002 | 1002 | $post_id |
| 1003 | 1003 | ); |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | // Exclude roles from AD - PR #3635 |
| 1021 | 1021 | $adRoles = DB::query( |
| 1022 | 1022 | 'SELECT roles_from_ad_groups |
| 1023 | - FROM ' . prefixTable('users') . ' |
|
| 1023 | + FROM ' . prefixTable('users').' |
|
| 1024 | 1024 | WHERE id = %i', |
| 1025 | 1025 | $post_id |
| 1026 | 1026 | )[0]['roles_from_ad_groups']; |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | ); |
| 1123 | 1123 | // delete personal folder and subfolders |
| 1124 | 1124 | $data = DB::queryFirstRow( |
| 1125 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 1125 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 1126 | 1126 | WHERE title = %s AND personal_folder = %i', |
| 1127 | 1127 | $post_id, |
| 1128 | 1128 | '1' |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
| 1136 | 1136 | // delete items & logs |
| 1137 | 1137 | $items = DB::query( |
| 1138 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
| 1138 | + 'SELECT id FROM '.prefixTable('items').' |
|
| 1139 | 1139 | WHERE id_tree=%i AND perso = %i', |
| 1140 | 1140 | $folder->id, |
| 1141 | 1141 | '1' |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | } else { |
| 1157 | 1157 | // Get old data about user |
| 1158 | 1158 | $oldData = DB::queryFirstRow( |
| 1159 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
| 1159 | + 'SELECT * FROM '.prefixTable('users').' |
|
| 1160 | 1160 | WHERE id = %i', |
| 1161 | 1161 | $post_id |
| 1162 | 1162 | ); |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | // update LOG |
| 1195 | 1195 | if ($oldData['email'] !== $post_email) { |
| 1196 | - logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id); |
|
| 1196 | + logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | } |
| 1199 | 1199 | echo prepareExchangedData( |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | DB::queryFirstRow( |
| 1244 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
| 1244 | + 'SELECT * FROM '.prefixTable('users').' |
|
| 1245 | 1245 | WHERE login = %s |
| 1246 | 1246 | AND deleted_at IS NULL', |
| 1247 | 1247 | filter_input(INPUT_POST, 'login', FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | // get User info |
| 1294 | 1294 | $rowUser = DB::queryFirstRow( |
| 1295 | 1295 | 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb, roles_from_ad_groups |
| 1296 | - FROM ' . prefixTable('users') . ' |
|
| 1296 | + FROM ' . prefixTable('users').' |
|
| 1297 | 1297 | WHERE id = %i', |
| 1298 | 1298 | $post_id |
| 1299 | 1299 | ); |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | $html = ''; |
| 1304 | 1304 | |
| 1305 | 1305 | if (isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) { |
| 1306 | - $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id']. ';' . $rowUser['roles_from_ad_groups']; |
|
| 1306 | + $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups']; |
|
| 1307 | 1307 | } |
| 1308 | 1308 | $arrData['functions'] = array_filter(explode(';', $rowUser['fonction_id'])); |
| 1309 | 1309 | $arrData['allowed_folders'] = array_filter(explode(';', $rowUser['groupes_visibles'])); |
@@ -1314,8 +1314,8 @@ discard block |
||
| 1314 | 1314 | // refine folders based upon roles |
| 1315 | 1315 | $rows = DB::query( |
| 1316 | 1316 | 'SELECT rv.folder_id, rv.type |
| 1317 | - FROM ' . prefixTable('roles_values') . ' as rv |
|
| 1318 | - INNER JOIN ' . prefixTable('nested_tree') . ' as nt ON rv.folder_id = nt.id |
|
| 1317 | + FROM ' . prefixTable('roles_values').' as rv |
|
| 1318 | + INNER JOIN ' . prefixTable('nested_tree').' as nt ON rv.folder_id = nt.id |
|
| 1319 | 1319 | WHERE rv.role_id IN %ls AND nt.personal_folder = 0 |
| 1320 | 1320 | ORDER BY rv.folder_id ASC', |
| 1321 | 1321 | $arrData['functions'] |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | // add allowed folders |
| 1341 | - foreach($arrData['allowed_folders'] as $Fld) { |
|
| 1341 | + foreach ($arrData['allowed_folders'] as $Fld) { |
|
| 1342 | 1342 | array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true)); |
| 1343 | 1343 | } |
| 1344 | 1344 | |
@@ -1349,7 +1349,7 @@ discard block |
||
| 1349 | 1349 | // get folder name |
| 1350 | 1350 | $row = DB::queryFirstRow( |
| 1351 | 1351 | 'SELECT title, nlevel, id |
| 1352 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 1352 | + FROM ' . prefixTable('nested_tree').' |
|
| 1353 | 1353 | WHERE id = %i', |
| 1354 | 1354 | $fld['id'] |
| 1355 | 1355 | ); |
@@ -1362,38 +1362,38 @@ discard block |
||
| 1362 | 1362 | |
| 1363 | 1363 | // manage right icon |
| 1364 | 1364 | if ($fld['type'] == 'W') { |
| 1365 | - $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1366 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' . |
|
| 1367 | - '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>'; |
|
| 1365 | + $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1366 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'. |
|
| 1367 | + '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>'; |
|
| 1368 | 1368 | } elseif ($fld['type'] == 'ND') { |
| 1369 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1370 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' . |
|
| 1371 | - '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>'; |
|
| 1369 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1370 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'. |
|
| 1371 | + '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>'; |
|
| 1372 | 1372 | } elseif ($fld['type'] == 'NE') { |
| 1373 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1374 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' . |
|
| 1375 | - '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>'; |
|
| 1373 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1374 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'. |
|
| 1375 | + '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>'; |
|
| 1376 | 1376 | } elseif ($fld['type'] == 'NDNE') { |
| 1377 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' . |
|
| 1378 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' . |
|
| 1379 | - '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>'; |
|
| 1377 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'. |
|
| 1378 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'. |
|
| 1379 | + '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>'; |
|
| 1380 | 1380 | } elseif ($fld['type'] == '') { |
| 1381 | - $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . $lang->get('no_access') . '"></i>'; |
|
| 1381 | + $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.$lang->get('no_access').'"></i>'; |
|
| 1382 | 1382 | } else { |
| 1383 | - $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . $lang->get('read') . '"></i>'; |
|
| 1383 | + $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.$lang->get('read').'"></i>'; |
|
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | - $html .= '<tr><td>' . $ident . $row['title'] . |
|
| 1387 | - ' <small class="text-info">[' . $row['id'] . ']</small>'. |
|
| 1388 | - ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . $lang->get('user_specific_right') . '"></i>' : ''). |
|
| 1389 | - '</td><td>' . $label . '</td></tr>'; |
|
| 1386 | + $html .= '<tr><td>'.$ident.$row['title']. |
|
| 1387 | + ' <small class="text-info">['.$row['id'].']</small>'. |
|
| 1388 | + ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.$lang->get('user_specific_right').'"></i>' : ''). |
|
| 1389 | + '</td><td>'.$label.'</td></tr>'; |
|
| 1390 | 1390 | break; |
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | - $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' . |
|
| 1396 | - $html . '</tbody></table>'; |
|
| 1395 | + $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'. |
|
| 1396 | + $html.'</tbody></table>'; |
|
| 1397 | 1397 | } else { |
| 1398 | 1398 | $html_full = ''; |
| 1399 | 1399 | } |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | if ((int) $session->get('user-admin') === 0 && (int) $session->get('user-can_manage_all_users') === 0) { |
| 1440 | 1440 | $rows = DB::query( |
| 1441 | 1441 | 'SELECT * |
| 1442 | - FROM ' . prefixTable('users') . ' |
|
| 1442 | + FROM ' . prefixTable('users').' |
|
| 1443 | 1443 | WHERE admin = %i AND isAdministratedByRole IN %ls', |
| 1444 | 1444 | '0', |
| 1445 | 1445 | array_filter($session->get('user-roles_array')) |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | } else { |
| 1448 | 1448 | $rows = DB::query( |
| 1449 | 1449 | 'SELECT * |
| 1450 | - FROM ' . prefixTable('users') . ' |
|
| 1450 | + FROM ' . prefixTable('users').' |
|
| 1451 | 1451 | WHERE admin = %i', |
| 1452 | 1452 | '0' |
| 1453 | 1453 | ); |
@@ -1459,7 +1459,7 @@ discard block |
||
| 1459 | 1459 | $groupIds = []; |
| 1460 | 1460 | foreach (explode(';', $record['fonction_id']) as $group) { |
| 1461 | 1461 | $tmp = DB::queryFirstRow( |
| 1462 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
| 1462 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
| 1463 | 1463 | WHERE id = %i', |
| 1464 | 1464 | $group |
| 1465 | 1465 | ); |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | |
| 1472 | 1472 | // Get managed_by |
| 1473 | 1473 | $managedBy = DB::queryFirstRow( |
| 1474 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
| 1474 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
| 1475 | 1475 | WHERE id = %i', |
| 1476 | 1476 | $record['isAdministratedByRole'] |
| 1477 | 1477 | ); |
@@ -1481,7 +1481,7 @@ discard block |
||
| 1481 | 1481 | $foldersAllowedIds = []; |
| 1482 | 1482 | foreach (explode(';', $record['groupes_visibles']) as $role) { |
| 1483 | 1483 | $tmp = DB::queryFirstRow( |
| 1484 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
| 1484 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
| 1485 | 1485 | WHERE id = %i', |
| 1486 | 1486 | $role |
| 1487 | 1487 | ); |
@@ -1494,7 +1494,7 @@ discard block |
||
| 1494 | 1494 | $foldersForbiddenIds = []; |
| 1495 | 1495 | foreach (explode(';', $record['groupes_interdits']) as $role) { |
| 1496 | 1496 | $tmp = DB::queryFirstRow( |
| 1497 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
| 1497 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
| 1498 | 1498 | WHERE id = %i', |
| 1499 | 1499 | $role |
| 1500 | 1500 | ); |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | 'login' => $record['login'], |
| 1513 | 1513 | 'groups' => implode(', ', $groups), |
| 1514 | 1514 | 'groupIds' => $groupIds, |
| 1515 | - 'managedBy' => $managedBy=== null ? $lang->get('administrator') : $managedBy['title'], |
|
| 1515 | + 'managedBy' => $managedBy === null ? $lang->get('administrator') : $managedBy['title'], |
|
| 1516 | 1516 | 'managedById' => $managedBy === null ? 0 : $managedBy['id'], |
| 1517 | 1517 | 'foldersAllowed' => implode(', ', $foldersAllowed), |
| 1518 | 1518 | 'foldersAllowedIds' => $foldersAllowedIds, |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | |
| 1614 | 1614 | // Get info about user |
| 1615 | 1615 | $data_user = DB::queryFirstRow( |
| 1616 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 1616 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 1617 | 1617 | WHERE id = %i', |
| 1618 | 1618 | $inputData['source_id'] |
| 1619 | 1619 | ); |
@@ -1840,14 +1840,14 @@ discard block |
||
| 1840 | 1840 | if (empty($post_context) === false && $post_context === 'add_one_role_to_user') { |
| 1841 | 1841 | $data_user = DB::queryFirstRow( |
| 1842 | 1842 | 'SELECT fonction_id, public_key |
| 1843 | - FROM ' . prefixTable('users') . ' |
|
| 1843 | + FROM ' . prefixTable('users').' |
|
| 1844 | 1844 | WHERE id = %i', |
| 1845 | 1845 | $post_user_id |
| 1846 | 1846 | ); |
| 1847 | 1847 | |
| 1848 | 1848 | if ($data_user) { |
| 1849 | 1849 | // Ensure array is unique |
| 1850 | - $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value; |
|
| 1850 | + $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value; |
|
| 1851 | 1851 | $post_new_value = implode(';', array_unique(explode(';', $post_new_value))); |
| 1852 | 1852 | } else { |
| 1853 | 1853 | // User not found |
@@ -1863,14 +1863,14 @@ discard block |
||
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | // Manage specific case of api key |
| 1866 | - if($post_field === 'user_api_key') { |
|
| 1866 | + if ($post_field === 'user_api_key') { |
|
| 1867 | 1867 | $encrypted_key = encryptUserObjectKey(base64_encode($post_new_value), $session->get('user-public_key')); |
| 1868 | 1868 | $session->set('user-api_key', $post_new_value); |
| 1869 | 1869 | |
| 1870 | 1870 | // test if user has an api key |
| 1871 | 1871 | $data_user = DB::queryFirstRow( |
| 1872 | 1872 | 'SELECT value |
| 1873 | - FROM ' . prefixTable('api') . ' |
|
| 1873 | + FROM ' . prefixTable('api').' |
|
| 1874 | 1874 | WHERE user_id = %i', |
| 1875 | 1875 | $post_user_id |
| 1876 | 1876 | ); |
@@ -1990,7 +1990,7 @@ discard block |
||
| 1990 | 1990 | } catch (\LdapRecord\Auth\BindException $e) { |
| 1991 | 1991 | $error = $e->getDetailedError(); |
| 1992 | 1992 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 1993 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
| 1993 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
| 1994 | 1994 | } |
| 1995 | 1995 | // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending |
| 1996 | 1996 | echo prepareExchangedData( |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | } catch (\LdapRecord\Auth\BindException $e) { |
| 2021 | 2021 | $error = $e->getDetailedError(); |
| 2022 | 2022 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 2023 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
| 2023 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
| 2024 | 2024 | } |
| 2025 | 2025 | // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending |
| 2026 | 2026 | echo prepareExchangedData( |
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue; |
| 2038 | 2038 | // Build the list of all groups in AD |
| 2039 | 2039 | if (isset($adUser['memberof']) === true) { |
| 2040 | - foreach($adUser['memberof'] as $j => $adUserGroup) { |
|
| 2040 | + foreach ($adUser['memberof'] as $j => $adUserGroup) { |
|
| 2041 | 2041 | if (empty($adUserGroup) === false && $j !== "count") { |
| 2042 | 2042 | $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3); |
| 2043 | 2043 | if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) { |
@@ -2053,7 +2053,7 @@ discard block |
||
| 2053 | 2053 | // Get his ID |
| 2054 | 2054 | $userInfo = DB::queryFirstRow( |
| 2055 | 2055 | 'SELECT id, login, fonction_id, auth_type |
| 2056 | - FROM ' . prefixTable('users') . ' |
|
| 2056 | + FROM ' . prefixTable('users').' |
|
| 2057 | 2057 | WHERE login = %s', |
| 2058 | 2058 | $userLogin |
| 2059 | 2059 | ); |
@@ -2089,7 +2089,7 @@ discard block |
||
| 2089 | 2089 | |
| 2090 | 2090 | // Get all groups in Teampass |
| 2091 | 2091 | $teampassRoles = array(); |
| 2092 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
| 2092 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
| 2093 | 2093 | foreach ($rows as $record) { |
| 2094 | 2094 | array_push( |
| 2095 | 2095 | $teampassRoles, |
@@ -2154,7 +2154,7 @@ discard block |
||
| 2154 | 2154 | // Check if user already exists |
| 2155 | 2155 | $data = DB::query( |
| 2156 | 2156 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
| 2157 | - FROM ' . prefixTable('users') . ' |
|
| 2157 | + FROM ' . prefixTable('users').' |
|
| 2158 | 2158 | WHERE login = %s', |
| 2159 | 2159 | $post_login |
| 2160 | 2160 | ); |
@@ -2331,7 +2331,7 @@ discard block |
||
| 2331 | 2331 | // Check if user already exists |
| 2332 | 2332 | DB::query( |
| 2333 | 2333 | 'SELECT id |
| 2334 | - FROM ' . prefixTable('users') . ' |
|
| 2334 | + FROM ' . prefixTable('users').' |
|
| 2335 | 2335 | WHERE id = %i', |
| 2336 | 2336 | $post_id |
| 2337 | 2337 | ); |
@@ -2393,7 +2393,7 @@ discard block |
||
| 2393 | 2393 | // Get all groups in Teampass |
| 2394 | 2394 | $teampassRoles = array(); |
| 2395 | 2395 | $titleToIdMap = []; |
| 2396 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
| 2396 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
| 2397 | 2397 | foreach ($rows as $record) { |
| 2398 | 2398 | array_push( |
| 2399 | 2399 | $teampassRoles, |
@@ -2439,7 +2439,7 @@ discard block |
||
| 2439 | 2439 | // Get his ID |
| 2440 | 2440 | $userInfo = DB::queryFirstRow( |
| 2441 | 2441 | 'SELECT id, login, fonction_id, auth_type |
| 2442 | - FROM ' . prefixTable('users') . ' |
|
| 2442 | + FROM ' . prefixTable('users').' |
|
| 2443 | 2443 | WHERE login = %s', |
| 2444 | 2444 | $userLogin |
| 2445 | 2445 | ); |
@@ -2546,7 +2546,7 @@ discard block |
||
| 2546 | 2546 | // Check if user already exists |
| 2547 | 2547 | DB::query( |
| 2548 | 2548 | 'SELECT id |
| 2549 | - FROM ' . prefixTable('users') . ' |
|
| 2549 | + FROM ' . prefixTable('users').' |
|
| 2550 | 2550 | WHERE id = %i', |
| 2551 | 2551 | $post_id |
| 2552 | 2552 | ); |
@@ -2612,7 +2612,7 @@ discard block |
||
| 2612 | 2612 | // Search TP_USER in db |
| 2613 | 2613 | $userTP = DB::queryFirstRow( |
| 2614 | 2614 | 'SELECT pw |
| 2615 | - FROM ' . prefixTable('users') . ' |
|
| 2615 | + FROM ' . prefixTable('users').' |
|
| 2616 | 2616 | WHERE id = %i', |
| 2617 | 2617 | TP_USER_ID |
| 2618 | 2618 | ); |
@@ -2635,7 +2635,7 @@ discard block |
||
| 2635 | 2635 | 'arguments' => json_encode([ |
| 2636 | 2636 | 'new_user_id' => (int) $post_user_id, |
| 2637 | 2637 | 'new_user_pwd' => '', |
| 2638 | - 'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'], |
|
| 2638 | + 'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'], |
|
| 2639 | 2639 | 'owner_id' => (int) TP_USER_ID, |
| 2640 | 2640 | 'creator_pwd' => $userTP['pw'], |
| 2641 | 2641 | 'email_body' => $lang->get('email_body_user_config_5'), |
@@ -2731,8 +2731,8 @@ discard block |
||
| 2731 | 2731 | // get user info |
| 2732 | 2732 | $processesProgress = DB::query( |
| 2733 | 2733 | 'SELECT u.ongoing_process_id, pt.task, pt.updated_at, pt.finished_at, pt.is_in_progress |
| 2734 | - FROM ' . prefixTable('users') . ' AS u |
|
| 2735 | - INNER JOIN ' . prefixTable('background_subtasks') . ' AS pt ON (pt.task_id = u.ongoing_process_id) |
|
| 2734 | + FROM ' . prefixTable('users').' AS u |
|
| 2735 | + INNER JOIN ' . prefixTable('background_subtasks').' AS pt ON (pt.task_id = u.ongoing_process_id) |
|
| 2736 | 2736 | WHERE u.id = %i', |
| 2737 | 2737 | $user_id |
| 2738 | 2738 | ); |
@@ -2740,9 +2740,9 @@ discard block |
||
| 2740 | 2740 | //print_r($processesProgress); |
| 2741 | 2741 | $finished_steps = 0; |
| 2742 | 2742 | $nb_steps = count($processesProgress); |
| 2743 | - foreach($processesProgress as $process) { |
|
| 2743 | + foreach ($processesProgress as $process) { |
|
| 2744 | 2744 | if ((int) $process['is_in_progress'] === -1) { |
| 2745 | - $finished_steps ++; |
|
| 2745 | + $finished_steps++; |
|
| 2746 | 2746 | } |
| 2747 | 2747 | } |
| 2748 | 2748 | |
@@ -2751,7 +2751,7 @@ discard block |
||
| 2751 | 2751 | 'error' => false, |
| 2752 | 2752 | 'message' => '', |
| 2753 | 2753 | 'user_id' => $user_id, |
| 2754 | - 'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps/$nb_steps*100, 0).'%', |
|
| 2754 | + 'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps / $nb_steps * 100, 0).'%', |
|
| 2755 | 2755 | 'debug' => $finished_steps.",".$nb_steps, |
| 2756 | 2756 | ), |
| 2757 | 2757 | 'encode' |
@@ -2841,7 +2841,7 @@ discard block |
||
| 2841 | 2841 | |
| 2842 | 2842 | // Get info about user |
| 2843 | 2843 | $data_user = DB::queryFirstRow( |
| 2844 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 2844 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 2845 | 2845 | WHERE id = %i', |
| 2846 | 2846 | $value[1] |
| 2847 | 2847 | ); |
@@ -2875,7 +2875,7 @@ discard block |
||
| 2875 | 2875 | logEvents( |
| 2876 | 2876 | $SETTINGS, |
| 2877 | 2877 | 'user_mngt', |
| 2878 | - 'at_user_new_' . $value[0] . ':' . $value[1], |
|
| 2878 | + 'at_user_new_'.$value[0].':'.$value[1], |
|
| 2879 | 2879 | (string) $session->get('user-id'), |
| 2880 | 2880 | $session->get('user-login'), |
| 2881 | 2881 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS) |
@@ -2909,7 +2909,7 @@ discard block |
||
| 2909 | 2909 | |
| 2910 | 2910 | // Get info about user |
| 2911 | 2911 | $data_user = DB::queryFirstRow( |
| 2912 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 2912 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 2913 | 2913 | WHERE id = %i', |
| 2914 | 2914 | $id[1] |
| 2915 | 2915 | ); |
@@ -50,24 +50,24 @@ discard block |
||
| 50 | 50 | private function generateUserKeys($arguments) { |
| 51 | 51 | // Get all subtasks related to this task |
| 52 | 52 | $subtasks = DB::query( |
| 53 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
| 53 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
| 54 | 54 | $this->taskId |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | if (empty($subtasks)) { |
| 58 | - if (LOG_TASKS=== true) $this->logger->log("No subtask was found for task {$this->taskId}"); |
|
| 58 | + if (LOG_TASKS === true) $this->logger->log("No subtask was found for task {$this->taskId}"); |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Process each subtask |
| 63 | 63 | foreach ($subtasks as $subtask) { |
| 64 | - if (LOG_TASKS=== true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}"); |
|
| 64 | + if (LOG_TASKS === true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}"); |
|
| 65 | 65 | $this->processGenerateUserKeysSubtask($subtask, $arguments); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Are all subtasks completed? |
| 69 | 69 | $remainingSubtasks = DB::queryFirstField( |
| 70 | - 'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0', |
|
| 70 | + 'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0', |
|
| 71 | 71 | $this->taskId |
| 72 | 72 | ); |
| 73 | 73 | if ($remainingSubtasks == 0) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $subtask['increment_id'] |
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | - if (LOG_TASKS=== true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO'); |
|
| 101 | + if (LOG_TASKS === true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO'); |
|
| 102 | 102 | switch ($taskData['step'] ?? '') { |
| 103 | 103 | case 'step0': |
| 104 | 104 | $this->generateNewUserStep0($arguments); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $subtask['increment_id'] |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | - $this->logger->log("Subtask {$subtask['increment_id']} failure: " . $e->getMessage(), 'ERROR'); |
|
| 155 | + $this->logger->log("Subtask {$subtask['increment_id']} failure: ".$e->getMessage(), 'ERROR'); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // Loop on items |
| 195 | 195 | $rows = DB::query( |
| 196 | 196 | 'SELECT id, pw, perso |
| 197 | - FROM ' . prefixTable('items') . ' |
|
| 197 | + FROM ' . prefixTable('items').' |
|
| 198 | 198 | WHERE perso = %i |
| 199 | 199 | ORDER BY id ASC |
| 200 | 200 | LIMIT %i, %i', |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | // Get itemKey from current user |
| 208 | 208 | $currentUserKey = DB::queryFirstRow( |
| 209 | 209 | 'SELECT share_key, increment_id |
| 210 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 210 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 211 | 211 | WHERE object_id = %i AND user_id = %i', |
| 212 | 212 | $record['id'], |
| 213 | 213 | (int) $record['perso'] === 0 ? $arguments['owner_id'] : $arguments['new_user_id'] |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // If user is changing his own keys |
| 236 | - if (isset($arguments['user_self_change']) &&(int) $arguments['user_self_change'] === 1) { |
|
| 236 | + if (isset($arguments['user_self_change']) && (int) $arguments['user_self_change'] === 1) { |
|
| 237 | 237 | // Save the new sharekey correctly encrypted in DB |
| 238 | 238 | $affected = DB::update( |
| 239 | 239 | prefixTable('sharekeys_items'), |
@@ -299,16 +299,16 @@ discard block |
||
| 299 | 299 | // Loop on logs |
| 300 | 300 | $rows = DB::query( |
| 301 | 301 | 'SELECT increment_id |
| 302 | - FROM ' . prefixTable('log_items') . ' |
|
| 302 | + FROM ' . prefixTable('log_items').' |
|
| 303 | 303 | WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes" |
| 304 | 304 | ORDER BY increment_id ASC |
| 305 | - LIMIT ' . $taskData['index'] . ', ' . $taskData['nb'] |
|
| 305 | + LIMIT ' . $taskData['index'].', '.$taskData['nb'] |
|
| 306 | 306 | ); |
| 307 | 307 | foreach ($rows as $record) { |
| 308 | 308 | // Get itemKey from current user |
| 309 | 309 | $currentUserKey = DB::queryFirstRow( |
| 310 | 310 | 'SELECT share_key |
| 311 | - FROM ' . prefixTable('sharekeys_logs') . ' |
|
| 311 | + FROM ' . prefixTable('sharekeys_logs').' |
|
| 312 | 312 | WHERE object_id = %i AND user_id = %i', |
| 313 | 313 | $record['increment_id'], |
| 314 | 314 | $arguments['owner_id'] |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | if ((int) $arguments['new_user_id'] !== (int) $arguments['owner_id']) { |
| 341 | 341 | $currentUserKey = DB::queryFirstRow( |
| 342 | 342 | 'SELECT increment_id |
| 343 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 343 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 344 | 344 | WHERE object_id = %i AND user_id = %i', |
| 345 | 345 | $record['id'], |
| 346 | 346 | $arguments['new_user_id'] |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | // Loop on fields |
| 389 | 389 | $rows = DB::query( |
| 390 | 390 | 'SELECT id |
| 391 | - FROM ' . prefixTable('categories_items') . ' |
|
| 391 | + FROM ' . prefixTable('categories_items').' |
|
| 392 | 392 | WHERE encryption_type = "teampass_aes" |
| 393 | 393 | ORDER BY id ASC |
| 394 | 394 | LIMIT %i, %i', |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | // Get itemKey from current user |
| 400 | 400 | $currentUserKey = DB::queryFirstRow( |
| 401 | 401 | 'SELECT share_key |
| 402 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 402 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 403 | 403 | WHERE object_id = %i AND user_id = %i', |
| 404 | 404 | $record['id'], |
| 405 | 405 | $arguments['owner_id'] |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | if ((int) $arguments['new_user_id'] !== (int) $arguments['owner_id']) { |
| 428 | 428 | $currentUserKey = DB::queryFirstRow( |
| 429 | 429 | 'SELECT increment_id |
| 430 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 430 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 431 | 431 | WHERE object_id = %i AND user_id = %i', |
| 432 | 432 | $record['id'], |
| 433 | 433 | $arguments['new_user_id'] |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | // Loop on suggestions |
| 477 | 477 | $rows = DB::query( |
| 478 | 478 | 'SELECT id |
| 479 | - FROM ' . prefixTable('suggestion') . ' |
|
| 479 | + FROM ' . prefixTable('suggestion').' |
|
| 480 | 480 | ORDER BY id ASC |
| 481 | 481 | LIMIT %i, %i', |
| 482 | 482 | $taskData['index'], |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | // Get itemKey from current user |
| 487 | 487 | $currentUserKey = DB::queryFirstRow( |
| 488 | 488 | 'SELECT share_key |
| 489 | - FROM ' . prefixTable('sharekeys_suggestions') . ' |
|
| 489 | + FROM ' . prefixTable('sharekeys_suggestions').' |
|
| 490 | 490 | WHERE object_id = %i AND user_id = %i', |
| 491 | 491 | $record['id'], |
| 492 | 492 | $arguments['owner_id'] |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | if ((int) $arguments['new_user_id'] !== (int) $arguments['owner_id']) { |
| 519 | 519 | $currentUserKey = DB::queryFirstRow( |
| 520 | 520 | 'SELECT increment_id |
| 521 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 521 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 522 | 522 | WHERE object_id = %i AND user_id = %i', |
| 523 | 523 | $record['id'], |
| 524 | 524 | $arguments['new_user_id'] |
@@ -566,9 +566,9 @@ discard block |
||
| 566 | 566 | // Loop on files |
| 567 | 567 | $rows = DB::query( |
| 568 | 568 | 'SELECT f.id AS id, i.perso AS perso |
| 569 | - FROM ' . prefixTable('files') . ' AS f |
|
| 570 | - INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item |
|
| 571 | - WHERE f.status = "' . TP_ENCRYPTION_NAME . '" |
|
| 569 | + FROM ' . prefixTable('files').' AS f |
|
| 570 | + INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item |
|
| 571 | + WHERE f.status = "' . TP_ENCRYPTION_NAME.'" |
|
| 572 | 572 | LIMIT %i, %i', |
| 573 | 573 | $taskData['index'], |
| 574 | 574 | $taskData['nb'] |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | // Get itemKey from current user |
| 578 | 578 | $currentUserKey = DB::queryFirstRow( |
| 579 | 579 | 'SELECT share_key, increment_id |
| 580 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 580 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 581 | 581 | WHERE object_id = %i AND user_id = %i', |
| 582 | 582 | $record['id'], |
| 583 | 583 | (int) $record['perso'] === 0 ? $arguments['owner_id'] : $arguments['new_user_id'] |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | $currentUserKey = DB::queryFirstRow( |
| 607 | 607 | 'SELECT increment_id |
| 608 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 608 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 609 | 609 | WHERE object_id = %i AND user_id = %i', |
| 610 | 610 | $record['id'], |
| 611 | 611 | $arguments['new_user_id'] |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | // get user info |
| 684 | 684 | $userInfo = DB::queryFirstRow( |
| 685 | 685 | 'SELECT u.email, u.login, u.auth_type, u.special, u.lastname, u.name |
| 686 | - FROM ' . prefixTable('users') . ' AS u |
|
| 686 | + FROM ' . prefixTable('users').' AS u |
|
| 687 | 687 | WHERE u.id = %i', |
| 688 | 688 | $arguments['new_user_id'] |
| 689 | 689 | ); |
@@ -698,10 +698,10 @@ discard block |
||
| 698 | 698 | filter_var($userInfo['email'], FILTER_SANITIZE_EMAIL), |
| 699 | 699 | // @scrutinizer ignore-type |
| 700 | 700 | empty($arguments['email_body']) === false ? $arguments['email_body'] : $lang->get('email_body_user_config_1'), |
| 701 | - 'TEAMPASS - ' . $lang->get('login_credentials'), |
|
| 701 | + 'TEAMPASS - '.$lang->get('login_credentials'), |
|
| 702 | 702 | (array) filter_var_array( |
| 703 | 703 | [ |
| 704 | - '#code#' => cryption($arguments['new_user_code'], '','decrypt', $this->settings)['string'], |
|
| 704 | + '#code#' => cryption($arguments['new_user_code'], '', 'decrypt', $this->settings)['string'], |
|
| 705 | 705 | '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '', |
| 706 | 706 | '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '', |
| 707 | 707 | ], |
@@ -765,24 +765,24 @@ discard block |
||
| 765 | 765 | private function getOwnerInfos(int $owner_id, string $owner_pwd, int $only_personal_items = 0, string $owner_private_key = ''): array { |
| 766 | 766 | $userInfo = DB::queryFirstRow( |
| 767 | 767 | 'SELECT pw, public_key, private_key, login, name |
| 768 | - FROM ' . prefixTable('users') . ' |
|
| 768 | + FROM ' . prefixTable('users').' |
|
| 769 | 769 | WHERE id = %i', |
| 770 | 770 | $owner_id |
| 771 | 771 | ); |
| 772 | 772 | |
| 773 | 773 | // decrypt owner password |
| 774 | - $pwd = cryption($owner_pwd, '','decrypt', $this->settings)['string']; |
|
| 774 | + $pwd = cryption($owner_pwd, '', 'decrypt', $this->settings)['string']; |
|
| 775 | 775 | |
| 776 | 776 | // decrypt private key and send back |
| 777 | 777 | if ((int) $only_personal_items === 1 && empty($owner_private_key) === false) { |
| 778 | 778 | // Explicitely case where we only want personal items and where user has provided his private key |
| 779 | 779 | return [ |
| 780 | - 'private_key' => cryption($owner_private_key, '','decrypt')['string'], |
|
| 780 | + 'private_key' => cryption($owner_private_key, '', 'decrypt')['string'], |
|
| 781 | 781 | 'public_key' => $userInfo['public_key'], |
| 782 | 782 | 'login' => $userInfo['login'], |
| 783 | 783 | 'name' => $userInfo['name'], |
| 784 | 784 | ]; |
| 785 | - }else { |
|
| 785 | + } else { |
|
| 786 | 786 | // Normal case |
| 787 | 787 | return [ |
| 788 | 788 | 'private_key' => decryptPrivateKey($pwd, $userInfo['private_key']), |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ) { |
| 80 | 80 | // Not allowed page |
| 81 | 81 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 82 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 82 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 83 | 83 | exit; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | date_default_timezone_set('UTC'); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
| 107 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
| 108 | 108 | header('Content-type: text/html; charset=utf-8'); |
| 109 | 109 | header('Cache-Control: no-cache, must-revalidate'); |
| 110 | 110 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | // About special settings |
| 366 | 366 | $dataFolderSettings = DB::queryFirstRow( |
| 367 | 367 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
| 368 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 368 | + FROM ' . prefixTable('nested_tree').' |
|
| 369 | 369 | WHERE id = %i', |
| 370 | 370 | $inputData['folderId'] |
| 371 | 371 | ); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | // Get folder complexity |
| 383 | 383 | $folderComplexity = DB::queryFirstRow( |
| 384 | 384 | 'SELECT valeur |
| 385 | - FROM ' . prefixTable('misc') . ' |
|
| 385 | + FROM ' . prefixTable('misc').' |
|
| 386 | 386 | WHERE type = %s AND intitule = %i', |
| 387 | 387 | 'complex', |
| 388 | 388 | $inputData['folderId'] |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $itemExists = 0; |
| 408 | 408 | $newID = ''; |
| 409 | 409 | $data = DB::queryFirstRow( |
| 410 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 410 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 411 | 411 | WHERE label = %s AND inactif = %i', |
| 412 | 412 | $inputData['label'], |
| 413 | 413 | 0 |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | (int) $post_folder_is_personal, |
| 489 | 489 | (int) $newID, |
| 490 | 490 | $cryptedStuff['objectKey'], |
| 491 | - true, // only for the item creator |
|
| 492 | - false, // no delete all |
|
| 491 | + true, // only for the item creator |
|
| 492 | + false, // no delete all |
|
| 493 | 493 | ); |
| 494 | 494 | |
| 495 | 495 | // update fields |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | // should we encrypt the data |
| 503 | 503 | $dataTmp = DB::queryFirstRow( |
| 504 | 504 | 'SELECT encrypted_data |
| 505 | - FROM ' . prefixTable('categories') . ' |
|
| 505 | + FROM ' . prefixTable('categories').' |
|
| 506 | 506 | WHERE id = %i', |
| 507 | 507 | $field['id'] |
| 508 | 508 | ); |
@@ -531,8 +531,8 @@ discard block |
||
| 531 | 531 | (int) $post_folder_is_personal, |
| 532 | 532 | (int) $newObjectId, |
| 533 | 533 | $cryptedStuff['objectKey'], |
| 534 | - true, // only for the item creator |
|
| 535 | - false, // no delete all |
|
| 534 | + true, // only for the item creator |
|
| 535 | + false, // no delete all |
|
| 536 | 536 | ); |
| 537 | 537 | |
| 538 | 538 | array_push( |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | ) { |
| 569 | 569 | DB::queryFirstRow( |
| 570 | 570 | 'SELECT * |
| 571 | - FROM ' . prefixTable('templates') . ' |
|
| 571 | + FROM ' . prefixTable('templates').' |
|
| 572 | 572 | WHERE item_id = %i', |
| 573 | 573 | $newID |
| 574 | 574 | ); |
@@ -637,11 +637,11 @@ discard block |
||
| 637 | 637 | ) { |
| 638 | 638 | foreach ($post_restricted_to as $userRest) { |
| 639 | 639 | if (empty($userRest) === false) { |
| 640 | - $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest); |
|
| 640 | + $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest); |
|
| 641 | 641 | if (empty($listOfRestricted)) { |
| 642 | 642 | $listOfRestricted = $dataTmp['login']; |
| 643 | 643 | } else { |
| 644 | - $listOfRestricted .= ';' . $dataTmp['login']; |
|
| 644 | + $listOfRestricted .= ';'.$dataTmp['login']; |
|
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | 647 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | if (empty($userRest) === false) { |
| 658 | 658 | $dataTmp = DB::queryFirstRow( |
| 659 | 659 | 'SELECT login |
| 660 | - FROM ' . prefixTable('users') . ' |
|
| 660 | + FROM ' . prefixTable('users').' |
|
| 661 | 661 | WHERE id= %i', |
| 662 | 662 | $userRest |
| 663 | 663 | ); |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | if (empty($oldRestrictionList) === true) { |
| 666 | 666 | $oldRestrictionList = $dataTmp['login']; |
| 667 | 667 | } else { |
| 668 | - $oldRestrictionList .= ';' . $dataTmp['login']; |
|
| 668 | + $oldRestrictionList .= ';'.$dataTmp['login']; |
|
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | } |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | if (empty($post_uploaded_file_id) === false) { |
| 729 | 729 | $rows = DB::query( |
| 730 | 730 | 'SELECT id |
| 731 | - FROM ' . prefixTable('files') . ' |
|
| 731 | + FROM ' . prefixTable('files').' |
|
| 732 | 732 | WHERE id_item = %s', |
| 733 | 733 | $post_uploaded_file_id |
| 734 | 734 | ); |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | $lang->get('email_subject_item_updated'), |
| 785 | 785 | str_replace( |
| 786 | 786 | array('#label', '#link'), |
| 787 | - array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']), |
|
| 787 | + array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']), |
|
| 788 | 788 | $lang->get('new_item_email_body') |
| 789 | 789 | ), |
| 790 | 790 | $emailAddress, |
@@ -888,11 +888,11 @@ discard block |
||
| 888 | 888 | // Prepare variables |
| 889 | 889 | $itemInfos = array(); |
| 890 | 890 | $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; |
| 891 | - $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : ''; |
|
| 891 | + $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : ''; |
|
| 892 | 892 | $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : ''; |
| 893 | 893 | $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; |
| 894 | - $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : ''; |
|
| 895 | - $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : ''; |
|
| 894 | + $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : ''; |
|
| 895 | + $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : ''; |
|
| 896 | 896 | $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT); |
| 897 | 897 | $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT); |
| 898 | 898 | $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT); |
@@ -923,8 +923,7 @@ discard block |
||
| 923 | 923 | $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var( |
| 924 | 924 | $dataReceived['to_be_deleted_after_date'], |
| 925 | 925 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
| 926 | - ) : |
|
| 927 | - ''; |
|
| 926 | + ) : ''; |
|
| 928 | 927 | $post_fields = (filter_var_array( |
| 929 | 928 | $dataReceived['fields'], |
| 930 | 929 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
@@ -984,7 +983,7 @@ discard block |
||
| 984 | 983 | // About special settings |
| 985 | 984 | $dataFolderSettings = DB::queryFirstRow( |
| 986 | 985 | 'SELECT bloquer_creation, bloquer_modification, personal_folder, title |
| 987 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 986 | + FROM ' . prefixTable('nested_tree').' |
|
| 988 | 987 | WHERE id = %i', |
| 989 | 988 | $inputData['folderId'] |
| 990 | 989 | ); |
@@ -1000,7 +999,7 @@ discard block |
||
| 1000 | 999 | // Get folder complexity |
| 1001 | 1000 | $folderComplexity = DB::queryFirstRow( |
| 1002 | 1001 | 'SELECT valeur |
| 1003 | - FROM ' . prefixTable('misc') . ' |
|
| 1002 | + FROM ' . prefixTable('misc').' |
|
| 1004 | 1003 | WHERE type = %s AND intitule = %i', |
| 1005 | 1004 | 'complex', |
| 1006 | 1005 | $inputData['folderId'] |
@@ -1045,8 +1044,8 @@ discard block |
||
| 1045 | 1044 | // Get all informations for this item |
| 1046 | 1045 | $dataItem = DB::queryFirstRow( |
| 1047 | 1046 | 'SELECT * |
| 1048 | - FROM ' . prefixTable('items') . ' as i |
|
| 1049 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1047 | + FROM ' . prefixTable('items').' as i |
|
| 1048 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1050 | 1049 | WHERE i.id=%i AND l.action = %s', |
| 1051 | 1050 | $inputData['itemId'], |
| 1052 | 1051 | 'at_creation' |
@@ -1088,7 +1087,7 @@ discard block |
||
| 1088 | 1087 | // Does the user has the sharekey for this item? |
| 1089 | 1088 | DB::query( |
| 1090 | 1089 | 'SELECT * |
| 1091 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 1090 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 1092 | 1091 | WHERE object_id = %i AND user_id = %s', |
| 1093 | 1092 | $inputData['itemId'], |
| 1094 | 1093 | $session->get('user-id') |
@@ -1149,9 +1148,9 @@ discard block |
||
| 1149 | 1148 | 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, |
| 1150 | 1149 | i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification, |
| 1151 | 1150 | u.login as user_login, u.email as user_email |
| 1152 | - FROM ' . prefixTable('items') . ' as i |
|
| 1153 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item) |
|
| 1154 | - INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user) |
|
| 1151 | + FROM ' . prefixTable('items').' as i |
|
| 1152 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item) |
|
| 1153 | + INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user) |
|
| 1155 | 1154 | WHERE i.id=%i', |
| 1156 | 1155 | $inputData['itemId'] |
| 1157 | 1156 | ); |
@@ -1159,7 +1158,7 @@ discard block |
||
| 1159 | 1158 | // Should we log a password change? |
| 1160 | 1159 | $userKey = DB::queryFirstRow( |
| 1161 | 1160 | 'SELECT share_key |
| 1162 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 1161 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 1163 | 1162 | WHERE user_id = %i AND object_id = %i', |
| 1164 | 1163 | $session->get('user-id'), |
| 1165 | 1164 | $inputData['itemId'] |
@@ -1223,12 +1222,12 @@ discard block |
||
| 1223 | 1222 | (int) $post_folder_is_personal, |
| 1224 | 1223 | (int) $inputData['itemId'], |
| 1225 | 1224 | $encrypted_password_key, |
| 1226 | - true, // only for the item creator |
|
| 1227 | - true, // delete all |
|
| 1225 | + true, // only for the item creator |
|
| 1226 | + true, // delete all |
|
| 1228 | 1227 | ); |
| 1229 | 1228 | |
| 1230 | 1229 | // Create a task to create sharekeys for users |
| 1231 | - if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw); |
|
| 1230 | + if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw); |
|
| 1232 | 1231 | $tasksToBePerformed = ['item_password']; |
| 1233 | 1232 | $encryptionTaskIsRequested = true; |
| 1234 | 1233 | } else { |
@@ -1239,7 +1238,7 @@ discard block |
||
| 1239 | 1238 | // Get list of tags |
| 1240 | 1239 | $itemTags = DB::queryFirstColumn( |
| 1241 | 1240 | 'SELECT tag |
| 1242 | - FROM ' . prefixTable('tags') . ' |
|
| 1241 | + FROM ' . prefixTable('tags').' |
|
| 1243 | 1242 | WHERE item_id = %i', |
| 1244 | 1243 | $inputData['itemId'] |
| 1245 | 1244 | ); |
@@ -1285,7 +1284,7 @@ discard block |
||
| 1285 | 1284 | $session->get('user-id'), |
| 1286 | 1285 | 'at_modification', |
| 1287 | 1286 | $session->get('user-login'), |
| 1288 | - 'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags |
|
| 1287 | + 'at_tag : '.implode(' ', $itemTags).' => '.$post_tags |
|
| 1289 | 1288 | ); |
| 1290 | 1289 | } |
| 1291 | 1290 | |
@@ -1330,8 +1329,8 @@ discard block |
||
| 1330 | 1329 | 'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv, |
| 1331 | 1330 | i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, |
| 1332 | 1331 | c.masked AS masked, i.id AS field_item_id |
| 1333 | - FROM ' . prefixTable('categories_items') . ' AS i |
|
| 1334 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id) |
|
| 1332 | + FROM ' . prefixTable('categories_items').' AS i |
|
| 1333 | + INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id) |
|
| 1335 | 1334 | WHERE i.field_id = %i AND i.item_id = %i', |
| 1336 | 1335 | $field['id'], |
| 1337 | 1336 | $inputData['itemId'] |
@@ -1347,7 +1346,7 @@ discard block |
||
| 1347 | 1346 | // Perform new query |
| 1348 | 1347 | $dataTmpCat = DB::queryFirstRow( |
| 1349 | 1348 | 'SELECT id, title, encrypted_data, masked |
| 1350 | - FROM ' . prefixTable('categories') . ' |
|
| 1349 | + FROM ' . prefixTable('categories').' |
|
| 1351 | 1350 | WHERE id = %i', |
| 1352 | 1351 | $field['id'] |
| 1353 | 1352 | ); |
@@ -1377,8 +1376,8 @@ discard block |
||
| 1377 | 1376 | (int) $post_folder_is_personal, |
| 1378 | 1377 | (int) $newId, |
| 1379 | 1378 | $cryptedStuff['objectKey'], |
| 1380 | - true, // only for the item creator |
|
| 1381 | - true, // delete all |
|
| 1379 | + true, // only for the item creator |
|
| 1380 | + true, // delete all |
|
| 1382 | 1381 | ); |
| 1383 | 1382 | |
| 1384 | 1383 | // update value |
@@ -1428,7 +1427,7 @@ discard block |
||
| 1428 | 1427 | $session->get('user-id'), |
| 1429 | 1428 | 'at_modification', |
| 1430 | 1429 | $session->get('user-login'), |
| 1431 | - 'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value'] |
|
| 1430 | + 'at_field : '.$dataTmpCat['title'].' : '.$field['value'] |
|
| 1432 | 1431 | ); |
| 1433 | 1432 | } else { |
| 1434 | 1433 | // Case where the field already exists |
@@ -1437,7 +1436,7 @@ discard block |
||
| 1437 | 1436 | // Get user sharekey for this field |
| 1438 | 1437 | $userKey = DB::queryFirstRow( |
| 1439 | 1438 | 'SELECT share_key |
| 1440 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 1439 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 1441 | 1440 | WHERE user_id = %i AND object_id = %i', |
| 1442 | 1441 | $session->get('user-id'), |
| 1443 | 1442 | $dataTmpCat['field_item_id'] |
@@ -1476,8 +1475,8 @@ discard block |
||
| 1476 | 1475 | (int) $post_folder_is_personal, |
| 1477 | 1476 | (int) $dataTmpCat['field_item_id'], |
| 1478 | 1477 | $cryptedStuff['objectKey'], |
| 1479 | - true, // only for the item creator |
|
| 1480 | - true, // delete all |
|
| 1478 | + true, // only for the item creator |
|
| 1479 | + true, // delete all |
|
| 1481 | 1480 | ); |
| 1482 | 1481 | |
| 1483 | 1482 | if ($encryptedFieldIsChanged === false) { |
@@ -1519,7 +1518,7 @@ discard block |
||
| 1519 | 1518 | $session->get('user-id'), |
| 1520 | 1519 | 'at_modification', |
| 1521 | 1520 | $session->get('user-login'), |
| 1522 | - 'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal |
|
| 1521 | + 'at_field : '.$dataTmpCat['title'].' => '.$oldVal |
|
| 1523 | 1522 | ); |
| 1524 | 1523 | } |
| 1525 | 1524 | } |
@@ -1573,7 +1572,7 @@ discard block |
||
| 1573 | 1572 | ) { |
| 1574 | 1573 | DB::queryFirstRow( |
| 1575 | 1574 | 'SELECT * |
| 1576 | - FROM ' . prefixTable('templates') . ' |
|
| 1575 | + FROM ' . prefixTable('templates').' |
|
| 1577 | 1576 | WHERE item_id = %i', |
| 1578 | 1577 | $inputData['itemId'] |
| 1579 | 1578 | ); |
@@ -1616,7 +1615,7 @@ discard block |
||
| 1616 | 1615 | // check if elem exists in Table. If not add it or update it. |
| 1617 | 1616 | DB::query( |
| 1618 | 1617 | 'SELECT * |
| 1619 | - FROM ' . prefixTable('automatic_del') . ' |
|
| 1618 | + FROM ' . prefixTable('automatic_del').' |
|
| 1620 | 1619 | WHERE item_id = %i', |
| 1621 | 1620 | $inputData['itemId'] |
| 1622 | 1621 | ); |
@@ -1643,7 +1642,7 @@ discard block |
||
| 1643 | 1642 | // Store updates performed |
| 1644 | 1643 | array_push( |
| 1645 | 1644 | $arrayOfChanges, |
| 1646 | - $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled') |
|
| 1645 | + $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled') |
|
| 1647 | 1646 | ); |
| 1648 | 1647 | |
| 1649 | 1648 | // update LOG |
@@ -1686,7 +1685,7 @@ discard block |
||
| 1686 | 1685 | // Store updates performed |
| 1687 | 1686 | array_push( |
| 1688 | 1687 | $arrayOfChanges, |
| 1689 | - $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled') |
|
| 1688 | + $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled') |
|
| 1690 | 1689 | ); |
| 1691 | 1690 | |
| 1692 | 1691 | // update LOG |
@@ -1714,7 +1713,7 @@ discard block |
||
| 1714 | 1713 | if (empty($userId) === false) { |
| 1715 | 1714 | $dataTmp = DB::queryFirstRow( |
| 1716 | 1715 | 'SELECT id, name, lastname |
| 1717 | - FROM ' . prefixTable('users') . ' |
|
| 1716 | + FROM ' . prefixTable('users').' |
|
| 1718 | 1717 | WHERE id= %i', |
| 1719 | 1718 | $userId |
| 1720 | 1719 | ); |
@@ -1722,7 +1721,7 @@ discard block |
||
| 1722 | 1721 | // Add to array |
| 1723 | 1722 | array_push( |
| 1724 | 1723 | $arrayOfUsersRestriction, |
| 1725 | - $dataTmp['name'] . ' ' . $dataTmp['lastname'] |
|
| 1724 | + $dataTmp['name'].' '.$dataTmp['lastname'] |
|
| 1726 | 1725 | ); |
| 1727 | 1726 | array_push( |
| 1728 | 1727 | $arrayOfUsersIdRestriction, |
@@ -1753,8 +1752,8 @@ discard block |
||
| 1753 | 1752 | // get values before deleting them |
| 1754 | 1753 | $rows = DB::query( |
| 1755 | 1754 | 'SELECT t.title, t.id AS id |
| 1756 | - FROM ' . prefixTable('roles_title') . ' as t |
|
| 1757 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id) |
|
| 1755 | + FROM ' . prefixTable('roles_title').' as t |
|
| 1756 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id) |
|
| 1758 | 1757 | WHERE r.item_id = %i |
| 1759 | 1758 | ORDER BY t.title ASC', |
| 1760 | 1759 | $inputData['itemId'] |
@@ -1788,7 +1787,7 @@ discard block |
||
| 1788 | 1787 | ); |
| 1789 | 1788 | $dataTmp = DB::queryFirstRow( |
| 1790 | 1789 | 'SELECT title |
| 1791 | - FROM ' . prefixTable('roles_title') . ' |
|
| 1790 | + FROM ' . prefixTable('roles_title').' |
|
| 1792 | 1791 | WHERE id = %i', |
| 1793 | 1792 | $role |
| 1794 | 1793 | ); |
@@ -1816,7 +1815,7 @@ discard block |
||
| 1816 | 1815 | // Get current status |
| 1817 | 1816 | $otpStatus = DB::queryFirstRow( |
| 1818 | 1817 | 'SELECT enabled as otp_is_enabled, phone_number, secret |
| 1819 | - FROM ' . prefixTable('items_otp') . ' |
|
| 1818 | + FROM ' . prefixTable('items_otp').' |
|
| 1820 | 1819 | WHERE item_id = %i', |
| 1821 | 1820 | $inputData['itemId'] |
| 1822 | 1821 | ); |
@@ -1830,7 +1829,7 @@ discard block |
||
| 1830 | 1829 | 'decrypt' |
| 1831 | 1830 | )['string']; |
| 1832 | 1831 | } else { |
| 1833 | - $currentsecret=''; |
|
| 1832 | + $currentsecret = ''; |
|
| 1834 | 1833 | } |
| 1835 | 1834 | |
| 1836 | 1835 | // If OTP secret provided then encrypt it |
@@ -1880,7 +1879,7 @@ discard block |
||
| 1880 | 1879 | $session->get('user-id'), |
| 1881 | 1880 | 'at_modification', |
| 1882 | 1881 | $session->get('user-login'), |
| 1883 | - 'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled') |
|
| 1882 | + 'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled') |
|
| 1884 | 1883 | ); |
| 1885 | 1884 | } |
| 1886 | 1885 | if ($otpStatus['phone_number'] !== $post_otp_phone_number) { |
@@ -1891,7 +1890,7 @@ discard block |
||
| 1891 | 1890 | $session->get('user-id'), |
| 1892 | 1891 | 'at_modification', |
| 1893 | 1892 | $session->get('user-login'), |
| 1894 | - 'at_phone_number:' . $otpStatus['phone_number'] . ' => ' . $post_otp_phone_number |
|
| 1893 | + 'at_phone_number:'.$otpStatus['phone_number'].' => '.$post_otp_phone_number |
|
| 1895 | 1894 | ); |
| 1896 | 1895 | } |
| 1897 | 1896 | if ($currentsecret !== $post_otp_secret) { |
@@ -1940,8 +1939,8 @@ discard block |
||
| 1940 | 1939 | $session->get('user-id'), |
| 1941 | 1940 | 'at_modification', |
| 1942 | 1941 | $session->get('user-login'), |
| 1943 | - 'at_restriction : ' . (count($diffUsersRestiction) > 0 ? |
|
| 1944 | - implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '') |
|
| 1942 | + 'at_restriction : '.(count($diffUsersRestiction) > 0 ? |
|
| 1943 | + implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '') |
|
| 1945 | 1944 | ); |
| 1946 | 1945 | } |
| 1947 | 1946 | |
@@ -1961,7 +1960,7 @@ discard block |
||
| 1961 | 1960 | $session->get('user-id'), |
| 1962 | 1961 | 'at_modification', |
| 1963 | 1962 | $session->get('user-login'), |
| 1964 | - 'at_label : ' . $data['label'] . ' => ' . $inputData['label'] |
|
| 1963 | + 'at_label : '.$data['label'].' => '.$inputData['label'] |
|
| 1965 | 1964 | ); |
| 1966 | 1965 | } |
| 1967 | 1966 | // LOGIN |
@@ -1980,7 +1979,7 @@ discard block |
||
| 1980 | 1979 | $session->get('user-id'), |
| 1981 | 1980 | 'at_modification', |
| 1982 | 1981 | $session->get('user-login'), |
| 1983 | - 'at_login : ' . $data['login'] . ' => ' . $post_login |
|
| 1982 | + 'at_login : '.$data['login'].' => '.$post_login |
|
| 1984 | 1983 | ); |
| 1985 | 1984 | } |
| 1986 | 1985 | |
@@ -1999,7 +1998,7 @@ discard block |
||
| 1999 | 1998 | $session->get('user-id'), |
| 2000 | 1999 | 'at_modification', |
| 2001 | 2000 | $session->get('user-login'), |
| 2002 | - 'at_email : ' . $data['email'] . ' => ' . $post_email |
|
| 2001 | + 'at_email : '.$data['email'].' => '.$post_email |
|
| 2003 | 2002 | ); |
| 2004 | 2003 | } |
| 2005 | 2004 | // URL |
@@ -2018,7 +2017,7 @@ discard block |
||
| 2018 | 2017 | $session->get('user-id'), |
| 2019 | 2018 | 'at_modification', |
| 2020 | 2019 | $session->get('user-login'), |
| 2021 | - 'at_url : ' . $data['url'] . ' => ' . $post_url |
|
| 2020 | + 'at_url : '.$data['url'].' => '.$post_url |
|
| 2022 | 2021 | ); |
| 2023 | 2022 | } |
| 2024 | 2023 | // DESCRIPTION |
@@ -2044,7 +2043,7 @@ discard block |
||
| 2044 | 2043 | // FOLDER |
| 2045 | 2044 | if ((int) $data['id_tree'] !== (int) $inputData['folderId']) { |
| 2046 | 2045 | // Get name of folders |
| 2047 | - $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId'])); |
|
| 2046 | + $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId'])); |
|
| 2048 | 2047 | |
| 2049 | 2048 | // Store updates performed |
| 2050 | 2049 | array_push( |
@@ -2060,7 +2059,7 @@ discard block |
||
| 2060 | 2059 | $session->get('user-id'), |
| 2061 | 2060 | 'at_modification', |
| 2062 | 2061 | $session->get('user-login'), |
| 2063 | - 'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title'] |
|
| 2062 | + 'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title'] |
|
| 2064 | 2063 | ); |
| 2065 | 2064 | } |
| 2066 | 2065 | // ANYONE_CAN_MODIFY |
@@ -2068,7 +2067,7 @@ discard block |
||
| 2068 | 2067 | // Store updates performed |
| 2069 | 2068 | array_push( |
| 2070 | 2069 | $arrayOfChanges, |
| 2071 | - $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled')) |
|
| 2070 | + $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled')) |
|
| 2072 | 2071 | ); |
| 2073 | 2072 | |
| 2074 | 2073 | // Log |
@@ -2079,15 +2078,15 @@ discard block |
||
| 2079 | 2078 | $session->get('user-id'), |
| 2080 | 2079 | 'at_modification', |
| 2081 | 2080 | $session->get('user-login'), |
| 2082 | - 'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled') |
|
| 2081 | + 'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled') |
|
| 2083 | 2082 | ); |
| 2084 | 2083 | } |
| 2085 | 2084 | |
| 2086 | 2085 | // Reload new values |
| 2087 | 2086 | $dataItem = DB::queryFirstRow( |
| 2088 | 2087 | 'SELECT * |
| 2089 | - FROM ' . prefixTable('items') . ' as i |
|
| 2090 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 2088 | + FROM ' . prefixTable('items').' as i |
|
| 2089 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 2091 | 2090 | WHERE i.id = %i AND l.action = %s', |
| 2092 | 2091 | $inputData['itemId'], |
| 2093 | 2092 | 'at_creation' |
@@ -2096,8 +2095,8 @@ discard block |
||
| 2096 | 2095 | $history = ''; |
| 2097 | 2096 | $rows = DB::query( |
| 2098 | 2097 | 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login |
| 2099 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 2100 | - LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 2098 | + FROM ' . prefixTable('log_items').' as l |
|
| 2099 | + LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 2101 | 2100 | WHERE l.action <> %s AND id_item=%s', |
| 2102 | 2101 | 'at_shown', |
| 2103 | 2102 | $inputData['itemId'] |
@@ -2106,14 +2105,14 @@ discard block |
||
| 2106 | 2105 | if ($record['raison'] === NULL) continue; |
| 2107 | 2106 | $reason = explode(':', $record['raison']); |
| 2108 | 2107 | if (count($reason) > 0) { |
| 2109 | - $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' |
|
| 2110 | - . $record['login'] . ' - ' . $lang->get($record['action']) . ' - ' |
|
| 2111 | - . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1] |
|
| 2108 | + $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - ' |
|
| 2109 | + . $record['login'].' - '.$lang->get($record['action']).' - ' |
|
| 2110 | + . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1] |
|
| 2112 | 2111 | : $lang->get(trim($reason[0]))) : ''); |
| 2113 | 2112 | if (empty($history)) { |
| 2114 | 2113 | $history = $sentence; |
| 2115 | 2114 | } else { |
| 2116 | - $history .= '<br />' . $sentence; |
|
| 2115 | + $history .= '<br />'.$sentence; |
|
| 2117 | 2116 | } |
| 2118 | 2117 | } |
| 2119 | 2118 | } |
@@ -2251,7 +2250,7 @@ discard block |
||
| 2251 | 2250 | ) { |
| 2252 | 2251 | // load the original record into an array |
| 2253 | 2252 | $originalRecord = DB::queryFirstRow( |
| 2254 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 2253 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 2255 | 2254 | WHERE id = %i', |
| 2256 | 2255 | $inputData['itemId'] |
| 2257 | 2256 | ); |
@@ -2270,7 +2269,7 @@ discard block |
||
| 2270 | 2269 | |
| 2271 | 2270 | // Load the destination folder record into an array |
| 2272 | 2271 | $dataDestination = DB::queryFirstRow( |
| 2273 | - 'SELECT personal_folder FROM ' . prefixTable('nested_tree') . ' |
|
| 2272 | + 'SELECT personal_folder FROM '.prefixTable('nested_tree').' |
|
| 2274 | 2273 | WHERE id = %i', |
| 2275 | 2274 | $post_dest_id |
| 2276 | 2275 | ); |
@@ -2278,7 +2277,7 @@ discard block |
||
| 2278 | 2277 | // Get the ITEM object key for the user |
| 2279 | 2278 | $userKey = DB::queryFirstRow( |
| 2280 | 2279 | 'SELECT share_key |
| 2281 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2280 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2282 | 2281 | WHERE user_id = %i AND object_id = %i', |
| 2283 | 2282 | $session->get('user-id'), |
| 2284 | 2283 | $inputData['itemId'] |
@@ -2355,8 +2354,8 @@ discard block |
||
| 2355 | 2354 | // Manage Custom Fields |
| 2356 | 2355 | $rows = DB::query( |
| 2357 | 2356 | 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data |
| 2358 | - FROM ' . prefixTable('categories_items') . ' AS ci |
|
| 2359 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id) |
|
| 2357 | + FROM ' . prefixTable('categories_items').' AS ci |
|
| 2358 | + INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id) |
|
| 2360 | 2359 | WHERE ci.item_id = %i', |
| 2361 | 2360 | $inputData['itemId'] |
| 2362 | 2361 | ); |
@@ -2368,7 +2367,7 @@ discard block |
||
| 2368 | 2367 | // Get user key |
| 2369 | 2368 | $userKey = DB::queryFirstRow( |
| 2370 | 2369 | 'SELECT share_key |
| 2371 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 2370 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 2372 | 2371 | WHERE user_id = %i AND object_id = %i', |
| 2373 | 2372 | $session->get('user-id'), |
| 2374 | 2373 | $field['id'] |
@@ -2435,15 +2434,15 @@ discard block |
||
| 2435 | 2434 | $rows = DB::query( |
| 2436 | 2435 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension, |
| 2437 | 2436 | f.size AS size, f.type AS type, s.share_key AS share_key |
| 2438 | - FROM ' . prefixTable('files') . ' AS f |
|
| 2439 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
| 2437 | + FROM ' . prefixTable('files').' AS f |
|
| 2438 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
| 2440 | 2439 | WHERE s.user_id = %i AND f.id_item = %i', |
| 2441 | 2440 | $session->get('user-id'), |
| 2442 | 2441 | $inputData['itemId'] |
| 2443 | 2442 | ); |
| 2444 | 2443 | foreach ($rows as $record) { |
| 2445 | 2444 | // Check if file still exists |
| 2446 | - if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) { |
|
| 2445 | + if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) { |
|
| 2447 | 2446 | // Step1 - decrypt the file |
| 2448 | 2447 | // deepcode ignore PT: path is sanitized inside decryptFile() |
| 2449 | 2448 | $fileContent = decryptFile( |
@@ -2454,8 +2453,8 @@ discard block |
||
| 2454 | 2453 | |
| 2455 | 2454 | // Step2 - create file |
| 2456 | 2455 | // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database |
| 2457 | - $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension']; |
|
| 2458 | - $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab'); |
|
| 2456 | + $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension']; |
|
| 2457 | + $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab'); |
|
| 2459 | 2458 | if ($outstream === false) { |
| 2460 | 2459 | echo prepareExchangedData( |
| 2461 | 2460 | array( |
@@ -2528,7 +2527,7 @@ discard block |
||
| 2528 | 2527 | |
| 2529 | 2528 | // ------------------------- |
| 2530 | 2529 | // Add specific restrictions |
| 2531 | - $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']); |
|
| 2530 | + $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']); |
|
| 2532 | 2531 | foreach ($rows as $record) { |
| 2533 | 2532 | DB::insert( |
| 2534 | 2533 | prefixTable('restriction_to_roles'), |
@@ -2540,7 +2539,7 @@ discard block |
||
| 2540 | 2539 | } |
| 2541 | 2540 | |
| 2542 | 2541 | // Add Tags |
| 2543 | - $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']); |
|
| 2542 | + $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']); |
|
| 2544 | 2543 | foreach ($rows as $record) { |
| 2545 | 2544 | DB::insert( |
| 2546 | 2545 | prefixTable('tags'), |
@@ -2642,7 +2641,7 @@ discard block |
||
| 2642 | 2641 | // then we can show it |
| 2643 | 2642 | $item_deleted = DB::queryFirstRow( |
| 2644 | 2643 | 'SELECT * |
| 2645 | - FROM ' . prefixTable('log_items') . ' |
|
| 2644 | + FROM ' . prefixTable('log_items').' |
|
| 2646 | 2645 | WHERE id_item = %i AND action = %s |
| 2647 | 2646 | ORDER BY date DESC |
| 2648 | 2647 | LIMIT 0, 1', |
@@ -2653,7 +2652,7 @@ discard block |
||
| 2653 | 2652 | |
| 2654 | 2653 | $item_restored = DB::queryFirstRow( |
| 2655 | 2654 | 'SELECT * |
| 2656 | - FROM ' . prefixTable('log_items') . ' |
|
| 2655 | + FROM ' . prefixTable('log_items').' |
|
| 2657 | 2656 | WHERE id_item = %i AND action = %s |
| 2658 | 2657 | ORDER BY date DESC |
| 2659 | 2658 | LIMIT 0, 1', |
@@ -2677,8 +2676,8 @@ discard block |
||
| 2677 | 2676 | // Get all informations for this item |
| 2678 | 2677 | $dataItem = DB::queryFirstRow( |
| 2679 | 2678 | 'SELECT * |
| 2680 | - FROM ' . prefixTable('items') . ' as i |
|
| 2681 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 2679 | + FROM ' . prefixTable('items').' as i |
|
| 2680 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 2682 | 2681 | WHERE i.id = %i AND l.action = %s', |
| 2683 | 2682 | $inputData['id'], |
| 2684 | 2683 | 'at_creation' |
@@ -2687,7 +2686,7 @@ discard block |
||
| 2687 | 2686 | // Notification |
| 2688 | 2687 | DB::queryFirstRow( |
| 2689 | 2688 | 'SELECT * |
| 2690 | - FROM ' . prefixTable('notification') . ' |
|
| 2689 | + FROM ' . prefixTable('notification').' |
|
| 2691 | 2690 | WHERE item_id = %i AND user_id = %i', |
| 2692 | 2691 | $inputData['id'], |
| 2693 | 2692 | $session->get('user-id') |
@@ -2706,7 +2705,7 @@ discard block |
||
| 2706 | 2705 | |
| 2707 | 2706 | // manage case of API user |
| 2708 | 2707 | if ($dataItem['id_user'] === API_USER_ID) { |
| 2709 | - $arrData['author'] = 'API [' . $dataItem['description'] . ']'; |
|
| 2708 | + $arrData['author'] = 'API ['.$dataItem['description'].']'; |
|
| 2710 | 2709 | $arrData['id_user'] = API_USER_ID; |
| 2711 | 2710 | $arrData['author_email'] = ''; |
| 2712 | 2711 | $arrData['notification_status'] = false; |
@@ -2716,7 +2715,7 @@ discard block |
||
| 2716 | 2715 | $tags = array(); |
| 2717 | 2716 | $rows = DB::query( |
| 2718 | 2717 | 'SELECT tag |
| 2719 | - FROM ' . prefixTable('tags') . ' |
|
| 2718 | + FROM ' . prefixTable('tags').' |
|
| 2720 | 2719 | WHERE item_id = %i', |
| 2721 | 2720 | $inputData['id'] |
| 2722 | 2721 | ); |
@@ -2740,7 +2739,7 @@ discard block |
||
| 2740 | 2739 | // Check if user has a role that is accepted |
| 2741 | 2740 | $rows_tmp = DB::query( |
| 2742 | 2741 | 'SELECT role_id |
| 2743 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 2742 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 2744 | 2743 | WHERE item_id=%i', |
| 2745 | 2744 | $inputData['id'] |
| 2746 | 2745 | ); |
@@ -2754,7 +2753,7 @@ discard block |
||
| 2754 | 2753 | // Get the object key for the user |
| 2755 | 2754 | $userKeys = DB::query( |
| 2756 | 2755 | 'SELECT share_key |
| 2757 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 2756 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 2758 | 2757 | WHERE user_id = %i AND object_id = %i', |
| 2759 | 2758 | $session->get('user-id'), |
| 2760 | 2759 | $inputData['id'] |
@@ -2867,8 +2866,8 @@ discard block |
||
| 2867 | 2866 | // Add restriction if item is restricted to roles |
| 2868 | 2867 | $rows = DB::query( |
| 2869 | 2868 | 'SELECT t.title, t.id |
| 2870 | - FROM ' . prefixTable('roles_title') . ' AS t |
|
| 2871 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id) |
|
| 2869 | + FROM ' . prefixTable('roles_title').' AS t |
|
| 2870 | + INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id) |
|
| 2872 | 2871 | WHERE r.item_id = %i |
| 2873 | 2872 | ORDER BY t.title ASC', |
| 2874 | 2873 | $inputData['id'] |
@@ -2884,8 +2883,8 @@ discard block |
||
| 2884 | 2883 | $tmp = array(); |
| 2885 | 2884 | $rows = DB::query( |
| 2886 | 2885 | 'SELECT k.label, k.id |
| 2887 | - FROM ' . prefixTable('kb_items') . ' as i |
|
| 2888 | - INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id) |
|
| 2886 | + FROM ' . prefixTable('kb_items').' as i |
|
| 2887 | + INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id) |
|
| 2889 | 2888 | WHERE i.item_id = %i |
| 2890 | 2889 | ORDER BY k.label ASC', |
| 2891 | 2890 | $inputData['id'] |
@@ -2968,7 +2967,7 @@ discard block |
||
| 2968 | 2967 | $arrCatList = array(); |
| 2969 | 2968 | $rows_tmp = DB::query( |
| 2970 | 2969 | 'SELECT id_category |
| 2971 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2970 | + FROM ' . prefixTable('categories_folders').' |
|
| 2972 | 2971 | WHERE id_folder=%i', |
| 2973 | 2972 | $inputData['folderId'] |
| 2974 | 2973 | ); |
@@ -2983,8 +2982,8 @@ discard block |
||
| 2983 | 2982 | 'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id, |
| 2984 | 2983 | i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id, |
| 2985 | 2984 | c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility |
| 2986 | - FROM ' . prefixTable('categories_items') . ' AS i |
|
| 2987 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id) |
|
| 2985 | + FROM ' . prefixTable('categories_items').' AS i |
|
| 2986 | + INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id) |
|
| 2988 | 2987 | WHERE i.item_id=%i AND c.parent_id IN %ls', |
| 2989 | 2988 | $inputData['id'], |
| 2990 | 2989 | $arrCatList |
@@ -2995,7 +2994,7 @@ discard block |
||
| 2995 | 2994 | //db::debugmode(true); |
| 2996 | 2995 | $userKey = DB::queryFirstRow( |
| 2997 | 2996 | 'SELECT share_key |
| 2998 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 2997 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 2999 | 2998 | WHERE user_id = %i AND object_id = %i', |
| 3000 | 2999 | $session->get('user-id'), |
| 3001 | 3000 | $row['id'] |
@@ -3013,7 +3012,7 @@ discard block |
||
| 3013 | 3012 | } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) { |
| 3014 | 3013 | // Data is not encrypted in DB |
| 3015 | 3014 | $fieldText = [ |
| 3016 | - 'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : |
|
| 3015 | + 'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : |
|
| 3017 | 3016 | 'encrypted' => false, |
| 3018 | 3017 | 'error' => false, |
| 3019 | 3018 | ]; |
@@ -3058,7 +3057,7 @@ discard block |
||
| 3058 | 3057 | if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) { |
| 3059 | 3058 | $rows_tmp = DB::queryFirstRow( |
| 3060 | 3059 | 'SELECT category_id |
| 3061 | - FROM ' . prefixTable('templates') . ' |
|
| 3060 | + FROM ' . prefixTable('templates').' |
|
| 3062 | 3061 | WHERE item_id = %i', |
| 3063 | 3062 | $inputData['id'] |
| 3064 | 3063 | ); |
@@ -3075,7 +3074,7 @@ discard block |
||
| 3075 | 3074 | // Evaluate if item is ready for all users |
| 3076 | 3075 | $rows_tmp = DB::queryFirstRow( |
| 3077 | 3076 | 'SELECT finished_at |
| 3078 | - FROM ' . prefixTable('background_tasks') . ' |
|
| 3077 | + FROM ' . prefixTable('background_tasks').' |
|
| 3079 | 3078 | WHERE item_id = %i', |
| 3080 | 3079 | $inputData['id'] |
| 3081 | 3080 | ); |
@@ -3092,7 +3091,7 @@ discard block |
||
| 3092 | 3091 | // Is the Item to be deleted? |
| 3093 | 3092 | $dataDelete = DB::queryFirstRow( |
| 3094 | 3093 | 'SELECT * |
| 3095 | - FROM ' . prefixTable('automatic_del') . ' |
|
| 3094 | + FROM ' . prefixTable('automatic_del').' |
|
| 3096 | 3095 | WHERE item_id = %i', |
| 3097 | 3096 | $inputData['id'] |
| 3098 | 3097 | ); |
@@ -3173,14 +3172,14 @@ discard block |
||
| 3173 | 3172 | if (empty($userRest) === false) { |
| 3174 | 3173 | $dataTmp = DB::queryFirstRow( |
| 3175 | 3174 | 'SELECT login |
| 3176 | - FROM ' . prefixTable('users') . ' |
|
| 3175 | + FROM ' . prefixTable('users').' |
|
| 3177 | 3176 | WHERE id= %i', |
| 3178 | 3177 | $userRest |
| 3179 | 3178 | ); |
| 3180 | 3179 | if (empty($listOfRestricted)) { |
| 3181 | 3180 | $listOfRestricted = $dataTmp['login']; |
| 3182 | 3181 | } else { |
| 3183 | - $listOfRestricted .= ';' . $dataTmp['login']; |
|
| 3182 | + $listOfRestricted .= ';'.$dataTmp['login']; |
|
| 3184 | 3183 | } |
| 3185 | 3184 | } |
| 3186 | 3185 | } |
@@ -3254,9 +3253,9 @@ discard block |
||
| 3254 | 3253 | // Load item data |
| 3255 | 3254 | $dataItem = DB::queryFirstRow( |
| 3256 | 3255 | 'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret |
| 3257 | - FROM ' . prefixTable('items') . ' AS i |
|
| 3258 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
| 3259 | - LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id) |
|
| 3256 | + FROM ' . prefixTable('items').' AS i |
|
| 3257 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
| 3258 | + LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id) |
|
| 3260 | 3259 | WHERE i.id = %i', |
| 3261 | 3260 | $inputData['id'] |
| 3262 | 3261 | ); |
@@ -3278,7 +3277,7 @@ discard block |
||
| 3278 | 3277 | // Check if user has a role that is accepted |
| 3279 | 3278 | $rows_tmp = DB::query( |
| 3280 | 3279 | 'SELECT role_id |
| 3281 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 3280 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 3282 | 3281 | WHERE item_id=%i', |
| 3283 | 3282 | $inputData['id'] |
| 3284 | 3283 | ); |
@@ -3310,12 +3309,12 @@ discard block |
||
| 3310 | 3309 | // launch query |
| 3311 | 3310 | $rows = DB::query( |
| 3312 | 3311 | 'SELECT id, name, file, extension, size |
| 3313 | - FROM ' . prefixTable('files') . ' |
|
| 3312 | + FROM ' . prefixTable('files').' |
|
| 3314 | 3313 | WHERE id_item = %i AND confirmed = 1', |
| 3315 | 3314 | $inputData['id'] |
| 3316 | 3315 | ); |
| 3317 | 3316 | foreach ($rows as $record) { |
| 3318 | - $filename = basename($record['name'], '.' . $record['extension']); |
|
| 3317 | + $filename = basename($record['name'], '.'.$record['extension']); |
|
| 3319 | 3318 | $filename = isBase64($filename) === true ? base64_decode($filename) : $filename; |
| 3320 | 3319 | |
| 3321 | 3320 | array_push( |
@@ -3328,7 +3327,7 @@ discard block |
||
| 3328 | 3327 | 'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0, |
| 3329 | 3328 | 'id' => $record['id'], |
| 3330 | 3329 | 'key' => $session->get('user-key_tmp'), |
| 3331 | - 'internalFilename' => basename($record['name'], '.' . $record['extension']), |
|
| 3330 | + 'internalFilename' => basename($record['name'], '.'.$record['extension']), |
|
| 3332 | 3331 | ) |
| 3333 | 3332 | ); |
| 3334 | 3333 | } |
@@ -3366,7 +3365,7 @@ discard block |
||
| 3366 | 3365 | array( |
| 3367 | 3366 | 'latest_items' => implode(';', $session->get('user-latest_items')), |
| 3368 | 3367 | ), |
| 3369 | - 'id=' . $session->get('user-id') |
|
| 3368 | + 'id='.$session->get('user-id') |
|
| 3370 | 3369 | ); |
| 3371 | 3370 | } |
| 3372 | 3371 | |
@@ -3375,8 +3374,8 @@ discard block |
||
| 3375 | 3374 | $listOptionsForRoles = array(); |
| 3376 | 3375 | $rows = DB::query( |
| 3377 | 3376 | 'SELECT r.role_id AS role_id, t.title AS title |
| 3378 | - FROM ' . prefixTable('roles_values') . ' AS r |
|
| 3379 | - INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id) |
|
| 3377 | + FROM ' . prefixTable('roles_values').' AS r |
|
| 3378 | + INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id) |
|
| 3380 | 3379 | WHERE r.folder_id = %i', |
| 3381 | 3380 | $dataItem['id_tree'] |
| 3382 | 3381 | ); |
@@ -3390,9 +3389,9 @@ discard block |
||
| 3390 | 3389 | ); |
| 3391 | 3390 | $rows2 = DB::query( |
| 3392 | 3391 | 'SELECT id, login, fonction_id, email, name, lastname |
| 3393 | - FROM ' . prefixTable('users') . ' |
|
| 3392 | + FROM ' . prefixTable('users').' |
|
| 3394 | 3393 | WHERE fonction_id LIKE %s', |
| 3395 | - '%' . $record['role_id'] . '%' |
|
| 3394 | + '%'.$record['role_id'].'%' |
|
| 3396 | 3395 | ); |
| 3397 | 3396 | foreach ($rows2 as $record2) { |
| 3398 | 3397 | foreach (explode(';', $record2['fonction_id']) as $role) { |
@@ -3405,7 +3404,7 @@ discard block |
||
| 3405 | 3404 | array( |
| 3406 | 3405 | 'id' => (int) $record2['id'], |
| 3407 | 3406 | 'login' => $record2['login'], |
| 3408 | - 'name' => $record2['name'] . ' ' . $record2['lastname'], |
|
| 3407 | + 'name' => $record2['name'].' '.$record2['lastname'], |
|
| 3409 | 3408 | 'email' => $record2['email'], |
| 3410 | 3409 | ) |
| 3411 | 3410 | ); |
@@ -3424,16 +3423,16 @@ discard block |
||
| 3424 | 3423 | $path = ''; |
| 3425 | 3424 | foreach ($arbo as $elem) { |
| 3426 | 3425 | if (empty($path) === true) { |
| 3427 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 3426 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 3428 | 3427 | } else { |
| 3429 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 3428 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 3430 | 3429 | } |
| 3431 | 3430 | } |
| 3432 | 3431 | // Build text to show user |
| 3433 | 3432 | if (empty($path) === true) { |
| 3434 | 3433 | $path = addslashes($dataItem['label']); |
| 3435 | 3434 | } else { |
| 3436 | - $path = addslashes($dataItem['label']) . ' (' . $path . ')'; |
|
| 3435 | + $path = addslashes($dataItem['label']).' ('.$path.')'; |
|
| 3437 | 3436 | } |
| 3438 | 3437 | |
| 3439 | 3438 | // Add Admins to notification list if expected |
@@ -3456,7 +3455,7 @@ discard block |
||
| 3456 | 3455 | array( |
| 3457 | 3456 | addslashes($session->get('user-login')), |
| 3458 | 3457 | $path, |
| 3459 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'], |
|
| 3458 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'], |
|
| 3460 | 3459 | ), |
| 3461 | 3460 | $lang->get('email_on_open_notification_mail') |
| 3462 | 3461 | ), |
@@ -3466,7 +3465,7 @@ discard block |
||
| 3466 | 3465 | } |
| 3467 | 3466 | |
| 3468 | 3467 | // has this item a change proposal |
| 3469 | - DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']); |
|
| 3468 | + DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']); |
|
| 3470 | 3469 | $returnArray['has_change_proposal'] = DB::count(); |
| 3471 | 3470 | |
| 3472 | 3471 | // Setting |
@@ -3477,7 +3476,7 @@ discard block |
||
| 3477 | 3476 | if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) { |
| 3478 | 3477 | DB::query( |
| 3479 | 3478 | 'SELECT * |
| 3480 | - FROM ' . prefixTable('otv') . ' |
|
| 3479 | + FROM ' . prefixTable('otv').' |
|
| 3481 | 3480 | WHERE item_id = %i |
| 3482 | 3481 | AND time_limit > %i', |
| 3483 | 3482 | $inputData['id'], |
@@ -3576,7 +3575,7 @@ discard block |
||
| 3576 | 3575 | // Load item data |
| 3577 | 3576 | $data = DB::queryFirstRow( |
| 3578 | 3577 | 'SELECT id_tree, id, label |
| 3579 | - FROM ' . prefixTable('items') . ' |
|
| 3578 | + FROM ' . prefixTable('items').' |
|
| 3580 | 3579 | WHERE id = %i OR item_key = %s', |
| 3581 | 3580 | $inputData['itemId'], |
| 3582 | 3581 | $inputData['itemKey'] |
@@ -3667,7 +3666,7 @@ discard block |
||
| 3667 | 3666 | // Load item data |
| 3668 | 3667 | $dataItem = DB::queryFirstRow( |
| 3669 | 3668 | 'SELECT secret, enabled |
| 3670 | - FROM ' . prefixTable('items_otp') . ' |
|
| 3669 | + FROM ' . prefixTable('items_otp').' |
|
| 3671 | 3670 | WHERE item_id = %i', |
| 3672 | 3671 | $inputData['id'] |
| 3673 | 3672 | ); |
@@ -3749,13 +3748,13 @@ discard block |
||
| 3749 | 3748 | |
| 3750 | 3749 | // Check if user is allowed to access this folder |
| 3751 | 3750 | if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) { |
| 3752 | - echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]'; |
|
| 3751 | + echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]'; |
|
| 3753 | 3752 | break; |
| 3754 | 3753 | } |
| 3755 | 3754 | |
| 3756 | 3755 | // Check if title doesn't contains html codes |
| 3757 | 3756 | if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) { |
| 3758 | - echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]'; |
|
| 3757 | + echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]'; |
|
| 3759 | 3758 | break; |
| 3760 | 3759 | } |
| 3761 | 3760 | // check that title is not numeric |
@@ -3766,9 +3765,9 @@ discard block |
||
| 3766 | 3765 | |
| 3767 | 3766 | // Check if duplicate folders name are allowed |
| 3768 | 3767 | if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') { |
| 3769 | - $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title); |
|
| 3768 | + $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title); |
|
| 3770 | 3769 | if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) { |
| 3771 | - echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]'; |
|
| 3770 | + echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]'; |
|
| 3772 | 3771 | break; |
| 3773 | 3772 | } |
| 3774 | 3773 | } |
@@ -3776,7 +3775,7 @@ discard block |
||
| 3776 | 3775 | // query on folder |
| 3777 | 3776 | $data = DB::queryFirstRow( |
| 3778 | 3777 | 'SELECT parent_id, personal_folder |
| 3779 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 3778 | + FROM ' . prefixTable('nested_tree').' |
|
| 3780 | 3779 | WHERE id = %i', |
| 3781 | 3780 | $inputData['folderId'] |
| 3782 | 3781 | ); |
@@ -3786,20 +3785,20 @@ discard block |
||
| 3786 | 3785 | if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') { |
| 3787 | 3786 | $data = DB::queryFirstRow( |
| 3788 | 3787 | 'SELECT valeur |
| 3789 | - FROM ' . prefixTable('misc') . ' |
|
| 3788 | + FROM ' . prefixTable('misc').' |
|
| 3790 | 3789 | WHERE intitule = %i AND type = %s', |
| 3791 | 3790 | $data['parent_id'], |
| 3792 | 3791 | 'complex' |
| 3793 | 3792 | ); |
| 3794 | 3793 | if (intval($dataReceived['complexity']) < intval($data['valeur'])) { |
| 3795 | - echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]'; |
|
| 3794 | + echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]'; |
|
| 3796 | 3795 | break; |
| 3797 | 3796 | } |
| 3798 | 3797 | } |
| 3799 | 3798 | |
| 3800 | 3799 | // update Folders table |
| 3801 | 3800 | $tmp = DB::queryFirstRow( |
| 3802 | - 'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 3801 | + 'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 3803 | 3802 | $dataReceived['folder'] |
| 3804 | 3803 | ); |
| 3805 | 3804 | if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) { |
@@ -3913,7 +3912,7 @@ discard block |
||
| 3913 | 3912 | $uniqueLoadData['path'] = $arr_arbo; |
| 3914 | 3913 | |
| 3915 | 3914 | // store last folder accessed in cookie |
| 3916 | - $arr_cookie_options = array ( |
|
| 3915 | + $arr_cookie_options = array( |
|
| 3917 | 3916 | 'expires' => time() + TP_ONE_DAY_SECONDS * 5, |
| 3918 | 3917 | 'path' => '/', |
| 3919 | 3918 | 'secure' => true, |
@@ -3928,7 +3927,7 @@ discard block |
||
| 3928 | 3927 | foreach ($session->get('user-roles_array') as $role) { |
| 3929 | 3928 | $roleQ = DB::queryFirstRow( |
| 3930 | 3929 | 'SELECT allow_pw_change |
| 3931 | - FROM ' . prefixTable('roles_title') . ' |
|
| 3930 | + FROM ' . prefixTable('roles_title').' |
|
| 3932 | 3931 | WHERE id = %i', |
| 3933 | 3932 | $role |
| 3934 | 3933 | ); |
@@ -3959,11 +3958,11 @@ discard block |
||
| 3959 | 3958 | |
| 3960 | 3959 | foreach ($session->get('user-roles_array') as $role) { |
| 3961 | 3960 | $access = DB::queryFirstRow( |
| 3962 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
| 3961 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
| 3963 | 3962 | $role, |
| 3964 | 3963 | $inputData['id'] |
| 3965 | 3964 | ); |
| 3966 | - if (DB::count()>0) { |
|
| 3965 | + if (DB::count() > 0) { |
|
| 3967 | 3966 | if ($access['type'] === 'R') { |
| 3968 | 3967 | array_push($arrTmp, 10); |
| 3969 | 3968 | } elseif ($access['type'] === 'W') { |
@@ -4028,7 +4027,7 @@ discard block |
||
| 4028 | 4027 | } else { |
| 4029 | 4028 | DB::query( |
| 4030 | 4029 | 'SELECT * |
| 4031 | - FROM ' . prefixTable('items') . ' |
|
| 4030 | + FROM ' . prefixTable('items').' |
|
| 4032 | 4031 | WHERE inactif = %i', |
| 4033 | 4032 | 0 |
| 4034 | 4033 | ); |
@@ -4038,7 +4037,7 @@ discard block |
||
| 4038 | 4037 | |
| 4039 | 4038 | // Get folder complexity |
| 4040 | 4039 | $folderComplexity = DB::queryFirstRow( |
| 4041 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i', |
|
| 4040 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i', |
|
| 4042 | 4041 | 'complex', |
| 4043 | 4042 | $inputData['id'] |
| 4044 | 4043 | ); |
@@ -4050,7 +4049,7 @@ discard block |
||
| 4050 | 4049 | if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) { |
| 4051 | 4050 | $folderRow = DB::query( |
| 4052 | 4051 | 'SELECT id_category |
| 4053 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 4052 | + FROM ' . prefixTable('categories_folders').' |
|
| 4054 | 4053 | WHERE id_folder = %i', |
| 4055 | 4054 | $inputData['id'] |
| 4056 | 4055 | ); |
@@ -4106,8 +4105,8 @@ discard block |
||
| 4106 | 4105 | $where->add('i.inactif=%i', 0); |
| 4107 | 4106 | $where->add('i.deleted_at IS NULL'); |
| 4108 | 4107 | |
| 4109 | - $query_limit = ' LIMIT ' . |
|
| 4110 | - $start . ',' . |
|
| 4108 | + $query_limit = ' LIMIT '. |
|
| 4109 | + $start.','. |
|
| 4111 | 4110 | $post_nb_items_to_display_once; |
| 4112 | 4111 | |
| 4113 | 4112 | $rows = DB::query( |
@@ -4115,8 +4114,8 @@ discard block |
||
| 4115 | 4114 | i.label, i.description, i.pw, i.login, |
| 4116 | 4115 | i.anyone_can_modify, i.id_tree AS tree_id, i.fa_icon, |
| 4117 | 4116 | n.renewal_period, i.url AS link, i.email |
| 4118 | - FROM ' . prefixTable('items') . ' AS i |
|
| 4119 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
| 4117 | + FROM ' . prefixTable('items').' AS i |
|
| 4118 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
| 4120 | 4119 | WHERE %l |
| 4121 | 4120 | ORDER BY i.label ASC' . $query_limit, |
| 4122 | 4121 | $where |
@@ -4130,8 +4129,8 @@ discard block |
||
| 4130 | 4129 | i.label, i.description, i.pw, i.login, |
| 4131 | 4130 | i.anyone_can_modify, i.id_tree AS tree_id, i.fa_icon, |
| 4132 | 4131 | n.renewal_period, i.url AS link, i.email |
| 4133 | - FROM ' . prefixTable('items') . ' AS i |
|
| 4134 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
| 4132 | + FROM ' . prefixTable('items').' AS i |
|
| 4133 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
| 4135 | 4134 | WHERE %l |
| 4136 | 4135 | ORDER BY i.label ASC', |
| 4137 | 4136 | $where |
@@ -4161,7 +4160,7 @@ discard block |
||
| 4161 | 4160 | $item_is_restricted_to_role = false; |
| 4162 | 4161 | DB::queryFirstRow( |
| 4163 | 4162 | 'SELECT role_id |
| 4164 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 4163 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 4165 | 4164 | WHERE item_id = %i', |
| 4166 | 4165 | $record['id'] |
| 4167 | 4166 | ); |
@@ -4173,7 +4172,7 @@ discard block |
||
| 4173 | 4172 | $user_is_included_in_role = false; |
| 4174 | 4173 | DB::query( |
| 4175 | 4174 | 'SELECT role_id |
| 4176 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
| 4175 | + FROM ' . prefixTable('restriction_to_roles').' |
|
| 4177 | 4176 | WHERE item_id = %i AND role_id IN %ls', |
| 4178 | 4177 | $record['id'], |
| 4179 | 4178 | $session->get('user-roles_array') |
@@ -4383,8 +4382,8 @@ discard block |
||
| 4383 | 4382 | if ((int) $start === 0) { |
| 4384 | 4383 | DB::query( |
| 4385 | 4384 | 'SELECT i.id |
| 4386 | - FROM ' . prefixTable('items') . ' as i |
|
| 4387 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
| 4385 | + FROM ' . prefixTable('items').' as i |
|
| 4386 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
| 4388 | 4387 | WHERE %l', |
| 4389 | 4388 | $where |
| 4390 | 4389 | ); |
@@ -4444,8 +4443,8 @@ discard block |
||
| 4444 | 4443 | $dataItem = DB::queryFirstRow( |
| 4445 | 4444 | 'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id, |
| 4446 | 4445 | i.label AS label, i.id_tree AS id_tree |
| 4447 | - FROM ' . prefixTable('items') . ' AS i |
|
| 4448 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
| 4446 | + FROM ' . prefixTable('items').' AS i |
|
| 4447 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
| 4449 | 4448 | WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)', |
| 4450 | 4449 | $session->get('user-id'), |
| 4451 | 4450 | $inputData['itemKey'] ?? '', |
@@ -4557,7 +4556,7 @@ discard block |
||
| 4557 | 4556 | // do query on this folder |
| 4558 | 4557 | $data_this_folder = DB::queryFirstRow( |
| 4559 | 4558 | 'SELECT id, personal_folder, title |
| 4560 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 4559 | + FROM ' . prefixTable('nested_tree').' |
|
| 4561 | 4560 | WHERE id = %s', |
| 4562 | 4561 | $inputData['folderId'] |
| 4563 | 4562 | ); |
@@ -4597,8 +4596,8 @@ discard block |
||
| 4597 | 4596 | $visibilite = ''; |
| 4598 | 4597 | $data = DB::queryFirstRow( |
| 4599 | 4598 | 'SELECT m.valeur, n.personal_folder |
| 4600 | - FROM ' . prefixTable('misc') . ' AS m |
|
| 4601 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id) |
|
| 4599 | + FROM ' . prefixTable('misc').' AS m |
|
| 4600 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id) |
|
| 4602 | 4601 | WHERE type=%s AND intitule = %s', |
| 4603 | 4602 | 'complex', |
| 4604 | 4603 | $inputData['folderId'] |
@@ -4611,8 +4610,8 @@ discard block |
||
| 4611 | 4610 | // Prepare Item actual visibility (what Users/Roles can see it) |
| 4612 | 4611 | $rows = DB::query( |
| 4613 | 4612 | 'SELECT t.title |
| 4614 | - FROM ' . prefixTable('roles_values') . ' as v |
|
| 4615 | - INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id) |
|
| 4613 | + FROM ' . prefixTable('roles_values').' as v |
|
| 4614 | + INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id) |
|
| 4616 | 4615 | WHERE v.folder_id = %i |
| 4617 | 4616 | GROUP BY title', |
| 4618 | 4617 | $inputData['folderId'] |
@@ -4621,7 +4620,7 @@ discard block |
||
| 4621 | 4620 | if (empty($visibilite)) { |
| 4622 | 4621 | $visibilite = $record['title']; |
| 4623 | 4622 | } else { |
| 4624 | - $visibilite .= ' - ' . $record['title']; |
|
| 4623 | + $visibilite .= ' - '.$record['title']; |
|
| 4625 | 4624 | } |
| 4626 | 4625 | } |
| 4627 | 4626 | } else { |
@@ -4631,14 +4630,14 @@ discard block |
||
| 4631 | 4630 | // do new query to know if current folder is pf |
| 4632 | 4631 | $data_pf = DB::queryFirstRow( |
| 4633 | 4632 | 'SELECT personal_folder |
| 4634 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 4633 | + FROM ' . prefixTable('nested_tree').' |
|
| 4635 | 4634 | WHERE id = %s', |
| 4636 | 4635 | $inputData['folderId'] |
| 4637 | 4636 | ); |
| 4638 | 4637 | |
| 4639 | 4638 | $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0; |
| 4640 | 4639 | |
| 4641 | - $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')'; |
|
| 4640 | + $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')'; |
|
| 4642 | 4641 | } |
| 4643 | 4642 | |
| 4644 | 4643 | recupDroitCreationSansComplexite($inputData['folderId']); |
@@ -4648,8 +4647,8 @@ discard block |
||
| 4648 | 4647 | $listOptionsForRoles = array(); |
| 4649 | 4648 | $rows = DB::query( |
| 4650 | 4649 | 'SELECT r.role_id AS role_id, t.title AS title |
| 4651 | - FROM ' . prefixTable('roles_values') . ' AS r |
|
| 4652 | - INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id) |
|
| 4650 | + FROM ' . prefixTable('roles_values').' AS r |
|
| 4651 | + INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id) |
|
| 4653 | 4652 | WHERE r.folder_id = %i', |
| 4654 | 4653 | $inputData['folderId'] |
| 4655 | 4654 | ); |
@@ -4663,7 +4662,7 @@ discard block |
||
| 4663 | 4662 | ); |
| 4664 | 4663 | $rows2 = DB::query( |
| 4665 | 4664 | 'SELECT id, login, fonction_id, email, name, lastname |
| 4666 | - FROM ' . prefixTable('users') . ' |
|
| 4665 | + FROM ' . prefixTable('users').' |
|
| 4667 | 4666 | WHERE admin = 0 AND fonction_id is not null' |
| 4668 | 4667 | ); |
| 4669 | 4668 | foreach ($rows2 as $record2) { |
@@ -4677,7 +4676,7 @@ discard block |
||
| 4677 | 4676 | array( |
| 4678 | 4677 | 'id' => $record2['id'], |
| 4679 | 4678 | 'login' => $record2['login'], |
| 4680 | - 'name' => $record2['name'] . ' ' . $record2['lastname'], |
|
| 4679 | + 'name' => $record2['name'].' '.$record2['lastname'], |
|
| 4681 | 4680 | 'email' => $record2['email'], |
| 4682 | 4681 | ) |
| 4683 | 4682 | ); |
@@ -4694,12 +4693,12 @@ discard block |
||
| 4694 | 4693 | foreach ($session->get('user-roles_array') as $role) { |
| 4695 | 4694 | $access = DB::queryFirstRow( |
| 4696 | 4695 | 'SELECT type |
| 4697 | - FROM ' . prefixTable('roles_values') . ' |
|
| 4696 | + FROM ' . prefixTable('roles_values').' |
|
| 4698 | 4697 | WHERE role_id = %i AND folder_id = %i', |
| 4699 | 4698 | $role, |
| 4700 | 4699 | $inputData['folderId'] |
| 4701 | 4700 | ); |
| 4702 | - if (DB::count()>0) { |
|
| 4701 | + if (DB::count() > 0) { |
|
| 4703 | 4702 | if ($access['type'] === 'R') { |
| 4704 | 4703 | array_push($arrTmp, 10); |
| 4705 | 4704 | } elseif ($access['type'] === 'W') { |
@@ -4727,7 +4726,7 @@ discard block |
||
| 4727 | 4726 | // Check if personal folder is owned by user |
| 4728 | 4727 | $folder = DB::queryFirstRow( |
| 4729 | 4728 | 'SELECT id |
| 4730 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 4729 | + FROM ' . prefixTable('nested_tree').' |
|
| 4731 | 4730 | WHERE title = %s', |
| 4732 | 4731 | $session->get('user-id'), |
| 4733 | 4732 | ); |
@@ -4832,7 +4831,7 @@ discard block |
||
| 4832 | 4831 | // Get some info before deleting |
| 4833 | 4832 | $data = DB::queryFirstRow( |
| 4834 | 4833 | 'SELECT name, id_item, file |
| 4835 | - FROM ' . prefixTable('files') . ' |
|
| 4834 | + FROM ' . prefixTable('files').' |
|
| 4836 | 4835 | WHERE id = %i', |
| 4837 | 4836 | $fileId |
| 4838 | 4837 | ); |
@@ -4840,7 +4839,7 @@ discard block |
||
| 4840 | 4839 | // Load item data |
| 4841 | 4840 | $data_item = DB::queryFirstRow( |
| 4842 | 4841 | 'SELECT id_tree |
| 4843 | - FROM ' . prefixTable('items') . ' |
|
| 4842 | + FROM ' . prefixTable('items').' |
|
| 4844 | 4843 | WHERE id = %i', |
| 4845 | 4844 | $data['id_item'] |
| 4846 | 4845 | ); |
@@ -4870,7 +4869,7 @@ discard block |
||
| 4870 | 4869 | $session->get('user-id'), |
| 4871 | 4870 | 'at_modification', |
| 4872 | 4871 | $session->get('user-login'), |
| 4873 | - 'at_del_file : ' . $data['name'] |
|
| 4872 | + 'at_del_file : '.$data['name'] |
|
| 4874 | 4873 | ); |
| 4875 | 4874 | |
| 4876 | 4875 | // DElete sharekeys |
@@ -4881,7 +4880,7 @@ discard block |
||
| 4881 | 4880 | ); |
| 4882 | 4881 | |
| 4883 | 4882 | // Delete file from server |
| 4884 | - $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']); |
|
| 4883 | + $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']); |
|
| 4885 | 4884 | $fileToDelete = realpath($fileToDelete); |
| 4886 | 4885 | if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) { |
| 4887 | 4886 | fileDelete($fileToDelete, $SETTINGS); |
@@ -4935,7 +4934,7 @@ discard block |
||
| 4935 | 4934 | // Update SESSION with this new favourite |
| 4936 | 4935 | $data = DB::queryFirstRow( |
| 4937 | 4936 | 'SELECT label,id_tree |
| 4938 | - FROM ' . prefixTable('items') . ' |
|
| 4937 | + FROM ' . prefixTable('items').' |
|
| 4939 | 4938 | WHERE id = %i', |
| 4940 | 4939 | $inputData['itemId'] |
| 4941 | 4940 | ); |
@@ -4944,7 +4943,7 @@ discard block |
||
| 4944 | 4943 | [ |
| 4945 | 4944 | $inputData['itemId'] => [ |
| 4946 | 4945 | 'label' => $data['label'], |
| 4947 | - 'url' => 'index.php?page=items&group=' . $data['id_tree'] . '&id=' . $inputData['itemId'], |
|
| 4946 | + 'url' => 'index.php?page=items&group='.$data['id_tree'].'&id='.$inputData['itemId'], |
|
| 4948 | 4947 | ], |
| 4949 | 4948 | ], |
| 4950 | 4949 | 'add' |
@@ -5013,8 +5012,8 @@ discard block |
||
| 5013 | 5012 | // get data about item |
| 5014 | 5013 | $dataSource = DB::queryFirstRow( |
| 5015 | 5014 | 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label |
| 5016 | - FROM ' . prefixTable('items') . ' as i |
|
| 5017 | - INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id) |
|
| 5015 | + FROM ' . prefixTable('items').' as i |
|
| 5016 | + INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id) |
|
| 5018 | 5017 | WHERE i.id=%i', |
| 5019 | 5018 | $inputData['itemId'] |
| 5020 | 5019 | ); |
@@ -5058,7 +5057,7 @@ discard block |
||
| 5058 | 5057 | // get data about new folder |
| 5059 | 5058 | $dataDestination = DB::queryFirstRow( |
| 5060 | 5059 | 'SELECT personal_folder, title |
| 5061 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 5060 | + FROM ' . prefixTable('nested_tree').' |
|
| 5062 | 5061 | WHERE id = %i', |
| 5063 | 5062 | $inputData['folderId'] |
| 5064 | 5063 | ); |
@@ -5111,7 +5110,7 @@ discard block |
||
| 5111 | 5110 | // Get fields for this Item |
| 5112 | 5111 | $rows = DB::query( |
| 5113 | 5112 | 'SELECT id |
| 5114 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5113 | + FROM ' . prefixTable('categories_items').' |
|
| 5115 | 5114 | WHERE item_id = %i', |
| 5116 | 5115 | $inputData['itemId'] |
| 5117 | 5116 | ); |
@@ -5128,7 +5127,7 @@ discard block |
||
| 5128 | 5127 | // Get FILES for this Item |
| 5129 | 5128 | $rows = DB::query( |
| 5130 | 5129 | 'SELECT id |
| 5131 | - FROM ' . prefixTable('files') . ' |
|
| 5130 | + FROM ' . prefixTable('files').' |
|
| 5132 | 5131 | WHERE id_item = %i', |
| 5133 | 5132 | $inputData['itemId'] |
| 5134 | 5133 | ); |
@@ -5175,7 +5174,7 @@ discard block |
||
| 5175 | 5174 | // Get the ITEM object key for the user |
| 5176 | 5175 | $userKey = DB::queryFirstRow( |
| 5177 | 5176 | 'SELECT share_key |
| 5178 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 5177 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 5179 | 5178 | WHERE user_id = %i AND object_id = %i', |
| 5180 | 5179 | $session->get('user-id'), |
| 5181 | 5180 | $inputData['itemId'] |
@@ -5186,7 +5185,7 @@ discard block |
||
| 5186 | 5185 | // This is a public object |
| 5187 | 5186 | $users = DB::query( |
| 5188 | 5187 | 'SELECT id, public_key |
| 5189 | - FROM ' . prefixTable('users') . ' |
|
| 5188 | + FROM ' . prefixTable('users').' |
|
| 5190 | 5189 | WHERE id NOT IN %li |
| 5191 | 5190 | AND public_key != ""', |
| 5192 | 5191 | $tpUsersIDs |
@@ -5209,14 +5208,14 @@ discard block |
||
| 5209 | 5208 | // Get fields for this Item |
| 5210 | 5209 | $rows = DB::query( |
| 5211 | 5210 | 'SELECT id |
| 5212 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5211 | + FROM ' . prefixTable('categories_items').' |
|
| 5213 | 5212 | WHERE item_id = %i', |
| 5214 | 5213 | $inputData['itemId'] |
| 5215 | 5214 | ); |
| 5216 | 5215 | foreach ($rows as $field) { |
| 5217 | 5216 | $userKey = DB::queryFirstRow( |
| 5218 | 5217 | 'SELECT share_key |
| 5219 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 5218 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 5220 | 5219 | WHERE user_id = %i AND object_id = %i', |
| 5221 | 5220 | $session->get('user-id'), |
| 5222 | 5221 | $field['id'] |
@@ -5227,7 +5226,7 @@ discard block |
||
| 5227 | 5226 | // This is a public object |
| 5228 | 5227 | $users = DB::query( |
| 5229 | 5228 | 'SELECT id, public_key |
| 5230 | - FROM ' . prefixTable('users') . ' |
|
| 5229 | + FROM ' . prefixTable('users').' |
|
| 5231 | 5230 | WHERE id NOT IN %li |
| 5232 | 5231 | AND public_key != ""', |
| 5233 | 5232 | $tpUsersIDs |
@@ -5250,14 +5249,14 @@ discard block |
||
| 5250 | 5249 | // Get FILES for this Item |
| 5251 | 5250 | $rows = DB::query( |
| 5252 | 5251 | 'SELECT id |
| 5253 | - FROM ' . prefixTable('files') . ' |
|
| 5252 | + FROM ' . prefixTable('files').' |
|
| 5254 | 5253 | WHERE id_item = %i', |
| 5255 | 5254 | $inputData['itemId'] |
| 5256 | 5255 | ); |
| 5257 | 5256 | foreach ($rows as $attachment) { |
| 5258 | 5257 | $userKey = DB::queryFirstRow( |
| 5259 | 5258 | 'SELECT share_key |
| 5260 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 5259 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 5261 | 5260 | WHERE user_id = %i AND object_id = %i', |
| 5262 | 5261 | $session->get('user-id'), |
| 5263 | 5262 | $attachment['id'] |
@@ -5268,7 +5267,7 @@ discard block |
||
| 5268 | 5267 | // This is a public object |
| 5269 | 5268 | $users = DB::query( |
| 5270 | 5269 | 'SELECT id, public_key |
| 5271 | - FROM ' . prefixTable('users') . ' |
|
| 5270 | + FROM ' . prefixTable('users').' |
|
| 5272 | 5271 | WHERE id NOT IN %li |
| 5273 | 5272 | AND public_key != ""', |
| 5274 | 5273 | $tpUsersIDs |
@@ -5309,7 +5308,7 @@ discard block |
||
| 5309 | 5308 | $session->get('user-id'), |
| 5310 | 5309 | 'at_modification', |
| 5311 | 5310 | $session->get('user-login'), |
| 5312 | - 'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title'] |
|
| 5311 | + 'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title'] |
|
| 5313 | 5312 | ); |
| 5314 | 5313 | |
| 5315 | 5314 | // Update cache table |
@@ -5368,8 +5367,8 @@ discard block |
||
| 5368 | 5367 | // get data about item |
| 5369 | 5368 | $dataSource = DB::queryFirstRow( |
| 5370 | 5369 | 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label |
| 5371 | - FROM ' . prefixTable('items') . ' as i |
|
| 5372 | - INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id) |
|
| 5370 | + FROM ' . prefixTable('items').' as i |
|
| 5371 | + INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id) |
|
| 5373 | 5372 | WHERE i.id=%i', |
| 5374 | 5373 | $item_id |
| 5375 | 5374 | ); |
@@ -5391,7 +5390,7 @@ discard block |
||
| 5391 | 5390 | |
| 5392 | 5391 | // get data about new folder |
| 5393 | 5392 | $dataDestination = DB::queryFirstRow( |
| 5394 | - 'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 5393 | + 'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 5395 | 5394 | $inputData['folderId'] |
| 5396 | 5395 | ); |
| 5397 | 5396 | |
@@ -5433,7 +5432,7 @@ discard block |
||
| 5433 | 5432 | // Get fields for this Item |
| 5434 | 5433 | $rows = DB::query( |
| 5435 | 5434 | 'SELECT id |
| 5436 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5435 | + FROM ' . prefixTable('categories_items').' |
|
| 5437 | 5436 | WHERE item_id = %i', |
| 5438 | 5437 | $item_id |
| 5439 | 5438 | ); |
@@ -5450,7 +5449,7 @@ discard block |
||
| 5450 | 5449 | // Get FILES for this Item |
| 5451 | 5450 | $rows = DB::query( |
| 5452 | 5451 | 'SELECT id |
| 5453 | - FROM ' . prefixTable('files') . ' |
|
| 5452 | + FROM ' . prefixTable('files').' |
|
| 5454 | 5453 | WHERE id_item = %i', |
| 5455 | 5454 | $item_id |
| 5456 | 5455 | ); |
@@ -5505,7 +5504,7 @@ discard block |
||
| 5505 | 5504 | // Get the ITEM object key for the user |
| 5506 | 5505 | $userKey = DB::queryFirstRow( |
| 5507 | 5506 | 'SELECT share_key |
| 5508 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 5507 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 5509 | 5508 | WHERE user_id = %i AND object_id = %i', |
| 5510 | 5509 | $session->get('user-id'), |
| 5511 | 5510 | $item_id |
@@ -5516,7 +5515,7 @@ discard block |
||
| 5516 | 5515 | // This is a public object |
| 5517 | 5516 | $users = DB::query( |
| 5518 | 5517 | 'SELECT id, public_key |
| 5519 | - FROM ' . prefixTable('users') . ' |
|
| 5518 | + FROM ' . prefixTable('users').' |
|
| 5520 | 5519 | WHERE id NOT IN %li |
| 5521 | 5520 | AND public_key != ""', |
| 5522 | 5521 | $tpUsersIDs |
@@ -5539,14 +5538,14 @@ discard block |
||
| 5539 | 5538 | // Get fields for this Item |
| 5540 | 5539 | $rows = DB::query( |
| 5541 | 5540 | 'SELECT id |
| 5542 | - FROM ' . prefixTable('categories_items') . ' |
|
| 5541 | + FROM ' . prefixTable('categories_items').' |
|
| 5543 | 5542 | WHERE item_id = %i', |
| 5544 | 5543 | $item_id |
| 5545 | 5544 | ); |
| 5546 | 5545 | foreach ($rows as $field) { |
| 5547 | 5546 | $userKey = DB::queryFirstRow( |
| 5548 | 5547 | 'SELECT share_key |
| 5549 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
| 5548 | + FROM ' . prefixTable('sharekeys_fields').' |
|
| 5550 | 5549 | WHERE user_id = %i AND object_id = %i', |
| 5551 | 5550 | $session->get('user-id'), |
| 5552 | 5551 | $field['id'] |
@@ -5557,7 +5556,7 @@ discard block |
||
| 5557 | 5556 | // This is a public object |
| 5558 | 5557 | $users = DB::query( |
| 5559 | 5558 | 'SELECT id, public_key |
| 5560 | - FROM ' . prefixTable('users') . ' |
|
| 5559 | + FROM ' . prefixTable('users').' |
|
| 5561 | 5560 | WHERE id NOT IN %li |
| 5562 | 5561 | AND public_key != ""', |
| 5563 | 5562 | $tpUsersIDs |
@@ -5581,14 +5580,14 @@ discard block |
||
| 5581 | 5580 | // Get FILES for this Item |
| 5582 | 5581 | $rows = DB::query( |
| 5583 | 5582 | 'SELECT id |
| 5584 | - FROM ' . prefixTable('files') . ' |
|
| 5583 | + FROM ' . prefixTable('files').' |
|
| 5585 | 5584 | WHERE id_item = %i', |
| 5586 | 5585 | $item_id |
| 5587 | 5586 | ); |
| 5588 | 5587 | foreach ($rows as $attachment) { |
| 5589 | 5588 | $userKey = DB::queryFirstRow( |
| 5590 | 5589 | 'SELECT share_key |
| 5591 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
| 5590 | + FROM ' . prefixTable('sharekeys_files').' |
|
| 5592 | 5591 | WHERE user_id = %i AND object_id = %i', |
| 5593 | 5592 | $session->get('user-id'), |
| 5594 | 5593 | $attachment['id'] |
@@ -5599,7 +5598,7 @@ discard block |
||
| 5599 | 5598 | // This is a public object |
| 5600 | 5599 | $users = DB::query( |
| 5601 | 5600 | 'SELECT id, public_key |
| 5602 | - FROM ' . prefixTable('users') . ' |
|
| 5601 | + FROM ' . prefixTable('users').' |
|
| 5603 | 5602 | WHERE id NOT IN %li |
| 5604 | 5603 | AND public_key != ""', |
| 5605 | 5604 | $tpUsersIDs |
@@ -5639,13 +5638,13 @@ discard block |
||
| 5639 | 5638 | $session->get('user-id'), |
| 5640 | 5639 | 'at_modification', |
| 5641 | 5640 | $session->get('user-login'), |
| 5642 | - 'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title'] |
|
| 5641 | + 'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title'] |
|
| 5643 | 5642 | ); |
| 5644 | 5643 | } |
| 5645 | 5644 | } |
| 5646 | 5645 | |
| 5647 | 5646 | // reload cache table |
| 5648 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 5647 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 5649 | 5648 | updateCacheTable('reload', null); |
| 5650 | 5649 | |
| 5651 | 5650 | echo (string) prepareExchangedData( |
@@ -5709,7 +5708,7 @@ discard block |
||
| 5709 | 5708 | // get info |
| 5710 | 5709 | $dataSource = DB::queryFirstRow( |
| 5711 | 5710 | 'SELECT label, id_tree |
| 5712 | - FROM ' . prefixTable('items') . ' |
|
| 5711 | + FROM ' . prefixTable('items').' |
|
| 5713 | 5712 | WHERE id=%i', |
| 5714 | 5713 | $item_id |
| 5715 | 5714 | ); |
@@ -5810,14 +5809,14 @@ discard block |
||
| 5810 | 5809 | // Variables |
| 5811 | 5810 | $dataAuthor = DB::queryFirstRow( |
| 5812 | 5811 | 'SELECT email,login |
| 5813 | - FROM ' . prefixTable('users') . ' |
|
| 5812 | + FROM ' . prefixTable('users').' |
|
| 5814 | 5813 | WHERE id = %i', |
| 5815 | 5814 | $post_content[1] |
| 5816 | 5815 | ); |
| 5817 | 5816 | |
| 5818 | 5817 | $dataItem = DB::queryFirstRow( |
| 5819 | 5818 | 'SELECT label, id_tree |
| 5820 | - FROM ' . prefixTable('items') . ' |
|
| 5819 | + FROM ' . prefixTable('items').' |
|
| 5821 | 5820 | WHERE id = %i', |
| 5822 | 5821 | $post_content[0] |
| 5823 | 5822 | ); |
@@ -5834,7 +5833,7 @@ discard block |
||
| 5834 | 5833 | $lang->get('email_request_access_subject'), |
| 5835 | 5834 | str_replace( |
| 5836 | 5835 | array('#tp_item_author#', '#tp_user#', '#tp_item#'), |
| 5837 | - array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path), |
|
| 5836 | + array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path), |
|
| 5838 | 5837 | $lang->get('email_request_access_mail') |
| 5839 | 5838 | ), |
| 5840 | 5839 | $dataAuthor['email'], |
@@ -5843,7 +5842,7 @@ discard block |
||
| 5843 | 5842 | } elseif ($inputData['cat'] === 'share_this_item') { |
| 5844 | 5843 | $dataItem = DB::queryFirstRow( |
| 5845 | 5844 | 'SELECT label,id_tree |
| 5846 | - FROM ' . prefixTable('items') . ' |
|
| 5845 | + FROM ' . prefixTable('items').' |
|
| 5847 | 5846 | WHERE id= %i', |
| 5848 | 5847 | $inputData['id'] |
| 5849 | 5848 | ); |
@@ -5866,7 +5865,7 @@ discard block |
||
| 5866 | 5865 | ), |
| 5867 | 5866 | array( |
| 5868 | 5867 | empty($SETTINGS['email_server_url']) === false ? |
| 5869 | - $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'], |
|
| 5868 | + $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'], |
|
| 5870 | 5869 | addslashes($session->get('user-login')), |
| 5871 | 5870 | addslashes($path), |
| 5872 | 5871 | ), |
@@ -5915,8 +5914,8 @@ discard block |
||
| 5915 | 5914 | // Get all informations for this item |
| 5916 | 5915 | $dataItem = DB::queryFirstRow( |
| 5917 | 5916 | 'SELECT * |
| 5918 | - FROM ' . prefixTable('items') . ' as i |
|
| 5919 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 5917 | + FROM ' . prefixTable('items').' as i |
|
| 5918 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 5920 | 5919 | WHERE i.id=%i AND l.action = %s', |
| 5921 | 5920 | $item_id, |
| 5922 | 5921 | 'at_creation' |
@@ -5945,18 +5944,18 @@ discard block |
||
| 5945 | 5944 | $session->get('user-login'), |
| 5946 | 5945 | htmlspecialchars_decode($label, ENT_QUOTES), |
| 5947 | 5946 | null, |
| 5948 | - (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format']) |
|
| 5947 | + (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format']) |
|
| 5949 | 5948 | ); |
| 5950 | 5949 | // Prepare new line |
| 5951 | 5950 | $data = DB::queryFirstRow( |
| 5952 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC', |
|
| 5951 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC', |
|
| 5953 | 5952 | $item_id |
| 5954 | 5953 | ); |
| 5955 | - $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison']; |
|
| 5954 | + $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison']; |
|
| 5956 | 5955 | // send back |
| 5957 | 5956 | $data = array( |
| 5958 | 5957 | 'error' => '', |
| 5959 | - 'new_line' => '<br>' . addslashes($historic), |
|
| 5958 | + 'new_line' => '<br>'.addslashes($historic), |
|
| 5960 | 5959 | ); |
| 5961 | 5960 | echo (string) prepareExchangedData( |
| 5962 | 5961 | $data, |
@@ -6031,8 +6030,8 @@ discard block |
||
| 6031 | 6030 | // Should we log a password change? |
| 6032 | 6031 | $itemQ = DB::queryFirstRow( |
| 6033 | 6032 | 'SELECT s.share_key, i.pw |
| 6034 | - FROM ' . prefixTable('items') . ' AS i |
|
| 6035 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id) |
|
| 6033 | + FROM ' . prefixTable('items').' AS i |
|
| 6034 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id) |
|
| 6036 | 6035 | WHERE s.user_id = %i AND s.object_id = %i', |
| 6037 | 6036 | $session->get('user-id'), |
| 6038 | 6037 | $dataReceived['id'] |
@@ -6087,7 +6086,7 @@ discard block |
||
| 6087 | 6086 | if (isset($SETTINGS['otv_expiration_period']) === false) { |
| 6088 | 6087 | $SETTINGS['otv_expiration_period'] = 7; |
| 6089 | 6088 | } |
| 6090 | - $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session); |
|
| 6089 | + $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session); |
|
| 6091 | 6090 | |
| 6092 | 6091 | echo json_encode( |
| 6093 | 6092 | array( |
@@ -6118,7 +6117,7 @@ discard block |
||
| 6118 | 6117 | // get parameters from original link |
| 6119 | 6118 | $url = $dataReceived['original_link']; |
| 6120 | 6119 | $parts = parse_url($url); |
| 6121 | - if(isset($parts['query'])){ |
|
| 6120 | + if (isset($parts['query'])) { |
|
| 6122 | 6121 | parse_str($parts['query'], $orignal_link_parameters); |
| 6123 | 6122 | } else { |
| 6124 | 6123 | $orignal_link_parameters = array(); |
@@ -6149,13 +6148,13 @@ discard block |
||
| 6149 | 6148 | $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME); |
| 6150 | 6149 | $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST); |
| 6151 | 6150 | if (str_contains($domain_host, 'www.') === true) { |
| 6152 | - $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4); |
|
| 6151 | + $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4); |
|
| 6153 | 6152 | } else { |
| 6154 | - $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host; |
|
| 6153 | + $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host; |
|
| 6155 | 6154 | } |
| 6156 | - $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session); |
|
| 6155 | + $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session); |
|
| 6157 | 6156 | } else { |
| 6158 | - $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session); |
|
| 6157 | + $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session); |
|
| 6159 | 6158 | } |
| 6160 | 6159 | |
| 6161 | 6160 | echo (string) prepareExchangedData( |
@@ -6190,8 +6189,8 @@ discard block |
||
| 6190 | 6189 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, |
| 6191 | 6190 | f.extension AS extension, f.type AS type, |
| 6192 | 6191 | s.share_key AS share_key |
| 6193 | - FROM ' . prefixTable('files') . ' AS f |
|
| 6194 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
| 6192 | + FROM ' . prefixTable('files').' AS f |
|
| 6193 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
| 6195 | 6194 | WHERE s.user_id = %i AND s.object_id = %i', |
| 6196 | 6195 | $session->get('user-id'), |
| 6197 | 6196 | $inputData['id'] |
@@ -6212,7 +6211,7 @@ discard block |
||
| 6212 | 6211 | //$fileName = basename($file_info['name'], '.'.$file_info['extension']); |
| 6213 | 6212 | |
| 6214 | 6213 | // prepare image info |
| 6215 | - $post_title = basename($file_info['name'], '.' . $file_info['extension']); |
|
| 6214 | + $post_title = basename($file_info['name'], '.'.$file_info['extension']); |
|
| 6216 | 6215 | $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title; |
| 6217 | 6216 | |
| 6218 | 6217 | // Get image content |
@@ -6239,7 +6238,7 @@ discard block |
||
| 6239 | 6238 | echo (string) prepareExchangedData( |
| 6240 | 6239 | array( |
| 6241 | 6240 | 'error' => false, |
| 6242 | - 'filename' => $post_title . '.' . $file_info['extension'], |
|
| 6241 | + 'filename' => $post_title.'.'.$file_info['extension'], |
|
| 6243 | 6242 | 'file_type' => $file_info['type'], |
| 6244 | 6243 | 'file_content' => $fileContent, |
| 6245 | 6244 | ), |
@@ -6351,7 +6350,7 @@ discard block |
||
| 6351 | 6350 | $arbo = $tree->getPath($folder->id, false); |
| 6352 | 6351 | $path = ''; |
| 6353 | 6352 | foreach ($arbo as $elem) { |
| 6354 | - $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 6353 | + $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 6355 | 6354 | } |
| 6356 | 6355 | |
| 6357 | 6356 | // Build array |
@@ -6417,7 +6416,7 @@ discard block |
||
| 6417 | 6416 | if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') { |
| 6418 | 6417 | $rows = DB::query( |
| 6419 | 6418 | 'SELECT id, categories |
| 6420 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 6419 | + FROM ' . prefixTable('nested_tree').' |
|
| 6421 | 6420 | WHERE id IN (%l)', |
| 6422 | 6421 | implode(',', $foldersArray) |
| 6423 | 6422 | ); |
@@ -6459,7 +6458,7 @@ discard block |
||
| 6459 | 6458 | // get item info |
| 6460 | 6459 | $dataItem = DB::queryFirstRow( |
| 6461 | 6460 | 'SELECT * |
| 6462 | - FROM ' . prefixTable('items') . ' |
|
| 6461 | + FROM ' . prefixTable('items').' |
|
| 6463 | 6462 | WHERE id=%i', |
| 6464 | 6463 | $inputData['itemId'] |
| 6465 | 6464 | ); |
@@ -6471,8 +6470,8 @@ discard block |
||
| 6471 | 6470 | 'SELECT l.date as date, l.action as action, l.raison as raison, |
| 6472 | 6471 | u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname, |
| 6473 | 6472 | l.old_value as old_value |
| 6474 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 6475 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 6473 | + FROM ' . prefixTable('log_items').' as l |
|
| 6474 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 6476 | 6475 | WHERE id_item=%i AND l.action NOT IN (%l) |
| 6477 | 6476 | ORDER BY date DESC', |
| 6478 | 6477 | $inputData['itemId'], |
@@ -6487,18 +6486,18 @@ discard block |
||
| 6487 | 6486 | |
| 6488 | 6487 | // imported via API |
| 6489 | 6488 | if (empty($record['login']) === true) { |
| 6490 | - $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']'; |
|
| 6489 | + $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']'; |
|
| 6491 | 6490 | } |
| 6492 | 6491 | |
| 6493 | 6492 | // Prepare avatar |
| 6494 | 6493 | if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) { |
| 6495 | - if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) { |
|
| 6496 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb']; |
|
| 6494 | + if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) { |
|
| 6495 | + $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb']; |
|
| 6497 | 6496 | } else { |
| 6498 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
| 6497 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
| 6499 | 6498 | } |
| 6500 | 6499 | } else { |
| 6501 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
| 6500 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
| 6502 | 6501 | } |
| 6503 | 6502 | |
| 6504 | 6503 | // Prepare action |
@@ -6518,7 +6517,7 @@ discard block |
||
| 6518 | 6517 | $previous_passwords, |
| 6519 | 6518 | [ |
| 6520 | 6519 | 'password' => htmlentities($previous_pwd['string']), |
| 6521 | - 'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']), |
|
| 6520 | + 'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']), |
|
| 6522 | 6521 | ] |
| 6523 | 6522 | ); |
| 6524 | 6523 | } |
@@ -6531,19 +6530,19 @@ discard block |
||
| 6531 | 6530 | $action = $lang->get($reason[0]); |
| 6532 | 6531 | if ($reason[0] === 'at_moved') { |
| 6533 | 6532 | $tmp = explode(' -> ', $reason[1]); |
| 6534 | - $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>'; |
|
| 6533 | + $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>'; |
|
| 6535 | 6534 | } elseif ($reason[0] === 'at_field') { |
| 6536 | 6535 | $tmp = explode(' => ', $reason[1]); |
| 6537 | 6536 | if (count($tmp) > 1) { |
| 6538 | - $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') . |
|
| 6539 | - ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>'; |
|
| 6537 | + $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value'). |
|
| 6538 | + ': <span class="font-weight-light">'.trim($tmp[1]).'</span>'; |
|
| 6540 | 6539 | } else { |
| 6541 | 6540 | $detail = trim($reason[1]); |
| 6542 | 6541 | } |
| 6543 | 6542 | } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) { |
| 6544 | 6543 | $tmp = explode(' => ', $reason[1]); |
| 6545 | 6544 | $detail = empty(trim($tmp[0])) === true ? |
| 6546 | - $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>'; |
|
| 6545 | + $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>'; |
|
| 6547 | 6546 | } elseif ($reason[0] === 'at_automatic_del') { |
| 6548 | 6547 | $detail = $lang->get($reason[1]); |
| 6549 | 6548 | } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status' || $reason[0] === 'at_otp_secret' || $reason[0] === 'at_phone_number') { |
@@ -6552,7 +6551,7 @@ discard block |
||
| 6552 | 6551 | $tmp = explode(':', $reason[1]); |
| 6553 | 6552 | $tmp = explode('.', $tmp[0]); |
| 6554 | 6553 | $detail = isBase64($tmp[0]) === true ? |
| 6555 | - base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0]; |
|
| 6554 | + base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0]; |
|
| 6556 | 6555 | } elseif ($reason[0] === 'at_import') { |
| 6557 | 6556 | $detail = ''; |
| 6558 | 6557 | } elseif (in_array($reason[0], array('csv', 'pdf')) === true) { |
@@ -6571,8 +6570,8 @@ discard block |
||
| 6571 | 6570 | array( |
| 6572 | 6571 | 'avatar' => $avatar, |
| 6573 | 6572 | 'login' => $record['login'], |
| 6574 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
| 6575 | - 'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']), |
|
| 6573 | + 'name' => $record['name'].' '.$record['lastname'], |
|
| 6574 | + 'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']), |
|
| 6576 | 6575 | 'action' => $action, |
| 6577 | 6576 | 'detail' => $detail, |
| 6578 | 6577 | ) |
@@ -6660,11 +6659,11 @@ discard block |
||
| 6660 | 6659 | |
| 6661 | 6660 | // get some info to add to the notification email |
| 6662 | 6661 | $resp_user = DB::queryFirstRow( |
| 6663 | - 'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i', |
|
| 6662 | + 'SELECT login FROM '.prefixTable('users').' WHERE id = %i', |
|
| 6664 | 6663 | $session->get('user-id') |
| 6665 | 6664 | ); |
| 6666 | 6665 | $resp_folder = DB::queryFirstRow( |
| 6667 | - 'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 6666 | + 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 6668 | 6667 | $folder |
| 6669 | 6668 | ); |
| 6670 | 6669 | |
@@ -6673,7 +6672,7 @@ discard block |
||
| 6673 | 6672 | $emailService = new EmailService(); |
| 6674 | 6673 | $rows = DB::query( |
| 6675 | 6674 | 'SELECT email |
| 6676 | - FROM ' . prefixTable('users') . ' |
|
| 6675 | + FROM ' . prefixTable('users').' |
|
| 6677 | 6676 | WHERE `gestionnaire` = %i AND `email` IS NOT NULL', |
| 6678 | 6677 | 1 |
| 6679 | 6678 | ); |
@@ -6719,7 +6718,7 @@ discard block |
||
| 6719 | 6718 | // Send email |
| 6720 | 6719 | $dataItem = DB::queryFirstRow( |
| 6721 | 6720 | 'SELECT label, id_tree |
| 6722 | - FROM ' . prefixTable('items') . ' |
|
| 6721 | + FROM ' . prefixTable('items').' |
|
| 6723 | 6722 | WHERE id = %i', |
| 6724 | 6723 | $inputData['itemId'] |
| 6725 | 6724 | ); |
@@ -6773,7 +6772,7 @@ discard block |
||
| 6773 | 6772 | |
| 6774 | 6773 | DB::query( |
| 6775 | 6774 | 'SELECT * |
| 6776 | - FROM ' . prefixTable('notification') . ' |
|
| 6775 | + FROM ' . prefixTable('notification').' |
|
| 6777 | 6776 | WHERE item_id = %i AND user_id = %i', |
| 6778 | 6777 | $inputData['itemId'], |
| 6779 | 6778 | $session->get('user-id') |
@@ -6845,7 +6844,7 @@ discard block |
||
| 6845 | 6844 | // And related logs |
| 6846 | 6845 | $rows = DB::query( |
| 6847 | 6846 | 'SELECT id, file AS filename |
| 6848 | - FROM ' . prefixTable('files') . ' |
|
| 6847 | + FROM ' . prefixTable('files').' |
|
| 6849 | 6848 | WHERE id_item = %i AND confirmed = %i', |
| 6850 | 6849 | $inputData['itemId'], |
| 6851 | 6850 | 0 |
@@ -6859,12 +6858,12 @@ discard block |
||
| 6859 | 6858 | ); |
| 6860 | 6859 | |
| 6861 | 6860 | // Delete file on server |
| 6862 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename'])); |
|
| 6861 | + unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename'])); |
|
| 6863 | 6862 | |
| 6864 | 6863 | // Delete related logs |
| 6865 | 6864 | $logFile = DB::query( |
| 6866 | 6865 | 'SELECT increment_id, raison |
| 6867 | - FROM ' . prefixTable('log_items') . ' |
|
| 6866 | + FROM ' . prefixTable('log_items').' |
|
| 6868 | 6867 | WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"', |
| 6869 | 6868 | $inputData['itemId'], |
| 6870 | 6869 | $session->get('user-id'), |
@@ -6923,7 +6922,7 @@ discard block |
||
| 6923 | 6922 | // Confirm attachments |
| 6924 | 6923 | $rows = DB::query( |
| 6925 | 6924 | 'SELECT id, file AS filename |
| 6926 | - FROM ' . prefixTable('files') . ' |
|
| 6925 | + FROM ' . prefixTable('files').' |
|
| 6927 | 6926 | WHERE id_item = %i AND confirmed = %i', |
| 6928 | 6927 | $inputData['itemId'], |
| 6929 | 6928 | 0 |
@@ -7039,7 +7038,7 @@ discard block |
||
| 7039 | 7038 | $successfulDeletions = array(); |
| 7040 | 7039 | $failedDeletions = array(); |
| 7041 | 7040 | |
| 7042 | - foreach( $selectedItemIds as $itemId) { |
|
| 7041 | + foreach ($selectedItemIds as $itemId) { |
|
| 7043 | 7042 | // Check that user can access this item |
| 7044 | 7043 | $granted = accessToItemIsGranted((int) $itemId, $SETTINGS); |
| 7045 | 7044 | if ($granted !== true) { |
@@ -7050,7 +7049,7 @@ discard block |
||
| 7050 | 7049 | // Load item data |
| 7051 | 7050 | $data = DB::queryFirstRow( |
| 7052 | 7051 | 'SELECT id_tree, id, label |
| 7053 | - FROM ' . prefixTable('items') . ' |
|
| 7052 | + FROM ' . prefixTable('items').' |
|
| 7054 | 7053 | WHERE id = %i', |
| 7055 | 7054 | $itemId |
| 7056 | 7055 | ); |
@@ -7133,15 +7132,15 @@ discard block |
||
| 7133 | 7132 | case 'autocomplete_tags': |
| 7134 | 7133 | // Get a list off all existing TAGS |
| 7135 | 7134 | $listOfTags = ''; |
| 7136 | - $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']); |
|
| 7135 | + $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']); |
|
| 7137 | 7136 | foreach ($rows as $record) { |
| 7138 | 7137 | if (empty($listOfTags)) { |
| 7139 | - $listOfTags = '"' . $record['tag'] . '"'; |
|
| 7138 | + $listOfTags = '"'.$record['tag'].'"'; |
|
| 7140 | 7139 | } else { |
| 7141 | - $listOfTags .= ', "' . $record['tag'] . '"'; |
|
| 7140 | + $listOfTags .= ', "'.$record['tag'].'"'; |
|
| 7142 | 7141 | } |
| 7143 | 7142 | } |
| 7144 | - echo '[' . $listOfTags . ']'; |
|
| 7143 | + echo '['.$listOfTags.']'; |
|
| 7145 | 7144 | break; |
| 7146 | 7145 | } |
| 7147 | 7146 | } |
@@ -7157,7 +7156,7 @@ discard block |
||
| 7157 | 7156 | { |
| 7158 | 7157 | $data = DB::queryFirstRow( |
| 7159 | 7158 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
| 7160 | - FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 7159 | + FROM ' . prefixTable('nested_tree').' WHERE id = %i', |
|
| 7161 | 7160 | $groupe |
| 7162 | 7161 | ); |
| 7163 | 7162 | // Check if it's in a personal folder. If yes, then force complexity overhead. |
@@ -7277,7 +7276,7 @@ discard block |
||
| 7277 | 7276 | // Get item date |
| 7278 | 7277 | $itemRestrictedUsersList = DB::queryFirstRow( |
| 7279 | 7278 | 'SELECT restricted_to |
| 7280 | - FROM ' . prefixTable('items') . ' |
|
| 7279 | + FROM ' . prefixTable('items').' |
|
| 7281 | 7280 | WHERE id = %i', |
| 7282 | 7281 | $itemId |
| 7283 | 7282 | ); |
@@ -7310,7 +7309,7 @@ discard block |
||
| 7310 | 7309 | $now = time(); |
| 7311 | 7310 | $editionLocks = DB::query( |
| 7312 | 7311 | 'SELECT timestamp, user_id, increment_id |
| 7313 | - FROM ' . prefixTable('items_edition') . ' |
|
| 7312 | + FROM ' . prefixTable('items_edition').' |
|
| 7314 | 7313 | WHERE item_id = %i |
| 7315 | 7314 | ORDER BY increment_id DESC', |
| 7316 | 7315 | $itemId |
@@ -7356,7 +7355,7 @@ discard block |
||
| 7356 | 7355 | |
| 7357 | 7356 | // Delete related background tasks if any |
| 7358 | 7357 | $task = DB::queryFirstRow( |
| 7359 | - 'SELECT increment_id FROM ' . prefixTable('background_tasks') . ' |
|
| 7358 | + 'SELECT increment_id FROM '.prefixTable('background_tasks').' |
|
| 7360 | 7359 | WHERE item_id = %i AND finished_at = ""', |
| 7361 | 7360 | $itemId |
| 7362 | 7361 | ); |
@@ -7369,7 +7368,7 @@ discard block |
||
| 7369 | 7368 | // Check if encryption process is still running |
| 7370 | 7369 | DB::queryFirstRow( |
| 7371 | 7370 | 'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id |
| 7372 | - FROM ' . prefixTable('background_tasks') . ' |
|
| 7371 | + FROM ' . prefixTable('background_tasks').' |
|
| 7373 | 7372 | WHERE item_id = %i AND finished_at = "" |
| 7374 | 7373 | ORDER BY increment_id DESC', |
| 7375 | 7374 | $itemId |
@@ -7390,7 +7389,7 @@ discard block |
||
| 7390 | 7389 | } |
| 7391 | 7390 | |
| 7392 | 7391 | return [ |
| 7393 | - 'status' => true, // Encryption in progress |
|
| 7392 | + 'status' => true, // Encryption in progress |
|
| 7394 | 7393 | 'delay' => $delay - $elapsed, // Time remaining before the lock expires |
| 7395 | 7394 | ]; |
| 7396 | 7395 | } |
@@ -7435,7 +7434,7 @@ discard block |
||
| 7435 | 7434 | { |
| 7436 | 7435 | // Check if there's an ongoing background encryption process for the item |
| 7437 | 7436 | $ongoingProcess = DB::queryFirstRow( |
| 7438 | - 'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', |
|
| 7437 | + 'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', |
|
| 7439 | 7438 | $itemId |
| 7440 | 7439 | ); |
| 7441 | 7440 | |
@@ -7453,7 +7452,7 @@ discard block |
||
| 7453 | 7452 | function getUserVisibleFolders(int $userId): array |
| 7454 | 7453 | { |
| 7455 | 7454 | // Query to retrieve visible folders for the user |
| 7456 | - $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId); |
|
| 7455 | + $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId); |
|
| 7457 | 7456 | |
| 7458 | 7457 | // Decode JSON data into an array; return an empty array if the data is invalid |
| 7459 | 7458 | return json_decode($data['visible_folders'], true) ?? []; |
@@ -7477,7 +7476,7 @@ discard block |
||
| 7477 | 7476 | |
| 7478 | 7477 | // Query the access rights for the given roles and folder |
| 7479 | 7478 | $accessTypes = DB::queryFirstColumn( |
| 7480 | - 'SELECT DISTINCT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', |
|
| 7479 | + 'SELECT DISTINCT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', |
|
| 7481 | 7480 | $roles, |
| 7482 | 7481 | $treeId |
| 7483 | 7482 | ); |