/WebSVN/listing.php
83,6 → 83,35
return $url;
}
 
function fileLinkGetFile($path, $file)
{
global $rep, $passrev, $showchanged, $config;
 
if ($path == "" || $path{0} != "/")
$ppath = "/".$path;
else
$ppath = $path;
 
if ($ppath{strlen($ppath)-1} != "/")
$ppath .= "/";
 
if ($file{0} == "/")
$pfile = substr($file, 1);
else
$pfile = $file;
 
$isDir = $pfile{strlen($pfile) - 1} == "/";
 
if (!$isDir)
{
$url = $config->getURL($rep, $ppath.$pfile, "file");
$url = removeURLSeparator($url);
$url = "<a href=\"${url}&getfile\">Get</a>";
}
 
return $url;
}
 
function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true)
{
global $rep, $passrev, $showchanged, $config, $lang;
89,6 → 118,20
 
$path = "";
 
// Explicitly requested file as attachment
if (isset($_REQUEST['getfile']))
{
$base = basename($path);
 
header("Content-Type: application/octet-stream");
header("Content-Length: $size");
header("Content-Disposition: inline; filename=".urlencode($base));
 
$svnrep->getFileContents($path, "", $rev);
 
exit;
}
 
if (!$treeview)
$level = $limit;
 
149,7 → 192,7
if ($access)
{
$listing[$index]["rowparity"] = ($index % 2)?"1":"0";
$listing[$index]["rowparity"] = ($index % 2)?"L1":"L0";
if ($treeview)
$listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />";
161,6 → 204,11
else
$listing[$index]["filelink"] = fileLink($path, $file);
if ($isDir)
$listing[$index]["filelinkgetfile"] = "";
else
$listing[$index]["filelinkgetfile"] = fileLinkGetFile($path, $file);
 
// The history command doesn't return with a trailing slash. We need to remember here if the
// file is a directory or not!