* Fixed unclosed <p> tag
[lhc/web/wiklou.git] / includes / SpecialRecentchanges.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once( 'Feed.php' );
12 require_once( 'ChangesList.php' );
13 require_once( 'Revision.php' );
14
15 /**
16 * Constructor
17 */
18 function wfSpecialRecentchanges( $par, $specialPage ) {
19 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgTitle, $wgMemc, $wgDBname;
20 global $wgRequest, $wgSitename, $wgLanguageCode, $wgContLanguageCode;
21 global $wgFeedClasses, $wgUseRCPatrol;
22 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
23 global $wgLinkCache;
24 $fname = 'wfSpecialRecentchanges';
25
26 # Get query parameters
27 $feedFormat = $wgRequest->getVal( 'feed' );
28
29 $defaults = array(
30 /* int */ 'days' => $wgUser->getDefaultOption('rcdays'),
31 /* int */ 'limit' => $wgUser->getDefaultOption('rclimit'),
32 /* bool */ 'hideminor' => false,
33 /* bool */ 'hidebots' => true,
34 /* bool */ 'hideliu' => false,
35 /* bool */ 'hidepatrolled' => false,
36 /* text */ 'from' => '',
37 /* text */ 'namespace' => null,
38 /* bool */ 'invert' => false,
39 );
40
41 extract($defaults);
42
43
44 $days = $wgUser->getOption( 'rcdays' );
45 if ( !$days ) { $days = $defaults['days']; }
46 $days = $wgRequest->getInt( 'days', $days );
47
48 $limit = $wgUser->getOption( 'rclimit' );
49 if ( !$limit ) { $limit = $defaults['limit']; }
50
51 # list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
52 $limit = $wgRequest->getInt( 'limit', $limit );
53
54 /* order of selection: url > preferences > default */
55 $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor') ? true : $defaults['hideminor'] );
56
57
58 # As a feed, use limited settings only
59 if( $feedFormat ) {
60 global $wgFeedLimit;
61 if( $limit > $wgFeedLimit ) {
62 $options['limit'] = $wgFeedLimit;
63 }
64
65 } else {
66
67 $namespace = $wgRequest->getIntOrNull( 'namespace' );
68 $invert = $wgRequest->getBool( 'invert', $defaults['invert'] );
69 $hidebots = $wgRequest->getBool( 'hidebots', $defaults['hidebots'] );
70 $hideliu = $wgRequest->getBool( 'hideliu', $defaults['hideliu'] );
71 $hidepatrolled = $wgRequest->getBool( 'hidepatrolled', $defaults['hidepatrolled'] );
72 $from = $wgRequest->getVal( 'from', $defaults['from'] );
73
74 # Get query parameters from path
75 if( $par ) {
76 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
77 foreach ( $bits as $bit ) {
78 if ( 'hidebots' == $bit ) $hidebots = 1;
79 if ( 'bots' == $bit ) $hidebots = 0;
80 if ( 'hideminor' == $bit ) $hideminor = 1;
81 if ( 'minor' == $bit ) $hideminor = 0;
82 if ( 'hideliu' == $bit ) $hideliu = 1;
83 if ( 'hidepatrolled' == $bit ) $hidepatrolled = 1;
84
85 if ( is_numeric( $bit ) ) {
86 $limit = $bit;
87 }
88
89 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
90 $limit = $m[1];
91 }
92
93 if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
94 $days = $m[1];
95 }
96 }
97 }
98 }
99
100 if ( $limit < 0 || $limit > 5000 ) $limit = $defaults['limit'];
101
102
103 # Database connection and caching
104 $dbr =& wfGetDB( DB_SLAVE );
105 extract( $dbr->tableNames( 'recentchanges', 'watchlist' ) );
106
107
108 $cutoff_unixtime = time() - ( $days * 86400 );
109 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime % 86400);
110 $cutoff = $dbr->timestamp( $cutoff_unixtime );
111 if(preg_match('/^[0-9]{14}$/', $from) and $from > wfTimestamp(TS_MW,$cutoff)) {
112 $cutoff = $dbr->timestamp($from);
113 } else {
114 $from = $defaults['from'];
115 }
116
117 # 10 seconds server-side caching max
118 $wgOut->setSquidMaxage( 10 );
119
120 # Get last modified date, for client caching
121 # Don't use this if we are using the patrol feature, patrol changes don't update the timestamp
122 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, $fname );
123 if ( $feedFormat || !$wgUseRCPatrol ) {
124 if( $lastmod && $wgOut->checkLastModified( $lastmod ) ){
125 # Client cache fresh and headers sent, nothing more to do.
126 return;
127 }
128 }
129
130 $hidem = $hideminor ? 'AND rc_minor=0' : '';
131 $hidem .= $hidebots ? ' AND rc_bot=0' : '';
132 $hidem .= $hideliu ? ' AND rc_user=0' : '';
133 $hidem .= $hidepatrolled ? ' AND rc_patrolled=0' : '';
134 $hidem .= is_null( $namespace ) ? '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
135
136 // This is the big thing!
137
138 $uid = $wgUser->getID();
139
140 // Perform query
141 $sql2 = "SELECT *" . ($uid ? ",wl_user,wl_notificationtimestamp" : "") . " FROM $recentchanges " .
142 ($uid ? "LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") .
143 "WHERE rc_timestamp > '{$cutoff}' {$hidem} " .
144 "ORDER BY rc_timestamp DESC LIMIT {$limit}";
145 $res = $dbr->query( $sql2, $fname );
146
147 // Fetch results, prepare a batch link existence check query
148 $rows = array();
149 $batch = new LinkBatch;
150 while( $row = $dbr->fetchObject( $res ) ){
151 $rows[] = $row;
152 // User page link
153 $title = Title::makeTitleSafe( NS_USER, $row->rc_user_text );
154 $batch->addObj( $title );
155
156 // User talk
157 $title = Title::makeTitleSafe( NS_USER_TALK, $row->rc_user_text );
158 $batch->addObj( $title );
159
160 }
161 $dbr->freeResult( $res );
162
163 // Run existence checks
164 $batch->execute( $wgLinkCache );
165
166 if( $feedFormat ) {
167 rcOutputFeed( $rows, $feedFormat, $limit, $hideminor, $lastmod );
168 } else {
169
170 # Web output...
171
172 // Output header
173 if ( !$specialPage->including() ) {
174 $wgOut->addWikiText( wfMsgForContent( "recentchangestext" ) );
175
176 // Dump everything here
177 $nondefaults = array();
178
179 appendToArrayIfNotDefault( 'days', $days, $defaults, $nondefaults);
180 appendToArrayIfNotDefault( 'limit', $limit , $defaults, $nondefaults);
181 appendToArrayIfNotDefault( 'hideminor', $hideminor, $defaults, $nondefaults);
182 appendToArrayIfNotDefault( 'hidebots', $hidebots, $defaults, $nondefaults);
183 appendToArrayIfNotDefault( 'hideliu', $hideliu, $defaults, $nondefaults);
184 appendToArrayIfNotDefault( 'hidepatrolled', $hidepatrolled, $defaults, $nondefaults);
185 appendToArrayIfNotDefault( 'from', $from, $defaults, $nondefaults);
186 appendToArrayIfNotDefault( 'namespace', $namespace, $defaults, $nondefaults);
187 appendToArrayIfNotDefault( 'invert', $invert, $defaults, $nondefaults);
188
189 // Add end of the texts
190 $wgOut->addHTML( '<div class="rcoptions">' . rcOptionsPanel( $defaults, $nondefaults ) );
191 $wgOut->addHTML( rcNamespaceForm( $namespace, $invert, $nondefaults) . '</div>');
192 }
193
194 // And now for the content
195 $sk = $wgUser->getSkin();
196 $wgOut->setSyndicated( true );
197 $list =& new ChangesList( $sk );
198 $s = $list->beginRecentChangesList();
199 $counter = 1;
200 foreach( $rows as $obj ){
201 if( $limit == 0) {
202 break;
203 }
204
205 if ( ! ( $hideminor && $obj->rc_minor ) &&
206 ! ( $hidepatrolled && $obj->rc_patrolled ) ) {
207 $rc = RecentChange::newFromRow( $obj );
208 $rc->counter = $counter++;
209
210 if ($wgShowUpdatedMarker
211 && !empty( $obj->wl_notificationtimestamp )
212 && ($obj->rc_timestamp >= $obj->wl_notificationtimestamp)) {
213 $rc->notificationtimestamp = true;
214 } else {
215 $rc->notificationtimestamp = false;
216 }
217
218 if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
219 $sql3 = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" . $dbr->strencode($obj->rc_title) ."' AND wl_namespace=$obj->rc_namespace" ;
220 $res3 = $dbr->query( $sql3, 'wfSpecialRecentChanges');
221 $x = $dbr->fetchObject( $res3 );
222 $rc->numberofWatchingusers = $x->n;
223 } else {
224 $rc->numberofWatchingusers = 0;
225 }
226 $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ) );
227 --$limit;
228 }
229 }
230 $s .= $list->endRecentChangesList();
231 $wgOut->addHTML( $s );
232 }
233 }
234
235 function rcOutputFeed( $rows, $feedFormat, $limit, $hideminor, $lastmod ) {
236 global $messageMemc, $wgDBname, $wgFeedCacheTimeout;
237 global $wgFeedClasses, $wgTitle, $wgSitename, $wgContLanguageCode;
238
239 if( !isset( $wgFeedClasses[$feedFormat] ) ) {
240 wfHttpError( 500, "Internal Server Error", "Unsupported feed type." );
241 return false;
242 }
243
244 $timekey = "$wgDBname:rcfeed:$feedFormat:timestamp";
245 $key = "$wgDBname:rcfeed:$feedFormat:limit:$limit:minor:$hideminor";
246
247 $feedTitle = $wgSitename . ' - ' . wfMsgForContent( 'recentchanges' ) .
248 ' [' . $wgContLanguageCode . ']';
249 $feed = new $wgFeedClasses[$feedFormat](
250 $feedTitle,
251 htmlspecialchars( wfMsgForContent( 'recentchangestext' ) ),
252 $wgTitle->getFullUrl() );
253
254 /**
255 * Bumping around loading up diffs can be pretty slow, so where
256 * possible we want to cache the feed output so the next visitor
257 * gets it quick too.
258 */
259 $cachedFeed = false;
260 if( $feedLastmod = $messageMemc->get( $timekey ) ) {
261 /**
262 * If the cached feed was rendered very recently, we may
263 * go ahead and use it even if there have been edits made
264 * since it was rendered. This keeps a swarm of requests
265 * from being too bad on a super-frequently edited wiki.
266 */
267 if( time() - wfTimestamp( TS_UNIX, $feedLastmod )
268 < $wgFeedCacheTimeout
269 || wfTimestamp( TS_UNIX, $feedLastmod )
270 > wfTimestamp( TS_UNIX, $lastmod ) ) {
271 wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" );
272 $cachedFeed = $messageMemc->get( $key );
273 } else {
274 wfDebug( "RC: cached feed timestamp check failed ($feedLastmod; $lastmod)\n" );
275 }
276 }
277 if( is_string( $cachedFeed ) ) {
278 wfDebug( "RC: Outputting cached feed\n" );
279 $feed->httpHeaders();
280 echo $cachedFeed;
281 } else {
282 wfDebug( "RC: rendering new feed and caching it\n" );
283 ob_start();
284 rcDoOutputFeed( $rows, $feed );
285 $cachedFeed = ob_get_contents();
286 ob_end_flush();
287
288 $expire = 3600 * 24; # One day
289 $messageMemc->set( $key, $cachedFeed );
290 $messageMemc->set( $timekey, wfTimestamp( TS_MW ), $expire );
291 }
292 return true;
293 }
294
295 function rcDoOutputFeed( $rows, &$feed ) {
296 global $wgSitename, $wgFeedClasses, $wgContLanguageCode;
297
298 $feed->outHeader();
299
300 # Merge adjacent edits by one user
301 $sorted = array();
302 $n = 0;
303 foreach( $rows as $obj ) {
304 if( $n > 0 &&
305 $obj->rc_namespace >= 0 &&
306 $obj->rc_cur_id == $sorted[$n-1]->rc_cur_id &&
307 $obj->rc_user_text == $sorted[$n-1]->rc_user_text ) {
308 $sorted[$n-1]->rc_last_oldid = $obj->rc_last_oldid;
309 } else {
310 $sorted[$n] = $obj;
311 $n++;
312 }
313 $first = false;
314 }
315
316 foreach( $sorted as $obj ) {
317 $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title );
318 $talkpage = $title->getTalkPage();
319 $item = new FeedItem(
320 $title->getPrefixedText(),
321 rcFormatDiff( $obj ),
322 $title->getFullURL(),
323 $obj->rc_timestamp,
324 $obj->rc_user_text,
325 $talkpage->getFullURL()
326 );
327 $feed->outItem( $item );
328 }
329 $feed->outFooter();
330 }
331
332 /**
333 *
334 */
335 function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
336 global $wgUser, $wgLang, $wgContLang;
337 $sk = $wgUser->getSkin();
338 $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
339 ($lim ? $wgLang->formatNum( "{$lim}" ) : wfMsg( 'recentchangesall' ) ), "{$more}" .
340 ($d ? "days={$d}&" : '') . 'limit='.$lim );
341 return $s;
342 }
343
344 /**
345 *
346 */
347 function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) {
348 global $wgUser, $wgLang, $wgContLang;
349 $sk = $wgUser->getSkin();
350 $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
351 ($d ? $wgLang->formatNum( "{$d}" ) : wfMsg( 'recentchangesall' ) ), $more.'days='.$d .
352 ($lim ? '&limit='.$lim : '') );
353 return $s;
354 }
355
356 /**
357 * Used by Recentchangeslinked
358 */
359 function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall = false, $minorLink = '',
360 $botLink = '', $liuLink = '', $patrLink = '' ) {
361 if ($more != '') $more .= '&';
362 $cl = rcCountLink( 50, $days, $page, $more ) . ' | ' .
363 rcCountLink( 100, $days, $page, $more ) . ' | ' .
364 rcCountLink( 250, $days, $page, $more ) . ' | ' .
365 rcCountLink( 500, $days, $page, $more ) .
366 ( $doall ? ( ' | ' . rcCountLink( 0, $days, $page, $more ) ) : '' );
367 $dl = rcDaysLink( $limit, 1, $page, $more ) . ' | ' .
368 rcDaysLink( $limit, 3, $page, $more ) . ' | ' .
369 rcDaysLink( $limit, 7, $page, $more ) . ' | ' .
370 rcDaysLink( $limit, 14, $page, $more ) . ' | ' .
371 rcDaysLink( $limit, 30, $page, $more ) .
372 ( $doall ? ( ' | ' . rcDaysLink( $limit, 0, $page, $more ) ) : '' );
373 $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink );
374 $note = wfMsg( 'rclinks', $cl, $dl, $shm );
375 return $note;
376 }
377
378
379 /**
380 * Makes change an option link which carries all the other options
381 */
382 function makeOptionsLink( $title, $override, $options ) {
383 global $wgUser, $wgLang, $wgContLang;
384 $sk = $wgUser->getSkin();
385 return $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
386 $title, wfArrayToCGI( $override, $options ) );
387 }
388
389 /**
390 * Creates the options panel
391 */
392 function rcOptionsPanel( $defaults, $nondefaults ) {
393 global $wgLang;
394
395 $options = $nondefaults + $defaults;
396
397 if( $options['from'] )
398 $note = wfMsg( 'rcnotefrom', $wgLang->formatNum( $options['limit'] ), $wgLang->timeanddate( $options['from'], true ) );
399 else
400 $note = wfMsg( 'rcnote', $wgLang->formatNum( $options['limit'] ), $wgLang->formatNum( $options['days'] ) );
401
402 // limit links
403 $cl = '';
404 $options_limit = array(50, 100, 250, 500);
405 $i = 0;
406 while ( $i+1 < count($options_limit) ) {
407 $cl .= makeOptionsLink( $options_limit[$i], array( 'limit' => $options_limit[$i] ), $nondefaults) . ' | ' ;
408 $i++;
409 }
410 $cl .= makeOptionsLink( $options_limit[$i], array( 'limit' => $options_limit[$i] ), $nondefaults) ;
411
412 // day links, reset 'from' to none
413 $dl = '';
414 $options_days = array(1, 3, 7, 14, 30);
415 $i = 0;
416 while ( $i+1 < count($options_days) ) {
417 $dl .= makeOptionsLink( $options_days[$i], array( 'days' => $options_days[$i], 'from' => '' ), $nondefaults) . ' | ' ;
418 $i++;
419 }
420 $dl .= makeOptionsLink( $options_days[$i], array( 'days' => $options_days[$i], 'from' => '' ), $nondefaults) ;
421
422 // show/hide links
423 $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ));
424 $minorLink = makeOptionsLink( $showhide[1-$options['hideminor']],
425 array( 'hideminor' => 1-$options['hideminor'] ), $nondefaults);
426 $botLink = makeOptionsLink( $showhide[1-$options['hidebots']],
427 array( 'hidebots' => 1-$options['hidebots'] ), $nondefaults);
428 $liuLink = makeOptionsLink( $showhide[1-$options['hideliu']],
429 array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults);
430 $patrLink = makeOptionsLink( $showhide[1-$options['hidepatrolled']],
431 array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults);
432
433 $hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink );
434
435 // show from this onward link
436 $now = $wgLang->timeanddate( wfTimestampNow(), true );
437 $tl = makeOptionsLink( $now, array( 'from' => wfTimestampNow()), $nondefaults );
438
439 $rclinks = wfMsg( 'rclinks', $cl, $dl, $hl );
440 $rclistfrom = wfMsg( 'rclistfrom', $tl );
441 return "$note<br />$rclinks<br />$rclistfrom";
442
443 }
444
445 /**<F2>
446 * Creates the choose namespace selection
447 *
448 * @access private
449 *
450 * @param mixed $namespace The key of the currently selected namespace, empty string
451 * if there is none
452 * @param bool $invert Whether to invert the namespace selection
453 * @param array $nondefaults An array of non default options to be remembered
454 *
455 * @return string
456 */
457 function rcNamespaceForm ( $namespace, $invert, $nondefaults ) {
458 global $wgContLang, $wgScript;
459 $t = Title::makeTitle( NS_SPECIAL, 'Recentchanges' );
460
461 $namespaceselect = "<select name='namespace' id='nsselectbox'>";
462 $namespaceselect .= '<option value="" ' . ($namespace === '' ? ' selected="selected"' : '') . '>' . wfMsg( 'contributionsall' ) . '</option>';
463 $arr = $wgContLang->getFormattedNamespaces();
464 foreach ( $arr as $ns => $name ) {
465 if( $ns < NS_MAIN )
466 continue;
467 $n = $ns === NS_MAIN ? wfMsg ( 'blanknamespace' ) : $name;
468 $sel = $namespace === (string) $ns ? ' selected="selected"' : '';
469 $namespaceselect .= "<option value='$ns'$sel>$n</option>";
470 }
471 $namespaceselect .= '</select>';
472
473 $out = '';
474 $out .= "<div class='namespaceselector'><form method='get' action='{$wgScript}'>\n";
475 foreach ( $nondefaults as $key => $value ) {
476 if ($key != 'namespace' && $key != 'invert')
477 $out .= "<input type='hidden' name='$key' value='$value' />";
478 }
479
480 $submitbutton = '<input type="submit" value="' . wfMsg( 'allpagessubmit' ) . '" />';
481 $invertbox = "<input type='checkbox' name='invert' value='1' id='nsinvert'" . ( $invert ? ' checked="checked"' : '' ) . ' />';
482
483
484 $out .= '<input type="hidden" name="title" value="'.$t->getPrefixedText().'" />';
485 $out .= "
486 <div id='nsselect' class='recentchanges'>
487 <label for='nsselectbox'>" . wfMsg('namespace') . "</label>
488 $namespaceselect $submitbutton $invertbox <label for='nsinvert'>" . wfMsg('invert') . "</label>
489 </div>";
490 $out .= '</form></div>';
491 return $out;
492 }
493
494
495 /**
496 * Format a diff for the newsfeed
497 */
498 function rcFormatDiff( $row ) {
499 $fname = 'rcFormatDiff';
500 wfProfileIn( $fname );
501
502 require_once( 'DifferenceEngine.php' );
503 $comment = "<p>" . htmlspecialchars( $row->rc_comment ) . "</p>\n";
504
505 if( $row->rc_namespace >= 0 ) {
506 global $wgContLang;
507
508 #$diff =& new DifferenceEngine( $row->rc_this_oldid, $row->rc_last_oldid, $row->rc_id );
509 #$diff->showDiffPage();
510
511 $titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
512 $dbr =& wfGetDB( DB_SLAVE );
513 $newrev =& Revision::newFromTitle( $titleObj, $row->rc_this_oldid );
514 if( $newrev ) {
515 $newtext = $newrev->getText();
516 } else {
517 $diffText = "<p>Can't load revision $row->rc_this_oldid</p>";
518 wfProfileOut( $fname );
519 return $comment . $diffText;
520 }
521
522 if( $row->rc_last_oldid ) {
523 wfProfileIn( "$fname-dodiff" );
524 $oldrev =& Revision::newFromId( $row->rc_last_oldid );
525 if( !$oldrev ) {
526 $diffText = "<p>Can't load old revision $row->rc_last_oldid</p>";
527 wfProfileOut( $fname );
528 return $comment . $diffText;
529 }
530 $oldtext = $oldrev->getText();
531
532 # Old entries may contain illegal characters
533 # which will damage output
534 $oldtext = UtfNormal::cleanUp( $oldtext );
535
536 global $wgFeedDiffCutoff;
537 if( strlen( $newtext ) > $wgFeedDiffCutoff ||
538 strlen( $oldtext ) > $wgFeedDiffCutoff ) {
539 $diffLink = $titleObj->escapeFullUrl(
540 'diff=' . $row->rc_this_oldid .
541 '&oldid=' . $row->rc_last_oldid );
542 $diffText = '<a href="' .
543 $diffLink .
544 '">' .
545 htmlspecialchars( wfMsgForContent( 'difference' ) ) .
546 '</a>';
547 } else {
548 $diffText = DifferenceEngine::getDiff( $oldtext, $newtext,
549 wfMsg( 'revisionasof', $wgContLang->timeanddate( $row->rc_timestamp ) ),
550 wfMsg( 'currentrev' ) );
551 }
552 wfProfileOut( "$fname-dodiff" );
553 } else {
554 $diffText = '<p><b>' . wfMsg( 'newpage' ) . '</b></p>' .
555 '<div>' . nl2br( htmlspecialchars( $newtext ) ) . '</div>';
556 }
557
558 wfProfileOut( $fname );
559 return $comment . $diffText;
560 }
561
562 wfProfileOut( $fname );
563 return $comment;
564 }
565
566
567 /**
568 * Appends to second array if $value differs from that in $default
569 */
570 function appendToArrayIfNotDefault( $key, $value, $default, &$changed )
571 {
572 if ( is_null( $changed ) ) {
573 die();
574 }
575 if ( $default[$key] !== $value ) {
576 $changed[$key] = $value;
577 }
578 }
579
580 ?>