url() public static method

Generate a URL that links into Chora.
public static url ( string $script, string $uri = '', array $args = [], string $anchor = '' ) : string
$script string Name of the Chora script to link into.
$uri string The path being browsed.
$args array Key/value pair of any GET parameters to append.
$anchor string Anchor entity name.
return string The URL, with session information if necessary.
Esempio n. 1
0
    if (!isset($title)) {
        $title = _("Commits to:");
    }
}
try {
    $ps = $VC->getPatchset($ps_opts);
    $patchsets = $ps->getPatchsets();
} catch (Horde_Vcs_Exception $e) {
    Chora::fatal($e);
}
if (empty($patchsets)) {
    Chora::fatal(_("Commit Not Found"), '404 Not Found');
}
$page_output->addScriptFile('tables.js', 'horde');
$page_output->addScriptFile('quickfinder.js', 'horde');
Chora::header($title);
echo Chora::getHistoryViews($where)->render('patchsets');
require CHORA_TEMPLATES . '/patchsets/header_table.inc';
$diff_img = Horde::img('diff.png', _("Diff"));
reset($patchsets);
while (list($id, $patchset) = each($patchsets)) {
    $patchset_link = Chora::url('commit', $where, array('commit' => $id))->link(array('title' => $id)) . htmlspecialchars($VC->abbrev($id)) . '</a>';
    $commitDate = Chora::formatDate($patchset['date']);
    $readableDate = Chora::readableTime($patchset['date'], true);
    $author = Chora::showAuthorName($patchset['author'], true);
    $logMessage = Chora::formatLogMessage($patchset['log']);
    $tags = array_merge($patchset['branch'], $patchset['tags']);
    require CHORA_TEMPLATES . '/patchsets/ps.inc';
}
require CHORA_TEMPLATES . '/patchsets/footer.inc';
$page_output->footer();
Esempio n. 2
0
            // Not supported in any other VC systems yet.
            $allDiffsLink = '';
        }
        $files = array();
        $dir = dirname($where);
        foreach ($patchset['members'] as $member) {
            $file = array();
            $mywhere = is_a($VC, 'VC_svn') ? $member['file'] : $dir . DIRECTORY_SEPARATOR . $member['file'];
            $file['file'] = Horde::link(Chora::url('patchsets', $mywhere), $member['file']) . $member['file'] . '</a>';
            if ($member['from'] == 'INITIAL') {
                $file['from'] = '<i>' . _("New File") . '</i>';
                $file['diff'] = '';
            } else {
                $file['from'] = Horde::link(Chora::url('co', $mywhere, array('r' => $member['from'])), $member['from']) . $member['from'] . '</a>';
                $file['diff'] = Horde::link(Chora::url('diff', $mywhere, array('r1' => $member['from'], 'r2' => $member['to'], 'ty' => 'u')), _("Diff")) . '(' . _("Diff") . ')';
            }
            if (substr($member['to'], -6) == '(DEAD)') {
                $file['to'] = '<i>' . _("Deleted") . '</i>';
                $file['diff'] = '';
            } else {
                $file['to'] = Horde::link(Chora::url('co', $mywhere, array('r' => $member['to'])), $member['to']) . $member['to'] . '</a>';
            }
            $files[] = $file;
        }
        $logMessage = Chora::formatLogMessage($patchset['log']);
        require CHORA_TEMPLATES . '/patchsets/ps.inc';
    }
    require $registry->getParam('templates', 'horde') . '/common-footer.inc';
} else {
    Chora::fatal('404 Not Found', "{$where}: no such file or directory");
}
Esempio n. 3
0
 /**
  */
 public function topbarCreate(Horde_Tree_Renderer_Base $tree, $parent = null, array $params = array())
 {
     $sourceroots = Chora::sourceroots();
     asort($sourceroots);
     foreach ($sourceroots as $key => $val) {
         $tree->addNode(array('id' => $parent . $key, 'parent' => $parent, 'label' => $val['name'], 'expanded' => false, 'params' => array('icon' => Horde_Themes::img('tree/folder.png'), 'url' => Chora::url('browsedir', '', array('rt' => $key)))));
     }
 }
Esempio n. 4
0
<?php

/**
 * $Horde: chora/history.php,v 1.48 2004/01/17 22:57:25 jan Exp $
 *
 * Copyright 2000-2004 Anil Madhavapeddy <*****@*****.**>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */
define('CHORA_BASE', dirname(__FILE__));
require_once CHORA_BASE . '/lib/base.php';
// Exit if it's not supported.
if (is_a($VC, 'VC_svn')) {
    header('Location: ' . Chora::url('cvs', $where));
    exit;
}
/* Spawn the file object */
$fl =& $VC->getFileObject($where);
/* $trunk contains an array of trunk revisions */
$trunk = array();
/* $branches is a hash with the branch revision as the
 * key, and value being an array of revs on that branch */
$branches = array();
/* Populate $col with a list of all the branch points */
foreach ($fl->branches as $rev => $sym) {
    $branches[$rev] = array();
}
/* For every revision, figure out if it is a trunk
 * revision, or instead associated with a branch.
 * If trunk, add it to the $trunk array.
Esempio n. 5
0
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */
define('CHORA_BASE', dirname(__FILE__));
require_once CHORA_BASE . '/lib/base.php';
/* Spawn the file object. */
$fl =& $VC->getFileObject($where);
/* Retrieve the desired revision from the GET variable. */
$rev = Util::getFormData('rev', '1.1');
if (!VC_Revision::valid($rev)) {
    Chora::fatal('404 Not Found', "Revision {$rev} not found");
}
$ann =& $VC->getAnnotateObject($fl);
Chora::checkError($lines = $ann->doAnnotate($rev));
$title = sprintf(_("Source Annotation of %s for version %s"), Text::htmlAllSpaces($where), $rev);
$extraLink = sprintf('<a href="%s">%s</a> <b>|</b> <a href="%s">%s</a>', Chora::url('co', $where, array('r' => $rev)), _("View"), Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download"));
require CHORA_TEMPLATES . '/common-header.inc';
Chora::menu();
require CHORA_TEMPLATES . '/headerbar.inc';
require CHORA_TEMPLATES . '/annotate/header.inc';
$author = '';
$style = 0;
foreach ($lines as $line) {
    $lineno = $line['lineno'];
    $prevAuthor = $author;
    $author = Chora::showAuthorName($line['author']);
    if ($prevAuthor != $author) {
        $style = ++$style % 3;
    }
    $rev = $line['rev'];
    $line = Text::htmlspaces($line['line']);
Esempio n. 6
0
    echo implode("\n", $VC->diff($fl, $vars->r1, $vars->r2, array('num' => $num, 'type' => $type))) . "\n";
    exit;
}
/* Human-Readable diff. */
$abbrev_r1 = $VC->abbrev($vars->r1);
$abbrev_r2 = $VC->abbrev($vars->r2);
$title = sprintf(_("Diff for %s between version %s and %s"), $injector->getInstance('Horde_Core_Factory_TextFilter')->filter($where, 'space2html', array('encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2);
/* Format log entries. */
$log_messages = array();
foreach ($VC->getRevisionRange($fl, $vars->r1, $vars->r2) as $val) {
    $clog = $fl->getLog($val);
    if (!is_null($clog)) {
        $log_messages[] = $clog;
    }
}
$page_output->addScriptFile('stripe.js', 'horde');
Chora::header($title);
require CHORA_TEMPLATES . '/diff/header.inc';
$mime_type = Horde_Mime_Magic::filenameToMIME($fullname);
if (substr($mime_type, 0, 6) == 'image/') {
    /* Check for images. */
    $url1 = Chora::url('co', $where, array('r' => $vars->r1, 'p' => 1));
    $url2 = Chora::url('co', $where, array('r' => $vars->r2, 'p' => 1));
    echo "<tr><td><img src=\"{$url1}\" alt=\"" . htmlspecialchars($vars->r1) . '" /></td>' . "<td><img src=\"{$url2}\" alt=\"" . htmlspecialchars($vars->r2) . '" /></td></tr>';
} else {
    $view = $injector->createInstance('Horde_View');
    $view->addHelper('Chora_Diff_Helper');
    echo $view->diff($fl, $vars->r1, $vars->r2);
    echo $view->diffCaption();
}
$page_output->footer();
Esempio n. 7
0
 /**
  * Generate the link used for various file views.
  *
  * @param string $where    The current file path.
  * @param string $rev      The current revision.
  *
  * @return array  An array of file view links.
  */
 public static function getFileViews($where, $rev)
 {
     global $injector, $VC;
     $tabs = new Horde_Core_Ui_Tabs(null, $injector->getInstance('Horde_Variables'));
     $tabs->addTab(_("_View"), Chora::url('co', $where, array('r' => $rev)), 'co');
     $tabs->addTab(_("_Annotate"), Chora::url('annotate', $where, array('rev' => $rev)), 'annotate');
     if ($VC->hasFeature('snapshots')) {
         $snapdir = dirname($VC->getFile($where)->getPath());
         $tabs->addTab(_("_Snapshot"), Chora::url('browsedir', $snapdir == '.' ? '' : $snapdir . '/', array('onb' => $rev)));
     }
     $tabs->addTab(_("_Download"), Chora::url('co', $where, array('r' => $rev, 'p' => 1)));
     return $tabs;
 }
Esempio n. 8
0
 function getFileViews()
 {
     global $where;
     $views = array();
     $current = $_SERVER['PHP_SELF'];
     if (!empty($_SERVER['PATH_INFO'])) {
         $current = str_replace($_SERVER['PATH_INFO'], '', $current);
     }
     $current = str_replace('.php', '', basename($current));
     $views[] = $current == 'cvs' ? '<i>' . _("Logs") . '</i>' : Horde::link(Chora::url('cvs', $where), _("Logs"), 'widget') . _("Logs") . '</a>';
     // Subversion supports patchsets natively
     if (!empty($GLOBALS['conf']['paths']['cvsps']) || is_a($GLOBALS['VC'], 'VC_svn')) {
         $views[] = $current == 'patchsets' ? '<i>' . _("Patchsets") . '</i>' : Horde::link(Chora::url('patchsets', $where), _("Patchsets"), 'widget') . _("Patchsets") . '</a>';
     }
     if (!is_a($GLOBALS['VC'], 'VC_svn')) {
         $views[] = $current == 'history' ? '<i>' . _("Branches") . '</i>' : Horde::link(Chora::url('history', $where), _("Branches"), 'widget') . _("Branches") . '</a>';
     }
     if (!empty($GLOBALS['conf']['paths']['cvsgraph']) && !is_a($GLOBALS['VC'], 'VC_svn')) {
         $views[] = $current == 'cvsgraph' ? '<i>' . _("Graph") . '</i>' : Horde::link(Chora::url('cvsgraph', $where), _("Graph"), 'widget') . _("Graph") . '</a>';
     }
     $views[] = $current == 'stats' ? '<i>' . _("Statistics") . '</i>' : Horde::link(Chora::url('stats', $where), _("Statistics"), 'widget') . _("Statistics") . '</a>';
     return _("View:") . ' ' . implode(' | ', $views);
 }
Esempio n. 9
0
   </li>
  </ul>

  <?php 
    if ($logMessage['branch']) {
        ?>
  <h4><?php 
        echo _("Branches");
        ?>
</h4>
  <ul>
  <?php 
        foreach ($logMessage['branch'] as $branchname) {
            ?>
   <li><a href="<?php 
            echo Chora::url('browsefile', $GLOBALS['where'], array('onb' => $branchname));
            ?>
"><?php 
            echo $this->escape($branchname);
            ?>
</a></li>
  <?php 
        }
        ?>
  </ul>
  <?php 
    }
    ?>

  <?php 
    if (!empty($logMessage['tags'])) {
Esempio n. 10
0
         foreach ($args as $key => $val) {
             $argstr .= "-{$key} '{$val}' ";
         }
     }
     header('Content-Type: image/png');
     passthru($conf['paths']['cvsgraph'] . ' ' . $argstr . ' ' . $file);
 } else {
     // Display the wrapper page for the image.
     $title = sprintf(_("CVS Graph for %s"), Text::htmlAllSpaces($where));
     $upwhere = preg_replace('|[^/]+$|', '', $where);
     $extraLink = Chora::getFileViews();
     require CHORA_TEMPLATES . '/common-header.inc';
     Chora::menu();
     require CHORA_TEMPLATES . '/headerbar.inc';
     $imgUrl = Chora::url('cvsgraph', $where, array('show_image' => 1));
     $args = array('c' => $conf['paths']['cvsgraph_conf'], 'M' => 'graphMap', 'r' => $root, '0' => ini_get('arg_separator.output'), '1' => Chora::url('cvs', $where, array('dummy' => 'true')), '2' => Chora::url('diff', $where, array('dummy' => 'true')), '3' => Chora::url('co', $where, array('dummy' => 'true')));
     // Build up the argument string.
     $argstr = '';
     if (OS_WINDOWS) {
         foreach ($args as $key => $val) {
             $argstr .= "-{$key} \"{$val}\" ";
         }
     } else {
         foreach ($args as $key => $val) {
             $argstr .= "-{$key} '{$val}' ";
         }
     }
     // Generate the imagemap.
     $map = shell_exec($conf['paths']['cvsgraph'] . ' ' . $argstr . ' -i ' . $file);
     require CHORA_TEMPLATES . '/cvsgraph/cvsgraph.inc';
     require $registry->getParam('templates', 'horde') . '/common-footer.inc';
Esempio n. 11
0
     }
     if ($prevRevision = $fl->queryPreviousRevision($lg->queryRevision())) {
         $changedLines = $lg->queryChangedLines();
         $coloredDiffURL = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev, 'ty' => 'h'));
         $longDiffURL = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev, 'ty' => 'h', 'num' => 10));
         $uniDiffURL = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev, 'ty' => 'u'));
         $nowsDiffURL = Chora::url('diff', $where, array('ws' => 0, 'r1' => $prevRevision, 'r2' => $rev, 'ty' => 'u'));
     }
     $manyRevisions = !($fl->queryRevision() === '1.1');
     if ($manyRevisions) {
         $selCvsURL = Chora::url('cvs', $where, array('r1' => $rev, 'onb' => $onb));
         if (!empty($r1)) {
             $selColoredDiffURL = Chora::url('diff', $where, array('r1' => $r1, 'r2' => $rev, 'ty' => 'h'));
             $selLongDiffURL = Chora::url('diff', $where, array('r1' => $r1, 'r2' => $rev, 'ty' => 'h', 'num' => 10));
             $selUniDiffURL = Chora::url('diff', $where, array('r1' => $r1, 'r2' => $rev, 'ty' => 'u'));
             $selNowsDiffURL = Chora::url('diff', $where, array('ws' => 0, 'r1' => $r1, 'r2' => $rev, 'ty' => 'u'));
         }
     }
     $logMessage = Chora::formatLogMessage($lg->log);
     if ($r1 === $rev) {
         $bgclass = 'diff-selected';
     } else {
         $bgclass = 'control';
     }
     require CHORA_TEMPLATES . '/log/rev.inc';
 }
 $first = end($fl->logs);
 $diffValueLeft = $first->rev;
 $diffValueRight = $fl->queryRevision();
 $sel = '';
 foreach ($fl->symrev as $sm => $rv) {
Esempio n. 12
0
 * it should never change */
header('Cache-Control: max-age=604800');
/* Title to use for html output pages */
$title = sprintf(_("Diff for %s between version %s and %s"), Text::htmlallspaces($where), $r1, $r2);
/* All is ok, proceed with the diff */
switch ($type) {
    case 'column':
        /* We'll need to know the mime type to modify diffs based on the mime
           type. */
        require_once HORDE_LIBS . 'Horde/MIME/Magic.php';
        $mime_type = MIME_Magic::filenameToMIME($fullname);
        if ($browser->isViewable($mime_type)) {
            // The above are images that most web browsers can inline
            // We borrow a *large* part of this from the Human-Readable case
            $url1 = Chora::url('co', $where, array('r' => $r1));
            $url2 = Chora::url('co', $where, array('r' => $r2));
            $path = $fl->queryModulePath();
            // Get the log entry so we can display it
            $log = $fl->logs[$r2];
            $log_print = Chora::formatLogMessage($log->queryLog());
            // Start the html output, include menu bar and headers.
            require CHORA_TEMPLATES . '/common-header.inc';
            Chora::menu();
            require CHORA_TEMPLATES . '/headerbar.inc';
            // Create a table for the two revisions, display log, and
            // print a labeled bar for the revisions.
            require CHORA_TEMPLATES . '/diff/hr/header.inc';
            echo "<td><img src=\"{$url1}\"></td>";
            echo "<td><img src=\"{$url2}\"></td>";
            echo '</tr>';
            require $registry->getParam('templates', 'horde') . '/common-footer.inc';
Esempio n. 13
0
<div class="diff"<?php 
if ($id) {
    echo ' id="' . $id . '"';
}
?>
>
 <div class="diff-header"><h4><a href="<?php 
echo Chora::url('co', $file->getSourcerootPath(), array('onb' => $r1));
?>
"><?php 
echo $file->getSourcerootPath();
?>
</a></h4></div>
 <div class="diff-container diff-subheader">
  <div class="diff-left"><?php 
echo $this->escape($r1);
?>
</div>
  <div class="diff-right"><?php 
echo $this->escape($r2);
?>
</div>
 </div>

 <div class="diff-container">
  <div class="diff-left">
   <div class="diff-linenumbers">
    <ol>
    <?php 
foreach ($leftNumbers as $ln) {
    ?>
Esempio n. 14
0
        $lg = $currFile->getLastLog();
        $realname = $currFile->getFileName();
        $mimeType = Horde_Mime_Magic::filenameToMIME($realname);
        $currFile->mimeType = $mimeType;
        if (Horde_String::lower(Horde_String::substr($realname, 0, 6)) == 'readme') {
            $readmes[] = $currFile;
        }
        $icon = $injector->getInstance('Horde_Core_Factory_MimeViewer')->getIcon($mimeType);
        $author = Chora::showAuthorName($lg->getAuthor());
        $filerev = $lg->getRevision();
        $date = $lg->getDate();
        $log = $lg->getMessage();
        $attic = $currFile->isDeleted();
        $fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname;
        $name = $injector->getInstance('Horde_Core_Factory_TextFilter')->filter($realname, 'space2html', array('encode' => true, 'encode_all' => true));
        $url = Chora::url('browsefile', $fileName, $branchArgs);
        $readableDate = Chora::readableTime($date);
        if ($log) {
            $shortLog = Horde_String::truncate(str_replace("\n", ' ', trim($log)), $conf['options']['shortLogLength']);
        }
        require CHORA_TEMPLATES . '/directory/file.inc';
    }
    echo '</tbody>';
}
echo '</table>';
if ($readmes) {
    $readmeCollection = new Chora_Readme_Collection($readmes);
    $readmeFile = $readmeCollection->chooseReadme();
    $readmeRenderer = new Chora_Renderer_File_Html($injector->createInstance('Horde_View'), $readmeFile, $readmeFile->getRevision());
    echo $readmeRenderer->render();
}
Esempio n. 15
0
        }
    } else {
        foreach ($args as $key => $val) {
            $argstr .= "-{$key} '{$val}' ";
        }
    }
    header('Content-Type: image/png');
    passthru($conf['paths']['cvsgraph'] . ' ' . $argstr . ' ' . $file);
    exit;
}
// Display the wrapper page for the image.
$title = _("Graph for:");
Chora::header($title);
echo Chora::getHistoryViews($where)->render('cvsgraph');
$imgUrl = Chora::url('cvsgraph', $where, array('show_image' => 1));
$args = array('c' => $conf['paths']['cvsgraph_conf'], 'M' => 'graphMap', 'r' => $root, '0' => '&amp;', '1' => Chora::url('browsefile', $where, array('dummy' => 'true')), '2' => Chora::url('diff', $where, array('dummy' => 'true')), '3' => Chora::url('co', $where, array('dummy' => 'true')));
// Build up the argument string.
$argstr = '';
if (!strncasecmp(PHP_OS, 'WIN', 3)) {
    foreach ($args as $key => $val) {
        $argstr .= "-{$key} \"{$val}\" ";
    }
} else {
    foreach ($args as $key => $val) {
        $argstr .= "-{$key} '{$val}' ";
    }
}
// Generate the imagemap.
$map = shell_exec($conf['paths']['cvsgraph'] . ' ' . $argstr . ' -i ' . $file);
require CHORA_TEMPLATES . '/cvsgraph/cvsgraph.inc';
$page_output->footer();
Esempio n. 16
0
/**
 * Copyright 2000-2015 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author  Anil Madhavapeddy <*****@*****.**>
 * @package Chora
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('chora');
// TODO - This currently doesn't work.
Chora::fatal('History display is currently broken', '500 Internal Server Error');
/* Exit if it's not supported. */
if (!$VC->hasFeature('branches')) {
    Chora::url('browsefile', $where)->redirect();
}
$colset = array('#ccdeff', '#ecf', '#fec', '#efc', '#cfd', '#dcdba0');
$branch_colors = $colStack = array();
foreach ($branches as $brrev => $brcont) {
    if (!count($colStack)) {
        $colStack = $colset;
    }
    $branch_colors[$brrev] = array_shift($colset);
}
/**
 * This takes a row and a column, and recursively iterates through any
 * sub-revisions or branches from the value that was already in the
 * grid at the co-ordinates that it was called with.
 *
 * Calling this function on every revision of the trunk is enough to
Esempio n. 17
0
     Chora::fatal(sprintf(_("Revision %s for file %s not found."), $r, $file));
 }
 /* Get this revision's attributes in printable form. */
 $log = $file->logs[$r];
 $commitDate = strftime('%c', $log->date);
 $readableDate = VC_File::readableTime($log->date, true);
 $aid = $log->queryAuthor();
 $author = Chora::showAuthorName($aid, true);
 if (!empty($log->tags)) {
     $commitTags = implode(', ', $log->tags);
 } else {
     $commitTags = '';
 }
 $branchPointsArr = array();
 foreach ($log->querySymbolicBranches() as $symb => $bra) {
     $branchPointsArr[] = '<a href="' . Chora::url('cvs', $where, array('onb' => $bra)) . '">' . $symb . '</a>';
 }
 /* Calculate the current branch name and revision. */
 $branchPoints = implode(' , ', $branchPointsArr);
 $branchRev = VC_Revision::strip($r, 1);
 if (@isset($fl->branches[$branchRev])) {
     $branchName = $fl->branches[$branchRev];
 } else {
     $branchName = '';
 }
 if ($prevRevision = VC_Revision::prev($log->queryRevision())) {
     $changedLines = $log->queryChangedLines();
 }
 $log_print = Chora::formatLogMessage($log->queryLog());
 $i = 0;
 require CHORA_TEMPLATES . '/common-header.inc';