86 lines
1.7 KiB
PHP
86 lines
1.7 KiB
PHP
<?PHP
|
|
/**
|
|
* This file runs the search.
|
|
*
|
|
* @file
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
|
*/
|
|
|
|
// Include functions and settings.
|
|
|
|
require_once __DIR__ . "/inc/functions.php";
|
|
require_once __DIR__ . "/inc/search.php";
|
|
|
|
// Ensure working environment for frontend.
|
|
|
|
ensureEnvironment();
|
|
$pages = loadPublicPages(); // Load overview of pages.
|
|
|
|
/*
|
|
* Load data.
|
|
*/
|
|
|
|
/*
|
|
* Output
|
|
*/
|
|
|
|
echo printPublicHead($settings, "search", $settings['pageTitle'], $settings['logo']);
|
|
echo printPublicHeader($settings['pageTitle']);
|
|
echo printStaticPagePart("banner", "header"); // Print aside (if need be)
|
|
|
|
echo generatePublicNav($pages);
|
|
|
|
echo '
|
|
<div id="mainWrapper">
|
|
';
|
|
|
|
// Print main content
|
|
echo '
|
|
<main>';
|
|
|
|
if (!isset($_GET['q'])) {
|
|
|
|
echo '
|
|
<h1><span class="toTranslate" data-content="Search"></span></h1>
|
|
';
|
|
|
|
generateSearchBar();
|
|
|
|
}
|
|
else {
|
|
|
|
$getArgsForMD = [];
|
|
foreach ($_GET as $key => $value) $getArgsForMD[] = "$key=$value";
|
|
|
|
echo '
|
|
<h1><span class="toTranslate" data-content="SearchingFor"></span> "' . $_GET['q'] . '"</h1>
|
|
|
|
<section>
|
|
<h2><span class="toTranslate" data-content="ResultsInPages"></span></h2>
|
|
' . displaySearchResults($_GET['q']) . '
|
|
</section>
|
|
|
|
<section id="mdSearchObjs">
|
|
<h2><span class="toTranslate" data-content="ResultsInObjects"></span></h2>
|
|
' . searchMDObjects(array_merge(["sv=" . $_GET['q']], $getArgsForMD), $settings) . '
|
|
</section>
|
|
';
|
|
|
|
}
|
|
|
|
echo '
|
|
</main>
|
|
';
|
|
|
|
echo printStaticPagePart("aside", "aside"); // Print aside (if need be)
|
|
|
|
echo '
|
|
</div>';
|
|
|
|
echo printStaticPagePart("footer", "footer"); // Print footer (if need be)
|
|
|
|
echo printPublicEnd();
|
|
|
|
?>
|