Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | 'Listusers' => new SpecialPage( 'Listusers' ), |
38 | 38 | 'Statistics' => new SpecialPage( 'Statistics' ), |
39 | 39 | 'Random' => new SpecialPage( 'Randompage' ), |
| 40 | + 'RandomFA' => new SpecialPage( 'RandomFA' ), |
40 | 41 | 'Lonelypages' => new SpecialPage( 'Lonelypages' ), |
41 | 42 | 'Uncategorizedpages'=> new SpecialPage( 'Uncategorizedpages' ), |
42 | 43 | 'Uncategorizedcategories'=> new SpecialPage( 'Uncategorizedcategories' ), |
Index: trunk/phase3/includes/SpecialRandomFA.php |
— | — | @@ -0,0 +1,48 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @package MediaWiki |
| 5 | + * @subpackage SpecialPage |
| 6 | + */ |
| 7 | + |
| 8 | +/** |
| 9 | + * Constructor |
| 10 | + */ |
| 11 | +function wfSpecialRandomFA() { |
| 12 | + global $wgOut, $wgTitle, $wgArticle, $wgContLang; |
| 13 | + $fname = 'wfSpecialRandomFA'; |
| 14 | + |
| 15 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 16 | + $use_index = $dbr->useIndexClause( 'page_random' ); |
| 17 | + extract( $dbr->tableNames( 'page', 'pagelinks' ) ); |
| 18 | + |
| 19 | + $randstr = wfRandom(); |
| 20 | + $ft = Title::newFromText( wfMsgForContent( 'featuredtemplate' ) ); |
| 21 | + if ( is_null( $ft ) ) { |
| 22 | + $title = Title::newFromText( wfMsgForContent( 'mainpage' ) ); |
| 23 | + $wgOut->redirect( $title->getFullUrl() ); |
| 24 | + return; |
| 25 | + } |
| 26 | + $template = $dbr->addQuotes( $ft->getDBkey() ); |
| 27 | + $sql = " |
| 28 | + SELECT page_title, page_random |
| 29 | + FROM $pagelinks |
| 30 | + LEFT JOIN $page $use_index ON page_id = pl_from |
| 31 | + WHERE pl_title = $template AND pl_namespace = " . NS_TEMPLATE . " AND page_namespace = " . NS_TALK . " AND page_random > $randstr |
| 32 | + ORDER BY page_random |
| 33 | + "; |
| 34 | + $sql = $dbr->limitResult($sql, 1, 0); |
| 35 | + $res = $dbr->query( $sql, $fname ); |
| 36 | + |
| 37 | + $title = null; |
| 38 | + if ( $s = $dbr->fetchObject( $res ) ) { |
| 39 | + $title =& Title::makeTitle( NS_MAIN, $s->page_title ); |
| 40 | + } |
| 41 | + if ( is_null( $title ) ) { |
| 42 | + # That's not supposed to happen :) |
| 43 | + $title = Title::newFromText( wfMsgForContent( 'mainpage' ) ); |
| 44 | + } |
| 45 | + $wgOut->reportTime(); # for logfile |
| 46 | + $wgOut->redirect( $title->getFullUrl() ); |
| 47 | +} |
| 48 | + |
| 49 | +?> |
Property changes on: trunk/phase3/includes/SpecialRandomFA.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 50 | + native |
Added: svn:keywords |
2 | 51 | + Author Date Id Revision |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -1106,6 +1106,7 @@ |
1107 | 1107 | 'maintenancebacklink' => 'Back to Maintenance Page', |
1108 | 1108 | 'disambiguations' => 'Disambiguation pages', |
1109 | 1109 | 'disambiguationspage' => 'Template:disambig', |
| 1110 | +'featuredtemplate' => 'Template:Featured', |
1110 | 1111 | 'disambiguationstext' => "The following pages link to a <i>disambiguation page</i>. They should link to the appropriate topic instead.<br />A page is treated as disambiguation if it is linked from $1.<br />Links from other namespaces are <i>not</i> listed here.", |
1111 | 1112 | 'doubleredirects' => 'Double redirects', |
1112 | 1113 | 'doubleredirectstext' => "Each row contains links to the first and second redirect, as well as the first line of the second redirect text, usually giving the \"real\" target page, which the first redirect should point to.", |