3 function wfSpecialAllpages()
5 global $from, $indexMaxperpage;
6 $indexMaxperpage = 480;
9 indexShowChunk( $from );
15 function indexShowToplevel()
17 global $wgOut, $indexMaxperpage;
18 $fname = "indexShowToplevel";
19 # FIXME: This may be slow; we may need to cache it
21 # $fromwhere = "FROM cur WHERE cur_namespace=0 AND cur_is_redirect=0";
22 $fromwhere = "FROM cur WHERE cur_namespace=0";
23 $order = "ORDER BY cur_title";
26 $sql = "SELECT COUNT(*) AS count $fromwhere";
27 $res = wfQuery( $sql, $fname );
28 $s = wfFetchObject( $res );
30 $sections = ceil( $count / $indexMaxperpage );
32 $sql = "SELECT cur_title $fromwhere $order LIMIT 1";
33 $res = wfQuery( $sql, $fname );
34 $s = wfFetchObject( $res );
35 $inpoint = $s->cur_title
;
38 # There's got to be a cleaner way to do this!
39 for( $i = 1; $i < $sections; $i++
) {
40 $from = $i * $indexMaxperpage;
41 $sql = "SELECT cur_title $fromwhere $order LIMIT $from,2";
42 $res = wfQuery( $sql, $fname );
44 $s = wfFetchObject( $res );
45 $outpoint = $s->cur_title
;
46 $out .= indexShowline( $inpoint, $outpoint );
48 $s = wfFetchObject( $res );
49 $inpoint = $s->cur_title
;
54 $from = $i * $indexMaxperpage;
55 $sql = "SELECT cur_title $fromwhere $order LIMIT " . ($count-1) . ",1";
56 $res = wfQuery( $sql, $fname );
57 $s = wfFetchObject( $res );
58 $outpoint = $s->cur_title
;
59 $out .= indexShowline( $inpoint, $outpoint );
62 $wgOut->addHtml( $out );
65 function indexShowline( $inpoint, $outpoint )
67 global $wgOut, $wgLang, $wgUser;
68 $sk = $wgUser->getSkin();
73 $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
74 str_replace( "_", " ", $inpoint ),
75 "from=" . wfStrencode( $inpoint ) ) . "</td><td>",
76 "</td><td align=\"left\">" .
77 str_replace( "_", " ", $outpoint )
79 return "<tr><td align=\"right\">{$out}</td></tr>\n";
82 function indexShowChunk( $from )
84 global $wgOut, $wgUser, $indexMaxperpage;
85 $sk = $wgUser->getSkin();
88 $sql = "SELECT cur_title
90 WHERE cur_namespace=0 AND cur_title >= '" . wfStrencode( $from ) . "'
92 LIMIT {$indexMaxperpage}";
93 $res = wfQuery( $sql, "indexShowChunk" );
95 # FIXME: Dynamic column widths, backlink to main list,
96 # side links to next and previous
98 $out = "<table border=\"0\">\n";
99 while( $s = wfFetchObject( $res ) ) {
100 $out .= "<td width=\"33%\">" .
101 $sk->makeKnownLink( $s->cur_title
) .
105 $out .= "</tr>\n<tr>";
113 $wgOut->addHtml( $out );