Index: trunk/extensions/Cite/SpecialCite_body.php |
— | — | @@ -23,21 +23,15 @@ |
24 | 24 | $this->setHeaders(); |
25 | 25 | $this->outputHeader(); |
26 | 26 | |
27 | | - $page = isset( $par ) ? $par : $wgRequest->getText( 'page' ); |
28 | | - $id = $wgRequest->getInt( 'id' ); |
| 27 | + $page = $par !== null ? $par : $wgRequest->getText( 'page' ); |
| 28 | + $title = Title::newFromText( $page ); |
29 | 29 | |
30 | | - $title = Title::newFromText( $page ); |
31 | | - if ( $title ) { |
32 | | - $article = new Article( $title ); |
33 | | - } |
34 | 30 | $cform = new CiteForm( $title ); |
| 31 | + $cform->execute(); |
35 | 32 | |
36 | | - if ( !$title || ! $article->exists() ) { |
37 | | - $cform->execute(); |
38 | | - } else { |
39 | | - $cform->execute(); |
40 | | - |
41 | | - $cout = new CiteOutput( $title, $article, $id ); |
| 33 | + if ( $title && $title->exists() ) { |
| 34 | + $id = $wgRequest->getInt( 'id' ); |
| 35 | + $cout = new CiteOutput( $title, $id ); |
42 | 36 | $cout->execute(); |
43 | 37 | } |
44 | 38 | } |
— | — | @@ -117,11 +111,11 @@ |
118 | 112 | |
119 | 113 | var $mSpTitle; |
120 | 114 | |
121 | | - function __construct( &$title, &$article, $id ) { |
| 115 | + function __construct( $title, $id ) { |
122 | 116 | global $wgHooks, $wgParser; |
123 | 117 | |
124 | | - $this->mTitle =& $title; |
125 | | - $this->mArticle =& $article; |
| 118 | + $this->mTitle = $title; |
| 119 | + $this->mArticle = new Article( $title ); |
126 | 120 | $this->mId = $id; |
127 | 121 | |
128 | 122 | $wgHooks['ParserGetVariableValueVarCache'][] = array( $this, 'varCache' ); |
— | — | @@ -141,8 +135,7 @@ |
142 | 136 | if ( $msg == '' ) { |
143 | 137 | $msg = $wgCiteDefaultText; |
144 | 138 | } |
145 | | - $this->mArticle->fetchContent( $this->mId, false ); |
146 | | - $ret = $wgParser->parse( $msg, $this->mTitle, $this->mParserOptions, false, true, $this->mArticle->getRevIdFetched() ); |
| 139 | + $ret = $wgParser->parse( $msg, $this->mTitle, $this->mParserOptions, false, true, $this->getRevId() ); |
147 | 140 | $wgOut->addHTML( $ret->getText() ); |
148 | 141 | } |
149 | 142 | |
— | — | @@ -175,4 +168,12 @@ |
176 | 169 | |
177 | 170 | return true; |
178 | 171 | } |
| 172 | + |
| 173 | + function getRevId() { |
| 174 | + if ( $this->mId ) { |
| 175 | + return $this->mId; |
| 176 | + } else { |
| 177 | + return $this->mTitle->getLatestRevID(); |
| 178 | + } |
| 179 | + } |
179 | 180 | } |