summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric J. Duran2011-06-07 23:33:40 (GMT)
committer Eric J. Duran2011-06-07 23:33:40 (GMT)
commit408c943c80d8d1898e2381dcfe0d638c974ab003 (patch)
tree2077bc63e30afef6bf7105d2fcfba35322e8662b
parent091fb03536b7e360767cd1614f6ec9d4690991c8 (diff)
Issue #1178918 by ericduran: Fixed Proper access check on fivestar block.
-rw-r--r--fivestar.module25
1 files changed, 19 insertions, 6 deletions
diff --git a/fivestar.module b/fivestar.module
index 0e66ac2..0c29016 100644
--- a/fivestar.module
+++ b/fivestar.module
@@ -583,14 +583,27 @@ function fivestar_block_info() {
}
function fivestar_block_view($delta = 0) {
- if (user_access('access content') && user_access('rate content') && (arg(2) == '' || arg(2) == 'view') && ($node = menu_get_object())) {
- $block = array('subject' => t('Rate This'));
- foreach (fivestar_get_tags() as $tag) {
- if (fivestar_validate_target('node', $node->nid, $tag)) {
- $block['content'][$tag] = fivestar_widget_form($node, $tag);
+ if (user_access('access content') && (arg(2) == '' || arg(2) == 'view') && ($node = menu_get_object())) {
+ if (user_access('rate content')) {
+ $block = array('subject' => t('Rate This'));
+ foreach (fivestar_get_tags() as $tag) {
+ if (fivestar_validate_target('node', $node->nid, $tag)) {
+ $block['content'][$tag] = fivestar_widget_form($node, $tag);
+ }
+ }
+ return $block;
+ }
+ else {
+ $block = array('subject' => t('Fivestars'));
+ foreach (fivestar_get_tags() as $tag) {
+ if (fivestar_validate_target('node', $node->nid, $tag)) {
+ $block['content'][$tag] = array(
+ '#markup' => fivestar_static('node', $node->nid, $node->type, $tag),
+ );
+ }
}
+ return $block;
}
- return $block;
}
}