getURL($rep, $ppath.$pfile, "dir");
// XHTML doesn't allow slashes in IDs and must begin with a letter
$id = str_replace('/', '_', 'path'.$ppath.$pfile);
$url = "treeView) $url .= "#$id";
$url .= "\">$pfile";
} else {
$url = $config->getURL($rep, $ppath.$pfile, "file");
$url .= $passrevstr;
$url = removeURLSeparator($url);
$url = "$pfile";
}
return $url;
}
function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true) {
global $rep, $passrev, $config, $lang;
$path = "";
if (!$treeview) {
$level = $limit;
}
for ($n = 0; $n <= $level; $n++) {
$path .= $subs[$n]."/";
}
$logList = $svnrep->getList($path, $rev);
// List each file in the current directory
$loop = 0;
$last_index = 0;
$openDir = false;
$fullaccess = $rep->hasReadAccess($path, false);
foreach ($logList->entries as $entry) {
$file = $entry->file;
$isDir = $entry->isdir;
$access = false;
if ($isDir) {
if ($rep->hasReadAccess($path.$file, true)) {
$access = true;
$openDir = isset($subs[$level+1]) && (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file));
if ($openDir) {
$listing[$index]["filetype"] = "diropen";
} else {
$listing[$index]["filetype"] = "dir";
}
if ($rep->isDownloadAllowed($path.$file)) {
$dlurl = $config->getURL($rep, $path.$file, "dl");
$listing[$index]["fileviewdllink"] = "${lang["TARBALL"]}";
$listing[$index]['downloadurl'] = $dlurl.'rev='.$passrev.'&isdir=1';
} else {
$listing[$index]['downloadurl'] = '';
}
$listing[$index]['downloadplainurl'] = '';
}
} else {
if ($fullaccess) {
$access = true;
if ($level != $limit) {
// List directories only, skip all files
continue;
}
$listing[$index]['downloadurl'] = '';
if ($rep->isDownloadAllowed($path.$file)) {
$dlurl = $config->getURL($rep, $path.$file, "dl");
$listing[$index]['downloadplainurl'] = $dlurl.'rev='.$passrev;
} else {
$listing[$index]['downloadplainurl'] = '';
}
$listing[$index]["filetype"] = strtolower(strrchr($file, "."));
}
}
if ($access) {
$listing[$index]["rowparity"] = ($index % 2)?"1":"0";
if ($treeview) {
$listing[$index]["compare_box"] = "";
} else {
$listing[$index]["compare_box"] = "";
}
if ($openDir) {
$listing[$index]["filelink"] = "".fileLink($path, $file)."";
} else {
$listing[$index]["filelink"] = fileLink($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 {
$listing[$index]["level"] = 0;
}
$listing[$index]["node"] = 0; // t-node
$fileurl = $config->getURL($rep, $path.$file, "log");
$listing[$index]["fileviewloglink"] = "${lang["VIEWLOG"]}";
$listing[$index]['logurl'] = $fileurl.'rev='.$passrev.'&isdir='.$isDir;
if ($rep->getHideRss()) {
$rssurl = $config->getURL($rep, $path.$file, 'rss');
$listing[$index]['rssurl'] = $rssurl.'rev='.$passrev.'&isdir='.$isDir;
}
if ($config->showLastMod) {
$listing[$index]['revision'] = $entry->rev;
$listing[$index]['author'] = $entry->author;
$listing[$index]['date'] = $entry->date;
$listing[$index]['committime'] = $entry->committime;
$listing[$index]['age'] = $entry->age;
$listing[$index]['revurl'] = $config->getURL($rep, $path.$file, 'revision').'rev='.$entry->rev.'&';
}
$index++;
$loop++;
$last_index = $index;
if (($level != $limit) && ($isDir)) {
if (isset($subs[$level + 1]) && !strcmp(htmlentities($subs[$level + 1],ENT_QUOTES).'/', htmlentities($file))) {
$listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
$index = count($listing);
}
}
}
}
if ($last_index != 0 && $treeview) {
$listing[$last_index - 1]["node"] = 1; // l-node
}
return $listing;
}
function showTreeDir($svnrep, $path, $rev, $listing) {
global $vars, $config;
$subs = explode("/", $path);
// For directory, the last element in the subs is empty.
// For file, the last element in the subs is the file name.
// Therefore, it is always count($subs) - 2
$limit = count($subs) - 2;
for ($n = 0; $n < $limit; $n++) {
$vars["last_i_node"][$n] = FALSE;
}
return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView);
}
// Make sure that we have a repository
if (!isset($rep)) {
echo $lang["NOREP"];
exit;
}
$svnrep = new SVNRepository($rep);
// Revision info to pass along chain
$passrev = $rev;
// If there's no revision info, go to the lastest revision for this path
$history = $svnrep->getLog($path, "", "", false);
if (is_string($history)) {
echo $history;
exit;
}
if (!empty($history->entries[0])) {
$youngest = $history->entries[0]->rev;
} else {
$youngest = -1;
}
// Unless otherwise specified, we get the log details of the latest change
if (empty($rev)) {
$logrev = $youngest;
} else {
$logrev = $rev;
}
if ($logrev != $youngest) {
$logEntry = $svnrep->getLog($path, $logrev, $logrev, false);
if (is_string($logEntry)) {
echo $logEntry;
exit;
}
$logEntry = isset($logEntry->entries[0]) ? $logEntry->entries[0] : false;
} else {
$logEntry = isset($history->entries[0]) ? $history->entries[0] : false;
}
$headlog = $svnrep->getLog("/", "", "", true, 1);
if (is_string($headlog)) {
echo $headlog;
exit;
}
$headrev = isset($headlog->entries[0]) ? $headlog->entries[0]->rev : 0;
// If we're not looking at a specific revision, get the HEAD revision number
// (the revision of the rest of the tree display)
if (empty($rev)) {
$rev = $headrev;
}
if ($path == "" || $path{0} != "/") {
$ppath = "/".$path;
} else {
$ppath = $path;
}
$vars["repname"] = $rep->getDisplayName();
$compurl = $config->getURL($rep, "/", "comp");
$revisionurl = $config->getURL($rep, $path, 'revision');
if ($passrev != 0 && $passrev != $headrev && $youngest != -1) {
$vars['goyoungesturl'] = $config->getURL($rep, $path, 'dir').'opt=dir';
} else {
$vars['goyoungesturl'] = '';
}
$bugtraq = new Bugtraq($rep, $svnrep, $ppath);
$vars["action"] = "";
$vars["rev"] = $rev;
$vars["path"] = htmlentities($ppath, ENT_QUOTES, 'UTF-8');
$vars["lastchangedrev"] = $logrev;
$vars["date"] = $logEntry ? $logEntry->date : '';
$vars["author"] = $logEntry ? $logEntry->author : '';
$vars["log"] = $logEntry ? nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg))) : '';
$vars["changesurl"] = $revisionurl.'rev='.$passrev;
createDirLinks($rep, $ppath, $passrev);
$logurl = $config->getURL($rep, $path, "log");
$vars['logurl'] = $logurl.'rev='.$passrev.'&isdir=1';
$vars['indexurl'] = $config->getURL($rep, '', 'index');
$vars['repurl'] = $config->getURL($rep, '', 'dir');
if ($rep->getHideRss()) {
$rssurl = $config->getURL($rep, $path, "rss");
// $vars["curdirrsslink"] = "${lang["RSSFEED"]}";
$vars['rssurl'] = $rssurl.'isdir=1';
// $vars["curdirrssanchor"] = "";
}
// Set up the tarball link
$subs = explode("/", $path);
$level = count($subs) - 2;
if ($rep->isDownloadAllowed($path)) {
$dlurl = $config->getURL($rep, $path, "dl");
$vars["curdirdllink"] = "${lang["TARBALL"]}";
$vars['downloadurl'] = $dlurl.'rev='.$passrev.'&isdir=1';
} else {
$vars["curdirdllink"] = '';
$vars['downloadurl'] = '';
}
$url = $config->getURL($rep, "/", "comp");
$vars["compare_form"] = "
";
$vars['showlastmod'] = $config->showLastMod;
$vars['showageinsteadofdate'] = $config->showAgeInsteadOfDate;
$listing = array();
$listing = showTreeDir($svnrep, $path, $rev, $listing);
$vars["version"] = $version;
if (!$rep->hasReadAccess($path, true)) {
$vars["noaccess"] = true;
}
if (!$rep->hasReadAccess($path, false)) {
$vars["restricted"] = true;
}
parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing);
parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing);
parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);
WebSVN
- websvn
- Blame
- Rev 5
- /listing.php
websvn |
Subversion Repositories: |
[/] [listing.php] - Blame information for rev 5
Powered by WebSVN 2.2.1