PHP Classes

File: htdocs/header.php

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/header.php   Download  
File: htdocs/header.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change: Merge pull request #1586 from mambax7/feature/Cannot_use_bool_as_array

fix for Cannot use bool as array
copyright update
Null coalescing operator
PER-CS formatting
'isset' can be replaced with coalesce
short array
Merge branch 'master' into feature/remove_error_suppression_operator
Merge pull request #1239 from Andrew-Staves-Activ/notificationhandler_subscribe_success

Merge branch 'feature/php8_templates' of https://github.com/mambax7/XoopsCore25 into feature/php8_templates

# Conflicts:
# htdocs/themes/xswatch4/modules/publisher/publisher_item.tpl
Merge xswatch4
Date: 10 months ago
Size: 4,521 bytes
 

Contents

Class file image Download
<?php
/**
 * XOOPS global header file
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       (c) 2000-2025 XOOPS Project (https://xoops.org)
 * @license             GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
 * @package             core
 * @since               2.0.0
 * @author              Kazumi Ono <webmaster@myweb.ne.jp>
 * @author              Skalpa Keo <skalpa@xoops.org>
 * @author              Taiwen Jiang <phppp@users.sourceforge.net>
 */

if (!defined('XOOPS_ROOT_PATH')) {
    throw new \RuntimeException('Restricted access');
}

$xoopsPreload = XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.header.start');

include_once $GLOBALS['xoops']->path('class/xoopsblock.php');

$xoopsLogger = XoopsLogger::getInstance();
$xoopsLogger->stopTime('Module init');
$xoopsLogger->startTime('XOOPS output init');

global $xoopsOption, $xoopsConfig, $xoopsModule;

// include Smarty template engine and initialize it
require_once $GLOBALS['xoops']->path('class/template.php');
require_once $GLOBALS['xoops']->path('class/theme.php');
require_once $GLOBALS['xoops']->path('class/theme_blocks.php');

if (isset($GLOBALS['xoopsOption']['template_main'])) {
    if (false === strpos($GLOBALS['xoopsOption']['template_main'], ':')) {
        $GLOBALS['xoopsOption']['template_main'] = 'db:' . $GLOBALS['xoopsOption']['template_main'];
    }
}

$xoopsThemeFactory                = null;
$xoopsThemeFactory                = new xos_opal_ThemeFactory();
$xoopsThemeFactory->allowedThemes = $xoopsConfig['theme_set_allowed'];
$xoopsThemeFactory->defaultTheme  = $xoopsConfig['theme_set'];

/**
 * @var xos_opal_Theme
 */
$xoTheme  = $xoopsThemeFactory->createInstance(['contentTemplate' => $xoopsOption['template_main'] ?? []]);
$xoopsTpl = $xoTheme->template;

$xoopsPreload->triggerEvent('core.header.addmeta');

// Temporary solution for start page redirection
if (defined('XOOPS_STARTPAGE_REDIRECTED')) {
    $params = $content = $tpl = $repeat = null;
    $xoTheme->headContent($params, "<base href='" . XOOPS_URL . '/modules/' . $xoopsConfig['startpage'] . "/' />", $tpl, $repeat);
}

if (@is_object($xoTheme->plugins['xos_logos_PageBuilder'])) {
    $aggreg = & $xoTheme->plugins['xos_logos_PageBuilder'];
    // Backward compatibility code for pre 2.0.14 themes
    $xoopsTpl->assignByRef('xoops_lblocks', $aggreg->blocks['canvas_left']);
    $xoopsTpl->assignByRef('xoops_rblocks', $aggreg->blocks['canvas_right']);
    $xoopsTpl->assignByRef('xoops_ccblocks', $aggreg->blocks['page_topcenter']);
    $xoopsTpl->assignByRef('xoops_clblocks', $aggreg->blocks['page_topleft']);
    $xoopsTpl->assignByRef('xoops_crblocks', $aggreg->blocks['page_topright']);
    $xoopsTpl->assign('xoops_showlblock', !empty($aggreg->blocks['canvas_left']));
    $xoopsTpl->assign('xoops_showrblock', !empty($aggreg->blocks['canvas_right']));
    $xoopsTpl->assign('xoops_showcblock', !empty($aggreg->blocks['page_topcenter']) || !empty($aggreg->blocks['page_topleft']) || !empty($aggreg->blocks['page_topright']));
}

// Sets cache time
if (!empty($xoopsModule)) {
    $xoTheme->contentCacheLifetime = $xoopsConfig['module_cache'][$xoopsModule->getVar('mid', 'n')] ?? 0;
    // Tricky solution for setting cache time for homepage
} elseif (!empty($GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] === 'db:system_homepage.tpl') {
    $xoTheme->contentCacheLifetime = 604800;
}

$xoopsPreload->triggerEvent('core.header.checkcache');
if ($xoTheme->checkCache()) {
    $xoopsPreload->triggerEvent('core.header.cacheend');
    //exit(); // see https://sourceforge.net/p/xoops/bugs/1261/
}

if (!isset($GLOBALS['xoopsOption']['template_main']) && $xoopsModule) {
    // new themes using Smarty do not have old functions that are required in old modules, so include them now
    include $GLOBALS['xoops']->path('include/old_theme_functions.php');
    // need this also
    $xoopsTheme['thename'] = $xoopsConfig['theme_set'];
    ob_start();
}

$xoopsLogger->stopTime('XOOPS output init');
$xoopsLogger->startTime('Module display');

$xoopsPreload->triggerEvent('core.header.end');