- Patch by Ax: "The $block->path setting, which <cite>lets you define regular expressions to specify on which pages you want the specific blocks to be shown</cite> [1], has been disfunctional for some time (did it ever work at all?). one reason was the magic_quotes_gpc / stripslashes issue [2] - luckily, this got solved today. the other reason is a buggy implementation that a) compares the path to $PHP_SELF (which is the script name only, without any url params like "?op=view&id=13"; in the case of clean urls, worse, it is index.php always ...) instead of request_uri() (which does have these params and the proper value), and b) doesn't properly escape the regexp delimiter character in the expression ("/back\/slash/")."

4.2.x
Dries Buytaert 2003-02-27 22:48:32 +00:00
parent 6f6561a8b2
commit f21742c772
1 changed files with 2 additions and 3 deletions

View File

@ -158,15 +158,14 @@ function theme_init() {
* Render blocks available for $user and $region calling $theme->block($region).
*
* @param string $region main|left|right
* @param
*/
function theme_blocks($region) {
global $user, $PHP_SELF;
global $user, $REQUEST_URI;
$result = db_query("SELECT * FROM blocks WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = '%s' " : "") ."ORDER BY weight, module", $region == "left" ? 0 : 1);
while ($result && ($block = db_fetch_object($result))) {
if ((($block->status && (!$user->uid || !$block->custom)) || ($block->custom && $user->block[$block->module][$block->delta])) && (!$block->path || preg_match("|$block->path|", $PHP_SELF))) {
if ((($block->status && (!$user->uid || !$block->custom)) || ($block->custom && $user->block[$block->module][$block->delta])) && (!$block->path || preg_match('/'. str_replace('/', '\/', $block->path) .'/', request_uri()))) {
$block_data = module_invoke($block->module, "block", "view", $block->delta);
if ($block_data["content"]) {
theme("block", $block_data["subject"], $block_data["content"], $region);