--- /tmp/drupal/modules/block.module 2005-03-30 15:00:27.000000000 +0200 +++ block.module 2005-03-30 15:11:34.000000000 +0200 @@ -215,11 +215,11 @@ function block_admin_display() { if ($block['region'] == 0) { $left[] = $row; } - else { + if ($block['region'] == 1) { $right[] = $row; } } - else { + else if ($block['region'] <= 1) { $disabled[] = $row; } } @@ -423,7 +423,13 @@ function block_user($type, $edit, &$user /** * Return blocks available for current $user at $region. * - * @param $region main|left|right + * @param $region left|right|all + * + * @param $regions + * + * This is an optional array and contains map(s) from the string $region to + * the numerical region index(es) in the blocks table. See default value + * for examples. * * @return array of block objects, indexed with module_delta * @@ -433,13 +439,13 @@ function block_user($type, $edit, &$user * to mess around with this module_delta construct. currently, * "blocks" has no primary key defined (bad)! */ -function block_list($region) { +function block_list($region, $regions = array('left' => 0, 'right' => 1, 'all' => '0, 1')) { global $user; static $blocks = array(); if (!isset($blocks[$region])) { $blocks[$region] = array(); - $result = db_query('SELECT * FROM {blocks} WHERE status = 1 '. ($region != 'all' ? 'AND region = %d ' : '') .'ORDER BY weight, module', $region == 'left' ? 0 : 1); + $result = db_query("SELECT * FROM {blocks} WHERE status = 1 AND region IN ('%s') ORDER BY weight, module", $regions[$region]); while ($result && ($block = db_fetch_array($result))) { // Use the user's block visibility setting, if necessary