websvn |
Subversion Repositories: |
Rev 1 | Rev 3 | |
---|---|---|
Line 43... | Line 43... | |
|
| |
$passrev = $rev; |
$passrev = $rev; | |
|
| |
// 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 = isset($history->entries[0]) ? $history->entries[0]->rev: false; |
$youngest = isset($history->entries[0]) ? $history->entries[0]->rev: false; | |
|
| |
if (empty($rev)) { |
if (empty($rev)) { | |
$rev = $youngest; |
$rev = $youngest; | |
} |
} | |
Line 78... | Line 82... | |
|
| |
if (!$rep->getIgnoreWebSVNContentTypes()) { |
if (!$rep->getIgnoreWebSVNContentTypes()) { | |
$setupContentType = @$contentType[$extn]; |
$setupContentType = @$contentType[$extn]; | |
} |
} | |
|
| |
// Use this set of priorities when establishing what content-type to |
// Use the documented priorities when establishing what content-type to use. | |
// actually use. |
||
|
||
if (!empty($svnMimeType) && $svnMimeType != 'application/octet-stream') { |
if (!empty($svnMimeType) && $svnMimeType != 'application/octet-stream') { | |
$cont = $svnMimeType; |
$mimeType = $svnMimeType; | |
} else if (!empty($setupContentType)) { |
} else if (!empty($setupContentType)) { | |
$cont = $setupContentType; |
$mimeType = $setupContentType; | |
} else if (!empty($svnMimeType)) { |
} else if (!empty($svnMimeType)) { | |
// It now is equal to application/octet-stream due to logic |
$mimeType = $svnMimeType; // Use SVN's default of "application/octet-stream" | |
// above.... |
||
$cont = $svnMimeType; |
||
} |
} | |
|
| |
// If there's a MIME type associated with this format, then we deliver it |
// If the MIME type exists but is set to be ignored, set it to an empty string. | |
// with this information |
if (!empty($mimeType)) { | |
foreach ($config->inlineMimeTypes as $inlineType) { | ||
if (preg_match('|'.$inlineType.'|', $mimeType)) { | ||
$mimeType = ''; | ||
break; | ||
} | ||
} | ||
} | ||
|
| |
if (!empty($cont) && $rep->hasReadAccess($path, false)) { |
// If a MIME type is associated with the file, deliver with Content-Type header. | |
if (!empty($mimeType) && $rep->hasReadAccess($path, false)) { | ||
$base = basename($path); |
$base = basename($path); | |
|
header('Content-Type: '.$mimeType); | |
header("Content-Type: $cont"); |
//header('Content-Length: '.$size); | |
//header("Content-Length: $size"); |
header('Content-Disposition: inline; filename='.urlencode($base)); | |
header("Content-Disposition: inline; filename=".urlencode($base)); |
||
|
||
$svnrep->getFileContents($path, "", $rev); |
$svnrep->getFileContents($path, "", $rev); | |
|
||
exit; |
exit; | |
} |
} | |
|
| |
// There's no associated MIME type. Show the file using WebSVN. |
// Display the file inline using WebSVN. | |
|
| |
$url = $config->getURL($rep, $path, "file"); |
$url = $config->getURL($rep, $path, "file"); | |
|
| |
if ($rev != $youngest) { |
if ($rev != $youngest) { | |
$vars["goyoungestlink"] = "<a href=\"${url}\">${lang["GOYOUNGEST"]}</a>"; |
$vars["goyoungestlink"] = "<a href=\"${url}\">${lang["GOYOUNGEST"]}</a>"; | |
Line 134... | Line 139... | |
$url = $config->getURL($rep, $path, "diff"); |
$url = $config->getURL($rep, $path, "diff"); | |
$vars["prevdifflink"] = "<a href=\"${url}rev=$passrev\">${lang["DIFFPREV"]}</a>"; |
$vars["prevdifflink"] = "<a href=\"${url}rev=$passrev\">${lang["DIFFPREV"]}</a>"; | |
|
| |
$url = $config->getURL($rep, $path, "blame"); |
$url = $config->getURL($rep, $path, "blame"); | |
$vars["blamelink"] = "<a href=\"${url}rev=$passrev\">${lang["BLAME"]}</a>"; |
$vars["blamelink"] = "<a href=\"${url}rev=$passrev\">${lang["BLAME"]}</a>"; | |
| ||
if ($rep->isDownloadAllowed($path)) { | ||
$url = $config->getURL($rep, $path, "dl"); | ||
$vars["dllink"] = "<a href=\"${url}rev=$passrev\">${lang["DOWNLOAD"]}</a>"; | ||
} | ||
|
| |
$listing = array(); |
$listing = array(); | |
|
| |
$vars["version"] = $version; |
$vars["version"] = $version; | |
|
|