| 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 |
|
|
| 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 { |
| 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 { |
| 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 |
} |
} |
| 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); |
| 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 |
} |
} |
| 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); |