Added press. Added tracking.

This commit is contained in:
2018-06-04 01:54:32 +02:00
committed by Stefan Rohde-Enslin
parent 94757eecc3
commit f15684f85e
10 changed files with 231 additions and 25 deletions

View File

@ -12,9 +12,20 @@ require_once __DIR__ . "/htmlToTeX.php";
ensureEnvironment();
if (!isset($_GET['t']) or $_GET['t'] == "about") {
$sourceFolder = "contents";
$sourceFile = "brochure";
$sourceTeXFile = "contentsFrontend";
}
else if (!isset($_GET['t']) or $_GET['t'] == "press") {
$sourceFolder = "press";
$sourceFile = "press_review";
$sourceTeXFile = "contentsIntroductionPress";
}
// Find out current language
$availableLangs = scanDirConts(__DIR__ . "/contents"); // Those languages are available, for which there are files
$availableLangs = scanDirConts(__DIR__ . "/$sourceFolder"); // Those languages are available, for which there are files
foreach ($availableLangs as $key => $value) {
$availableLangs[$key] = str_replace(".htm", "", $value);
}
@ -25,7 +36,7 @@ else $lang = lang_getfrombrowser($availableLangs, 'de', null, false);
// Load HTML document to PHP DOMDocument
$content = new DOMDocument();
$content->load(__DIR__ . "/contents/$lang.htm");
$content->load(__DIR__ . "/$sourceFolder/$lang.htm");
// Find out title
@ -33,20 +44,20 @@ $title = $content->getElementsByTagName("h1")[0]->nodeValue;
// Generate PDF if need be.
# if (filemtime(__DIR__ . "/tex/$lang/contentsFrontend.tex") -5000 < filemtime(__DIR__ . "/contents/$lang.htm")) {
if (filemtime(__DIR__ . "/tex/$lang/$sourceTeXFile.tex") -5000 < filemtime(__DIR__ . "/$sourceFolder/$lang.htm")) {
foreach ($content->getElementsByTagName("section") as $c) {
DOMtoTeX($c, "tex/$lang");
}
runPDF("tex/$lang", "brochure", "brochure.pdf", $title, $lang, true);
runPDF("tex/$lang", "$sourceFile", "$sourceFile", $title, $lang, true);
# }
}
// Print HTML page.
$content = file_get_contents(__DIR__ . "/contents/$lang.htm");
$content = file_get_contents(__DIR__ . "/$sourceFolder/$lang.htm");
$content = str_replace("\\today", date("Y-m-d", filemtime("contents/$lang.htm")), $content);
$content = str_replace("\\today", date("Y-m-d", filemtime(__DIR__ . "/$sourceFolder/$lang.htm")), $content);
echo printHTMLPage("about:" . $title, $content, $lang, $availableLangs);