// 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"); }
for ($i = 0; $i < $numRows; ++$i) { $grid[1 + $i + $row][$insCol] = $brcont[$i]; } /* For each value just set, check for sub-branches, - but * in reverse (VERY IMPORTANT!). */ for ($i = $numRows - 1; $i >= 0; --$i) { _populateGrid(1 + $i + $row, $insCol); } } } } /* Spawn the file object. */ try { $fl = $VC->getFile($where); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } $revlist = $fl->getBranchList(); /* Start row at the bottom trunk revision. Since branches always go * down, there can never be one above 1.1, and so this is a safe * location to start. We will then work our way up, recursively * populating the grid with branch revisions. */ for ($row = sizeof($trunk) - 1; $row >= 0; $row--) { $grid[$row][0] = $trunk[$row]; _populateGrid($row, 0); } /* Sort the grid array into row order, and determine the maximum * column size that we need to render out in HTML. */ ksort($grid); $maxCol = 0; foreach ($grid as $cols) {
/** * Global variables defined: * $chora_conf * $sourceroots */ protected function _init() { global $acts, $conf, $defaultActs, $where, $atdir, $fullname, $sourceroot, $page_output; // TODO: If chora isn't fully/properly setup, init() will throw fatal // errors. Don't want that if this class is being loaded simply to // obtain basic chora application information. $initial_app = $GLOBALS['registry']->initialApp == 'chora'; try { $GLOBALS['sourceroots'] = Horde::loadConfiguration('backends.php', 'sourceroots'); } catch (Horde_Exception $e) { $GLOBALS['sourceroots'] = array(); if (!$initial_app) { return; } $GLOBALS['notification']->push($e); } $sourceroots = Chora::sourceroots(); /** * Variables we wish to propagate across web pages * ha = Hide Attic Files * ord = Sort order * sbt = Sort By Type (name, age, author, etc) * * Obviously, defaults go into $defaultActs :) * TODO: defaults of 1 will not get propagated correctly - avsm * XXX: Rewrite this propagation code, since it sucks - avsm */ $defaultActs = $acts = array('onb' => 0, 'ord' => Horde_Vcs::SORT_ASCENDING, 'rev' => 0, 'rt' => null, 'sa' => 0, 'sbt' => constant($conf['options']['defaultsort']), 'ws' => 1); /* See if any actions have been passed as form variables, and if so, * assign them into the acts array. */ $vars = Horde_Variables::getDefaultVariables(); foreach (array_keys($acts) as $key) { if (isset($vars->{$key})) { $acts[$key] = $vars->{$key}; } } /* Use the value of the 'rt' form value for the sourceroot. If not * present, use the last sourceroot used as the default value if the * user has that preference. Otherwise, use default sourceroot. */ $last_sourceroot = $GLOBALS['prefs']->getValue('last_sourceroot'); if (is_null($acts['rt'])) { if (!empty($last_sourceroot) && !empty($sourceroots[$last_sourceroot]) && is_array($sourceroots[$last_sourceroot])) { $acts['rt'] = $last_sourceroot; } else { foreach ($sourceroots as $key => $val) { if (!isset($acts['rt']) || isset($val['default'])) { $acts['rt'] = $key; break; } } if (is_null($acts['rt'])) { if ($initial_app) { Chora::fatal(new Chora_Exception(_("No repositories found."))); } return; } } } if (!isset($sourceroots[$acts['rt']])) { if ($initial_app) { Chora::fatal(new Chora_Exception(sprintf(_("The repository with the slug '%s' was not found"), $acts['rt']))); } return; } $sourcerootopts = $sourceroots[$acts['rt']]; $sourceroot = $acts['rt']; /* Store last repository viewed */ if ($acts['rt'] != $last_sourceroot) { $GLOBALS['prefs']->setValue('last_sourceroot', $acts['rt']); } // Cache. $cache = empty($conf['caching']) ? null : $GLOBALS['injector']->getInstance('Horde_Cache'); $GLOBALS['chora_conf'] = array('cvsusers' => $sourcerootopts['location'] . '/' . (isset($sourcerootopts['cvsusers']) ? $sourcerootopts['cvsusers'] : ''), 'introText' => CHORA_BASE . '/config/' . (isset($sourcerootopts['intro']) ? $sourcerootopts['intro'] : ''), 'introTitle' => isset($sourcerootopts['title']) ? $sourcerootopts['title'] : '', 'sourceRootName' => $sourcerootopts['name']); $chora_conf =& $GLOBALS['chora_conf']; $GLOBALS['VC'] = Horde_Vcs::factory(Horde_String::ucfirst($sourcerootopts['type']), array('cache' => $cache, 'sourceroot' => $sourcerootopts['location'], 'paths' => array_merge($conf['paths'], array('temp' => Horde::getTempDir())), 'username' => isset($sourcerootopts['username']) ? $sourcerootopts['username'] : '', 'password' => isset($sourcerootopts['password']) ? $sourcerootopts['password'] : '')); if (!$initial_app) { return; } $where = Horde_Util::getFormData('f', '/'); /* Location relative to the sourceroot. */ $where = preg_replace(array('|^/|', '|\\.\\.|'), '', $where); $fullname = $sourcerootopts['location'] . (substr($sourcerootopts['location'], -1) == '/' ? '' : '/') . $where; if ($sourcerootopts['type'] == 'cvs') { $fullname = preg_replace('|/$|', '', $fullname); $atdir = @is_dir($fullname); } else { $atdir = !$where || substr($where, -1) == '/'; } $where = preg_replace('|/$|', '', $where); if ($sourcerootopts['type'] == 'cvs' && !@is_dir($sourcerootopts['location'])) { Chora::fatal(new Chora_Exception(_("Sourceroot not found. This could be a misconfiguration by the server administrator, or the server could be having temporary problems. Please try again later."))); } if (Chora::isRestricted($where)) { Chora::fatal(new Chora_Exception(sprintf(_("%s: Forbidden by server configuration"), $where))); } }
} $ps_opts = array('timezone' => $prefs->getValue('timezone')); if ($where) { $ps_opts['file'] = $where; 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']);
/** * $Horde: chora/annotate.php,v 1.43 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'; /* 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']);
session_cache_expire(10080); Horde_Registry::appInit('chora', array('session_cache_limiter' => 'public')); /* Spawn the repository and file objects */ try { $fl = $VC->getFile($where); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } $vars = Horde_Variables::getDefaultVariables(); if (!isset($vars->r2)) { $vars->r2 = $vars->r1; $vars->r1 = $fl->getPreviousRevision($vars->r1); } /* Ensure that we have valid revision numbers. */ if (!$VC->isValidRevision($vars->r1) || !$VC->isValidRevision($vars->r2)) { Chora::fatal(_("Malformed Query"), '500 Internal Server Error'); } /* If no type has been specified, then default to human readable. */ $type = $vars->get('t', 'colored'); if ($vars->ty == 'u') { $type = 'unified'; } /* All is ok, proceed with the diff. Always make sure there is a newline at * the end of the file - patch requires it. */ if ($type != 'colored') { header('Content-Type: text/plain'); 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);
* * 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 <*****@*****.**> * @author Chuck Hagenbuch <*****@*****.**> * @package Chora */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('chora'); // Exit if cvsgraph isn't active or it's not supported. if (empty($conf['paths']['cvsgraph']) || !$VC->hasFeature('branches')) { Chora::url('browsefile', $where)->redirect(); } if (!is_file($fullname . ',v')) { Chora::fatal(sprintf(_("%s: no such file or directory"), $where), '404 Not Found'); } $root = escapeShellCmd($VC->sourceroot); $file = escapeShellCmd($where . ',v'); if (Horde_Util::getFormData('show_image')) { // Pipe out the actual image. $args = array('c' => $conf['paths']['cvsgraph_conf'], 'r' => $root); // 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}' ";
// Load the Horde Framework core, and set up inclusion paths. require_once HORDE_BASE . '/lib/core.php'; // Registry $registry =& Registry::singleton(); if (is_a($pushed = $registry->pushApp('chora', !defined('AUTH_HANDLER')), 'PEAR_Error')) { if ($pushed->getCode() == 'permission_denied') { Horde::authenticationFailureRedirect(); } Horde::fatal($pushed, __FILE__, __LINE__, false); } $conf =& $GLOBALS['conf']; @define('CHORA_TEMPLATES', $registry->getParam('templates')); // Notification system. $notification =& Notification::singleton(); $notification->attach('status'); // Find the base file path of Chora. @define('CHORA_BASE', dirname(__FILE__) . '/..'); // Horde base libraries. require_once HORDE_LIBS . 'Horde/Text.php'; require_once HORDE_LIBS . 'Horde/Help.php'; // Chora libraries and config. require_once CHORA_BASE . '/config/sourceroots.php'; require_once CHORA_BASE . '/lib/Chora.php'; require_once HORDE_LIBS . 'Horde/VC.php'; // Initialize objects, path, etc. Chora::init(); if (Chora::isRestricted($where)) { Chora::fatal('403 Forbidden', "{$where}: Forbidden by server configuration"); } /* Start compression, if requested. */ Horde::compressOutput();
$type = 'column'; break; case 'c': $type = 'context'; break; case 'e': $type = 'ed'; break; case 'u': case 'h': default: $type = 'unified'; } /* Ensure that we have valid revision numbers. */ if (!VC_Revision::valid($r1) || !VC_Revision::valid($r2)) { Chora::fatal(_("Malformed Query")); } /* Cache the output of the diff for a week - it can be longer, since * 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
/** * Given a return object from a VC:: call, make sure * that it's not a PEAR_Error object. * @param e Return object from a VC:: call. */ function checkError($e) { if (is_a($e, 'PEAR_Error')) { Chora::fatal($e->getMessage()); } }
/* Retrieve the actual checkout. */ $checkOut = $VC->getCheckout($file, $r); /* Get the MIME type of the file, or at least our best guess at it. */ $mime_type = MIME_Magic::filenameToMIME($fullname); /* Check error status, and either show error page, or the checkout * contents */ Chora::checkError($checkOut); if (!$plain) { /* Pretty-print the checked out copy */ $pretty =& Chora::pretty($mime_type, $checkOut); if (($pretty->getType() == 'text/html' || $pretty->getType() == 'text/plain') && $pretty->canDisplayInline()) { $title = sprintf(_("Checkout of %s (revision %s)"), basename($fullname), $r); $extraLink = sprintf('<a href="%s">%s</a> <b>|</b> <a href="%s">%s</a>', Chora::url('annotate', $where, array('rev' => $r)), _("Annotate"), Chora::url('co', $where, array('r' => $r, 'p' => 1)), _("Download")); /* Make sure this revision exists. */ if (empty($file->logs[$r])) { 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>';