3 function wfSpecialAllpages( $par=NULL )
5 global $from, $indexMaxperpage;
6 $indexMaxperpage = 480;
9 indexShowChunk( $par );
10 } elseif( isset( $from ) ) {
11 indexShowChunk( $from );
17 function indexShowToplevel()
19 global $wgOut, $indexMaxperpage, $wgLang;
20 $fname = "indexShowToplevel";
23 $vsp = $wgLang->getValidSpecialPages();
24 $log = new LogPage( $vsp["Allpages"] );
25 $log->mUpdateRecentChanges
= false;
29 $log->showAsDisabledPage();
34 # $fromwhere = "FROM cur WHERE cur_namespace=0 AND cur_is_redirect=0";
35 $fromwhere = "FROM cur WHERE cur_namespace=0";
36 $order = "ORDER BY cur_title";
39 $sql = "SELECT COUNT(*) AS count $fromwhere";
40 $res = wfQuery( $sql, $fname );
41 $s = wfFetchObject( $res );
43 $sections = ceil( $count / $indexMaxperpage );
45 $sql = "SELECT cur_title $fromwhere $order LIMIT 1";
46 $res = wfQuery( $sql, $fname );
47 $s = wfFetchObject( $res );
48 $inpoint = $s->cur_title
;
51 # There's got to be a cleaner way to do this!
52 for( $i = 1; $i < $sections; $i++
) {
53 $from = $i * $indexMaxperpage;
54 $sql = "SELECT cur_title $fromwhere $order LIMIT $from,2";
55 $res = wfQuery( $sql, $fname );
57 $s = wfFetchObject( $res );
58 $outpoint = $s->cur_title
;
59 $out .= indexShowline( $inpoint, $outpoint );
61 $s = wfFetchObject( $res );
62 $inpoint = $s->cur_title
;
67 $from = $i * $indexMaxperpage;
68 $sql = "SELECT cur_title $fromwhere $order LIMIT " . ($count-1) . ",1";
69 $res = wfQuery( $sql, $fname );
70 $s = wfFetchObject( $res );
71 $outpoint = $s->cur_title
;
72 $out .= indexShowline( $inpoint, $outpoint );
76 $log->replaceContent( $out );
78 $wgOut->addHtml( $out );
81 function indexShowline( $inpoint, $outpoint )
83 global $wgOut, $wgLang, $wgUser;
84 $sk = $wgUser->getSkin();
89 $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
90 str_replace( "_", " ", $inpoint ),
91 "from=" . wfStrencode( $inpoint ) ) . "</td><td>",
92 "</td><td align=\"left\">" .
93 str_replace( "_", " ", $outpoint )
95 return "<tr><td align=\"right\">{$out}</td></tr>\n";
98 function indexShowChunk( $from )
100 global $wgOut, $wgUser, $indexMaxperpage;
101 $sk = $wgUser->getSkin();
104 $sql = "SELECT cur_title
106 WHERE cur_namespace=0 AND cur_title >= '" . wfStrencode( $from ) . "'
108 LIMIT {$indexMaxperpage}";
109 $res = wfQuery( $sql, "indexShowChunk" );
111 # FIXME: Dynamic column widths, backlink to main list,
112 # side links to next and previous
114 $out = "<table border=\"0\">\n";
115 while( $s = wfFetchObject( $res ) ) {
116 $out .= "<td width=\"33%\">" .
117 $sk->makeKnownLink( $s->cur_title
) .
121 $out .= "</tr>\n<tr>";
129 $wgOut->addHtml( $out );