if ( preg_match( "/\\[\\[([^\\]\\|]+)[\\]\\|]/",
$s->cur_text, $m ) ) {
$rt = Title::newFromText( $m[1] );
-
- # Gotta hand redirects to special pages differently:
- # Fill the HTTP response "Location" header and ignore
- # the rest of the page we're on.
-
- if ( $rt->getInterwiki() != "" ) {
- $wgOut->redirect( $rt->getFullURL() ) ;
- return;
- }
- if ( $rt->getNamespace() == Namespace::getSpecial() ) {
- $wgOut->redirect( wfLocalUrl(
- $rt->getPrefixedURL() ) );
- return;
- }
- $rid = $rt->getArticleID();
- if ( 0 != $rid ) {
- $sql = "SELECT cur_text,cur_timestamp,cur_user," .
- "cur_counter,cur_restrictions,cur_touched FROM cur WHERE cur_id={$rid}";
- $res = wfQuery( $sql, DB_READ, $fname );
-
- if ( 0 != wfNumRows( $res ) ) {
- $this->mRedirectedFrom = $this->mTitle->getPrefixedText();
- $this->mTitle = $rt;
- $s = wfFetchObject( $res );
+ if( $rt ) {
+ # Gotta hand redirects to special pages differently:
+ # Fill the HTTP response "Location" header and ignore
+ # the rest of the page we're on.
+
+ if ( $rt->getInterwiki() != "" ) {
+ $wgOut->redirect( $rt->getFullURL() ) ;
+ return;
+ }
+ if ( $rt->getNamespace() == Namespace::getSpecial() ) {
+ $wgOut->redirect( wfLocalUrl(
+ $rt->getPrefixedURL() ) );
+ return;
+ }
+ $rid = $rt->getArticleID();
+ if ( 0 != $rid ) {
+ $sql = "SELECT cur_text,cur_timestamp,cur_user," .
+ "cur_counter,cur_restrictions,cur_touched FROM cur WHERE cur_id={$rid}";
+ $res = wfQuery( $sql, DB_READ, $fname );
+
+ if ( 0 != wfNumRows( $res ) ) {
+ $this->mRedirectedFrom = $this->mTitle->getPrefixedText();
+ $this->mTitle = $rt;
+ $s = wfFetchObject( $res );
+ }
}
}
}