Example #1
0
     $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?
 if ($xoopsConfig['banners'] == 1) {
     $xoopsTpl->assign('xoops_banner', xoops_getbanner());
 } else {
     $xoopsTpl->assign('xoops_banner', ' ');
 }
 // Weird, but need extra <script> tags for 2.0.x themes
 $xoopsTpl->assign('xoops_js', '//--></script><script type="text/javascript" src="' . XOOPS_URL . '/include/xoops.js"></script><script type="text/javascript"><!--');
 // get all blocks and assign to smarty
 $xoopsblock = new XoopsBlock();
 $block_arr = array();
 if ($xoopsUser != '') {
     $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
     $groups = $xoopsUser->getGroups();
 } else {
     $xoopsTpl->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false));
     $groups = XOOPS_GROUP_ANONYMOUS;
 }
Example #2
0
    }
} elseif (!empty($_POST['xoops_login'])) {
    include_once $GLOBALS['xoops']->path('include/checklogin.php');
    exit;
}
if (!$allowed) {
    require_once $GLOBALS['xoops']->path('class/template.php');
    require_once $GLOBALS['xoops']->path('class/theme.php');
    $xoopsThemeFactory = null;
    $xoopsThemeFactory = new xos_opal_ThemeFactory();
    $xoopsThemeFactory->allowedThemes = $xoopsConfig['theme_set_allowed'];
    $xoopsThemeFactory->defaultTheme = $xoopsConfig['theme_set'];
    $xoTheme = $xoopsThemeFactory->createInstance(array('plugins' => array()));
    $xoTheme->addScript('/include/xoops.js', array('type' => 'text/javascript'));
    $xoopsTpl = $xoTheme->template;
    $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($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), 'xoops_dirname' => @$xoopsModule ? $xoopsModule->getVar('dirname') : 'system', 'xoops_banner' => $xoopsConfig['banners'] ? xoops_getbanner() : '&nbsp;', 'xoops_pagetitle' => isset($xoopsModule) && is_object($xoopsModule) ? $xoopsModule->getVar('name') : htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), 'lang_login' => _LOGIN, 'lang_username' => _USERNAME, 'lang_password' => _PASSWORD, 'lang_siteclosemsg' => $xoopsConfig['closesite_text']));
    $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) {
        $name = $config[$i]->getVar('conf_name', 'n');
        $value = $config[$i]->getVar('conf_value', 'n');
        if (substr($name, 0, 5) === 'meta_') {
            $xoopsTpl->assign("xoops_{$name}", htmlspecialchars($value, ENT_QUOTES));
        } else {
            // prefix each tag with 'xoops_'
            $xoopsTpl->assign("xoops_{$name}", $value);
        }
    }
    $xoopsTpl->debugging = false;
function showbanner()
{
    $GLOBALS['xoopsLogger']->addDeprecated("Function " . __FUNCTION__ . "() is deprecated, use xoops_getbanner instead");
    echo xoops_getbanner();
}
Example #4
0
/**
 * Function to display banners in all pages
 * @deprecated Use xoops_getbanner instead
 * @todo Remove in version 1.4 - all occurrences have been removed from the core
 */
function showbanner()
{
    icms_core_Debug::setDeprecated('xoops_getbanner', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
    echo xoops_getbanner();
}
 function renderTheme(&$target)
 {
     $this->_commonPrepareRender();
     //jQuery Ready functions
     $mRoot = $this->mController->mRoot;
     $mContext = $mRoot->mContext;
     XCube_DelegateUtils::call('Site.JQuery.AddFunction', new XCube_Ref($mContext->mAttributes['headerScript']));
     $headerScript = $mContext->getAttribute('headerScript');
     $mTpl = $this->mXoopsTpl;
     $moduleHeader = $mTpl->get_template_vars('xoops_module_header');
     $moduleHeader = $headerScript->createLibraryTag() . $moduleHeader . $headerScript->createOnloadFunctionTag();
     //
     // Assign from attributes of the render-target.
     //
     $vars = $target->getAttributes();
     $vars['xoops_module_header'] = $moduleHeader;
     $moduleHandler = xoops_gethandler('module');
     $legacyRender =& $moduleHandler->getByDirname('legacyRender');
     $configHandler = xoops_gethandler('config');
     $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get('mid'));
     $textFilter =& $mRoot->getTextFilter();
     $headerScript = $mContext->getAttribute('headerScript');
     $vars['xoops_meta_keywords'] = $textFilter->toShow($headerScript->getMeta('keywords') ? $headerScript->getMeta('keywords') : $configs['meta_keywords']);
     $vars['xoops_meta_description'] = $textFilter->toShow($headerScript->getMeta('description') ? $headerScript->getMeta('description') : $configs['meta_description']);
     $vars['xoops_meta_robots'] = $textFilter->toShow($headerScript->getMeta('robots') ? $headerScript->getMeta('robots') : $configs['meta_robots']);
     $vars['xoops_meta_rating'] = $textFilter->toShow($headerScript->getMeta('rating') ? $headerScript->getMeta('rating') : $configs['meta_rating']);
     $vars['xoops_meta_author'] = $textFilter->toShow($headerScript->getMeta('author') ? $headerScript->getMeta('author') : $configs['meta_author']);
     $vars['xoops_meta_copyright'] = $textFilter->toShow($headerScript->getMeta('copyright') ? $headerScript->getMeta('copyright') : $configs['meta_copyright']);
     $vars['xoops_footer'] = $configs['footer'];
     // footer may be raw HTML text.
     //
     // If this site has the setting of banner.
     // TODO this process depends on XOOPS 2.0.x.
     //
     if (LEGACY_RENDERSYSTEM_BANNERSETUP_BEFORE == false) {
         $vars['xoops_banner'] = $this->_mIsActiveBanner == 1 ? xoops_getbanner() : '&nbsp;';
     }
     $mTpl->assign($vars);
     //
     // [TODO]
     // We must implement with a render-target.
     //
     // $this->_processLegacyTemplate();
     // assing
     /// @todo I must move these to somewhere.
     $assignNameMap = array(XOOPS_SIDEBLOCK_LEFT => array('showflag' => 'xoops_showlblock', 'block' => 'xoops_lblocks'), XOOPS_CENTERBLOCK_LEFT => array('showflag' => 'xoops_showcblock', 'block' => 'xoops_clblocks'), XOOPS_CENTERBLOCK_RIGHT => array('showflag' => 'xoops_showcblock', 'block' => 'xoops_crblocks'), XOOPS_CENTERBLOCK_CENTER => array('showflag' => 'xoops_showcblock', 'block' => 'xoops_ccblocks'), XOOPS_SIDEBLOCK_RIGHT => array('showflag' => 'xoops_showrblock', 'block' => 'xoops_rblocks'));
     foreach ($assignNameMap as $key => $val) {
         $mTpl->assign($val['showflag'], $this->_getBlockShowFlag($val['showflag']));
         if (isset($mContext->mAttributes['legacy_BlockContents'][$key])) {
             foreach ($mContext->mAttributes['legacy_BlockContents'][$key] as $result) {
                 $mTpl->append($val['block'], $result);
             }
         }
     }
     $this->mBeginRender->call(new XCube_Ref($mTpl));
     //
     // Render result, and set it to the RenderBuffer of the $target.
     //
     $result = null;
     if ($target->getAttribute('isFileTheme')) {
         $result = $mTpl->fetch($target->getTemplateName() . '/theme.html');
     } else {
         $result = $mTpl->fetch('db:' . $target->getTemplateName());
     }
     $result .= $mTpl->fetchDebugConsole();
     $target->setResult($result);
 }
Example #6
0
function showbanner()
{
    echo xoops_getbanner();
}
Example #7
0
 /**
  * Initializes this theme
  *
  * Upon initialization, the theme creates its template engine and instanciates the
  * plug-ins from the specified {@link $plugins} list. If the theme is a 2.0 theme, that does not
  * display redirection messages, the HTTP redirections system is disabled to ensure users will
  * see the redirection screen.
  *
  * @param array $options
  * @return bool
  */
 function xoInit($options = array())
 {
     $this->path = XOOPS_THEME_PATH . '/' . $this->folderName;
     $this->url = XOOPS_THEME_URL . '/' . $this->folderName;
     $this->template = new XoopsTpl();
     $this->template->currentTheme =& $this;
     $this->template->assign_by_ref('xoTheme', $this);
     $this->template->assign(array('xoops_theme' => $GLOBALS['xoopsConfig']['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $GLOBALS['xoopsConfig']['theme_set'] . '/', 'xoops_themecss' => xoops_getcss($GLOBALS['xoopsConfig']['theme_set']), 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($GLOBALS['xoopsConfig']['slogan'], ENT_QUOTES), 'xoops_dirname' => isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system', 'xoops_banner' => $GLOBALS['xoopsConfig']['banners'] ? xoops_getbanner() : '&nbsp;', 'xoops_pagetitle' => isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('name') : htmlspecialchars($GLOBALS['xoopsConfig']['slogan'], ENT_QUOTES)));
     if (isset($GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser'])) {
         $this->template->assign(array('xoops_isuser' => true, 'xoops_userid' => $GLOBALS['xoopsUser']->getVar('uid'), 'xoops_uname' => $GLOBALS['xoopsUser']->getVar('uname'), 'xoops_isadmin' => $GLOBALS['xoopsUserIsAdmin']));
     } else {
         $this->template->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false));
     }
     // Meta tags
     $config_handler =& xoops_gethandler('config');
     //$criteria = new CriteriaCompo(new Criteria('conf_modid', 0));       // ezsky hack
     //$criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER));  // ezsky hack
     //$config = $config_handler->getConfigs($criteria, true);            // ezsky hack
     $config = $config_handler->getConfigsByCat(XOOPS_CONF_METAFOOTER);
     // ezsky hack
     foreach (array_keys($config) as $i) {
         $name = $i;
         // ezsky hack
         $value = $config[$i];
         // ezsky hack
         if (substr($name, 0, 5) == 'meta_') {
             $this->addMeta('meta', substr($name, 5), $value);
         } else {
             // prefix each tag with 'xoops_'
             $this->template->assign("xoops_{$name}", $value);
         }
     }
     // Load global javascript
     $this->addScript('include/xoops.js');
     $this->loadLocalization();
     if ($this->bufferOutput) {
         ob_start();
     }
     $GLOBALS['xoTheme'] =& $this;
     $GLOBALS['xoopsTpl'] =& $this->template;
     // Instanciate and initialize all the theme plugins
     foreach ($this->plugins as $k => $bundleId) {
         if (!is_object($bundleId)) {
             $this->plugins[$bundleId] = new $bundleId();
             $this->plugins[$bundleId]->theme =& $this;
             $this->plugins[$bundleId]->xoInit();
             unset($this->plugins[$k]);
         }
     }
     return true;
 }
Example #8
0
 /**
  * Initializes this theme
  *
  * Upon initialization, the theme creates its template engine and instantiates the
  * plug-ins from the specified {@link $plugins} list. If the theme is a 2.0 theme, that does not
  * display redirection messages, the HTTP redirections system is disabled to ensure users will
  * see the redirection screen.
  *
  * @param  array $options
  * @return bool
  */
 public function xoInit($options = array())
 {
     /** @var XoopsConfigHandler $configHandler */
     $configHandler = xoops_getHandler('config');
     $this->path = XOOPS_THEME_PATH . '/' . $this->folderName;
     $this->url = XOOPS_THEME_URL . '/' . $this->folderName;
     $this->template = null;
     $this->template = new XoopsTpl();
     $this->template->currentTheme = $this;
     $this->template->assign_by_ref('xoTheme', $this);
     $xoops_page = str_replace(realpath(XOOPS_ROOT_PATH) . '/', '', realpath($_SERVER['SCRIPT_FILENAME']));
     if (strpos($xoops_page, 'modules') !== false) {
         $xoops_page = str_replace('modules/', '', $xoops_page);
     }
     $xoops_page = str_replace('.php', '', $xoops_page);
     if (isset($GLOBALS['xoopsConfig']['startpage'])) {
         $xoops_startpage = $GLOBALS['xoopsConfig']['startpage'];
         if ($xoops_startpage == '--') {
             $xoops_startpage = 'system';
         }
     } else {
         $xoops_startpage = 'system';
     }
     $searchConfig = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
     $xoops_search = (bool) (isset($searchConfig['enable_search']) && $searchConfig['enable_search'] === 1);
     $this->template->assign(array('xoops_theme' => $GLOBALS['xoopsConfig']['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $GLOBALS['xoopsConfig']['theme_set'] . '/', 'xoops_themecss' => xoops_getcss($GLOBALS['xoopsConfig']['theme_set']), 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($GLOBALS['xoopsConfig']['slogan'], ENT_QUOTES), 'xoops_dirname' => isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system', 'xoops_page' => $xoops_page, 'xoops_startpage' => $xoops_startpage, 'xoops_banner' => $GLOBALS['xoopsConfig']['banners'] && $this->renderBanner ? xoops_getbanner() : '&nbsp;', 'xoops_pagetitle' => isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('name') : htmlspecialchars($GLOBALS['xoopsConfig']['slogan'], ENT_QUOTES), 'xoops_search' => $xoops_search));
     if (isset($GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser'])) {
         $this->template->assign(array('xoops_isuser' => true, 'xoops_avatar' => XOOPS_UPLOAD_URL . '/' . $GLOBALS['xoopsUser']->getVar('user_avatar'), 'xoops_userid' => $GLOBALS['xoopsUser']->getVar('uid'), 'xoops_uname' => $GLOBALS['xoopsUser']->getVar('uname'), 'xoops_name' => $GLOBALS['xoopsUser']->getVar('name'), 'xoops_isadmin' => $GLOBALS['xoopsUserIsAdmin'], 'xoops_usergroups' => $GLOBALS['xoopsUser']->getGroups()));
     } else {
         $this->template->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false, 'xoops_usergroups' => array(XOOPS_GROUP_ANONYMOUS)));
     }
     // Meta tags
     $criteria = new CriteriaCompo(new Criteria('conf_modid', 0));
     $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER));
     $config = $configHandler->getConfigs($criteria, true);
     foreach (array_keys($config) as $i) {
         $name = $config[$i]->getVar('conf_name', 'n');
         $value = $config[$i]->getVar('conf_value', 'n');
         if (substr($name, 0, 5) === 'meta_') {
             $this->addMeta('meta', substr($name, 5), $value);
         } else {
             // prefix each tag with 'xoops_'
             $this->template->assign("xoops_{$name}", $value);
         }
     }
     // Load global javascript
     $this->addScript('include/xoops.js');
     $this->loadLocalization();
     if ($this->bufferOutput) {
         ob_start();
     }
     $GLOBALS['xoTheme'] =& $this;
     $GLOBALS['xoopsTpl'] =& $this->template;
     // Instanciate and initialize all the theme plugins
     foreach ($this->plugins as $k => $bundleId) {
         if (!is_object($bundleId)) {
             $this->plugins[$bundleId] = null;
             $this->plugins[$bundleId] = new $bundleId();
             $this->plugins[$bundleId]->theme =& $this;
             $this->plugins[$bundleId]->xoInit();
             unset($this->plugins[$k]);
         }
     }
     return true;
 }
Example #9
0
function showbanner()
{
    trigger_error("Function " . __FUNCTION__ . "() is deprecated, use xoops_getbanner instead", E_USER_NOTICE);
    echo xoops_getbanner();
}
Example #10
0
 /**
  * Initializes this theme
  *
  * Upon initialization, the theme creates its template engine and instanciates the
  * plug-ins from the specified {@link $plugins} list. If the theme is a 2.0 theme, that does not
  * display redirection messages, the HTTP redirections system is disabled to ensure users will
  * see the redirection screen.
  *
  * @param array $options
  * @return bool
  */
 public function xoInit($options = array())
 {
     global $xoops;
     $this->path = is_dir(ICMS_MODULES_PATH . '/system/themes/' . $this->folderName) ? ICMS_MODULES_PATH . '/system/themes/' . $this->folderName : ICMS_THEME_PATH . '/' . $this->folderName;
     $this->url = is_dir(ICMS_MODULES_PATH . '/system/themes/' . $this->folderName) ? ICMS_MODULES_URL . '/system/themes/' . $this->folderName : ICMS_THEME_URL . '/' . $this->folderName;
     $this->template = new icms_view_Tpl();
     $this->template->currentTheme =& $this;
     $this->template->assign_by_ref('xoTheme', $this);
     global $icmsConfig, $icmsConfigMetaFooter, $icmsModule, $xoopsModule;
     $this->template->assign(array('icms_style' => ICMS_URL . '/icms' . (defined('_ADM_USE_RTL') && _ADM_USE_RTL ? '_rtl' : '') . '.css', 'icms_theme' => $this->folderName, 'icms_imageurl' => is_dir(ICMS_MODULES_PATH . '/system/themes/' . $this->folderName . '/') ? ICMS_MODULES_URL . '/system/themes/' . $this->folderName . '/' : ICMS_THEME_URL . '/' . $this->folderName . '/', 'icms_themecss' => xoops_getcss($this->folderName), 'icms_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'icms_sitename' => htmlspecialchars($icmsConfig['sitename'], ENT_QUOTES), 'icms_slogan' => htmlspecialchars($icmsConfig['slogan'], ENT_QUOTES), 'icms_dirname' => @$icmsModule ? $icmsModule->getVar('dirname') : 'system', 'icms_banner' => $icmsConfig['banners'] ? xoops_getbanner() : '&nbsp;', 'icms_pagetitle' => isset($icmsModule) && is_object($icmsModule) ? $icmsModule->getVar('name') : htmlspecialchars($icmsConfig['slogan'], ENT_QUOTES)));
     // this is for backward compatibility only!
     $this->template->assign(array('xoops_theme' => $this->template->get_template_vars('icms_theme'), 'xoops_imageurl' => $this->template->get_template_vars('icms_imageurl'), 'xoops_themecss' => $this->template->get_template_vars('icms_themecss'), 'xoops_requesturi' => $this->template->get_template_vars('icms_requesturi'), 'xoops_sitename' => $this->template->get_template_vars('icms_sitename'), 'xoops_slogan' => $this->template->get_template_vars('icms_slogan'), 'xoops_dirname' => $this->template->get_template_vars('icms_dirname'), 'xoops_banner' => $this->template->get_template_vars('icms_banner')));
     if (isset(icms::$user) && is_object(icms::$user)) {
         $this->template->assign(array('icms_isuser' => TRUE, 'icms_userid' => icms::$user->getVar('uid'), 'icms_uname' => icms::$user->getVar('uname'), 'icms_isadmin' => icms::$user->isAdmin(), 'xoops_isuser' => TRUE, 'xoops_userid' => icms::$user->getVar('uid'), 'xoops_uname' => icms::$user->getVar('uname'), 'xoops_isadmin' => icms::$user->isAdmin()));
     } else {
         $this->template->assign(array('icms_isuser' => FALSE, 'icms_isadmin' => FALSE, 'xoops_isuser' => FALSE, 'xoops_isadmin' => FALSE));
     }
     // Meta tags
     foreach ($icmsConfigMetaFooter as $name => $value) {
         if (substr($name, 0, 5) == 'meta_') {
             $this->addMeta('meta', substr($name, 5), $value);
         } elseif (substr($name, 0, 6) == 'footer') {
             $values = $value;
             if ($icmsConfigMetaFooter['use_google_analytics'] == TRUE && isset($icmsConfigMetaFooter['google_analytics']) && $icmsConfigMetaFooter['google_analytics'] != '') {
                 $values = $value . '<script type="text/javascript">
                   var _gaq = _gaq || [];  _gaq.push(["_setAccount", "UA-' . $icmsConfigMetaFooter['google_analytics'] . '"]);  _gaq.push(["_trackPageview"]);
                   (function() {var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = TRUE;
                   ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
                   var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);})();
                 </script>';
             }
             $this->template->assign("xoops_{$name}", $values);
             $this->template->assign("icms_{$name}", $values);
         } else {
             // prefix each tag with 'xoops_'
             $this->template->assign("xoops_{$name}", $value);
             $this->template->assign("icms_{$name}", $value);
         }
     }
     if ($this->bufferOutput) {
         ob_start();
     }
     $GLOBALS['xoTheme'] =& $this;
     $GLOBALS['xoopsTpl'] =& $this->template;
     // Instanciate and initialize all the theme plugins
     foreach ($this->plugins as $k => $bundleId) {
         if (!is_object($bundleId)) {
             $this->plugins[$bundleId] = new $bundleId();
             $this->plugins[$bundleId]->theme =& $this;
             $this->plugins[$bundleId]->xoInit();
             unset($this->plugins[$k]);
         }
     }
     return TRUE;
 }
Example #11
0
 /**
  * Initializes this theme
  *
  * Upon initialization, the theme creates its template engine and instanciates the
  * plug-ins from the specified {@link $plugins} list. If the theme is a 2.0 theme, that does not
  * display redirection messages, the HTTP redirections system is disabled to ensure users will
  * see the redirection screen.
  *
  * @param array $options
  * @return bool
  */
 public function xoInit($options = array())
 {
     global $xoops;
     $this->path = is_dir(ICMS_MODULES_PATH . '/system/themes/' . $this->folderName) ? ICMS_MODULES_PATH . '/system/themes/' . $this->folderName : ICMS_THEME_PATH . '/' . $this->folderName;
     $this->url = is_dir(ICMS_MODULES_PATH . '/system/themes/' . $this->folderName) ? ICMS_MODULES_URL . '/system/themes/' . $this->folderName : ICMS_THEME_URL . '/' . $this->folderName;
     $this->template = new icms_view_Tpl();
     $this->template->currentTheme =& $this;
     $this->template->assign_by_ref('xoTheme', $this);
     global $icmsConfig, $icmsConfigMetaFooter, $icmsModule, $xoopsModule;
     $this->template->assign(array('icms_style' => ICMS_URL . '/icms' . (defined('_ADM_USE_RTL') && _ADM_USE_RTL ? '_rtl' : '') . '.css', 'icms_theme' => $this->folderName, 'icms_imageurl' => is_dir(ICMS_MODULES_PATH . '/system/themes/' . $this->folderName . '/') ? ICMS_MODULES_URL . '/system/themes/' . $this->folderName . '/' : ICMS_THEME_URL . '/' . $this->folderName . '/', 'icms_themecss' => xoops_getcss($this->folderName), 'icms_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'icms_sitename' => htmlspecialchars($icmsConfig['sitename'], ENT_QUOTES), 'icms_slogan' => htmlspecialchars($icmsConfig['slogan'], ENT_QUOTES), 'icms_dirname' => @$icmsModule ? $icmsModule->getVar('dirname') : 'system', 'icms_banner' => $icmsConfig['banners'] ? xoops_getbanner() : '&nbsp;', 'icms_pagetitle' => isset($icmsModule) && is_object($icmsModule) ? $icmsModule->getVar('name') : htmlspecialchars($icmsConfig['slogan'], ENT_QUOTES)));
     // this is for backward compatibility only!
     $this->template->assign(array('xoops_theme' => $this->template->get_template_vars('icms_theme'), 'xoops_imageurl' => $this->template->get_template_vars('icms_imageurl'), 'xoops_themecss' => $this->template->get_template_vars('icms_themecss'), 'xoops_requesturi' => $this->template->get_template_vars('icms_requesturi'), 'xoops_sitename' => $this->template->get_template_vars('icms_sitename'), 'xoops_slogan' => $this->template->get_template_vars('icms_slogan'), 'xoops_dirname' => $this->template->get_template_vars('icms_dirname'), 'xoops_banner' => $this->template->get_template_vars('icms_banner'), 'xoops_pagetitle' => $this->template->get_template_vars('icms_pagetitle')));
     if (isset(icms::$user) && is_object(icms::$user)) {
         $this->template->assign(array('icms_isuser' => true, 'icms_userid' => icms::$user->getVar('uid'), 'icms_uname' => icms::$user->getVar('uname'), 'icms_isadmin' => icms::$user->isAdmin(), 'xoops_isuser' => true, 'xoops_userid' => icms::$user->getVar('uid'), 'xoops_uname' => icms::$user->getVar('uname'), 'xoops_isadmin' => icms::$user->isAdmin()));
     } else {
         $this->template->assign(array('icms_isuser' => false, 'icms_isadmin' => false, 'xoops_isuser' => false, 'xoops_isadmin' => false));
     }
     // Meta tags
     foreach ($icmsConfigMetaFooter as $name => $value) {
         if (substr($name, 0, 5) == 'meta_') {
             $this->addMeta('meta', substr($name, 5), $value);
         } elseif (substr($name, 0, 6) == 'footer') {
             $values = $value;
             if ($icmsConfigMetaFooter['use_google_analytics'] == true && isset($icmsConfigMetaFooter['google_analytics']) && $icmsConfigMetaFooter['google_analytics'] != '') {
                 $values = $value . '<script type="text/javascript">
                 var pageTracker = _gat._getTracker("UA-' . $icmsConfigMetaFooter['google_analytics'] . '"); pageTracker._trackPageview();
                 </script>';
             }
             $this->template->assign("xoops_{$name}", $values);
             $this->template->assign("icms_{$name}", $values);
         } else {
             // prefix each tag with 'xoops_'
             $this->template->assign("xoops_{$name}", $value);
             $this->template->assign("icms_{$name}", $value);
         }
     }
     if ($this->bufferOutput) {
         ob_start();
     }
     $GLOBALS['xoTheme'] =& $this;
     $GLOBALS['xoopsTpl'] =& $this->template;
     // Instanciate and initialize all the theme plugins
     foreach ($this->plugins as $k => $bundleId) {
         if (!is_object($bundleId)) {
             $this->plugins[$bundleId] = new $bundleId();
             $this->plugins[$bundleId]->theme =& $this;
             $this->plugins[$bundleId]->xoInit();
             unset($this->plugins[$k]);
         }
     }
     return true;
 }
Example #12
0
 /**
  * Constructor
  *
  * @param bool $enableBanner whether to enable banners on this page
  * @param bool $debugging whether debugging is enabled
  * @param bool $mainService whether this is the main theme service (Not used yet, Mith)
  * @param string $name name of the theme to use
  *
  * @return void
  */
 function XTheme($enableBanner = true, $debugging = false, $mainService = false, $name = "")
 {
     $this->path = XOOPS_THEME_PATH;
     $this->url = XOOPS_THEME_URL;
     /*switch ($this->contentType) {
       case 'text/html':
       $this->document =& $GLOBALS[XOOPS]->create( 'xoops.output.document.xhtml' );
       break;
       default:
       $this->document =& $GLOBALS[XOOPS]->create( 'xoops.output.document' );
       }*/
     $this->enableBanner = $enableBanner;
     if ($name != "") {
         $this->name = $name;
     }
     $this->tplEngine = new XoopsTpl();
     $this->tplEngine->xoops_setDebugging($debugging);
     $this->tplEngine->template_dir = XOOPS_THEME_PATH;
     $this->tplEngine->assign('xoops_banner', $this->enableBanner ? xoops_getbanner() : '&#160;');
     $GLOBALS['xoopsTpl'] =& $this->tplEngine;
     if ($this->bufferOutput) {
         global $xoopsConfig;
         /* Forced */
         $xoopsConfig['gzip_compression'] = 0;
         //if Gzip is enabled and debug is turned off
         if ($xoopsConfig['gzip_compression'] == 1 && ($xoopsConfig['debug_mode'] == array(0 => 0) || $xoopsConfig['debug_mode'] == array())) {
             $ob_started = false;
             $phpver = phpversion();
             $useragent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
             if ($phpver >= '4.0.4pl1' && (strstr($useragent, 'compatible') || strstr($useragent, 'Gecko'))) {
                 if (extension_loaded('zlib')) {
                     ob_start('ob_gzhandler');
                     $ob_started = true;
                 }
             } else {
                 if ($phpver > '4.0') {
                     if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
                         if (extension_loaded('zlib')) {
                             ob_start();
                             ob_implicit_flush(0);
                             header('Content-Encoding: gzip');
                             $ob_started = true;
                         }
                     }
                 }
             }
             if (!$ob_started) {
                 ob_start();
             }
         } else {
             ob_start();
         }
     }
     $this->loadGlobalVars();
     $this->loadTheme();
     return true;
 }
Example #13
0
/**
 * Function to redirect a user to certain pages
 */
function redirect_header($url, $time = 3, $message = '', $addredirect = true, $allowExternalLink = false)
{
    global $xoopsConfig, $xoopsLogger, $xoopsUserIsAdmin;
    $xoopsPreload =& XoopsPreload::getInstance();
    $xoopsPreload->triggerEvent('core.include.functions.redirectheader', array($url, $time, $message, $addredirect, $allowExternalLink));
    if (preg_match("/[\\0-\\31]|about:|script:/i", $url)) {
        if (!preg_match('/^\\b(java)?script:([\\s]*)history\\.go\\(-[0-9]*\\)([\\s]*[;]*[\\s]*)$/si', $url)) {
            $url = XOOPS_URL;
        }
    }
    if (!$allowExternalLink && ($pos = strpos($url, '://'))) {
        $xoopsLocation = substr(XOOPS_URL, strpos(XOOPS_URL, '://') + 3);
        if (strcasecmp(substr($url, $pos + 3, strlen($xoopsLocation)), $xoopsLocation)) {
            $url = XOOPS_URL;
        }
    }
    if (defined('XOOPS_CPFUNC_LOADED')) {
        $theme = 'default';
    } else {
        $theme = $xoopsConfig['theme_set'];
    }
    require_once XOOPS_ROOT_PATH . '/class/template.php';
    require_once XOOPS_ROOT_PATH . '/class/theme.php';
    $xoopsThemeFactory = null;
    $xoopsThemeFactory = new xos_opal_ThemeFactory();
    $xoopsThemeFactory->allowedThemes = $xoopsConfig['theme_set_allowed'];
    $xoopsThemeFactory->defaultTheme = $theme;
    $xoTheme =& $xoopsThemeFactory->createInstance(array("plugins" => array()));
    $xoopsTpl =& $xoTheme->template;
    $xoopsTpl->assign(array('xoops_theme' => $theme, 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $theme . '/', 'xoops_themecss' => xoops_getcss($theme), 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), 'xoops_dirname' => isset($xoopsModule) && is_object($xoopsModule) ? $xoopsModule->getVar('dirname') : 'system', 'xoops_banner' => $xoopsConfig['banners'] ? xoops_getbanner() : '&nbsp;', 'xoops_pagetitle' => isset($xoopsModule) && is_object($xoopsModule) ? $xoopsModule->getVar('name') : htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
    if ($xoopsConfig['debug_mode'] == 2 && $xoopsUserIsAdmin) {
        $xoopsTpl->assign('time', 300);
        $xoopsTpl->assign('xoops_logdump', $xoopsLogger->dump());
    } else {
        $xoopsTpl->assign('time', intval($time));
    }
    if (!empty($_SERVER['REQUEST_URI']) && $addredirect && strstr($url, 'user.php')) {
        if (!strstr($url, '?')) {
            $url .= '?xoops_redirect=' . urlencode($_SERVER['REQUEST_URI']);
        } else {
            $url .= '&amp;xoops_redirect=' . urlencode($_SERVER['REQUEST_URI']);
        }
    }
    if (defined('SID') && SID && (!isset($_COOKIE[session_name()]) || $xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']]))) {
        if (!strstr($url, '?')) {
            $url .= '?' . SID;
        } else {
            $url .= '&amp;' . SID;
        }
    }
    $url = preg_replace("/&amp;/i", '&', htmlspecialchars($url, ENT_QUOTES));
    $xoopsTpl->assign('url', $url);
    $message = trim($message) != '' ? $message : _TAKINGBACK;
    $xoopsTpl->assign('message', $message);
    $xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
    $xoopsTpl->display('db:system_redirect.html');
    exit;
}