more cssification of diff rendering, some " -> ' in diff engine
[lhc/web/wiklou.git] / includes / SpecialRandompage.php
1 <?php
2 # $Id$
3
4 function wfSpecialRandompage()
5 {
6 global $wgOut, $wgTitle, $wgArticle, $wgIsMySQL;
7 $fname = "wfSpecialRandompage";
8
9 wfSeedRandom();
10 $rand = mt_rand() / mt_getrandmax();
11 # interpolation and sprintf() can muck up with locale-specific decimal separator
12 $randstr = number_format( $rand, 12, ".", "" );
13 $use_index=$wgIsMySQL?"USE INDEX (cur_random)":"";
14 $sqlget = "SELECT cur_id,cur_title
15 FROM cur $use_index
16 WHERE cur_namespace=0 AND cur_is_redirect=0
17 AND cur_random>$randstr
18 ORDER BY cur_random
19 LIMIT 1";
20 $res = wfQuery( $sqlget, DB_READ, $fname );
21 if( $s = wfFetchObject( $res ) ) {
22 $rt = wfUrlEncode( $s->cur_title );
23 } else {
24 # No articles?!
25 $rt = "";
26 }
27
28 $wgOut->reportTime(); # for logfile
29 $wgOut->redirect( wfLocalUrl( $rt ) );
30 }
31
32 ?>