Index: block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.262 diff -u -r1.262 block.module --- block.module 28 May 2007 06:08:39 -0000 1.262 +++ block.module 1 Jun 2007 11:22:54 -0000 @@ -153,12 +153,8 @@ * @return * Blocks currently exported by modules. */ -function _block_rehash() { - global $theme_key; - - init_theme(); - - $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $theme_key); +function _block_rehash($theme) { + $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $theme); while ($old_block = db_fetch_object($result)) { $old_blocks[$old_block->module][$old_block->delta] = $old_block; } @@ -199,7 +195,7 @@ db_lock_table('blocks'); // Remove all blocks from table. - db_query("DELETE FROM {blocks} WHERE theme = '%s'", $theme_key); + db_query("DELETE FROM {blocks} WHERE theme = '%s'", $theme); // Reinsert new set of blocks into table. foreach ($blocks as $block) { @@ -207,7 +203,7 @@ 'visibility' => NULL, 'throttle' => NULL, ); - db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, title) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, '%s')", $block['module'], $block['delta'], $theme_key, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['title']); + db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, title) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, '%s')", $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['title']); } db_unlock_tables(); @@ -233,7 +229,7 @@ init_theme(); // Fetch and sort blocks - $blocks = _block_rehash(); + $blocks = _block_rehash($theme_key); usort($blocks, '_block_compare'); $throttle = module_exists('throttle'); @@ -256,7 +252,7 @@ if ($throttle) { $form[$i]['throttle'] = array('#type' => 'checkbox', '#default_value' => isset($block['throttle']) ? $block['throttle'] : FALSE); } - $form[$i]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta'])); + $form[$i]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], array('query' => drupal_get_destination()))); if ($block['module'] == 'block') { $form[$i]['delete'] = array('#value' => l(t('delete'), 'admin/build/block/delete/'. $block['delta'])); } @@ -516,8 +512,6 @@ module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values); drupal_set_message(t('The block configuration has been saved.')); cache_clear_all(); - $form_state['redirect'] = 'admin/build/block'; - return; } }