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 | * |
||
5 | * @access public |
||
6 | * @return void |
||
7 | * @copyright 1997-2010 The Lap Group |
||
8 | * @author Martin <[email protected]> |
||
9 | * @created time :2010-07-22 16:27:07 |
||
10 | * */ |
||
11 | class MartinReview extends XoopsObject |
||
12 | { |
||
13 | } |
||
14 | |||
15 | /** |
||
16 | * |
||
17 | * @access public |
||
18 | * @return void |
||
19 | * @copyright 1997-2010 The Lap Group |
||
20 | * @author Martin <[email protected]> |
||
21 | * @created time :2010-07-22 16:27:25 |
||
22 | * */ |
||
23 | class MartinReviewHandler extends XoopsObjectHandler |
||
24 | { |
||
25 | /** |
||
26 | * @create cart object |
||
27 | * @license http://www.blags.org/ |
||
28 | * @created :2010年07月04日 12时59分 |
||
29 | * @copyright 1997-2010 The Martin Group |
||
30 | * @author Martin <[email protected]> |
||
31 | * */ |
||
32 | public function &create() |
||
33 | { |
||
34 | $obj =& new MartinReview; |
||
35 | |||
36 | return $obj; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * insert review for hotel |
||
41 | * @access public |
||
42 | * @param $Data |
||
43 | * @copyright 1997-2010 The Lap Group |
||
44 | * @author Martin <[email protected]> |
||
45 | * @created time :2010-07-22 16:28:18 |
||
46 | */ |
||
47 | public function SaveReview($Data) |
||
0 ignored issues
–
show
|
|||
48 | { |
||
49 | global $xoopsDB; |
||
50 | if (!$Data) { |
||
51 | return $Data; |
||
52 | } |
||
53 | $table = $xoopsDB->prefix('martin_user_review'); |
||
54 | $exist = $this->CheckReviewExist($Data['hotel_id'], $Data['uid']); |
||
55 | if (is_array($Data)) { |
||
56 | foreach ($Data as $key => $value) { |
||
57 | $v .= $prefix . $value; |
||
0 ignored issues
–
show
The variable
$v 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
![]() The variable
$prefix 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
![]() |
|||
58 | $k .= $prefix . $key; |
||
0 ignored issues
–
show
The variable
$k 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
![]() |
|||
59 | $updateStr .= $prefix . "$key = $value"; |
||
0 ignored issues
–
show
The variable
$updateStr 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
![]() |
|||
60 | $prefix = ','; |
||
61 | } |
||
62 | } |
||
63 | $sql = $exist ? "UPDATE $table SET %s WHERE hotel_id = {$Data['hotel_id']} AND uid = {$Data['uid']}" : "INSERT INTO $table (%s) VALUES (%s)"; |
||
64 | $sql = $exist ? sprintf($sql, $updateStr) : sprintf($sql, $k, $v); |
||
65 | |||
66 | //echo $sql; |
||
67 | return $xoopsDB->query($sql); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * |
||
72 | * @access public |
||
73 | * @param $hotel_id |
||
74 | * @param $uid |
||
75 | * @return bool |
||
76 | * @copyright 1997-2010 The Lap Group |
||
77 | * @author Martin <[email protected]> |
||
78 | * @created time :2010-07-22 16:43:23 |
||
79 | */ |
||
80 | View Code Duplication | public function CheckReviewExist($hotel_id, $uid) |
|
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. ![]() |
|||
81 | { |
||
82 | global $xoopsDB; |
||
83 | $sql = "SELECT * FROM {$xoopsDB->prefix('martin_user_review')} WHERE hotel_id = $hotel_id AND uid = $uid "; |
||
84 | |||
85 | return is_array($xoopsDB->fetchArray($xoopsDB->query($sql))); |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * |
||
90 | * @access public |
||
91 | * @param $hotel_id |
||
92 | * @copyright 1997-2010 The Lap Group |
||
93 | * @author Martin <[email protected]> |
||
94 | * @created time :2010-07-22 16:49:41 |
||
95 | */ |
||
96 | public function GetReview($hotel_id) |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a ![]() |
|||
97 | { |
||
98 | global $xoopsDB, $xoopsUser; |
||
99 | $uid = $xoopsUser->uid(); |
||
100 | $sql = "SELECT * FROM {$xoopsDB->prefix('martin_user_review')} WHERE hotel_id = $hotel_id AND uid = $uid "; |
||
101 | |||
102 | return $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * get hotel review |
||
107 | * @access public |
||
108 | * @param $hotel_id |
||
109 | * @copyright 1997-2010 The Lap Group |
||
110 | * @author Martin <[email protected]> |
||
111 | * @created time :2010-07-22 17:03:32 |
||
112 | */ |
||
113 | public function GetHotelReview($hotel_id) |
||
114 | { |
||
115 | global $xoopsDB; |
||
116 | $table = $xoopsDB->prefix('martin_user_review'); |
||
117 | $sql = "SELECT avg(review_type_avg) as review_type_avg , count(uid) as count FROM $table WHERE hotel_id = $hotel_id GROUP BY hotel_id "; |
||
118 | $row = ($xoopsDB->fetchArray($xoopsDB->query($sql))); |
||
119 | $row['review_type_avg'] = round($row['review_type_avg'], 2); |
||
120 | $row['score'] = (int)(($row['review_type_avg'] / 5) * 100); |
||
121 | |||
122 | //var_dump($row); |
||
123 | return $row; |
||
124 | } |
||
125 | } |
||
126 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.