1
|
|
|
<?php declare(strict_types=1); |
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
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
14
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
15
|
|
|
* @author XOOPS Development Team |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use XoopsModules\Xhelp; |
19
|
|
|
|
20
|
|
|
require_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
21
|
|
|
|
22
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
23
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
24
|
|
|
|
25
|
|
|
/** @var \XoopsDatabase $db */ |
26
|
|
|
/** @var Xhelp\Helper $helper */ |
27
|
|
|
/** @var Xhelp\Utility $utility */ |
28
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
29
|
|
|
$helper = Xhelp\Helper::getInstance(); |
30
|
|
|
$utility = new Xhelp\Utility(); |
31
|
|
|
//$configurator = new Xhelp\Common\Configurator(); |
32
|
|
|
|
33
|
|
|
$helper->loadLanguage('common'); |
34
|
|
|
$helper->loadLanguage('main'); |
35
|
|
|
$helper->loadLanguage('admin'); |
36
|
|
|
|
37
|
|
|
//handlers |
38
|
|
|
///** @var \XoopsPersistableObjectHandler $xhelp_brokenHandler */ |
39
|
|
|
//$xhelp_brokenHandler = new Xhelp\Xhelp_brokenHandler($db); |
40
|
|
|
|
41
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
42
|
|
|
define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
43
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
44
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName); |
45
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName); |
46
|
|
|
define($moduleDirNameUpper . '_IMAGES_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
47
|
|
|
define($moduleDirNameUpper . '_IMAGES_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images/'); |
48
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
49
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
50
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
51
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
52
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
53
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
54
|
|
|
define($moduleDirNameUpper . '_CAT_IMAGES_URL', XOOPS_UPLOAD_URL . ' / ' . constant($moduleDirNameUpper . '_DIRNAME') . '/images/category'); |
55
|
|
|
define($moduleDirNameUpper . '_CAT_IMAGES_PATH', XOOPS_UPLOAD_PATH . '/' . constant($moduleDirNameUpper . '_DIRNAME') . ' / images / category'); |
56
|
|
|
// define($moduleDirNameUpper . '_CACHE_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/'); |
57
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', '16'); |
61
|
|
|
$pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); |
62
|
|
|
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
63
|
|
|
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
64
|
|
|
|
65
|
|
|
$icons = [ |
66
|
|
|
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
67
|
|
|
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
68
|
|
|
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
69
|
|
|
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
70
|
|
|
'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
71
|
|
|
'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
72
|
|
|
'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
73
|
|
|
'0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
74
|
|
|
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
75
|
|
|
]; |
76
|
|
|
|
77
|
|
|
$debug = false; |
78
|
|
|
|
79
|
|
|
// MyTextSanitizer object |
80
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
81
|
|
|
|
82
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
83
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
84
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', $helper->url()); |
88
|
|
|
// Local icons path |
89
|
|
|
if (is_object($helper->getModule())) { |
90
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
91
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
92
|
|
|
|
93
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
|
|
|
94
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
xoops_loadLanguage('main', $moduleDirName); |
98
|
|
|
if (class_exists('D3LanguageManager')) { |
99
|
|
|
require_once XOOPS_TRUST_PATH . "/libs/altsys/class/D3LanguageManager.class.php"; |
100
|
|
|
$langman = D3LanguageManager::getInstance(); |
|
|
|
|
101
|
|
|
$langman->read('main.php', $moduleDirName); |
102
|
|
|
} |
103
|
|
|
|