r53116 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53115‎ | r53116 | r53117 >
Date:18:09, 11 July 2009
Author:ialex
Status:resolved
Tags:
Comment:
renamed NAMESPACE constant to NAMESPACE_RESTRICTION (and PAGE to PAGE_RESTRICTION for consistency) to avoid E_PARSE on PHP 5.3+
Modified paths:
  • /trunk/phase3/includes/specials/SpecialListUserRestrictions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRestrictUser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRestrictUser.php
@@ -62,7 +62,7 @@
6363 global $wgOut, $wgRequest, $wgUser;
6464 $error = '';
6565 $success = false;
66 - if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::PAGE &&
 66+ if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::PAGE_RESTRICTION &&
6767 $wgUser->matchEditToken( $wgRequest->getVal( 'edittoken' ) ) ) {
6868
6969 $title = Title::newFromText( $wgRequest->getVal( 'page' ) );
@@ -81,14 +81,14 @@
8282 $success = array('restrictuser-success', $user);
8383 }
8484 }
85 - $useRequestValues = $wgRequest->getVal( 'type' ) == UserRestriction::PAGE;
 85+ $useRequestValues = $wgRequest->getVal( 'type' ) == UserRestriction::PAGE_RESTRICTION;
8686 $wgOut->addHTML( Xml::fieldset( wfMsg( 'restrictuser-legend-page' ) ) );
8787
8888 self::printSuccessError( $success, $error );
8989
9090 $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => SpecialPage::getTitleFor( 'RestrictUser' )->getLocalUrl(),
9191 'method' => 'post' ) ) );
92 - $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::PAGE ) );
 92+ $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::PAGE_RESTRICTION ) );
9393 $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) );
9494 $wgOut->addHTML( Xml::hidden( 'user', $user ) );
9595 $form = array();
@@ -113,7 +113,7 @@
114114 public static function doPageRestriction( $uid, $user ) {
115115 global $wgUser, $wgRequest;
116116 $r = new UserRestriction();
117 - $r->setType( UserRestriction::PAGE );
 117+ $r->setType( UserRestriction::PAGE_RESTRICTION );
118118 $r->setPage( Title::newFromText( $wgRequest->getVal( 'page' ) ) );
119119 $r->setSubjectId( $uid );
120120 $r->setSubjectText( $user );
@@ -133,7 +133,7 @@
134134 global $wgOut, $wgRequest, $wgUser, $wgContLang;
135135 $error = '';
136136 $success = false;
137 - if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::NAMESPACE &&
 137+ if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::NAMESPACE_RESTRICTION &&
138138 $wgUser->matchEditToken( $wgRequest->getVal( 'edittoken' ) ) ) {
139139 $ns = $wgRequest->getVal( 'namespace' );
140140 if( $wgContLang->getNsText( $ns ) === false )
@@ -149,14 +149,14 @@
150150 $success = array('restrictuser-success', $user);
151151 }
152152 }
153 - $useRequestValues = $wgRequest->getVal( 'type' ) == UserRestriction::NAMESPACE;
 153+ $useRequestValues = $wgRequest->getVal( 'type' ) == UserRestriction::NAMESPACE_RESTRICTION;
154154 $wgOut->addHTML( Xml::fieldset( wfMsg( 'restrictuser-legend-namespace' ) ) );
155155
156156 self::printSuccessError( $success, $error );
157157
158158 $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => SpecialPage::getTitleFor( 'RestrictUser' )->getLocalUrl(),
159159 'method' => 'post' ) ) );
160 - $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::NAMESPACE ) );
 160+ $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::NAMESPACE_RESTRICTION ) );
161161 $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) );
162162 $wgOut->addHTML( Xml::hidden( 'user', $user ) );
163163 $form = array();
@@ -172,7 +172,7 @@
173173 public static function doNamespaceRestriction( $uid, $user ) {
174174 global $wgUser, $wgRequest;
175175 $r = new UserRestriction();
176 - $r->setType( UserRestriction::NAMESPACE );
 176+ $r->setType( UserRestriction::NAMESPACE_RESTRICTION );
177177 $r->setNamespace( $wgRequest->getVal( 'namespace' ) );
178178 $r->setSubjectId( $uid );
179179 $r->setSubjectText( $user );
Index: trunk/phase3/includes/specials/SpecialListUserRestrictions.php
@@ -48,8 +48,8 @@
4949 public static function typeSelector( $name = 'type', $value = '', $id = false ) {
5050 $s = new XmlSelect( $name, $id, $value );
5151 $s->addOption( wfMsg( 'userrestrictiontype-none' ), '' );
52 - $s->addOption( wfMsg( 'userrestrictiontype-page' ), UserRestriction::PAGE );
53 - $s->addOption( wfMsg( 'userrestrictiontype-namespace' ), UserRestriction::NAMESPACE );
 52+ $s->addOption( wfMsg( 'userrestrictiontype-page' ), UserRestriction::PAGE_RESTRICTION );
 53+ $s->addOption( wfMsg( 'userrestrictiontype-namespace' ), UserRestriction::NAMESPACE_RESTRICTION );
5454 return $s->getHTML();
5555 }
5656
@@ -58,7 +58,7 @@
5959 $conds = array();
6060
6161 $type = $wgRequest->getVal( 'type' );
62 - if( in_array( $type, array( UserRestriction::PAGE, UserRestriction::NAMESPACE ) ) )
 62+ if( in_array( $type, array( UserRestriction::PAGE_RESTRICTION, UserRestriction::NAMESPACE_RESTRICTION ) ) )
6363 $conds['ur_type'] = $type;
6464
6565 $user = $wgRequest->getVal( 'user' );
@@ -105,7 +105,7 @@
106106 $name = str_replace( ' ', '_', $row->ur_user_text );
107107 $lb->add( NS_USER, $name );
108108 $lb->add( NS_USER_TALK, $name );
109 - if( $row->ur_type == UserRestriction::PAGE )
 109+ if( $row->ur_type == UserRestriction::PAGE_RESTRICTION )
110110 $lb->add( $row->ur_page_namespace, $row->ur_page_title );
111111 }
112112 $lb->execute();

Follow-up revisions

RevisionCommit summaryAuthorDate
r53118follow-up r53116: let's just delete the files since the feature was reverted ...ialex19:07, 11 July 2009

Status & tagging log