These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * **************************************************************************** |
||
4 | * GBOOK - MODULE FOR XOOPS |
||
5 | * Copyright (c) 2007 - 2012 |
||
6 | * Ingo H. de Boer (http://www.winshell.org) |
||
7 | * |
||
8 | * This program is free software; you can redistribute it and/or modify |
||
9 | * it under the terms of the GNU General Public License as published by |
||
10 | * the Free Software Foundation; either version 2 of the License, or |
||
11 | * (at your option) any later version. |
||
12 | * |
||
13 | * You may not change or alter any portion of this comment or credits |
||
14 | * of supporting developers from this source code or any supporting |
||
15 | * source code which is considered copyrighted (c) material of the |
||
16 | * original comment or credit authors. |
||
17 | * |
||
18 | * This program is distributed in the hope that it will be useful, |
||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
21 | * GNU General Public License for more details. |
||
22 | * --------------------------------------------------------------------------- |
||
23 | * |
||
24 | * @copyright Ingo H. de Boer (http://www.winshell.org) |
||
25 | * @license GNU General Public License (GPL) |
||
26 | * @package GBook |
||
27 | * @author Ingo H. de Boer ([email protected]) |
||
28 | * |
||
29 | * **************************************************************************** |
||
30 | */ |
||
31 | use Xmf\Request; |
||
32 | |||
33 | include_once __DIR__ . '/header.php'; |
||
34 | include_once __DIR__ . '/class/utilities.php'; |
||
35 | |||
36 | //Assign info |
||
37 | $myts = MyTextSanitizer::getInstance(); |
||
38 | //$nameTmp0 = isset($_POST['Name']) ? $myts->stripSlashesGPC(trim($_POST['Name'])) : (null !== $xoopsUser ? $xoopsUser->getVar('uname', 'E') : ''); |
||
0 ignored issues
–
show
|
|||
39 | $nameTmp = Request::getString('Name', '', 'POST') ?: (null !== $xoopsUser ? $xoopsUser->getVar('uname', 'E') : ''); |
||
40 | $emailTmp = Request::getString('Email', '', 'POST') ?: (null !== $xoopsUser ? $xoopsUser->getVar('email', |
||
41 | 'E') : ''); //isset($_POST['Email']) ? $myts->stripSlashesGPC(trim($_POST['Email'])) : (null !== $xoopsUser ? $xoopsUser->getVar('email', 'E') : ''); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
42 | $urlTmp = Request::getString('URL', '', 'POST') ?: (null !== $xoopsUser ? $xoopsUser->getVar('url', |
||
43 | 'E') : ''); //isset($_POST['URL']) ? $myts->stripSlashesGPC(trim($_POST['URL'])) : (null !== $xoopsUser ? $xoopsUser->getVar('url', 'E') : ''); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
44 | $messageTmp = Request::getString('Message', '', |
||
45 | 'POST') ?: ''; //isset($_POST['Message']) ? $myts->stripSlashesGPC(trim($_POST['Message'])) : ''; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
78% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
46 | $timeTmp = time(); |
||
47 | $ipTmp = GBookUtilities::gbookIP(); |
||
48 | |||
49 | $GLOBALS['xoopsOption']['template_main'] = 'gbook_sign.tpl'; |
||
50 | $GLOBALS['xoopsOption']['xoops_module_header'] = '<link rel="stylesheet" type="text/css" href="assets/css/gbook.css" />'; |
||
51 | include XOOPS_ROOT_PATH . '/header.php'; |
||
52 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
53 | |||
54 | //Assign data to smarty tpl |
||
55 | $xoopsTpl->assign('lang_back', _MD_GBOOK_BACK); |
||
56 | $xoopsTpl->assign('lang_desc', _MD_GBOOK_DESC); |
||
57 | |||
58 | if (empty($_POST['submit'])) { |
||
59 | $gbookform = GBookUtilities::getSignForm($nameTmp, $emailTmp, $urlTmp, $messageTmp); |
||
60 | $gbookform->assign($xoopsTpl); |
||
61 | } else { |
||
62 | $stop = ''; |
||
63 | xoops_load('XoopsCaptcha'); |
||
64 | $xoopsCaptcha = xoopsCaptcha::getInstance(); |
||
65 | if (!$xoopsCaptcha->verify()) { |
||
66 | $stop .= $xoopsCaptcha->getMessage(); |
||
67 | } |
||
68 | if (!empty($emailTmp) && !checkEmail($emailTmp)) { |
||
69 | $stop .= _MD_GBOOK_EMAIL_INVALID; |
||
70 | } |
||
71 | if ('' !== $stop) { |
||
72 | $stop .= '<br />'; |
||
73 | $GLOBALS['xoopsTpl']->assign('stop', $stop); |
||
74 | $gbookform = GBookUtilities::getSignForm($nameTmp, $emailTmp, $urlTmp, $messageTmp); |
||
75 | $gbookform->assign($xoopsTpl); |
||
76 | } else { |
||
77 | $handler = xoops_getModuleHandler('entries'); |
||
78 | $obj = $handler->create(); |
||
79 | $obj->setVar('name', $nameTmp); |
||
80 | $obj->setVar('email', $emailTmp); |
||
81 | $obj->setVar('url', formatURL($urlTmp)); |
||
82 | $obj->setVar('message', $messageTmp); |
||
83 | $obj->setVar('time', $timeTmp); |
||
84 | $obj->setVar('ip', $ipTmp); |
||
85 | if ($handler->insert($obj)) { |
||
86 | redirect_header('index.php', 3, _MD_GBOOK_SIGNED); |
||
87 | } |
||
88 | include_once dirname(__DIR__) . '/include/forms.php'; |
||
89 | echo $obj->getHtmlErrors(); |
||
90 | $form = $obj->getForm(); |
||
91 | $form->display(); |
||
92 | } |
||
93 | } |
||
94 | |||
95 | include_once __DIR__ . '/footer.php'; |
||
96 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.