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.
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 | * @license http://www.blags.org/ |
||
5 | * @created :2010年05月20日 23时52分 |
||
6 | * @copyright 1997-2010 The Martin Group |
||
7 | * @author Martin <[email protected]> |
||
8 | * */ |
||
9 | if (!defined('XOOPS_ROOT_PATH')) { |
||
10 | return; |
||
11 | } |
||
12 | |||
13 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
14 | |||
15 | /** |
||
16 | * Class form_order |
||
17 | */ |
||
18 | class form_order extends XoopsThemeForm |
||
19 | { |
||
20 | /** |
||
21 | * form_order constructor. |
||
22 | * @param $OrderObj |
||
23 | */ |
||
24 | public function __construct(&$OrderObj) |
||
25 | { |
||
26 | //array |
||
27 | $this->OrderType = getModuleArray('order_type', 'order_type', true); |
||
28 | $this->OrderMode = getModuleArray('order_mode', 'order_mode', true); |
||
29 | $this->OrderPayMethod = getModuleArray('order_pay_method', 'order_pay_method', true); |
||
30 | $this->OrderStatus = getModuleArray('order_status', 'order_status', true); |
||
31 | $this->OrderDocumentType = getModuleArray('order_document_type', 'order_document_type', true); |
||
32 | |||
33 | //print_r($this->OrderStatus);exit; |
||
34 | |||
35 | $this->Obj = &$OrderObj; |
||
36 | parent::__construct(_AM_MARTIN_ORDER_INFORMATION, "op", xoops_getenv('PHP_SELF') . "?action=save"); |
||
37 | $this->setExtra('enctype="multipart/form-data"'); |
||
38 | |||
39 | $this->createElements(); |
||
40 | $this->createButtons(); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * created elements |
||
45 | * @license http://www.blags.org/ |
||
46 | * @created :2010年05月21日 20时40分 |
||
47 | * @copyright 1997-2010 The Martin Group |
||
48 | * @author Martin <[email protected]> |
||
49 | * */ |
||
50 | public function createElements() |
||
51 | { |
||
52 | //var_dump($this->Obj);exit; |
||
53 | //编辑器 |
||
54 | include_once XOOPS_ROOT_PATH . "/modules/martin/class/xoopsformloader.php"; |
||
55 | include_once MARTIN_ROOT_PATH . '/include/formdatetime.php'; |
||
56 | |||
57 | $Order = new XoopsFormElementTray(_AM_MARTIN_ORDER_ID); |
||
58 | $Order->addElement(new XoopsFormElementTray($this->Obj->order_id())); |
||
59 | $this->addElement($Order, false); |
||
60 | |||
61 | $order_type = new XoopsFormElementTray(_AM_MARTIN_PREDETERMINED_MANNER); |
||
62 | $orderIniType = $this->Obj->order_type(); |
||
63 | $order_type->addElement(new XoopsFormElementTray($this->OrderType[$orderIniType])); |
||
64 | $this->addElement($order_type, false); |
||
65 | |||
66 | $order_status = new XoopsFormElementTray(_AM_MARTIN_ORDER_STATUS); |
||
67 | $StatusElement = new XoopsFormSelect(_AM_MARTIN_CURRENT_CONDITION . ':' . $this->OrderStatus[$this->Obj->order_status()] . '<br>', 'order_status', $this->Obj->order_status(), 1); |
||
68 | $StatusElement->addOptionArray($this->OrderStatus); |
||
69 | $order_status->addElement($StatusElement, false); |
||
70 | |||
71 | if ($qrooms = $this->Obj->qrooms) { |
||
72 | $orderqrooms = '<br><br>'; |
||
73 | foreach ($qrooms as $room) { |
||
74 | $orderqrooms .= $orderqroomsPrefix . _AM_MARTIN_HOTEL_NAME . ': <a href="martin.hotel.php?action=add&id=' . $room['hotel_id'] . '">' . $room['hotel_name'] . '</a> '; |
||
0 ignored issues
–
show
|
|||
75 | $orderqrooms .= _AM_MARTIN_ROOM_COUNT . ': <a href="martin.room.php?action=add&id=' . $room['room_id'] . '">' . $room['room_name'] . '</a> '; |
||
76 | $orderqrooms .= _AM_MARTIN_THE_NUMBER_OF_ROOMS . ': <b>' . $room['room_count'] . '</b> '; |
||
77 | $orderqrooms .= _AM_MARTIN_RESERVATION_TIME . ': <b>' . date('Y-m-d', $room['room_date']) . '</b> '; |
||
78 | $orderqrooms .= _AM_MARTIN_PRICE_SETTING . ' : <input type="text" name="room_price[' . $room['room_id'] . '-' . $room['room_date'] . ']" value= ' . $room['room_price'] . '> '; |
||
79 | $orderqroomsPrefix = '<br><br>'; |
||
80 | } |
||
81 | } |
||
82 | |||
83 | //$orderqrooms .= '<br><br><input type="button" value="'._AM_MARTIN_SAVE_PRICE.'">'; |
||
84 | |||
85 | $order_status->addElement(new XoopsFormElementTray($orderqrooms)); |
||
0 ignored issues
–
show
The variable
$orderqrooms does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
86 | |||
87 | $this->addElement($order_status, false); |
||
88 | |||
89 | $order_pay_method = new XoopsFormElementTray(_AM_MARTIN_PAYMENT_ORDER); |
||
90 | $order_pay_method->addElement(new XoopsFormElementTray($this->OrderPayMethod[$this->Obj->order_pay_method()])); |
||
91 | $this->addElement($order_pay_method, false); |
||
92 | |||
93 | $order_total_price = new XoopsFormElementTray(_AM_MARTIN_THE_TOTAL_AMOUNT_OF_ORDERS); |
||
94 | $order_total_price->addElement(new XoopsFormElementTray($this->Obj->order_total_price())); |
||
95 | $this->addElement($order_total_price, false); |
||
96 | |||
97 | $order_pay_money = new XoopsFormElementTray(_AM_MARTIN_THE_ACTUAL_PAYMENT_AMOUNT); |
||
98 | $order_pay_money->addElement(new XoopsFormElementTray($this->Obj->order_pay_money())); |
||
99 | $this->addElement($order_pay_money, false); |
||
100 | |||
101 | $order_coupon = new XoopsFormElementTray(_AM_MARTIN_CASH_VOLUME_PAYMENT_AMOUNT); |
||
102 | $order_coupon->addElement(new XoopsFormElementTray($this->Obj->order_coupon())); |
||
103 | $this->addElement($order_coupon, false); |
||
104 | |||
105 | $order_sented_coupon = new XoopsFormElementTray(_AM_MARTIN_GET_MONEY); |
||
106 | $order_sented_coupon->addElement(new XoopsFormElementTray($this->Obj->order_sented_coupon())); |
||
107 | $this->addElement($order_sented_coupon, false); |
||
108 | |||
109 | $order_mode = new XoopsFormElementTray(_AM_MARTIN_ORDER_MODE); |
||
110 | $order_mode->addElement(new XoopsFormElementTray('<a href=' . XOOPS_URL . '/userinfo.php?uid=' . $this->Obj->order_uid() . '>' . $this->Obj->uname() . '</a>')); |
||
111 | $this->addElement($order_mode, false); |
||
112 | |||
113 | $order_real_name = new XoopsFormElementTray(_AM_MARTIN_ACTUAL_NAME); |
||
114 | $order_real_name->addElement(new XoopsFormElementTray($this->Obj->order_real_name())); |
||
115 | $this->addElement($order_real_name, false); |
||
116 | |||
117 | $order_document_type = new XoopsFormElementTray(_AM_MARTIN_CERTIFICATION_TYPE); |
||
118 | $order_document_type->addElement(new XoopsFormElementTray($this->OrderDocumentType[$this->Obj->order_document_type()])); |
||
119 | $this->addElement($order_document_type, false); |
||
120 | |||
121 | $order_document = new XoopsFormElementTray(_AM_MARTIN_CREDENTIALS); |
||
122 | $order_document->addElement(new XoopsFormElementTray($this->Obj->order_document())); |
||
123 | $this->addElement($order_document, false); |
||
124 | |||
125 | $order_phone = new XoopsFormElementTray(_AM_MARTIN_PHONE); |
||
126 | $order_phone->addElement(new XoopsFormElementTray($this->Obj->order_phone())); |
||
127 | $this->addElement($order_phone, false); |
||
128 | |||
129 | $order_telephone = new XoopsFormElementTray(_AM_MARTIN_PHONE); |
||
130 | $order_telephone->addElement(new XoopsFormElementTray($this->Obj->order_telephone())); |
||
131 | $this->addElement($order_telephone, false); |
||
132 | |||
133 | $extraPersons = $this->Obj->order_extra_persons(); |
||
134 | if (is_array($extraPersons)) { |
||
135 | var_dump($extraPersons); |
||
0 ignored issues
–
show
|
|||
136 | } |
||
137 | $order_extra_persons = new XoopsFormElementTray(_AM_MARTIN_INCIDENTAL_PERSONNEL_INFORMATION); |
||
138 | $order_extra_persons->addElement(new XoopsFormElementTray($$extraPersons)); |
||
139 | $this->addElement($order_extra_persons, false); |
||
140 | |||
141 | $order_note = new XoopsFormElementTray(_AM_MARTIN_ORDER_NOTES); |
||
142 | $order_note->addElement(new XoopsFormElementTray($this->Obj->order_note())); |
||
143 | $this->addElement($order_note, false); |
||
144 | |||
145 | $order_status_time = new XoopsFormElementTray(_AM_MARTIN_ORDERS_LAST_MODIFIED); |
||
146 | $order_status_time->addElement(new XoopsFormElementTray(date('Y-m-d H:i:s', $this->Obj->order_status_time()))); |
||
147 | $this->addElement($order_status_time, false); |
||
148 | |||
149 | $order_submit_time = new XoopsFormElementTray(_AM_MARTIN_ORDER_SUBMISSION_TIME); |
||
150 | $order_submit_time->addElement(new XoopsFormElementTray(date('Y-m-d H:i;s', $this->Obj->order_submit_time()))); |
||
151 | $this->addElement($order_submit_time, false); |
||
152 | |||
153 | $orderrooms = ''; |
||
154 | if ($rooms = $this->Obj->rooms) { |
||
155 | foreach ($rooms as $room) { |
||
156 | $orderrooms .= $orderroomsPrefix . _AM_MARTIN_HOTEL_NAME . ': <a href="martin.hotel.php?action=add&id=' . $room['hotel_id'] . '">' . $room['hotel_name'] . '</a> '; |
||
0 ignored issues
–
show
The variable
$orderroomsPrefix does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
157 | $orderrooms .= _AM_MARTIN_ROOM_COUNT . ': <a href="martin.room.php?action=add&id=' . $room['room_id'] . '">' . $room['room_name'] . '</a> '; |
||
158 | $orderrooms .= _AM_MARTIN_THE_NUMBER_OF_ROOMS . ': <b>' . $room['room_count'] . '</b> '; |
||
159 | $orderrooms .= _AM_MARTIN_RESERVATION_TIME . ': <b>' . date('Y-m-d', $room['room_date']) . '</b> '; |
||
160 | $orderrooms .= _AM_MARTIN_PRICE . ': <b>' . $room['room_price'] . '</b> '; |
||
161 | $orderroomsPrefix = '<br>'; |
||
162 | } |
||
163 | } |
||
164 | $order_rooms = new XoopsFormElementTray(_AM_MARTIN_ORDER_ROOM_INFORMATION); |
||
165 | $order_rooms->addElement(new XoopsFormElementTray($orderrooms)); |
||
166 | $this->addElement($order_rooms, false); |
||
167 | |||
168 | /*$this->addElement( new XoopsFormText('酒店排序', 'hotel_rank', 11, 11, $this->Obj->hotel_rank()), true); |
||
169 | |||
170 | $this->addElement( new XoopsFormText(_AM_MARTIN_HOTEL_NAME, 'hotel_name', 50, 255, $this->Obj->hotel_name()), true); |
||
171 | |||
172 | $this->addElement( new XoopsFormText('酒店英文名称', 'hotel_enname', 50, 255, $this->Obj->hotel_enname()), true); |
||
173 | |||
174 | $this->addElement( new XoopsFormText('酒店别名', 'hotel_alias', 50, 255, $this->Obj->hotel_alias()), true); |
||
175 | |||
176 | $this->addElement( new XoopsFormText(_AM_MARTIN_HOTEL_KEYWORDS_SEO, 'hotel_keywords', 50, 255, $this->Obj->hotel_keywords()), true); |
||
177 | |||
178 | $this->addElement( new XoopsFormTextArea(_AM_MARTIN_HOTEL_DESC_SEO, 'hotel_description', $this->Obj->hotel_description()) , true); |
||
179 | |||
180 | //hotel star |
||
181 | $rankElement = new XoopsFormSelect(_AM_MARTIN_HOTEL_STARS, 'hotel_star', $this->Obj->hotel_star() , 1 ); |
||
182 | $rankElement->addOptionArray($this->Ranks); |
||
183 | $this->addElement($rankElement , true); |
||
184 | |||
185 | $this->addElement( new XoopsFormText('酒店地址', 'hotel_address', 50, 255, $this->Obj->hotel_address()), true); |
||
186 | |||
187 | $this->addElement( new XoopsFormText('酒店电话', 'hotel_telephone', 50, 255, $this->Obj->hotel_telephone()), true); |
||
188 | |||
189 | $this->addElement( new XoopsFormText('酒店 FAX', 'hotel_fax', 50, 255, $this->Obj->hotel_fax()), true); |
||
190 | |||
191 | $this->addElement( new XoopsFormText('酒店特色', 'hotel_characteristic', 50, 255, $this->Obj->hotel_characteristic()), true); |
||
192 | |||
193 | $this->addElement( new XoopsFormText('酒店房间数', 'hotel_room_count', 11, 11, $this->Obj->hotel_room_count()), true); |
||
194 | |||
195 | //$this->addElement( new XoopsFormText(_AM_MARTIN_HOTEL_ROOM_PHOTOS, 'hotel_image', 50, 255, $this->Obj->hotel_image()), true); |
||
196 | |||
197 | //特殊处理 |
||
198 | //酒店地图 |
||
199 | $Coordinate = $this->Obj->hotel_google(); |
||
200 | $google = new XoopsFormElementTray('google 地图'); |
||
201 | $google->addElement(new XoopsFormText('纬度', 'GmapLatitude', 25, 25, $Coordinate[0]), true); |
||
202 | $google->addElement(new XoopsFormText('经度', 'GmapLongitude', 25, 25, $Coordinate[1]), true); |
||
203 | $google->addElement(new XoopsFormLabel("<br><br><font style='background-color:#2F5376;color:#FFFFFF;padding:2px;vertical-align:middle;'>google map:</font><br>", $this->googleMap($Coordinate) )); |
||
204 | |||
205 | //酒店图片 |
||
206 | $Img = new XoopsFormElementTray('酒店图片'); |
||
207 | $Img->addElement(new XoopsFormLabel("", $this->Swfupload() )); |
||
208 | |||
209 | $this->addElement($Img); |
||
210 | $this->addElement($google , true); |
||
211 | //特殊处理 |
||
212 | |||
213 | //编辑器 酒店详细信息 |
||
214 | $this->addElement( new XoopsFormTextArea('酒店特别提醒', 'hotel_reminded', $this->Obj->hotel_reminded()) , true); |
||
215 | $editor = 'tinymce'; |
||
216 | $hotel_info = $this->Obj->hotel_info(); |
||
217 | $editor_configs = array(); |
||
218 | $editor_configs["name"] ="hotel_info"; |
||
219 | $editor_configs["value"] = $hotel_info; |
||
220 | $editor_configs["rows"] = empty($xoopsModuleConfig["editor_rows"])? 35 : $xoopsModuleConfig["editor_rows"]; |
||
221 | $editor_configs["cols"] = empty($xoopsModuleConfig["editor_cols"])? 60 : $xoopsModuleConfig["editor_cols"]; |
||
222 | $editor_configs["width"] = empty($xoopsModuleConfig["editor_width"])? "100%" : $xoopsModuleConfig["editor_width"]; |
||
223 | $editor_configs["height"] = empty($xoopsModuleConfig["editor_height"])? "400px" : $xoopsModuleConfig["editor_height"]; |
||
224 | |||
225 | $this->addElement(new XoopsFormEditor("酒店详细信息", $editor, $editor_configs, false, $onfailure = null) , false); |
||
226 | //$this->addElement(new XoopsFormHidden("hotel_info", $hotel_info) , true ); |
||
227 | |||
228 | $this->addElement( new XoopsFormRadioYN("酒店编辑状态", 'hotel_status', $this->Obj->hotel_status(), _AM_MARTIN_PUBLISHED, _AM_MARTIN_DRAFT) , true); |
||
229 | $this->addElement( new MartinFormDateTime("酒店发布时间", 'hotel_open_time', $size = 15, $this->Obj->hotel_open_time() ) ,true);*/ |
||
230 | |||
231 | $this->addElement(new XoopsFormHidden('id', $this->Obj->order_id())); |
||
232 | } |
||
233 | |||
234 | /** |
||
235 | * @创建按钮 |
||
236 | * @license http://www.blags.org/ |
||
237 | * @created :2010年05月20日 23时52分 |
||
238 | * @copyright 1997-2010 The Martin Group |
||
239 | * @author Martin <[email protected]> |
||
240 | * */ |
||
241 | View Code Duplication | public function createButtons() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
242 | { |
||
243 | $button_tray = new XoopsFormElementTray('', ''); |
||
244 | // No ID for category -- then it's new category, button says 'Create' |
||
245 | if (!$this->Obj->order_id()) { |
||
246 | $butt_create = new XoopsFormButton('', '', _SUBMIT, 'submit'); |
||
247 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"'); |
||
248 | $button_tray->addElement($butt_create); |
||
249 | |||
250 | $butt_clear = new XoopsFormButton('', '', _RESET, 'reset'); |
||
251 | $button_tray->addElement($butt_clear); |
||
252 | |||
253 | $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button'); |
||
254 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
255 | $button_tray->addElement($butt_cancel); |
||
256 | |||
257 | $this->addElement($button_tray); |
||
258 | } else { |
||
259 | // button says 'Update' |
||
260 | $butt_create = new XoopsFormButton('', '', _EDIT, 'submit'); |
||
261 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"'); |
||
262 | $button_tray->addElement($butt_create); |
||
263 | |||
264 | $butt_clear = new XoopsFormButton('', '', _RESET, 'reset'); |
||
265 | $button_tray->addElement($butt_clear); |
||
266 | |||
267 | $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button'); |
||
268 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
269 | $button_tray->addElement($butt_cancel); |
||
270 | |||
271 | $this->addElement($button_tray); |
||
272 | } |
||
273 | } |
||
274 | |||
275 | /** |
||
276 | * @google 地图 |
||
277 | * @license http://www.blags.org/ |
||
278 | * @created :2010年05月24日 19时55分 |
||
279 | * @copyright 1997-2010 The Martin Group |
||
280 | * @author Martin <[email protected]> |
||
281 | * @param $Coordinate |
||
282 | */ |
||
283 | public function googleMap($Coordinate) |
||
284 | { |
||
285 | } |
||
286 | |||
287 | /** |
||
288 | * swf 多图片上传 |
||
289 | * @license http://www.blags.org/ |
||
290 | * @created :2010年05月24日 19时55分 |
||
291 | * @copyright 1997-2010 The Martin Group |
||
292 | * @author Martin <[email protected]> |
||
293 | * */ |
||
294 | public function Swfupload() |
||
295 | { |
||
296 | } |
||
297 | } |
||
298 |
If you define a variable conditionally, it can happen that it is not defined for all execution paths.
Let’s take a look at an example:
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.
Available Fixes
Check for existence of the variable explicitly:
Define a default value for the variable:
Add a value for the missing path: