1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Modulebuilder\Common; |
4
|
|
|
|
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
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* My Module module for xoops |
17
|
|
|
* |
18
|
|
|
* @copyright 2020 XOOPS Project (https://xooops.org) |
19
|
|
|
* @license GPL 2.0 or later |
20
|
|
|
* @package Modulebuilder |
21
|
|
|
* @since 1.0 |
22
|
|
|
* @min_xoops 2.5.9 |
23
|
|
|
* @author Goffy - Email:<[email protected]> - Website:<http://xoops.org> |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
use XoopsModules\Modulebuilder; |
27
|
|
|
|
28
|
|
|
defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Object XoopsConfirm |
32
|
|
|
*/ |
33
|
|
|
class XoopsConfirm |
34
|
|
|
{ |
35
|
|
|
private $hiddens = []; |
36
|
|
|
private $action = ''; |
37
|
|
|
private $title = ''; |
38
|
|
|
private $label = ''; |
39
|
|
|
private $object = ''; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @public function constructor class |
43
|
|
|
* |
44
|
|
|
* @param null |
45
|
|
|
*/ |
46
|
|
|
public function __construct($hiddens, $action, $object, $title = '', $label = '') |
47
|
|
|
{ |
48
|
|
|
$this->hiddens = $hiddens; |
49
|
|
|
$this->action = $action; |
50
|
|
|
$this->object = $object; |
51
|
|
|
$this->title = $title; |
52
|
|
|
$this->label = $label; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @public function getXoopsConfirm |
57
|
|
|
* @param bool $action |
58
|
|
|
* @return \XoopsThemeForm |
59
|
|
|
*/ |
60
|
|
|
public function getFormXoopsConfirm() |
61
|
|
|
{ |
62
|
|
|
//in order to be accessable from user and admin area this should be place in language common.php |
63
|
|
|
define('CO__MODULEBUILDER_DELETE_CONFIRM', 'Confirm delete'); |
64
|
|
|
define('CO__MODULEBUILDER_DELETE_LABEL', 'Do you really want to delete:'); |
65
|
|
|
|
66
|
|
|
// Get Theme Form |
67
|
|
|
if ('' === $this->action) { |
68
|
|
|
$this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); |
69
|
|
|
} |
70
|
|
|
if ('' === $this->title) { |
71
|
|
|
$this->title = CO__MODULEBUILDER_DELETE_CONFIRM; |
72
|
|
|
} |
73
|
|
|
if ('' === $this->label) { |
74
|
|
|
|
75
|
|
|
$this->label = CO__MODULEBUILDER_DELETE_LABEL; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
xoops_load('XoopsFormLoader'); |
79
|
|
|
$form = new \XoopsThemeForm($this->title, 'formXoopsConfirm', $this->action, 'post', true); |
80
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
81
|
|
|
$form->addElement(new \XoopsFormLabel($this->label, $this->object)); |
82
|
|
|
//hiddens |
83
|
|
|
foreach ($this->hiddens as $key => $value) { |
84
|
|
|
$form->addElement(new \XoopsFormHidden($key, $value)); |
85
|
|
|
} |
86
|
|
|
$form->addElement(new \XoopsFormHidden('ok', 1)); |
87
|
|
|
$buttonTray = new \XoopsFormElementTray(''); |
88
|
|
|
$buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', _YES, 'submit', false)); |
|
|
|
|
89
|
|
|
$buttonBack = new \XoopsFormButton('', 'confirm_back', _NO, 'button', false); |
90
|
|
|
$buttonBack->setExtra('onclick="history.go(-1);return true;"'); |
91
|
|
|
$buttonTray->addElement($buttonBack); |
92
|
|
|
$form->addElement($buttonTray); |
93
|
|
|
return $form; |
94
|
|
|
} |
95
|
|
|
} |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.