Fix validity and correctness of r63342
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 9 Mar 2010 19:47:05 +0000 (19:47 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 9 Mar 2010 19:47:05 +0000 (19:47 +0000)
The name attribute may only be used on <a> if an id attribute with
identical value is given on the same element.  I moved the id to the tr
so it leaves a bit of space at the top, rather than using a name
attribute at all.  Also, we need to call Sanitizer::escapeId() on the
group key, lest people use spaces or something in the group key (not
advisable, but possible).

includes/specials/SpecialListgrouprights.php

index 9aff7fd..e66a195 100644 (file)
@@ -63,8 +63,7 @@ class SpecialListGroupRights extends SpecialPage {
                        } else {
                                $grouppage = $this->skin->link(
                                        Title::newFromText( $grouppageLocalized ),
-                                       htmlspecialchars($groupnameLocalized),
-                                       array( 'name' => $group )
+                                       htmlspecialchars($groupnameLocalized)
                                );
                        }
 
@@ -96,16 +95,17 @@ class SpecialListGroupRights extends SpecialPage {
                        $addgroupsSelf = isset( $wgGroupsAddToSelf[$group] ) ? $wgGroupsAddToSelf[$group] : array();
                        $removegroupsSelf = isset( $wgGroupsRemoveFromSelf[$group] ) ? $wgGroupsRemoveFromSelf[$group] : array();
 
-                       $wgOut->addHTML(
-                               '<tr>
-                                       <td>' .
+                       $id = $group == '*' ? false : Sanitizer::escapeId( $group );
+                       $wgOut->addHTML( Html::rawElement( 'tr', array( 'id' => $id ),
+                               '
+                               <td>' .
                                                $grouppage . $grouplink .
                                        '</td>
                                        <td>' .
                                                self::formatPermissions( $permissions, $revoke, $addgroups, $removegroups, $addgroupsSelf, $removegroupsSelf ) .
                                        '</td>
-                               </tr>'
-                       );
+                               '
+                       ) );
                }
                $wgOut->addHTML(
                        Xml::closeElement( 'table' ) . "\n<br /><hr />\n"