2018-06-01 22:35:44 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
|
|
|
* This file serves the HTML output of the main about page.
|
|
|
|
*/
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
ini_set('display_errors', 1);
|
|
|
|
|
|
|
|
// Load required files and ensure environment.
|
|
|
|
|
|
|
|
require_once __DIR__ . "/functions.php";
|
|
|
|
require_once __DIR__ . "/htmlToTeX.php";
|
|
|
|
|
|
|
|
ensureEnvironment();
|
|
|
|
|
|
|
|
// Find out current language
|
|
|
|
|
|
|
|
$availableLangs = scanDirConts(__DIR__ . "/contents"); // Those languages are available, for which there are files
|
|
|
|
foreach ($availableLangs as $key => $value) {
|
|
|
|
$availableLangs[$key] = str_replace(".htm", "", $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET['lang'])) $lang = $_GET['lang'];
|
|
|
|
else $lang = lang_getfrombrowser($availableLangs, 'de', null, false);
|
|
|
|
|
|
|
|
// Load HTML document to PHP DOMDocument
|
|
|
|
|
|
|
|
$content = new DOMDocument();
|
|
|
|
$content->load(__DIR__ . "/contents/$lang.htm");
|
|
|
|
|
|
|
|
// Find out title
|
|
|
|
|
|
|
|
$title = $content->getElementsByTagName("h1")[0]->nodeValue;
|
|
|
|
|
|
|
|
// Generate PDF if need be.
|
|
|
|
|
2018-06-02 02:03:38 +02:00
|
|
|
if (filemtime(__DIR__ . "/tex/$lang/contentsFrontend.tex") < filemtime(__DIR__ . "/contents/$lang.htm")) {
|
2018-06-01 22:35:44 +02:00
|
|
|
|
|
|
|
foreach ($content->getElementsByTagName("section") as $c) {
|
|
|
|
DOMtoTeX($c, "tex/$lang");
|
|
|
|
}
|
|
|
|
runPDF("tex/$lang", "brochure", "brochure.pdf", $title, $lang, true);
|
|
|
|
|
2018-06-02 02:03:38 +02:00
|
|
|
}
|
2018-06-01 22:35:44 +02:00
|
|
|
|
|
|
|
// Print HTML page.
|
|
|
|
|
|
|
|
$content = file_get_contents(__DIR__ . "/contents/$lang.htm");
|
|
|
|
|
|
|
|
$content = str_replace("\\today", date("Y-m-d", filemtime("contents/$lang.htm")), $content);
|
|
|
|
|
2018-06-02 02:03:38 +02:00
|
|
|
echo printHTMLPage("about:" . $title, $content, $lang);
|
2018-06-01 22:35:44 +02:00
|
|
|
|
|
|
|
?>
|