1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Module: XoopsTube |
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
|
|
|
* PHP version 5 |
11
|
|
|
* |
12
|
|
|
* @category Module |
13
|
|
|
* @package Xoopstube |
14
|
|
|
* @author XOOPS Development Team, Irmtfan |
15
|
|
|
* @copyright 2001-2016 XOOPS Project (https://xoops.org) |
16
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
17
|
|
|
* @link https://xoops.org/ |
18
|
|
|
* @since 1.0.6 |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use XoopsModules\Xoopstube\{ |
22
|
|
|
Helper, |
23
|
|
|
Utility |
24
|
|
|
}; |
25
|
|
|
/** @var Helper $helper */ |
26
|
|
|
/** @var Utility $utility */ |
27
|
|
|
|
28
|
|
|
require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
29
|
|
|
|
30
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
31
|
|
|
$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName |
32
|
|
|
|
33
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
34
|
|
|
$helper = Helper::getInstance(); |
35
|
|
|
$utility = new Utility(); |
36
|
|
|
//$configurator = new Xoopstube\Common\Configurator(); |
37
|
|
|
|
38
|
|
|
$helper->loadLanguage('common'); |
39
|
|
|
|
40
|
|
|
//handlers |
41
|
|
|
//$categoryHandler = new Xoopstube\CategoryHandler($db); |
42
|
|
|
//$downloadHandler = new Xoopstube\DownloadHandler($db); |
43
|
|
|
|
44
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
45
|
|
|
define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
46
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
47
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
48
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName); |
49
|
|
|
define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
50
|
|
|
define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); |
51
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
52
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
53
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
54
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
55
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
56
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
57
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
58
|
|
|
// Do we resize pictures when they are smaller than defined dimensions ? |
59
|
|
|
define($moduleDirNameUpper . '_DONT_RESIZE_IF_SMALLER', true); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
63
|
|
|
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); |
64
|
|
|
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
65
|
|
|
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
66
|
|
|
|
67
|
|
|
$icons = [ |
68
|
|
|
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
69
|
|
|
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
70
|
|
|
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
71
|
|
|
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
72
|
|
|
'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
73
|
|
|
'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
74
|
|
|
'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
75
|
|
|
'0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
76
|
|
|
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
77
|
|
|
]; |
78
|
|
|
|
79
|
|
|
$debug = false; |
80
|
|
|
|
81
|
|
|
// MyTextSanitizer object |
82
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
83
|
|
|
|
84
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
85
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
86
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
90
|
|
|
// Local icons path |
91
|
|
|
if (is_object($helper->getModule())) { |
92
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
93
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
94
|
|
|
|
95
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
|
|
|
96
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
97
|
|
|
} |
98
|
|
|
|