r58052 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58051‎ | r58052 | r58053 >
Date:11:08, 23 October 2009
Author:ialex
Status:ok
Tags:
Comment:
removed trailing spaces
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -112,7 +112,7 @@
113113 $this->previewTextAfterContent =
114114 $this->mPreloadText = "";
115115 }
116 -
 116+
117117 function getArticle() {
118118 return $this->mArticle;
119119 }
@@ -173,7 +173,7 @@
174174 $undorev->getPage() == $this->mArticle->getID() &&
175175 !$undorev->isDeleted( Revision::DELETED_TEXT ) &&
176176 !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) {
177 -
 177+
178178 $undotext = $this->mArticle->getUndoText( $undorev, $oldrev );
179179 if ( $undotext === false ) {
180180 # Warn the user that something went wrong
@@ -208,7 +208,7 @@
209209 wfProfileOut( __METHOD__ );
210210 return $text;
211211 }
212 -
 212+
213213 /** Use this method before edit() to preload some text into the edit box */
214214 public function setPreloadedText( $text ) {
215215 $this->mPreloadText = $text;
@@ -330,7 +330,7 @@
331331 $this->mMetaData = $s;
332332 }
333333
334 - /*
 334+ /*
335335 * Check if a page was deleted while the user was editing it, before submit.
336336 * Note that we rely on the logging table, which hasn't been always there,
337337 * but that doesn't matter, because this only applies to brand new
@@ -422,7 +422,7 @@
423423 }
424424 }
425425 }
426 -
 426+
427427 // If they used redlink=1 and the page exists, redirect to the main article
428428 if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
429429 $wgOut->redirect( $this->mTitle->getFullURL() );
@@ -491,7 +491,7 @@
492492 wfProfileOut( __METHOD__."-business-end" );
493493 wfProfileOut( __METHOD__ );
494494 }
495 -
 495+
496496 protected function getEditPermissionErrors() {
497497 global $wgUser;
498498 $permErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
@@ -503,7 +503,7 @@
504504 # Ignore some permissions errors when a user is just previewing/viewing diffs
505505 $remove = array();
506506 foreach( $permErrors as $error ) {
507 - if ( ($this->preview || $this->diff) &&
 507+ if ( ($this->preview || $this->diff) &&
508508 ($error[0] == 'blockedtext' || $error[0] == 'autoblockedtext') )
509509 {
510510 $remove[] = $error;
@@ -632,8 +632,8 @@
633633 $this->watchthis = $request->getCheck( 'wpWatchthis' );
634634
635635 # 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() )
638638 {
639639 $this->allowBlankSummary = true;
640640 } else {
@@ -664,7 +664,7 @@
665665 elseif ( $this->section != 'new' && $request->getVal( 'summary' ) ) {
666666 $this->summary = $request->getText( 'summary' );
667667 }
668 -
 668+
669669 if ( $request->getVal( 'minor' ) ) {
670670 $this->minoredit = true;
671671 }
@@ -734,11 +734,11 @@
735735 }
736736 # Give a notice if the user is editing a deleted/moved page...
737737 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') )
743743 );
744744 }
745745 }
@@ -904,7 +904,7 @@
905905 wfProfileOut( $fname );
906906 return self::AS_HOOK_ERROR_EXPECTED;
907907 }
908 -
 908+
909909 # Handle the user preference to force summaries here. Check if it's not a redirect.
910910 if ( !$this->allowBlankSummary && !Title::newFromRedirect( $this->textbox1 ) ) {
911911 if ( md5( $this->summary ) == $this->autoSumm ) {
@@ -947,7 +947,7 @@
948948 }
949949 }
950950 $userid = $wgUser->getId();
951 -
 951+
952952 # Suppress edit conflict with self, except for section edits where merging is required.
953953 if ( $this->isConflict && $this->section == '' && $this->userWasLastToEdit($userid,$this->edittime) ) {
954954 wfDebug( "EditPage::editForm Suppressing edit conflict, same user.\n" );
@@ -998,7 +998,7 @@
999999 }
10001000
10011001 # 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)
10031003 && !Title::newFromRedirect( $text ) ) # check if it's not a redirect
10041004 {
10051005 if ( md5( $this->summary ) == $this->autoSumm ) {
@@ -1062,7 +1062,7 @@
10631063
10641064 # update the article here
10651065 if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
1066 - $this->watchthis, $bot, $sectionanchor ) )
 1066+ $this->watchthis, $bot, $sectionanchor ) )
10671067 {
10681068 wfProfileOut( $fname );
10691069 return self::AS_SUCCESS_UPDATE;
@@ -1072,7 +1072,7 @@
10731073 wfProfileOut( $fname );
10741074 return self::AS_END;
10751075 }
1076 -
 1076+
10771077 /**
10781078 * Check if no edits were made by other users since
10791079 * the time a user started editing the page. Limit to
@@ -1083,7 +1083,7 @@
10841084 $dbw = wfGetDB( DB_MASTER );
10851085 $res = $dbw->select( 'revision',
10861086 'rev_user',
1087 - array(
 1087+ array(
10881088 'rev_page' => $this->mArticle->getId(),
10891089 'rev_timestamp > '.$dbw->addQuotes( $dbw->timestamp($edittime) )
10901090 ),
@@ -1107,7 +1107,7 @@
11081108 $regexes = (array)$wgSpamRegex;
11091109 return self::matchSpamRegexInternal( $text, $regexes );
11101110 }
1111 -
 1111+
11121112 /**
11131113 * Check given input text against $wgSpamRegex, and return the text of the first match.
11141114 * @return mixed -- matching string or false
@@ -1117,7 +1117,7 @@
11181118 $regexes = (array)$wgSummarySpamRegex;
11191119 return self::matchSpamRegexInternal( $text, $regexes );
11201120 }
1121 -
 1121+
11221122 protected static function matchSpamRegexInternal( $text, $regexes ) {
11231123 foreach( $regexes as $regex ) {
11241124 $matches = array();
@@ -1192,9 +1192,9 @@
11931193 if ( $this->formtype == 'preview' ) {
11941194 $previewOutput = $this->getPreviewText();
11951195 }
1196 -
1197 - wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
11981196
 1197+ wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) );
 1198+
11991199 $this->setHeaders();
12001200
12011201 # Enabled article-related sidebar, toplinks, etc.
@@ -1289,7 +1289,7 @@
12901290 $noticeMsg = 'protectedpagewarning';
12911291 $classes[] = 'mw-textarea-protected';
12921292 }
1293 - LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
 1293+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
12941294 array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) );
12951295 }
12961296 if ( $this->mTitle->isCascadeProtected() ) {
@@ -1551,7 +1551,7 @@
15521552 END
15531553 );
15541554 $this->showTextbox1( $classes );
1555 -
 1555+
15561556 $wgOut->addHTML( $this->editFormTextAfterContent );
15571557
15581558 $wgOut->wrapWikiMsg( "<div id=\"editpage-copywarn\">\n$1\n</div>", $copywarnMsg );
@@ -1628,25 +1628,25 @@
16291629 <input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n
16301630 <input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" );
16311631 }
1632 -
 1632+
16331633 protected function showTextbox1( $classes ) {
16341634 $attribs = array( 'tabindex' => 1 );
1635 -
 1635+
16361636 if ( $this->wasDeletedSinceLastEdit() )
16371637 $attribs['type'] = 'hidden';
16381638 if ( !empty($classes) )
16391639 $attribs['class'] = implode(' ',$classes);
1640 -
 1640+
16411641 $this->showTextbox( $this->textbox1, 'wpTextbox1', $attribs );
16421642 }
1643 -
 1643+
16441644 protected function showTextbox2() {
16451645 $this->showTextbox( $this->textbox2, 'wpTextbox2', array( 'tabindex' => 6 ) );
16461646 }
1647 -
 1647+
16481648 protected function showTextbox( $content, $name, $attribs = array() ) {
16491649 global $wgOut, $wgUser;
1650 -
 1650+
16511651 $wikitext = $this->safeUnicodeOutput( $content );
16521652 if ( $wikitext !== '' ) {
16531653 // Ensure there's a newline at the end, otherwise adding lines
@@ -1655,13 +1655,13 @@
16561656 // mode will show an extra newline. A bit annoying.
16571657 $wikitext .= "\n";
16581658 }
1659 -
 1659+
16601660 $attribs['accesskey'] = ',';
16611661 $attribs['id'] = $name;
1662 -
 1662+
16631663 if ( $wgUser->getOption( 'editwidth' ) )
16641664 $attribs['style'] = 'width: 100%';
1665 -
 1665+
16661666 $wgOut->addHTML( Xml::textarea(
16671667 $name,
16681668 $wikitext,
@@ -1766,7 +1766,7 @@
17671767 'log_title',
17681768 'log_comment',
17691769 'log_params',
1770 - 'log_deleted',
 1770+ 'log_deleted',
17711771 'user_name' ),
17721772 array( 'log_namespace' => $this->mTitle->getNamespace(),
17731773 'log_title' => $this->mTitle->getDBkey(),
@@ -1878,7 +1878,7 @@
18791879 wfProfileOut( __METHOD__ );
18801880 return $previewhead . $previewHTML . $this->previewTextAfterContent;
18811881 }
1882 -
 1882+
18831883 function getTemplates() {
18841884 if ( $this->preview || $this->section != '' ) {
18851885 $templates = array();
@@ -2065,7 +2065,7 @@
20662066 * Shows a bulletin board style toolbar for common editing functions.
20672067 * It can be disabled in the user preferences.
20682068 * The necessary JavaScript code can be found in skins/common/edit.js.
2069 - *
 2069+ *
20702070 * @return string
20712071 */
20722072 static function getEditToolbar() {
@@ -2283,7 +2283,7 @@
22842284 ++$tabindex; // use the same for preview and live preview
22852285 if ( $this->useLivePreview() ) {
22862286 $this->doLivePreviewScript(); // Add to output
2287 -
 2287+
22882288 $temp = array(
22892289 'id' => 'wpPreview',
22902290 'name' => 'wpPreview',
@@ -2305,7 +2305,7 @@
23062306 'title' => '',
23072307 'style' => 'display: none;',
23082308 );
2309 -
 2309+
23102310 $buttons['live'] = Xml::element('input', $temp, '');
23112311 } else {
23122312 $temp = array(
@@ -2601,7 +2601,7 @@
26022602 return false;
26032603 }
26042604 }
2605 -
 2605+
26062606 function getBaseRevision() {
26072607 if ( $this->mBaseRevision == false ) {
26082608 $db = wfGetDB( DB_MASTER );

Status & tagging log