Beispiel #1
0
     $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');
     // Get the file contents and pipe into gzip. All this without creating
     // a temporary file. Damn clever.
     $svnrep->getFileContents($path, '', $rev, $peg, '| ' . $config->gzip . ' -n -f');
     exit;
 }
 // Check to see if we should serve it with a particular content-type.
 // The content-type could come from an svn:mime-type property on the
 // file, or from the $contentType array in setup.php.
 if (!$rep->getIgnoreSvnMimeTypes()) {
     $svnMimeType = $svnrep->getProperty($path, 'svn:mime-type', $rev);
 }
 if (!$rep->getIgnoreWebSVNContentTypes()) {
     $setupContentType = @$contentType[$extn];
 }
 // Use the documented priorities when establishing what content-type to use.
 if (!empty($svnMimeType) && $svnMimeType != 'application/octet-stream') {
     $mimeType = $svnMimeType;
 } else {
Beispiel #2
0
            $diff = $config->getURL($rep, $path, 'diff') . $passRevString;
            $passIgnoreWhitespace = $ignoreWhitespace ? '&ignorews=1' : '';
            if ($all) {
                $vars['showcompactlink'] = '<a href="' . $diff . $passIgnoreWhitespace . '">' . $lang['SHOWCOMPACT'] . '</a>';
            } else {
                $vars['showalllink'] = '<a href="' . $diff . $passIgnoreWhitespace . '&amp;all=1' . '">' . $lang['SHOWENTIREFILE'] . '</a>';
            }
            $passShowAll = $all ? '&amp;all=1' : '';
            if ($ignoreWhitespace) {
                $vars['regardwhitespacelink'] = '<a href="' . $diff . $passShowAll . '">' . $lang['REGARDWHITESPACE'] . '</a>';
            } else {
                $vars['ignorewhitespacelink'] = '<a href="' . $diff . $passShowAll . '&amp;ignorews=1">' . $lang['IGNOREWHITESPACE'] . '</a>';
            }
            // Get the contents of the two files
            $newerFile = tempnam($config->getTempDir(), '');
            $highlightedNew = $svnrep->getFileContents($history->entries[0]->path, $newerFile, $history->entries[0]->rev, $peg, '', true);
            $olderFile = tempnam($config->getTempDir(), '');
            $highlightedOld = $svnrep->getFileContents($history->entries[1]->path, $olderFile, $history->entries[1]->rev, $peg, '', true);
            // TODO: Figured out why diffs across a move/rename are currently broken.
            $ent = !$highlightedNew && !$highlightedOld;
            $listing = do_diff($all, $ignoreWhitespace, $ent, $newerFile, $olderFile);
            // Remove our temporary files
            @unlink($newerFile);
            @unlink($olderFile);
        }
    }
    if (!$rep->hasReadAccess($path, false)) {
        $vars['error'] = $lang['NOACCESS'];
    }
}
$vars['template'] = 'diff';
Beispiel #3
0
     $vars['diffurl'] = $config->getURL($rep, $path, 'diff') . $passRevString;
     $vars['difflink'] = '<a href="' . $vars['diffurl'] . '">' . $lang['DIFFPREV'] . '</a>';
 }
 if ($rep->isRssEnabled()) {
     $vars['rssurl'] = $config->getURL($rep, $path, 'rss') . ($peg ? 'peg=' . $peg : '');
     $vars['rsslink'] = '<a href="' . $vars['rssurl'] . '">' . $lang['RSSFEED'] . '</a>';
 }
 // Check for binary file type before grabbing blame information.
 $svnMimeType = $svnrep->getProperty($path, 'svn:mime-type', $rev, $peg);
 if (!$rep->getIgnoreSvnMimeTypes() && preg_match('~application/*~', $svnMimeType)) {
     $vars['warning'] = 'Cannot display blame info for binary file. (svn:mime-type = ' . $svnMimeType . ')';
     $vars['javascript'] = '';
 } else {
     // Get the contents of the file
     $tfname = tempnam($config->getTempDir(), '');
     $highlighted = $svnrep->getFileContents($path, $tfname, $rev, $peg, '', true);
     if ($file = fopen($tfname, 'r')) {
         // Get the blame info
         $tbname = tempnam($config->getTempDir(), '');
         $svnrep->getBlameDetails($path, $tbname, $rev, $peg);
         if ($blame = fopen($tbname, 'r')) {
             // Create an array of version/author/line
             $index = 0;
             $seen_rev = array();
             $last_rev = '';
             $row_class = '';
             while (!feof($blame) && !feof($file)) {
                 $blameline = fgets($blame);
                 if ($blameline != '') {
                     list($revision, $author, $remainder) = sscanf($blameline, '%d %s %s');
                     $empty = !$remainder;