From 37a8e9a147423fea707823d35d06665dc68cdecd Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Wed, 4 Nov 2009 12:55:00 +0000 Subject: [PATCH] * (bug 6579) Fixed protecting images from uploading only * Added upload by default to $wgRestrictionTypes Also requires MessagesEn.php accidently committed in r58536 --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 2 +- includes/ProtectionForm.php | 8 ++++++-- maintenance/language/messages.inc | 2 +- skins/common/protect.js | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 488f92fe40..8c10923d02 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -96,6 +96,7 @@ Hopefully we will remove this configuration var soon) * $wgEnableHtmlDiff has been removed * (bug 3340) $wgBlockCIDRLimit added (default: 16) to configure the low end of CIDR ranges for blocking +* Added upload by default to $wgRestrictionTypes === New features in 1.16 === @@ -617,6 +618,7 @@ Hopefully we will remove this configuration var soon) * (bug 19859) Removed experimental HTMLDiff feature * Removed section edit links in edit conflict form * Allow SpecialActiveusers to work on non-MySQL databases +* (bug 6579) Fixed protecting images from uploading only == API changes in 1.16 == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index adcc1a5603..db1106a693 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1452,7 +1452,7 @@ $wgGroupsRemoveFromSelf = array(); * You probably shouldn't change this. * Translated through restriction-* messages. */ -$wgRestrictionTypes = array( 'edit', 'move' ); +$wgRestrictionTypes = array( 'edit', 'move', 'upload' ); /** * Rights which can be required for each protection level (via action=protect) diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index e6b7dbe4bb..4a32ecd5ac 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -318,6 +318,10 @@ class ProtectionForm { Xml::openElement( 'tbody' ); foreach( $this->mRestrictions as $action => $selected ) { + // Special case: apply upload protection only on images + if ( $action == 'upload' && $this->mTitle->getNamespace() != NS_FILE ) + continue; + /* Not all languages have V_x <-> N_x relation */ $msg = wfMsg( 'restriction-' . $action ); if( wfEmptyMsg( 'restriction-' . $action, $msg ) ) { @@ -547,8 +551,8 @@ class ProtectionForm { } $script .= "[" . implode(',',$CascadeableLevels) . "];\n"; $options = (object)array( - 'tableId' => 'mw-protect-table-move', - 'labelText' => wfMsg( 'protect-unchain' ), + 'tableId' => 'mwProtectSet', + 'labelText' => wfMsg( 'protect-unchain-permissions' ), 'numTypes' => count($this->mApplicableTypes), 'existingMatch' => 1 == count( array_unique( $this->mExistingExpiry ) ), ); diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index dabbe268a6..0e01ed6848 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1751,7 +1751,7 @@ $wgMessageStructure = array( 'protectexpiry', 'protect_expiry_invalid', 'protect_expiry_old', - 'protect-unchain', + 'protect-unchain-permissions', 'protect-text', 'protect-locked-blocked', 'protect-locked-dblock', diff --git a/skins/common/protect.js b/skins/common/protect.js index d9650c829a..e037f08a0e 100644 --- a/skins/common/protect.js +++ b/skins/common/protect.js @@ -22,7 +22,7 @@ var ProtectionForm = { var boxbody = box.getElementsByTagName('tbody')[0] var row = document.createElement( 'tr' ); - boxbody.insertBefore( row, boxbody.firstChild ); + boxbody.insertBefore( row, boxbody.firstChild.nextSibling ); this.existingMatch = opts.existingMatch; -- 2.20.1