Bug 23699: Add trailing \n at the end of <div>s in wrapWikiMsg()
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
index 5cda361..9b480bb 100644 (file)
@@ -17,7 +17,9 @@ function wfSpecialMovepage( $par = null ) {
        }
 
        $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
-       $oldTitleText = $wgRequest->getText( 'wpOldTitle', $target );
+
+       // Yes, the use of getVal() and getText() is wanted, see bug 20365
+       $oldTitleText = $wgRequest->getVal( 'wpOldTitle', $target );
        $newTitleText = $wgRequest->getText( 'wpNewTitle' );
 
        $oldTitle = Title::newFromText( $oldTitleText );
@@ -54,61 +56,70 @@ function wfSpecialMovepage( $par = null ) {
  * @ingroup SpecialPage
  */
 class MovePageForm {
-       var $oldTitle, $newTitle, $reason; # Text input
-       var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects;
+       var $oldTitle, $newTitle; # Objects
+       var $reason; # Text input
+       var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects, $leaveRedirect, $moveOverShared; # Checks
 
        private $watch = false;
 
-       function MovePageForm( $oldTitle, $newTitle ) {
-               global $wgRequest;
+       function __construct( $oldTitle, $newTitle ) {
+               global $wgRequest, $wgUser;
                $target = isset($par) ? $par : $wgRequest->getVal( 'target' );
                $this->oldTitle = $oldTitle;
                $this->newTitle = $newTitle;
                $this->reason = $wgRequest->getText( 'wpReason' );
                if ( $wgRequest->wasPosted() ) {
                        $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', false );
+                       $this->fixRedirects = $wgRequest->getBool( 'wpFixRedirects', false );
+                       $this->leaveRedirect = $wgRequest->getBool( 'wpLeaveRedirect', false );
                } else {
                        $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
+                       $this->fixRedirects = $wgRequest->getBool( 'wpFixRedirects', true );
+                       $this->leaveRedirect = $wgRequest->getBool( 'wpLeaveRedirect', true );
                }
                $this->moveSubpages = $wgRequest->getBool( 'wpMovesubpages', false );
                $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' );
-               $this->fixRedirects = $wgRequest->getBool( 'wpFixRedirects', true );
-               $this->watch = $wgRequest->getCheck( 'wpWatch' );
+               $this->moveOverShared = $wgRequest->getBool( 'wpMoveOverSharedFile', false );
+               $this->watch = $wgRequest->getCheck( 'wpWatch' ) && $wgUser->isLoggedIn();
        }
 
-       function showForm( $err, $hookErr = '' ) {
-               global $wgOut, $wgUser;
+       /**
+        * Show the form
+        * @param mixed $err Error message. May either be a string message name or 
+        *    array message name and parameters, like the second argument to 
+        *    OutputPage::wrapWikiMsg(). 
+        */
+       function showForm( $err ) {
+               global $wgOut, $wgUser, $wgContLang, $wgFixDoubleRedirects;
 
                $skin = $wgUser->getSkin();
 
-               $oldTitleLink = $skin->makeLinkObj( $this->oldTitle );
-               $oldTitle = $this->oldTitle->getPrefixedText();
+               $oldTitleLink = $skin->link( $this->oldTitle );
 
-               $wgOut->setPagetitle( wfMsg( 'move-page', $oldTitle ) );
+               $wgOut->setPagetitle( wfMsg( 'move-page', $this->oldTitle->getPrefixedText() ) );
                $wgOut->setSubtitle( wfMsg( 'move-page-backlink', $oldTitleLink ) );
 
-               if( $this->newTitle == '' ) {
+               $newTitle = $this->newTitle;
+
+               if( !$newTitle ) {
                        # Show the current title as a default
                        # when the form is first opened.
-                       $newTitle = $oldTitle;
-               } else {
-                       if( $err == '' ) {
-                               $nt = Title::newFromURL( $this->newTitle );
-                               if( $nt ) {
-                                       # If a title was supplied, probably from the move log revert
-                                       # link, check for validity. We can then show some diagnostic
-                                       # information and save a click.
-                                       $newerr = $this->oldTitle->isValidMoveOperation( $nt );
-                                       if( is_string( $newerr ) ) {
-                                               $err = $newerr;
-                                       }
+                       $newTitle = $this->oldTitle;
+               }
+               else {
+                       if( empty($err) ) {
+                               # If a title was supplied, probably from the move log revert
+                               # link, check for validity. We can then show some diagnostic
+                               # information and save a click.
+                               $newerr = $this->oldTitle->isValidMoveOperation( $newTitle );
+                               if( $newerr ) {
+                                       $err = $newerr[0];
                                }
                        }
-                       $newTitle = $this->newTitle;
                }
 
-               if ( $err == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) {
-                       $wgOut->addWikiMsg( 'delete_and_move_text', $newTitle );
+               if ( !empty($err) && $err[0] == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) {
+                       $wgOut->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
                        $movepagebtn = wfMsg( 'delete_and_move' );
                        $submitVar = 'wpDeleteAndMove';
                        $confirm = "
@@ -120,22 +131,35 @@ class MovePageForm {
                                </tr>";
                        $err = '';
                } else {
+                       if ($this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
+                               $wgOut->wrapWikiMsg( "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>", 'moveuserpage-warning' );
+                       }
                        $wgOut->addWikiMsg( 'movepagetext' );
                        $movepagebtn = wfMsg( 'movepagebtn' );
                        $submitVar = 'wpMove';
                        $confirm = false;
                }
 
+               if ( !empty($err) && $err[0] == 'file-exists-sharedrepo' && $wgUser->isAllowed( 'reupload-shared' ) ) {
+                       $wgOut->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
+                       $submitVar = 'wpMoveOverSharedFile';
+                       $err = '';
+               }
+               
                $oldTalk = $this->oldTitle->getTalkPage();
                $considerTalk = ( !$this->oldTitle->isTalkPage() && $oldTalk->exists() );
 
                $dbr = wfGetDB( DB_SLAVE );
-               $hasRedirects = $dbr->selectField( 'redirect', '1', 
-                       array( 
-                               'rd_namespace' => $this->oldTitle->getNamespace(),
-                               'rd_title' => $this->oldTitle->getDBkey(),
-                       ) , __METHOD__ );
-               
+               if ( $wgFixDoubleRedirects ) {
+                       $hasRedirects = $dbr->selectField( 'redirect', '1', 
+                               array( 
+                                       'rd_namespace' => $this->oldTitle->getNamespace(),
+                                       'rd_title' => $this->oldTitle->getDBkey(),
+                               ) , __METHOD__ );
+               } else {
+                       $hasRedirects = false;
+               }
+
                if ( $considerTalk ) {
                        $wgOut->addWikiMsg( 'movepagetalktext' );
                }
@@ -143,16 +167,33 @@ class MovePageForm {
                $titleObj = SpecialPage::getTitleFor( 'Movepage' );
                $token = htmlspecialchars( $wgUser->editToken() );
 
-               if ( $err != '' ) {
+               if ( !empty($err) ) {
                        $wgOut->setSubtitle( wfMsg( 'formerror' ) );
-                       if( $err == 'hookaborted' ) {
+                       if( $err[0] == 'hookaborted' ) {
+                               $hookErr = $err[1];
                                $errMsg = "<p><strong class=\"error\">$hookErr</strong></p>\n";
                                $wgOut->addHTML( $errMsg );
                        } else {
-                               $wgOut->wrapWikiMsg( '<p><strong class="error">$1</strong></p>', $err );
+                               $wgOut->wrapWikiMsg( "<p><strong class=\"error\">\n$1\n</strong></p>", $err );
                        }
                }
 
+               if ( $this->oldTitle->isProtected( 'move' ) ) {
+                       # Is the title semi-protected?
+                       if ( $this->oldTitle->isSemiProtected( 'move' ) ) {
+                               $noticeMsg = 'semiprotectedpagemovewarning';
+                               $classes[] = 'mw-textarea-sprotected';
+                       } else {
+                               # Then it must be protected based on static groups (regular)
+                               $noticeMsg = 'protectedpagemovewarning';
+                               $classes[] = 'mw-textarea-protected';
+                       }
+                       $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
+                       $wgOut->addWikiMsg( $noticeMsg );
+                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) );
+                       $wgOut->addHTML( "</div>\n" );
+               }
+
                $wgOut->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
@@ -171,8 +212,8 @@ class MovePageForm {
                                        Xml::label( wfMsg( 'newtitle' ), 'wpNewTitle' ) .
                                "</td>
                                <td class='mw-input'>" .
-                                       Xml::input( 'wpNewTitle', 40, $newTitle, array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) .
-                                       Xml::hidden( 'wpOldTitle', $oldTitle ) .
+                                       Xml::input( 'wpNewTitle', 40, $wgContLang->recodeForEdit( $newTitle->getPrefixedText() ), array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) .
+                                       Xml::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) .
                                "</td>
                        </tr>
                        <tr>
@@ -180,7 +221,8 @@ class MovePageForm {
                                        Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
                                "</td>
                                <td class='mw-input'>" .
-                                       Xml::tags( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2 ), htmlspecialchars( $this->reason ) ) .
+                                       Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
+                                       'maxlength' => 200 ), $this->reason ) .
                                "</td>
                        </tr>"
                );
@@ -196,6 +238,18 @@ class MovePageForm {
                        );
                }
 
+               if ( $wgUser->isAllowed( 'suppressredirect' ) ) {
+                       $wgOut->addHTML( "
+                               <tr>
+                                       <td></td>
+                                       <td class='mw-input' >" .
+                                               Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect', 
+                                                       'wpLeaveRedirect', $this->leaveRedirect ) .
+                                       "</td>
+                               </tr>"
+                       );
+               }
+
                if ( $hasRedirects ) {
                        $wgOut->addHTML( "
                                <tr>
@@ -204,40 +258,56 @@ class MovePageForm {
                                                Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects', 
                                                        'wpFixRedirects', $this->fixRedirects ) .
                                        "</td>
-                               </td>"
+                               </tr>"
                        );
                }
 
                if( ($this->oldTitle->hasSubpages() || $this->oldTitle->getTalkPage()->hasSubpages())
-               && $this->oldTitle->userCan( 'move-subpages' ) ) {
+                       && $this->oldTitle->userCan( 'move-subpages' ) )
+               {
+                       global $wgMaximumMovedPages, $wgLang;
+
                        $wgOut->addHTML( "
                                <tr>
                                        <td></td>
                                        <td class=\"mw-input\">" .
-                               Xml::checkLabel( wfMsgHtml(
-                                               $this->oldTitle->hasSubpages()
-                                               ? 'move-subpages'
-                                               : 'move-talk-subpages'
-                                       ),
-                                       'wpMovesubpages', 'wpMovesubpages',
+                               Xml::check(
+                                       'wpMovesubpages',
                                        # Don't check the box if we only have talk subpages to
                                        # move and we aren't moving the talk page.
-                                       $this->moveSubpages && ($this->oldTitle->hasSubpages() || $this->moveTalk)
+                                       $this->moveSubpages && ($this->oldTitle->hasSubpages() || $this->moveTalk),
+                                       array( 'id' => 'wpMovesubpages' )
+                               ) . '&nbsp;' .
+                               Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ),
+                                       wfMsgExt(
+                                               ( $this->oldTitle->hasSubpages()
+                                                       ? 'move-subpages'
+                                                       : 'move-talk-subpages' ),
+                                               array( 'parseinline' ),
+                                               $wgLang->formatNum( $wgMaximumMovedPages ),
+                                               # $2 to allow use of PLURAL in message.
+                                               $wgMaximumMovedPages
+                                       )
                                ) .
                                        "</td>
                                </tr>"
                        );
                }
 
-               $watchChecked = $this->watch || $wgUser->getBoolOption( 'watchmoves' ) 
-                       || $this->oldTitle->userIsWatching();
-               $wgOut->addHTML( "
+               $watchChecked = $wgUser->isLoggedIn() && ($this->watch || $wgUser->getBoolOption( 'watchmoves' ) 
+                       || $this->oldTitle->userIsWatching());
+               # Don't allow watching if user is not logged in
+               if( $wgUser->isLoggedIn() ) {
+                       $wgOut->addHTML( "
                        <tr>
                                <td></td>
                                <td class='mw-input'>" .
                                        Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) .
                                "</td>
-                       </tr>
+                       </tr>");
+               }
+
+               $wgOut->addHTML( "      
                                {$confirm}
                        <tr>
                                <td>&nbsp;</td>
@@ -253,21 +323,19 @@ class MovePageForm {
                );
 
                $this->showLogFragment( $this->oldTitle, $wgOut );
+               $this->showSubpages( $this->oldTitle, $wgOut );
 
        }
 
        function doSubmit() {
                global $wgOut, $wgUser, $wgRequest, $wgMaximumMovedPages, $wgLang;
+               global $wgFixDoubleRedirects;
 
                if ( $wgUser->pingLimiter( 'move' ) ) {
                        $wgOut->rateLimited();
                        return;
                }
 
-               if( ! wfRunHooks( 'SpecialMovepageBeforeMove', array(&$this) ) ) {
-                       return;
-               }
-
                $ot = $this->oldTitle;
                $nt = $this->newTitle;
 
@@ -283,6 +351,12 @@ class MovePageForm {
                                return;
                        }
 
+                       // Delete an associated image if there is
+                       $file = wfLocalFile( $nt );
+                       if( $file->exists() ) {
+                               $file->delete( wfMsgForContent( 'delete_and_move_reason' ), false );
+                       }
+
                        // This may output an error message and exit
                        $article->doDelete( wfMsgForContent( 'delete_and_move_reason' ) );
                }
@@ -293,14 +367,32 @@ class MovePageForm {
                        return;
                }
 
-               $error = $ot->moveTo( $nt, true, $this->reason );
+               # Show a warning if the target file exists on a shared repo
+               if ( $nt->getNamespace() == NS_FILE 
+                       && !( $this->moveOverShared && $wgUser->isAllowed( 'reupload-shared' ) )
+                       && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt ) 
+                       && wfFindFile( $nt ) )
+               {
+                       $this->showForm( array('file-exists-sharedrepo') );
+                       return;
+                       
+               }
+               
+               if ( $wgUser->isAllowed( 'suppressredirect' ) ) {
+                       $createRedirect = $this->leaveRedirect;
+               } else {
+                       $createRedirect = true;
+               }
+
+               # Do the actual move.
+               $error = $ot->moveTo( $nt, true, $this->reason, $createRedirect );
                if ( $error !== true ) {
-                       # FIXME: showForm() should handle multiple errors
-                       call_user_func_array(array($this, 'showForm'), $error[0]);
+                       # FIXME: show all the errors in a list, not just the first one
+                       $this->showForm( reset( $error ) );
                        return;
                }
 
-               if ( $this->fixRedirects ) {
+               if ( $wgFixDoubleRedirects && $this->fixRedirects ) {
                        DoubleRedirectJob::fixRedirects( 'move', $ot, $nt );
                }
 
@@ -315,7 +407,9 @@ class MovePageForm {
                $oldLink = "<span class='plainlinks'>[$oldUrl $oldText]</span>";
                $newLink = "<span class='plainlinks'>[$newUrl $newText]</span>";
 
+               $msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect';
                $wgOut->addWikiMsg( 'movepage-moved', $oldLink, $newLink, $oldText, $newText );
+               $wgOut->addWikiMsg( $msgName );
 
                # Now we move extra pages we've been asked to move: subpages and talk
                # pages.  First, if the old page or the new page is a talk page, we
@@ -339,6 +433,8 @@ class MovePageForm {
                # would mean that you couldn't move them back in one operation, which
                # is bad.  FIXME: A specific error message should be given in this
                # case.
+               
+               // FIXME: Use Title::moveSubpages() here
                $dbr = wfGetDB( DB_MASTER );
                if( $this->moveSubpages && (
                        MWNamespace::hasSubpages( $nt->getNamespace() ) || (
@@ -347,7 +443,7 @@ class MovePageForm {
                        )
                ) ) {
                        $conds = array(
-                               'page_title LIKE '.$dbr->addQuotes( $dbr->escapeLike( $ot->getDBkey() ) . '/%' )
+                               'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
                                        .' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
                        );
                        $conds['page_namespace'] = array();
@@ -360,7 +456,7 @@ class MovePageForm {
                } elseif( $this->moveTalk ) {
                        $conds = array(
                                'page_namespace' => $ot->getTalkPage()->getNamespace(),
-                               'page_title' => $ot->getDBKey()
+                               'page_title' => $ot->getDBkey()
                        );
                } else {
                        # Skip the query
@@ -382,15 +478,15 @@ class MovePageForm {
                $skin = $wgUser->getSkin();
                $count = 1;
                foreach( $extraPages as $oldSubpage ) {
-                       if( $oldSubpage->getArticleId() == $ot->getArticleId() ) {
+                       if( $ot->equals( $oldSubpage ) ) {
                                # Already did this one.
                                continue;
                        }
 
                        $newPageName = preg_replace(
-                               '#^'.preg_quote( $ot->getDBKey(), '#' ).'#',
-                               $nt->getDBKey(),
-                               $oldSubpage->getDBKey()
+                               '#^'.preg_quote( $ot->getDBkey(), '#' ).'#',
+                               StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
+                               $oldSubpage->getDBkey()
                        );
                        if( $oldSubpage->isTalkPage() ) {
                                $newNs = $nt->getTalkPage()->getNamespace();
@@ -401,7 +497,7 @@ class MovePageForm {
                        # be longer than 255 characters.
                        $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
                        if( !$newSubpage ) {
-                               $oldLink = $skin->makeKnownLinkObj( $oldSubpage );
+                               $oldLink = $skin->linkKnown( $oldSubpage );
                                $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
                                        htmlspecialchars(Title::makeName( $newNs, $newPageName )));
                                continue;
@@ -409,29 +505,34 @@ class MovePageForm {
 
                        # This was copy-pasted from Renameuser, bleh.
                        if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
-                               $link = $skin->makeKnownLinkObj( $newSubpage );
+                               $link = $skin->linkKnown( $newSubpage );
                                $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
                        } else {
-                               $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason );
+                               $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
                                if( $success === true ) {
                                        if ( $this->fixRedirects ) {
                                                DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage );
                                        }
-                                       $oldLink = $skin->makeKnownLinkObj( $oldSubpage, '', 'redirect=no' );
-                                       $newLink = $skin->makeKnownLinkObj( $newSubpage );
+                                       $oldLink = $skin->linkKnown(
+                                               $oldSubpage,
+                                               null,
+                                               array(),
+                                               array( 'redirect' => 'no' )
+                                       );
+                                       $newLink = $skin->linkKnown( $newSubpage );
                                        $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
+                                       ++$count;
+                                       if( $count >= $wgMaximumMovedPages ) {
+                                               $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgMaximumMovedPages ) );
+                                               break;
+                                       }
                                } else {
-                                       $oldLink = $skin->makeKnownLinkObj( $oldSubpage );
-                                       $newLink = $skin->makeLinkObj( $newSubpage );
+                                       $oldLink = $skin->linkKnown( $oldSubpage );
+                                       $newLink = $skin->link( $newSubpage );
                                        $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
                                }
                        }
 
-                       ++$count;
-                       if( $count >= $wgMaximumMovedPages ) {
-                               $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgMaximumMovedPages ) );
-                               break;
-                       }
                }
 
                if( $extraOutput !== array() ) {
@@ -439,18 +540,53 @@ class MovePageForm {
                }
 
                # Deal with watches (we don't watch subpages)
-               if( $this->watch ) {
+               if( $this->watch && $wgUser->isLoggedIn() ) {
                        $wgUser->addWatch( $ot );
                        $wgUser->addWatch( $nt );
                } else {
                        $wgUser->removeWatch( $ot );
                        $wgUser->removeWatch( $nt );
                }
+               
+               # Re-clear the file redirect cache, which may have been polluted by 
+               # parsing in messages above. See CR r56745.
+               # FIXME: needs a more robust solution inside FileRepo.
+               if( $ot->getNamespace() == NS_FILE ) {
+                       RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $ot );
+               }
        }
 
        function showLogFragment( $title, &$out ) {
-               $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'move' ) ) );
+               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
                LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() );
        }
 
+       function showSubpages( $title, $out ) {
+               global $wgUser, $wgLang;
+
+               if( !MWNamespace::hasSubpages( $title->getNamespace() ) )
+                       return;
+
+               $subpages = $title->getSubpages();
+               $count = $subpages instanceof TitleArray ? $subpages->count() : 0;
+
+               $out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
+
+               # No subpages.
+               if ( $count == 0 ) {
+                       $out->addWikiMsg( 'movenosubpage' );
+                       return;
+               }
+
+               $out->addWikiMsg( 'movesubpagetext', $wgLang->formatNum( $count ) );
+               $skin = $wgUser->getSkin();
+               $out->addHTML( "<ul>\n" );
+
+               foreach( $subpages as $subpage ) {
+                       $link = $skin->link( $subpage );
+                       $out->addHTML( "<li>$link</li>\n" );
+               }
+               $out->addHTML( "</ul>\n" );
+       }
 }
+