Index: trunk/phase3/includes/User.php |
— | — | @@ -1104,16 +1104,16 @@ |
1105 | 1105 | |
1106 | 1106 | /** |
1107 | 1107 | * Add the user to the group if he/she meets given criteria. |
1108 | | - * |
1109 | | - * Contrary to autopromotion by \ref $wgAutopromote, the group will be |
| 1108 | + * |
| 1109 | + * Contrary to autopromotion by \ref $wgAutopromote, the group will be |
1110 | 1110 | * possible to remove manually via Special:UserRights. In such case it |
1111 | 1111 | * will not be re-added automatically. The user will also not lose the |
1112 | 1112 | * group if they no longer meet the criteria. |
1113 | | - * |
| 1113 | + * |
1114 | 1114 | * @param $event String key in $wgAutopromoteOnce (each one has groups/criteria) |
1115 | | - * |
1116 | | - * @return array Array of groups the user has been promoted to. |
1117 | | - * |
| 1115 | + * |
| 1116 | + * @return array Array of groups the user has been promoted to. |
| 1117 | + * |
1118 | 1118 | * @see $wgAutopromoteOnce |
1119 | 1119 | */ |
1120 | 1120 | public function addAutopromoteOnceGroups( $event ) { |
— | — | @@ -1135,7 +1135,7 @@ |
1136 | 1136 | ); |
1137 | 1137 | } |
1138 | 1138 | } |
1139 | | - return $toPromote; |
| 1139 | + return $toPromote; |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | /** |
— | — | @@ -1152,7 +1152,7 @@ |
1153 | 1153 | $this->mSkin = null; |
1154 | 1154 | $this->mRights = null; |
1155 | 1155 | $this->mEffectiveGroups = null; |
1156 | | - $this->mOptions = null; |
| 1156 | + $this->mOptions = null; |
1157 | 1157 | |
1158 | 1158 | if ( $reloadFrom ) { |
1159 | 1159 | $this->mLoadedItems = array(); |
— | — | @@ -2276,15 +2276,15 @@ |
2277 | 2277 | } |
2278 | 2278 | return $this->mEffectiveGroups; |
2279 | 2279 | } |
2280 | | - |
| 2280 | + |
2281 | 2281 | /** |
2282 | | - * Returns the groups the user has belonged to. |
2283 | | - * |
| 2282 | + * Returns the groups the user has belonged to. |
| 2283 | + * |
2284 | 2284 | * The user may still belong to the returned groups. Compare with getGroups(). |
2285 | | - * |
| 2285 | + * |
2286 | 2286 | * The function will not return groups the user had belonged to before MW 1.17 |
2287 | | - * |
2288 | | - * @return array Names of the groups the user has belonged to. |
| 2287 | + * |
| 2288 | + * @return array Names of the groups the user has belonged to. |
2289 | 2289 | */ |
2290 | 2290 | function getFormerGroups() { |
2291 | 2291 | if( is_null( $this->mFormerGroups ) ) { |
— | — | @@ -2297,10 +2297,10 @@ |
2298 | 2298 | foreach( $res as $row ) { |
2299 | 2299 | $this->mFormerGroups[] = $row->ufg_group; |
2300 | 2300 | } |
2301 | | - } |
| 2301 | + } |
2302 | 2302 | return $this->mFormerGroups; |
2303 | 2303 | } |
2304 | | - |
| 2304 | + |
2305 | 2305 | /** |
2306 | 2306 | * Get the user's edit count. |
2307 | 2307 | * @return Int |
— | — | @@ -3310,12 +3310,15 @@ |
3311 | 3311 | $this->load(); |
3312 | 3312 | $confirmed = true; |
3313 | 3313 | if( wfRunHooks( 'EmailConfirmed', array( &$this, &$confirmed ) ) ) { |
3314 | | - if( $this->isAnon() ) |
| 3314 | + if( $this->isAnon() ) { |
3315 | 3315 | return false; |
3316 | | - if( !self::isValidEmailAddr( $this->mEmail ) ) |
| 3316 | + } |
| 3317 | + if( !Sanitizer::validateEmail( $this->mEmail ) ) { |
3317 | 3318 | return false; |
3318 | | - if( $wgEmailAuthentication && !$this->getEmailAuthenticationTimestamp() ) |
| 3319 | + } |
| 3320 | + if( $wgEmailAuthentication && !$this->getEmailAuthenticationTimestamp() ) { |
3319 | 3321 | return false; |
| 3322 | + } |
3320 | 3323 | return true; |
3321 | 3324 | } else { |
3322 | 3325 | return $confirmed; |
Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Get a special type of connection |
133 | | - * @param $type See openPgConnection() for details. |
| 133 | + * @param $type string See openPgConnection() for details. |
134 | 134 | * @return Status |
135 | 135 | */ |
136 | 136 | protected function getPgConnection( $type ) { |
— | — | @@ -151,35 +151,35 @@ |
152 | 152 | * Get a connection of a specific PostgreSQL-specific type. Connections |
153 | 153 | * of a given type are cached. |
154 | 154 | * |
155 | | - * PostgreSQL lacks cross-database operations, so after the new database is |
156 | | - * created, you need to make a separate connection to connect to that |
157 | | - * database and add tables to it. |
| 155 | + * PostgreSQL lacks cross-database operations, so after the new database is |
| 156 | + * created, you need to make a separate connection to connect to that |
| 157 | + * database and add tables to it. |
158 | 158 | * |
159 | | - * New tables are owned by the user that creates them, and MediaWiki's |
160 | | - * PostgreSQL support has always assumed that the table owner will be |
161 | | - * $wgDBuser. So before we create new tables, we either need to either |
162 | | - * connect as the other user or to execute a SET ROLE command. Using a |
163 | | - * separate connection for this allows us to avoid accidental cross-module |
| 159 | + * New tables are owned by the user that creates them, and MediaWiki's |
| 160 | + * PostgreSQL support has always assumed that the table owner will be |
| 161 | + * $wgDBuser. So before we create new tables, we either need to either |
| 162 | + * connect as the other user or to execute a SET ROLE command. Using a |
| 163 | + * separate connection for this allows us to avoid accidental cross-module |
164 | 164 | * dependencies. |
165 | 165 | * |
166 | 166 | * @param $type The type of connection to get: |
167 | 167 | * - create-db: A connection for creating DBs, suitable for pre- |
168 | 168 | * installation. |
169 | | - * - create-schema: A connection to the new DB, for creating schemas and |
| 169 | + * - create-schema: A connection to the new DB, for creating schemas and |
170 | 170 | * other similar objects in the new DB. |
171 | 171 | * - create-tables: A connection with a role suitable for creating tables. |
172 | 172 | * |
173 | | - * @return A Status object. On success, a connection object will be in the |
| 173 | + * @return A Status object. On success, a connection object will be in the |
174 | 174 | * value member. |
175 | 175 | */ |
176 | 176 | protected function openPgConnection( $type ) { |
177 | 177 | switch ( $type ) { |
178 | 178 | case 'create-db': |
179 | 179 | return $this->openConnectionToAnyDB( |
180 | | - $this->getVar( '_InstallUser' ), |
| 180 | + $this->getVar( '_InstallUser' ), |
181 | 181 | $this->getVar( '_InstallPassword' ) ); |
182 | 182 | case 'create-schema': |
183 | | - return $this->openConnectionWithParams( |
| 183 | + return $this->openConnectionWithParams( |
184 | 184 | $this->getVar( '_InstallUser' ), |
185 | 185 | $this->getVar( '_InstallPassword' ), |
186 | 186 | $this->getVar( 'wgDBname' ) ); |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | $conn = $status->value; |
238 | 238 | $superuser = $this->getVar( '_InstallUser' ); |
239 | 239 | |
240 | | - $row = $conn->selectRow( '"pg_catalog"."pg_roles"', '*', |
| 240 | + $row = $conn->selectRow( '"pg_catalog"."pg_roles"', '*', |
241 | 241 | array( 'rolname' => $superuser ), __METHOD__ ); |
242 | 242 | return $row; |
243 | 243 | } |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | if ( !$perms ) { |
256 | 256 | return false; |
257 | 257 | } |
258 | | - return $perms->rolsuper === 't'; |
| 258 | + return $perms->rolsuper === 't'; |
259 | 259 | } |
260 | 260 | |
261 | 261 | public function getSettingsForm() { |
— | — | @@ -311,15 +311,15 @@ |
312 | 312 | } |
313 | 313 | |
314 | 314 | // Existing web account. Test the connection. |
315 | | - $status = $this->openConnectionToAnyDB( |
| 315 | + $status = $this->openConnectionToAnyDB( |
316 | 316 | $this->getVar( 'wgDBuser' ), |
317 | 317 | $this->getVar( 'wgDBpassword' ) ); |
318 | 318 | if ( !$status->isOK() ) { |
319 | 319 | return $status; |
320 | 320 | } |
321 | 321 | |
322 | | - // The web user is conventionally the table owner in PostgreSQL |
323 | | - // installations. Make sure the install user is able to create |
| 322 | + // The web user is conventionally the table owner in PostgreSQL |
| 323 | + // installations. Make sure the install user is able to create |
324 | 324 | // objects on behalf of the web user. |
325 | 325 | if ( $same || $this->canCreateObjectsForWebUser() ) { |
326 | 326 | return Status::newGood(); |
— | — | @@ -444,14 +444,14 @@ |
445 | 445 | try { |
446 | 446 | $conn->query( "CREATE SCHEMA $safeschema AUTHORIZATION $safeuser" ); |
447 | 447 | } catch ( DBQueryError $e ) { |
448 | | - return Status::newFatal( 'config-install-pg-schema-failed', |
| 448 | + return Status::newFatal( 'config-install-pg-schema-failed', |
449 | 449 | $this->getVar( '_InstallUser' ), $schema ); |
450 | 450 | } |
451 | 451 | } |
452 | 452 | |
453 | 453 | // If we created a user, alter it now to search the new schema by default |
454 | 454 | if ( $this->getVar( '_CreateDBAccount' ) ) { |
455 | | - $conn->query( "ALTER ROLE $safeuser SET search_path = $safeschema, public", |
| 455 | + $conn->query( "ALTER ROLE $safeuser SET search_path = $safeschema, public", |
456 | 456 | __METHOD__ ); |
457 | 457 | } |
458 | 458 | |
— | — | @@ -487,8 +487,8 @@ |
488 | 488 | // Create the user |
489 | 489 | try { |
490 | 490 | $sql = "CREATE ROLE $safeuser NOCREATEDB LOGIN PASSWORD $safepass"; |
491 | | - |
492 | | - // If the install user is not a superuser, we need to make the install |
| 491 | + |
| 492 | + // If the install user is not a superuser, we need to make the install |
493 | 493 | // user a member of the new user's group, so that the install user will |
494 | 494 | // be able to create a schema and other objects on behalf of the new user. |
495 | 495 | if ( !$this->isSuperUser() ) { |
— | — | @@ -497,7 +497,7 @@ |
498 | 498 | |
499 | 499 | $conn->query( $sql, __METHOD__ ); |
500 | 500 | } catch ( DBQueryError $e ) { |
501 | | - return Status::newFatal( 'config-install-user-create-failed', |
| 501 | + return Status::newFatal( 'config-install-user-create-failed', |
502 | 502 | $this->getVar( 'wgDBuser' ), $e->getMessage() ); |
503 | 503 | } |
504 | 504 | } |
— | — | @@ -559,7 +559,7 @@ |
560 | 560 | } |
561 | 561 | |
562 | 562 | public function setupPLpgSQL() { |
563 | | - // Connect as the install user, since it owns the database and so is |
| 563 | + // Connect as the install user, since it owns the database and so is |
564 | 564 | // the user that needs to run "CREATE LANGAUGE" |
565 | 565 | $status = $this->getPgConnection( 'create-schema' ); |
566 | 566 | if ( !$status->isOK() ) { |
— | — | @@ -574,7 +574,7 @@ |
575 | 575 | return Status::newGood(); |
576 | 576 | } |
577 | 577 | |
578 | | - // plpgsql is not installed, but if we have a pg_pltemplate table, we |
| 578 | + // plpgsql is not installed, but if we have a pg_pltemplate table, we |
579 | 579 | // should be able to create it |
580 | 580 | $exists = $conn->selectField( |
581 | 581 | array( '"pg_catalog"."pg_class"', '"pg_catalog"."pg_namespace"' ), |
Index: trunk/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -766,7 +766,7 @@ |
767 | 767 | |
768 | 768 | // Validate e-mail if provided |
769 | 769 | $email = $this->getVar( '_AdminEmail' ); |
770 | | - if( $email && !User::isValidEmailAddr( $email ) ) { |
| 770 | + if( $email && !Sanitizer::validateEmail( $email ) ) { |
771 | 771 | $this->parent->showError( 'config-admin-error-bademail' ); |
772 | 772 | $retVal = false; |
773 | 773 | } |
Index: trunk/phase3/includes/media/Generic.php |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | * MediaHanlder::METADATA_COMPATIBLE if metadata is old but backwards |
163 | 163 | * compatible (which may or may not trigger a metadata reload). |
164 | 164 | */ |
165 | | - function isMetadataValid( $image, $metadata ) { |
| 165 | + function isMetadataValid( $image, $metadata ) { |
166 | 166 | return self::METADATA_GOOD; |
167 | 167 | } |
168 | 168 | |
— | — | @@ -210,14 +210,14 @@ |
211 | 211 | function getThumbType( $ext, $mime, $params = null ) { |
212 | 212 | $magic = MimeMagic::singleton(); |
213 | 213 | if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) { |
214 | | - // The extension is not valid for this mime type and we do |
| 214 | + // The extension is not valid for this mime type and we do |
215 | 215 | // recognize the mime type |
216 | 216 | $extensions = $magic->getExtensionsForType( $mime ); |
217 | 217 | if ( $extensions ) { |
218 | 218 | return array( strtok( $extensions, ' ' ), $mime ); |
219 | 219 | } |
220 | 220 | } |
221 | | - |
| 221 | + |
222 | 222 | // The extension is correct (true) or the mime type is unknown to |
223 | 223 | // MediaWiki (null) |
224 | 224 | return array( $ext, $mime ); |
— | — | @@ -357,12 +357,12 @@ |
358 | 358 | /** |
359 | 359 | * This is used to generate an array element for each metadata value |
360 | 360 | * That array is then used to generate the table of metadata values |
361 | | - * on the image page |
| 361 | + * on the image page |
362 | 362 | * |
363 | 363 | * @param &$array Array An array containing elements for each type of visibility |
364 | 364 | * and each of those elements being an array of metadata items. This function adds |
365 | 365 | * a value to that array. |
366 | | - * @param $visibility string ('visible' or 'collapsed') if this value is hidden |
| 366 | + * @param $visbility string ('visible' or 'collapsed') if this value is hidden |
367 | 367 | * by default. |
368 | 368 | * @param $type String type of metadata tag (currently always 'exif') |
369 | 369 | * @param $id String the name of the metadata tag (like 'artist' for example). |
— | — | @@ -381,7 +381,7 @@ |
382 | 382 | $msgName = "$type-$id"; |
383 | 383 | if ( wfEmptyMsg( $msgName ) ) { |
384 | 384 | // This is for future compatibility when using instant commons. |
385 | | - // So as to not display as ugly a name if a new metadata |
| 385 | + // So as to not display as ugly a name if a new metadata |
386 | 386 | // property is defined that we don't know about |
387 | 387 | // (not a major issue since such a property would be collapsed |
388 | 388 | // by default). |
— | — | @@ -455,10 +455,10 @@ |
456 | 456 | /** |
457 | 457 | * File validation hook called on upload. |
458 | 458 | * |
459 | | - * If the file at the given local path is not valid, or its MIME type does not |
| 459 | + * If the file at the given local path is not valid, or its MIME type does not |
460 | 460 | * match the handler class, a Status object should be returned containing |
461 | 461 | * relevant errors. |
462 | | - * |
| 462 | + * |
463 | 463 | * @param $fileName The local path to the file. |
464 | 464 | * @return Status object |
465 | 465 | */ |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -206,7 +206,7 @@ |
207 | 207 | } |
208 | 208 | |
209 | 209 | # Send out an email authentication message if needed |
210 | | - if( $wgEmailAuthentication && User::isValidEmailAddr( $u->getEmail() ) ) { |
| 210 | + if( $wgEmailAuthentication && Sanitizer::validateEmail( $u->getEmail() ) ) { |
211 | 211 | $status = $u->sendConfirmationMail(); |
212 | 212 | if( $status->isGood() ) { |
213 | 213 | $wgOut->addWikiMsg( 'confirmemail_oncreate' ); |
— | — | @@ -355,7 +355,7 @@ |
356 | 356 | return false; |
357 | 357 | } |
358 | 358 | |
359 | | - if( !empty( $this->mEmail ) && !User::isValidEmailAddr( $this->mEmail ) ) { |
| 359 | + if( !empty( $this->mEmail ) && !Sanitizer::validateEmail( $this->mEmail ) ) { |
360 | 360 | $this->mainLoginForm( wfMsg( 'invalidemailaddress' ) ); |
361 | 361 | return false; |
362 | 362 | } |
— | — | @@ -814,12 +814,12 @@ |
815 | 815 | # Run any hooks; display injected HTML |
816 | 816 | $injected_html = ''; |
817 | 817 | $welcome_creation_msg = 'welcomecreation'; |
818 | | - |
| 818 | + |
819 | 819 | wfRunHooks( 'UserLoginComplete', array( &$wgUser, &$injected_html ) ); |
820 | | - |
| 820 | + |
821 | 821 | //let any extensions change what message is shown |
822 | 822 | wfRunHooks( 'BeforeWelcomeCreation', array( &$welcome_creation_msg, &$injected_html ) ); |
823 | | - |
| 823 | + |
824 | 824 | $this->displaySuccessfulLogin( $welcome_creation_msg, $injected_html ); |
825 | 825 | } |
826 | 826 | |
— | — | @@ -833,7 +833,7 @@ |
834 | 834 | if( $msgname ){ |
835 | 835 | $wgOut->addWikiMsg( $msgname, wfEscapeWikiText( $wgUser->getName() ) ); |
836 | 836 | } |
837 | | - |
| 837 | + |
838 | 838 | $wgOut->addHTML( $injected_html ); |
839 | 839 | |
840 | 840 | if ( !empty( $this->mReturnTo ) ) { |
— | — | @@ -874,7 +874,7 @@ |
875 | 875 | $block_reason, |
876 | 876 | $block->getBlocker()->getName() |
877 | 877 | ); |
878 | | - |
| 878 | + |
879 | 879 | $wgOut->returnToMain( false ); |
880 | 880 | } |
881 | 881 | |
Index: trunk/phase3/includes/specials/SpecialConfirmemail.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | |
56 | 56 | if( empty( $code ) ) { |
57 | 57 | if( $wgUser->isLoggedIn() ) { |
58 | | - if( User::isValidEmailAddr( $wgUser->getEmail() ) ) { |
| 58 | + if( Sanitizer::validateEmail( $wgUser->getEmail() ) ) { |
59 | 59 | $this->showRequestForm(); |
60 | 60 | } else { |
61 | 61 | $wgOut->addWikiMsg( 'confirmemail_noemail' ); |
Index: trunk/phase3/includes/Autopromote.php |
— | — | @@ -29,9 +29,9 @@ |
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Get the groups for the given user based on the given criteria. |
33 | | - * |
| 33 | + * |
34 | 34 | * Does not return groups the user already belongs to or has once belonged. |
35 | | - * |
| 35 | + * |
36 | 36 | * @param $user The user to get the groups for |
37 | 37 | * @param $event String key in $wgAutopromoteOnce (each one has groups/criteria) |
38 | 38 | * |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | |
155 | 155 | switch( $cond[0] ) { |
156 | 156 | case APCOND_EMAILCONFIRMED: |
157 | | - if ( User::isValidEmailAddr( $user->getEmail() ) ) { |
| 157 | + if ( Sanitizer::validateEmail( $user->getEmail() ) ) { |
158 | 158 | if ( $wgEmailAuthentication ) { |
159 | 159 | return (bool)$user->getEmailAuthenticationTimestamp(); |
160 | 160 | } else { |