- global $wgLang ;
-
- $ns = $wgLang->getNamespaces() ;
- $from = $skin->makeKnownLink( $result->cur_title ,'', 'redirect=no' );
- $edit = $skin->makeBrokenLink( $result->cur_title , "(".wfMsg("qbedit").")" , 'redirect=no');
- $to = $skin->makeBrokenLink( $result->bl_to );
+ $fromObj = Title::makeTitle( $result->namespace, $result->title );
+ if ( isset( $result->pl_title ) ) {
+ $toObj = Title::makeTitle( $result->pl_namespace, $result->pl_title );
+ } else {
+ $blinks = $fromObj->getBrokenLinksFrom();
+ if ( $blinks ) {
+ $toObj = $blinks[0];
+ } else {
+ $toObj = false;
+ }
+ }
+
+ // $toObj may very easily be false if the $result list is cached
+ if ( !is_object( $toObj ) ) {
+ return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
+ }
+
+ $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
+ $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
+ $to = $skin->makeBrokenLinkObj( $toObj );