websvn |
Subversion Repositories: |
Rev 1 | Rev 3 | |
---|---|---|
Line 32... | Line 32... | |
|
| |
$svnrep = new SVNRepository($rep); |
$svnrep = new SVNRepository($rep); | |
|
| |
// If there's no revision info, go to the lastest revision for this path |
// If there's no revision info, go to the lastest revision for this path | |
$history = $svnrep->getLog($path, '', '', true); |
$history = $svnrep->getLog($path, '', '', true); | |
if (is_string($history)) { | ||
echo $history; | ||
exit; | ||
} | ||
$youngest = $history->entries[0]->rev; |
$youngest = $history->entries[0]->rev; | |
|
| |
if (empty($rev)) { |
if (empty($rev)) { | |
$rev = $youngest; |
$rev = $youngest; | |
} |
} | |
Line 53... | Line 57... | |
$vars['repname'] = htmlentities($rep->getDisplayName(), ENT_QUOTES, 'UTF-8'); |
$vars['repname'] = htmlentities($rep->getDisplayName(), ENT_QUOTES, 'UTF-8'); | |
$vars['rev'] = $rev; |
$vars['rev'] = $rev; | |
$vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); |
$vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); | |
|
| |
createDirLinks($rep, $ppath, $rev); |
createDirLinks($rep, $ppath, $rev); | |
|
||
$url = $config->getURL($rep, $path, "file"); |
||
|
| |
if ($rev != $youngest) { |
if ($rev != $youngest) { | |
$url = $config->getURL($rep, $path, 'blame'); | ||
$vars["goyoungestlink"] = '<a href="'.$url.'">'.$lang["GOYOUNGEST"].'</a>'; |
$vars["goyoungestlink"] = '<a href="'.$url.'">'.$lang["GOYOUNGEST"].'</a>'; | |
} else { |
} else { | |
$vars["goyoungestlink"] = ""; |
$vars["goyoungestlink"] = ""; | |
} |
} | |
|
| |
Line 78... | Line 81... | |
|
| |
$listing = array(); |
$listing = array(); | |
|
| |
// Get the contents of the file |
// Get the contents of the file | |
$tfname = tempnam('temp', ''); |
$tfname = tempnam('temp', ''); | |
$svnrep->getFileContents($path, $tfname, $rev, '', true); |
$highlighted = $svnrep->getFileContents($path, $tfname, $rev, '', true); | |
|
| |
if ($file = fopen($tfname, 'r')) { |
if ($file = fopen($tfname, 'r')) { | |
// Get the blame info |
// Get the blame info | |
$tbname = tempnam('temp', ''); |
$tbname = tempnam('temp', ''); | |
$svnrep->getBlameDetails($path, $tbname, $rev); |
$svnrep->getBlameDetails($path, $tbname, $rev); | |
|
||
$ent = true; |
||
$extension = strrchr(basename($path), '.'); |
||
if (($extension && isset($extEnscript[$extension]) && ('php' == $extEnscript[$extension])) || ($config->useEnscript || $config->useGeshi)) { |
||
$ent = false; |
||
} |
||
|
| |
if ($blame = fopen($tbname, 'r')) { |
if ($blame = fopen($tbname, 'r')) { | |
// Create an array of version/author/line |
// Create an array of version/author/line | |
|
| |
$index = 0; |
$index = 0; | |
$seen_rev = array(); |
$seen_rev = array(); | |
$last_rev = ""; |
$last_rev = ""; | |
$row_class = 'light'; |
$row_class = ''; | |
|
| |
while (!feof($blame) && !feof($file)) { |
while (!feof($blame) && !feof($file)) { | |
$blameline = fgets($blame); |
$blameline = fgets($blame); | |
|
| |
if ($blameline != '') { |
if ($blameline != '') { | |
Line 123... | Line 120... | |
|
| |
$listing[$index]['row_class'] = $row_class; |
$listing[$index]['row_class'] = $row_class; | |
$last_rev = $revision; |
$last_rev = $revision; | |
|
| |
$line = rtrim(fgets($file)); |
$line = rtrim(fgets($file)); | |
if ($ent) $line = replaceEntities($line, $rep); |
if (!$highlighted) $line = replaceEntities($line, $rep); | |
|
| |
if ($empty) $line = ' '; |
if ($empty) $line = ' '; | |
$listing[$index]['line'] = hardspace($line); |
$listing[$index]['line'] = hardspace($line); | |
|
| |
$index++; |
$index++; | |
Line 136... | Line 133... | |
|
| |
fclose($blame); |
fclose($blame); | |
} |
} | |
|
| |
fclose($file); |
fclose($file); | |
| ||
@unlink($tbname); | ||
} |
} | |
|
| |
@unlink($tfname); |
@unlink($tfname); | |
@unlink($tbname); |
||
|
| |
$vars['version'] = $version; |
$vars['version'] = $version; | |
|
| |
if (!$rep->hasReadAccess($path, false)) { |
if (!$rep->hasReadAccess($path, false)) { | |
$vars['noaccess'] = true; |
$vars['noaccess'] = true; | |
Line 196... | Line 194... | |
|
| |
HTML; |
HTML; | |
|
| |
foreach ($seen_rev as $key => $val) { |
foreach ($seen_rev as $key => $val) { | |
$history = $svnrep->getLog($path, $key, $key, false, 1); |
$history = $svnrep->getLog($path, $key, $key, false, 1); | |
if (!empty($history)) { |
if (!is_string($history)) { | |
$vars['javascript'] .= "rev[$key] = '"; |
$vars['javascript'] .= "rev[$key] = '"; | |
$vars['javascript'] .= "<div class=\"info\">"; |
$vars['javascript'] .= "<div class=\"info\">"; | |
$vars['javascript'] .= "<span class=\"date\">".$history->curEntry->date."<\/span>"; |
$vars['javascript'] .= "<span class=\"date\">".$history->curEntry->date."<\/span>"; | |
$vars['javascript'] .= "<\/div>"; |
$vars['javascript'] .= "<\/div>"; | |
$vars['javascript'] .= "<div class=\"msg\">".addslashes(preg_replace('/\n/', "<br />", $history->curEntry->msg))."<\/div>"; |
$vars['javascript'] .= "<div class=\"msg\">".addslashes(preg_replace('/\n/', "<br />", $history->curEntry->msg))."<\/div>"; |