function myblocksadmin_update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options = array()) { global $xoopsConfig; if (empty($bmodule)) { xoops_cp_header(); xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN)); xoops_cp_footer(); exit; } $myblock = new XoopsBlock($bid); // $myblock->setVar('side', $bside); GIJ - if ($bside >= 0) { $myblock->setVar('side', $bside); } // GIJ + $myblock->setVar('weight', $bweight); $myblock->setVar('visible', $bvisible); $myblock->setVar('title', $btitle); $myblock->setVar('content', $bcontent); $myblock->setVar('bcachetime', $bcachetime); if (isset($options) && count($options) > 0) { $options = implode('|', $options); $myblock->setVar('options', $options); } if ($myblock->getVar('block_type') == 'C') { switch ($bctype) { case 'H': $name = _AM_CUSTOMHTML; break; case 'P': $name = _AM_CUSTOMPHP; break; case 'S': $name = _AM_CUSTOMSMILE; break; default: $name = _AM_CUSTOMNOSMILE; break; } $myblock->setVar('name', $name); $myblock->setVar('c_type', $bctype); } else { $myblock->setVar('c_type', 'H'); } $msg = _AM_DBUPDATED; if ($myblock->store() != false) { $db =& Database::getInstance(); $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $db->prefix('block_module_link'), $bid); $db->query($sql); foreach ($bmodule as $bmid) { $sql = sprintf("INSERT INTO %s (block_id, module_id) VALUES (%u, %d)", $db->prefix('block_module_link'), $bid, intval($bmid)); $db->query($sql); } include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->xoops_setCaching(2); if ($myblock->getVar('template') != '') { if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'))) { if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'))) { $msg = 'Unable to clear cache for block ID' . $bid; } } } else { if ($xoopsTpl->is_cached('db:system_dummy.html', 'block' . $bid)) { if (!$xoopsTpl->clear_cache('db:system_dummy.html', 'block' . $bid)) { $msg = 'Unable to clear cache for block ID' . $bid; } } } } else { $msg = 'Failed update of block. ID:' . $bid; } // redirect_header('admin.php?fct=blocksadmin&t='.time(),1,$msg); // exit(); GIJ - return $msg; // GIJ + }
function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options = array(), $bgroups = array()) { global $xoopsConfig; if (empty($bmodule)) { xoops_cp_header(); xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN)); xoops_cp_footer(); exit; } $myblock = new XoopsBlock($bid); $myblock->setVar('side', $bside); $myblock->setVar('weight', $bweight); $myblock->setVar('visible', $bvisible); $myblock->setVar('title', $btitle); $myblock->setVar('content', $bcontent); $myblock->setVar('bcachetime', $bcachetime); if (isset($options)) { $options_count = count($options); if ($options_count > 0) { //Convert array values to comma-separated for ($i = 0; $i < $options_count; $i++) { if (is_array($options[$i])) { $options[$i] = implode(',', $options[$i]); } } $options = implode('|', $options); $myblock->setVar('options', $options); } } if ($myblock->isCustom()) { switch ($bctype) { case 'H': $name = _AM_CUSTOMHTML; break; case 'P': $name = _AM_CUSTOMPHP; break; case 'S': $name = _AM_CUSTOMSMILE; break; default: $name = _AM_CUSTOMNOSMILE; break; } $myblock->setVar('name', $name); $myblock->setVar('c_type', $bctype); } else { $myblock->setVar('c_type', 'H'); } $msg = _AM_DBUPDATED; if ($myblock->store() != false) { $db =& Database::getInstance(); $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $db->prefix('block_module_link'), $bid); $db->query($sql); foreach ($bmodule as $bmid) { $sql = sprintf("INSERT INTO %s (block_id, module_id) VALUES (%u, %d)", $db->prefix('block_module_link'), $bid, intval($bmid)); $db->query($sql); } include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->xoops_setCaching(2); if ($myblock->getVar('template') != '') { if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'), 'blk_' . $myblock->getVar('bid'))) { if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'), 'blk_' . $myblock->getVar('bid'))) { $msg = 'Unable to clear cache for block ID ' . $bid; } } } else { if ($xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) { if (!$xoopsTpl->clear_cache('db:system_dummy.html', 'blk_' . $bid)) { $msg = 'Unable to clear cache for block ID ' . $bid; } } } $groupperm_handler =& xoops_gethandler('groupperm'); $groups_with_access =& $groupperm_handler->getGroupIds("block_read", $bid); $removed_groups = array_diff($groups_with_access, $bgroups); if (count($removed_groups) > 0) { foreach ($removed_groups as $groupid) { $criteria = new CriteriaCompo(new Criteria('gperm_name', 'block_read')); $criteria->add(new Criteria('gperm_groupid', $groupid)); $criteria->add(new Criteria('gperm_itemid', $bid)); $criteria->add(new Criteria('gperm_modid', 1)); $perm = $groupperm_handler->getObjects($criteria); if (isset($perm[0]) && is_object($perm[0])) { $groupperm_handler->delete($perm[0]); } } } $new_groups = array_diff($bgroups, $groups_with_access); if (count($new_groups) > 0) { foreach ($new_groups as $groupid) { $groupperm_handler->addRight("block_read", $bid, $groupid); } } } else { $msg = 'Failed update of block. ID:' . $bid; } redirect_header('admin.php?fct=blocksadmin&t=' . time(), 1, $msg); exit; }
if (isset($_GET['topicid'])) { $topicid = intval($_GET['topicid']); } if (!$topicid) { exit; } $myts =& MyTextSanitizer::getInstance(); if (function_exists('mb_http_output')) { mb_http_output('pass'); } $restricted = getmoduleoption('restrictindex'); $newsnumber = getmoduleoption('storyhome'); header('Content-Type:text/xml; charset=utf-8'); $story = new NewsStory(); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); $tpl->xoops_setCacheTime(0); if (!$tpl->is_cached('db:system_rss.html')) { $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid); if (is_array($sarray) && count($sarray) > 0) { $tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); $tpl->assign('channel_link', XOOPS_URL . '/'); $tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true)); // Fed up with spam $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true)); // Fed up with spam $tpl->assign('channel_category', 'News'); $tpl->assign('channel_generator', 'XOOPS'); $tpl->assign('channel_language', _LANGCODE);
$xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES)); include XOOPS_ROOT_PATH . '/include/old_functions.php'; if ($xoopsOption['show_cblock'] || isset($xoopsModule) && preg_match("/index\\.php\$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) { $xoopsOption['show_rblock'] = $xoopsOption['show_cblock'] = 1; } themeheader($xoopsOption['show_rblock']); if ($xoopsOption['show_cblock']) { make_cblock(); } //create center block } else { $xoopsOption['theme_use_smarty'] = 1; // include Smarty template engine and initialize it require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->xoops_setCaching(2); if ($xoopsConfig['debug_mode'] == 3) { $xoopsTpl->xoops_setDebugging(true); } $xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/', 'xoops_themecss' => xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); // Meta tags $config_handler =& xoops_gethandler('config'); $criteria = new CriteriaCompo(new Criteria('conf_modid', 0)); $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER)); $config =& $config_handler->getConfigs($criteria, true); foreach (array_keys($config) as $i) { // prefix each tag with 'xoops_' $xoopsTpl->assign('xoops_' . $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); } //unset($config); // show banner?
/** * Clear the module cache * * @deprecated * * @param int $mid Module ID * @return **/ function xoops_template_clear_module_cache($mid) { $block_arr =& XoopsBlock::getByModule($mid); $count = count($block_arr); if ($count > 0) { $xoopsTpl = new XoopsTpl(); $xoopsTpl->xoops_setCaching(2); for ($i = 0; $i < $count; $i++) { if ($block_arr[$i]->getVar('template') != '') { $xoopsTpl->clear_cache('db:' . $block_arr[$i]->getVar('template'), 'blk_' . $block_arr[$i]->getVar('bid')); } } } }
function make_cblock() { global $xoopsUser, $xoopsOption; $xoopsblock = new XoopsBlock(); $cc_block = $cl_block = $cr_block = ""; $arr = array(); if ($xoopsOption['theme_use_smarty'] == 0) { if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); } else { $xoopsTpl =& $GLOBALS['xoopsTpl']; } if (is_object($xoopsUser)) { $block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE); } else { $block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE); } $block_count = count($block_arr); $xoopsLogger =& XoopsLogger::instance(); for ($i = 0; $i < $block_count; $i++) { $bcachetime = intval($block_arr[$i]->getVar('bcachetime')); if (empty($bcachetime)) { $xoopsTpl->xoops_setCaching(0); } else { $xoopsTpl->xoops_setCaching(2); $xoopsTpl->xoops_setCacheTime($bcachetime); } $btpl = $block_arr[$i]->getVar('template'); if ($btpl != '') { if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) { $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); $bresult =& $block_arr[$i]->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('block', $bresult); $bcontent =& $xoopsTpl->fetch('db:' . $btpl); $xoopsTpl->clear_assign('block'); } else { $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); $bcontent =& $xoopsTpl->fetch('db:' . $btpl); } } else { $bid = $block_arr[$i]->getVar('bid'); if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) { $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); $bresult =& $block_arr[$i]->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']); $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid); $xoopsTpl->clear_assign('block'); } else { $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid); } } $title = $block_arr[$i]->getVar('title'); switch ($block_arr[$i]->getVar('side')) { case XOOPS_CENTERBLOCK_CENTER: if ($title != "") { $cc_block .= '<tr valign="top"><td colspan="2"><strong>' . $title . '</strong><hr />' . $bcontent . '<br /><br /></td></tr>' . "\n"; } else { $cc_block .= '<tr><td colspan="2">' . $bcontent . '<br /><br /></td></tr>' . "\n"; } break; case XOOPS_CENTERBLOCK_LEFT: if ($title != "") { $cl_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n"; } else { $cl_block .= '<p>' . $bcontent . '</p>' . "\n"; } break; case XOOPS_CENTERBLOCK_RIGHT: if ($title != "") { $cr_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n"; } else { $cr_block .= '<p>' . $bcontent . '</p>' . "\n"; } break; default: break; } unset($bcontent, $title); } echo '<table width="100%">' . $cc_block . '<tr valign="top"><td width="50%">' . $cl_block . '</td><td width="50%">' . $cr_block . '</td></tr></table>' . "\n"; } }
function plugin_xoopsblock_convert() { if ($this->root->module['platform'] !== "xoops") { return ''; } static $css_show = FALSE; list($tgt, $option1, $option2) = array_pad(func_get_args(), 3, ""); $tgt_bids = array(); if (!$tgt || $tgt === "?") { $tgt = "?"; } else { foreach (explode(",", $tgt) as $_bid) { if (preg_match("/^\\d+\$/", $_bid) && $_bid > 0) { $tgt_bids[] = $_bid; } } } $align = "left"; $around = false; $width = ""; $arg = array(); if (preg_match("/^(left|center|right)\$/i", $option2, $arg)) { $align = $arg[1]; } if (preg_match("/^(left|center|right)\$/i", $option1, $arg)) { $align = $arg[1]; } if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option2, $arg)) { if ($arg[1]) { $around = true; } $width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3]; $width = "width:" . $width . ";"; } if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option1, $arg)) { if ($arg[1]) { $around = true; } $width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3]; $width = "width:" . $width . ";"; } if ($align === 'center') { if (!$width) { $width = 'width:auto;'; } $style = ' style="margin-left:auto;margin-right:auto;' . $width . '"'; $around = false; } else { $style = ' style="float:' . $align . ';' . $width . '"'; } $clear = $around ? '' : '<div style="clear:both;"></div>'; global $xoopsUser; $xoopsblock = new XoopsBlock(); $xoopsgroup = new XoopsGroup(); $arr = array(); $side = null; if ($this->root->userinfo['admin']) { $arr = $xoopsblock->getAllBlocks(); } else { if ($xoopsUser) { $arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->groups()); } else { $arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous")); } } $ret = ""; if ($tgt == "?") { foreach ($arr as $myblock) { $block = array(); $block_type = @$myblock->getVar("type") ? $myblock->getVar("type") : $myblock->getVar("block_type"); $name = @$myblock->getVar("title") ? $myblock->getVar("title") : $myblock->getVar("name"); $bid = $myblock->getVar('bid'); $ret .= "<li>(" . $bid . ")" . $name . "</li>"; } } else { global $xoopsTpl; require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); if (is_object($xoopsUser)) { $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUser->isAdmin())); } $xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES)); foreach ($tgt_bids as $bid) { $myblock = new XoopsBlock($bid); $_bid = $myblock->getVar('bid'); if (!empty($_bid)) { $bcachetime = $myblock->getVar('bcachetime'); // Only a guest enable cache. by nao-pon //if (empty($bcachetime)) { if ($bcachetime % 10 == 1) { $bcachetime_guest = TRUE; $bcachetime = $bcachetime - 1; } else { $bcachetime_guest = FALSE; } if (empty($bcachetime) || is_object($xoopsUser) && $bcachetime_guest) { //if (empty($bcachetime)) { $xoopsTpl->xoops_setCaching(0); } else { $xoopsTpl->xoops_setCaching(2); $xoopsTpl->xoops_setCacheTime($bcachetime); } $btpl = $myblock->getVar('template'); if ($btpl != '') { if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $myblock->getVar('bid'))) { //$xoopsLogger->addBlock($myblock->getVar('name')); $bresult = $myblock->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('block', $bresult); $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid')); $xoopsTpl->clear_assign('block'); } else { //$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime); $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid')); } } else { //$bid = $myblock->getVar('bid'); if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) { //$xoopsLogger->addBlock($myblock->getVar('name')); $bresult = $myblock->buildBlock(); if (!$bresult) { continue; } $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']); $bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid); $xoopsTpl->clear_assign('block'); } else { //$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime); $bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid); } } $btitle = $myblock->getVar('title'); } else { $btitle = "Block({$bid})"; $bcontent = "Block({$bid}) is not found."; } if ($bcontent) { $ret .= "<h5>" . $btitle . "</h5>\n"; $ret .= $bcontent; foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_block_header')) as $str) { $this->root->head_tags[] = rtrim($str); } foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_module_header')) as $str) { $this->root->head_tags[] = rtrim($str); } $this->root->head_tags = array_unique($this->root->head_tags); } } unset($myblock); } if (!$css_show) { $css_show = true; $this->root->head_pre_tags[] = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . XOOPS_URL . "/xoops.css\" />"; } if ($tgt == "?") { $ret = "<ul>{$ret}</ul>"; } unset($xoopsblock, $xoopsgroup); return "<div{$style}>{$ret}</div>{$clear}"; }
if (is_object($xoopsUser)) { foreach ($xoopsUser->getGroups() as $group) { if (in_array($group, $xoopsConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) { $allowed = true; break; } } } elseif (!empty($_POST['xoops_login'])) { include_once XOOPS_ROOT_PATH . '/include/checklogin.php'; exit; } if (!$allowed) { include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->assign(array('xoops_sitename' => htmlspecialchars($xoopsConfig['sitename']), 'xoops_themecss' => xoops_getcss(), 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/', 'lang_login' => _LOGIN, 'lang_username' => _USERNAME, 'lang_password' => _PASSWORD, 'lang_siteclosemsg' => $xoopsConfig['closesite_text'])); $xoopsTpl->xoops_setCaching(1); $xoopsTpl->display('db:system_siteclosed.html'); exit; } unset($allowed, $group); } if (file_exists('./xoops_version.php')) { $url_arr = explode('/', strstr($xoopsRequestUri, '/modules/')); $module_handler =& xoops_gethandler('module'); $xoopsModule =& $module_handler->getByDirname($url_arr[2]); unset($url_arr); if (!$xoopsModule || !$xoopsModule->getVar('isactive')) { include_once XOOPS_ROOT_PATH . "/header.php"; echo "<h4>" . _MODULENOEXIST . "</h4>"; include_once XOOPS_ROOT_PATH . "/footer.php"; exit;
/** * Clear the module cache * * @param int $mid Module ID * @return **/ function xoops_template_clear_module_cache($mid) { $block_handler =& xoops_gethandler('block'); //note this uses backwards parameters for backwards compatibility - change that! $block_arr =& $block_handler->getByModule($mid, true, false); if (count($block_arr) > 0) { $instance_handler =& xoops_gethandler('blockinstance'); $instances =& $instance_handler->getObjects(new Criteria('bid', "(" . implode(',', array_keys($block_arr)) . ")", "IN")); $count = count($instances); if ($count > 0) { $xoopsTpl = new XoopsTpl(); $xoopsTpl->xoops_setCaching(2); for ($i = 0; $i < $count; $i++) { if ($block_arr[$instances[$i]->getVar('bid')]->getVar('template') != '') { $xoopsTpl->clear_cache('db:' . $block_arr[$instances[$i]->getVar('bid')]->getVar('template'), 'blk_' . $instances[$i]->getVar('instanceid')); } } } } }
function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = array()) { global $xoopsConfig; $block = new XoopsBlock($bid); if ($bside >= 0) { $block->setVar('side', $bside); } $block->setVar('weight', $bweight); $block->setVar('visible', $bvisible); $block->setVar('title', $btitle); if (isset($bcontent)) { $block->setVar('content', $bcontent); } if (isset($bctype)) { $block->setVar('c_type', $bctype); } $block->setVar('bcachetime', $bcachetime); if (is_array($options) && count($options) > 0) { $block->setVar('options', implode('|', $options)); } if ($block->getVar('block_type') == 'C') { $name = $this->get_blockname_from_ctype($block->getVar('c_type')); $block->setVar('name', $name); } $msg = _MD_A_MYBLOCKSADMIN_DBUPDATED; if ($block->store() != false) { include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->xoops_setCaching(2); if ($block->getVar('template') != '') { if ($xoopsTpl->is_cached('db:' . $block->getVar('template'))) { if (!$xoopsTpl->clear_cache('db:' . $block->getVar('template'))) { $msg = 'Unable to clear cache for block ID' . $bid; } } } else { if ($xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) { if (!$xoopsTpl->clear_cache('db:system_dummy.html', 'blk_' . $bid)) { $msg = 'Unable to clear cache for block ID' . $bid; } } } } else { $msg = 'Failed update of block. ID:' . $bid; } return $msg; }
foreach ($forums as $forum) { if (in_array($forum, array_keys($available_forums))) { $valid_forums[] = $forum; } } } else { $valid_forums = array_keys($available_forums); } unset($available_forums); if (count($valid_forums) == 0) { exit; } $charset = empty($xoopsModuleConfig['rss_utf8']) ? _CHARSET : 'UTF-8'; header('Content-Type:text/xml; charset=' . $charset); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(1); $tpl->xoops_setCacheTime($xoopsModuleConfig['rss_cachetime'] * 60); $compile_id = implode(",", $valid_forums); $xoopsCachedTemplateId = 'mod_' . $xoopsModule->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); if (!$tpl->is_cached('db:newbb_rss.html', $xoopsCachedTemplateId, $compile_id)) { $xmlrss_handler =& xoops_getmodulehandler('xmlrss', 'newbb'); $rss = $xmlrss_handler->create(); $rss->setVarRss('channel_title', $xoopsConfig['sitename'] . ' :: ' . _MD_FORUM); $rss->channel_link = XOOPS_URL . '/'; $rss->setVarRss('channel_desc', $xoopsConfig['slogan'] . ' :: ' . $xoopsModule->getInfo('description')); // There is a "bug" with xoops function formatTimestamp(time(), 'rss') // We have to make a customized function //$rss->channel_lastbuild = formatTimestamp(time(), 'rss'); $rss->setVarRss('channel_lastbuild', newbb_formatTimestamp(time(), 'rss')); $rss->channel_webmaster = $xoopsConfig['adminmail']; $rss->channel_editor = $xoopsConfig['adminmail'];
<?php include '../../mainfile.php'; include_once XOOPS_ROOT_PATH . '/class/template.php'; $eventHandler = xoops_getmodulehandler('event', 'extcal'); if (!isset($_GET['cat'])) { $cat = 0; } else { $cat = intval($_GET['cat']); } if (function_exists('mb_http_output')) { mb_http_output('pass'); } header('Content-Type:text/xml; charset=utf-8'); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(0); $tpl->xoops_setCacheTime($xoopsModuleConfig['rss_cache_time'] * 60); if (!$tpl->is_cached('db:extcal_rss.html', $cat)) { $events = $eventHandler->getUpcommingEvent($xoopsModuleConfig['rss_nb_event'], $cat); if (is_array($events)) { $tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); $tpl->assign('channel_link', XOOPS_URL . '/'); $tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); $tpl->assign('channel_webmaster', $xoopsConfig['adminmail']); $tpl->assign('channel_editor', $xoopsConfig['adminmail']); $tpl->assign('channel_category', 'Event'); $tpl->assign('channel_generator', 'XOOPS'); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/modules/extcal/images/extcal_logo.png'); $tpl->assign('image_width', 92);