From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- includes/SpecialBooksources.php | 109 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 includes/SpecialBooksources.php (limited to 'includes/SpecialBooksources.php') diff --git a/includes/SpecialBooksources.php b/includes/SpecialBooksources.php new file mode 100644 index 00000000..960f6224 --- /dev/null +++ b/includes/SpecialBooksources.php @@ -0,0 +1,109 @@ +getVal( 'isbn' ); + } + $isbn = preg_replace( '/[^0-9X]/', '', $isbn ); + + $bsl = new BookSourceList( $isbn ); + $bsl->show(); +} + +/** + * + * @package MediaWiki + * @subpackage SpecialPage + */ +class BookSourceList { + var $mIsbn; + + function BookSourceList( $isbn ) { + $this->mIsbn = $isbn; + } + + function show() { + global $wgOut; + + $wgOut->setPagetitle( wfMsg( "booksources" ) ); + if( $this->mIsbn == '' ) { + $this->askForm(); + } else { + $this->showList(); + } + } + + function showList() { + global $wgOut, $wgContLang; + $fname = "BookSourceList::showList()"; + + # First, see if we have a custom list setup in + # [[Wikipedia:Book sources]] or equivalent. + $bstitle = Title::makeTitleSafe( NS_PROJECT, wfMsg( "booksources" ) ); + if( $bstitle ) { + $revision = Revision::newFromTitle( $bstitle ); + if( $revision ) { + $bstext = $revision->getText(); + 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 = wfMsgWikiHtml( 'booksourcetext' ) . "\n"; + + $wgOut->addHTML( $s ); + } + + function askForm() { + global $wgOut, $wgTitle; + $fname = "BookSourceList::askForm()"; + + $action = $wgTitle->escapeLocalUrl(); + $isbn = htmlspecialchars( wfMsg( "isbn" ) ); + $go = htmlspecialchars( wfMsg( "go" ) ); + $out = "
+ $isbn: + +
"; + $wgOut->addHTML( $out ); + } +} + +?> -- cgit v1.2.3-54-g00ecf