On peux a nouveau télécharger un fichier depuis le browser
This commit is contained in:
parent
b8a4b87061
commit
7399963cfd
|
@ -1,15 +1,9 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: adm_doadd.php,v 1.8 2006/01/24 05:03:30 joe Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2006 Le réseau Koumbit Inc.
|
||||
http://koumbit.org/
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
Copyright (C) 2000-2012 by the AlternC Development Team.
|
||||
https://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
|
@ -25,9 +19,6 @@
|
|||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file: Benjamin Sonntag
|
||||
Purpose of file: Create a new member
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
|
|
|
@ -330,7 +330,12 @@ if ($p["showicons"]) {
|
|||
echo "<td width=\"28\"><img src=\"icon/".$bro->icon($c[$i]["name"])."\" width=\"16\" height=\"16\" alt=\"\" /></td>";
|
||||
}
|
||||
echo "<td><a href=\"";
|
||||
echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&R=".urlencode($R);
|
||||
$canedit = $bro->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"])."</a></td>\n";
|
||||
echo " <td>".format_size($c[$i]["size"])."</td>";
|
||||
echo "<td>".format_date('%3$d-%2$d-%1$d %4$d:%5$d',date("Y-m-d H:i:s",$c[$i]["date"]))."<br /></td>";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</table>
|
||||
</div> <!-- div global -->
|
||||
<?php
|
||||
if ( $debug_alternc->status ) {
|
||||
if ( isset($debug_alternc) && $debug_alternc->status ) {
|
||||
$debug_alternc->dump();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue