" . $cssContent . ""; } else { // Otherwise, add the CSS file to the array array_push($GLOBALS['cssList'], $css); } } else { // If the file doesn't exist or is not readable, add it to the array (optional) array_push($GLOBALS['cssList'], $css); } } function printCSS($defer = true, $elseInline = true) { if(!isset($GLOBALS['cssList'])) { $GLOBALS['cssList'] = array(); } if(sizeof($GLOBALS['cssList']) == 0) { return; } if($defer) { echo ''; echo "\n"; echo ''; echo "\n"; } else { for($i = 0; $i < sizeof($GLOBALS['cssList']); $i++) { if($elseInline) { echo "\n"; } else { echo ''."\n"; echo ''."\n"; } } } $GLOBALS['cssList'] = array(); } function isPHPFileAllowed($fname) { if(getSetting("safety", "allow_php") == "all") { return true; } else if(getSetting("safety", "allow_php") == "single") { $single_files = getSetting("safety", "single_php_files"); $single_files = str_replace(",", "|", $single_files); $list = explode("|", $single_files); return in_array($fname, $list); } else if(getSetting("safety", "allow_php") == "none") { return false; } else { return (bool) getSetting("safety", "allow_php"); } } function searchForStringInFile($searchFor, $filename) { $matches = array(); $handle = @fopen($filename, "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); if(strpos($buffer, $searchFor) !== FALSE) { $matches[] = $buffer; break; // only first match } } fclose($handle); } // show results: // print_r($matches); if(sizeof($matches) > 0) { return $matches[0]; } else { return ""; } } function searchFolderForString($folder, $strToFind) { if(!is_dir($folder)) { return false; } $dir_content = scandir($folder, SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(file_exists($folder."/".$single_file) && !is_dir($folder."/".$single_file)) { $content = file_get_contents($folder."/".$single_file); if (strpos($content, $strToFind) !== false) { return true; } } } return false; } function setNewURL($newurl, $refreshRequired = false) { // example input: http://example.com/foo/bar.php // $_SERVER['PHP_SELF'] /foo/bar.php // $_SERVER['REQUEST_URI'] /index.html // $_SERVER['HTTPS'] set or not set // $_SERVER['HTTP_HOST'] www.xyz.com // /index.php ** /en ** ** www.domain.com $parsedURL = parse_url($newurl); $_SERVER['HTTP_HOST'] = $parsedURL['host']; $_SERVER['REQUEST_URI'] = $parsedURL['path']; if(strlen($parsedURL['query']) > 0) { $_SERVER['REQUEST_URI'] .= "?".$parsedURL['query']; } if($refreshRequired) { // header("Location:".$newurl, true, 301); // echo "**".$newurl."**"; return false; } else { // echo $_SERVER['PHP_SELF']; return true; } } function scandirelseempty($directory, int $sorting_order = SCANDIR_SORT_ASCENDING) { $dir_content = array(); if(file_exists($directory)) { $dir_content = scandir($directory); } return $dir_content; } $_ESCAPEDPOST = array(); foreach ($_POST as $key => $value) { $_ESCAPEDPOST[$key] = htmlspecialchars($value, ENT_QUOTES,"UTF-8"); } $thisPath = trim(substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')), "/"); // echo $thisPath; $expectedURL = trim($_SERVER['REQUEST_URI'], "/"); $localPath = $expectedURL; // echo "::".$thisPath.";;"; // exit; // echo "::".$localPath.";;"; // exit; if(substr($localPath, 0, strlen($thisPath)) == $thisPath) { // echo "^"; // avoid duplicate part url always adding the same fragment of the url $localPath = trim(substr($localPath, strlen($thisPath) + 0), "/"); // echo $localPath; // echo "^"; // exit; } $localPath = trim($localPath, "/"); // echo "*".$expectedURL."*".$localPath; // exit; // echo "??".$localPath."!!"; // exit; $default_language = anu(trim(file_get_contents("site/default_language.txt"))); $language = $default_language; $languageFound = false; $subdirs = explode("/", $localPath); // was: explode("/", $_SERVER['REQUEST_URI']."/"); $subdirLang = 0; $page = ""; foreach($subdirs as $dir) { if(file_exists("site/menu_".anu($dir).".txt")) { $language = anu($dir); $languageFound = true; break; } $subdirLang++; break; } $subpage = ""; if($subdirLang + 1 <= sizeof($subdirs)) { // don't calculate ? & parameters into the page name // echo "-".$subdirs[$subDirLang + 1]."-"; if(strlen($subdirs[$subDirLang + 1]) > 0 && $subdirs[$subDirLang + 1][0] == "?") { $subpage = ""; } else if(strlen($subdirs[$subDirLang + 1]) > 1 && $subdirs[$subDirLang + 1][0] == "/" && $subdirs[$subDirLang + 1][1] == "?") { $subpage = ""; } else { $subpage = anu(strtok($subdirs[$subdirLang + 1], '?')); } } // echo "*".$subpage."*"; // echo "(".$language.((int) $languageFound).")"; if(!$languageFound) { $newurl = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://".trim($_SERVER['HTTP_HOST'], "/"); if(strlen(trim($thisPath, "/")) > 0) { // avoid empty double slashes here $newurl .= "/".trim($thisPath, "/"); } $newurl .= "/".anu($default_language)."/".trim($localPath, "/"); if(setNewURL($newurl)) { goto top; } else { exit; } // header("Location:".$newurl, true, 301); // echo "**".$newurl."**"; // exit; } // check if either the directory or the menu entry exists $subpageExists = false; if(file_exists("site/content_".$language."/".$subpage."/left")) { $subpageExists = true; } if(file_exists("site/content_".$language."/".$subpage."/center")) { $subpageExists = true; } if(file_exists("site/content_".$language."/".$subpage."/right")) { $subpageExists = true; } // echo "EXISTS: ".((int) $subpageExists); $handle = fopen("site/menu_".$language.".txt", "r"); $firstMenu = ""; if($handle) { while (($line = fgets($handle)) !== false) { if(substr(trim($line), 0, 1) == "#") { continue; } $elements = explode("@", trim($line)); if(sizeof($elements) == 2) { if($subpage == anu($elements[1])) { $subpageExists = true; } if($firstMenu == "") { $firstMenu = anu($elements[1]); } } } fclose($handle); } // echo "EXISTS: ".((int) $subpageExists); if(!$subpageExists) { if($subpage == "") { $newurl = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://".trim($_SERVER['HTTP_HOST'], "/"); if(strlen(trim($thisPath, "/")) > 0) { // avoid empty double slashes here $newurl .= "/".trim($thisPath, "/"); } // $newurl .= "/".$default_language."/".trim($firstMenu, "/"); $newurl .= "/".$language."/".trim($firstMenu, "/"); // echo "--".$newurl."--"; // header("Location:".$newurl, true, 301); // exit; if(setNewURL($newurl)) { goto top; } else { exit; } } } if(1 && file_exists("site/content_".$language."/".$subpage."/force_https")) { // force https $checkProto = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://"; $checkDomain = trim($_SERVER['HTTP_HOST'], "/"); $checkURI = trim($_SERVER['REQUEST_URI'], "/"); if($checkProto == "http://") { $newurl = "https://".$checkDomain."/".$checkURI; header("Location:".$newurl, true, 301); // here also a real refresh is required } } $redirectionFound = false; $error404 = false; // page not found $error410 = false; // is gone forever and will never return // if(!$subpageExists) { if(1) { if(file_exists("site/redirections.txt")) { $handle = fopen("site/redirections.txt", "r"); if($handle) { $checkProto = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://"; $checkDomain = trim($_SERVER['HTTP_HOST'], "/"); $checkURI = trim($_SERVER['REQUEST_URI'], "/"); $checkComplete = $checkProto.$checkDomain."/".$checkURI; while (($line = fgets($handle)) !== false) { $countReplaces = 0; $elements = explode("->", trim($line)); if(sizeof($elements) == 2 && strlen($elements[0]) > 0) { $checkComplete = str_replace($elements[0], $elements[1], $checkComplete, $countReplaces); if($countReplaces > 0) { if($elements[1] != "GONE") { $newurl = $checkComplete; header("Location:".$newurl, true, 301); // here a real direction is necessary $redirectionFound = true; } else { $newurl = "GONE"; } } } } fclose($handle); } } if(!$redirectionFound && !$subpageExists) { if($newurl == "GONE") { $error410 = true; // gone forever header($_SERVER["SERVER_PROTOCOL"]." 410 Gone", true, 410); } else { $error404 = true; header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); } } } // check for multiple subpages (avoid multiple pages in one url) if(0) { $subpageCounter = 0; foreach($subdirs AS $single_dir) { $handle = fopen("site/menu_".$language.".txt", "r"); if($handle) { while (($line = fgets($handle)) !== false) { $elements = explode("@", trim($line)); if(sizeof($elements) == 2) { if(anu($single_dir) == anu($elements[1])) { $subpageCounter++; } } } fclose($handle); } } if($subpageCounter > 1 && !$error410) { $error404 = true; header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); } } if(getSetting("general", "session") > 0) { if (session_status() == PHP_SESSION_NONE) { // set session to maximum life time $lifetime = 2147483647; session_set_cookie_params($lifetime); session_start(); } } ?> 0) { echo ''; } else if(isset($default_language) && strlen($default_language) > 0) { echo ''; } else { echo ''; } echo ''; $_POST['language'] = $language; $_ESCAPEDPOST['language'] = htmlspecialchars($_POST['language']); $dir_content = scandirelseempty("site/content_".$language."/".$subpage."/head", SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(substr($single_file, 0, 1) == "'" || substr($single_file, 0, 1) == "#") { continue; } $ending = pathinfo($single_file, PATHINFO_EXTENSION); chdir(__DIR__); if($ending == "txt" || $ending == "html" || $ending == "bb") { $str = file_get_contents("site/content_".$language."/".$subpage."/head/".$single_file); echo bb_parse($str); } chdir(__DIR__); if($ending == "php" && isPHPFileAllowed($single_file)) { ob_start("bb_parse"); include(dirname(__FILE__)."/site/content_".$language."/".$subpage."/head/".$single_file); ob_end_flush(); } chdir(__DIR__); } if(1) { $dir_content = scandirelseempty("site/head_".$language, SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(substr($single_file, 0, 1) == "'" || substr($single_file, 0, 1) == "#") { continue; } $ending = pathinfo($single_file, PATHINFO_EXTENSION); chdir(__DIR__); if($ending == "txt" || $ending == "html" || $ending == "bb") { $str = file_get_contents("site/head_".$language."/".$single_file); echo bb_parse($str); } chdir(__DIR__); if($ending == "php" && isPHPFileAllowed($single_file)) { ob_start("bb_parse"); include(dirname(__FILE__)."/site/head_".$language."/".$single_file); ob_end_flush(); } chdir(__DIR__); } } // load after title $isNoJQuery = searchFolderForString("site/content_".$language."/".$subpage."/head/", "[nojquery]"); if(file_exists("js/lozad.min.js")) { echo ''; } if(!$isNoJQuery) { // jquery is required early echo ''; } ?> '; // [andreas] change on 2022-05-29 make custom.css as inline to avoid reference which makes problems with PageSpeed // addCSS("css/custom.css"); addCSS("../site/custom.css"); addCSS("site/custom.css"); addCSS("css/default.css"); addCSS("css/topnavdropdown.css"); addCSS("css/fancy-button.css"); addCSS("css/stars.css"); printCSS(false); ?> '; echo '@media screen and (max-width: '.$top_bar_width.'px) {'; echo ' .a-topnav a:not(:first-child), .a-dropdown .a-dropbtn {'; echo ' display: none;'; echo ' }'; echo ' .a-topnav a.a-icon {'; echo ' float: right;'; echo ' display: block;'; echo ' }'; echo '}'; echo '@media (min-width:'.$horizontal_wrap.'px) {'; echo ' .a-third {'; echo ' width:33.33333%;'; echo ' }'; echo ' .a-twothird {'; echo ' width:66.66666%;'; echo ' }'; echo '}'; echo '@media screen and (max-width: '.$top_bar_width.'px) {'; ?> .a-topnav.responsive { position: relative; } .a-topnav.responsive .a-icon { position: absolute; right: 0; top: 0; } .a-topnav.responsive a { float: none; display: block; text-align: left; } .a-topnav.responsive .a-dropdown { float: none; } .a-topnav.responsive .a-dropdown-content { position: relative; } .a-topnav.responsive .a-dropdown .a-dropbtn { display: block; width: 100%; text-align: left; } } 0) { array_push($menu_link_complete, "/".$thisPath."/".$language."/".anu(trim($elements[1]))); } else { // avoid double slash array_push($menu_link_complete, "/".$language."/".anu(trim($elements[1]))); } // echo "/".$thisPath."/".$language."/".trim($elements[1])."**"; if(strpos($elements[1], ":") !== false) { array_push($menu_link_external, $elements[1]); } else { array_push($menu_link_external, ""); } } else { array_push($menu_link, "#"); array_push($menu_link_complete, "#"); array_push($menu_link_external, ""); } } fclose($handle); } else { // echo "missing menu"; } ?>
' && $dropdown_name == "") { // if($i < sizeof($menu_name) - 1 && substr($menu_name[$i + 1], 0, 1) == '>' && substr($menu_name[$i + 0], 0, 1) != '>') { $dropdown_name = $menu_name[$i]; for($t = $i + 1; $t < sizeof($menu_name); $t++) { if(substr($menu_name[$t], 0, 1) != '>') { break; } if($subpage == $menu_link[$t]) { $dropdown_selected = true; } } $hide_item = true; } $isSelected = ""; $isImage = ""; $isFirst = ""; if($subpage == $menu_link[$i]) { // use $subpage instead of $dir because only one item must be selected $isSelected = ' class="a-selected" '; } foreach($subdirs as $dir) { if(strpos($menu_name[$i], "') { if(!$dropdown_open) { $dropdown_open = true; echo '
'; if($dropdown_selected) { echo ' '; echo '
'; // $dropdown_name = ""; $dropdown_selected = false; } if(!$hide_item) { // sub menu items? if(strlen($menu_link_external[$i]) > 0) { echo ''.substr($menu_name[$i], 1).''; } else { echo ''.substr($menu_name[$i], 1).''; } } } else { if($dropdown_open) { $dropdown_open = false; $dropdown_name = ""; echo '
'; echo '
'; echo '
'; } if(!$hide_item) { // top menu items? if(strlen($menu_link_external[$i]) > 0) { echo ''.$menu_name[$i].''; } else { echo ''.$menu_name[$i].' '; } } } if($dropdown_open && $i < sizeof($menu_name) && substr($menu_name[$i + 1], 0, 1) != '>') { if($dropdown_open) { $dropdown_open = false; $dropdown_name = ""; echo '
'; echo '
'; echo '
'; } } } if($dropdown_open) { $dropdown_open = false; $dropdown_name = ""; echo '
'; echo ' '; echo ''; } echo ''; // closing a-menu-texts (required for counting the width) //echo ""; echo ''; ?> '; echo bb_parse("[p]Error 410. Gone forever.[/p]"); echo ''; } else if($error404) { echo '
'; echo bb_parse("[p]Error 404. Page not found.[/p]"); echo '
'; } ?> '; ?> '; } chdir(__DIR__); include("helper/mail_post_content.php"); chdir(__DIR__); if(0) { // enable to test cookie bar again / debug ?> Click here to revoke the Cookie consent
'; } else if($has_left && !$has_center && !$has_right) { // is the only one echo '
'; } else if($has_left) { // has center OR right echo '
'; } else { echo '
'; } $dir_content = scandirelseempty("site/content_".$language."/".$subpage."/left", SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(substr($single_file, 0, 1) == "'" || substr($single_file, 0, 1) == "#") { continue; } $ending = pathinfo($single_file, PATHINFO_EXTENSION); chdir(__DIR__); if($ending == "txt" || $ending == "html" || $ending == "bb") { $str = file_get_contents("site/content_".$language."/".$subpage."/left/".$single_file); echo bb_parse($str); } chdir(__DIR__); if($ending == "php" && isPHPFileAllowed($single_file)) { ob_start("bb_parse"); include(dirname(__FILE__)."/site/content_".$language."/".$subpage."/left/".$single_file); ob_end_flush(); } chdir(__DIR__); } ?>
'; } else if($has_center && !$has_left && !$has_right) { // is the only one echo '
'; } else if($has_center) { // has left OR right echo '
'; } else { echo '
'; } $dir_content = scandirelseempty("site/content_".$language."/".$subpage."/center", SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(substr($single_file, 0, 1) == "'" || substr($single_file, 0, 1) == "#") { continue; } $ending = pathinfo($single_file, PATHINFO_EXTENSION); chdir(__DIR__); if($ending == "txt" || $ending == "html" || $ending == "bb") { $str = file_get_contents("site/content_".$language."/".$subpage."/center/".$single_file); echo bb_parse($str); } chdir(__DIR__); if($ending == "php" && isPHPFileAllowed($single_file)) { ob_start("bb_parse"); include(dirname(__FILE__)."/site/content_".$language."/".$subpage."/center/".$single_file); ob_end_flush(); } chdir(__DIR__); } ?>
'; } else if($has_right && !$has_center && !$has_left) { // is the only one echo '
'; } else if($has_left) { // has left -> right is larger echo '
'; } else if($has_right) { // has center -> right is smaller echo '
'; } else { echo '
'; } $dir_content = scandirelseempty("site/content_".$language."/".$subpage."/right", SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(substr($single_file, 0, 1) == "'" || substr($single_file, 0, 1) == "#") { continue; } $ending = pathinfo($single_file, PATHINFO_EXTENSION); chdir(__DIR__); if($ending == "txt" || $ending == "html" || $ending == "bb") { $str = file_get_contents("site/content_".$language."/".$subpage."/right/".$single_file); echo bb_parse($str); } chdir(__DIR__); if($ending == "php" && isPHPFileAllowed($single_file)) { ob_start("bb_parse"); include(dirname(__FILE__)."/site/content_".$language."/".$subpage."/right/".$single_file); ob_end_flush(); } chdir(__DIR__); } ?>
'; $dir_content = scandirelseempty("site/footer_".$language, SCANDIR_SORT_ASCENDING); foreach($dir_content AS $single_file) { if(substr($single_file, 0, 1) == "'" || substr($single_file, 0, 1) == "#") { continue; } $ending = pathinfo($single_file, PATHINFO_EXTENSION); chdir(__DIR__); if($ending == "txt" || $ending == "html" || $ending == "bb") { $str = file_get_contents("site/footer_".$language."/".$single_file); echo bb_parse($str); } chdir(__DIR__); if($ending == "php" && isPHPFileAllowed($single_file)) { ob_start("bb_parse"); include(dirname(__FILE__)."/site/footer_".$language."/".$single_file); ob_end_flush(); } chdir(__DIR__); } // echo '

'; if(0) { // this is not used at all - the functionality is in helper_bb echo '

'; // echo "*"; $all_languages = anu(explode("|", trim(file_get_contents("site/languages.txt"))), "|"); // print_r($all_languages); // echo "!!".file_get_contents("site/languages.txt")."!!"; // echo getcwd(); // echo file_exists("site/languages.txt"); if(!empty($all_languages) && sizeof($all_languages) > 1) { // foreach(array_reverse($all_languages) AS $flag) { foreach($all_languages AS $flag) { // echo $flag; // echo "X"; // echo $flag; $flag_split = explode("-", $flag); // echo $flag_split[0]; // echo ".".strtolower($flag_split[1]); $flag_icon = $flag_dir = $flag_split[0]; if(sizeof($flag_split) > 1) { $flag_icon = strtolower($flag_split[1]); } $from = '/'.preg_quote("/".$language."/", '/').'/'; $lnLink = preg_replace($from, "/".$flag_dir."/", $_SERVER['REQUEST_URI'], 1); echo ''; echo ''; echo ''; } } echo '
'; // echo '

'; } // non-critical css at the end before closing body tag to accelerate page loading printCSS(); ?> '; echo "\n"; // echo ''; echo ''; echo "\n"; $trackingID = getSetting("analytics", "tracking_id"); if(strlen($trackingID) >= 4 && $_COOKIE['cookiebar'] == "CookieAllowed") { // use google analytics echo ""; if(getSetting("analytics", "track_outlinks") == 1 || getSetting("analytics", "track_events") == 1) { // also track outgoing clicks echo ""; } } if(1) { // fallback for ad-blocker ?>

' . $js_str . ''; } chdir(__DIR__); } ?>