diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-12-18 07:52:59 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-12-18 07:52:59 +0000 |
commit | 7307de5c9e7442d9b744d03d6ad7165767ed78ca (patch) | |
tree | 88d603e61fb8ea26a7544f644b1f6a8b846477ed | |
parent | 22869afd381c8c49d421aed9c86988b119dfae03 (diff) | |
download | brdo-7307de5c9e7442d9b744d03d6ad7165767ed78ca.tar.gz brdo-7307de5c9e7442d9b744d03d6ad7165767ed78ca.tar.bz2 |
- Patch #14532 by andre molnar: tidied up some block.module code.
-rw-r--r-- | modules/block.module | 9 | ||||
-rw-r--r-- | modules/block/block.module | 9 |
2 files changed, 6 insertions, 12 deletions
diff --git a/modules/block.module b/modules/block.module index d7e4b7e9b..5b0733a87 100644 --- a/modules/block.module +++ b/modules/block.module @@ -390,7 +390,7 @@ function block_user($type, $edit, &$user, $category = NULL) { * "blocks" has no primary key defined (bad)! */ function block_list($region) { - global $user, $base_url; + global $user; static $blocks = array(); if (!isset($blocks[$region])) { @@ -413,12 +413,9 @@ function block_list($region) { // Match path if necessary if ($block['pages']) { - $base = parse_url($base_url); - $session = session_name() .'='. session_id(); - $url = str_replace(array($base['path'], '?'. $session), '', request_uri()); - $url = ereg_replace('^/(\?q=)?', '', $url); + $path = drupal_get_path_alias($_GET['q']); $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1\2'), preg_quote($block['pages'], '/')) .')$/'; - $matched = !($block['visibility'] xor preg_match($regexp, $url)); + $matched = !($block['visibility'] xor preg_match($regexp, $path)); } else { $matched = TRUE; diff --git a/modules/block/block.module b/modules/block/block.module index d7e4b7e9b..5b0733a87 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -390,7 +390,7 @@ function block_user($type, $edit, &$user, $category = NULL) { * "blocks" has no primary key defined (bad)! */ function block_list($region) { - global $user, $base_url; + global $user; static $blocks = array(); if (!isset($blocks[$region])) { @@ -413,12 +413,9 @@ function block_list($region) { // Match path if necessary if ($block['pages']) { - $base = parse_url($base_url); - $session = session_name() .'='. session_id(); - $url = str_replace(array($base['path'], '?'. $session), '', request_uri()); - $url = ereg_replace('^/(\?q=)?', '', $url); + $path = drupal_get_path_alias($_GET['q']); $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1\2'), preg_quote($block['pages'], '/')) .')$/'; - $matched = !($block['visibility'] xor preg_match($regexp, $url)); + $matched = !($block['visibility'] xor preg_match($regexp, $path)); } else { $matched = TRUE; |