|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Xooghost module |
|
4
|
|
|
* |
|
5
|
|
|
* You may not change or alter any portion of this comment or credits |
|
6
|
|
|
* of supporting developers from this source code or any supporting source code |
|
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
8
|
|
|
* This program is distributed in the hope that it will be useful, |
|
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
* |
|
12
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
13
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
14
|
|
|
* @package Xooghost |
|
15
|
|
|
* @since 2.6.0 |
|
16
|
|
|
* @author Laurent JEN (Aka DuGris) |
|
17
|
|
|
*/ |
|
18
|
|
|
use Xoops\Core\Request; |
|
19
|
|
|
|
|
20
|
|
|
include dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
21
|
|
|
|
|
22
|
|
|
\XoopsLoad::load('system', 'system'); |
|
23
|
|
|
$system = \System::getInstance(); |
|
24
|
|
|
|
|
25
|
|
|
$helper = \XoopsModules\Xooghost\Helper::getInstance(); |
|
26
|
|
|
$ghostConfig = $helper->loadConfig(); |
|
|
|
|
|
|
27
|
|
|
$pageHandler = $helper->getHandler('Page'); |
|
28
|
|
|
|
|
29
|
|
|
$xooghostUrl = basename(Request::getString('SCRIPT_NAME', '', 'SERVER')); |
|
30
|
|
|
$exclude = [ |
|
31
|
|
|
'footer.php', |
|
32
|
|
|
'header.php', |
|
33
|
|
|
'index.php', |
|
34
|
|
|
'page_like_dislike.php', |
|
35
|
|
|
'page_rate.php', |
|
36
|
|
|
'qrcode.php', |
|
37
|
|
|
'xoops_version.php', |
|
38
|
|
|
]; |
|
39
|
|
|
|
|
40
|
|
|
if (in_array($xooghostUrl, $exclude, true)) { |
|
41
|
|
|
$xoops->header('xooghost_index.tpl'); |
|
42
|
|
|
} else { |
|
43
|
|
|
$xoops->header('xooghost_page.tpl'); |
|
44
|
|
|
$page = $pageHandler->getByURL($xooghostUrl); |
|
|
|
|
|
|
45
|
|
|
if (is_object($page) && 0 != count($page) && $page->getVar('xooghost_online') && $page->getVar('xooghost_online')) { |
|
46
|
|
|
$_SESSION['xooghost_stat'] = true; |
|
47
|
|
|
$time = time(); |
|
48
|
|
|
$Xooghost_id = $page->getVar('xooghost_id'); |
|
49
|
|
|
if (!isset($_SESSION['xooghost_view' . $Xooghost_id]) || $_SESSION['xooghost_view' . $Xooghost_id] < $time) { |
|
50
|
|
|
$_SESSION['xooghost_view' . $Xooghost_id] = $time + 3600; |
|
51
|
|
|
$pageHandler->SetRead($page); |
|
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
// For comments module |
|
55
|
|
|
$_GET['ghost_id'] = $page->getVar('xooghost_id'); |
|
56
|
|
|
if ($plugin = \Xoops\Module\Plugin::getPlugin('xooghost', 'comments')) { |
|
57
|
|
|
$xoops->tpl()->assign('xooghost_com', $xoops->isActiveModule('comments')); |
|
58
|
|
|
} |
|
59
|
|
|
// For comments module |
|
60
|
|
|
|
|
61
|
|
|
$content = $page->getValues(); |
|
62
|
|
|
$content = $page->getRLD($content); |
|
63
|
|
|
$xoops->tpl()->assign('page', $content); |
|
64
|
|
|
$xoops->tpl()->assign('security', $xoops->security()->createToken()); |
|
65
|
|
|
$xoops->tpl()->assign('xoops_pagetitle', $page->getVar('xooghost_title') . ' - ' . $xoops->module->getVar('name')); |
|
66
|
|
|
$xoops->theme()->addMeta('meta', 'description', $page->getMetaDescription()); |
|
67
|
|
|
$xoops->theme()->addMeta('meta', 'keywords', $page->getMetaKeywords()); |
|
68
|
|
|
} else { |
|
69
|
|
|
$xoops->tpl()->assign('not_found', true); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
$xoops->theme()->addStylesheet('modules/xooghost/assets/css/module.css'); |
|
73
|
|
|
|
|
74
|
|
|
$xoops->tpl()->assign('moduletitle', $xoops->module->name()); |
|
75
|
|
|
|
|
76
|
|
|
$xoops->tpl()->assign('template', $ghostConfig['xooghost_main_mode']); |
|
77
|
|
|
$xoops->tpl()->assign('welcome', $ghostConfig['xooghost_welcome']); |
|
78
|
|
|
$xoops->tpl()->assign('width', $ghostConfig['xooghost_image_width']); |
|
79
|
|
|
$xoops->tpl()->assign('height', $ghostConfig['xooghost_image_height']); |
|
80
|
|
|
$xoops->tpl()->assign('xooghost_rld', $ghostConfig['xooghost_rld']); |
|
81
|
|
|
|
|
82
|
|
|
$xoops->tpl()->assign('qrcode', $xoops->isActiveModule('qrcode')); |
|
83
|
|
|
|
|
84
|
|
|
if ($xoops->isActiveModule('notifications')) { |
|
85
|
|
|
if ($plugin = \Xoops\Module\Plugin::getPlugin('xooghost', 'notifications') && $xoops->isUser()) { |
|
|
|
|
|
|
86
|
|
|
$xoops->tpl()->assign('xooghost_not', true); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|