getVal( 'isbn' ); } $isbn = preg_replace( '/[^0-9X]/', '', $isbn ); $bsl = new BookSourceList( $isbn ); $bsl->show(); } class BookSourceList { var $mIsbn; function BookSourceList( $isbn ) { $this->mIsbn = $isbn; } function show() { global $wgOut, $wgUser, $wgLang; $fname = "BookSourceList::show()"; $noautolist = false; $wgOut->setPagetitle( wfMsg( "booksources" ) ); $bstext = wfMsg( "booksourcetext" ); if( $this->mIsbn ) { $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; $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext ); $noautolist = true; } } $wgOut->addWikiText( $bstext ); # If ISBN is blank, just show a list of links to the # home page of the various book sites. Otherwise, show # a list of links directly to the book. if( !$noautolist ) { # only do this if we haven't already shown [[Wikipedia:Book sources]] $s = "\n"; $wgOut->addHTML( $s ); } } } ?>