This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
2 | |||
3 | namespace XoopsModules\Pedigree; |
||
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 | * Pedigree\Breadcrumb Class |
||
17 | * |
||
18 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
19 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
20 | * @author lucio <[email protected]> |
||
21 | * @package Pedigree |
||
22 | * @since 1.31 |
||
23 | */ |
||
24 | |||
25 | use XoopsFormLabel; |
||
26 | use XoopsModules\Pedigree; |
||
27 | |||
28 | /** |
||
29 | * Class Field |
||
30 | */ |
||
31 | class Field |
||
32 | { |
||
33 | protected $id; |
||
34 | |||
35 | /** |
||
36 | * @param $fieldnumber |
||
37 | * @param $config |
||
38 | */ |
||
39 | public function __construct($fieldnumber, $config) |
||
40 | { |
||
41 | //find key where id = $fieldnumber; |
||
42 | $configCount = \count($config); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
43 | foreach ($config as $x => $xValue) { |
||
44 | //@todo - figure out if this is suppose to be an assignment or just a compare ('=' or '==') |
||
45 | $config[$x]['id'] = $fieldnumber; |
||
46 | if ($config[$x]['id']) { |
||
47 | foreach ($config[$x] as $key => $value) { |
||
48 | $this->$key = $value; |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 | $this->id = $fieldnumber; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function isActive() |
||
59 | { |
||
60 | return '1' == $this->getSetting('isactive'); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function inAdvanced() |
||
67 | { |
||
68 | return '1' == $this->getSetting('viewinadvanced'); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return bool |
||
73 | */ |
||
74 | public function isLocked() |
||
75 | { |
||
76 | return '1' == $this->getSetting('locked'); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function hasSearch() |
||
83 | { |
||
84 | return '1' == $this->getSetting('hassearch'); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @return bool |
||
89 | */ |
||
90 | public function addLitter() |
||
91 | { |
||
92 | return '1' == $this->getSetting('litter'); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function generalLitter() |
||
99 | { |
||
100 | return ('1' == $this->getSetting('generallitter')); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function hasLookup() |
||
107 | { |
||
108 | return ('1' == $this->getSetting('lookuptable')); |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * @return string |
||
113 | */ |
||
114 | public function getSearchString() |
||
115 | { |
||
116 | return '&o=pname&p'; |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function inPie() |
||
123 | { |
||
124 | return ('1' == $this->getSetting('viewinpie')); |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * @return bool |
||
129 | */ |
||
130 | public function inPedigree() |
||
131 | { |
||
132 | return ('1' == $this->getSetting('viewinpedigree')); |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function inList() |
||
139 | { |
||
140 | return '1' == $this->getSetting('viewinlist'); |
||
141 | } |
||
142 | |||
143 | public function getId() |
||
144 | { |
||
145 | return $this->id; |
||
146 | } |
||
147 | |||
148 | /** |
||
149 | * @param $setting |
||
150 | * |
||
151 | * @return mixed |
||
152 | */ |
||
153 | public function getSetting($setting) |
||
154 | { |
||
155 | // return $this->{$setting}; |
||
156 | return isset($this->$setting) ? $this->$setting : null; |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * @param $fieldnumber |
||
161 | * |
||
162 | * @return array |
||
163 | */ |
||
164 | public function lookupField($fieldnumber) |
||
165 | { |
||
166 | $ret = []; |
||
167 | global $xoopsDB; |
||
168 | $SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix("pedigree_lookup{$fieldnumber}") . " ORDER BY 'order'"; |
||
169 | $result = $GLOBALS['xoopsDB']->query($SQL); |
||
170 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
171 | $ret[] = ['id' => $row['id'], 'value' => $row['value']]; |
||
172 | } |
||
173 | |||
174 | //array_multisort($ret,SORT_ASC); |
||
175 | return $ret; |
||
176 | } |
||
177 | |||
178 | /** |
||
179 | * @return \XoopsFormLabel |
||
180 | */ |
||
181 | public function viewField() |
||
182 | { |
||
183 | $view = new \XoopsFormLabel($this->fieldname, $this->value); |
||
0 ignored issues
–
show
|
|||
184 | |||
185 | return $view; |
||
186 | } |
||
187 | |||
188 | /** |
||
189 | * @return string |
||
190 | */ |
||
191 | public function showField() |
||
192 | { |
||
193 | return $this->fieldname . ' : ' . $this->value; |
||
0 ignored issues
–
show
|
|||
194 | } |
||
195 | |||
196 | /** |
||
197 | * @return mixed|string |
||
198 | */ |
||
199 | public function showValue() |
||
200 | { |
||
201 | global $myts; |
||
202 | |||
203 | return $myts->displayTarea($this->value); |
||
0 ignored issues
–
show
|
|||
204 | //return $this->value; |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * @return string |
||
209 | */ |
||
210 | public function searchField() |
||
211 | { |
||
212 | return '<input type="text" name="query" size="20">'; |
||
213 | } |
||
214 | } |
||
215 |