Formats a log message.
public static formatLogMessage ( string $log ) : string | ||
$log | string | The log message text. |
리턴 | string | The formatted message. |
// 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"); }
try { $fl = $VC->getFile($where); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } /* Retrieve the desired revision from the GET variable. */ $rev = Horde_Util::getFormData('rev'); if (!$rev) { Chora::fatal(_("No revision specified")); } switch (Horde_Util::getFormData('actionID')) { case 'log': $VC->assertValidRevision($rev); $log = $fl->getLog($rev); if (!is_null($log)) { echo '<em>' . _("Author") . ':</em> ' . Chora::showAuthorName($log->getAuthor(), true) . '<br />' . '<em>' . _("Date") . ':</em> ' . Chora::formatDate($log->getDate()) . '<br /><br />' . Chora::formatLogMessage($log->getMessage()); } exit; } if (!$VC->isValidRevision($rev)) { Chora::fatal(sprintf(_("Revision %s not found"), $rev), '404 Not Found'); } try { $lines = $VC->annotate($fl, $rev); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } $title = sprintf(_("Source Annotation (revision %s) for:"), $rev); $page_output->addScriptFile('annotate.js'); $page_output->addInlineJsVars(array('var Chora' => array('ANNOTATE_URL' => (string) Horde::url('annotate.php', true)->add(array('actionID' => 'log', 'rt' => $sourceroot, 'f' => $where, 'rev' => '')), 'loading_text' => _("Loading...")))); Chora::header($title);
$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) { $sel .= '<option value="' . $rv . '">' . $sm . '</option>'; } $selAllBranches = '';
?> </li> <?php } ?> </ul> <?php } ?> </div> <?php } ?> <div class="commit-message"><?php echo Chora::formatLogMessage($logMessage['log']); ?> </div> <div class="commit-author"> <div class="commit-author-avatar"> <img src="http://www.gravatar.com/avatar/<?php echo md5(strtolower(trim(Chora::getAuthorEmail($logMessage['author'])))); ?> ?d=mm&s=40" /> </div> <?php echo Chora::showAuthorName($logMessage['author'], true); ?> <br /> <?php
header('Content-Type: text/plain'); echo implode("\n", $VC->getDiff($fl, $r1, $r2, $type, $num, $ws)); break; case 'unified': default: if ($ty != 'h') { /* Not Human-Readable format. */ header('Content-Type: text/plain'); echo implode("\n", $VC->getDiff($fl, $r1, $r2, $type, $num, $ws)); } else { /* Human-Readable diff. */ /* Output standard header information for the page. */ $filename = preg_replace('/^.*\\//', '', $where); $pathname = preg_replace('/[^\\/]*$/', '', $where); $log = $fl->logs[$r2]; $log_print = Chora::formatLogMessage($log->queryLog()); require CHORA_TEMPLATES . '/common-header.inc'; Chora::menu(); require CHORA_TEMPLATES . '/headerbar.inc'; require CHORA_TEMPLATES . '/diff/hr/header.inc'; /* Retrieve the tree of changes. */ $lns = VC_Diff::humanReadable($VC->getDiff($fl, $r1, $r2, 'unified', $num, $ws)); /* TODO: check for errors here (PEAR_Error returned) - avsm */ /* Is the diff empty? */ if (!sizeof($lns)) { require CHORA_TEMPLATES . '/diff/hr/nochange.inc'; } else { /* Iterate through every header block of changes */ foreach ($lns as $header) { $lefthead = Text::htmlspaces(@$header['oldline']); $righthead = Text::htmlspaces(@$header['newline']);