XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
header.php
Go to the documentation of this file.
1 <?php
22 defined('XOOPS_ROOT_PATH') or die('Restricted access');
23 
24 $xoopsPreload =& XoopsPreload::getInstance();
25 $xoopsPreload->triggerEvent('core.header.start');
26 
27 include_once $GLOBALS['xoops']->path('class/xoopsblock.php');
28 
29 $xoopsLogger =& XoopsLogger::getInstance();
30 $xoopsLogger->stopTime('Module init');
31 $xoopsLogger->startTime('XOOPS output init');
32 
33 if ($xoopsConfig['theme_set'] != 'default' && file_exists(XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/theme.php')) {
34  require_once $GLOBALS['xoops']->path('include/xoops13_header.php');
35 } else {
37 
38  $xoopsOption['theme_use_smarty'] = 1;
39 
40  // include Smarty template engine and initialize it
41  require_once $GLOBALS['xoops']->path('class/template.php');
42  require_once $GLOBALS['xoops']->path('class/theme.php');
43  require_once $GLOBALS['xoops']->path('class/theme_blocks.php');
44 
45  if (@$xoopsOption['template_main']) {
46  if (false === strpos($xoopsOption['template_main'], ':')) {
47  $xoopsOption['template_main'] = 'db:' . $xoopsOption['template_main'];
48  }
49  }
50 
53  $xoopsThemeFactory->allowedThemes = $xoopsConfig['theme_set_allowed'];
54  $xoopsThemeFactory->defaultTheme = $xoopsConfig['theme_set'];
55 
59  $xoTheme =& $xoopsThemeFactory->createInstance(array('contentTemplate' => @$xoopsOption['template_main']));
60  $xoopsTpl =& $xoTheme->template;
61 
62  $xoopsPreload->triggerEvent('core.header.addmeta');
63 
64  // Temporary solution for start page redirection
65  if (defined("XOOPS_STARTPAGE_REDIRECTED")) {
66  $params = $content = $tpl = $repeat = null;
67  $xoTheme->headContent($params, "<base href='" . XOOPS_URL . '/modules/' . $xoopsConfig['startpage'] . "/' />", $tpl, $repeat);
68  }
69 
70  if (@is_object($xoTheme->plugins['xos_logos_PageBuilder'])) {
71  $aggreg =& $xoTheme->plugins['xos_logos_PageBuilder'];
72  // Backward compatibility code for pre 2.0.14 themes
73  $xoopsTpl->assign_by_ref('xoops_lblocks', $aggreg->blocks['canvas_left']);
74  $xoopsTpl->assign_by_ref('xoops_rblocks', $aggreg->blocks['canvas_right']);
75  $xoopsTpl->assign_by_ref('xoops_ccblocks', $aggreg->blocks['page_topcenter']);
76  $xoopsTpl->assign_by_ref('xoops_clblocks', $aggreg->blocks['page_topleft']);
77  $xoopsTpl->assign_by_ref('xoops_crblocks', $aggreg->blocks['page_topright']);
78  $xoopsTpl->assign('xoops_showlblock', !empty($aggreg->blocks['canvas_left']));
79  $xoopsTpl->assign('xoops_showrblock', !empty($aggreg->blocks['canvas_right']));
80  $xoopsTpl->assign('xoops_showcblock', !empty($aggreg->blocks['page_topcenter']) || !empty($aggreg->blocks['page_topleft']) || !empty($aggreg->blocks['page_topright']));
81  }
82 
83  // Sets cache time
84  if (!empty($xoopsModule)) {
85  $xoTheme->contentCacheLifetime = @$xoopsConfig['module_cache'][$xoopsModule->getVar('mid', 'n')];
86  // Tricky solution for setting cache time for homepage
87  } else if (!empty($xoopsOption['template_main']) && $xoopsOption['template_main'] == 'db:system_homepage.html') {
88  $xoTheme->contentCacheLifetime = 604800;
89  }
90 
91  $xoopsPreload->triggerEvent('core.header.checkcache');
92  if ($xoTheme->checkCache()) {
93  $xoopsPreload->triggerEvent('core.header.cacheend');
94  exit();
95  }
96 
97  if (!isset($xoopsOption['template_main']) && $xoopsModule) {
98  // new themes using Smarty does not have old functions that are required in old modules, so include them now
99  include $GLOBALS['xoops']->path('include/old_theme_functions.php');
100  // need this also
101  $xoopsTheme['thename'] = $xoopsConfig['theme_set'];
102  ob_start();
103  }
104 
105  $xoopsLogger->stopTime('XOOPS output init');
106  $xoopsLogger->startTime('Module display');
107 }
108 
109 $xoopsPreload->triggerEvent('core.header.end');
110 ?>