|
@@ -287,12 +287,21 @@ class document
|
|
|
$filePatch = file::download($_id, DIR_DATAS_DOCS);
|
|
$filePatch = file::download($_id, DIR_DATAS_DOCS);
|
|
|
|
|
|
|
|
if (file_exists($filePatch) && is_readable($filePatch)) {
|
|
if (file_exists($filePatch) && is_readable($filePatch)) {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$file_info = new finfo(FILEINFO_MIME_TYPE);
|
|
$file_info = new finfo(FILEINFO_MIME_TYPE);
|
|
|
$mime_type = $file_info->file($filePatch);
|
|
$mime_type = $file_info->file($filePatch);
|
|
|
- header('Content-Type: ' . $mime_type);
|
|
|
|
|
- header('Content-Length: ' . filesize($filePatch));
|
|
|
|
|
- readfile($filePatch);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Vérification si le fichier est de type XML
|
|
|
|
|
+ if ($mime_type === 'application/xml' || $mime_type === 'text/xml') {
|
|
|
|
|
+ // Chargement du contenu XML
|
|
|
|
|
+ $xml_content = file_get_contents($filePatch);
|
|
|
|
|
+ xml::print($xml_content);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Si ce n'est pas un fichier XML, comportement normal pour servir le fichier
|
|
|
|
|
+ header('Content-Type: ' . $mime_type);
|
|
|
|
|
+ header('Content-Length: ' . filesize($filePatch));
|
|
|
|
|
+ readfile($filePatch);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
echo "Le fichier n'a pas été trouvé ou n'est pas lisible.";
|
|
echo "Le fichier n'a pas été trouvé ou n'est pas lisible.";
|
|
|
}
|
|
}
|
|
@@ -448,7 +457,7 @@ class document
|
|
|
<div><span class="fw-bold">'.$principal["name"].'</span> ('.core::convertBytes($principal["size"]).')</div>
|
|
<div><span class="fw-bold">'.$principal["name"].'</span> ('.core::convertBytes($principal["size"]).')</div>
|
|
|
Chargé le '.core::convertDate($principal["creer"]).' par '.$principal["user"].'
|
|
Chargé le '.core::convertDate($principal["creer"]).' par '.$principal["user"].'
|
|
|
<div id="select-attach-'.$principal["id"].'" style="color:red;"></div>
|
|
<div id="select-attach-'.$principal["id"].'" style="color:red;"></div>
|
|
|
- </div><button type="button" class="btn btn btn-outline-secondary" onclick="window.open(\'/document.php?id=' . $principal["id"] . '\', \'_blank\')">' . icon::getFont(["icon" => "bi bi-eye-fill"]) . '</button>
|
|
|
|
|
|
|
+ </div><button type="button" title="Voir le document" class="btn btn btn-outline-secondary" onclick="window.open(\'/document.php?id=' . $principal["id"] . '\', \'_blank\')">' . icon::getFont(["icon" => "bi bi-eye-fill"]) . '</button>
|
|
|
</li>';
|
|
</li>';
|
|
|
foreach ($_attachs as $key => $attach) {
|
|
foreach ($_attachs as $key => $attach) {
|
|
|
if($key != "principal"){
|
|
if($key != "principal"){
|
|
@@ -458,9 +467,9 @@ class document
|
|
|
Chargé le '.core::convertDate($attach["creer"]).' par '.$attach["user"].'
|
|
Chargé le '.core::convertDate($attach["creer"]).' par '.$attach["user"].'
|
|
|
<div id="select-attach-'.$attach["id"].'"></div>
|
|
<div id="select-attach-'.$attach["id"].'"></div>
|
|
|
</div><div class="btn-group">
|
|
</div><div class="btn-group">
|
|
|
- <button type="button" class="btn btn btn-outline-secondary" onclick="window.open(\'/document.php?id=' . $attach["id"] . '\', \'_blank\')">' . icon::getFont(["icon" => "bi bi-eye-fill"]) . '</button>
|
|
|
|
|
- <button type="button" class="btn btn btn-outline-primary" onclick="defaultAttachment(\''.$attach["id"].'\')" id="button-default-'.$attach["id"].'">' . icon::getFont(["icon" => "bi bi-paperclip"]) . '</button>
|
|
|
|
|
- <button type="button" class="btn btn-outline-danger" onclick="deleteAttachment(\''.$attach["id"].'\')" id="button-delete-'.$attach["id"].'">' . icon::getFont(["icon" => "bi bi-trash"]) . '</button>
|
|
|
|
|
|
|
+ <button type="button" title="Voir le document" class="btn btn btn-outline-secondary" onclick="window.open(\'/document.php?id=' . $attach["id"] . '\', \'_blank\')">' . icon::getFont(["icon" => "bi bi-eye-fill"]) . '</button>
|
|
|
|
|
+ <button type="button" title="Document mis en avant" class="btn btn btn-outline-primary" onclick="defaultAttachment(\''.$attach["id"].'\')" id="button-default-'.$attach["id"].'">' . icon::getFont(["icon" => "bi bi-star-fill"]) . '</button>
|
|
|
|
|
+ <button type="button" title="Supprimer ce document" class="btn btn-outline-danger" onclick="deleteAttachment(\''.$attach["id"].'\')" id="button-delete-'.$attach["id"].'">' . icon::getFont(["icon" => "bi bi-trash"]) . '</button>
|
|
|
</div>
|
|
</div>
|
|
|
</li>';
|
|
</li>';
|
|
|
}
|
|
}
|