$vars['compare_path1input'] = '<input type="text" size="40" name="compare[0]" value="' . htmlentities($path1, ENT_QUOTES, 'UTF-8') . '" />'; $vars['compare_path2input'] = '<input type="text" size="40" name="compare[1]" value="' . htmlentities($path2, ENT_QUOTES, 'UTF-8') . '" />'; $vars['compare_rev1input'] = '<input type="text" size="5" name="compare_rev[0]" value="' . $rev1 . '" />'; $vars['compare_rev2input'] = '<input type="text" size="5" name="compare_rev[1]" value="' . $rev2 . '" />'; $vars['compare_submit'] = '<input name="comparesubmit" type="submit" value="' . $lang['COMPAREPATHS'] . '" />'; $vars['compare_endform'] = '</form>'; // safe paths are a hack for fixing XSS exploit $vars['path1'] = htmlentities($path1, ENT_QUOTES, 'UTF-8'); $vars['safepath1'] = htmlentities($path1, ENT_QUOTES, 'UTF-8'); $vars['path2'] = htmlentities($path2, ENT_QUOTES, 'UTF-8'); $vars['safepath2'] = htmlentities($path2, ENT_QUOTES, 'UTF-8'); $vars['rev1'] = $rev1; $vars['rev2'] = $rev2; // Set variables used for the more recent of the two revisions $rev = max($rev1, $rev2); $history = $svnrep->getLog($path, $rev, $rev, false, 1); if ($history) { $logEntry = $history->curEntry; $vars['rev'] = $logEntry->rev; $vars['peg'] = $peg; $vars['date'] = $logEntry->date; $vars['author'] = $logEntry->author; $vars['log'] = xml_entities($logEntry->msg); } else { $vars['warning'] = 'Problem with comparison.'; } $noinput = empty($path1) || empty($path2); // Generate the diff listing $relativePath1 = $path1; $relativePath2 = $path2; $svnpath1 = encodepath($svnrep->getSvnPath(str_replace(DIRECTORY_SEPARATOR, '/', $path1)));
// // Show the differences between 2 revisions of a file. // require_once 'include/setup.php'; require_once 'include/svnlook.php'; require_once 'include/utils.php'; require_once 'include/template.php'; require_once 'include/diff_inc.php'; $vars['action'] = $lang['DIFF']; $all = @$_REQUEST['all'] == 1; $ignoreWhitespace = @$_REQUEST['ignorews'] == 1; // Make sure that we have a repository if ($rep) { $svnrep = new SVNRepository($rep); // If there's no revision info, go to the lastest revision for this path $history = $svnrep->getLog($path, '', '', true, 2, $peg); $youngest = $history ? $history->entries[0]->rev : 0; if (empty($rev)) { $rev = $youngest; } $history = $svnrep->getLog($path, $rev, '', false, 2, $peg); if ($path[0] != '/') { $ppath = '/' . $path; } else { $ppath = $path; } $prevrev = @$history->entries[1]->rev; $vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); $vars['rev1'] = $rev; $vars['rev2'] = $prevrev; $vars['prevrev'] = $prevrev;
// revision.php // // Show the details for a given revision require_once 'include/setup.php'; require_once 'include/svnlook.php'; require_once 'include/utils.php'; require_once 'include/template.php'; require_once 'include/bugtraq.php'; // Make sure that we have a repository if ($rep) { $svnrep = new SVNRepository($rep); $ppath = $path == '' || $path[0] != '/' ? '/' . $path : $path; createPathLinks($rep, $ppath, $rev, $peg); $passRevString = createRevAndPegString($rev, $peg); // Find the youngest revision containing changes for the given path $history = $svnrep->getLog($path, 'HEAD', '', false, 2, $path == '/' ? '' : $peg); if (!$history) { unset($vars['error']); $history = $svnrep->getLog($path, '', '', false, 2, $path == '/' ? '' : $peg); } $youngest = $history ? $history->entries[0]->rev : 0; $vars['youngestrev'] = $youngest; // TODO The "youngest" rev is often incorrect when both path and rev are specified. // If a path was last modified at rev M and the URL contains rev N, it uses rev N. // Unless otherwise specified, we get the log details of the latest change $lastChangedRev = $rev ? $rev : $youngest; if ($lastChangedRev != $youngest) { $history = $svnrep->getLog($path, $lastChangedRev, $lastChangedRev, false, 2, $peg); } if (empty($rev)) { $rev = $lastChangedRev;
return true; } return false; } // Make sure that downloading the specified file/directory is permitted if (!$rep->isDownloadAllowed($path)) { header('HTTP/1.x 403 Forbidden', true, 403); error_log('Unable to download resource at path: ' . $path); print 'Unable to download resource at path: ' . $path; exit; } if ($rep) { $svnrep = new SVNRepository($rep); // Fetch information about a revision (if unspecified, the latest) for this path if (empty($rev)) { $history = $svnrep->getLog($path, 'HEAD', '', true, 1, $peg); } else { if ($rev == $peg) { $history = $svnrep->getLog($path, '', 1, true, 1, $peg); } else { $history = $svnrep->getLog($path, $rev, $rev - 1, true, 1, $peg); } } $logEntry = $history ? $history->entries[0] : null; if (empty($rev)) { $rev = $logEntry->rev; } // Create a temporary filename to be used for a directory to archive a download. // Here we have an unavoidable but highly unlikely to occur race condition. $tempDir = tempnam($config->getTempDir(), 'websvn'); if ($tempDir == false) {
// Simply lists the contents of a file require_once 'include/setup.php'; require_once 'include/svnlook.php'; require_once 'include/utils.php'; require_once 'include/template.php'; // Make sure that we have a repository if ($rep) { $svnrep = new SVNRepository($rep); if ($path[0] != '/') { $ppath = '/' . $path; } else { $ppath = $path; } $useMime = false; // If there's no revision info, go to the lastest revision for this path $history = $svnrep->getLog($path, '', '', false, 2, $peg); $youngest = $history && isset($history->entries[0]) ? $history->entries[0]->rev : false; if (empty($rev)) { $rev = $youngest; } else { if ($rev > $youngest) { $vars['warning'] = 'Revision ' . $rev . ' of this resource does not exist.'; } } $extn = strtolower(strrchr($path, '.')); // Check to see if the user has requested that this type be zipped and sent // to the browser as an attachment if (in_array($extn, $zipped) && $rep->hasReadAccess($path, false)) { $base = basename($path); header('Content-Type: application/x-gzip'); header('Content-Disposition: attachment; filename=' . urlencode($base) . '.gz');
} if (!$rep) { header('HTTP/1.x 404 Not Found', true, 404); print 'Unable to access resource at path: ' . $path; exit; } // Make sure that the user has full access to the specified directory if (!$rep->hasReadAccess($path, false)) { header('HTTP/1.x 403 Forbidden', true, 403); print 'Unable to access resource at path: ' . $path; exit; } header('Content-Type: application/xml; charset=utf-8'); // If there's no revision info, go to the lastest revision for this path $svnrep = new SVNRepository($rep); $history = $svnrep->getLog($path, $rev, '', false, $max, $peg); if ($rep->isRssCachingEnabled()) { // Filename for storing a cached RSS feed for this particular path/revision $cache = $locwebsvnreal . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . strtr($rep->getDisplayName() . $path, ':/\\?', '____') . ($peg ? '@' . $peg : '') . ($rev ? '_r' . $rev : '') . 'm' . $max . ($quiet ? 'q' : '') . '.rss.xml'; // If a recent-enough cached version exists, use it and avoid the work below if (file_exists($cache) && filemtime($cache) >= $history->curEntry->committime) { readfile($cache); exit; } } // Generate RSS 2.0 feed $rss = '<?xml version="1.0" encoding="utf-8"?>'; $rss .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel>'; $rss .= '<title>' . htmlspecialchars($rep->getDisplayName() . ($path ? ' - ' . $path : '')) . '</title>'; $rss .= '<description>' . htmlspecialchars($lang['RSSFEEDTITLE'] . ' - ' . $repname) . '</description>'; $rss .= '<lastBuildDate>' . date('r') . '</lastBuildDate>';
$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; } $vars['compare_box'] = ''; // Set blank once in case tree view is not enabled. return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView); } // Make sure that we have a repository if ($rep) { $svnrep = new SVNRepository($rep); $history = $svnrep->getLog($path, 'HEAD', '', false, 2, $path == '/' ? '' : $peg); if (!$history) { unset($vars['error']); $history = $svnrep->getLog($path, '', '', false, 2, $path == '/' ? '' : $peg); } $youngest = $history && isset($history->entries[0]) ? $history->entries[0]->rev : 0; // Unless otherwise specified, we get the log details of the latest change $lastChangedRev = $passrev ? $passrev : $youngest; if ($lastChangedRev != $youngest) { $history = $svnrep->getLog($path, $lastChangedRev, '', false, 2, $peg); } $logEntry = $history && isset($history->entries[0]) ? $history->entries[0] : 0; $headlog = $svnrep->getLog('/', '', '', true, 1); $headrev = $headlog && 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($words[$index])) { unset($words[$index]); } } if (empty($page)) { $page = 1; } // If searching, display all the results if ($dosearch) { $all = true; } $maxperpage = 20; // Make sure that we have a repository if ($rep) { $svnrep = new SVNRepository($rep); $history = $svnrep->getLog($path, 'HEAD', '', false, 1, $path == '/' ? '' : $peg); if (!$history) { unset($vars['error']); $history = $svnrep->getLog($path, '', '', false, 1, $path == '/' ? '' : $peg); } $youngest = $history && isset($history->entries[0]) ? $history->entries[0]->rev : 0; if (empty($startrev)) { //$startrev = ($rev) ? $rev : 'HEAD'; $startrev = $rev; } else { if ($startrev != 'HEAD' && $startrev != 'BASE' && $startrev != 'PREV' && $startrev != 'COMMITTED') { $startrev = (int) $startrev; } } if (empty($endrev)) { $endrev = 1;
// -- // // blame.php // // Show the blame information of a file. // require_once 'include/setup.php'; require_once 'include/svnlook.php'; require_once 'include/utils.php'; require_once 'include/template.php'; $vars['action'] = $lang['BLAME']; // Make sure that we have a repository if ($rep) { $svnrep = new SVNRepository($rep); // If there's no revision info, go to the lastest revision for this path $history = $svnrep->getLog($path, '', '', false, 2, $peg); $youngest = $history ? $history->entries[0]->rev : 0; if (empty($rev)) { $rev = $youngest; } else { $history = $svnrep->getLog($path, $rev, '', false, 2, $peg); } if ($path[0] != '/') { $ppath = '/' . $path; } else { $ppath = $path; } // Find the parent path (or the whole path if it's already a directory) $pos = strrpos($ppath, '/'); $parent = substr($ppath, 0, $pos + 1); $vars['rev'] = $rev;