Merge remote-tracking branch 'origin/support/3.0' into develop

# Conflicts:
#	pages/UI.php
#	tests/php-unit-tests/unitary-tests/application/utilsTest.php
This commit is contained in:
Eric Espie
2023-06-01 16:59:59 +02:00
5 changed files with 6 additions and 6 deletions

View File

@@ -480,7 +480,7 @@ class utils
// For URL // For URL
case static::ENUM_SANITIZATION_FILTER_URL: case static::ENUM_SANITIZATION_FILTER_URL:
$retValue = filter_var($value, FILTER_SANITIZE_URL); $retValue = filter_var($value, FILTER_VALIDATE_URL);
break; break;
default: default:

View File

@@ -592,8 +592,8 @@ try
if ($sQuery !== $sFullText) { if ($sQuery !== $sFullText) {
$sQueryLabel = $sFullText; $sQueryLabel = $sFullText;
} }
GlobalSearchHelper::AddQueryToHistory($sQuery, $sQueryIconUrl, $sQueryLabel); GlobalSearchHelper::AddQueryToHistory(utils::EscapeHtml($sQuery), $sQueryIconUrl, $sQueryLabel);
$oP->SetBlockParam('ibo-global-search.sQuery', $sQuery); $oP->SetBlockParam('ibo-global-search.sQuery', utils::EscapeHtml($sQuery));
// Check the needle length // Check the needle length
$iMinLenth = MetaModel::GetConfig()->Get('full_text_needle_min'); $iMinLenth = MetaModel::GetConfig()->Get('full_text_needle_min');

View File

@@ -55,7 +55,7 @@ try
if (array_key_exists('table_inner_id', $aListParams)) if (array_key_exists('table_inner_id', $aListParams))
{ {
$sListId = $aListParams['table_inner_id']; $sListId = utils::HtmlEntities($aListParams['table_inner_id']);
} }
if (array_key_exists('json', $aListParams)) if (array_key_exists('json', $aListParams))

View File

@@ -811,7 +811,7 @@ try {
foreach ($aShortcutClasses as $cShortcutPlugin) { foreach ($aShortcutClasses as $cShortcutPlugin) {
foreach ($cShortcutPlugin::GetShortcutKeys() as $aShortcutKey) { foreach ($cShortcutPlugin::GetShortcutKeys() as $aShortcutKey) {
$sKey = utils::ReadParam($aShortcutKey['id'], $aShortcutKey['key'], true, 'raw_data'); $sKey = utils::ReadParam($aShortcutKey['id'], $aShortcutKey['key'], true, 'raw_data');
$aShortcutPrefs[$aShortcutKey['id']] = strtolower($sKey); $aShortcutPrefs[$aShortcutKey['id']] = strtolower(utils::HtmlEntities($sKey));
} }
} }
appUserPreferences::SetPref('keyboard_shortcuts', $aShortcutPrefs); appUserPreferences::SetPref('keyboard_shortcuts', $aShortcutPrefs);

View File

@@ -830,7 +830,7 @@ class utilsTest extends ItopTestCase
'good element_identifier' => [utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER, 'AD05nb', 'AD05nb'], 'good element_identifier' => [utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER, 'AD05nb', 'AD05nb'],
'bad element_identifier' => [utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER, 'AD05nb+', 'AD05nb'], 'bad element_identifier' => [utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER, 'AD05nb+', 'AD05nb'],
'good url' => [utils::ENUM_SANITIZATION_FILTER_URL, 'https://www.w3schools.com', 'https://www.w3schools.com'], 'good url' => [utils::ENUM_SANITIZATION_FILTER_URL, 'https://www.w3schools.com', 'https://www.w3schools.com'],
'bad url' => [utils::ENUM_SANITIZATION_FILTER_URL, 'https://www.w3schoo<6F><6F>ls.co<63>m', 'https://www.w3schools.com'], 'bad url' => [utils::ENUM_SANITIZATION_FILTER_URL, 'https://www.w3schoo<6F><6F>ls.co<63>m', null],
'raw_data' => ['raw_data', '<Test>\s😃😃😃', '<Test>\s😃😃😃'], 'raw_data' => ['raw_data', '<Test>\s😃😃😃', '<Test>\s😃😃😃'],
]; ];
} }