XOOPS  2.6.0
site-closed.php
Go to the documentation of this file.
1 <?php
23 
25 
26 $allowed = false;
27 if ($xoops->isUser()) {
28  foreach ($xoops->user->getGroups() as $group) {
29  if (in_array($group, $xoops->getConfig('closesite_okgrp')) || FixedGroups::ADMIN == $group) {
30  $allowed = true;
31  break;
32  }
33  }
34 } else {
35  if (!empty($_POST['xoops_login'])) {
36  include_once $xoops->path('include/checklogin.php');
37  exit();
38  }
39 }
40 
41 if (!$allowed) {
42  $xoopsThemeFactory = null;
43  $xoopsThemeFactory = new XoopsThemeFactory();
44  $xoopsThemeFactory->allowedThemes = $xoops->getConfig('theme_set_allowed');
45  $xoopsThemeFactory->defaultTheme = $xoops->getConfig('theme_set');
46  $xoops->setTheme($xoopsThemeFactory->createInstance(array('plugins' => array())));
47  unset($xoopsThemeFactory);
48  $xoops->theme()->addScript('/include/xoops.js', array('type' => 'text/javascript'));
49  $xoops->setTpl($xoops->theme()->template);
50  $xoops->tpl()->assign(array(
51  'xoops_theme' => $xoops->getConfig('theme_set'),
52  'xoops_imageurl' => \XoopsBaseConfig::get('themes-url'); . '/' . $xoops->getConfig('theme_set') . '/',
53  'xoops_themecss' => $xoops->getCss($xoops->getConfig('theme_set')),
54  'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES),
55  'xoops_sitename' => htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES),
56  'xoops_slogan' => htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES),
57  'xoops_dirname' => $xoops->isModule() ? $xoops->module->getVar('dirname') : 'system',
58  'xoops_banner' => $xoops->getConfig('banners') ? $xoops->getBanner() : '&nbsp;',
59  'xoops_pagetitle' => $xoops->isModule() ? $xoops->module->getVar('name') : htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES),
60  'lang_login' => XoopsLocale::A_LOGIN, 'lang_username' => XoopsLocale::C_USERNAME, 'lang_password' => XoopsLocale::C_PASSWORD,
61  'lang_siteclosemsg' => $xoops->getConfig('closesite_text')
62  ));
63  //todo check if we can use $xoops->getConfig() instead
64  $config_handler = $xoops->getHandlerConfig();
65  $criteria = new CriteriaCompo(new Criteria('conf_modid', 1));
66  $criteria->add(new Criteria('conf_catid'));
67  $config = $config_handler->getConfigs($criteria, true);
68  foreach (array_keys($config) as $i) {
69  $name = $config[$i]->getVar('conf_name', 'n');
70  $value = $config[$i]->getVar('conf_value', 'n');
71  if (substr($name, 0, 5) == 'meta_') {
72  $xoops->tpl()->assign("xoops_$name", htmlspecialchars($value, ENT_QUOTES));
73  } else {
74  // prefix each tag with 'xoops_'
75  $xoops->tpl()->assign("xoops_$name", $value);
76  }
77  }
78  $xoops->tpl()->debugging = false;
79  $xoops->tpl()->debugging_ctrl = 'none';
80  $xoops->tpl()->caching = 0;
81  $xoops->tpl()->display('module:system/system_siteclosed.tpl');
82  exit();
83 }
84 unset($allowed, $group);
85 
86 return true;
$i
Definition: dialog.php:68
static getInstance()
Definition: Xoops.php:160
const A_LOGIN
Definition: en_US.php:102
$_SERVER['REQUEST_URI']
$xoops
Definition: site-closed.php:24
exit
Definition: browse.php:104
$allowed
Definition: site-closed.php:26
const C_USERNAME
Definition: en_US.php:194
if($_SERVER['REQUEST_METHOD']== 'POST') $config_handler
static get($name)
return $config
$criteria
const C_PASSWORD
Definition: en_US.php:188