-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheader.php
More file actions
88 lines (77 loc) · 3.46 KB
/
header.php
File metadata and controls
88 lines (77 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* Xooghost module
*
* 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 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @package Xooghost
* @since 2.6.0
* @author Laurent JEN (Aka DuGris)
*/
use Xoops\Core\Request;
include dirname(dirname(__DIR__)) . '/mainfile.php';
\XoopsLoad::load('system', 'system');
$system = \System::getInstance();
$helper = \XoopsModules\Xooghost\Helper::getInstance();
$ghostConfig = $helper->loadConfig();
$pageHandler = $helper->getHandler('Page');
$xooghostUrl = basename(Request::getString('SCRIPT_NAME', '', 'SERVER'));
$exclude = [
'footer.php',
'header.php',
'index.php',
'page_like_dislike.php',
'page_rate.php',
'qrcode.php',
'xoops_version.php',
];
if (in_array($xooghostUrl, $exclude, true)) {
$xoops->header('xooghost_index.tpl');
} else {
$xoops->header('xooghost_page.tpl');
$page = $pageHandler->getByURL($xooghostUrl);
if (is_object($page) && 0 != count($page) && $page->getVar('xooghost_online') && $page->getVar('xooghost_online')) {
$_SESSION['xooghost_stat'] = true;
$time = time();
$Xooghost_id = $page->getVar('xooghost_id');
if (!isset($_SESSION['xooghost_view' . $Xooghost_id]) || $_SESSION['xooghost_view' . $Xooghost_id] < $time) {
$_SESSION['xooghost_view' . $Xooghost_id] = $time + 3600;
$pageHandler->SetRead($page);
}
// For comments module
$_GET['ghost_id'] = $page->getVar('xooghost_id');
if ($plugin = \Xoops\Module\Plugin::getPlugin('xooghost', 'comments')) {
$xoops->tpl()->assign('xooghost_com', $xoops->isActiveModule('comments'));
}
// For comments module
$content = $page->getValues();
$content = $page->getRLD($content);
$xoops->tpl()->assign('page', $content);
$xoops->tpl()->assign('security', $xoops->security()->createToken());
$xoops->tpl()->assign('xoops_pagetitle', $page->getVar('xooghost_title') . ' - ' . $xoops->module->getVar('name'));
$xoops->theme()->addMeta('meta', 'description', $page->getMetaDescription());
$xoops->theme()->addMeta('meta', 'keywords', $page->getMetaKeywords());
} else {
$xoops->tpl()->assign('not_found', true);
}
}
$xoops->theme()->addStylesheet('modules/xooghost/assets/css/module.css');
$xoops->tpl()->assign('moduletitle', $xoops->module->name());
$xoops->tpl()->assign('template', $ghostConfig['xooghost_main_mode']);
$xoops->tpl()->assign('welcome', $ghostConfig['xooghost_welcome']);
$xoops->tpl()->assign('width', $ghostConfig['xooghost_image_width']);
$xoops->tpl()->assign('height', $ghostConfig['xooghost_image_height']);
$xoops->tpl()->assign('xooghost_rld', $ghostConfig['xooghost_rld']);
$xoops->tpl()->assign('qrcode', $xoops->isActiveModule('qrcode'));
if ($xoops->isActiveModule('notifications')) {
if ($plugin = \Xoops\Module\Plugin::getPlugin('xooghost', 'notifications') && $xoops->isUser()) {
$xoops->tpl()->assign('xooghost_not', true);
}
}