Issues (143)

include/common.php (13 issues)

Labels
Severity
1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    XOOPS Project https://xoops.org/
14
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15
 * @package
16
 * @since
17
 * @author     XOOPS Development Team
18
 */
19
20
use XoopsModules\Xdonations;
21
22
require dirname(__DIR__) . '/preloads/autoloader.php';
23
24
$moduleDirName = basename(dirname(__DIR__));
25
$moduleDirNameUpper   = strtoupper($moduleDirName); //$capsDirName
26
27
28
/** @var \XoopsDatabase $db */
29
/** @var Xdonations\Helper $helper */
30
/** @var Xdonations\Utility $utility */
31
$db      = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
The type XoopsDatabaseFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
$helper  = Xdonations\Helper::getInstance();
33
$utility = new Xdonations\Utility();
34
//$configurator = new Xdonations\Common\Configurator();
35
36
$helper->loadLanguage('common');
37
38
//handlers
39
//$categoryHandler     = new Xdonations\CategoryHandler($db);
40
//$downloadHandler     = new Xdonations\DownloadHandler($db);
41
42
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) {
43
    define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
44
    define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
45
    define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
46
    define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
0 ignored issues
show
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
47
    define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
48
    define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
49
    define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
50
    define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
51
//    define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME'));
52
    define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
53
    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
54
    define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
0 ignored issues
show
The constant XOOPS_UPLOAD_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
55
    define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
0 ignored issues
show
The constant XOOPS_UPLOAD_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
56
    define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
57
}
58
59
60
61
$pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
0 ignored issues
show
The type Xmf\Module\Admin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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'>",
0 ignored issues
show
The constant _EDIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
68
    'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
0 ignored issues
show
The constant _DELETE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
69
    'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
0 ignored issues
show
The constant _CLONE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
70
    'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
0 ignored issues
show
The constant _PREVIEW was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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'>",
0 ignored issues
show
The constant _ADD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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();
0 ignored issues
show
The type MyTextSanitizer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
82
83
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
0 ignored issues
show
The type XoopsTpl was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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);
95
    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
96
}
97