* s~\t+$~~
[lhc/web/wiklou.git] / includes / SpecialUnwatchedpages.php
1 <?php
2 /**
3 * A special page that displays a list of pages that are not on anyones watchlist
4 *
5 * @package MediaWiki
6 * @subpackage SpecialPage
7 *
8 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
10 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 */
12
13 /* */
14 require_once 'QueryPage.php';
15
16 /**
17 * @package MediaWiki
18 * @subpackage SpecialPage
19 */
20 class UnwatchedpagesPage extends QueryPage {
21
22 function getName() { return 'Unwatchedpages'; }
23 function isExpensive() { return true; }
24 function isSyndicated() { return false; }
25
26 function getSQL() {
27 $dbr =& wfGetDB( DB_SLAVE );
28 extract( $dbr->tableNames( 'page', 'watchlist' ) );
29 return
30 "
31 SELECT
32 'Unwatchedpages' as type,
33 page_namespace as namespace,
34 page_title as title,
35 page_namespace as value
36 FROM $page
37 LEFT JOIN $watchlist ON wl_namespace = page_namespace AND page_title = wl_title
38 WHERE wl_title IS NULL AND page_is_redirect = 0
39 ";
40 }
41
42 function sortDescending() { return false; }
43
44 function formatResult( $skin, $result ) {
45 global $wgContLang;
46
47 $nt = Title::makeTitle( $result->namespace, $result->title );
48 $text = $wgContLang->convert( $nt->getPrefixedText() );
49
50 $plink = $skin->makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
51 $wlink = $skin->makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
52
53 return $plink . ' (' . $wlink . ')';
54 }
55 }
56
57 /**
58 * constructor
59 */
60 function wfSpecialUnwatchedpages() {
61 global $wgUser, $wgOut;
62
63 if ( ! $wgUser->isAllowed( 'unwatchedpages' ) )
64 return $wgOut->permissionRequired( 'unwatchedpages' );
65
66 list( $limit, $offset ) = wfCheckLimits();
67
68 $wpp = new UnwatchedpagesPage();
69
70 $wpp->doQuery( $offset, $limit );
71 }
72
73 ?>