<?php
+/**
+ * ISBNs in wiki pages will create links to this page, with the ISBN passed
+ * in via the query string.
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
-# ISBNs in wiki pages will create links to this page, with
-# the ISBN passed in via the query string.
-
-function wfSpecialBooksources( $par )
-{
+/**
+ * Constructor
+ */
+function wfSpecialBooksources( $par ) {
global $wgRequest;
$isbn = $par;
$bsl->show();
}
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
class BookSourceList {
var $mIsbn;
global $wgOut;
$wgOut->setPagetitle( wfMsg( "booksources" ) );
- if( empty( $this->mIsbn ) ) {
+ if( $this->mIsbn == '' ) {
$this->askForm();
} else {
$this->showList();
}
function showList() {
- global $wgOut, $wgUser, $wgLang;
+ global $wgOut, $wgUser, $wgContLang;
$fname = "BookSourceList::showList()";
# First, see if we have a custom list setup in
# [[Wikipedia:Book sources]] or equivalent.
- $bstitle = Title::makeTitleSafe( NS_WIKIPEDIA, wfMsg( "booksources" ) );
- $dbr =& wfGetDB( DB_SLAVE );
- $bstext = $dbr->selectField( 'cur', 'cur_text', $bstitle->curCond(), $fname );
- if( $bstext ) {
- $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext );
- $wgOut->addWikiText( $bstext );
- return;
+ $bstitle = Title::makeTitleSafe( NS_PROJECT, wfMsg( "booksources" ) );
+ $bsarticle = new Article( $bstitle );
+ if( $bsarticle->exists() ) {
+ $bstext = $bsarticle->getContent( false );
+ if( $bstext ) {
+ $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext );
+ $wgOut->addWikiText( $bstext );
+ return;
+ }
}
# Otherwise, use the list of links in the default Language.php file.
$s = wfMsg( "booksourcetext" ) . "<ul>\n";
- $bs = $wgLang->getBookstoreList() ;
+ $bs = $wgContLang->getBookstoreList() ;
$bsn = array_keys ( $bs ) ;
foreach ( $bsn as $name ) {
$adr = $bs[$name] ;