- $npages = 40000 * $days;
- }
-
- /* Edit watchlist form */
- if($wgRequest->getBool('edit') || $par == 'edit' ) {
- $wgOut->addWikiText( wfMsg( 'watchlistcontains', $wgLang->formatNum( $nitems ) ) .
- "\n\n" . wfMsg( 'watcheditlist' ) );
-
- $wgOut->addHTML( '<form action=\'' .
- $specialTitle->escapeLocalUrl( 'action=submit' ) .
- "' method='post'>\n" );
-
-# Patch A2
-# The following was proposed by KTurner 07.11.2004 to T.Gries
-# $sql = "SELECT distinct (wl_namespace & ~1),wl_title FROM $watchlist WHERE wl_user=$uid";
- $sql = "SELECT wl_namespace, wl_title, page_is_redirect FROM $watchlist LEFT JOIN $page ON wl_namespace = page_namespace AND wl_title = page_title WHERE wl_user=$uid";
-
- $res = $dbr->query( $sql, $fname );
-
- # Batch existence check
- $linkBatch = new LinkBatch();
- while( $row = $dbr->fetchObject( $res ) )
- $linkBatch->addObj( Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ) );
- $linkBatch->execute();
-
- if( $dbr->numRows( $res ) > 0 )
- $dbr->dataSeek( $res, 0 ); # Let's do the time warp again!
-
- $sk = $wgUser->getSkin();
-
- $list = array();
- while( $s = $dbr->fetchObject( $res ) ) {
- $list[$s->wl_namespace][$s->wl_title] = $s->page_is_redirect;
- }
-
- // TODO: Display a TOC
- foreach($list as $ns => $titles) {
- if (Namespace::isTalk($ns))
- continue;
- if ($ns != NS_MAIN)
- $wgOut->addHTML( '<h2>' . $wgContLang->getFormattedNsText( $ns ) . '</h2>' );
- $wgOut->addHTML( '<ul>' );
- foreach( $titles as $title => $redir ) {
- $titleObj = Title::makeTitle( $ns, $title );
- if( is_null( $titleObj ) ) {
- $wgOut->addHTML(
- '<!-- bad title "' .
- htmlspecialchars( $s->wl_title ) . '" in namespace ' . $s->wl_namespace . " -->\n"
- );
- } else {
- global $wgContLang;
- $toolLinks = array();
- $pageLink = $sk->makeLinkObj( $titleObj );
- $toolLinks[] = $sk->makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
- if( $titleObj->exists() )
- $toolLinks[] = $sk->makeKnownLinkObj( $titleObj, wfMsgHtml( 'history_short' ), 'action=history' );
- $toolLinks = '(' . implode( ' | ', $toolLinks ) . ')';
- $checkbox = '<input type="checkbox" name="id[]" value="' . htmlspecialchars( $titleObj->getPrefixedText() ) . '" /> ' . ( $wgContLang->isRTL() ? '‏' : '‎' );
- if( $redir ) {
- $spanopen = '<span class="watchlistredir">';
- $spanclosed = '</span>';
- } else {
- $spanopen = $spanclosed = '';
- }
-
- $wgOut->addHTML( "<li>{$checkbox}{$spanopen}{$pageLink}{$spanclosed} {$toolLinks}</li>\n" );
- }
- }
- $wgOut->addHTML( '</ul>' );
- }
- $wgOut->addHTML(
- wfSubmitButton( wfMsg('removechecked'), array('name' => 'remove') ) .
- "\n</form>\n"
- );
-
- return;