BUG#93 Fix handling of <nowiki> in templates
[lhc/web/wiklou.git] / includes / SpecialBooksources.php
index 8e7aa72..a00d4fb 100644 (file)
@@ -1,10 +1,16 @@
 <?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;
@@ -17,6 +23,11 @@ function wfSpecialBooksources( $par )
        $bsl->show();
 }
 
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 class BookSourceList {
        var $mIsbn;
 
@@ -41,15 +52,11 @@ class BookSourceList {
                
                # First, see if we have a custom list setup in
                # [[Wikipedia:Book sources]] or equivalent.
-               $bstitle = Title::newFromText( wfmsg( "booksources" ) );
-               $sql = "SELECT cur_text FROM cur " .
-                       "WHERE cur_namespace=4 and cur_title='" .
-                       wfStrencode( $bstitle->getDBkey() ) . "'";
-               $res = wfQuery( $sql, DB_READ, $fname );
-               if( ( $s = wfFetchObject( $res ) ) and ( $s->cur_text != "" ) ) {       
-                       $bstext = $s->cur_text;
+               $bstitle = Title::makeTitleSafe( NS_PROJECT, 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;
                }