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
|
|
|
* feedback plugin for xoops modules |
14
|
|
|
* |
15
|
|
|
* @copyright module for xoops |
16
|
|
|
* @license GPL 2.0 or later |
17
|
|
|
* @package general |
18
|
|
|
* @since 1.0 |
19
|
|
|
* @min_xoops 2.5.9 |
20
|
|
|
* @author XOOPS - Website:<https://xoops.org> |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
use Xmf\Request; |
24
|
|
|
|
25
|
|
|
require __DIR__ . '/admin_header.php'; |
26
|
|
|
|
27
|
|
|
$adminObject = \Xmf\Module\Admin::getInstance(); |
28
|
|
|
|
29
|
|
|
$feedback = new \XoopsModules\Soapbox\Common\ModuleFeedback; |
30
|
|
|
|
31
|
|
|
// It recovered the value of argument op in URL$ |
32
|
|
|
$op = Request::getString('op', 'list'); |
33
|
|
|
$moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname'); |
34
|
|
|
$moduleDirNameUpper = mb_strtoupper($moduleDirName); |
35
|
|
|
xoops_loadLanguage('feedback', $moduleDirName); |
36
|
|
|
|
37
|
|
|
xoops_cp_header(); |
38
|
|
|
|
39
|
|
|
switch ($op) { |
40
|
|
|
case 'list': |
41
|
|
|
default: |
42
|
|
|
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); |
43
|
|
|
$feedback->name = $GLOBALS['xoopsUser']->getVar('name'); |
44
|
|
|
$feedback->email = $GLOBALS['xoopsUser']->getVar('email'); |
45
|
|
|
$feedback->site = XOOPS_URL; |
46
|
|
|
$form = $feedback->getFormFeedback(); |
47
|
|
|
echo $form->display(); |
|
|
|
|
48
|
|
|
break; |
49
|
|
|
|
50
|
|
|
case 'send': |
51
|
|
|
// Security Check |
52
|
|
|
if (!$GLOBALS['xoopsSecurity']->check()) { |
53
|
|
|
redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); |
57
|
|
|
|
58
|
|
|
$your_name = Request::getString('your_name', ''); |
59
|
|
|
$your_site = Request::getString('your_site', ''); |
60
|
|
|
$your_mail = Request::getString('your_mail', ''); |
61
|
|
|
$fb_type = Request::getString('fb_type', ''); |
62
|
|
|
$fb_content = Request::getText('fb_content', ''); |
63
|
|
|
$fb_content = str_replace(["\r\n", "\n", "\r"], '<br>', $fb_content); //clean line break from dhtmltextarea |
64
|
|
|
|
65
|
|
|
$title = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname'); |
66
|
|
|
$body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '<br>'; |
67
|
|
|
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '<br>'; |
68
|
|
|
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '<br>'; |
69
|
|
|
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '<br><br>'; |
70
|
|
|
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':<br>'; |
71
|
|
|
$body .= $fb_content; |
72
|
|
|
$xoopsMailer = xoops_getMailer(); |
73
|
|
|
$xoopsMailer->useMail(); |
74
|
|
|
$xoopsMailer->setToEmails($GLOBALS['xoopsModule']->getInfo('author_mail')); |
75
|
|
|
$xoopsMailer->setFromEmail($your_mail); |
76
|
|
|
$xoopsMailer->setFromName($your_name); |
77
|
|
|
$xoopsMailer->setSubject($title); |
78
|
|
|
$xoopsMailer->multimailer->isHTML(true); |
79
|
|
|
$xoopsMailer->setBody($body); |
80
|
|
|
$ret = $xoopsMailer->send(); |
81
|
|
|
if ($ret) { |
82
|
|
|
redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
// show form with content again |
86
|
|
|
$feedback->name = $your_name; |
87
|
|
|
$feedback->email = $your_mail; |
88
|
|
|
$feedback->site = $your_site; |
89
|
|
|
$feedback->type = $fb_type; |
90
|
|
|
$feedback->content = $fb_content; |
91
|
|
|
echo '<div align="center" style="width: 80%; padding: 10px; border: 2px solid #ff0000; color: #ff0000; margin-right:auto;margin-left:auto;"> |
92
|
|
|
<h3>' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_ERROR') . '</h3> |
93
|
|
|
</div>'; |
94
|
|
|
$form = $feedback->getFormFeedback(); |
95
|
|
|
echo $form->display(); |
|
|
|
|
96
|
|
|
|
97
|
|
|
break; |
98
|
|
|
} |
99
|
|
|
include __DIR__ . '/admin_footer.php'; |
100
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.