Index: autoloads/ezkeywordlist.php
===================================================================
--- autoloads/ezkeywordlist.php	(revision 4841)
+++ autoloads/ezkeywordlist.php	(working copy)
@@ -58,7 +58,7 @@
         );
     }
 
-    function modify( $tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
+    function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters )
     {
         $parentNodeID = $namedParameters['parent_node_id'];
 
@@ -66,9 +66,8 @@
         {
             case 'ezkeywordlist':
             {
-                include_once( 'lib/ezdb/classes/ezdb.php' );
                 $db = eZDB::instance();
-                
+
                 if( $parentNodeID )
                 {
                     $node = eZContentObjectTreeNode::fetch( $parentNodeID );
@@ -87,34 +86,38 @@
                 $languageFilter = " AND " . eZContentLanguage::languagesSQLFilter( 'ezcontentobject' );
                 $versionNameJoins .= eZContentLanguage::sqlFilter( 'ezcontentobject_name', 'ezcontentobject' );
 
-                $quotedClassIdentifiers = array();
+                $classIDs = array();
                 foreach ( (array)$namedParameters['class_identifier'] as $classIdentifier )
                 {
-                    $quotedClassIdentifiers[] = "'" . $db->escapeString( $classIdentifier ) . "'";
+                    $classIDs[] = (int)eZContentObjectTreeNode::classIDByIdentifier( $classIdentifier );
                 }
+                $classIDSQL = '';
+                if ( count( $classIDs ) > 0 )
+                    $classIDSQL = 'AND ' . $db->generateSQLINStatement( $classIDs, 'ezcontentobject.contentclass_id' );
 
                 $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 " . $db->generateSQLINStatement( $quotedClassIdentifiers, 'ezcontentclass.identifier' ) . "
-                                                $pathString
-                                                $parentNodeIDSQL " .
-                                                ( $namedParameters['depth'] > 0 ? ("AND ezcontentobject_tree.depth=" . (int)$namedParameters['depth']) : '' ) . "
-                                                $showInvisibleNodesCond
-                                                $sqlPermissionChecking[where]
-                                                $languageFilter
-                                                $versionNameJoins
-                                            ORDER BY ezkeyword.keyword ASC" );
+                                        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 . "
+                                            $classIDSQL
+                                            $pathString
+                                            $parentNodeIDSQL " .
+                                            ( $namedParameters['depth'] > 0 ? ("AND ezcontentobject_tree.depth=" . (int)$namedParameters['depth']) : '' ) . "
+                                            $showInvisibleNodesCond
+                                            $sqlPermissionChecking[where]
+                                            $languageFilter
+                                            $versionNameJoins
+                                        ORDER BY ezkeyword.keyword ASC");
                 $operatorValue = $rs;
             } break;
         }
