mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
* Update search.js to use new pre-combined indexes; Support for running search on local docs * Update search.js to use new pre-combined indexes; Support for running search on local docs
26 lines
734 B
PHP
26 lines
734 B
PHP
<?php
|
|
|
|
use phpweb\I18n\Languages;
|
|
|
|
$lang = $_GET["lang"] ?? "en";
|
|
if (empty($_SERVER["DOCUMENT_ROOT"])) {
|
|
$_SERVER["DOCUMENT_ROOT"] = __DIR__ . "/../";
|
|
}
|
|
include __DIR__ . '/../include/prepend.inc';
|
|
if (!isset(Languages::ACTIVE_ONLINE_LANGUAGES[$lang])) {
|
|
header("Location: http://php.net");
|
|
}
|
|
|
|
$combinedIndex = $_SERVER["DOCUMENT_ROOT"] . "/manual/$lang/search-combined.json";
|
|
$tsstring = gmdate("D, d M Y H:i:s ", filemtime($combinedIndex)) . "GMT";
|
|
|
|
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) &&
|
|
($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring)) {
|
|
header("HTTP/1.1 304 Not Modified");
|
|
exit;
|
|
}
|
|
|
|
header("Last-Modified: " . $tsstring);
|
|
header("Content-Type: application/javascript");
|
|
readfile($combinedIndex);
|