$block['title'] = $myblock->getVar('title', 'E'); $block['content'] = $myblock->getVar('content', 'n'); $block['modules'] =& $bmodule; $block['ctype'] = isset($bctype) ? $bctype : $myblock->getVar('c_type'); $block['is_custom'] = true; $block['cachetime'] = intval($bcachetime); echo '<a href="myblocksadmin.php">' . _AM_BADMIN . '</a> <span style="font-weight:bold;">»»</span> ' . $block['form_title'] . '<br /><br />'; include dirname(__FILE__) . '/../admin/myblockform.php'; //GIJ //echo '<a href="admin.php?fct=blocksadmin">'. _AM_BADMIN .'</a> <span style="font-weight:bold;">»»</span> '.$block['form_title'].'<br /><br />'; //include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php'; $form->addElement($xoopsGTicket->getTicketXoopsForm(__LINE__, 1800, 'myblocksadmin')); //GIJ $form->display(); $original_level = error_reporting(E_ALL); echo "\r\n <table width='100%' class='outer' cellspacing='1'>\r\n <tr>\r\n <th>" . $myblock->getVar('title') . "</th>\r\n </tr>\r\n <tr>\r\n <td class='odd'>" . $myblock->getContent('S', $bctype) . "</td>\r\n </tr>\r\n </table>\n"; error_reporting($original_level); xoops_cp_footer(); /* echo '<script type="text/javascript"> preview_window = openWithSelfMain("'.XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file='.$dummyfile.'", "popup", 250, 200); </script>';*/ exit; } /* if ($op == 'previewpopup') { if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { exit('Invalid Referer'); } $file = str_replace('..', '', XOOPS_CACHE_PATH.'/'.trim($_GET['file'])); if (file_exists($file)) { include $file; @unlink($file);
$block['form_title'] = _AM_EDITBLOCK; $myblock = new XoopsBlock($bid); $block['name'] = $myblock->getVar('name'); } else { if ($op == 'save') { $block['form_title'] = _AM_ADDBLOCK; } else { $block['form_title'] = _AM_CLONEBLOCK; } $myblock = new XoopsBlock(); $myblock->setVar('block_type', 'C'); } $myts =& MyTextSanitizer::getInstance(); $myblock->setVar('title', $myts->stripSlashesGPC($btitle)); $myblock->setVar('content', $myts->stripSlashesGPC($bcontent)); $dummyhtml = '<html><head><meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '" /><meta http-equiv="content-language" content="' . _LANGCODE . '" /><title>' . $xoopsConfig['sitename'] . '</title><link rel="stylesheet" type="text/css" media="all" href="' . getcss($xoopsConfig['theme_set']) . '" /></head><body><table><tr><th>' . $myblock->getVar('title') . '</th></tr><tr><td>' . $myblock->getContent('S', $bctype) . '</td></tr></table></body></html>'; $dummyfile = '_dummyfile_' . time() . '.html'; $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w'); fwrite($fp, $dummyhtml); fclose($fp); $block['edit_form'] = false; $block['template'] = ''; $block['op'] = $op; $block['side'] = $bside; $block['weight'] = $bweight; $block['visible'] = $bvisible; $block['title'] = $myblock->getVar('title', 'E'); $block['content'] = $myblock->getVar('content', 'E'); $block['modules'] =& $bmodule; $block['ctype'] = isset($bctype) ? $bctype : $myblock->getVar('c_type'); $block['is_custom'] = true;
public function test_getContent() { $instance = new XoopsBlock(); $level = ob_get_level(); $value = $instance->getContent(); while (ob_get_level() > $level) { ob_end_clean(); } $this->assertSame('', $value); $value = $instance->getContent('s', 'T'); $this->assertSame('', $value); $value = $instance->getContent('s', 'H'); $this->assertSame('', $value); $value = $instance->getContent('s', 'P'); $this->assertSame('', $value); $value = $instance->getContent('s', 'S'); $this->assertSame('', $value); $value = $instance->getContent('e'); $this->assertSame('', $value); $value = $instance->getContent('default'); $this->assertSame(null, $value); }
if ($op == 'save') { $block['form_title'] = _AM_ADDBLOCK; } else { $block['form_title'] = _AM_CLONEBLOCK; } $myblock = new XoopsBlock(); $myblock->setVar('block_type', 'C'); } $myts =& MyTextSanitizer::getInstance(); $myblock->setVar('title', $myts->stripSlashesGPC($btitle)); $myblock->setVar('content', $myts->stripSlashesGPC($bcontent)); $dummyhtml = '<html><head><meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '" />'; $dummyhtml .= '<meta http-equiv="content-language" content="' . _LANGCODE . '" /><title>' . $xoopsConfig['sitename'] . '</title>'; $dummyhtml .= '<link rel="stylesheet" type="text/css" media="all" href="' . xoops_getcss($xoopsConfig['theme_set']) . '" />'; $dummyhtml .= '</head><body><table><tr><th>' . $myblock->getVar('title') . '</th></tr><tr><td>'; $dummyhtml .= $myblock->getContent('S', $bctype) . '</td></tr></table></body></html>'; $block['groups'] = $bgroups; $block['edit_form'] = false; $block['template'] = ''; $block['op'] = $op; $block['side'] = $bside; $block['weight'] = $bweight; $block['visible'] = $bvisible; $block['title'] = $myblock->getVar('title', 'E'); $block['content'] = $myblock->getVar('content', 'E'); $block['modules'] =& $bmodule; $block['ctype'] = isset($bctype) ? $bctype : $myblock->getVar('c_type'); $block['is_custom'] = true; $block['cachetime'] = intval($bcachetime); echo '<a href="admin.php?fct=blocksadmin">' . _AM_BADMIN . '</a> <span style="font-weight:bold;">»»</span> ' . $block['form_title'] . '<br /><br />'; include XOOPS_ROOT_PATH . '/modules/system/admin/blocksadmin/blockform.php';
$block['cachetime'] = intval($bcachetime); echo '<a href="myblocksadmin.php">'. _AM_BADMIN .'</a> <span style="font-weight:bold;">»»</span> '.$block['form_title'].'<br /><br />'; include dirname(__FILE__).'/../admin/myblockform.php'; //GIJ //echo '<a href="admin.php?fct=blocksadmin">'. _AM_BADMIN .'</a> <span style="font-weight:bold;">»»</span> '.$block['form_title'].'<br /><br />'; //include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php'; $form->addElement( $xoopsGTicket->getTicketXoopsForm( __LINE__ ) );//GIJ $form->display(); $original_level = error_reporting( E_ALL ) ; echo " <table width='100%' class='outer' cellspacing='1'> <tr> <th>".$myblock->getVar('title')."</th> </tr> <tr> <td class='odd'>".$myblock->getContent('S', $bctype)."</td> </tr> </table>\n" ; error_reporting( $original_level ) ; xoops_cp_footer(); /* echo '<script type="text/javascript"> preview_window = openWithSelfMain("'.XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file='.$dummyfile.'", "popup", 250, 200); </script>';*/ exit(); } /* if ($op == 'previewpopup') { if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { exit('Invalid Referer');
function previewContent($block_data) { $bid = intval($block_data['bid']); if (!$block_data['is_custom']) { return ''; } if (empty($this->preview_request)) { return ''; } $block = new XoopsBlock($bid); if ($block->getVar('mid')) { return ''; } $block->setVar('title', $block_data['title']); $block->setVar('content', $block_data['content']); restore_error_handler(); $original_level = error_reporting(E_ALL); $ret = $block->getContent('S', $block_data['ctype']); error_reporting($original_level); return $ret; }
function previewContent($block_data) { $bid = intval($block_data['bid']); if (!$block_data['is_custom']) { return ''; } if (empty($this->preview_request)) { return ''; } //HACK by domifara //TODO : need no hook block at this $block = new XoopsBlock($bid); /* $handler =& xoops_gethandler('block'); $block =& $handler->create(false) ; $block->load($bid) ; */ if ($block->getVar('mid')) { return ''; } $block->setVar('title', $block_data['title']); $block->setVar('content', $block_data['content']); restore_error_handler(); $original_level = error_reporting(E_ALL); $ret = $block->getContent('S', $block_data['ctype']); error_reporting($original_level); return $ret; }