Moved globals $utfCombiningClass, $utfCanonicalComp, $utfCanonicalDecomp, $utfCheckNF...
[lhc/web/wiklou.git] / includes / WatchlistEditor.php
index 9744aab..638b47a 100644 (file)
@@ -205,7 +205,7 @@ class WatchlistEditor {
                $dbr = wfGetDB( DB_MASTER );
                $uid = intval( $user->getId() );
                list( $watchlist, $page ) = $dbr->tableNamesN( 'watchlist', 'page' );
-               $sql = "SELECT wl_namespace, wl_title, page_id, page_len, page_is_redirect
+               $sql = "SELECT wl_namespace, wl_title, page_id, page_len, page_is_redirect, page_latest
                        FROM {$watchlist} LEFT JOIN {$page} ON ( wl_namespace = page_namespace
                        AND wl_title = page_title ) WHERE wl_user = {$uid}";
                $res = $dbr->query( $sql, __METHOD__ );
@@ -216,7 +216,7 @@ class WatchlistEditor {
                                if( $title instanceof Title ) {
                                        // Update the link cache while we're at it
                                        if( $row->page_id ) {
-                                               $cache->addGoodLinkObj( $row->page_id, $title, $row->page_len, $row->page_is_redirect );
+                                               $cache->addGoodLinkObj( $row->page_id, $title, $row->page_len, $row->page_is_redirect, $row->page_latest );
                                        } else {
                                                $cache->addBadLinkObj( $title );
                                        }
@@ -340,7 +340,7 @@ class WatchlistEditor {
                if( ( $count = $this->showItemCount( $output, $user ) ) > 0 ) {
                        $self = SpecialPage::getTitleFor( 'Watchlist' );
                        $form  = Xml::openElement( 'form', array( 'method' => 'post',
-                               'action' => $self->getLocalUrl( 'action=edit' ) ) );
+                               'action' => $self->getLocalUrl( array( 'action' => 'edit' ) ) ) );
                        $form .= Xml::hidden( 'token', $wgUser->editToken( 'watchlistedit' ) );
                        $form .= "<fieldset>\n<legend>" . wfMsgHtml( 'watchlistedit-normal-legend' ) . "</legend>";
                        $form .= wfMsgExt( 'watchlistedit-normal-explain', 'parse' );
@@ -414,15 +414,30 @@ class WatchlistEditor {
                        $link = '<span class="watchlistredir">' . $link . '</span>';
                $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) );
                if( $title->exists() ) {
-                       $tools[] = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'history_short' ), 'action=history' );
+                       $tools[] = $skin->link(
+                               $title,
+                               wfMsgHtml( 'history_short' ),
+                               array(),
+                               array( 'action' => 'history' ),
+                               array( 'known', 'noclasses' )
+                       );
                }
                if( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
-                       $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getText() ), wfMsgHtml( 'contributions' ) );
+                       $tools[] = $skin->link(
+                               SpecialPage::getTitleFor( 'Contributions', $title->getText() ),
+                               wfMsgHtml( 'contributions' ),
+                               array(),
+                               array(),
+                               array( 'known', 'noclasses' )
+                       );
                }
+
+               wfRunHooks( 'WatchlistEditorBuildRemoveLine', array( &$tools, $title, $redirect, $skin ) );
+
                return "<li>"
                        . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) )
                        . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "</li>\n";
-               }
+       }
 
        /**
         * Show a form for editing the watchlist in "raw" mode
@@ -435,7 +450,7 @@ class WatchlistEditor {
                $this->showItemCount( $output, $user );
                $self = SpecialPage::getTitleFor( 'Watchlist' );
                $form  = Xml::openElement( 'form', array( 'method' => 'post',
-                       'action' => $self->getLocalUrl( 'action=raw' ) ) );
+                       'action' => $self->getLocalUrl( array( 'action' => 'raw' ) ) ) );
                $form .= Xml::hidden( 'token', $wgUser->editToken( 'watchlistedit' ) );
                $form .= '<fieldset><legend>' . wfMsgHtml( 'watchlistedit-raw-legend' ) . '</legend>';
                $form .= wfMsgExt( 'watchlistedit-raw-explain', 'parse' );
@@ -487,7 +502,14 @@ class WatchlistEditor {
                $tools = array();
                $modes = array( 'view' => false, 'edit' => 'edit', 'raw' => 'raw' );
                foreach( $modes as $mode => $subpage ) {
-                       $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Watchlist', $subpage ), wfMsgHtml( "watchlisttools-{$mode}" ) );
+                       // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw'
+                       $tools[] = $skin->link(
+                               SpecialPage::getTitleFor( 'Watchlist', $subpage ),
+                               wfMsgHtml( "watchlisttools-{$mode}" ),
+                               array(),
+                               array(),
+                               array( 'known', 'noclasses' )
+                       );
                }
                return $wgLang->pipeList( $tools );
        }