diff modules/taxonomy/taxonomy.module @ 7:fff6d4c8c043 6.3

Drupal 6.3
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:30:28 +0100
parents 2427550111ae
children 589fb7c02327
line wrap: on
line diff
--- a/modules/taxonomy/taxonomy.module	Tue Dec 23 14:30:08 2008 +0100
+++ b/modules/taxonomy/taxonomy.module	Tue Dec 23 14:30:28 2008 +0100
@@ -1,5 +1,5 @@
 <?php
-// $Id: taxonomy.module,v 1.414.2.1 2008/04/09 21:11:51 goba Exp $
+// $Id: taxonomy.module,v 1.414.2.4 2008/06/25 08:00:57 goba Exp $
 
 /**
  * @file
@@ -49,7 +49,7 @@
   if ($type == 'taxonomy terms' && $node != NULL) {
     $links = array();
     // If previewing, the terms must be converted to objects first.
-    if ($node->build_mode == NODE_BUILD_PREVIEW) {
+    if (isset($node->build_mode) && $node->build_mode == NODE_BUILD_PREVIEW) {
       $node->taxonomy = taxonomy_preview_terms($node);
     }
     if (!empty($node->taxonomy)) {
@@ -908,6 +908,7 @@
     else {
       $result = db_query(db_rewrite_sql("SELECT t.tid, COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.status = 1 AND n.type = '%s' GROUP BY t.tid"), $type);
     }
+    $count[$type] = array();
     while ($term = db_fetch_object($result)) {
       $count[$type][$term->tid] = $term->c;
     }
@@ -956,7 +957,7 @@
  *   An array of matching term objects.
  */
 function taxonomy_get_term_by_name($name) {
-  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER(t.name) LIKE LOWER('%s')", 't', 'tid'), trim($name));
+  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s')", 't', 'tid'), trim($name));
   $result = array();
   while ($term = db_fetch_object($db_result)) {
     $result[] = $term;