r14220 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14219‎ | r14220 | r14221 >
Date:16:41, 14 May 2006
Author:robchurch
Status:old
Tags:
Comment:
(bug 5651) Disable section editing links for users who can't edit
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3054,11 +3054,13 @@
30553055 $doNumberHeadings = $this->mOptions->getNumberHeadings();
30563056 $doShowToc = true;
30573057 $forceTocHere = false;
3058 - if( !$this->mTitle->userCanEdit() ) {
3059 - $showEditLink = 0;
3060 - } else {
3061 - $showEditLink = $this->mOptions->getEditSection();
3062 - }
 3058+
 3059+ # Show section editing links if the user can edit the page and has
 3060+ # the appropriate preference set
 3061+ $user =& $this->mOptions->getUser();
 3062+ $perm = $user->isAllowed( 'edit' ) && $this->mTitle->userCanEdit();
 3063+ $pref = $this->mOptions->getEditSection();
 3064+ $showEditLink = $perm && $pref;
30633065
30643066 # Inhibit editsection links if requested in the page
30653067 $esw =& MagicWord::get( MAG_NOEDITSECTION );
@@ -4219,6 +4221,7 @@
42204222 var $mAllowSpecialInclusion; # Allow inclusion of special pages
42214223 var $mTidy; # Ask for tidy cleanup
42224224 var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
 4225+ var $mUser; # User being parsed for
42234226
42244227 function getUseTeX() { return $this->mUseTeX; }
42254228 function getUseDynamicDates() { return $this->mUseDynamicDates; }
@@ -4232,6 +4235,7 @@
42334236 function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; }
42344237 function getTidy() { return $this->mTidy; }
42354238 function getInterfaceMessage() { return $this->mInterfaceMessage; }
 4239+ function getUser() { return $this->mUser; }
42364240
42374241 function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); }
42384242 function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); }
@@ -4274,6 +4278,7 @@
42754279 $user =& $userInput;
42764280 }
42774281
 4282+ $this->mUser =& $user;
42784283 $this->mUseTeX = $wgUseTeX;
42794284 $this->mUseDynamicDates = $wgUseDynamicDates;
42804285 $this->mInterwikiMagic = $wgInterwikiMagic;
@@ -4283,7 +4288,7 @@
42844289 $this->mSkin =& $user->getSkin();
42854290 wfProfileOut( $fname.'-skin' );
42864291 $this->mDateFormat = $user->getOption( 'date' );
4287 - $this->mEditSection = true;
 4292+ $this->mEditSection = $user->getOption( 'editsection' );
42884293 $this->mNumberHeadings = $user->getOption( 'numberheadings' );
42894294 $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
42904295 $this->mTidy = false;
Index: trunk/phase3/RELEASE-NOTES
@@ -266,6 +266,7 @@
267267 Special:Statistics
268268 * (bug 5949) Update to Indonesian localisation (id)
269269 * (bug 5862) Update of Belarusian translation (be)
 270+* (bug 5651) Disable section editing links for users who can't edit
270271
271272 == Compatibility ==
272273

Status & tagging log