Clarification for $wgRestrictionLevels
[lhc/web/wiklou.git] / includes / SpecialRandomredirect.php
1 <?php
2
3 /**
4 * Special page to direct the user to a random redirect page (minus the second redirect)
5 *
6 * @addtogroup SpecialPage
7 * @author Rob Church <robchur@gmail.com>, Ilmari Karonen
8 * @license GNU General Public Licence 2.0 or later
9 */
10
11 /**
12 * Main execution point
13 * @param $par Namespace to select the redirect from
14 */
15 function wfSpecialRandomredirect( $par = null ) {
16 global $wgOut, $wgContLang;
17
18 $rnd = new RandomPage();
19 $rnd->setNamespace( $wgContLang->getNsIndex( $par ) );
20 $rnd->setRedirect( true );
21
22 $title = $rnd->getRandomTitle();
23
24 if( is_null( $title ) ) {
25 $wgOut->addWikiText( wfMsg( 'randomredirect-nopages' ) );
26 return;
27 }
28
29 $wgOut->reportTime();
30 $wgOut->redirect( $title->getFullUrl( 'redirect=no' ) );
31 }
32
33 ?>