Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.300 diff -r1.300 block.module 400,401d399 < global $user, $theme_key; < 405,418c403,432 < $rids = array_keys($user->roles); < $result = db_query(db_rewrite_sql("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (". db_placeholders($rids) .") OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module", 'b', 'bid'), array_merge(array($theme_key), $rids)); < while ($block = db_fetch_object($result)) { < if (!isset($blocks[$block->region])) { < $blocks[$block->region] = array(); < } < // Use the user's block visibility setting, if necessary < if ($block->custom != 0) { < if ($user->uid && isset($user->block[$block->module][$block->delta])) { < $enabled = $user->block[$block->module][$block->delta]; < } < else { < $enabled = ($block->custom == 1); < } --- > $blocks = _block_load_blocks(); > } > > // Create an empty array if there were no entries > if (!isset($blocks[$region])) { > $blocks[$region] = array(); > } > > _block_render_blocks($blocks, $region); > > return $blocks[$region]; > } > > /** > * Load blocks information from the database > */ > function _block_load_blocks() { > global $user, $theme_key; > > $blocks = array(); > $rids = array_keys($user->roles); > $result = db_query(db_rewrite_sql("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (". db_placeholders($rids) .") OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module", 'b', 'bid'), array_merge(array($theme_key), $rids)); > while ($block = db_fetch_object($result)) { > if (!isset($blocks[$block->region])) { > $blocks[$block->region] = array(); > } > // Use the user's block visibility setting, if necessary > if ($block->custom != 0) { > if ($user->uid && isset($user->block[$block->module][$block->delta])) { > $enabled = $user->block[$block->module][$block->delta]; 421c435 < $enabled = TRUE; --- > $enabled = ($block->custom == 1); 422a437,440 > } > else { > $enabled = TRUE; > } 424,440c442,454 < // Match path if necessary < if ($block->pages) { < if ($block->visibility < 2) { < $path = drupal_get_path_alias($_GET['q']); < // Compare with the internal and path alias (if any). < $page_match = drupal_match_path($path, $block->pages); < if ($path != $_GET['q']) { < $page_match = $page_match || drupal_match_path($_GET['q'], $block->pages); < } < // When $block->visibility has a value of 0, the block is displayed on < // all pages except those listed in $block->pages. When set to 1, it < // is displayed only on those pages listed in $block->pages. < $page_match = !($block->visibility xor $page_match); < } < else { < $page_match = drupal_eval($block->pages); < } --- > // Match path if necessary > if ($block->pages) { > if ($block->visibility < 2) { > $path = drupal_get_path_alias($_GET['q']); > // Compare with the internal and path alias (if any). > $page_match = drupal_match_path($path, $block->pages); > if ($path != $_GET['q']) { > $page_match = $page_match || drupal_match_path($_GET['q'], $block->pages); > } > // When $block->visibility has a value of 0, the block is displayed on > // all pages except those listed in $block->pages. When set to 1, it > // is displayed only on those pages listed in $block->pages. > $page_match = !($block->visibility xor $page_match); 443c457 < $page_match = TRUE; --- > $page_match = drupal_eval($block->pages); 444a459,468 > } > else { > $page_match = TRUE; > } > $block->enabled = $enabled; > $block->page_match = $page_match; > $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block; > } > return $blocks; > } 446c470,485 < if ($enabled && $page_match) { --- > /** > * Render blocks > * > * @param $blocks > * an array of block elements as returned by _block_load_blocks() > * > * @param $region > * The name of a region. > */ > function _block_render_blocks(&$blocks, $region) { > foreach ($blocks[$region] as $block) { > // Render the block content if it has not been created already. > if (!isset($block->content)) { > // Erase the block from the static array - we'll put it back if it has content. > unset($blocks[$region]["{$block->module}_{$block->delta}"]); > if ($block->enabled && $block->page_match) { 483,487d521 < // Create an empty array if there were no entries < if (!isset($blocks[$region])) { < $blocks[$region] = array(); < } < return $blocks[$region];