3 function wfSpecialAllpages( $par=NULL )
5 global $indexMaxperpage, $wgRequest;
6 $indexMaxperpage = 480;
7 $from = $wgRequest->getVal( 'from' );
10 indexShowChunk( $par );
11 } elseif( !is_null( $from ) ) {
12 indexShowChunk( $from );
18 function indexShowToplevel()
20 global $wgOut, $indexMaxperpage, $wgLang;
21 $fname = "indexShowToplevel";
24 $vsp = $wgLang->getValidSpecialPages();
25 $log = new LogPage( $vsp["Allpages"] );
26 $log->mUpdateRecentChanges
= false;
30 $log->showAsDisabledPage();
34 $dbr =& wfGetDB( DB_SLAVE
);
35 $cur = $dbr->tableName( 'cur' );
36 $fromwhere = "FROM $cur WHERE cur_namespace=0";
37 $order = 'ORDER BY cur_title';
39 $where = array( 'cur_namespace' => 0 );
41 $count = $dbr->selectField( 'cur', 'COUNT(*)', $where, $fname );
42 $sections = ceil( $count / $indexMaxperpage );
43 $inpoint = $dbr->selectField( 'cur', 'cur_title', $where, $fname, $order );
46 # There's got to be a cleaner way to do this!
47 for( $i = 1; $i < $sections; $i++
) {
48 $from = $i * $indexMaxperpage;
49 $sql = "SELECT cur_title $fromwhere $order ".$dbr->limitResult(2,$from);
50 $res = $dbr->query( $sql, $fname );
52 $s = $dbr->fetchObject( $res );
53 $outpoint = $s->cur_title
;
54 $out .= indexShowline( $inpoint, $outpoint );
56 $s = $dbr->fetchObject( $res );
57 $inpoint = $s->cur_title
;
59 $dbr->freeResult( $res );
62 $from = $i * $indexMaxperpage;
63 $sql = "SELECT cur_title $fromwhere $order ".wfLimitResult(1,$count-1);
64 $res = $dbr->query( $sql, $fname );
65 $s = $dbr->fetchObject( $res );
66 $outpoint = $s->cur_title
;
67 $out .= indexShowline( $inpoint, $outpoint );
71 $log->replaceContent( $out );
73 $wgOut->addHtml( $out );
76 function indexShowline( $inpoint, $outpoint )
78 global $wgOut, $wgLang, $wgUser;
79 $sk = $wgUser->getSkin();
80 $dbr =& wfGetDB( DB_SLAVE
);
85 $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
86 str_replace( "_", " ", $inpoint ),
87 "from=" . $dbr->strencode( $inpoint ) ) . "</td><td>",
88 "</td><td align=\"left\">" .
89 str_replace( "_", " ", $outpoint )
91 return "<tr><td align=\"right\">{$out}</td></tr>\n";
94 function indexShowChunk( $from )
96 global $wgOut, $wgUser, $indexMaxperpage, $wgLang;
97 $sk = $wgUser->getSkin();
98 $maxPlusOne = $indexMaxperpage +
1;
101 $dbr =& wfGetDB( DB_SLAVE
);
102 $cur = $dbr->tableName( 'cur' );
103 $sql = "SELECT cur_title FROM $cur WHERE cur_namespace=0 AND cur_title >= '"
104 . $dbr->strencode( $from ) . "' ORDER BY cur_title LIMIT " . $maxPlusOne;
105 $res = $dbr->query( $sql, "indexShowChunk" );
107 ### FIXME: side link to previous
110 $out = "<table border=\"0\" width=\"100%\">\n";
111 while( ($n < $indexMaxperpage) && ($s = $dbr->fetchObject( $res )) ) {
112 $t = Title
::makeTitle( 0, $s->cur_title
);
114 $link = $sk->makeKnownLinkObj( $t );
116 $link = "[[" . htmlspecialchars( $s->cur_title
) . "]]";
121 $out .= "<td>$link</td>";
127 if( ($n %
3) != 0 ) {
132 $out2 = "<div style='text-align: right; font-size: smaller; margin-bottom: 1em;'>" .
133 $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
134 wfMsg ( 'allpages' ) );
135 if ( ($n == $indexMaxperpage) && ($s = $dbr->fetchObject( $res )) ) {
136 $out2 .= " | " . $sk->makeKnownLink(
137 $wgLang->specialPage( "Allpages" ),
138 wfMsg ( 'nextpage', $s->cur_title
),
139 "from=" . $dbr->strencode( $s->cur_title
) );
143 $wgOut->addHtml( $out2 . $out );