getRssMaxEntries(); $quiet = (isset($_REQUEST['quiet'])); // Find the base URL name if ($config->multiViews) { $baseurl = ''; } else { $baseurl = dirname($_SERVER['PHP_SELF']); if ($baseurl != '' && $baseurl != DIRECTORY_SEPARATOR && $baseurl != '\\' && $baseurl != '/') { $baseurl .= '/'; } else { $baseurl = '/'; } } if ($path == '' || $path{0} != '/') { $ppath = '/'.$path; } else { $ppath = $path; } if (!$rep) { header('HTTP/1.x 404 Not Found', true, 404); print 'Unable to access resource at path: '.xml_entities($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: '.xml_entities($path); exit; } // 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 (!$history) { header('HTTP/1.x 404 Not Found', true, 404); echo $lang['NOPATH']; exit; } header('Content-Type: application/xml; charset=utf-8'); 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(); } } $bugtraq = new Bugtraq($rep, $svnrep, $ppath); // Generate RSS 2.0 feed $rss = ''; $rss .= ''; $rss .= ''.escape($rep->getDisplayName().($path ? ' - '.$path : '')).''; $rss .= ''.escape($lang['RSSFEEDTITLE'].' - '.$repname).''; $rss .= ''.date('r').''; // RFC 2822 date format $rss .= 'WebSVN '.$vars['version'].''; // URL for matching WebSVN log page $rss .= ''.getFullURL($baseurl.$config->getURL($rep, $path, 'log').(@$_REQUEST['isdir'] == 1 ? 'isdir=1&' : '').'max='.$max.'&'.createRevAndPegString($passrev, $peg)).''; // URL where this original RSS feed can be found $rss .= ''."\n"; if (is_array($history->entries)) { $itemURL = $baseurl.$config->getURL($rep, $path, 'revision'); if (@$_REQUEST['isdir'] == 1 || $path == '' || $path == '/') $itemURL .= 'isdir=1&'; foreach ($history->entries as $r) { $wordLimit = 10; // Display only up to the first 10 words of the log message $title = trim($r->msg); $title = str_replace(array("\r\n", "\r", "\n", "\t"), ' ', $title); $words = explode(' ', $title, $wordLimit + 1); if (count($words) > $wordLimit) { $title = implode(' ', array_slice($words, 0, $wordLimit)).' ...'; } $title = $lang['REV'].' '.$r->rev.' -- '.$title; $description = '
'.$r->author.' -- '.count($r->mods).' '.$lang['FILESMODIFIED'].'
'.nl2br($bugtraq->replaceIDs(create_anchors(str_replace('<', '<', $r->msg)))).'
'; if (!$quiet) { usort($r->mods, 'SVNLogEntry_compare'); foreach ($r->mods as $modifiedResource) { switch ($modifiedResource->action) { case 'A': $description .= '+ '; break; case 'M': $description .= '~ '; break; case 'D': $description .= 'x '; break; } $description .= $modifiedResource->path; if ($modifiedResource->copyfrom != '') { $description .= ' (copied from '.$modifiedResource->copyfrom.'@'.$modifiedResource->copyrev.')'; } $description .= '
'; } } // skip items with no access if ($r->committime) { $rss .= ''; $rss .= ''.date('r', $r->committime).''; $rss .= ''.escape($r->author).''; $rss .= ''.escape($title).''; $rss .= ''.escape($description).''; $itemLink = getFullURL($itemURL.createRevAndPegString($r->rev,$peg)); $rss .= ''.$itemLink.''; $rss .= ''.$itemLink.''; $rss .= ''."\n"; } } } $rss .= '
'; if ($rep->isRssCachingEnabled()) { $file = fopen($cache, 'w+'); if ($file) { fputs($file, $rss); fclose($file); touch($cache, $history->curEntry->committime); // set timestamp to commit time } else { echo 'Error creating RSS cache file, please check write permissions.'; } } echo $rss;