From 8f416baead93a48e5799e44b8bd2e2c4859f4e04 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 14 Sep 2007 13:18:58 +0200 Subject: auf Version 1.11 aktualisiert; Login-Bug behoben --- includes/SpecialWatchlist.php | 194 ++++++------------------------------------ 1 file changed, 24 insertions(+), 170 deletions(-) (limited to 'includes/SpecialWatchlist.php') diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index 2e660bd5..e9aa7e68 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -15,7 +15,7 @@ require_once( dirname(__FILE__) . '/SpecialRecentchanges.php' ); * @param $par Parameter passed to the page */ function wfSpecialWatchlist( $par ) { - global $wgUser, $wgOut, $wgLang, $wgRequest, $wgContLang; + global $wgUser, $wgOut, $wgLang, $wgRequest; global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker; global $wgEnotifWatchlist; $fname = 'wfSpecialWatchlist'; @@ -30,12 +30,24 @@ function wfSpecialWatchlist( $par ) { $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() ); $wgOut->addHtml( wfMsgWikiHtml( 'watchlistanontext', $llink ) ); return; - } else { - $wgOut->setPageTitle( wfMsg( 'watchlist' ) ); - $wgOut->setSubtitle( wfMsgWikiHtml( 'watchlistfor', htmlspecialchars( $wgUser->getName() ) ) ); } + + $wgOut->setPageTitle( wfMsg( 'watchlist' ) ); + + $sub = wfMsgExt( 'watchlistfor', 'parseinline', $wgUser->getName() ); + $sub .= '
' . WatchlistEditor::buildTools( $wgUser->getSkin() ); + $wgOut->setSubtitle( $sub ); - if( wlHandleClear( $wgOut, $wgRequest, $par ) ) { + if( ( $mode = WatchlistEditor::getMode( $wgRequest, $par ) ) !== false ) { + $editor = new WatchlistEditor(); + $editor->execute( $wgUser, $wgOut, $wgRequest, $mode ); + return; + } + + $uid = $wgUser->getId(); + if( $wgEnotifWatchlist && $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) { + $wgUser->clearAllNotifications( $uid ); + $wgOut->redirect( $specialTitle->getFullUrl() ); return; } @@ -72,37 +84,6 @@ function wfSpecialWatchlist( $par ) { $nameSpaceClause = ''; } - # Watchlist editing - $action = $wgRequest->getVal( 'action' ); - $remove = $wgRequest->getVal( 'remove' ); - $id = $wgRequest->getArray( 'id' ); - - $uid = $wgUser->getID(); - if( $wgEnotifWatchlist && $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) { - $wgUser->clearAllNotifications( $uid ); - } - - # Deleting items from watchlist - if(($action == 'submit') && isset($remove) && is_array($id)) { - $wgOut->addWikiText( wfMsg( 'removingchecked' ) ); - $wgOut->addHTML( "\n

" . wfMsg( 'wldone' ) . "

\n" ); - } - $dbr = wfGetDB( DB_SLAVE, 'watchlist' ); list( $page, $watchlist, $recentchanges ) = $dbr->tableNamesN( 'page', 'watchlist', 'recentchanges' ); @@ -143,7 +124,6 @@ function wfSpecialWatchlist( $par ) { if ( $days <= 0 ) { $andcutoff = ''; - $npages = wfMsg( 'watchlistall1' ); } else { $andcutoff = "AND rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'"; /* @@ -152,82 +132,6 @@ function wfSpecialWatchlist( $par ) { $s = $dbr->fetchObject( $res ); $npages = $s->n; */ - $npages = 40000 * $days; - } - - /* Edit watchlist form */ - if($wgRequest->getBool('edit') || $par == 'edit' ) { - $wgOut->addWikiText( wfMsgExt( 'watchlistcontains', array( 'parseinline' ), $wgLang->formatNum( $nitems ) ) . - "\n\n" . wfMsg( 'watcheditlist' ) ); - - $wgOut->addHTML( '
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( '

' . $wgContLang->getFormattedNsText( $ns ) . '

' ); - $wgOut->addHTML( '' ); - } - $wgOut->addHTML( - wfSubmitButton( wfMsg('removechecked'), array('name' => 'remove') ) . - "\n
\n" - ); - - return; } # If the watchlist is relatively short, it's simplest to zip @@ -257,17 +161,17 @@ function wfSpecialWatchlist( $par ) { $andLatest=''; $limitWatchlist = 'LIMIT ' . intval( $wgUser->getOption( 'wllimit' ) ); } else { - # Top log Ids for a page are not stored - $andLatest= 'AND (rc_this_oldid=page_latest OR rc_type=' . RC_LOG . ') '; + $andLatest= 'AND rc_this_oldid=page_latest'; $limitWatchlist = ''; } - # TODO: Consider removing the third parameter - $header .= wfMsgExt( 'watchdetails', array( 'parsemag' ), $wgLang->formatNum( $nitems ), - $wgLang->formatNum( $npages ), '', - $specialTitle->getFullUrl( 'edit=yes' ) ); + $header .= wfMsgExt( 'watchlist-details', array( 'parsemag' ), $wgLang->formatNum( $nitems ) ); $wgOut->addWikiText( $header ); + # Show a message about slave lag, if applicable + if( ( $lag = $dbr->getLag() ) > 0 ) + $wgOut->showLagWarning( $lag ); + if ( $wgEnotifWatchlist && $wgShowUpdatedMarker ) { $wgOut->addHTML( '