1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
/* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
* |
9
|
|
|
* This program is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @copyright XOOPS Project https://xoops.org/ |
16
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
17
|
|
|
* @package |
18
|
|
|
* @since |
19
|
|
|
* @author XOOPS Development Team |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
use Xmf\Module\Admin; |
23
|
|
|
use XoopsModules\Tdmdownloads\{ |
24
|
|
|
Helper |
25
|
|
|
}; |
26
|
|
|
|
27
|
|
|
require dirname(__DIR__) . '/preloads/autoloader.php'; |
28
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
29
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName); //$capsDirName |
30
|
|
|
/** @var \XoopsDatabase $db */ |
31
|
|
|
/** @var \XoopsModules\Tdmdownloads\Helper $helper */ |
32
|
|
|
/** @var \XoopsModules\Tdmdownloads\Utility $utility */ |
33
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
34
|
|
|
$debug = false; |
35
|
|
|
$helper = Helper::getInstance($debug); |
36
|
|
|
$utility = new \XoopsModules\Tdmdownloads\Utility(); |
37
|
|
|
//$configurator = new Tdmdownloads\Common\Configurator(); |
38
|
|
|
$helper->loadLanguage('common'); |
39
|
|
|
//handlers |
40
|
|
|
//appel des class |
41
|
|
|
$categoryHandler = Helper::getInstance()->getHandler('Category'); |
42
|
|
|
$downloadsHandler = Helper::getInstance()->getHandler('Downloads'); |
43
|
|
|
$downlimitHandler = Helper::getInstance()->getHandler('Downlimit'); |
44
|
|
|
$ratingHandler = Helper::getInstance()->getHandler('Rating'); |
45
|
|
|
$fieldHandler = Helper::getInstance()->getHandler('Field'); |
46
|
|
|
$fielddataHandler = Helper::getInstance()->getHandler('Fielddata'); |
47
|
|
|
$brokenHandler = Helper::getInstance()->getHandler('Broken'); |
48
|
|
|
$modifiedHandler = Helper::getInstance()->getHandler('Modified'); |
49
|
|
|
$modifieddataHandler = Helper::getInstance()->getHandler('Modifiedfielddata'); |
50
|
|
|
$pathIcon16 = Admin::iconUrl('', '16'); |
51
|
|
|
$pathIcon32 = Admin::iconUrl('', '32'); |
52
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
53
|
|
|
define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
54
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
55
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
56
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); |
57
|
|
|
define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
58
|
|
|
define($moduleDirNameUpper . '_ICONS_URL', constant($moduleDirNameUpper . '_URL') . '/assets/icons/'); |
59
|
|
|
define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); |
60
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
61
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
62
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
63
|
|
|
// define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
64
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
65
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
66
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif'); |
67
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
68
|
|
|
} |
69
|
|
|
$icons = [ |
70
|
|
|
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
71
|
|
|
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
72
|
|
|
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
73
|
|
|
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
74
|
|
|
'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
75
|
|
|
'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
76
|
|
|
'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
77
|
|
|
'0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
78
|
|
|
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
79
|
|
|
]; |
80
|
|
|
$debug = false; |
81
|
|
|
// MyTextSanitizer object |
82
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
83
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
84
|
|
|
require $GLOBALS['xoops']->path('class/template.php'); |
85
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
86
|
|
|
} |
87
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
88
|
|
|
// Local icons path |
89
|
|
|
if (is_object($helper->getModule())) { |
90
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
91
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
92
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
|
|
|
93
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon32); |
|
|
|
|
94
|
|
|
} |
95
|
|
|
|