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\Xoopsfaq\{
|
19
|
|
|
Helper,
|
20
|
|
|
Utility
|
21
|
|
|
};
|
22
|
|
|
|
23
|
|
|
require \dirname(__DIR__) . '/preloads/autoloader.php';
|
24
|
|
|
|
25
|
|
|
$moduleDirName = \basename(\dirname(__DIR__));
|
26
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
|
27
|
|
|
|
28
|
|
|
/** @var \XoopsDatabase $db */
|
29
|
|
|
/** @var \XoopsModules\Xoopsfaq\Helper $helper */
|
30
|
|
|
/** @var \XoopsModules\Xoopsfaq\Utility $utility */
|
31
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection();
|
32
|
|
|
$helper = Helper::getInstance();
|
33
|
|
|
$utility = new Utility();
|
34
|
|
|
//$configurator = new \XoopsModules\Xoopsfaq\Common\Configurator();
|
35
|
|
|
|
36
|
|
|
$helper->loadLanguage('common');
|
37
|
|
|
|
38
|
|
|
//handlers/** @var \XoopsPersistableObjectHandler $contentsHandler */
|
39
|
|
|
$contentsHandler = $helper->getHandler('Contents');
|
40
|
|
|
/** @var \XoopsPersistableObjectHandler $categoriesHandler */
|
41
|
|
|
$categoriesHandler = $helper->getHandler('Category');
|
42
|
|
|
|
43
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', '16');
|
44
|
|
|
$pathIcon32 = Xmf\Module\Admin::iconUrl('', '32');
|
45
|
|
|
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16');
|
46
|
|
|
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
|
47
|
|
|
|
48
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) {
|
49
|
|
|
define($moduleDirNameUpper . '_' . 'DIRNAME', basename(dirname(__DIR__)));
|
50
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
|
51
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
|
52
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
|
53
|
|
|
define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
|
54
|
|
|
define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
|
55
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
|
56
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
|
57
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
|
58
|
|
|
// define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
|
59
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
|
60
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
|
61
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif');
|
62
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
|
63
|
|
|
}
|
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
|
|
|
|
104
|
|
|
|