/[drupal]/contributions/modules/recipe/recipe.module
ViewVC logotype

Diff of /contributions/modules/recipe/recipe.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.72.2.8, Wed Oct 17 17:39:34 2007 UTC revision 1.72.2.9, Sun Apr 20 18:31:44 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: recipe.module,v 1.72.2.7 2007/10/17 14:45:02 marble Exp $  // $Id: recipe.module,v 1.81 2007/10/17 17:40:56 marble Exp $
3    
4  /**  /**
5   * @file   * @file
6   * recipe.module - share recipes   * recipe.module - share recipes
7   * for drupal 5.x   * for drupal 5.x
8   *   *
9   * @todo   * @todo
10   */   */
11    
# Line 175  function recipe_form(&$node) { Line 175  function recipe_form(&$node) {
175    if ($node->ingredients) {    if ($node->ingredients) {
176      foreach ($node->ingredients as $id => $ingredient) {      foreach ($node->ingredients as $id => $ingredient) {
177        $num_ingredients = $id+1;        $num_ingredients = $id+1;
178        if ($id == 0) {        if ($id == 0) {
179          $j = '0';          $j = '0';
180        }        }
181        else {        else {
# Line 258  function recipe_form(&$node) { Line 258  function recipe_form(&$node) {
258    } // if ($node->ingredients)    } // if ($node->ingredients)
259    // Add ten more spots for ingredients than are already used    // Add ten more spots for ingredients than are already used
260    for ($i = $num_ingredients; $i < $num_ingredients+10; $i++) {    for ($i = $num_ingredients; $i < $num_ingredients+10; $i++) {
261      if ($i == 0) {      if ($i == 0) {
262        $j = '0';        $j = '0';
263      }      }
264      else {      else {
# Line 573  function recipe_ingredient_id_from_name( Line 573  function recipe_ingredient_id_from_name(
573      if (!$ingredient_id) {      if (!$ingredient_id) {
574        global $active_db;        global $active_db;
575        $node_link = db_result(db_query("SELECT nid FROM {node} WHERE title = '%s'", $name));        $node_link = db_result(db_query("SELECT nid FROM {node} WHERE title = '%s'", $name));
576    
577        db_query("INSERT INTO {recipe_ingredient} (name, link) VALUES ('%s', '%s')", $name, $node_link);        db_query("INSERT INTO {recipe_ingredient} (name, link) VALUES ('%s', '%s')", $name, $node_link);
578        $ingredient_id = db_result(db_query("SELECT id FROM {recipe_ingredient} WHERE LOWER(name)='%s'", trim(strtolower($name))));        $ingredient_id = db_result(db_query("SELECT id FROM {recipe_ingredient} WHERE LOWER(name)='%s'", trim(strtolower($name))));
579      }      }
# Line 664  function recipe_ingredient_quantity_from Line 664  function recipe_ingredient_quantity_from
664      else {      else {
665        /* remove just the curly braces, but keep everything between them */        /* remove just the curly braces, but keep everything between them */
666        $ingredient_quantity = preg_replace('/{|}/', '', $ingredient_quantity);        $ingredient_quantity = preg_replace('/{|}/', '', $ingredient_quantity);
667      }      }
668    }    }
669    
670    return filter_xss_admin($ingredient_quantity);    return filter_xss_admin($ingredient_quantity);
# Line 1434  function theme_node_recipe($node, $yield Line 1434  function theme_node_recipe($node, $yield
1434      foreach ($vocabs as $vocab) {      foreach ($vocabs as $vocab) {
1435        $terms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vocab->vid);        $terms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vocab->vid);
1436        if (count($terms) > 0) {        if (count($terms) > 0) {
1437          $term = array_shift($terms);          $summary .= '<tr><th>'.$vocab->name.'</th><td>';
1438          $summary .= '<tr><th>'.$vocab->name.'</th><td>'.l($term->name, 'taxonomy/term/'.$term->tid).'</td></tr>';                foreach ($terms as $term) {
1439                $summary .= l($term->name, 'taxonomy/term/'.$term->tid).' ';
1440                  }
1441                  $summary .= '</td></tr>';
1442        }        }
1443      }      }
1444    }    }
# Line 1617  function recipe_import_from_46() { Line 1620  function recipe_import_from_46() {
1620          $out .= t('Got unit id @unitid', array('@unitid' => $unito->id))."\n";          $out .= t('Got unit id @unitid', array('@unitid' => $unito->id))."\n";
1621          $unitid = $unito->id;          $unitid = $unito->id;
1622        } else {        } else {
1623          $name = $unit ." ". $name;          $name = $unit ." ". $name;
1624        }        }
1625      }      }
1626      $iid = recipe_ingredient_id_from_name($name);      $iid = recipe_ingredient_id_from_name($name);

Legend:
Removed from v.1.72.2.8  
changed lines
  Added in v.1.72.2.9

  ViewVC Help
Powered by ViewVC 1.1.2