diff --git a/bureau/admin/adm_doadd.php b/bureau/admin/adm_doadd.php
index 5876a80e..a8fd9089 100644
--- a/bureau/admin/adm_doadd.php
+++ b/bureau/admin/adm_doadd.php
@@ -1,15 +1,9 @@
icon($c[$i]["name"])."\" width=\"16\" height=\"16\" alt=\"\" />";
}
echo "
can_edit($R,$c[$i]["name"]);
+if ($canedit) {
+ echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&R=".urlencode($R);
+} else {
+ echo "bro_downloadfile.php?dir=".urlencode($R)."&file=".urlencode($c[$i]["name"]);
+}
echo "\">".htmlentities($c[$i]["name"])." | \n";
echo " ".format_size($c[$i]["size"])." | ";
echo "".format_date('%3$d-%2$d-%1$d %4$d:%5$d',date("Y-m-d H:i:s",$c[$i]["date"]))."
| ";
diff --git a/bureau/admin/foot.php b/bureau/admin/foot.php
index f4d5642a..f7b0ad9c 100644
--- a/bureau/admin/foot.php
+++ b/bureau/admin/foot.php
@@ -4,7 +4,7 @@
status ) {
+if ( isset($debug_alternc) && $debug_alternc->status ) {
$debug_alternc->dump();
}
?>
diff --git a/bureau/class/m_bro.php b/bureau/class/m_bro.php
index 18a33de1..79eb9935 100644
--- a/bureau/class/m_bro.php
+++ b/bureau/class/m_bro.php
@@ -741,6 +741,22 @@ class m_bro {
}
}
+ function can_edit($dir,$name) {
+ global $mem,$err;
+ $absolute="$dir/$name";
+ $absolute=$this->convertabsolute($absolute,0);
+ if (!$absolute) {
+ $err->raise('bro',_("File not in authorized directory"));
+ include('foot.php');
+ exit;
+ }
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
+ $mime = finfo_file($finfo,$absolute);
+ if ( substr($mime,0,5)=="text/" || $mime == "application/x-empty") {
+ return true;
+ }
+ return false;
+ }
/**
* Return a HTML snippet representing an extraction function only if the mimetype of $name is supported
@@ -769,6 +785,15 @@ class m_bro {
return false;
}
+ function download_link($dir,$file){
+ global $err;
+ $err->log("bro","download_link");
+ header("Content-Disposition: attachment; filename=$file");
+ header("Content-Type: application/force-download");
+ header("Content-Transfer-Encoding: binary");
+ $this->content_send($dir,$file);
+ }
+
/* ------------------------------------------------------------------ */
/** Echoes the content of the file $file located in directory $R
diff --git a/bureau/class/m_log.php b/bureau/class/m_log.php
index f38fe2bc..ef620f68 100644
--- a/bureau/class/m_log.php
+++ b/bureau/class/m_log.php
@@ -80,7 +80,7 @@ class m_log {
function download_link($file){
global $err,$mem;
$err->log("log","download_link");
- header("Content-Disposition: attachment; filename=".$mem->user["login"].".zip");
+ header("Content-Disposition: attachment; filename=".$mem->user["login"].".zip"); // FIXME: keep the original name file
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
$f=$this->get_logs_directory();