Index: modules/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v retrieving revision 1.217 diff -u -F^f -r1.217 taxonomy.module --- modules/taxonomy.module 25 Jul 2005 04:55:37 -0000 1.217 +++ modules/taxonomy.module 20 Aug 2005 22:04:44 -0000 @@ -136,7 +132,7 @@ function taxonomy_form_vocabulary($edit return form($form); } -function taxonomy_save_vocabulary($edit) { +function taxonomy_save_vocabulary(&$edit) { $edit['nodes'] = ($edit['nodes']) ? $edit['nodes'] : array(); $edit['weight'] = ($edit['weight']) ? $edit['weight'] : 0; @@ -165,7 +161,7 @@ function taxonomy_save_vocabulary($edit) cache_clear_all(); - return array('status' => $status, 'object' => $edit); + return $status; } function taxonomy_del_vocabulary($vid) { @@ -251,7 +247,7 @@ function taxonomy_form_term($edit = arra return form($form); } -function taxonomy_save_term($edit) { +function taxonomy_save_term(&$edit) { if ($edit['tid'] && $edit['name']) { $data = array('name' => $edit['name'], 'description' => $edit['description'], 'weight' => $edit['weight']); @@ -307,7 +303,7 @@ function taxonomy_save_term($edit) { cache_clear_all(); - return array('status' => $status, 'object' => $edit); + return $status; } function taxonomy_del_term($tid) { @@ -608,8 +604,9 @@ function taxonomy_node_save($nid, $terms } if (!$typed_term_tid) { - list($status, $object) = array_values(taxonomy_save_term(array('vid' => $vid, 'name' => $typed_term))); - $typed_term_tid = $object['tid']; + $edit = array('vid' => $vid, 'name' => $typed_term); + $status = taxonomy_save_term($edit); + $typed_term_tid = $edit['tid']; } db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $typed_term_tid); @@ -1160,8 +1157,7 @@ function taxonomy_admin() { } case t('Submit'): if (arg(3) == 'vocabulary') { - list($status, $object) = array_values(taxonomy_save_vocabulary($edit)); - switch ($status) { + switch (taxonomy_save_vocabulary($edit)) { case SAVED_NEW: drupal_set_message(t('Created new vocabulary %name.', array('%name' => theme('placeholder', $edit['name'])))); break; @@ -1174,8 +1170,7 @@ function taxonomy_admin() { } } else { - list($status, $object) = array_values(taxonomy_save_term($edit)); - switch ($status) { + switch (taxonomy_save_term($edit)) { case SAVED_NEW: drupal_set_message(t('Created new term %term.', array('%term' => theme('placeholder', $edit['name'])))); break; Index: modules/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum.module,v retrieving revision 1.261 diff -u -F^f -r1.261 forum.module --- modules/forum.module 18 Aug 2005 21:53:55 -0000 1.261 +++ modules/forum.module 20 Aug 2005 22:04:45 -0000 @@ -91,27 +91,38 @@ function forum_admin() { break; } else { + $name = $edit['name']; $edit['name'] = 0; } case t('Submit'): - list($status, $object) = array_values(taxonomy_save_term($edit)); + $status = taxonomy_save_term($edit); if (arg(3) == 'container') { - $containers = variable_get('forum_containers', array()); - $containers[] = $edit['tid']; - variable_set('forum_containers', $containers); - if ($status == SAVED_NEW) { - drupal_set_message(t('Created new forum container %term.', array('%term' => theme('placeholder', $edit['name'])))); - } - else { - drupal_set_message(t('The forum container %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + switch ($status) { + case SAVED_NEW: + $containers = variable_get('forum_containers', array()); + $containers[] = $edit['tid']; + variable_set('forum_containers', $containers); + drupal_set_message(t('Created new forum container %term.', array('%term' => theme('placeholder', $edit['name'])))); + break; + case SAVED_UPDATED: + drupal_set_message(t('The forum container %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + break; + case SAVED_UPDATED: + drupal_set_message(t('The forum container %term has been deleted.', array('%term' => theme('placeholder', $name)))); + break; } } else { - if ($status == SAVED_NEW) { - drupal_set_message(t('Created new forum %term.', array('%term' => theme('placeholder', $edit['name'])))); - } - else { - drupal_set_message(t('The forum %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + switch ($status) { + case SAVED_NEW: + drupal_set_message(t('Created new forum %term.', array('%term' => theme('placeholder', $edit['name'])))); + break; + case SAVED_UPDATED: + drupal_set_message(t('The forum %term has been updated.', array('%term' => theme('placeholder', $edit['name'])))); + break; + case SAVED_DELETED: + drupal_set_message(t('The forum %term has been deleted.', array('%term' => theme('placeholder', $name)))); + break; } } drupal_goto('admin/forum'); @@ -293,8 +304,9 @@ function _forum_get_vid() { // Check to see if a forum vocabulary exists $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module='%s'", 'forum')); if (!$vid) { - list($status, $object) = array_values(taxonomy_save_vocabulary(array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum')))); - $vid = $object['vid']; + $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum')); + taxonomy_save_vocabulary($edit); + $vid = $edit['vid']; } variable_set('forum_nav_vocabulary', $vid); }