chg: [feed] Support unicode for feed preview search

pull/7798/head
Jakub Onderka 2021-10-03 19:42:40 +02:00
parent 629b711524
commit 8a4628c7e2
1 changed files with 12 additions and 17 deletions

View File

@ -673,7 +673,7 @@ class FeedsController extends AppController
$passedArgs = array();
App::uses('SyncTool', 'Tools');
$syncTool = new SyncTool();
$HttpSocket = $syncTool->setupHttpSocketFeed($feed);
$HttpSocket = $syncTool->setupHttpSocketFeed();
try {
$events = $this->Feed->getManifest($feed, $HttpSocket);
} catch (Exception $e) {
@ -682,28 +682,25 @@ class FeedsController extends AppController
}
if (!empty($this->params['named']['searchall'])) {
$searchAll = trim(strtolower($this->params['named']['searchall']));
$searchAll = trim(mb_strtolower($this->params['named']['searchall']));
foreach ($events as $uuid => $event) {
$found = false;
if ($uuid === $searchAll) {
$found = true;
continue;
}
if (!$found && strpos(strtolower($event['info']), $searchAll) !== false) {
$found = true;
if (strpos(mb_strtolower($event['info']), $searchAll) !== false) {
continue;
}
if (!$found && strpos(strtolower($event['Orgc']['name']), $searchAll) !== false) {
$found = true;
if (strpos(mb_strtolower($event['Orgc']['name']), $searchAll) !== false) {
continue;
}
if (!$found && !empty($event['Tag'])) {
if (!empty($event['Tag'])) {
foreach ($event['Tag'] as $tag) {
if (strpos(strtolower($tag['name']), $searchAll) !== false) {
$found = true;
if (strpos(mb_strtolower($tag['name']), $searchAll) !== false) {
continue 2;
}
}
}
if (!$found) {
unset($events[$uuid]);
}
unset($events[$uuid]);
}
}
foreach ($filterParams as $k => $filter) {
@ -722,9 +719,7 @@ class FeedsController extends AppController
$params = $customPagination->createPaginationRules($events, $this->passedArgs, $this->alias);
$this->params->params['paging'] = array($this->modelClass => $params);
$events = $customPagination->sortArray($events, $params, true);
if (is_array($events)) {
$customPagination->truncateByPagination($events, $params);
}
$customPagination->truncateByPagination($events, $params);
if ($this->_isRest()) {
return $this->RestResponse->viewData($events, $this->response->type());
}