/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;
 
116,7 → 159,7
{
$access = true;
$openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file));
 
if ($openDir)
$listing[$index]["filetype"] = "diropen";
else
146,26 → 189,31
$listing[$index]["filetype"] = strrchr($file, ".");
}
}
 
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)\" />";
else
$listing[$index]["compare_box"] = "";
 
if ($openDir)
$listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>";
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!
 
$listing[$index]["isDir"] = $isDir;
 
if ($treeview)
$listing[$index]["level"] = $level;
else
172,10 → 220,10
$listing[$index]["level"] = 0;
 
$listing[$index]["node"] = 0; // t-node
 
$fileurl = $config->getURL($rep, $path.$file, "log");
$listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>";
 
$rssurl = $config->getURL($rep, $path.$file, "rss");
if ($rep->getHideRss())
{
182,11 → 230,11
$listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>";
$listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">";
}
 
$index++;
$loop++;
$last_index = $index;
 
if (($level != $limit) && ($isDir))
{
if (!strcmp($subs[$level + 1]."/", $file))
194,7 → 242,7
$listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
$index = count($listing);
}
}
}
 
}
}
338,7 → 386,7
$vars["newfilesbr"] .= fileLink("", $file->path);
$vars["newfiles"] .= " ".fileLink("", $file->path);
break;
 
case "M":
if (!$firstModded) $vars["changedfilesbr"] .= "<br />";
$firstModded = false;
354,9 → 402,9
break;
}
}
 
$vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>";
 
$vars["hidechanges"] = false;
$vars["showchanges"] = true;
}
371,14 → 419,14
 
if (isset($history->entries[1]->rev))
{
$vars["curdircomplink"] = "<a href=\"${compurl}compare[]=".
urlencode($history->entries[1]->path)."@".$history->entries[1]->rev.
"&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev.
"\">${lang["DIFFPREV"]}</a>";
$vars["curdircomplink"] = "<a href=\"${compurl}compare[]=".
urlencode($history->entries[1]->path)."@".$history->entries[1]->rev.
"&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev.
"\">${lang["DIFFPREV"]}</a>";
}
else
{
$vars["curdircomplink"] = "";
$vars["curdircomplink"] = "";
}
 
if ($rep->getHideRss())