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(4, "订房后台 > 酒店促销"); |
||
25 | |||
26 | $promotion_handler =& xoops_getmodulehandler('hotelpromotion', MARTIN_DIRNAME, true); |
||
27 | $hotelservice_handler =& xoops_getmodulehandler('hotelservice', MARTIN_DIRNAME, true); |
||
28 | |||
29 | //$HotelServiceObj = $hotelservice_handler->create(); |
||
30 | $PromotionObj = $id > 0 ? $promotion_handler->get($id) : $promotion_handler->create(); |
||
31 | |||
32 | switch ($action) { |
||
33 | View Code Duplication | case "add": |
|
0 ignored issues
–
show
|
|||
34 | include MARTIN_ROOT_PATH . 'include/form.hotel.promotion.php'; |
||
35 | martin_collapsableBar('createtable', 'createtableicon', _AM_MARTIN_PROMO_ADD, _AM_MARTIN_PROMO_ADD); |
||
36 | CreateButton(); |
||
37 | //Create_button(array('addcity'=>array('url'=>'mconfirmartin.hotel.city.php?action=add','value'=>_AM_MARTIN_CITY_NAME))); |
||
38 | $form = new form_hotel_promotion($PromotionObj, $hotelservice_handler->GetHotelList()); |
||
0 ignored issues
–
show
|
|||
39 | |||
40 | $form->display(); |
||
41 | martin_close_collapsable('createtable', 'createtableicon'); |
||
0 ignored issues
–
show
|
|||
42 | break; |
||
43 | case "save": |
||
44 | //var_dump(($_POST['group_info']));exit; |
||
45 | $PromotionObj->setVar('promotion_id', $id); |
||
46 | $PromotionObj->setVar('hotel_id', (int)($_POST['hotel_id'])); |
||
47 | $PromotionObj->setVar('promotion_description', (isset($_POST['promotion_description']) ? ($_POST['promotion_description']) : '')); |
||
48 | $PromotionObj->setVar('promotion_start_date', (isset($_POST['promotion_start_date'])) ? strtotime($_POST['promotion_start_date']) : 0); |
||
49 | $PromotionObj->setVar('promotion_end_date', (isset($_POST['promotion_end_date'])) ? strtotime($_POST['promotion_end_date']) : 0); |
||
50 | $PromotionObj->setVar('promotion_add_time', time()); |
||
51 | |||
52 | //var_dump($PromotionObj);exit; |
||
53 | $isNew = false; |
||
54 | if (!$id) { |
||
55 | $isNew = true; |
||
56 | $PromotionObj->setNew(); |
||
57 | } |
||
58 | if ($PromotionObj->isNew()) { |
||
59 | $redirect_msg = _AM_MARTIN_ADDED_SUCCESSFULLY; |
||
60 | $redirect_to = 'martin.hotel.promotion.php'; |
||
61 | } else { |
||
62 | $redirect_msg = _AM_MARTIN_MODIFIED_SUCCESSFULLY; |
||
63 | $redirect_to = 'martin.hotel.promotion.php'; |
||
64 | } |
||
65 | |||
66 | if (!$promotion_handler->insert($PromotionObj)) { |
||
67 | redirect_header('javascript:history.go(-1);', 2, _AM_MARTIN_OPERATION_FAILED); |
||
68 | exit(); |
||
69 | } |
||
70 | |||
71 | //$promotion_id = $id > 0 ? $id : $PromotionObj->promotion_id(); |
||
72 | |||
73 | redirect_header($redirect_to, 2, $redirect_msg); |
||
74 | break; |
||
75 | View Code Duplication | case "del": |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
76 | if (!$confirm) { |
||
77 | xoops_confirm(array('op' => 'del', 'id' => $PromotionObj->promotion_id(), 'confirm' => 1, 'name' => $PromotionObj->hotel_name()), '?action=del', "删除 '" . $PromotionObj->hotel_name() . "'. <br /> <br /> 确定删除该促销吗?", _DELETE); |
||
78 | } else { |
||
79 | if ($promotion_handler->delete($PromotionObj)) { |
||
80 | $redirect_msg = _AM_MARTIN_OK_TO_DELETE_THE_ORDER; |
||
81 | $redirect_to = "martin.hotel.promotion.php"; |
||
82 | } else { |
||
83 | $redirect_msg = _AM_MARTIN_DELETE_FAILED; |
||
84 | $redirect_to = "javascript:history.go(-1);"; |
||
85 | } |
||
86 | redirect_header($redirect_to, 2, $redirect_msg); |
||
87 | } |
||
88 | break; |
||
89 | case "list": |
||
90 | martin_collapsableBar('createtable', 'createtableicon', _AM_MARTIN_PROMO_LIST, _AM_MARTIN_PROMO_LIST); |
||
91 | CreateButton(); |
||
92 | $Status = array('<div style="background-color:#FF0000">' . _AM_MARTIN_DRAFT . '</div>', '<div style="background-color:#00FF00">' . _AM_MARTIN_PUBLISHED . '</div>'); |
||
93 | |||
94 | $Cout = $promotion_handler->getCount(); |
||
95 | $PromotionObjs = $promotion_handler->getPromotions($xoopsModuleConfig['perpage'], $start, 0); |
||
96 | |||
97 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
98 | $pagenav = new XoopsPageNav($Cout, $xoopsModuleConfig['perpage'], $start, 'start'); |
||
99 | $pavStr = '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
||
100 | |||
101 | // Creating the objects for top categories |
||
102 | echo $pavStr . "<table width='100%' cellspacing=1 cellpadding=5 border=0 class = outer>"; |
||
103 | echo "<tr>"; |
||
104 | echo "<td class='bg3' align='left'><b>ID</b></td>"; |
||
105 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_PROMO_HOTELS . "</b></td>"; |
||
106 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_PROMO_START . "</b></td>"; |
||
107 | echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_PROMO_END . "</b></td>"; |
||
108 | echo "<td width='60' class='bg3' align='center'><b>" . _AM_MARTIN_ACTIONS . "</b></td>"; |
||
109 | echo "</tr>"; |
||
110 | if (count($PromotionObjs) > 0) { |
||
111 | foreach ($PromotionObjs as $key => $thiscat) { |
||
112 | $modify = "<a href='?action=add&id=" . $thiscat->promotion_id() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif'/></a>"; |
||
113 | $delete = "<a href='?action=del&id=" . $thiscat->promotion_id() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/delete.gif'/></a>"; |
||
114 | echo "<tr><td class='even' align='left'>" . $thiscat->promotion_id() . "</td>"; |
||
115 | echo "<td class='even' align='left'>" . $thiscat->hotel_name() . "</td>"; |
||
116 | echo "<td class='even' align='left'>" . date('Y-m-d', $thiscat->promotion_start_date()) . "</td>"; |
||
117 | echo "<td class='even' align='left'>" . date('Y-m-d', $thiscat->promotion_end_date()) . "</td>"; |
||
118 | echo "<td class='even' align='center'> $modify $delete </td></tr>"; |
||
119 | } |
||
120 | } else { |
||
121 | echo "<tr>"; |
||
122 | echo "<td class='head' align='center' colspan= '5'>" . MARTIN_IS_NUll . "</td>"; |
||
123 | echo "</tr>"; |
||
124 | $categoryid = '0'; |
||
125 | } |
||
126 | echo "</table>\n"; |
||
127 | echo '<div style="text-align:right;">' . $pavStr . '</div>'; |
||
128 | echo "<br />"; |
||
129 | martin_close_collapsable('createtable', 'createtableicon'); |
||
0 ignored issues
–
show
|
|||
130 | break; |
||
131 | default: |
||
132 | redirect_header(XOOPS_URL, 2, _AM_MARTIN_UNAUTHORIZED_ACCESS); |
||
133 | break; |
||
134 | } |
||
135 | |||
136 | View Code Duplication | function CreateButton() |
|
0 ignored issues
–
show
The function
CreateButton() has been defined more than once; this definition is ignored, only the first definition in admin/martin.auction.php (L178-184) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. ![]() This function 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. ![]() |
|||
137 | { |
||
138 | $arr = array( |
||
139 | 'addservicetype' => array('url' => 'martin.hotel.promotion.php?action=add', 'value' => _AM_MARTIN_PROMO_ADD), |
||
140 | 'servicetypelist' => array('url' => 'martin.hotel.promotion.php?action=list', 'value' => _AM_MARTIN_PROMO_LIST),); |
||
141 | Create_button($arr); |
||
142 | } |
||
143 | |||
144 | //底部 |
||
145 | //include_once martin.footer.php; |
||
146 | include_once __DIR__ . '/admin_footer.php'; |
||
147 |
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.