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();
35 # $fromwhere = "FROM cur WHERE cur_namespace=0 AND cur_is_redirect=0";
36 $fromwhere = "FROM cur WHERE cur_namespace=0";
37 $order = "ORDER BY cur_title";
40 $sql = "SELECT COUNT(*) AS count $fromwhere";
41 $res = wfQuery( $sql, DB_READ
, $fname );
42 $s = wfFetchObject( $res );
44 $sections = ceil( $count / $indexMaxperpage );
46 $sql = "SELECT cur_title $fromwhere $order LIMIT 1";
47 $res = wfQuery( $sql, DB_READ
, $fname );
48 $s = wfFetchObject( $res );
49 $inpoint = $s->cur_title
;
52 # There's got to be a cleaner way to do this!
53 for( $i = 1; $i < $sections; $i++
) {
54 $from = $i * $indexMaxperpage;
55 $sql = "SELECT cur_title $fromwhere $order LIMIT $from,2";
56 $res = wfQuery( $sql, DB_READ
, $fname );
58 $s = wfFetchObject( $res );
59 $outpoint = $s->cur_title
;
60 $out .= indexShowline( $inpoint, $outpoint );
62 $s = wfFetchObject( $res );
63 $inpoint = $s->cur_title
;
68 $from = $i * $indexMaxperpage;
69 $sql = "SELECT cur_title $fromwhere $order LIMIT " . ($count-1) . ",1";
70 $res = wfQuery( $sql, DB_READ
, $fname );
71 $s = wfFetchObject( $res );
72 $outpoint = $s->cur_title
;
73 $out .= indexShowline( $inpoint, $outpoint );
77 $log->replaceContent( $out );
79 $wgOut->addHtml( $out );
82 function indexShowline( $inpoint, $outpoint )
84 global $wgOut, $wgLang, $wgUser;
85 $sk = $wgUser->getSkin();
90 $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
91 str_replace( "_", " ", $inpoint ),
92 "from=" . wfStrencode( $inpoint ) ) . "</td><td>",
93 "</td><td align=\"left\">" .
94 str_replace( "_", " ", $outpoint )
96 return "<tr><td align=\"right\">{$out}</td></tr>\n";
99 function indexShowChunk( $from )
101 global $wgOut, $wgUser, $indexMaxperpage;
102 $sk = $wgUser->getSkin();
105 $sql = "SELECT cur_title
107 WHERE cur_namespace=0 AND cur_title >= '" . wfStrencode( $from ) . "'
109 LIMIT {$indexMaxperpage}";
110 $res = wfQuery( $sql, DB_READ
, "indexShowChunk" );
112 # FIXME: Dynamic column widths, backlink to main list,
113 # side links to next and previous
115 $out = "<table border=\"0\">\n";
116 while( $s = wfFetchObject( $res ) ) {
117 $t = Title
::makeTitle( 0, $s->cur_title
);
119 $link = $sk->makeKnownLinkObj( $t );
121 $link = "[[" . htmlspecialchars( $s->cur_title
) . "]]";
126 $out .= "<td width=\"33%\">$link</td>";
137 $wgOut->addHtml( $out );