{
global $wgOut, $wgUseExternalDiffEngine;
- $otext = str_replace( "\r\n", "\n", $otext );
- $ntext = str_replace( "\r\n", "\n", $ntext );
+ $otext = str_replace( "\r\n", "\n", htmlspecialchars( $otext ) );
+ $ntext = str_replace( "\r\n", "\n", htmlspecialchars( $ntext ) );
$wgOut->addHTML( "<table border='0' width='98%'
function _flushGroup ($new_tag) {
if ($this->_group !== '') {
- if ($this->_tag == 'mark')
- $this->_line .= '<span class="diffchange">'.htmlspecialchars ( $this->_group ).'</span>';
- else
- $this->_line .= htmlspecialchars ( $this->_group );
- }
+ if ($this->_tag == 'mark')
+ $this->_line .= '<span class="diffchange">'.$this->_group.'</span>';
+ else
+ $this->_line .= $this->_group;
+ }
$this->_group = '';
$this->_tag = $new_tag;
}
function _flushLine ($new_tag) {
$this->_flushGroup($new_tag);
if ($this->_line != '')
- array_push ( $this->_lines, $this->_line );
- else
- array_push ( $this->_lines, NBSP );
+ $this->_lines[] = $this->_line;
$this->_line = '';
}
if ($word == '')
continue;
if ($word[0] == "\n") {
+ $this->_group .= NBSP;
$this->_flushLine($tag);
$word = substr($word, 1);
}
}
function _split($lines) {
+ // FIXME: fix POSIX char class.
+# if (!preg_match_all('/ ( [^\S\n]+ | [[:alnum:]]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
implode("\n", $lines),
$m)) {
$l2 = wfMsg( 'lineno', $ybeg );
$r = '<tr><td colspan="2" align="left"><strong>'.$l1."</strong></td>\n" .
- '<td colspan="2" align="left"><strong>'.$l2."</strong></td></tr>\n";
+ '<td colspan="2" align="left"><strong>'.$l2."</strong></td></tr>\n";
return $r;
}
function addedLine( $line ) {
return '<td>+</td><td class="diff-addedline">' .
- $line . '</td>';
+ $line.'</td>';
}
function deletedLine( $line ) {
return '<td>-</td><td class="diff-deletedline">' .
- $line . '</td>';
+ $line.'</td>';
}
function emptyLine() {
}
function contextLine( $line ) {
- return '<td> </td><td class="diff-context">' .
- htmlspecialchars ( $line ) . '</td>';
+ return '<td> </td><td class="diff-context">'.$line.'</td>';
}
function _added($lines) {
global $wgOut;
foreach ($lines as $line) {
$wgOut->addHTML( '<tr>' . $this->emptyLine() .
- $this->addedLine( htmlspecialchars ( $line ) ) . "</tr>\n" );
+ $this->addedLine( $line ) . "</tr>\n" );
}
}
function _deleted($lines) {
global $wgOut;
foreach ($lines as $line) {
- $wgOut->addHTML( '<tr>' . $this->deletedLine( htmlspecialchars ( $line ) ) .
+ $wgOut->addHTML( '<tr>' . $this->deletedLine( $line ) .
$this->emptyLine() . "</tr>\n" );
}
}