blob: b43820139b7c7d1674d96b797e7722704e596519 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
#===============================================================================
# DEFINE: Administration
#===============================================================================
const ADMINISTRATION = TRUE;
const AUTHENTICATION = TRUE;
#===============================================================================
# INCLUDE: Initialization
#===============================================================================
require '../../core/application.php';
#===============================================================================
# Check for search request
#===============================================================================
if($search = HTTP::GET('q')) {
$PostRepository = Application::getRepository('Post');
$UserRepository = Application::getRepository('User');
foreach($PostRepository->search($search) as $Post) {
$User = $UserRepository->find($Post->get('user'));
$templates[] = generatePostItemTemplate($Post, $User);
}
}
#===============================================================================
# Build document
#===============================================================================
$SearchTemplate = Template\Factory::build('post/search');
$SearchTemplate->set('QUERY', $search);
$SearchTemplate->set('POSTS', $templates ?? []);
$MainTemplate = Template\Factory::build('main');
$MainTemplate->set('NAME', $Language->text('title_post_search'));
$MainTemplate->set('HTML', $SearchTemplate);
echo $MainTemplate;
|