Index: autoloads/ezkeywordlist.php
===================================================================
--- autoloads/ezkeywordlist.php	(revision 4841)
+++ autoloads/ezkeywordlist.php	(working copy)
@@ -50,18 +50,18 @@
                                                                 'default' => 0 ) ) );
     }
 
-    function modify( $tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
+    function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters )
     {
         $classIdentifier = $namedParameters['class_identifier'];
         $parentNodeID = $namedParameters['parent_node_id'];
+        $classIdentifierSQL = '';
 
         switch ( $operatorName )
         {
             case 'ezkeywordlist':
             {
-                include_once( 'lib/ezdb/classes/ezdb.php' );
                 $db = eZDB::instance();
-                
+
                 if( $parentNodeID )
                 {
                     $node = eZContentObjectTreeNode::fetch( $parentNodeID );
@@ -70,6 +70,12 @@
                     $parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int)$parentNodeID;
                 }
 
+                if( $classIdentifier )
+                {
+                    $classID = eZContentObjectTreeNode::classIDByIdentifier( $classIdentifier );
+                    $classIdentifierSQL = "AND ezcontentobject.contentclass_id = '" . $classID . "'";
+                }
+
                 $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( true, false );
                 $limitation = false;
                 $limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
@@ -80,31 +86,32 @@
                 $languageFilter = " AND " . eZContentLanguage::languagesSQLFilter( 'ezcontentobject' );
                 $versionNameJoins .= eZContentLanguage::sqlFilter( 'ezcontentobject_name', 'ezcontentobject' );
 
-                $rs = $db->arrayQuery( "SELECT DISTINCT ezkeyword.keyword
-                                            FROM ezkeyword_attribute_link,
-                                                 ezkeyword,
-                                                 ezcontentobject,
-                                                 ezcontentobject_name,
-                                                 ezcontentobject_attribute,
-                                                 ezcontentobject_tree,
-                                                 ezcontentclass
-                                                 $sqlPermissionChecking[from]
-                                            WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id
-                                                AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id
-                                                AND ezcontentobject_tree.contentobject_id = ezcontentobject_attribute.contentobject_id
-                                                AND ezkeyword.class_id = ezcontentclass.id
-                                                AND ezcontentclass.identifier = '" . $classIdentifier . "'
-                                                $pathString
-                                                $parentNodeIDSQL
-                                                $showInvisibleNodesCond
-                                                $sqlPermissionChecking[where]
-                                                $languageFilter
-                                                $versionNameJoins
-                                            ORDER BY ezkeyword.keyword ASC" );
+                $rs = $db->arrayQuery( "SELECT DISTINCT ezkeyword.keyword 
+                                        FROM ezkeyword,
+                                            ezkeyword_attribute_link
+                                            $sqlPermissionChecking[from]
+                                        LEFT JOIN ezcontentobject_attribute
+                                            ON ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id
+                                        LEFT JOIN ezcontentobject
+                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject.id
+                                        LEFT JOIN ezcontentobject_tree
+                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id
+                                        LEFT JOIN ezcontentobject_name
+                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject_name.contentobject_id
+                                        WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id
+                                            AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "
+                                            $pathString
+                                            $classIdentifierSQL
+                                            $parentNodeIDSQL
+                                            $showInvisibleNodesCond
+                                            $sqlPermissionChecking[where]
+                                            $languageFilter
+                                            $versionNameJoins
+                                        ORDER BY ezkeyword.keyword ASC");
                 $operatorValue = $rs;
             } break;
         }
     }
 }
 
-?>
\ No newline at end of file
+?>
