function setupBlock() { $showFlag = 0; $mid = 0; if ($this->mController->mRoot->mContext->mModule != null) { $showFlag = preg_match("/index\\.php\$/i", xoops_getenv('PHP_SELF')) && $this->mController->mRoot->mContext->mXoopsConfig['startpage'] == $this->mController->mRoot->mContext->mXoopsModule->get('dirname'); $mid = $this->mController->mRoot->mContext->mXoopsModule->get('mid'); } else { // // If you does not have module_contoller, this request is to toppage or other pages of toppage. // // $mid = preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) ? -1 : 0; $pathArray = parse_url(!empty($_SERVER['PATH_INFO']) ? substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])) : $_SERVER['PHP_SELF']); $mid = preg_match("#(/index\\.php|/)\$#i", @$pathArray['path']) ? -1 : 0; } $blockHandler =& xoops_gethandler('block'); $showCenterFlag = SHOW_CENTERBLOCK_LEFT | SHOW_CENTERBLOCK_CENTER | SHOW_CENTERBLOCK_RIGHT; $showRightFlag = SHOW_SIDEBLOCK_RIGHT; $showFlag = SHOW_SIDEBLOCK_LEFT | $showRightFlag | $showCenterFlag; $groups = is_object($this->mController->mRoot->mContext->mXoopsUser) ? $this->mController->mRoot->mContext->mXoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; $blockObjects =& $blockHandler->getBlocks($groups, $mid, $showFlag); foreach ($blockObjects as $blockObject) { $block =& Legacy_Utils::createBlockProcedure($blockObject); if ($block->prepare() !== false) { $this->mController->_mBlockChain[] =& $block; } unset($block); unset($blockObject); } }
function renderCell4BlockOptions($block_data) { if ($this->target_dirname && substr($this->target_dirname, 0, 1) != '_') { $langman =& D3LanguageManager::getInstance(); $langman->read('admin.php', $this->target_dirname); } $bid = intval($block_data['bid']); $block = new XoopsBlock($bid); $legacy_block =& Legacy_Utils::createBlockProcedure($block); return $legacy_block->getOptionForm(); }
function renderCell4BlockOptions($block_data) { if ($this->target_dirname && substr($this->target_dirname, 0, 1) != '_') { $langman =& D3LanguageManager::getInstance(); $langman->read('admin.php', $this->target_dirname); } $bid = intval($block_data['bid']); //HACK by domifara // $block = new XoopsBlock( $bid ) ; $handler =& xoops_gethandler('block'); $block =& $handler->create(false); $block->load($bid); $legacy_block =& Legacy_Utils::createBlockProcedure($block); return $legacy_block->getOptionForm(); }
/** * * @package CubeUtils * @version $Id: xoops_version.php 1294 2008-01-31 05:32:20Z nobunobu $ * @copyright Copyright 2006-2008 NobuNobuXOOPS Project <http://sourceforge.net/projects/nobunobuxoops/> * @author NobuNobu <*****@*****.**> * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2 * */ function cubeUtils_GetBlock($bid, $useCache = true) { $blockHandler =& xoops_gethandler('block'); $blockObject =& $blockHandler->get($bid); if (!$blockObject) { return false; } $blockProcedure =& Legacy_Utils::createBlockProcedure($blockObject); if ($blockProcedure->prepare()) { $root =& XCube_Root::getSingleton(); $controller = $root->mController; $context =& $root->mContext; $usedCacheFlag = false; $cacheInfo = null; if ($useCache) { if ($controller->isEnableCacheFeature() && $blockProcedure->isEnableCache()) { $cacheInfo =& $blockProcedure->createCacheInfo(); $controller->mSetBlockCachePolicy->call(new XCube_Ref($cacheInfo)); $filepath = $cacheInfo->getCacheFilePath(); if ($cacheInfo->isEnableCache() && $controller->existActiveCacheFile($filepath, $blockProcedure->getCacheTime())) { $content = $controller->loadCache($filepath); if ($blockProcedure->isDisplay() && !empty($content)) { $block['content'] = $content; } $usedCacheFlag = true; } } } if (!$usedCacheFlag) { $blockProcedure->execute(); $renderBuffer = null; if ($blockProcedure->isDisplay()) { $renderBuffer =& $blockProcedure->getRenderTarget(); $block['content'] = $renderBuffer->getResult(); } else { $renderBuffer = new XCube_RenderTarget(); } if ($useCache) { if ($controller->isEnableCacheFeature() && $blockProcedure->isEnableCache() && is_object($cacheInfo) && $cacheInfo->isEnableCache()) { $controller->cacheRenderTarget($cacheInfo->getCacheFilePath(), $renderBuffer); } } } } return $block; }
/** * Gets rendered HTML buffer of the block optional edit form. */ function _getOptionForm() { $block =& Legacy_Utils::createBlockProcedure($this->mObject); return $block->getOptionForm(); }
/** * ブロックプロシージャを生成する * @param XoopsBlock $xoopsBlock * @returns Legacy_BlockProcedure */ protected function _getBlockProcedure(XoopsBlock $xoopsBlock) { return Legacy_Utils::createBlockProcedure($xoopsBlock); }
function executeXCL2CLASS($dummy = '', $max_entries = '') { if (!$this->init()) { return array(); } // file check if (!file_exists($this->func_file)) { $this->errors[] = _MD_D3PIPES_ERR_INVALIDFILEINBLOCK . "\n" . $this->func_file . ' (' . get_class($this) . ')'; return array(); } require_once $this->func_file; //d3module and function type module check if (function_exists($this->func_name) || array_key_exists('disable_renderer', $this->block_options)) { $block = $this->executeStandard($dummy, $max_entries); return $block; } //---------- get block object ----------// //XCL modules $db =& XoopsDatabaseFactory::getDatabaseConnection(); //chanhe class_name -> func_name //only no xoos_trust_path module class type , convert class_name to func_name //you need to set $this->func_name when xoos_trust_path module class type if (!empty($this->class_name) && empty($this->func_name)) { if (!empty($this->trustdirname)) { $this->func_name = 'cl::' . preg_replace('/^' . $this->trustdirname . '_/i', '', $this->class_name); } else { $this->func_name = 'cl::' . preg_replace('/^' . $this->target_dirname . '_/i', '', $this->class_name); } } //get bid $sql = "SELECT bid FROM " . $db->prefix("newblocks") . " WHERE dirname=" . $db->quoteString($this->target_dirname) . " AND show_func=" . $db->quoteString($this->func_name) . " AND block_type='M' "; $result = $db->query($sql); list($bid) = $db->fetchRow($result); // bid check old function if (empty($bid)) { $block = $this->executeStandard($dummy, $max_entries); return $block; } //---------- module object check ----------// $module_handler =& xoops_gethandler('module'); $module = $module_handler->getByDirname($this->target_dirname); if (!is_object($module) || !$module->getVar('isactive')) { $this->errors[] = _MD_D3PIPES_ERR_INVALIDPIPEIDINBLOCK . "\n" . ' modulet not found : target_dirname=' . $this->target_dirname . ' func_name=' . $this->func_name . ' (' . get_class($this) . ')'; return array(); } //---------- get block object ----------// $blockHandler =& xoops_gethandler('block'); $blockObject =& $blockHandler->get($bid); if (!is_object($blockObject)) { $this->errors[] = _MD_D3PIPES_ERR_INVALIDPIPEIDINBLOCK . "\n" . ' block object not found : target_dirname=' . $this->target_dirname . ' func_name=' . $this->func_name . ' (' . get_class($this) . ')'; return array(); } //XCL AND other Xoops single module $options_separated = implode('|', $this->block_options); $blockObject->set('options', $options_separated); //get tager of block $blockProcedure =& Legacy_Utils::createBlockProcedure($blockObject); $blockProcedure->prepare(); $blockProcedure->execute(); $target =& $blockProcedure->getRenderTarget(); $buffer = $target->getAttributes(); //class type $block = $buffer; // update lastfetch_time $db->queryF("UPDATE " . $db->prefix($this->mydirname . "_pipes") . " SET lastfetch_time=UNIX_TIMESTAMP() WHERE pipe_id={$this->pipe_id}"); return $this->reassign($block); }