From 073d13e93da7eaf5838ef1eec2032aa95e30767e Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Fri, 2 Apr 2004 20:34:13 +0000 Subject: [PATCH] fixing category links, nth time --- includes/Parser.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 4d7c86ecaf..85198b0e0c 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -217,19 +217,19 @@ class Parser # $sk =& $this->mGetSkin(); $sk =& $wgUser->getSkin() ; - $doesexist = false ; - if ( $doesexist ) { - $sql = "SELECT cur_title,cur_namespace FROM cur,links WHERE l_to={$id} AND l_from=cur_id"; - } else { - $sql = "SELECT cur_title,cur_namespace FROM cur,brokenlinks WHERE bl_to={$id} AND bl_from=cur_id" ; - } + $data = array () ; + $sql1 = "SELECT DISTINCT cur_title,cur_namespace FROM cur,links WHERE l_to={$id} AND l_from=cur_id"; + $sql2 = "SELECT DISTINCT cur_title,cur_namespace FROM cur,brokenlinks WHERE bl_to={$id} AND bl_from=cur_id" ; + + $res = wfQuery ( $sql1, DB_READ ) ; + while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; - $res = wfQuery ( $sql, DB_READ ) ; - while ( $x = wfFetchObject ( $res ) ) + $res = wfQuery ( $sql2, DB_READ ) ; + while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + + + foreach ( $data AS $x ) { - # $t = new Title ; - # $t->newFromDBkey ( $x->l_from ) ; - # $t = $t->getText() ; $t = $wgLang->getNsText ( $x->cur_namespace ) ; if ( $t != "" ) $t .= ":" ; $t .= $x->cur_title ; @@ -867,6 +867,7 @@ class Parser $s .= $prefix . $trail ; return $s ; } + if( $ns == $media ) { $s .= $prefix . $sk->makeMediaLinkObj( $nt, $text ) . $trail; $wgLinkCache->addImageLinkObj( $nt ); -- 2.20.1