require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('chora');
-/* If we know we're at a directory, just go to browse.php. */
+/* If we know we're at a directory, just go to browsedir.php. */
if ($atdir) {
require CHORA_BASE . '/browsedir.php';
exit;
if (!empty($dir)) {
$url = self::url('browsedir', $path . ($i == $dir_count && !$GLOBALS['atdir'] ? '' : '/'));
if (!empty($onb)) {
- $url = Horde_Util::addParameter($url, array('onb' => $onb));
+ $url = $url->add('onb', $onb);
}
$bar .= '/ <a href="' . $url . '">' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($dir, 'space2html', array('encode' => true, 'encode_all' => true)) . '</a> ';
}
*
* @return string The URL, with session information if necessary.
*/
- static public function url($script, $uri = '', $args = array(), $anchor = '')
+ static public function url($script, $uri = '', $args = array(),
+ $anchor = '')
{
- $arglist = self::_getArgList($GLOBALS['acts'], $GLOBALS['defaultActs'], $args);
+ $arglist = self::_getArgList($GLOBALS['acts'],
+ $GLOBALS['defaultActs'],
+ $args);
$script .= '.php';
if ($GLOBALS['conf']['options']['urls'] == 'rewrite') {
- if (in_array($script, array('browse.php', 'browsedir.php'))) {
+ if (in_array($script, array('browsefile.php', 'browsedir.php'))) {
if (substr($uri, 0, 1) == '/') {
$script = "browse$uri";
} else {
$script = "browse/$uri";
}
- if (isset($args['rt'])) {
- $script = urlencode($arglist['rt']) . "/-/$script";
- unset($arglist['rt']);
- }
+ $script = urlencode(isset($args['rt']) ? $args['rt'] : $GLOBALS['acts']['rt']) . "/-/$script";
+ unset($arglist['rt']);
} else {
$script .= '/' . $uri;
}
$arglist['f'] = $uri;
}
- $url = Horde_Util::addParameter(Horde::applicationUrl($script), $arglist);
+ return Horde::applicationUrl($script)->add($arglist)->setAnchor($anchor);
- return empty($anchor) ? $url : ($url . '#' . $anchor);
}
/**
return '<form action="#" id="repository-picker">' .
'<select onchange="location.href=this[this.selectedIndex].value">' .
'<option value="">' . _("Change repositories:") . '</option>' .
- implode(' , ', $arr) . '</select></form>';
+ implode('', $arr) . '</select></form>';
}
/**
$tags = array();
foreach ($lg->querySymbolicBranches() as $symb => $bra) {
- $tags[] = '<a href="' . self::url('browsefile', $where, array('onb' => $bra)) . '">'. htmlspecialchars($symb) . '</a>';
+ $tags[] = self::url('browsefile', $where, array('onb' => $bra))->link() . htmlspecialchars($symb) . '</a>';
}
foreach ($lg->queryTags() as $tag) {
reset($patchsets);
while (list($id, $patchset) = each($patchsets)) {
- $patchset_link = Horde::link(Chora::url('patchsets', $where, array('ps' => $id)), sprintf("Patchset for %s", $id)) . htmlspecialchars($VC->abbrev($id)) . '</a>';
+ $patchset_link = Chora::url('patchsets', $where, array('ps' => $id))
+ ->link(array('title' => sprintf("Patchset for %s", $id)))
+ . htmlspecialchars($VC->abbrev($id)) . '</a>';
$files = $tags = array();
foreach ($patchset['members'] as $member) {
$file = array();
- $file['file'] = Horde::link(Chora::url('co', $member['file'])) . htmlspecialchars($member['file']) . '</a>';
+ $file['file'] = Chora::url('co', $member['file'])->link()
+ . htmlspecialchars($member['file']) . '</a>';
if ($member['status'] == Horde_Vcs_Patchset::ADDED) {
$file['from'] = '<ins>' . _("New File") . '</ins>';
$file['diff'] = '';
} else {
- $file['from'] = Horde::link(Chora::url('co', $member['file'], array('r' => $member['from'])), $member['from']) . htmlspecialchars($VC->abbrev($member['from'])) . '</a>';
- $file['diff'] = Horde::link(Chora::url('diff', $member['file'], array('r1' => $member['from'], 'r2' => $member['to'])), _("Diff")) . ' ' . $diff_img . '</a>';
+ $file['from'] = Chora::url('co', $member['file'], array('r' => $member['from']))
+ ->link(array('title' => $member['from']))
+ . htmlspecialchars($VC->abbrev($member['from'])) . '</a>';
+ $file['diff'] = Chora::url('diff', $member['file'], array('r1' => $member['from'], 'r2' => $member['to']))
+ ->link(array('title' => _("Diff")))
+ . ' ' . $diff_img . '</a>';
}
if ($member['status'] == Horde_Vcs_Patchset::DELETED) {
$file['to'] = '<del>' . _("Deleted") . '</del>';
$file['diff'] = '';
} else {
- $file['to'] = Horde::link(Chora::url('co', $member['file'], array('r' => $member['to'])), $member['to']) . htmlspecialchars($VC->abbrev($member['to'])) . '</a>';
+ $file['to'] = Chora::url('co', $member['file'], array('r' => $member['to']))
+ ->link(array('title' => $member['to']))
+ . htmlspecialchars($VC->abbrev($member['to'])) . '</a>';
}
if (isset($member['added'])) {
<?php if (count($branches) > 1): ?>
<div class="options">
<span>
- <form method="get" action="browsedir.php">
+ <form method="get" action="<?php echo Chora::url('browsedir', Horde_Util::getFormData('f')) ?>">
<?php echo _("View Branch:") ?>
- <?php echo Chora::formInputs() ?>
- <input type="hidden" name="f" value="<?php echo htmlspecialchars(Horde_Util::getFormData('f')) ?>" />
<select name="onb" onchange="this.form.submit()">
<option value="0"<?php if (!isset($onb) || !$onb) echo ' selected="selected"' ?>><?php echo _("All Branches") ?></option>
<?php foreach ($branches as $branch): ?>
<?php if (!empty($selAllBranches)): ?>
<span>
- <form method="get" action="browsefile.php">
- <?php echo Chora::formInputs() ?>
- <input type="hidden" name="f" value="<?php echo htmlspecialchars(Horde_Util::getFormData('f')) ?>" />
+ <form method="get" action="<?php echo Chora::url('browsefile', Horde_Util::getFormData('f')) ?>">
<?php echo _("Show Branch:") ?>
<select name="onb" onchange="this.form.submit()">
<option value="0"<?php if (!isset($onb) || !$onb) echo ' selected="selected"' ?>><?php echo _("All Branches") ?></option>
<?php $branchlist = array_diff($branch_info, array($onb)); if (!empty($branchlist)): ?>
<span class="branch">
<?php foreach ($branchlist as $val): ?>
- <?php echo Horde::link(Chora::url('browsefile', $where, array('onb' => $val))) . htmlspecialchars($val) ?></a>
+ <?php echo Chora::url('browsefile', $where, array('onb' => $val))->link() . htmlspecialchars($val) ?></a>
<?php endforeach; endif; ?>
<?php if (!empty($changedlines)): ?>
<small class="difflines">(<?php printf('%s lines', htmlspecialchars($changedlines)) ?>)</small>