252 lines
No EOL
9.1 KiB
PHP
252 lines
No EOL
9.1 KiB
PHP
<img src="buttons/pl4tamodeler.png" onclick="closeAll()" onmouseover="mouseHover('Home')" onmouseout='mouseHoverOut("")' alt="" id="pl4tformBtn">
|
|
|
|
|
|
<?php
|
|
|
|
include_once 'includes/Parsedown.php';
|
|
$Parsedown = new Parsedown();
|
|
|
|
|
|
|
|
$id = $_POST['id'];
|
|
|
|
$item = $id;
|
|
|
|
|
|
// $filesPath = '/var/www/pl4tform.org/website/data/files/';
|
|
// $filesLink = 'https://pl4tform.org/data/files/';
|
|
$filesPath = '/var/www/pl4tform.org/website/ncdata/';
|
|
$filesLink = 'https://pl4tform.org/ncdata/';
|
|
|
|
|
|
|
|
if(str_contains($id,"sacha")) {
|
|
// echo "yoooooooitsalink: ".$id;
|
|
echo "<div class='focusBox' id='focusBoxImage $file_tags'>";
|
|
echo "<button class='closeFocusBtn' id='closeFocusBtnImage' onclick='focusClose()'>close</button>";
|
|
|
|
echo "<div class='' id='focusImage' style='background-image: url($id)'></div>";
|
|
echo "</div>";
|
|
}
|
|
|
|
|
|
elseif(strlen($id > "1")) {
|
|
|
|
// echo "hallo??";
|
|
// Einbinden der getFileInfo.php Datei
|
|
include('includes/nc-one-file-request.php');
|
|
|
|
// Beispiel: Datei-ID, die du abfragen möchtest
|
|
$file_id = $id;
|
|
|
|
// 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'];
|
|
|
|
$itemPath = $filesPath.$file_name;
|
|
$itemLink = $filesLink.$file_name;
|
|
|
|
// Prüfen, ob der Dateiname mit einem Datum im gewünschten Format beginnt (YYMMDD-HHMM oder YYMMDD_HHMM)
|
|
if (preg_match('/^(\d{2})(\d{2})(\d{2})[-_](\d{4})/', $file_name, $matches)) {
|
|
// Extrahiere Jahr, Monat, Tag, Stunde und Minute
|
|
$file_year = $matches[1]; // Jahr (z.B. "21" wird zu "2021")
|
|
$file_month = $matches[2]; // Monat
|
|
$file_day = $matches[3]; // Tag
|
|
$file_hour = substr($matches[4], 0, 2); // Stunde (erste zwei Zeichen)
|
|
$file_minute = substr($matches[4], 2, 2); // Minute (letzte zwei Zeichen)
|
|
|
|
|
|
// Entferne Datum und Uhrzeit aus dem Dateinamen, also den Anfang
|
|
$file_title = substr($file_name, strlen($matches[0])); // Rest des Dateinamens nach Datum/Uhrzeit
|
|
|
|
// Finde die Position des letzten Punktes im Dateinamen
|
|
$last_dot_position = strrpos($file_title, '.');
|
|
|
|
// Überprüfe, ob ein Punkt im Dateinamen existiert
|
|
if ($last_dot_position !== false) {
|
|
// Extrahiere den Dateinamen ohne die Erweiterung (alles vor dem letzten Punkt)
|
|
$file_title = substr($file_title, 0, $last_dot_position);
|
|
}
|
|
|
|
// Entferne alles nach dem '@' (falls vorhanden)
|
|
$file_title = strtok($file_title, '@');
|
|
|
|
|
|
// Entferne einen führenden Unterstrich (falls vorhanden)
|
|
$file_title = ltrim($file_title, '_');
|
|
|
|
###### EXTRA CLASSES FOR EXTRA TAGS
|
|
|
|
// if (str_contains($file_tags, "full-page")) {
|
|
// $fullPage = "fullPage";
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (str_contains($mimetype_name, 'image')) {
|
|
echo "<div class='focusBox' id='focusBoxImage $file_tags'>";
|
|
echo "<button class='closeFocusBtn' id='closeFocusBtnImage' onclick='focusClose()'>close</button>";
|
|
|
|
// echo "<img class='' src='$itemPath' width='700px' alt='' >";
|
|
echo "<div class='' id='focusImage' style='background-image: url($itemLink)'></div>";
|
|
echo "</div>";
|
|
}
|
|
|
|
if (str_contains($mimetype_name, 'audio')) {
|
|
|
|
// soundfile
|
|
|
|
echo "<div class='focusBox focusBoxText $file_tags' id='focusBoxSoundDiscription'>";
|
|
|
|
// $item = $SoundPlayItem;
|
|
include('includes/soundfile_titleAnalyse.php');
|
|
|
|
if(str_contains($file_title, "---")) {
|
|
$file_title = str_replace("---", "<br>", $file_title);
|
|
};
|
|
|
|
|
|
$soundInfosFormat = "<div class='soundTitle'><h1>$file_title</h1></div> $file_day.$file_month.$file_year - $file_hour:$file_minute H<br>";
|
|
echo '<div class="soundDiscriptionTitle">' . $soundInfosFormat . '</div> ';
|
|
|
|
|
|
|
|
$soundPlayLink = 'https://pl4tform.org/ncdata/'.$file_name;
|
|
echo '<button id="test1312" class="soundItemBtn soundPlayBtn" onclick=\'audioPlay("'.$soundPlayLink.'","'.$file_title.'");\'>> PLAY</button> ';
|
|
echo '<div class="downloadLink"> <a href="'. $soundPlayLink .'" download="'. $file_name .'"><i class="fa fa-download"></i> Download .MP3 </a></div>';
|
|
|
|
|
|
echo '<div class="soundDiscriptionText">';
|
|
|
|
// $discriptionItemPath = $filesPath.$itemBeforeAt.'.md';
|
|
// include ("$discriptionItemPath");
|
|
|
|
#### discription file:
|
|
|
|
// Datenbankverbindungsdaten
|
|
$servername = "localhost"; // oder der Hostname deines DB-Servers
|
|
$username = "nc-site_request"; // Dein neuer MariaDB Benutzername
|
|
$password = "***"; // Dein Passwort für den neuen Benutzer
|
|
$dbname = "nextcloud"; // Der Name deiner Nextcloud-Datenbank
|
|
|
|
// Verbindung zur MySQL-Datenbank aufbauen
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
|
|
// Verbindung prüfen
|
|
if ($conn->connect_error) {
|
|
die("Verbindung fehlgeschlagen: " . $conn->connect_error);
|
|
}
|
|
|
|
// 1. Abfrage: Alle Dateien, deren Pfad '%files/archive/%' enthält
|
|
$sql1_desc = "SELECT fc.fileid, fc.name AS file_name, fc.path AS file_path, fc.size, fc.mimetype
|
|
FROM oc_filecache AS fc
|
|
WHERE (fc.path LIKE '%files/archive/%" . $file_year . $file_month . $file_day . "%" . $file_hour . $file_minute . "%.md%'
|
|
OR fc.path LIKE '%files/archive/%" . $file_year . $file_month . $file_day . "%" . $file_hour . $file_minute . "%.txt%')
|
|
ORDER BY fc.name DESC";
|
|
|
|
$result1_desc = $conn->query($sql1_desc);
|
|
$row_desc = $result1_desc->fetch_assoc();
|
|
$file_id_desc = $row_desc['fileid'];
|
|
$file_name_desc = $row_desc['file_name'];
|
|
|
|
// echo $file_name_desc;
|
|
|
|
|
|
if (str_contains($file_name_desc,".md")) {
|
|
$file_path_root_desc = '/var/www/nextcloud/data/radio_admin/files/archive/'.$file_name_desc;
|
|
$file_content_desc = file_get_contents($file_path_root_desc);
|
|
$file_content_desc = str_replace(".attachments.", "/ncdata/.attachments.", $file_content_desc);
|
|
echo $Parsedown->text($file_content_desc);
|
|
}
|
|
elseif (str_contains($file_name_desc,".txt")) {
|
|
$file_path_root_desc = '/var/www/nextcloud/data/radio_admin/files/archive/'.$file_name_desc;
|
|
$file_content_desc = file_get_contents($file_path_root_desc);
|
|
echo $file_content_desc;
|
|
}
|
|
|
|
|
|
|
|
echo '</div>';
|
|
|
|
|
|
echo "</div>";
|
|
|
|
}
|
|
|
|
|
|
if (str_contains($mimetype_name, 'markdown')) {
|
|
echo "<div class='focusBox focusBoxText $file_tags' id='focusBoxText'>";
|
|
echo "<button class='closeFocusBtn' id='closeFocusBtnText' onclick='focusClose()'>close</button>";
|
|
|
|
$file_path_root = '/var/www/nextcloud/data/radio_admin/files/archive/'.$file_name;
|
|
$file_content = file_get_contents($file_path_root);
|
|
$file_content = str_replace(".attachments.", "/ncdata/.attachments.", $file_content);
|
|
echo $Parsedown->text($file_content);
|
|
|
|
|
|
// include ("$itemPath");
|
|
echo "</div>";
|
|
}
|
|
|
|
if (str_contains($mimetype_name, 'text/html') or str_contains($mimetype_name, 'text/plain')) {
|
|
echo "<div class='focusBox focusBoxText $file_tags' id='focusBoxText'>";
|
|
echo "<button class='closeFocusBtn' id='closeFocusBtnText' onclick='focusClose()'>close</button>";
|
|
|
|
$file_path_root = '/var/www/nextcloud/data/radio_admin/files/archive/'.$file_name;
|
|
$file_content = file_get_contents($file_path_root);
|
|
echo $file_content;
|
|
|
|
echo "</div>";
|
|
}
|
|
|
|
|
|
if (str_contains($mimetype_name, 'application/pdf')) {
|
|
echo "<div class='focusBox focusBoxText $file_tags' id='focusBoxText'>";
|
|
echo "<button class='closeFocusBtn' id='closeFocusBtnText' onclick='focusClose()'>close</button>";
|
|
|
|
echo "<h1>$file_title</h1> <a href='https://pl4tform.org/ncdata/$file_name' target='_blanck'>====>>> Open in full-screen</a> <br><br>";
|
|
echo "<embed class='pdfembed' src='https://pl4tform.org/ncdata/$file_name' type='application/pdf' /> ";
|
|
|
|
echo "</div>";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
echo "Die Datei mit der ID $file_id wurde nicht gefunden.";
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
<script>
|
|
// $("#focusBackground").addClass("visible");
|
|
$(".focusBox").addClass("visible");
|
|
</script>
|