1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use XoopsModules\Wflinks; |
4
|
|
|
|
5
|
|
|
require dirname(__DIR__) . '/preloads/autoloader.php'; |
6
|
|
|
|
7
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
8
|
|
|
$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName |
9
|
|
|
|
10
|
|
|
/** @var \XoopsDatabase $db */ |
11
|
|
|
/** @var Wflinks\Helper $helper */ |
12
|
|
|
/** @var Wflinks\Utility $utility */ |
13
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
14
|
|
|
$helper = Wflinks\Helper::getInstance(); |
15
|
|
|
$utility = new Wflinks\Utility(); |
16
|
|
|
//$configurator = new Wflinks\Common\Configurator(); |
17
|
|
|
|
18
|
|
|
$helper->loadLanguage('common'); |
19
|
|
|
|
20
|
|
|
//handlers |
21
|
|
|
//$categoryHandler = new Wflinks\CategoryHandler($db); |
22
|
|
|
//$downloadHandler = new Wflinks\DownloadHandler($db); |
23
|
|
|
|
24
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
25
|
|
|
define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
26
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
27
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); |
28
|
|
|
define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
29
|
|
|
define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); |
30
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
31
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
32
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME')); |
33
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
34
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
35
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
36
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
37
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
//needed for Help |
41
|
|
|
define('_WFL_DIRNAME', basename(dirname(__DIR__))); |
42
|
|
|
|
43
|
|
|
/* |
44
|
|
|
* WARNING: ONCE SET DO NOT CHANGE! Improper use will render this module useless and unworkable. |
45
|
|
|
* Only Change if you know what you are doing. |
46
|
|
|
*/ |
47
|
|
|
if (!defined('WFLINKS_BROKEN')) { |
48
|
|
|
define('WFLINKS_BROKEN', 'wflinks_broken'); |
49
|
|
|
} |
50
|
|
|
if (!defined('WFLINKS_CAT')) { |
51
|
|
|
define('WFLINKS_CAT', 'wflinks_cat'); |
52
|
|
|
} |
53
|
|
|
if (!defined('WFLINKS_LINKS')) { |
54
|
|
|
define('WFLINKS_LINKS', 'wflinks_links'); |
55
|
|
|
} |
56
|
|
|
if (!defined('WFLINKS_MOD')) { |
57
|
|
|
define('WFLINKS_MOD', 'wflinks_mod'); |
58
|
|
|
} |
59
|
|
|
if (!defined('WFLINKS_VOTEDATA')) { |
60
|
|
|
define('WFLINKS_VOTEDATA', 'wflinks_votedata'); |
61
|
|
|
} |
62
|
|
|
if (!defined('WFLINKS_INDEXPAGE')) { |
63
|
|
|
define('WFLINKS_INDEXPAGE', 'wflinks_indexpage'); |
64
|
|
|
} |
65
|
|
|
if (!defined('WFLINKS_ALTCAT')) { |
66
|
|
|
define('WFLINKS_ALTCAT', 'wflinks_altcat'); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
70
|
|
|
$moduleDirNameUpper = mb_strtoupper($moduleDirName); |
71
|
|
|
|
72
|
|
|
if (!defined($moduleDirNameUpper . '_DIRNAME')) { |
73
|
|
|
//if (!defined(constant($capsDirName . '_DIRNAME'))) { |
74
|
|
|
define($moduleDirNameUpper . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
75
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME')); |
76
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME')); |
77
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
78
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME')); |
79
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
80
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
81
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
85
|
|
|
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); |
86
|
|
|
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
87
|
|
|
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
88
|
|
|
|
89
|
|
|
$icons = [ |
90
|
|
|
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
91
|
|
|
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
92
|
|
|
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
93
|
|
|
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
94
|
|
|
'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
95
|
|
|
'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
96
|
|
|
'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
97
|
|
|
'0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
98
|
|
|
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
99
|
|
|
]; |
100
|
|
|
|
101
|
|
|
$debug = false; |
102
|
|
|
|
103
|
|
|
// MyTextSanitizer object |
104
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
105
|
|
|
|
106
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
107
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
108
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
112
|
|
|
// Local icons path |
113
|
|
|
if (is_object($helper->getModule())) { |
114
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
115
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
116
|
|
|
|
117
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
|
|
|
118
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
119
|
|
|
} |
120
|
|
|
|