Publier Globinours 1.0.0-rc.3

This commit is contained in:
Alexandre NOEL 2026-09-03 12:39:15 +02:00
commit 9a2b4068da
325 changed files with 38230 additions and 20 deletions

View file

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
final class SearchController
{
public static function index(): void
{
$q = mb_substr(trim((string) ($_GET['q'] ?? '')), 0, 120);
render('search.php', [
'title' => t('search.title'),
'searchQuery' => $q,
'searchResults' => GlobalSearchService::search($q, 20),
]);
}
public static function json(): void
{
$q = mb_substr(trim((string) ($_GET['q'] ?? '')), 0, 120);
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: private, no-store');
echo json_encode(
['query' => $q, 'groups' => GlobalSearchService::search($q)],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR,
);
}
}