database timestamp fixup
[lhc/web/wiklou.git] / includes / EditPage.php
1 <?php
2 # $Id$
3
4 # Splitting edit page/HTML interface from Article...
5 # The actual database and text munging is still in Article,
6 # but it should get easier to call those from alternate
7 # interfaces.
8
9 class EditPage {
10 var $mArticle;
11 var $mTitle;
12
13 # Form values
14 var $save = false, $preview = false;
15 var $minoredit = false, $watchthis = false;
16 var $textbox1 = "", $textbox2 = "", $summary = "";
17 var $edittime = "", $section = "";
18 var $oldid = 0;
19
20 function EditPage( $article ) {
21 $this->mArticle =& $article;
22 global $wgTitle;
23 $this->mTitle =& $wgTitle;
24 }
25
26 # This is the function that gets called for "action=edit".
27
28 function edit()
29 {
30 global $wgOut, $wgUser, $wgWhitelistEdit, $wgRequest;
31 // this is not an article
32 $wgOut->setArticleFlag(false);
33
34 $this->importFormData( $wgRequest );
35
36 if ( ! $this->mTitle->userCanEdit() ) {
37 $wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
38 return;
39 }
40 if ( $wgUser->isBlocked() ) {
41 $this->blockedIPpage();
42 return;
43 }
44 if ( !$wgUser->getID() && $wgWhitelistEdit ) {
45 $this->userNotLoggedInPage();
46 return;
47 }
48 if ( wfReadOnly() ) {
49 if( $this->save || $this->preview ) {
50 $this->editForm( "preview" );
51 } else {
52 $wgOut->readOnlyPage( $this->mArticle->getContent( true ) );
53 }
54 return;
55 }
56 if ( $this->save ) {
57 $this->editForm( "save" );
58 } else if ( $this->preview ) {
59 $this->editForm( "preview" );
60 } else { # First time through
61 $this->editForm( "initial" );
62 }
63 }
64
65 function importFormData( &$request ) {
66 # These fields need to be checked for encoding.
67 # Also remove trailing whitespace, but don't remove _initial_
68 # whitespace from the text boxes. This may be significant formatting.
69 $this->textbox1 = rtrim( $request->getText( "wpTextbox1" ) );
70 $this->textbox2 = rtrim( $request->getText( "wpTextbox2" ) );
71 $this->summary = trim( $request->getText( "wpSummary" ) );
72
73 $this->edittime = $request->getVal( 'wpEdittime' );
74 if( !preg_match( '/^\d{14}$/', $this->edittime )) $this->edittime = "";
75
76 $this->preview = $request->getCheck( 'wpPreview' );
77 $this->save = $request->wasPosted() && !$this->preview;
78 $this->minoredit = $request->getCheck( 'wpMinoredit' );
79 $this->watchthis = $request->getCheck( 'wpWatchthis' );
80
81 $this->oldid = $request->getInt( 'oldid' );
82
83 # Section edit can come from either the form or a link
84 $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
85 }
86
87 # Since there is only one text field on the edit form,
88 # pressing <enter> will cause the form to be submitted, but
89 # the submit button value won't appear in the query, so we
90 # Fake it here before going back to edit(). This is kind of
91 # ugly, but it helps some old URLs to still work.
92
93 function submit()
94 {
95 if( !$this->preview ) $this->save = true;
96
97 $this->edit();
98 }
99
100 # The edit form is self-submitting, so that when things like
101 # preview and edit conflicts occur, we get the same form back
102 # with the extra stuff added. Only when the final submission
103 # is made and all is well do we actually save and redirect to
104 # the newly-edited page.
105
106 function editForm( $formtype )
107 {
108 global $wgOut, $wgUser;
109 global $wgLang, $wgParser, $wgTitle;
110 global $wgAllowAnonymousMinor;
111 global $wgWhitelistEdit;
112 global $wgSpamRegex, $wgFilterCallback;
113
114 $sk = $wgUser->getSkin();
115 $isConflict = false;
116 // css / js subpages of user pages get a special treatment
117 $isCssJsSubpage = (Namespace::getUser() == $wgTitle->getNamespace() and preg_match("/\\.(css|js)$/", $wgTitle->getText() ));
118
119 if(!$this->mTitle->getArticleID()) { # new article
120 $wgOut->addWikiText(wfmsg("newarticletext"));
121 }
122
123 if( Namespace::isTalk( $this->mTitle->getNamespace() ) ) {
124 $wgOut->addWikiText(wfmsg("talkpagetext"));
125 }
126
127 # Attempt submission here. This will check for edit conflicts,
128 # and redundantly check for locked database, blocked IPs, etc.
129 # that edit() already checked just in case someone tries to sneak
130 # in the back door with a hand-edited submission URL.
131
132 if ( "save" == $formtype ) {
133 # Check for spam
134 if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) {
135 $this->spamPage ( $matches );
136 return;
137 }
138 if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) {
139 # Error messages or other handling should be performed by the filter function
140 return;
141 }
142 if ( $wgUser->isBlocked() ) {
143 $this->blockedIPpage();
144 return;
145 }
146 if ( !$wgUser->getID() && $wgWhitelistEdit ) {
147 $this->userNotLoggedInPage();
148 return;
149 }
150 if ( wfReadOnly() ) {
151 $wgOut->readOnlyPage();
152 return;
153 }
154
155 # If article is new, insert it.
156 $aid = $this->mTitle->getArticleID();
157 if ( 0 == $aid ) {
158 # Don't save a new article if it's blank.
159 if ( ( "" == $this->textbox1 ) ||
160 ( wfMsg( "newarticletext" ) == $this->textbox1 ) ) {
161 $wgOut->redirect( $this->mTitle->getFullURL() );
162 return;
163 }
164 $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, $this->minoredit, $this->watchthis );
165 return;
166 }
167
168 # Article exists. Check for edit conflict.
169
170 $this->mArticle->clear(); # Force reload of dates, etc.
171
172 if( ( $this->section != "new" ) &&
173 ($this->mArticle->getTimestamp() != $this->edittime ) ) {
174 $isConflict = true;
175 }
176 $userid = $wgUser->getID();
177
178 $text = $this->mArticle->getTextOfLastEditWithSectionReplacedOrAdded(
179 $this->section, $this->textbox1, $this->summary);
180 # Suppress edit conflict with self
181
182 if ( ( 0 != $userid ) && ( $this->mArticle->getUser() == $userid ) ) {
183 $isConflict = false;
184 } else {
185 # switch from section editing to normal editing in edit conflict
186 if($isConflict) {
187 # Attempt merge
188 if( $this->mergeChangesInto( $text ) ){
189 // Successful merge! Maybe we should tell the user the good news?
190 $isConflict = false;
191 } else {
192 $this->section = "";
193 $this->textbox1 = $text;
194 }
195 }
196 }
197 if ( ! $isConflict ) {
198 # All's well
199 $sectionanchor = '';
200 if( $this->section != '' ) {
201 # Try to get a section anchor from the section source, redirect to edited section if header found
202 # XXX: might be better to integrate this into Article::getTextOfLastEditWithSectionReplacedOrAdded
203 # for duplicate heading checking and maybe parsing
204 $hasmatch = preg_match( "/^ *([=]{1,6})(.*?)(\\1) *\\n/i", $this->textbox1, $matches );
205 # we can't deal with anchors, includes, html etc in the header for now,
206 # headline would need to be parsed to improve this
207 #if($hasmatch and strlen($matches[2]) > 0 and !preg_match( "/[\\['{<>]/", $matches[2])) {
208 if($hasmatch and strlen($matches[2]) > 0) {
209 global $wgInputEncoding;
210 $headline = do_html_entity_decode( $matches[2], ENT_COMPAT, $wgInputEncoding );
211 # strip out HTML
212 $headline = preg_replace( "/<.*?" . ">/","",$headline );
213 $headline = trim( $headline );
214 $sectionanchor = '#'.urlencode( str_replace(' ', '_', $headline ) );
215 $replacearray = array(
216 '%3A' => ':',
217 '%' => '.'
218 );
219 $sectionanchor = str_replace(array_keys($replacearray),array_values($replacearray),$sectionanchor);
220 }
221 }
222
223 # update the article here
224 if($this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, $this->watchthis, '', $sectionanchor ))
225 return;
226 else
227 $isConflict = true;
228 }
229 }
230 # First time through: get contents, set time for conflict
231 # checking, etc.
232
233 if ( "initial" == $formtype ) {
234 $this->edittime = $this->mArticle->getTimestamp();
235 $this->textbox1 = $this->mArticle->getContent( true );
236 $this->summary = "";
237 $this->proxyCheck();
238 }
239 $wgOut->setRobotpolicy( "noindex,nofollow" );
240
241 # Enabled article-related sidebar, toplinks, etc.
242 $wgOut->setArticleRelated( true );
243
244 if ( $isConflict ) {
245 $s = wfMsg( "editconflict", $this->mTitle->getPrefixedText() );
246 $wgOut->setPageTitle( $s );
247 $wgOut->addHTML( wfMsg( "explainconflict" ) );
248
249 $this->textbox2 = $this->textbox1;
250 $this->textbox1 = $this->mArticle->getContent( true );
251 $this->edittime = $this->mArticle->getTimestamp();
252 } else {
253 $s = wfMsg( "editing", $this->mTitle->getPrefixedText() );
254
255 if( $this->section != "" ) {
256 if( $this->section == "new" ) {
257 $s.=wfMsg("commentedit");
258 } else {
259 $s.=wfMsg("sectionedit");
260 }
261 if(!$this->preview) {
262 $sectitle=preg_match("/^=+(.*?)=+/mi",
263 $this->textbox1,
264 $matches);
265 if( !empty( $matches[1] ) ) {
266 $this->summary = "/* ". trim($matches[1])." */ ";
267 }
268 }
269 }
270 $wgOut->setPageTitle( $s );
271 if ( $this->oldid ) {
272 $this->mArticle->setOldSubtitle();
273 $wgOut->addHTML( wfMsg( "editingold" ) );
274 }
275 }
276
277 if( wfReadOnly() ) {
278 $wgOut->addHTML( "<strong>" .
279 wfMsg( "readonlywarning" ) .
280 "</strong>" );
281 } else if ( $isCssJsSubpage and "preview" != $formtype) {
282 $wgOut->addHTML( wfMsg( "usercssjsyoucanpreview" ));
283 }
284 if( $this->mTitle->isProtected() ) {
285 $wgOut->addHTML( "<strong>" . wfMsg( "protectedpagewarning" ) .
286 "</strong><br />\n" );
287 }
288
289 $kblength = (int)(strlen( $this->textbox1 ) / 1024);
290 if( $kblength > 29 ) {
291 $wgOut->addHTML( "<strong>" .
292 wfMsg( "longpagewarning", $kblength )
293 . "</strong>" );
294 }
295
296 $rows = $wgUser->getOption( "rows" );
297 $cols = $wgUser->getOption( "cols" );
298
299 $ew = $wgUser->getOption( "editwidth" );
300 if ( $ew ) $ew = " style=\"width:100%\"";
301 else $ew = "" ;
302
303 $q = "action=submit";
304 #if ( "no" == $redirect ) { $q .= "&redirect=no"; }
305 $action = $this->mTitle->escapeLocalURL( $q );
306
307 $summary = wfMsg( "summary" );
308 $subject = wfMsg("subject");
309 $minor = wfMsg( "minoredit" );
310 $watchthis = wfMsg ("watchthis");
311 $save = wfMsg( "savearticle" );
312 $prev = wfMsg( "showpreview" );
313
314 $cancel = $sk->makeKnownLink( $this->mTitle->getPrefixedText(),
315 wfMsg( "cancel" ) );
316 $edithelpurl = $sk->makeUrl( wfMsg( 'edithelppage' ));
317 $edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
318 htmlspecialchars( wfMsg( 'edithelp' ) ).'</a> '.
319 htmlspecialchars( wfMsg( 'newwindow' ) );
320
321 global $wgRightsText;
322 $copywarn = "<div id=\"editpage-copywarn\">\n" .
323 wfMsg( $wgRightsText ? "copyrightwarning" : "copyrightwarning2",
324 "[[" . wfMsg( "copyrightpage" ) . "]]",
325 $wgRightsText ) . "\n</div>";
326
327 if( $wgUser->getOption("showtoolbar") and !$isCssJsSubpage ) {
328 # prepare toolbar for edit buttons
329 $toolbar = $sk->getEditToolbar();
330 } else {
331 $toolbar = "";
332 }
333
334 // activate checkboxes if user wants them to be always active
335 if( !$this->preview ) {
336 if( $wgUser->getOption( "watchdefault" ) ) $this->watchthis = true;
337 if( $wgUser->getOption( "minordefault" ) ) $this->minoredit = true;
338
339 // activate checkbox also if user is already watching the page,
340 // require wpWatchthis to be unset so that second condition is not
341 // checked unnecessarily
342 if( !$this->watchthis && $this->mTitle->userIsWatching() ) $this->watchthis = true;
343 }
344
345 $minoredithtml = "";
346
347 if ( 0 != $wgUser->getID() || $wgAllowAnonymousMinor ) {
348 $minoredithtml =
349 "<input tabindex='3' type='checkbox' value='1' name='wpMinoredit'".($this->minoredit?" checked='checked'":"").
350 " accesskey='".wfMsg('accesskey-minoredit')."' id='wpMinoredit' />".
351 "<label for='wpMinoredit' title='".wfMsg('tooltip-minoredit')."'>{$minor}</label>";
352 }
353
354 $watchhtml = "";
355
356 if ( 0 != $wgUser->getID() ) {
357 $watchhtml = "<input tabindex='4' type='checkbox' name='wpWatchthis'".($this->watchthis?" checked='checked'":"").
358 " accesskey='".wfMsg('accesskey-watch')."' id='wpWatchthis' />".
359 "<label for='wpWatchthis' title='".wfMsg('tooltip-watch')."'>{$watchthis}</label>";
360 }
361
362 $checkboxhtml = $minoredithtml . $watchhtml . "<br />";
363
364 if ( "preview" == $formtype) {
365 $previewhead="<h2>" . wfMsg( "preview" ) . "</h2>\n<p><center><font color=\"#cc0000\">" .
366 wfMsg( "note" ) . wfMsg( "previewnote" ) . "</font></center></p>\n";
367 if ( $isConflict ) {
368 $previewhead.="<h2>" . wfMsg( "previewconflict" ) .
369 "</h2>\n";
370 }
371
372 $parserOptions = ParserOptions::newFromUser( $wgUser );
373 $parserOptions->setUseCategoryMagic( false );
374 $parserOptions->setEditSection( false );
375 $parserOptions->setEditSectionOnRightClick( false );
376
377 # don't parse user css/js, show message about preview
378 # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here
379
380 if ( $isCssJsSubpage ) {
381 if(preg_match("/\\.css$/", $wgTitle->getText() ) ) {
382 $previewtext = wfMsg('usercsspreview');
383 } else if(preg_match("/\\.js$/", $wgTitle->getText() ) ) {
384 $previewtext = wfMsg('userjspreview');
385 }
386 $parserOutput = $wgParser->parse( $previewtext , $wgTitle, $parserOptions );
387 $wgOut->addHTML( $parserOutput->mText );
388 } else {
389 $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $this->textbox1 ) ."\n\n",
390 $wgTitle, $parserOptions );
391 $previewHTML = $parserOutput->mText;
392
393 if($wgUser->getOption("previewontop")) {
394 $wgOut->addHTML($previewhead);
395 $wgOut->addHTML($previewHTML);
396 }
397 $wgOut->addCategoryLinks($parserOutput->getCategoryLinks());
398 $wgOut->addLanguageLinks($parserOutput->getLanguageLinks());
399 $wgOut->addHTML( "<br style=\"clear:both;\" />\n" );
400 }
401 }
402
403 # if this is a comment, show a subject line at the top, which is also the edit summary.
404 # Otherwise, show a summary field at the bottom
405 $summarytext = htmlspecialchars( $wgLang->recodeForEdit( $this->summary ) ); # FIXME
406 if( $this->section == "new" ) {
407 $commentsubject="{$subject}: <input tabindex='1' type='text' value=\"$summarytext\" name=\"wpSummary\" maxlength='200' size='60' /><br />";
408 $editsummary = "";
409 } else {
410 $commentsubject = "";
411 $editsummary="{$summary}: <input tabindex='3' type='text' value=\"$summarytext\" name=\"wpSummary\" maxlength='200' size='60' /><br />";
412 }
413
414 if( !$this->preview ) {
415 # Don't select the edit box on preview; this interferes with seeing what's going on.
416 $wgOut->setOnloadHandler( "document.editform.wpTextbox1.focus()" );
417 }
418 # Prepare a list of templates used by this page
419 $db =& wfGetDB( DB_SLAVE );
420 $cur = $db->tableName( 'cur' );
421 $links = $db->tableName( 'links' );
422 $id = $this->mTitle->getArticleID();
423 $sql = "SELECT cur_namespace,cur_title,cur_id ".
424 "FROM $cur,$links WHERE l_to=cur_id AND l_from={$id} and cur_namespace=".NS_TEMPLATE;
425 $res = $db->query( $sql, "EditPage::editform" );
426
427 if ( $db->numRows( $res ) ) {
428 $templates = '<br />'. wfMsg( 'templatesused' ) . '<ul>';
429 while ( $row = $db->fetchObject( $res ) ) {
430 if ( $titleObj = Title::makeTitle( $row->cur_namespace, $row->cur_title ) ) {
431 $templates .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
432 }
433 }
434 $templates .= '</ul>';
435 }
436 $wgOut->addHTML( "
437 {$toolbar}
438 <form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\"
439 enctype=\"application/x-www-form-urlencoded\">
440 {$commentsubject}
441 <textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" rows='{$rows}'
442 cols='{$cols}'{$ew}>" .
443 htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) .
444 "
445 </textarea>
446 <br />{$editsummary}
447 {$checkboxhtml}
448 <input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"".wfMsg('accesskey-save')."\"".
449 " title=\"".wfMsg('tooltip-save')."\"/>
450 <input tabindex='6' id='wpPreview' type='submit' value=\"{$prev}\" name=\"wpPreview\" accesskey=\"".wfMsg('accesskey-preview')."\"".
451 " title=\"".wfMsg('tooltip-preview')."\"/>
452 <em>{$cancel}</em> | <em>{$edithelp}</em>{$templates}" );
453 $wgOut->addWikiText( $copywarn );
454 $wgOut->addHTML( "
455 <input type='hidden' value=\"" . htmlspecialchars( $this->section ) . "\" name=\"wpSection\" />
456 <input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n" );
457
458 if ( $isConflict ) {
459 $wgOut->addHTML( "<h2>" . wfMsg( "yourdiff" ) . "</h2>\n" );
460 DifferenceEngine::showDiff( $this->textbox2, $this->textbox1,
461 wfMsg( "yourtext" ), wfMsg( "storedversion" ) );
462
463 $wgOut->addHTML( "<h2>" . wfMsg( "yourtext" ) . "</h2>
464 <textarea tabindex=6 id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}' wrap='virtual'>"
465 . htmlspecialchars( $wgLang->recodeForEdit( $this->textbox2 ) ) .
466 "
467 </textarea>" );
468 }
469 $wgOut->addHTML( "</form>\n" );
470 if($formtype =="preview" && !$wgUser->getOption("previewontop")) {
471 $wgOut->addHTML($previewhead);
472 $wgOut->addHTML($previewHTML);
473 }
474
475 }
476
477 function blockedIPpage()
478 {
479 global $wgOut, $wgUser, $wgLang, $wgIP;
480
481 $wgOut->setPageTitle( wfMsg( "blockedtitle" ) );
482 $wgOut->setRobotpolicy( "noindex,nofollow" );
483 $wgOut->setArticleRelated( false );
484
485 $id = $wgUser->blockedBy();
486 $reason = $wgUser->blockedFor();
487 $ip = $wgIP;
488
489 if ( is_numeric( $id ) ) {
490 $name = User::whoIs( $id );
491 } else {
492 $name = $id;
493 }
494 $link = "[[" . $wgLang->getNsText( Namespace::getUser() ) .
495 ":{$name}|{$name}]]";
496
497 $wgOut->addWikiText( wfMsg( "blockedtext", $link, $reason, $ip, $name ) );
498 $wgOut->returnToMain( false );
499 }
500
501
502
503 function userNotLoggedInPage()
504 {
505 global $wgOut, $wgUser, $wgLang;
506
507 $wgOut->setPageTitle( wfMsg( "whitelistedittitle" ) );
508 $wgOut->setRobotpolicy( "noindex,nofollow" );
509 $wgOut->setArticleRelated( false );
510
511 $wgOut->addWikiText( wfMsg( "whitelistedittext" ) );
512 $wgOut->returnToMain( false );
513 }
514
515 function spamPage ( $matches = array() )
516 {
517 global $wgOut;
518 $wgOut->setPageTitle( wfMsg( "spamprotectiontitle" ) );
519 $wgOut->setRobotpolicy( "noindex,nofollow" );
520 $wgOut->setArticleRelated( false );
521
522 $wgOut->addWikiText( wfMsg( 'spamprotectiontext' ) );
523 if ( isset ( $matches[0] ) ) {
524 $wgOut->addWikiText( wfMsg( 'spamprotectionmatch', "<nowiki>{$matches[0]}</nowiki>" ) );
525 }
526 $wgOut->returnToMain( false );
527 }
528
529 # Forks processes to scan the originating IP for an open proxy server
530 # MemCached can be used to skip IPs that have already been scanned
531 function proxyCheck()
532 {
533 global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath;
534 global $wgIP, $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry;
535
536 if ( !$wgBlockOpenProxies ) {
537 return;
538 }
539
540 # Get MemCached key
541 $skip = false;
542 if ( $wgUseMemCached ) {
543 $mcKey = "$wgDBname:proxy:ip:$wgIP";
544 $mcValue = $wgMemc->get( $mcKey );
545 if ( $mcValue ) {
546 $skip = true;
547 }
548 }
549
550 # Fork the processes
551 if ( !$skip ) {
552 $title = Title::makeTitle( NS_SPECIAL, "Blockme" );
553 $iphash = md5( $wgIP . $wgProxyKey );
554 $url = $title->getFullURL( "ip=$iphash" );
555
556 foreach ( $wgProxyPorts as $port ) {
557 $params = implode( " ", array(
558 escapeshellarg( $wgProxyScriptPath ),
559 escapeshellarg( $wgIP ),
560 escapeshellarg( $port ),
561 escapeshellarg( $url )
562 ));
563 exec( "php $params &>/dev/null &" );
564 }
565 # Set MemCached key
566 if ( $wgUseMemCached ) {
567 $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry );
568 }
569 }
570 }
571
572 /* private */ function mergeChangesInto( &$text ){
573 $fname = 'EditPage::mergeChangesInto';
574 $oldDate = $this->edittime;
575 $dbw =& wfGetDB( DB_MASTER );
576 $obj = $dbw->getArray( 'cur', array( 'cur_text' ), array( 'cur_id' => $this->mTitle->getArticleID() ),
577 $fname, 'FOR UPDATE' );
578
579 $yourtext = $obj->cur_text;
580 $ns = $this->mTitle->getNamespace();
581 $title = $this->mTitle->getDBkey();
582 $obj = $dbw->getArray( 'old',
583 array( 'old_text','old_flags'),
584 array( 'old_namespace' => $ns, 'old_title' => $title,
585 'old_timestamp' => $dbw->timestamp($oldDate)),
586 $fname );
587 $oldText = Article::getRevisionText( $obj );
588
589 if(wfMerge($oldText, $text, $yourtext, $result)){
590 $text = $result;
591 return true;
592 } else {
593 return false;
594 }
595 }
596 }
597
598 ?>