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
|
|
|
* xnewsletter module |
14
|
|
|
* |
15
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
16
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
17
|
|
|
* @package xnewsletter |
18
|
|
|
* @since 1.3 |
19
|
|
|
* @author Xoops Development Team |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
use XoopsModules\Xnewsletter; |
23
|
|
|
|
24
|
|
|
// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined"); |
25
|
|
|
|
26
|
|
|
include dirname(__DIR__) . '/preloads/autoloader.php'; |
27
|
|
|
|
28
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
29
|
|
|
$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName |
30
|
|
|
|
31
|
|
|
/** @var \XoopsDatabase $db */ |
32
|
|
|
/** @var \XoopsModules\Xnewsletter\Helper $helper */ |
33
|
|
|
/** @var \XoopsModules\Xnewsletter\Utility $utility */ |
34
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
35
|
|
|
$debug = false; |
36
|
|
|
$helper = \XoopsModules\Xnewsletter\Helper::getInstance($debug); |
37
|
|
|
$utility = new \XoopsModules\Xnewsletter\Utility(); |
38
|
|
|
|
39
|
|
|
$helper->loadLanguage('common'); |
40
|
|
|
|
41
|
|
|
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
42
|
|
|
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); |
43
|
|
|
if (is_object($helper->getModule())) { |
44
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
45
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
// This must contain the name of the folder in which reside xnewsletter |
49
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
50
|
|
|
define('XNEWSLETTER_DIRNAME', basename(dirname(__DIR__))); |
51
|
|
|
define('XNEWSLETTER_URL', XOOPS_URL . '/modules/' . XNEWSLETTER_DIRNAME); |
52
|
|
|
define('XNEWSLETTER_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . XNEWSLETTER_DIRNAME); |
53
|
|
|
define('XNEWSLETTER_IMAGES_URL', XNEWSLETTER_URL . '/assets/images'); |
54
|
|
|
define('XNEWSLETTER_ADMIN_URL', XNEWSLETTER_URL . '/admin'); |
55
|
|
|
define('XNEWSLETTER_ICONS_URL', XNEWSLETTER_URL . '/assets/images/icons'); |
56
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
require_once XNEWSLETTER_ROOT_PATH . '/config/config.php'; // IN PROGRESS |
60
|
|
|
require_once XNEWSLETTER_ROOT_PATH . '/include/functions.php'; |
61
|
|
|
require_once XNEWSLETTER_ROOT_PATH . '/include/constants.php'; |
62
|
|
|
require_once XNEWSLETTER_ROOT_PATH . '/config/icons.php'; |
63
|
|
|
|
64
|
|
|
xoops_load('XoopsUserUtility'); |
65
|
|
|
// MyTextSanitizer object |
66
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
67
|
|
|
|
68
|
|
|
$moduleImageUrl = XNEWSLETTER_URL . '/assets/images/xnewsletter.png'; |
69
|
|
|
$moduleCopyrightHtml = ''; //"<br><br><a href='' title='' target='_blank'><img src='{$moduleImageUrl}' alt=''></a>"; |
70
|
|
|
|
71
|
|
|
$debug = false; |
72
|
|
|
$helper = \XoopsModules\Xnewsletter\Helper::getInstance($debug); |
73
|
|
|
|
74
|
|
|
//This is needed or it will not work in blocks. |
75
|
|
|
global $xnewsletter_isAdmin; |
76
|
|
|
|
77
|
|
|
// Load only if module is installed |
78
|
|
|
if (is_object($helper->getModule())) { |
79
|
|
|
// Find if the user is admin of the module |
80
|
|
|
$xnewsletter_isAdmin = xnewsletter_userIsAdmin(); |
81
|
|
|
} |
82
|
|
|
$xoopsModule = $helper->getModule(); |
83
|
|
|
|
84
|
|
|
// Load Xoops handlers |
85
|
|
|
$moduleHandler = xoops_getHandler('module'); |
86
|
|
|
$memberHandler = xoops_getHandler('member'); |
87
|
|
|
/** @var \XoopsNotificationHandler $notificationHandler */ |
88
|
|
|
$notificationHandler = xoops_getHandler('notification'); |
89
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
90
|
|
|
$configHandler = xoops_getHandler('config'); |
91
|
|
|
|
92
|
|
|
$debug = false; |
93
|
|
|
|
94
|
|
|
// MyTextSanitizer object |
95
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
96
|
|
|
|
97
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
|
|
|
|
98
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
99
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
103
|
|
|
// Local icons path |
104
|
|
|
if (is_object($helper->getModule())) { |
105
|
|
|
$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
106
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
107
|
|
|
|
108
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
109
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
110
|
|
|
} |
111
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.