3 function wfSpecialAllpages()
5 global $from, $indexMaxperpage;
6 $indexMaxperpage = 480;
9 indexShowChunk( $from );
15 function indexShowToplevel()
17 global $wgOut, $indexMaxperpage, $wgLang;
18 $fname = "indexShowToplevel";
21 $vsp = $wgLang->getValidSpecialPages();
22 $log = new LogPage( $vsp["Allpages"] );
23 $log->mUpdateRecentChanges
= false;
27 $log->showAsDisabledPage();
32 # $fromwhere = "FROM cur WHERE cur_namespace=0 AND cur_is_redirect=0";
33 $fromwhere = "FROM cur WHERE cur_namespace=0";
34 $order = "ORDER BY cur_title";
37 $sql = "SELECT COUNT(*) AS count $fromwhere";
38 $res = wfQuery( $sql, $fname );
39 $s = wfFetchObject( $res );
41 $sections = ceil( $count / $indexMaxperpage );
43 $sql = "SELECT cur_title $fromwhere $order LIMIT 1";
44 $res = wfQuery( $sql, $fname );
45 $s = wfFetchObject( $res );
46 $inpoint = $s->cur_title
;
49 # There's got to be a cleaner way to do this!
50 for( $i = 1; $i < $sections; $i++
) {
51 $from = $i * $indexMaxperpage;
52 $sql = "SELECT cur_title $fromwhere $order LIMIT $from,2";
53 $res = wfQuery( $sql, $fname );
55 $s = wfFetchObject( $res );
56 $outpoint = $s->cur_title
;
57 $out .= indexShowline( $inpoint, $outpoint );
59 $s = wfFetchObject( $res );
60 $inpoint = $s->cur_title
;
65 $from = $i * $indexMaxperpage;
66 $sql = "SELECT cur_title $fromwhere $order LIMIT " . ($count-1) . ",1";
67 $res = wfQuery( $sql, $fname );
68 $s = wfFetchObject( $res );
69 $outpoint = $s->cur_title
;
70 $out .= indexShowline( $inpoint, $outpoint );
74 $log->replaceContent( $out );
76 $wgOut->addHtml( $out );
79 function indexShowline( $inpoint, $outpoint )
81 global $wgOut, $wgLang, $wgUser;
82 $sk = $wgUser->getSkin();
87 $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
88 str_replace( "_", " ", $inpoint ),
89 "from=" . wfStrencode( $inpoint ) ) . "</td><td>",
90 "</td><td align=\"left\">" .
91 str_replace( "_", " ", $outpoint )
93 return "<tr><td align=\"right\">{$out}</td></tr>\n";
96 function indexShowChunk( $from )
98 global $wgOut, $wgUser, $indexMaxperpage;
99 $sk = $wgUser->getSkin();
102 $sql = "SELECT cur_title
104 WHERE cur_namespace=0 AND cur_title >= '" . wfStrencode( $from ) . "'
106 LIMIT {$indexMaxperpage}";
107 $res = wfQuery( $sql, "indexShowChunk" );
109 # FIXME: Dynamic column widths, backlink to main list,
110 # side links to next and previous
112 $out = "<table border=\"0\">\n";
113 while( $s = wfFetchObject( $res ) ) {
114 $out .= "<td width=\"33%\">" .
115 $sk->makeKnownLink( $s->cur_title
) .
119 $out .= "</tr>\n<tr>";
127 $wgOut->addHtml( $out );