XOOPS  2.6.0
index.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
13 
27 $mainfile = __DIR__ . '/mainfile.php';
28 if (file_exists($mainfile)) {
30 } elseif (file_exists(__DIR__ . '/install/index.php')) {
31  header('Location: install/index.php');
32  exit;
33 }
34 
35 
37 $xoops->preload()->triggerEvent('core.index.start');
38 
39 //check if start page is defined
40 if ($xoops->isActiveModule($xoops->getConfig('startpage'))) {
41  // Temporary solution for start page redirection
42  define('XOOPS_STARTPAGE_REDIRECTED', 1);
43  $module_handler = $xoops->getHandlerModule();
44  $xoops->module = $xoops->getModuleByDirname($xoops->getConfig('startpage'));
45  if (!$xoops->isModule() || !$xoops->module->getVar('isactive')) {
46  $xoops->header();
47  echo "<h4>" . XoopsLocale::E_NO_MODULE . "</h4>";
48  $xoops->footer();
49  }
50  $moduleperm_handler = $xoops->getHandlerGroupperm();
51  if ($xoops->isUser()) {
52  if (!$moduleperm_handler->checkRight('module_read', $xoops->module->getVar('mid'), $xoops->user->getGroups())) {
54  }
55  $xoops->userIsAdmin = $xoops->user->isAdmin($xoops->module->getVar('mid'));
56  } else {
57  if (!$moduleperm_handler->checkRight('module_read', $xoops->module->getVar('mid'), XOOPS_GROUP_ANONYMOUS)) {
58  $xoops->redirect(\XoopsBaseConfig::get('url') . "/user.php", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
59  }
60  }
61  if ($xoops->module->getVar('hasconfig') == 1
62  || $xoops->module->getVar('hascomments') == 1
63  || $xoops->module->getVar('hasnotification') == 1
64  ) {
65  $xoops->moduleConfig = $xoops->getModuleConfigs();
66  }
67 
68  chdir('modules/' . $xoops->getConfig('startpage') . '/');
69  $xoops->loadLanguage('main', $xoops->module->getVar('dirname', 'n'));
70  $parsed = parse_url($xoops->globalData->getVar('url'));
71  $url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://';
72  if (isset($parsed['host'])) {
73  $url .= $parsed['host'];
74  if (isset($parsed['port'])) {
75  $url .= ':' . $parsed['port'];
76  }
77  } else {
78  $url .= $_SERVER['HTTP_HOST'];
79  }
80 
81  $_SERVER['REQUEST_URI'] =
82  substr(\XoopsBaseConfig::get('url'), strlen($url)) . '/modules/' . $xoops->getConfig('startpage') . '/index.php';
83  include $xoops->path('modules/' . $xoops->getConfig('startpage') . '/index.php');
84  exit();
85 } else {
86  $xoops->setOption('show_cblock', 1);
87  $xoops->header("module:system/system_homepage.tpl");
88  $xoops->footer();
89 }
static getInstance()
Definition: Xoops.php:160
$_SERVER['REQUEST_URI']
exit
Definition: browse.php:104
const E_NO_MODULE
Definition: en_US.php:353
static get($name)
const E_NO_ACCESS_PERMISSION
Definition: en_US.php:351
$url
Definition: register.php:72
$module_handler
Definition: main.php:55
$moduleperm_handler
Definition: cp_header.php:31
$mainfile
Definition: index.php:27
if(file_exists($mainfile)) elseif(file_exists(__DIR__. '/install/index.php')) $xoops
Definition: index.php:36