--- tql/tql.module	2007-03-11 16:23:06.000000000 -0400
+++ sites/all/modules/contrib/tql/tql.module	2008-04-07 12:05:29.000000000 -0400
@@ -13,11 +13,12 @@
 function tql_menu($may_cache) {
   $items = array();
   if (!$may_cache) {
-    $items[] = array('path' => 'tql/autocomplete',
-      'title' => t('Autocomplete tql query'),
+    $items[] = array(
+      'path'     => 'tql/autocomplete',
+      'title'    => t('Autocomplete tql query'),
       'callback' => 'tql_autocomplete',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK);
+      'access'   => user_access('access content'),
+      'type'     => MENU_CALLBACK);
   }
   return $items;
 }
@@ -36,8 +37,8 @@ function tql_search($op = 'serach', $key
       if ($keys && $nid_sql = tql_generate_sql($keys)) {
         $search_results = array();
         // Create SQL for nids and number of results
-        $sql = 'SELECT nid FROM {node} WHERE status = 1 AND nid in (' . $nid_sql . ')';
-        $count_sql = 'SELECT COUNT(*) FROM {node} WHERE status = 1 AND nid in (' . $nid_sql . ')';
+        $sql = 'SELECT nid FROM {node} WHERE status = 1 AND nid in ('. $nid_sql .')';
+        $count_sql = 'SELECT COUNT(*) FROM {node} WHERE status = 1 AND nid in ('. $nid_sql .')';
         // Let 'pager' execute the query and make nice 'previous', 'next' links
         $result = pager_query($sql, 10, 0, $count_sql, $keys);
         while ($node = db_fetch_object($result)) {
@@ -51,7 +52,7 @@ function tql_search($op = 'serach', $key
           $extra = node_invoke_nodeapi($node, 'search result');
           // Construct search result entry
           $search_results[] = array(
-            'link' => url('node/' . $node->nid, NULL, NULL, TRUE),
+            'link' => url('node/'. $node->nid, NULL, NULL, TRUE),
             'title' => $node->title,
             'type' => node_get_types('name', $node),
             'user' => theme('username', $node),
@@ -113,7 +114,7 @@ function tql_views_tables() {
             'name' => t('Taxonomy: Query for @voc-name', array('@voc-name' => $voc->name)),
             'value' => array(
               '#type' => 'textfield',
-              '#autocomplete_path' => 'tql/autocomplete/' . $voc->vid,
+              '#autocomplete_path' => 'tql/autocomplete/'. $voc->vid,
             ),
             'option' => 'string',
             'operator' => array('Has'),
@@ -148,8 +149,8 @@ function tql_views_arguments() {
 /**
  * Callback when query filter is used as a views argument.
  */
-function tql_handler_arg_query ($op, &$query, $argtype, $arg = NULL) {
-  switch($op) {
+function tql_handler_arg_query($op, &$query, $argtype, $arg = NULL) {
+  switch ($op) {
     case 'summary':
       $query->ensure_table('term_data', true);
       $query->add_field('name', 'term_data');
@@ -201,7 +202,7 @@ function tql_handler_filter_query($op, $
   if ($sql) {
     $table = $filterinfo['table'];
     $query->ensure_table($table);
-    $query->add_where("node.nid in (" . $sql . ")");
+    $query->add_where("node.nid in (". $sql .")");
   }
   else {
     $query->add_where("FALSE");
@@ -220,17 +221,17 @@ function tql_handler_filter_query($op, $
  *   The generated SQL is a select query over a list of node ids and can be used 
  *   in a where clause as 'WHERE node.nid in ($sql_query)'.
  */
-function tql_generate_sql($query, $vocabularyList = NULL) {
+function tql_generate_sql($query, $vocabulary_list = NULL) {
   $sql = NULL;
 
   // Include needed files
-  include_once ('ast/TqlAbstractAstVisitor.php');
-  include_once ('ast/TqlAstDumper.php');
-  include_once ('ast/TqlErrorFormatter.php');
-  include_once ('ast/TqlNameToTid.php');
-  include_once ('ast/TqlMySqlGenerator.php');
-  include_once ('ast/TqlParser.php');
-  include_once ('ast/TqlLexer.php');
+  include_once('ast/TqlAbstractAstVisitor.php');
+  include_once('ast/TqlAstDumper.php');
+  include_once('ast/TqlErrorFormatter.php');
+  include_once('ast/TqlNameToTid.php');
+  include_once('ast/TqlMySqlGenerator.php');
+  include_once('ast/TqlParser.php');
+  include_once('ast/TqlLexer.php');
 
   // init the lexer with the query
   $lexer = new TqlLexer($query);
@@ -245,21 +246,21 @@ function tql_generate_sql($query, $vocab
   if ($parser->successful) {
 
     // map terms (strings) to term ids (integers)
-    $tagTank = tql_create_tag_tank ($parser->ast, $vocabularyList); 
+    $tag_tank = tql_create_tag_tank($parser->ast, $vocabulary_list); 
 
     // generate code for mysql
-    $sqlGenerator = new TqlMySqlGenerator();
-    $sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, 'term_node');
+    $sql_generator = new TqlMySqlGenerator();
+    $sql = $sql_generator->generate($parser->ast, $tag_tank->terms, 'term_node');
 
     // write the query nicely formatted
     $dumper = new TqlAstDumper();
     drupal_set_message($dumper->dump($parser->ast));
   }
   else {
-    tql_create_tag_tank ($parser->astParts, $vocabularyList); 
+    tql_create_tag_tank($parser->astParts, $vocabulary_list); 
     $errorPrinter = new TqlErrorFormatter();
     $error = $errorPrinter->error($parser->astParts, $query);
-    drupal_set_message (t("Error in query: ") .  $error,'error');
+    drupal_set_message(t("Error in query: ") . $error, 'error');
   }
   return $sql;
 }
@@ -269,27 +270,27 @@ function tql_generate_sql($query, $vocab
  *
  * @param $ast
  *   Object of type TqlNode or an array of such objects.
- * @param $vocabularyList
+ * @param $vocabulary_list
  *   Array of vocabulary IDs to use or 'null' if all should be taken into account.
  * @return
  *   TqlNameToId Object
  */
-function tql_create_tag_tank ($ast, $vocabularyList) {
-  $tagTank = new TqlNameToTid();
+function tql_create_tag_tank($ast, $vocabulary_list) {
+  $tag_tank = new TqlNameToTid();
   if (is_array($ast)) {
-    foreach ($ast as $partOfAST){
+    foreach ($ast as $part_of_ast) {
       // map terms (strings) to term ids (integers)   
-      $tagTank->computeTermIDs($partOfAST, $vocabularyList);
+      $tag_tank->computeTermIDs($part_of_ast, $vocabulary_list);
     }
   }
   else {
-    $tagTank->computeTermIDs($ast, $vocabularyList);
+    $tag_tank->computeTermIDs($ast, $vocabulary_list);
   }
   // report terms which do not occur in the selected vocabularies at all    
-  if (count($tagTank->missingTerms)>0){
-    drupal_set_message (t("The following terms were not found: ") .  implode(', ', $tagTank->missingTerms),'error');
+  if (count($tag_tank->missingTerms) > 0) {
+    drupal_set_message(t("The following terms were not found: ") .  implode(', ', $tag_tank->missingTerms), 'error');
   }
-  return $tagTank;
+  return $tag_tank;
 }
 
 /**
@@ -303,9 +304,9 @@ function tql_create_tag_tank ($ast, $voc
 function tql_autocomplete($vid = 0, $string = '') {
 
   // Include needed files
-  include_once ('ast/TqlAbstractAstVisitor.php');
-  include_once ('ast/TqlParser.php');
-  include_once ('ast/TqlLexer.php');
+  include_once('ast/TqlAbstractAstVisitor.php');
+  include_once('ast/TqlParser.php');
+  include_once('ast/TqlLexer.php');
 
   // Remove unneeded whitespace
   $string = trim($string);
@@ -333,7 +334,7 @@ function tql_autocomplete($vid = 0, $str
     // Base part of autocompleted string
     $prefix = substr($string, 0, $last_node->column);
     // Check if a quote is left of the last token
-    $has_left_quote = ($last_node->column-1 >= 0) ? $string[$last_node->column-1] == '"' : false;
+    $has_left_quote = ($last_node->column - 1 >= 0) ? $string[$last_node->column - 1] == '"' : false;
 
     // Construct response array
     $matches = array();
@@ -345,7 +346,7 @@ function tql_autocomplete($vid = 0, $str
           $name .= '"';
         }
         else {
-          $name = '"' . $name . '"';
+          $name = '"'. $name .'"';
         }
       }
       elseif ($has_left_quote) {
