* $Id: backend.php,v 1.2 2005/08/02 03:47:51 mauriciodelima Exp $ * Module: SmartSection * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ include_once "header.php"; global $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; include_once XOOPS_ROOT_PATH . '/class/template.php'; include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; if (function_exists('mb_http_output')) { mb_http_output('pass'); } header('Content-Type:text/xml; charset=utf-8'); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); $tpl->xoops_setCacheTime(3600); if (!$tpl->is_cached('db:system_rss.html')) { $sarray = $smartsection_item_handler->getAllPublished(10); if (is_array($sarray)) { $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', 'News'); $tpl->assign('channel_generator', 'SmartSection'); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif'); $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif'); if (empty($dimention[0])) {
$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); $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
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}"; }
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)); $xoopsTpl->assign('xoops_dirname', "system"); $moduleid = 0; if (!empty($xoopsOption['show_cblock'])) { $toppage = true; } } // Get blocks $block_arr =& $xoopsblock->getAllByGroupModule($groups, $moduleid, $toppage, XOOPS_BLOCK_VISIBLE); foreach (array_keys($block_arr) as $i) { $bcachetime = $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') != '' ? $block_arr[$i]->getVar('template') : "system_block_dummy.html"; if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'))) { $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, 'blk_' . $block_arr[$i]->getVar('bid')); $xoopsTpl->clear_assign('block'); } else { $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); $bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid')); }
require 'header.php'; require_once XOOPS_ROOT_PATH . '/class/template.php'; if (oledrion_utils::getModuleOption('use_rss') == 0) { exit; } // Paramètre, soit rien auquel cas on prend tous les produits récents soit cat_cid $cat_cid = isset($_GET['cat_cid']) ? intval($_GET['cat_cid']) : 0; if (function_exists('mb_http_output')) { mb_http_output('pass'); } $charset = 'utf-8'; header('Content-Type:text/xml; charset=' . $charset); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); // 1 = Cache global, 2 = Cache individuel (par template) $tpl->xoops_setCacheTime(OLEDRION_RSS_CACHE); // Temps de cache en secondes if (!$tpl->is_cached('db:oledrion_rss.tpl', $cat_cid)) { $categoryTitle = ''; if (!empty($cat_cid)) { $category = null; $category = $h_oledrion_cat->get($cat_cid); if (is_object($category)) { $categoryTitle = $category->getVar('cat_title'); } } $sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES); $email = checkEmail($xoopsConfig['adminmail'], true); $slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES); $limit = oledrion_utils::getModuleOption('perpage'); $tpl->assign('charset', $charset);
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"; } }
<?php require_once XOOPS_ROOT_PATH . '/class/template.php'; header('Content-Type: text/javascript'); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); $tpl->xoops_setCacheTime(60 * 60 * 24 * 7); $tpl->display("db:{$mydirname}_javascript.html");
require 'header.php'; require_once XOOPS_ROOT_PATH . '/class/template.php'; if (myshop_utils::getModuleOption('use_rss') == 0) { exit; } // Last cat_cid $cat_cid = isset($_GET['cat_cid']) ? intval($_GET['cat_cid']) : 0; if (function_exists('mb_http_output')) { mb_http_output('pass'); } $charset = 'utf-8'; header('Content-Type:text/xml; charset=' . $charset); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); // 1 = Global Cache, 2 = Individual Cache (by template) $tpl->xoops_setCacheTime(MYSHOP_RSS_CACHE); // Time cache in seconds if (!$tpl->is_cached('db:myshop_rss.html', $cat_cid)) { $categoryTitle = ''; if (!empty($cat_cid)) { $category = null; $category = $h_myshop_cat->get($cat_cid); if (is_object($category)) { $categoryTitle = $category->getVar('cat_title'); } } $sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES); $email = checkEmail($xoopsConfig['adminmail'], true); $slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES); $limit = myshop_utils::getModuleOption('perpage'); $tpl->assign('charset', $charset);
$block = new XoopsBlock($myrow); } $block_arr[$myrow['bid']] = $block; } } $adminmenublock_exists = false; foreach (array_keys($block_arr) as $i) { if ($block_arr[$i]->getVar('show_func') == 'b_altsys_admin_menu_show') { $adminmenublock_exists = true; } $bcachetime = $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, 'blk_' . $block_arr[$i]->getVar('bid'))) { $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, 'blk_' . $block_arr[$i]->getVar('bid')); $xoopsTpl->clear_assign('block'); } else { $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); $bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
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']; $rss->setVarRss('channel_category', $xoopsModule->getVar('name'));
} if (function_exists('mb_http_output')) { mb_http_output('pass'); } $restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $newsnumber = nw_getmoduleoption('storyhome', NW_MODULE_DIR_NAME); $charset = 'utf-8'; header ('Content-Type:text/xml; charset='.$charset); $story = new nw_NewsStory(); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); $tpl->xoops_setCacheTime(3600); // Change this to the value you want if (!$tpl->is_cached('db:nw_news_rss.html', $topicid)) { $xt = new nw_NewsTopic($topicid); $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid); if (is_array($sarray) && count($sarray)>0) { $sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES); $slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES); $tpl->assign('channel_title', xoops_utf8_encode($sitename)); $tpl->assign('channel_link', XOOPS_URL.'/'); $tpl->assign('channel_desc', xoops_utf8_encode($slogan)); $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', $xt->topic_title()); $tpl->assign('channel_generator', 'XOOPS'); $tpl->assign('channel_language', _LANGCODE);