Use wfMsg()'s parameters
[lhc/web/wiklou.git] / includes / SpecialStatistics.php
1 <?
2
3 function wfSpecialStatistics()
4 {
5 global $wgUser, $wgOut;
6 $fname = "wfSpecialStatistics";
7
8 $wgOut->addHTML( "<h2>" . wfMsg( "sitestats" ) . "</h2>\n" );
9
10 $sql = "SELECT COUNT(cur_id) AS total FROM cur";
11 $res = wfQuery( $sql, DB_READ, $fname );
12 $row = wfFetchObject( $res );
13 $total = $row->total;
14
15 $sql = "SELECT ss_total_views, ss_total_edits, ss_good_articles " .
16 "FROM site_stats WHERE ss_row_id=1";
17 $res = wfQuery( $sql, DB_READ, $fname );
18 $row = wfFetchObject( $res );
19 $views = $row->ss_total_views;
20 $edits = $row->ss_total_edits;
21 $good = $row->ss_good_articles;
22
23 $text = wfMsg( "sitestatstext",
24 $total, $good, $views, $edits,
25 sprintf( "%.2f", $total ? $edits / $total : 0 ),
26 sprintf( "%.2f", $edits ? $views / $edits : 0 ) );
27
28 $wgOut->addHTML( $text );
29 $wgOut->addHTML( "<h2>" . wfMsg( "userstats" ) . "</h2>\n" );
30
31 $sql = "SELECT COUNT(user_id) AS total FROM user";
32 $res = wfQuery( $sql, DB_READ, $fname );
33 $row = wfFetchObject( $res );
34 $total = $row->total;
35
36 $sql = "SELECT COUNT(user_id) AS total FROM user " .
37 "WHERE user_rights LIKE '%sysop%'";
38 $res = wfQuery( $sql, DB_READ, $fname );
39 $row = wfFetchObject( $res );
40 $admins = $row->total;
41
42 $sk = $wgUser->getSkin();
43 $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" );
44
45 $text = wfMsg( "userstatstext", $total, $admins, $ap );
46 $wgOut->addHTML( $text );
47 }
48
49 ?>