Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
300f91f4
Commit
300f91f4
authored
Aug 06, 2004
by
Steven Wittens
Browse files
- Cleaning up the rediculously long 'if' statement for checking block visibility.
-
#9811
: Remove session ID before matching block path
parent
cabd6c89
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/block.module
View file @
300f91f4
...
...
@@ -351,9 +351,23 @@ function block_list($region) {
if
(
$block
[
'custom'
]
&&
$user
->
uid
&&
!
isset
(
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]]))
{
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]]
=
$block
[
'status'
];
}
$base
=
parse_url
(
$base_url
);
if
(((
$block
[
'status'
]
&&
(
!
$user
->
uid
||
!
$block
[
'custom'
]))
||
(
$block
[
'custom'
]
&&
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]]))
&&
(
!
$block
[
'path'
]
||
preg_match
(
$block
[
'path'
],
ereg_replace
(
'^/(\?q=)?'
,
''
,
str_replace
(
$base
[
'path'
],
''
,
request_uri
())))))
{
// Determine block visibility
$enabled
=
$block
[
'status'
]
&&
(
!
$user
->
uid
||
!
$block
[
'custom'
]);
$custom
=
$block
[
'custom'
]
&&
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]];
// Match path if necessary
if
(
$block
[
'path'
])
{
$base
=
parse_url
(
$base_url
);
$session
=
session_name
()
.
'='
.
session_id
();
$url
=
str_replace
(
array
(
$base
[
'path'
],
'?'
.
$session
),
''
,
request_uri
());
$matched
=
preg_match
(
$block
[
'path'
],
ereg_replace
(
'^/(\?q=)?'
,
''
,
$path
);
}
else
{
$matched
=
true
;
}
if
((
$enabled
||
$custom
)
&&
$matched
)
{
/*
** Check the current throttle status and see if block should be displayed
** based on server load.
...
...
modules/block/block.module
View file @
300f91f4
...
...
@@ -351,9 +351,23 @@ function block_list($region) {
if
(
$block
[
'custom'
]
&&
$user
->
uid
&&
!
isset
(
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]]))
{
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]]
=
$block
[
'status'
];
}
$base
=
parse_url
(
$base_url
);
if
(((
$block
[
'status'
]
&&
(
!
$user
->
uid
||
!
$block
[
'custom'
]))
||
(
$block
[
'custom'
]
&&
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]]))
&&
(
!
$block
[
'path'
]
||
preg_match
(
$block
[
'path'
],
ereg_replace
(
'^/(\?q=)?'
,
''
,
str_replace
(
$base
[
'path'
],
''
,
request_uri
())))))
{
// Determine block visibility
$enabled
=
$block
[
'status'
]
&&
(
!
$user
->
uid
||
!
$block
[
'custom'
]);
$custom
=
$block
[
'custom'
]
&&
$user
->
block
[
$block
[
'module'
]][
$block
[
'delta'
]];
// Match path if necessary
if
(
$block
[
'path'
])
{
$base
=
parse_url
(
$base_url
);
$session
=
session_name
()
.
'='
.
session_id
();
$url
=
str_replace
(
array
(
$base
[
'path'
],
'?'
.
$session
),
''
,
request_uri
());
$matched
=
preg_match
(
$block
[
'path'
],
ereg_replace
(
'^/(\?q=)?'
,
''
,
$path
);
}
else
{
$matched
=
true
;
}
if
((
$enabled
||
$custom
)
&&
$matched
)
{
/*
** Check the current throttle status and see if block should be displayed
** based on server load.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment