Pl4tform_website/hotgluetransformation.php

441 lines
12 KiB
PHP
Raw Normal View History

2025-02-03 19:29:59 +01:00
<script type="text/javascript" src="includes/nowLive.js"></script>
<script type="text/javascript" src="includes/soundplay.js"></script>
<!-- PL$TFORM BUTTON BTN -->
<img src="buttons/pl4tamodeler.png" onclick="closeAll()" onmouseover="mouseHover('Home')" onmouseout='mouseHoverOut("")' alt="" id="pl4tformBtn">
<?php
// Einbinden der getFileInfo.php Datei
include('includes/nc-one-file-request.php');
if (isset($_POST["mapId"])) {
$mapId = substr($_POST["mapId"], 0, strlen($_POST["mapId"]));
}
else {
$mapId = "start";
}
$hotglueSitePathFromDatabase = "hotglue/content/".$mapId."/";
$hotglueSitePath = "/var/www/pl4tform.org/website/" . $hotglueSitePathFromDatabase;
$directoryPath = $hotglueSitePath . "head/";
$files = scandir($directoryPath);
foreach($files as $file) {
$filePath = $directoryPath . $file;
$objectType = "";
$zIndex = "";
$height = "";
$heightProcent = "";
$top = "";
$topProcent = "";
$width = "";
$widthProcent = "";
$left = "";
$leftProcent = "";
$cat = "";
$path = "";
$text = "";
$fontSize = "0px";
$fontColor = "";
$backgroundColor = "";
$objectWidth = 0;
$objectData = [];
$lineNumber = 0;
$lines = file($filePath);
foreach($lines as $line) {
$lineNumber++;
$line;
$lineSplit = preg_split("/[:]+/", $line);
$title = $lineSplit[0];
$content = $lineSplit[1];
$objectData[$title] = $content;
if (strlen($line) < 2) {
// echo "yoyoyo";
$textStartLine = $lineNumber;
// echo "textlinestart: $lineNumber";
break;
}
}
if ($file == "page") {
if ($objectData['page-background-file']) {
$backgroundImage = $objectData['page-background-file'];
$backgroundImageURL = "https://pl4tform.org/" . $hotglueSitePathFromDatabase . "shared/" . $backgroundImage;
// echo "<div id='mapOverBackground' style='background-image: url($backgroundImageURL);' onclick='back()'></div>";
echo "<div id='mapOverBackground' style='background-image: url($backgroundImageURL);'></div>";
}
elseif ($objectData['page-background-color']) {
$backgroundColor = $objectData['page-background-color'];
// echo "<div id='mapOverBackground' style='background-color: $backgroundColor;' onclick='back()'></div>";
echo "<div id='mapOverBackground' style='background-color: $backgroundColor;'></div>";
}
}
else {
if ($objectData['object-width'] > 1) {
///////////////// PARSING BRGINN /////////////////
$objectType = $objectData['type'];
$zIndex = $objectData['object-zindex'];
$height = $objectData['object-height'];
$heightNumb = substr($height, 0, strlen($height)-3);
$screenHeight = 907;
$heightCalc = $heightNumb / $screenHeight * 100;
$heightProcent = $heightCalc . "vh";
$top = $objectData['object-top'];
$topNumb = substr($top, 0, strlen($lft)-3);
$topCalc = $topNumb / $screenHeight * 100;
$topProcent = $topCalc . "vh";
$width = $objectData['object-width'];
$widthNumb = substr($width, 0, strlen($width)-3);
$screenWidth = 1919;
$widthCalc = $widthNumb / $screenWidth * 100;
$widthProcent = $widthCalc . "vw";
$left = $objectData['object-left'];
$leftNumb = substr($left, 0, strlen($lft)-3);
$leftCalc = $leftNumb / $screenWidth * 100;
$leftProcent = $leftCalc . "vw";
$link = substr($objectData['object-link'], 0, -1);
if (str_contains($objectType, 'image')) {
//// iamg file specifications alayisis
// echo "yes its an image <br>";
$path = "https://pl4tform.org/".$hotglueSitePathFromDatabase."shared/" . $objectData['image-file'];
}
// elseif (str_contains($objectType, 'iframe')) {
// $iframeUrl = $objectData['iframe-url'];
// $objectWidth = $objectData['object-width'];
// }
else {
//// text file specifications alayisis
$lastLines = array_slice($lines, $textStartLine);
$text = implode("<br>", $lastLines);
// echo "its a text <br> text: $text<br>";
$path = "";
$fontSize = $objectData['text-font-size'];
$fontColor = $objectData['text-font-color'];
$backgroundColor = $objectData['text-background-color'];
$objectWidth = $objectData['object-width'];
// attention there will be "" inside the font family
$fontFamily = $objectData['text-font-family'];
$fontStyle = $objectData['text-font-style'];
$fontWeight = $objectData['text-font-weight'];
$letterSpacing = $objectData['text-letter-spacing'];
$lineHeight = $objectData['text-line-height'];
$paddingTop = $objectData['text-padding-y'];
$paddingBottom = $objectData['text-padding-y'];
$paddingLeft = $objectData['text-padding-x'];
$paddingRight = $objectData['text-padding-x'];
$textAlign = $objectData['text-align'];
$wordSpacing = $objectData['text-word-spacing'];
$iframeUrl = $objectData['iframe-url'];
}
///////////////// PARSING END /////////////////
$ratioHW = $heightNumb / $widthNumb;
$heightNew = $ratioHW * $widthCalc . "vw";
$ratioTW = $topNumb / $widthNumb;
$topNew = $ratioTW * $widthCalc . "vw";
$url = "";
if (strlen($link < 1)) {
#### NOFUNCTION
$btnType = 'noFunctionBtn';
$load = "";
$directFocus = "";
$cat = "";
$onclick = '';
$loadOnHover = $link;
$loadOnHover_name = $loadOnHover;
}
elseif (str_contains($link, "livestream")){
##### LIVESTREAM
$load = "loadLiveBtn";
$directFocus = "";
$cat = "";
$onclick = 'audioPlay("https://pl4tform.org/stream","livestream")';
$loadOnHover = 'Livestream';
$loadOnHover_name = "Livestream";
}
elseif (str_contains($link, "play")){
##### DIRECT PLAY
$load = "";
$cat = $link;
$loadOnHover = "";
$cat = str_replace('play', '', $cat);
$file_id = $cat;
// Abrufen der Datei-Informationen
$file_info = getFileInfo($file_id);
// Überprüfen, ob die Datei gefunden wurde
if ($file_info) {
$file_id = $file_info['file_id'];
$file_name = $file_info['file_name'];
$file_size = $file_info['file_size'];
$mimetype_name = $file_info['mimetype_name'];
$file_tags = $file_info['file_tags'];
$file_title = $file_info['file_title'];
}
// echo "CAAAT: $cat and file_name: $file_name";
$loadOnHover_name = $file_title;
$onclick = 'audioPlay("https://pl4tform.org/ncdata/'.$file_name.'","'.$file_name.'");';
}
########## HAVE TO FIX HOVER LATER !!!
// elseif (str_contains($link, "hover")){
// $load = "hoverFocusBtn";
// $directFocus = "";
// $cat = $btnId;
// if (str_contains($btnId, ".txt")) {
// $loadOnHover = file_get_contents("https://pl4tform.org/data/files/".$cat);
// $loadOnHover = str_replace("\n", '', $loadOnHover);
// }
// else {
// $loadOnHover = $btnId;
// }
// $onclick = '';
// }
elseif (str_contains($link, "archive")){
##### ARCHIVE CHRONOLOGIC
$load = "loadMapBtn";
$directFocus = "";
$btnId = $link;
$cat = $btnId;
$onclick = 'openMap("archive")';
$loadOnHover = "Chronologic Archive";
$loadOnHover_name = $loadOnHover;
}
elseif (str_contains($link, "url")){
##### ARCHIVE CHRONOLOGIC
$load = "loadMapBtn";
$directFocus = "";
$btnId = $link;
$cat = $btnId;
$onclick = '';
$url = str_replace("url","https://",$link);
$loadOnHover = $url;
$loadOnHover_name = $loadOnHover;
}
elseif (str_contains($link, "home")){
##### HOME CLOSE ALL
$load = "loadMapBtn";
$directFocus = "";
$btnId = $link;
$cat = $btnId;
$onclick = 'closeAll()';
$loadOnHover = "Home";
$loadOnHover_name = $loadOnHover;
}
elseif (str_contains($link, "search")){
##### SEARCH
$load = "loadMapBtn";
$directFocus = "";
$btnId = $link;
$cat = $btnId;
$onclick = 'openSearchBar()';
$loadOnHover = "Search";
$loadOnHover_name = $loadOnHover;
}
elseif(preg_match("/[a-z]/i", $link) OR strlen($link < 3)){
##### MAP (and old zone) (it has letters !)
$load = "loadMapBtn";
$directFocus = "";
$btnId = $link;
$cat = $btnId;
$onclick = 'openMap("'.$btnId.'")';
$loadOnHover = $link;
$loadOnHover_name = $loadOnHover;
}
elseif (strlen($link > 3) AND preg_match('~[0-9]+~', $link)) {
// echo "itsafocusss";
#### FOCUS
$btnType = "focus";
$load = "";
$cat = $link;
$loadOnHover = $cat;
// Beispiel: Datei-ID, die du abfragen möchtest
$file_id = $cat;
// Abrufen der Datei-Informationen
$file_info = getFileInfo($file_id);
// Überprüfen, ob die Datei gefunden wurde
if ($file_info) {
$file_id = $file_info['file_id'];
$file_name = $file_info['file_name'];
$file_size = $file_info['file_size'];
$mimetype_name = $file_info['mimetype_name'];
$file_tags = $file_info['file_tags'];
$file_title = $file_info['file_title'];
}
// echo "CAAAT: $cat and file_name: $file_name";
$loadOnHover_name = $file_title;
$onclick = 'focusItem("'.$file_id.'");';
}
// $btnType = "NOMOREBTNTYPE";
///////////////// OUTPUT /////////////////
if (strlen($url > 1)) {
echo "<a href='$url'>";
// echo "yoo";
}
if (str_contains($objectType, 'image')) {
// IMAGE
echo "
<div class='image $background' style=' left: $leftProcent; position: absolute; top: $topProcent; width: $widthProcent; height: $heightProcent; z-index: $zIndex;'>
<img src='$path' id='$cat' class='image $load $btnType' onclick='$onclick' onmouseover='mouseHover(\"$loadOnHover_name\")' onmouseout='mouseHoverOut(\"\")' style='border: 0px; height: 100%; margin: 0px; padding: 0px; width: 100%;'>
<div class='hoverText' id='hoverText'></div>
</div>";
}
elseif (str_contains($objectType, 'iframe')) {
// IFRAME
echo "
<div id='' class='iframe' style='height: $heightProcent; left: $leftProcent; position: absolute; top: $topProcent; width: $widthProcent; z-index: 100;'>
<iframe name='' sandbox='allow-forms allow-same-origin allow-scripts allow-top-navigation' style='background-color: transparent; border-width: 0px; height: 100%; overflow: auto; position: absolute; width: 100%;' src='$iframeUrl' scrolling='auto'></iframe>
</div>
";
}
else {
// TEXT
echo "
<div class='text $background $load $btnType' id='$cat' style='left: $leftProcent; position: absolute; top: $topProcent; width: $objectWidth; height: $height; z-index: $zIndex; background-color: $backgroundColor; font-family: $fontFamily; font-size: $fontSize; color: $fontColor; font-style: $fontStyle; font-weight: $fontWeight; letter-spacing: $letterSpacing; line-height: $lineHeight; padding-bottom: $paddingBottom; padding-left: $paddingLeft; padding-right: $paddingRight; padding-top: $paddingTop; text-align: $textAlign; word-spacing: $wordSpacing;' onclick='$onclick' onmouseover='mouseHover(\"$loadOnHover_name\")' onmouseout='mouseHoverOut(\"\")' >
<div style='position: relative; top: -7px;' class='' >$text</div>
<div class='hoverText' id='hoverText'></div>
</div>";
}
if (strlen($url > 1)) {
echo "</a>";
}
}
else {
}
}
};
if (isset($_POST["mapId"])) {
$mapId = substr($_POST["mapId"], 0, strlen($_POST["mapId"]));
echo "</div>";
}
?>