Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | $this->previewTextAfterContent = |
114 | 114 | $this->mPreloadText = ""; |
115 | 115 | } |
116 | | - |
| 116 | + |
117 | 117 | function getArticle() { |
118 | 118 | return $this->mArticle; |
119 | 119 | } |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | $undorev->getPage() == $this->mArticle->getID() && |
175 | 175 | !$undorev->isDeleted( Revision::DELETED_TEXT ) && |
176 | 176 | !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { |
177 | | - |
| 177 | + |
178 | 178 | $undotext = $this->mArticle->getUndoText( $undorev, $oldrev ); |
179 | 179 | if ( $undotext === false ) { |
180 | 180 | # Warn the user that something went wrong |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | wfProfileOut( __METHOD__ ); |
210 | 210 | return $text; |
211 | 211 | } |
212 | | - |
| 212 | + |
213 | 213 | /** Use this method before edit() to preload some text into the edit box */ |
214 | 214 | public function setPreloadedText( $text ) { |
215 | 215 | $this->mPreloadText = $text; |
— | — | @@ -330,7 +330,7 @@ |
331 | 331 | $this->mMetaData = $s; |
332 | 332 | } |
333 | 333 | |
334 | | - /* |
| 334 | + /* |
335 | 335 | * Check if a page was deleted while the user was editing it, before submit. |
336 | 336 | * Note that we rely on the logging table, which hasn't been always there, |
337 | 337 | * but that doesn't matter, because this only applies to brand new |
— | — | @@ -422,7 +422,7 @@ |
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
426 | | - |
| 426 | + |
427 | 427 | // If they used redlink=1 and the page exists, redirect to the main article |
428 | 428 | if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) { |
429 | 429 | $wgOut->redirect( $this->mTitle->getFullURL() ); |
— | — | @@ -491,7 +491,7 @@ |
492 | 492 | wfProfileOut( __METHOD__."-business-end" ); |
493 | 493 | wfProfileOut( __METHOD__ ); |
494 | 494 | } |
495 | | - |
| 495 | + |
496 | 496 | protected function getEditPermissionErrors() { |
497 | 497 | global $wgUser; |
498 | 498 | $permErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ); |
— | — | @@ -503,7 +503,7 @@ |
504 | 504 | # Ignore some permissions errors when a user is just previewing/viewing diffs |
505 | 505 | $remove = array(); |
506 | 506 | foreach( $permErrors as $error ) { |
507 | | - if ( ($this->preview || $this->diff) && |
| 507 | + if ( ($this->preview || $this->diff) && |
508 | 508 | ($error[0] == 'blockedtext' || $error[0] == 'autoblockedtext') ) |
509 | 509 | { |
510 | 510 | $remove[] = $error; |
— | — | @@ -632,8 +632,8 @@ |
633 | 633 | $this->watchthis = $request->getCheck( 'wpWatchthis' ); |
634 | 634 | |
635 | 635 | # Don't force edit summaries when a user is editing their own user or talk page |
636 | | - if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) && |
637 | | - $this->mTitle->getText() == $wgUser->getName() ) |
| 636 | + if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) && |
| 637 | + $this->mTitle->getText() == $wgUser->getName() ) |
638 | 638 | { |
639 | 639 | $this->allowBlankSummary = true; |
640 | 640 | } else { |
— | — | @@ -664,7 +664,7 @@ |
665 | 665 | elseif ( $this->section != 'new' && $request->getVal( 'summary' ) ) { |
666 | 666 | $this->summary = $request->getText( 'summary' ); |
667 | 667 | } |
668 | | - |
| 668 | + |
669 | 669 | if ( $request->getVal( 'minor' ) ) { |
670 | 670 | $this->minoredit = true; |
671 | 671 | } |
— | — | @@ -734,11 +734,11 @@ |
735 | 735 | } |
736 | 736 | # Give a notice if the user is editing a deleted/moved page... |
737 | 737 | if ( !$this->mTitle->exists() ) { |
738 | | - LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), |
739 | | - '', array( 'lim' => 10, |
740 | | - 'conds' => array( "log_action != 'revision'" ), |
741 | | - 'showIfEmpty' => false, |
742 | | - 'msgKey' => array( 'recreate-moveddeleted-warn') ) |
| 738 | + LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), |
| 739 | + '', array( 'lim' => 10, |
| 740 | + 'conds' => array( "log_action != 'revision'" ), |
| 741 | + 'showIfEmpty' => false, |
| 742 | + 'msgKey' => array( 'recreate-moveddeleted-warn') ) |
743 | 743 | ); |
744 | 744 | } |
745 | 745 | } |
— | — | @@ -904,7 +904,7 @@ |
905 | 905 | wfProfileOut( $fname ); |
906 | 906 | return self::AS_HOOK_ERROR_EXPECTED; |
907 | 907 | } |
908 | | - |
| 908 | + |
909 | 909 | # Handle the user preference to force summaries here. Check if it's not a redirect. |
910 | 910 | if ( !$this->allowBlankSummary && !Title::newFromRedirect( $this->textbox1 ) ) { |
911 | 911 | if ( md5( $this->summary ) == $this->autoSumm ) { |
— | — | @@ -947,7 +947,7 @@ |
948 | 948 | } |
949 | 949 | } |
950 | 950 | $userid = $wgUser->getId(); |
951 | | - |
| 951 | + |
952 | 952 | # Suppress edit conflict with self, except for section edits where merging is required. |
953 | 953 | if ( $this->isConflict && $this->section == '' && $this->userWasLastToEdit($userid,$this->edittime) ) { |
954 | 954 | wfDebug( "EditPage::editForm Suppressing edit conflict, same user.\n" ); |
— | — | @@ -998,7 +998,7 @@ |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | # Handle the user preference to force summaries here, but not for null edits |
1002 | | - if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp($oldtext,$text) |
| 1002 | + if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp($oldtext,$text) |
1003 | 1003 | && !Title::newFromRedirect( $text ) ) # check if it's not a redirect |
1004 | 1004 | { |
1005 | 1005 | if ( md5( $this->summary ) == $this->autoSumm ) { |
— | — | @@ -1062,7 +1062,7 @@ |
1063 | 1063 | |
1064 | 1064 | # update the article here |
1065 | 1065 | if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, |
1066 | | - $this->watchthis, $bot, $sectionanchor ) ) |
| 1066 | + $this->watchthis, $bot, $sectionanchor ) ) |
1067 | 1067 | { |
1068 | 1068 | wfProfileOut( $fname ); |
1069 | 1069 | return self::AS_SUCCESS_UPDATE; |
— | — | @@ -1072,7 +1072,7 @@ |
1073 | 1073 | wfProfileOut( $fname ); |
1074 | 1074 | return self::AS_END; |
1075 | 1075 | } |
1076 | | - |
| 1076 | + |
1077 | 1077 | /** |
1078 | 1078 | * Check if no edits were made by other users since |
1079 | 1079 | * the time a user started editing the page. Limit to |
— | — | @@ -1083,7 +1083,7 @@ |
1084 | 1084 | $dbw = wfGetDB( DB_MASTER ); |
1085 | 1085 | $res = $dbw->select( 'revision', |
1086 | 1086 | 'rev_user', |
1087 | | - array( |
| 1087 | + array( |
1088 | 1088 | 'rev_page' => $this->mArticle->getId(), |
1089 | 1089 | 'rev_timestamp > '.$dbw->addQuotes( $dbw->timestamp($edittime) ) |
1090 | 1090 | ), |
— | — | @@ -1107,7 +1107,7 @@ |
1108 | 1108 | $regexes = (array)$wgSpamRegex; |
1109 | 1109 | return self::matchSpamRegexInternal( $text, $regexes ); |
1110 | 1110 | } |
1111 | | - |
| 1111 | + |
1112 | 1112 | /** |
1113 | 1113 | * Check given input text against $wgSpamRegex, and return the text of the first match. |
1114 | 1114 | * @return mixed -- matching string or false |
— | — | @@ -1117,7 +1117,7 @@ |
1118 | 1118 | $regexes = (array)$wgSummarySpamRegex; |
1119 | 1119 | return self::matchSpamRegexInternal( $text, $regexes ); |
1120 | 1120 | } |
1121 | | - |
| 1121 | + |
1122 | 1122 | protected static function matchSpamRegexInternal( $text, $regexes ) { |
1123 | 1123 | foreach( $regexes as $regex ) { |
1124 | 1124 | $matches = array(); |
— | — | @@ -1192,9 +1192,9 @@ |
1193 | 1193 | if ( $this->formtype == 'preview' ) { |
1194 | 1194 | $previewOutput = $this->getPreviewText(); |
1195 | 1195 | } |
1196 | | - |
1197 | | - wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ; |
1198 | 1196 | |
| 1197 | + wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ); |
| 1198 | + |
1199 | 1199 | $this->setHeaders(); |
1200 | 1200 | |
1201 | 1201 | # Enabled article-related sidebar, toplinks, etc. |
— | — | @@ -1289,7 +1289,7 @@ |
1290 | 1290 | $noticeMsg = 'protectedpagewarning'; |
1291 | 1291 | $classes[] = 'mw-textarea-protected'; |
1292 | 1292 | } |
1293 | | - LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', |
| 1293 | + LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', |
1294 | 1294 | array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) ); |
1295 | 1295 | } |
1296 | 1296 | if ( $this->mTitle->isCascadeProtected() ) { |
— | — | @@ -1551,7 +1551,7 @@ |
1552 | 1552 | END |
1553 | 1553 | ); |
1554 | 1554 | $this->showTextbox1( $classes ); |
1555 | | - |
| 1555 | + |
1556 | 1556 | $wgOut->addHTML( $this->editFormTextAfterContent ); |
1557 | 1557 | |
1558 | 1558 | $wgOut->wrapWikiMsg( "<div id=\"editpage-copywarn\">\n$1\n</div>", $copywarnMsg ); |
— | — | @@ -1628,25 +1628,25 @@ |
1629 | 1629 | <input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n |
1630 | 1630 | <input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" ); |
1631 | 1631 | } |
1632 | | - |
| 1632 | + |
1633 | 1633 | protected function showTextbox1( $classes ) { |
1634 | 1634 | $attribs = array( 'tabindex' => 1 ); |
1635 | | - |
| 1635 | + |
1636 | 1636 | if ( $this->wasDeletedSinceLastEdit() ) |
1637 | 1637 | $attribs['type'] = 'hidden'; |
1638 | 1638 | if ( !empty($classes) ) |
1639 | 1639 | $attribs['class'] = implode(' ',$classes); |
1640 | | - |
| 1640 | + |
1641 | 1641 | $this->showTextbox( $this->textbox1, 'wpTextbox1', $attribs ); |
1642 | 1642 | } |
1643 | | - |
| 1643 | + |
1644 | 1644 | protected function showTextbox2() { |
1645 | 1645 | $this->showTextbox( $this->textbox2, 'wpTextbox2', array( 'tabindex' => 6 ) ); |
1646 | 1646 | } |
1647 | | - |
| 1647 | + |
1648 | 1648 | protected function showTextbox( $content, $name, $attribs = array() ) { |
1649 | 1649 | global $wgOut, $wgUser; |
1650 | | - |
| 1650 | + |
1651 | 1651 | $wikitext = $this->safeUnicodeOutput( $content ); |
1652 | 1652 | if ( $wikitext !== '' ) { |
1653 | 1653 | // Ensure there's a newline at the end, otherwise adding lines |
— | — | @@ -1655,13 +1655,13 @@ |
1656 | 1656 | // mode will show an extra newline. A bit annoying. |
1657 | 1657 | $wikitext .= "\n"; |
1658 | 1658 | } |
1659 | | - |
| 1659 | + |
1660 | 1660 | $attribs['accesskey'] = ','; |
1661 | 1661 | $attribs['id'] = $name; |
1662 | | - |
| 1662 | + |
1663 | 1663 | if ( $wgUser->getOption( 'editwidth' ) ) |
1664 | 1664 | $attribs['style'] = 'width: 100%'; |
1665 | | - |
| 1665 | + |
1666 | 1666 | $wgOut->addHTML( Xml::textarea( |
1667 | 1667 | $name, |
1668 | 1668 | $wikitext, |
— | — | @@ -1766,7 +1766,7 @@ |
1767 | 1767 | 'log_title', |
1768 | 1768 | 'log_comment', |
1769 | 1769 | 'log_params', |
1770 | | - 'log_deleted', |
| 1770 | + 'log_deleted', |
1771 | 1771 | 'user_name' ), |
1772 | 1772 | array( 'log_namespace' => $this->mTitle->getNamespace(), |
1773 | 1773 | 'log_title' => $this->mTitle->getDBkey(), |
— | — | @@ -1878,7 +1878,7 @@ |
1879 | 1879 | wfProfileOut( __METHOD__ ); |
1880 | 1880 | return $previewhead . $previewHTML . $this->previewTextAfterContent; |
1881 | 1881 | } |
1882 | | - |
| 1882 | + |
1883 | 1883 | function getTemplates() { |
1884 | 1884 | if ( $this->preview || $this->section != '' ) { |
1885 | 1885 | $templates = array(); |
— | — | @@ -2065,7 +2065,7 @@ |
2066 | 2066 | * Shows a bulletin board style toolbar for common editing functions. |
2067 | 2067 | * It can be disabled in the user preferences. |
2068 | 2068 | * The necessary JavaScript code can be found in skins/common/edit.js. |
2069 | | - * |
| 2069 | + * |
2070 | 2070 | * @return string |
2071 | 2071 | */ |
2072 | 2072 | static function getEditToolbar() { |
— | — | @@ -2283,7 +2283,7 @@ |
2284 | 2284 | ++$tabindex; // use the same for preview and live preview |
2285 | 2285 | if ( $this->useLivePreview() ) { |
2286 | 2286 | $this->doLivePreviewScript(); // Add to output |
2287 | | - |
| 2287 | + |
2288 | 2288 | $temp = array( |
2289 | 2289 | 'id' => 'wpPreview', |
2290 | 2290 | 'name' => 'wpPreview', |
— | — | @@ -2305,7 +2305,7 @@ |
2306 | 2306 | 'title' => '', |
2307 | 2307 | 'style' => 'display: none;', |
2308 | 2308 | ); |
2309 | | - |
| 2309 | + |
2310 | 2310 | $buttons['live'] = Xml::element('input', $temp, ''); |
2311 | 2311 | } else { |
2312 | 2312 | $temp = array( |
— | — | @@ -2601,7 +2601,7 @@ |
2602 | 2602 | return false; |
2603 | 2603 | } |
2604 | 2604 | } |
2605 | | - |
| 2605 | + |
2606 | 2606 | function getBaseRevision() { |
2607 | 2607 | if ( $this->mBaseRevision == false ) { |
2608 | 2608 | $db = wfGetDB( DB_MASTER ); |