|
1
|
|
|
<?php namespace XoopsModules\Smartobject\Form\Elements; |
|
2
|
|
|
/** |
|
3
|
|
|
* Contains the set password tray class |
|
4
|
|
|
* |
|
5
|
|
|
* @license GNU |
|
6
|
|
|
* @author marcan <[email protected]> |
|
7
|
|
|
* @link http://smartfactory.ca The SmartFactory |
|
8
|
|
|
* @package SmartObject |
|
9
|
|
|
* @subpackage SmartObjectForm |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
use XoopsModules\Smartobject; |
|
13
|
|
|
|
|
14
|
|
|
// defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class SmartFormSetPasswordElement |
|
18
|
|
|
* @package XoopsModules\Smartobject\Form\Elements |
|
19
|
|
|
*/ |
|
20
|
|
|
class SmartFormSetPasswordElement extends \XoopsFormElementTray |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* Size of the field. |
|
24
|
|
|
* @var int |
|
25
|
|
|
* @access private |
|
26
|
|
|
*/ |
|
27
|
|
|
public $_size; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Maximum length of the text |
|
31
|
|
|
* @var int |
|
32
|
|
|
* @access private |
|
33
|
|
|
*/ |
|
34
|
|
|
public $_maxlength; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Initial content of the field. |
|
38
|
|
|
* @var string |
|
39
|
|
|
* @access private |
|
40
|
|
|
*/ |
|
41
|
|
|
public $_value; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Constructor |
|
45
|
|
|
* |
|
46
|
|
|
* @param string $object |
|
47
|
|
|
* @param string $key |
|
48
|
|
|
* @internal param string $caption Caption |
|
49
|
|
|
* @internal param string $name "name" attribute |
|
50
|
|
|
* @internal param int $size Size of the field |
|
51
|
|
|
* @internal param int $maxlength Maximum length of the text |
|
52
|
|
|
* @internal param int $value Initial value of the field. |
|
53
|
|
|
* <b>Warning:</b> this is readable in cleartext in the page's source! |
|
54
|
|
|
*/ |
|
55
|
|
|
public function __construct($object, $key) |
|
56
|
|
|
{ |
|
57
|
|
|
$var = $object->vars[$key]; |
|
58
|
|
|
$control = $object->controls[$key]; |
|
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
61
|
|
|
|
|
62
|
|
|
$password_box1 = new \XoopsFormPassword('', $key . '1', 10, 32); |
|
63
|
|
|
$this->addElement($password_box1); |
|
64
|
|
|
|
|
65
|
|
|
$password_box2 = new \XoopsFormPassword('', $key . '2', 10, 32); |
|
66
|
|
|
$this->addElement($password_box2); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.