Passed
Pull Request — master (#19)
by Michael
02:30
created

include/common.php (1 issue)

Labels
Severity
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
/** @var \XoopsDatabase $db */
34
$db      = \XoopsDatabaseFactory::getDatabaseConnection();
35
$helper  = Helper::getInstance();
36
$utility = new Utility();
37
//$configurator = new Xoopstube\Common\Configurator();
38
39
$helper->loadLanguage('common');
40
41
//handlers
42
//$categoryHandler     = new Xoopstube\CategoryHandler($db);
43
//$downloadHandler     = new Xoopstube\DownloadHandler($db);
44
45
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) {
46
    define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
47
    define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
48
    define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
49
    define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName);
50
    define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
51
    define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
52
    define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
53
    define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
54
    define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
55
    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
56
    define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
57
    define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
58
    define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
59
}
60
61
$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16);
62
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
63
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16');
64
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
65
66
$icons = [
67
    'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
68
    'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
69
    'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
70
    'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
71
    'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
72
    'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
73
    'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
74
    '0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
75
    '1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
76
];
77
78
$debug = false;
79
80
// MyTextSanitizer object
81
$myts = \MyTextSanitizer::getInstance();
82
83
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
84
    require_once $GLOBALS['xoops']->path('class/template.php');
85
    $GLOBALS['xoopsTpl'] = new \XoopsTpl();
86
}
87
88
$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName);
89
// Local icons path
90
if (is_object($helper->getModule())) {
91
    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
92
    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
93
94
    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
0 ignored issues
show
Are you sure $pathModIcon16 of type array|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

94
    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . /** @scrutinizer ignore-type */ $pathModIcon16);
Loading history...
95
    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
96
}
97