1
|
|
|
<?php |
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
|
|
|
* Mymenus module |
13
|
|
|
* |
14
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
15
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
16
|
|
|
* @package mymenus |
17
|
|
|
* @since 1.5 |
18
|
|
|
* @author Xoops Development Team |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use XoopsModules\Mymenus; |
22
|
|
|
|
23
|
|
|
require dirname(__DIR__) . '/preloads/autoloader.php'; |
24
|
|
|
|
25
|
|
|
//defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
26
|
|
|
|
27
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
28
|
|
|
$moduleDirNameUpper = strtoupper($moduleDirName); //$capsDirName |
29
|
|
|
|
30
|
|
|
/** @var \XoopsDatabase $db */ |
31
|
|
|
/** @var \XoopsModules\Mymenus\Helper $helper */ |
32
|
|
|
/** @var \XoopsModules\Mymenus\Utility $utility */ |
33
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
34
|
|
|
$debug = false; |
35
|
|
|
$helper = \XoopsModules\Mymenus\Helper::getInstance($debug); |
36
|
|
|
$utility = new \XoopsModules\Mymenus\Utility(); |
37
|
|
|
|
38
|
|
|
$helper->loadLanguage('common'); |
39
|
|
|
|
40
|
|
|
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
41
|
|
|
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); |
42
|
|
|
if (is_object($helper->getModule())) { |
43
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
44
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
// This must contain the name of the folder in which reside mymenus |
48
|
|
|
define('MYMENUS_DIRNAME', basename(dirname(__DIR__))); |
49
|
|
|
define('MYMENUS_URL', XOOPS_URL . '/modules/' . MYMENUS_DIRNAME); |
50
|
|
|
define('MYMENUS_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . MYMENUS_DIRNAME); |
51
|
|
|
define('MYMENUS_IMAGES_URL', MYMENUS_URL . '/assets/images'); |
52
|
|
|
define('MYMENUS_ADMIN_URL', MYMENUS_URL . '/admin'); |
53
|
|
|
define('MYMENUS_ICONS_URL', MYMENUS_URL . '/assets/images/icons'); |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
//require MYMENUS_ROOT_PATH . '/include/config.php'; // IN PROGRESS |
57
|
|
|
require MYMENUS_ROOT_PATH . '/include/constants.php'; |
58
|
|
|
|
59
|
|
|
xoops_load('XoopsUserUtility'); |
|
|
|
|
60
|
|
|
xoops_load('XoopsFormLoader'); |
61
|
|
|
|
62
|
|
|
// module information |
63
|
|
|
$moduleImageUrl = MYMENUS_URL . '/assets/images/mymenus.png'; |
64
|
|
|
$moduleCopyrightHtml = ''; //"<br><br><a href='' title='' target='_blank'><img src='{$moduleImageUrl}' alt=''></a>"; |
65
|
|
|
|
66
|
|
|
// MyTextSanitizer object |
67
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
68
|
|
|
|
69
|
|
|
|
70
|
|
|
|
71
|
|
|
|
72
|
|
|
//This is needed or it will not work in blocks. |
73
|
|
|
global $mymenusIsAdmin; |
74
|
|
|
|
75
|
|
|
// Load only if module is installed |
76
|
|
|
if (is_object($helper->getModule())) { |
77
|
|
|
// Find if the user is admin of the module |
78
|
|
|
$mymenusIsAdmin = Mymenus\Helper::getInstance()->isUserAdmin(); |
79
|
|
|
} |
80
|
|
|
$xoopsModule = $helper->getModule(); |
81
|
|
|
|
82
|
|
|
// Load Xoops handlers |
83
|
|
|
/** @var XoopsModuleHandler $moduleHandler */ |
84
|
|
|
$moduleHandler = xoops_getHandler('module'); |
85
|
|
|
/** @var XoopsMemberHandler $memberHandler */ |
86
|
|
|
$memberHandler = xoops_getHandler('member'); |
87
|
|
|
/** @var XoopsNotificationHandler $notificationHandler */ |
88
|
|
|
$notificationHandler = xoops_getHandler('notification'); |
89
|
|
|
/** @var XoopsGroupPermHandler $grouppermHandler */ |
90
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
91
|
|
|
/** @var XoopsConfigHandler $configHandler */ |
92
|
|
|
$configHandler = xoops_getHandler('config'); |
93
|
|
|
|