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 | * Module: SmartCourse |
||
5 | * Author: The SmartFactory <www.smartfactory.ca> |
||
6 | * Licence: GNU |
||
7 | * @param bool $showmenu |
||
8 | * @param int $offerid |
||
9 | * @param string $fct |
||
10 | */ |
||
11 | |||
12 | function editoffer($showmenu = false, $offerid = 0, $fct = '') |
||
13 | { |
||
14 | global $smartPartnerOfferHandler, $smartPartnerCategoryHandler, $smartPartnerPartnerHandler; |
||
15 | |||
16 | $offerObj = $smartPartnerOfferHandler->get($offerid); |
||
17 | |||
18 | if ($offerObj->isNew()) { |
||
19 | $breadcrumb = _AM_SPARTNER_OFFERS . ' > ' . _AM_SPARTNER_CREATINGNEW; |
||
0 ignored issues
–
show
|
|||
20 | $title = _AM_SPARTNER_OFFER_CREATE; |
||
21 | $info = _AM_SPARTNER_OFFER_CREATE_INFO; |
||
22 | $collaps_name = 'offercreate'; |
||
23 | $form_name = _AM_SPARTNER_OFFER_CREATE; |
||
24 | $submit_button_caption = null; |
||
25 | $offerObj->setVar('date_sub', time()); |
||
26 | } else { |
||
27 | $breadcrumb = _AM_SPARTNER_OFFERS . ' > ' . _AM_SPARTNER_EDITING; |
||
0 ignored issues
–
show
$breadcrumb is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
28 | $title = _AM_SPARTNER_OFFER_EDIT; |
||
29 | $info = _AM_SPARTNER_OFFER_EDIT_INFO; |
||
30 | $collaps_name = 'offeredit'; |
||
31 | $form_name = _AM_SPARTNER_OFFER_EDIT; |
||
32 | $submit_button_caption = null; |
||
33 | } |
||
34 | $partnerObj = $smartPartnerPartnerHandler->get($offerObj->getVar('partnerid', 'e')); |
||
0 ignored issues
–
show
$partnerObj is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
35 | $offerObj->hideFieldFromForm('date_sub'); |
||
36 | $menuTab = 3; |
||
0 ignored issues
–
show
$menuTab is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
37 | |||
38 | if ($showmenu) { |
||
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. ![]() |
|||
39 | //smart_adminMenu($menuTab, $breadcrumb); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
75% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
40 | } |
||
41 | echo "<br>\n"; |
||
42 | smart_collapsableBar($collaps_name, $title, $info); |
||
43 | |||
44 | $sform = $offerObj->getForm($form_name, 'addoffer', false, $submit_button_caption); |
||
45 | if ($fct === 'app') { |
||
46 | $sform->addElement(new XoopsFormHidden('fct', 'app')); |
||
47 | } |
||
48 | $sform->display(); |
||
49 | smart_close_collapsable($collaps_name); |
||
50 | } |
||
51 | |||
52 | include_once __DIR__ . '/admin_header.php'; |
||
53 | |||
54 | $op = ''; |
||
55 | if (isset($_GET['op'])) { |
||
56 | $op = $_GET['op']; |
||
57 | } |
||
58 | if (isset($_POST['op'])) { |
||
59 | $op = $_POST['op']; |
||
60 | } |
||
61 | |||
62 | switch ($op) { |
||
63 | case 'mod': |
||
64 | $offerid = isset($_GET['offerid']) ? (int)$_GET['offerid'] : 0; |
||
65 | $fct = isset($_GET['fct']) ? $_GET['fct'] : ''; |
||
66 | smart_xoops_cp_header(); |
||
67 | |||
68 | editoffer(true, $offerid, $fct); |
||
69 | break; |
||
70 | |||
71 | case 'addoffer': |
||
72 | include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
||
73 | |||
74 | $controller = new SmartObjectController($smartPartnerOfferHandler); |
||
75 | $offerObj = $controller->storeSmartObject(); |
||
76 | $fct = isset($_POST['fct']) ? $_POST['fct'] : ''; |
||
77 | |||
78 | if ($offerObj->hasError()) { |
||
79 | redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $offerObj->getHtmlErrors()); |
||
80 | } else { |
||
81 | $partnerObj = $smartPartnerPartnerHandler->get($offerObj->getVar('partnerid', 'e')); |
||
82 | $partnerObj->setUpdated(); |
||
83 | if ($_POST['offerid'] == '') { |
||
84 | $offerObj->sendNotifications(array(_SPARTNER_NOT_OFFER_NEW)); |
||
85 | } |
||
86 | |||
87 | redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS); |
||
88 | } |
||
89 | exit; |
||
90 | break; |
||
91 | |||
92 | case 'del': |
||
93 | include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
||
94 | $controller = new SmartObjectController($smartPartnerOfferHandler); |
||
95 | $controller->handleObjectDeletion(); |
||
96 | break; |
||
97 | |||
98 | case 'default': |
||
99 | default: |
||
100 | include_once(XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'); |
||
101 | smart_xoops_cp_header(); |
||
102 | |||
103 | //add navigation icon |
||
104 | $indexAdmin = new ModuleAdmin(); |
||
105 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
||
106 | |||
107 | //add button for creating a new offer |
||
108 | $indexAdmin->addItemButton(_AM_SPARTNER_OFFER_CREATE, 'offer.php?op=mod', 'add', ''); |
||
109 | echo $indexAdmin->renderButton('left', ''); |
||
110 | |||
111 | //smart_adminMenu(3, _AM_SPARTNER_OFFERS); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
63% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
112 | |||
113 | // echo "<br>\n"; |
||
114 | // echo "<form><div style=\"margin-bottom: 12px;\">"; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
115 | // echo "<input type='button' name='button' onclick=\"location='offer.php?op=mod'\" value='" . _AM_SPARTNER_OFFER_CREATE . "'> "; |
||
116 | // echo "</div></form>"; |
||
117 | |||
118 | smart_collapsableBar('createdoffers', _AM_SPARTNER_OFFERS, _AM_SPARTNER_OFFERS_DSC); |
||
119 | |||
120 | include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjecttable.php'; |
||
121 | $objectTable = new SmartObjectTable($smartPartnerOfferHandler); |
||
122 | $objectTable->addFilter('partnerid', 'getPartnerList'); |
||
123 | $objectTable->addFilter('status', 'getStatusList'); |
||
124 | $objectTable->addColumn(new SmartObjectColumn('title', 'left')); |
||
125 | $objectTable->addColumn(new SmartObjectColumn('partnerid', 'center', 100)); |
||
126 | $objectTable->addColumn(new SmartObjectColumn('status', 'center', 100)); |
||
127 | $objectTable->render(); |
||
128 | |||
129 | echo '<br>'; |
||
130 | smart_close_collapsable('createdoffers'); |
||
131 | echo '<br>'; |
||
132 | |||
133 | break; |
||
134 | } |
||
135 | |||
136 | //smart_modFooter(); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
137 | //xoops_cp_footer(); |
||
138 | include_once __DIR__ . '/admin_footer.php'; |
||
139 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.