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 | include_once __DIR__ . '/admin_header.php'; |
||
3 | /* |
||
4 | * 处理 |
||
5 | **/ |
||
6 | |||
7 | //头部 |
||
8 | include "martin.header.php"; |
||
9 | $currentFile = basename(__FILE__); |
||
10 | $myModuleAdmin = new ModuleAdmin(); |
||
11 | echo $myModuleAdmin->addNavigation($currentFile); |
||
12 | |||
13 | //parameter 参数 |
||
14 | $action = isset($_POST['action']) ? $_POST['action'] : @$_GET['action']; |
||
15 | $action = empty($action) ? 'list' : $action; |
||
16 | $action = trim(strtolower($action)); |
||
17 | $id = !empty($_POST['id']) ? $_POST['id'] : @$_GET['id']; |
||
18 | $id = (int)($id); |
||
19 | $start = isset($_GET['start']) ? (int)($_GET['start']) : 0; |
||
20 | //确认删除 |
||
21 | $confirm = (isset($_POST['confirm'])) ? $_POST['confirm'] : 0; |
||
22 | //parameter 参数 |
||
23 | |||
24 | // martin_adminMenu(7, "订房后台 > 团购管理"); |
||
25 | |||
26 | $group_handler =& xoops_getmodulehandler('group', MARTIN_DIRNAME, true); |
||
27 | $hotelservice_handler =& xoops_getmodulehandler('hotelservice', MARTIN_DIRNAME, true); |
||
28 | |||
29 | //$HotelServiceObj = $hotelservice_handler->create(); |
||
30 | $GroupObj = $id > 0 ? $group_handler->get($id) : $group_handler->create(); |
||
31 | |||
32 | switch ($action) { |
||
33 | View Code Duplication | case "add": |
|
34 | include MARTIN_ROOT_PATH . 'include/form.group.php'; |
||
35 | martin_collapsableBar('createtable', 'createtableicon', _AM_MARTIN_ADD_CUSTOMERS, _AM_MARTIN_ADD_CUSTOMERS); |
||
36 | CreateButton(); |
||
37 | //Create_button(array('addcity'=>array('url'=>'mconfirmartin.hotel.city.php?action=add','value'=>_AM_MARTIN_CITY_NAME))); |
||
38 | $form = new form_group($GroupObj, $group_handler->getRoomList($id), $hotelservice_handler->GetHotelList()); |
||
39 | |||
40 | $form->display(); |
||
41 | martin_close_collapsable('createtable', 'createtableicon'); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
42 | break; |
||
43 | case "save": |
||
44 | //var_dump(($_POST['group_info']));exit; |
||
45 | $GroupObj->setVar('group_id', $id); |
||
46 | $GroupObj->setVar('group_name', (isset($_POST['group_name']) ? addslashes($_POST['group_name']) : '')); |
||
47 | $GroupObj->setVar('group_info', (isset($_POST['group_info']) ? ($_POST['group_info']) : '')); |
||
48 | $GroupObj->setVar('check_in_date', (isset($_POST['check_in_date'])) ? strtotime($_POST['check_in_date']) : 0); |
||
49 | $GroupObj->setVar('check_out_date', (isset($_POST['check_out_date'])) ? strtotime($_POST['check_out_date']) : 0); |
||
50 | //$GroupObj->setVar('apply_start_date', (isset($_POST['apply_start_date'])) ? strtotime($_POST['apply_start_date']) : 0); |
||
51 | //$GroupObj->setVar('apply_end_date', (isset($_POST['apply_end_date'])) ? strtotime($_POST['apply_end_date']) : 0); |
||
52 | |||
53 | $GroupObj->setVar('apply_start_date', (isset($_POST['apply_start_date'])) ? strtotime($_POST['apply_start_date']['date']) + (int)($_POST['apply_start_date']['time']) : 0); |
||
54 | $GroupObj->setVar('apply_end_date', (isset($_POST['apply_end_date'])) ? strtotime($_POST['apply_end_date']['date']) + (int)($_POST['apply_end_date']['time']) : 0); |
||
55 | |||
56 | $GroupObj->setVar('group_price', (isset($_POST['group_price'])) ? round($_POST['group_price'], 2) : 0); |
||
57 | $GroupObj->setVar('group_can_use_coupon', (isset($_POST['group_can_use_coupon'])) ? intval($_POST['group_can_use_coupon'], 2) : 0); |
||
58 | $GroupObj->setVar('group_sented_coupon', (isset($_POST['group_sented_coupon'])) ? round($_POST['group_sented_coupon'], 2) : 0); |
||
59 | $GroupObj->setVar('group_status', (isset($_POST['group_status'])) ? intval($_POST['group_status'], 2) : 0); |
||
60 | $GroupObj->setVar('group_add_time', time()); |
||
61 | |||
62 | $room_counts = array(); |
||
63 | $room_ids = $_POST['room_id']; |
||
64 | foreach ($room_ids as $room_id) { |
||
65 | $room_counts[] = $_POST['room_count_' . $room_id]; |
||
66 | } |
||
67 | |||
68 | //var_dump($GroupObj);exit; |
||
69 | $isNew = false; |
||
70 | if (!$id) { |
||
71 | $isNew = true; |
||
72 | $GroupObj->setNew(); |
||
73 | } |
||
74 | if ($GroupObj->isNew()) { |
||
75 | $redirect_msg = _AM_MARTIN_ADDED_SUCCESSFULLY; |
||
76 | $redirect_to = 'martin.group.php'; |
||
77 | } else { |
||
78 | $redirect_msg = _AM_MARTIN_MODIFIED_SUCCESSFULLY; |
||
79 | $redirect_to = 'martin.group.php'; |
||
80 | } |
||
81 | |||
82 | View Code Duplication | if (!is_array($room_ids) || empty($room_ids)) { |
|
83 | redirect_header('javascript:history.go(-1);', 2, _AM_MARTIN_FAILED_TO_ADD_ROOM.'<br>'._AM_MARTIN_NO_ROOM_CHOSEN); |
||
84 | exit(); |
||
85 | } |
||
86 | |||
87 | if (!$group_id = $group_handler->insert($GroupObj)) { |
||
88 | redirect_header('javascript:history.go(-1);', 2, _AM_MARTIN_OPERATION_FAILED); |
||
89 | exit(); |
||
90 | } |
||
91 | |||
92 | //$group_id = $id > 0 ? $id : $GroupObj->group_id(); |
||
93 | |||
94 | //var_dump($group_id); |
||
95 | View Code Duplication | if ($group_id > 0) { |
|
96 | if (!$group_handler->InsertGroupRoom($group_id, $room_ids, $room_counts, $isNew)) { |
||
97 | redirect_header('javascript:history.go(-1);', 2, _AM_MARTIN_FAILED_TO_ADD_ROOM); |
||
98 | exit(); |
||
99 | } |
||
100 | } else { |
||
101 | redirect_header('javascript:history.go(-1);', 2, _AM_MARTIN_FAILED_TO_ADD_ROOM); |
||
102 | exit(); |
||
103 | } |
||
104 | |||
105 | redirect_header($redirect_to, 2, $redirect_msg); |
||
106 | break; |
||
107 | View Code Duplication | case "del": |
|
108 | if (!$confirm) { |
||
109 | xoops_confirm(array('op' => 'del', 'id' => $GroupObj->group_id(), 'confirm' => 1, 'name' => $GroupObj->group_name()), '?action=del', "删除 '" . $GroupObj->group_name() . "'. <br /> <br /> 确定删除该团购吗?", _DELETE); |
||
110 | } else { |
||
111 | if ($group_handler->delete($GroupObj)) { |
||
112 | $redirect_msg = _AM_MARTIN_OK_TO_DELETE_THE_ORDER; |
||
113 | $redirect_to = "martin.group.php"; |
||
114 | } else { |
||
115 | $redirect_msg = _AM_MARTIN_DELETE_FAILED; |
||
116 | $redirect_to = "javascript:history.go(-1);"; |
||
117 | } |
||
118 | redirect_header($redirect_to, 2, $redirect_msg); |
||
119 | } |
||
120 | break; |
||
121 | case "list": |
||
122 | martin_collapsableBar('createtable', 'createtableicon', _AM_MARTIN_CUSTOMERS_LIST, _AM_MARTIN_CUSTOMERS_LIST); |
||
123 | CreateButton(); |
||
124 | $Status = array('<div style="background-color:#FF0000">' . _AM_MARTIN_DRAFT . '</div>', '<div style="background-color:#00FF00">' . _AM_MARTIN_PUBLISHED . '</div>'); |
||
125 | $GroupObjs = $group_handler->getGroups($xoopsModuleConfig['perpage'], $start, 0); |
||
126 | $Cout = $group_handler->getCount(); |
||
127 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
128 | $pagenav = new XoopsPageNav($Cout, $xoopsModuleConfig['perpage'], $start, 'start'); |
||
129 | $pavStr = '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
||
130 | |||
131 | // Creating the objects for top categories |
||
132 | echo $pavStr . "<table width='100%' cellspacing=1 cellpadding=10 border=0 class = outer>"; |
||
133 | echo "<tr>"; |
||
134 | echo "<td class='bg3' align='left'><b>ID</b></td>"; |
||
135 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_TITLE . "</b></td>"; |
||
136 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_CHECK_IN . "</b></td>"; |
||
137 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_CHECK_OUT . "</b></td>"; |
||
138 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_CUSTOMER_START_TIME . "</b></td>"; |
||
139 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_CUSTOMER_END_TIME . "</b></td>"; |
||
140 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_BUY_PRICE . "</b></td>"; |
||
141 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_CASH . "</b></td>"; |
||
142 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_PUBLIC_STATUS . "</b></td>"; |
||
143 | echo "<td width='60' class='bg3' align='center'><b>" . _AM_MARTIN_ACTIONS . "</b></td>"; |
||
144 | echo "</tr>"; |
||
145 | if (count($GroupObjs) > 0) { |
||
146 | foreach ($GroupObjs as $key => $thiscat) { |
||
147 | $StatusStr = time() < $thiscat->apply_end_date() ? '<div style="background-color: rgb(0, 255, 0);">%s</div>' : '<div style="background-color: rgb(255, 0, 0);">%s</div>'; |
||
148 | $modify = "<a href='?action=add&id=" . $thiscat->group_id() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif'/></a>"; |
||
149 | $delete = "<a href='?action=del&id=" . $thiscat->group_id() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/delete.gif'/></a>"; |
||
150 | echo "<tr><td class='even' align='left'>" . $thiscat->group_id() . "</td>"; |
||
151 | echo "<td class='even' align='left' width=50><a href='../group.php/group-" . $thiscat->group_id() . $xoopsModuleConfig['hotel_static_prefix'] . "'>" . $thiscat->group_name() . "</a></td>"; |
||
152 | echo "<td class='even' align='left'>" . date('Y-m-d', $thiscat->check_in_date()) . "</td>"; |
||
153 | echo "<td class='even' align='left'>" . date('Y-m-d', $thiscat->check_out_date()) . "</td>"; |
||
154 | echo "<td class='even' align='left'>" . date('Y-m-d H:i:s', $thiscat->apply_start_date()) . "</td>"; |
||
155 | echo "<td class='even' align='left'>" . sprintf($StatusStr, date('Y-m-d H:i:s', $thiscat->apply_end_date())) . "</td>"; |
||
156 | echo "<td class='even' align='left'>" . $thiscat->group_price() . "</td>"; |
||
157 | echo "<td class='even' align='left'>" . $thiscat->group_sented_coupon() . "</td>"; |
||
158 | echo "<td class='even' align='left'>" . $Status[$thiscat->group_status()] . "</td>"; |
||
159 | echo "<td class='even' align='center'> $modify $delete </td></tr>"; |
||
160 | } |
||
161 | } else { |
||
162 | echo "<tr>"; |
||
163 | echo "<td class='head' align='center' colspan= '10'>" . MARTIN_IS_NUll . "</td>"; |
||
164 | echo "</tr>"; |
||
165 | $categoryid = '0'; |
||
166 | } |
||
167 | echo "</table>\n"; |
||
168 | echo '<div style="text-align:right;">' . $pavStr . '</div>'; |
||
169 | echo "<br />"; |
||
170 | martin_close_collapsable('createtable', 'createtableicon'); |
||
0 ignored issues
–
show
|
|||
171 | break; |
||
172 | default: |
||
173 | redirect_header(XOOPS_URL, 2, _AM_MARTIN_UNAUTHORIZED_ACCESS); |
||
174 | break; |
||
175 | } |
||
176 | |||
177 | View Code Duplication | function CreateButton() |
|
178 | { |
||
179 | $arr = array( |
||
180 | 'addservicetype' => array('url' => 'martin.group.php?action=add', 'value' => _AM_MARTIN_ADD_CUSTOMERS), |
||
181 | 'servicetypelist' => array('url' => 'martin.group.php?action=list', 'value' => _AM_MARTIN_CUSTOMERS_LIST),); |
||
182 | Create_button($arr); |
||
183 | } |
||
184 | |||
185 | //底部 |
||
186 | include_once __DIR__ . '/admin_footer.php'; |
||
187 |