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