<?php
/* Einbinden oft benötigter Funktionen */
include_once($rel."libraries/BTPL_functions.inc.php");
/* Ableitung eines Optionen Objektes für Download Optionen */
$dlOption = new CBOption();
$dlOption->setModule("download");
$dlOption->getOptionList();
/*
* Queries generieren
* abhängig vom Ausgangspunkt beim laden des Moduls (ist $id gesetzt oder nicht)
* müssen verschiedene Queries generiert werden. Wenn $id nicht gesetzt,
* dann alle Kategorien anzeigen, die download als zuständiges Modul
* angegeben haben
* File Queries werden nur generiert, wenn $id bekannt
*/
if (!empty($fid) && ereg("(^[1-9]?[0-9]*$)", $fid)) {
/* Alle Dateien der aktuellen Rubrik */
$fileRow = mysql_fetch_object(mysql_query("SELECT * FROM ".TABLE."_mm_files AS file, ".TABLE."_user AS user WHERE user.userid = file.userid AND file.fileID = '$fid'"));
$id = $fileRow->branchID;
/*
* Herausfinden des Pfades an Rubriken, nebenbei auslesen
* der aktuellen Rubrik
*/
$counter = 1;
$actualID = $id;
$rootParentFound = false;
do {
/* Daten der aktuellen Rubrik */
$branchPathQuery = mysql_fetch_object(mysql_query("SELECT name, branchID, module, parentID, branchName, description FROM ".TABLE."_mm_folder WHERE branchID = '$actualID'"));
if($counter == 1) {
$actualBranchRow = $branchPathQuery;
}
$pathToRootName[] = $branchPathQuery->name;
$pathToRootID[] = $branchPathQuery->branchID;
$pathToRootDesc[] = $branchPathQuery->decription;
$actualID = $branchPathQuery->parentID;
if($branchPathQuery->module == 'download') {
$rootParentFound = true;
}
if($branchPathQuery->parentID == '0' || $branchPathQuery->parentID == '') {
$rootParentFound = true;
}
++$counter;
} while($rootParentFound != true);
$pathToRootName = array_reverse($pathToRootName);
$pathToRootDesc = array_reverse($pathToRootDesc);
$pathToRootID = array_reverse($pathToRootID);
$tpl->assign("pathData",
array ( "name" => $pathToRootName,
"id" => $pathToRootID
)
);
/* Speicherung des Pfades zum aktuellen Uploadverzeichnis */
$actualBranchPath = $path["cb"].$cbDirUploads."files/".$actualBranchRow->branchName."/";
/* Zuweisung der Daten des aktuellen Zweiges an das Template */
$tpl->assign("actualBranch",
array ( "name" => $actualBranchRow->name,
"id" => $actualBranchRow->branchID,
"branchName" => $actualBranchRow->branchName,
"parentID" => $actualBranchRow->parentID,
"desc" => $actualBranchRow->description,
"status" => $actualBranchRow->status
)
);
/*
* Abrage der einzelnen Dateien und Ermittlung der Metadaten wie
* Größe usw. Umwandlung des Datums in einen Timestamp. Verarbeitung
* der Daten
*/
/* Zuweisung der Daten ans Template */
$tpl->assign("fileQuerySet", "1");
$tpl->assign("fileData",
array ( "name" => $fileRow->filename,
"username" => $fileRow->name,
"size" => fsize($actualBranchPath.$fileRow->filename),
"fileID" => $fileRow->fileID,
"typeID" => $fileRow->typeID,
"userID" => $fileRow->userid,
"keywords" => $fileRow->keywords,
"title" => $fileRow->title,
"options" => $fileRow->options,
"param" => $fileRow->parameter,
"date" => strtotime($fileRow->insertdate),
"desc" => $fileRow->description
)
);
$type = "download";
$entryID = $fid;
$idLabel = "fid";
$submitLabel = "DL_submit";
$outputOrder = "ORDER BY datetime ASC";
$outputLimit = "";
if($cbOption->getSingleOption("comment")) {
include($rel."libraries/comment/insertComment.php");
include($rel."libraries/comment/displayComments.php");
$tpl->assign("commentLink", "1");
} else {
$tpl->assign("commentLink", "0");
}
include($rel."libraries/comment/postComment.php");
}
/* Ausgabe des Templates */
$tpl->display("dl_detailView.template");
?>