1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Module: Countdown |
17
|
|
|
* |
18
|
|
|
* @category Module |
19
|
|
|
* @package countdown |
20
|
|
|
* @author XOOPS Development Team <https://xoops.org> |
21
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
22
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
23
|
|
|
* @link https://xoops.org/ |
24
|
|
|
* @since 1.0.0 |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
use XoopsModules\Countdown; |
28
|
|
|
|
29
|
|
|
require dirname(__DIR__) . '/preloads/autoloader.php'; |
30
|
|
|
|
31
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
32
|
|
|
$moduleDirNameUpper = strtoupper($moduleDirName); |
33
|
|
|
|
34
|
|
|
/** @var \XoopsDatabase $db */ |
35
|
|
|
/** @var Countdown\Helper $helper */ |
36
|
|
|
/** @var Countdown\Utility $utility */ |
37
|
|
|
|
38
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
39
|
|
|
$helper = Countdown\Helper::getInstance(); |
40
|
|
|
$utility = new Countdown\Utility(); |
41
|
|
|
//$configurator = new Countdown\Common\Configurator(); |
42
|
|
|
|
43
|
|
|
$helper->loadLanguage('common'); |
44
|
|
|
|
45
|
|
|
//handlers/** @var \XoopsPersistableObjectHandler $eventsHandler */ |
46
|
|
|
$eventsHandler = new Countdown\EventsHandler($db); |
47
|
|
|
$categoryHandler = new Countdown\CategoryHandler($db); |
48
|
|
|
|
49
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
50
|
|
|
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); |
51
|
|
|
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
52
|
|
|
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
53
|
|
|
|
54
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
55
|
|
|
define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
56
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName); |
57
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName); |
58
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName); |
59
|
|
|
define($moduleDirNameUpper . '_IMAGES_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
60
|
|
|
define($moduleDirNameUpper . '_IMAGES_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images/'); |
61
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
62
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
63
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
64
|
|
|
// define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
65
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
66
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
67
|
|
|
define($moduleDirNameUpper . '_CAT_IMAGES_URL', XOOPS_UPLOAD_URL . ' / ' . constant($moduleDirNameUpper . '_DIRNAME') . '/images/category'); |
68
|
|
|
define($moduleDirNameUpper . '_CAT_IMAGES_PATH', XOOPS_UPLOAD_PATH . '/' . constant($moduleDirNameUpper . '_DIRNAME') . ' / images / category'); |
69
|
|
|
define($moduleDirNameUpper . '_CACHE_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/'); |
70
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif'); |
71
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
//define option du module |
75
|
|
|
//define($moduleDirNameUpper. '_DISPLAY_CAT', $helper->getConfig('$mod_name_cat_display', 'none')); |
76
|
|
|
|
77
|
|
|
//require_once dirname(__DIR__) . '/include/seo_functions.php'; |
78
|
|
|
//require_once dirname(__DIR__) . '/class/PageNav.php'; |
79
|
|
|
|
80
|
|
|
//require_once XOOPS_ROOT_PATH . '/class/tree.php'; |
81
|
|
|
|
82
|
|
|
//require_once dirname(__DIR__) . '/class/Tree.php'; |
83
|
|
|
//require_once dirname(__DIR__) . '/class/FormSelect.php'; |
84
|
|
|
|
85
|
|
|
// Load only if module is installed |
86
|
|
|
//if (is_object($helper->getModule())) { |
87
|
|
|
// // Find if the user is admin of the module |
88
|
|
|
// $publisherIsAdmin = publisher\Utility::userIsAdmin(); |
89
|
|
|
// // get current page |
90
|
|
|
// $publisherCurrentPage = publisher\Utility::getCurrentPage(); |
91
|
|
|
//} |
92
|
|
|
|
93
|
|
|
$icons = [ |
94
|
|
|
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
95
|
|
|
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
96
|
|
|
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
97
|
|
|
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
98
|
|
|
'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
99
|
|
|
'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
100
|
|
|
'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
101
|
|
|
'0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
102
|
|
|
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
103
|
|
|
//'active' => "<img src='" . $pathIcon16 . "/active.gif' alt='" . _MD_ACTIVE . "' align='middle'>", |
104
|
|
|
]; |
105
|
|
|
|
106
|
|
|
$debug = false; |
107
|
|
|
|
108
|
|
|
// MyTextSanitizer object |
109
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
110
|
|
|
|
111
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
112
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
113
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
117
|
|
|
// Local icons path |
118
|
|
|
if (is_object($helper->getModule())) { |
119
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
120
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
121
|
|
|
|
122
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
|
|
|
123
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
124
|
|
|
} |
125
|
|
|
|