XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
index.php
Go to the documentation of this file.
1 <?php
22 include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php';
23 
25 $xoopsPreload->triggerEvent('core.index.start');
26 
27 //check if start page is defined
28 if (isset($xoopsConfig['startpage']) && $xoopsConfig['startpage'] != "" && $xoopsConfig['startpage'] != "--" && xoops_isActiveModule($xoopsConfig['startpage'])) {
29  // Temporary solution for start page redirection
30  define("XOOPS_STARTPAGE_REDIRECTED", 1);
31 
32  global $xoopsModuleConfig;
33  $module_handler =& xoops_gethandler('module');
34  $xoopsModule =& $module_handler->getByDirname($xoopsConfig['startpage']);
35  if (!$xoopsModule || !$xoopsModule->getVar('isactive')) {
36  include_once $GLOBALS['xoops']->path('header.php');
37  echo "<h4>" . _MODULENOEXIST . "</h4>";
38  include_once $GLOBALS['xoops']->path('footer.php');
39  exit();
40  }
41  $moduleperm_handler =& xoops_gethandler('groupperm');
42  if ($xoopsUser) {
43  if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
44  redirect_header(XOOPS_URL, 1, _NOPERM, false);
45  exit();
46  }
47  $xoopsUserIsAdmin = $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
48  } else {
49  if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), XOOPS_GROUP_ANONYMOUS)) {
50  redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM);
51  exit();
52  }
53  }
54  if ($xoopsModule->getVar('hasconfig') == 1 || $xoopsModule->getVar('hascomments') == 1 || $xoopsModule->getVar('hasnotification') == 1) {
55  $xoopsModuleConfig = $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid'));
56  }
57 
58  chdir('modules/' . $xoopsConfig['startpage'] . '/');
59  xoops_loadLanguage('main', $xoopsModule->getVar('dirname', 'n'));
60  $parsed = parse_url(XOOPS_URL);
61  $url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://';
62  if (isset($parsed['host'])) {
63  $url .= $parsed['host'];
64  if (isset($parsed['port'])) {
65  $url .= ':' . $parsed['port'];
66  }
67  } else {
68  $url .= $_SERVER['HTTP_HOST'];
69  }
70 
71  $_SERVER['REQUEST_URI'] = substr(XOOPS_URL, strlen($url)) . '/modules/' . $xoopsConfig['startpage'] . '/index.php';
72  include $GLOBALS['xoops']->path('modules/' . $xoopsConfig['startpage'] . '/index.php');
73  exit();
74 } else {
75  $xoopsOption['show_cblock'] = 1;
76  $xoopsOption['template_main'] = "db:system_homepage.html";
77  include $GLOBALS['xoops']->path('header.php');
78  include $GLOBALS['xoops']->path('footer.php');
79 }
80 ?>