N°3207 - Global search: Add possibility to open history items in a new tab

This commit is contained in:
Molkobain
2021-01-21 15:50:04 +01:00
parent 63c1a1d2d3
commit fa0ea7ed77
3 changed files with 16 additions and 12 deletions

View File

@@ -107,18 +107,22 @@ class GlobalSearchHelper
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
static::TruncateHistory($aHistoryEntries);
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
// Add HTML label if missing
if(!isset($aHistoryEntries[$iIdx]['label_html']))
{
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml($aHistoryEntries[$iIdx]['query']);
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++){
$sRawQuery = $aHistoryEntries[$iIdx]['query'];
// Make icon URL absolute
if(isset($aHistoryEntries[$iIdx]['icon_url'])){
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
}
// Set absolute URL
if(isset($aHistoryEntries[$iIdx]['icon_url']))
{
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
// Add HTML label if missing
if(!isset($aHistoryEntries[$iIdx]['label_html'])) {
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml($sRawQuery);
}
// Add URL
if(!isset($aHistoryEntries[$iIdx]['target_url'])){
$aHistoryEntries[$iIdx]['target_url'] = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=full_text&text='.urlencode($sRawQuery);
}
}