Exemple #1
0
function createPathLinks($rep, $path, $rev, $peg = '')
{
    global $vars, $config;
    $pathComponents = explode('/', htmlentities($path, ENT_QUOTES, 'UTF-8'));
    $count = count($pathComponents);
    // The number of links depends on the last item.	It's empty if we're looking
    // at a directory, and non-empty if we're looking at a file.
    if (empty($pathComponents[$count - 1])) {
        $limit = $count - 2;
        $dir = true;
    } else {
        $limit = $count - 1;
        $dir = false;
    }
    $passRevString = createRevAndPegString($rev, $peg);
    $pathSoFar = '/';
    $pathSoFarURL = $config->getURL($rep, $pathSoFar, 'dir') . $passRevString;
    $vars['pathlinks'] = '<a href="' . $pathSoFarURL . '" class="root"><span>(root)</span></a>/';
    for ($n = 1; $n < $limit; $n++) {
        $pathSoFar .= html_entity_decode($pathComponents[$n]) . '/';
        $pathSoFarURL = $config->getURL($rep, $pathSoFar, 'dir') . $passRevString;
        $vars['pathlinks'] .= '<a href="' . $pathSoFarURL . '#' . anchorForPath($pathSoFar) . '">' . $pathComponents[$n] . '</a>/';
    }
    if (!empty($pathComponents[$n])) {
        $pegrev = $peg ? ' <a class="peg" href="' . '?' . htmlspecialchars(str_replace('&peg=' . $peg, '', $_SERVER['QUERY_STRING']), ENT_NOQUOTES) . '">@ ' . $peg . '</a>' : '';
        if ($dir) {
            $vars['pathlinks'] .= '<span class="dir">' . $pathComponents[$n] . '/' . $pegrev . '</span>';
        } else {
            $vars['pathlinks'] .= '<span class="file">' . $pathComponents[$n] . $pegrev . '</span>';
        }
    }
}
Exemple #2
0
function fileLink($path, $file, $returnjoin = false)
{
    global $config, $rep, $passrev, $passRevString, $peg;
    if ($path == '' || $path[0] != '/') {
        $ppath = '/' . $path;
    } else {
        $ppath = $path;
    }
    if ($ppath[strlen($ppath) - 1] != '/') {
        $ppath .= '/';
    }
    if ($file[0] == '/') {
        $pfile = substr($file, 1);
    } else {
        $pfile = $file;
    }
    if ($returnjoin) {
        return $ppath . $pfile;
    }
    $isDir = $pfile[strlen($pfile) - 1] == '/';
    if ($isDir) {
        $url = $config->getURL($rep, $ppath . $pfile, 'dir') . $passRevString;
        if ($config->treeView) {
            $id = anchorForPath($ppath . $pfile);
            $url .= '#' . $id . '" id="' . $id;
        }
    } else {
        $url = $config->getURL($rep, $ppath . $pfile, 'file') . $passRevString;
    }
    // NOTE: If it's a directory in tree view, this also injects an "id" attribute
    return '<a href="' . removeURLSeparator($url) . '">' . $pfile . '</a>';
}
Exemple #3
0
 }
 // Save the entry from which we pull information for the current revision.
 $logEntry = isset($history->entries[0]) ? $history->entries[0] : null;
 $bugtraq = new Bugtraq($rep, $svnrep, $ppath);
 $vars['action'] = '';
 $vars['rev'] = $rev;
 $vars['peg'] = $peg;
 $vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8');
 $vars['date'] = $logEntry ? $logEntry->date : '';
 $vars['author'] = $logEntry ? $logEntry->author : '';
 $vars['log'] = $logEntry ? nl2br($bugtraq->replaceIDs(create_anchors(xml_entities($logEntry->msg)))) : '';
 $isDir = @$_REQUEST['isdir'] == 1 || $path == '' || $path == '/';
 $vars['logurl'] = $config->getURL($rep, $path, 'log') . $passRevString . ($isDir ? '&amp;isdir=1' : '');
 $vars['loglink'] = '<a href="' . $vars['logurl'] . '">' . $lang['VIEWLOG'] . '</a>';
 $dirPath = $isDir ? $path : dirname($path) . '/';
 $vars['directoryurl'] = $config->getURL($rep, $dirPath, 'dir') . $passRevString . '#' . anchorForPath($dirPath);
 $vars['directorylink'] = '<a href="' . $vars['directoryurl'] . '">' . $lang['LISTING'] . '</a>';
 if ($path != $dirPath) {
     $vars['filedetailurl'] = $config->getURL($rep, $path, 'file') . $passRevString;
     $vars['filedetaillink'] = '<a href="' . $vars['filedetailurl'] . '">' . $lang['FILEDETAIL'] . '</a>';
     $vars['blameurl'] = $config->getURL($rep, $path, 'blame') . $passRevString;
     $vars['blamelink'] = '<a href="' . $vars['blameurl'] . '">' . $lang['BLAME'] . '</a>';
 }
 if ($rep->isRssEnabled()) {
     $vars['rssurl'] = $config->getURL($rep, $path, 'rss') . ($peg ? 'peg=' . $peg : '');
     $vars['rsslink'] = '<a href="' . $vars['rssurl'] . '">' . $lang['RSSFEED'] . '</a>';
 }
 $changes = $logEntry ? $logEntry->mods : array();
 if (!is_array($changes)) {
     $changes = array();
 }