42 if (!isset($params[
'id'])) {
48 $display_title = (isset($params[
'display']) && $params[
'display'] ==
'title') ?
true :
false;
49 $display_none = (isset($params[
'display']) && $params[
'display'] ==
'none') ?
true :
false;
50 $options = (isset($params[
'options'])) ? $params[
'options'] :
false;
51 $groups = (isset($params[
'groups'])) ? explode(
'|', $params[
'groups']) :
false;
52 $cache = (isset($params[
'cache'])) ? intval($params[
'cache']) :
false;
54 $block_id = intval($params[
'id']);
56 $block_handler =
$xoops->getHandlerBlock();
58 if (!isset($block_objs[$block_id])) {
59 $blockObj = $block_handler->get($block_id);
60 if (!is_object($blockObj)) {
63 $block_objs[$block_id] = $blockObj;
65 $blockObj = $block_objs[$block_id];
67 $user_groups =
$xoops->getUserGroups();
69 static $allowed_blocks;
70 if (count($allowed_blocks) == 0) {
71 $allowed_blocks = $block_handler->getAllBlocksByGroup($user_groups,
false);
75 if (!array_intersect($user_groups,
$groups)) {
79 if (!in_array($block_id, $allowed_blocks)) {
85 $blockObj->setVar(
'options',
$options);
89 $blockObj->setVar(
'bcachetime', $cache);
93 return $blockObj->getVar(
'title');
98 $block_renderer->theme =
$xoops->theme();
99 $block = $block_renderer->buildBlock($blockObj,
$tpl);
100 if (!$display_none) {
101 return $block[
'content'];
smarty_function_xoblock($params, &$smarty)