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 namespace JobApis\Jobs\Client\Queries; |
||
2 | |||
3 | class IndeedQuery extends AbstractQuery |
||
4 | { |
||
5 | /** |
||
6 | * API Version. Should be 2. |
||
7 | * |
||
8 | * @var integer |
||
9 | */ |
||
10 | const API_VERSION = 2; |
||
11 | |||
12 | /** |
||
13 | * Response format. |
||
14 | * |
||
15 | * @var integer |
||
16 | */ |
||
17 | const API_FORMAT = 'json'; |
||
18 | |||
19 | /** |
||
20 | * User Agent |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $useragent; |
||
25 | |||
26 | /** |
||
27 | * Client IP Address |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $userip; |
||
32 | |||
33 | /** |
||
34 | * Channel group |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $chnl; |
||
39 | |||
40 | /** |
||
41 | * Country |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $co; |
||
46 | |||
47 | /** |
||
48 | * Include latitude and longitude in results |
||
49 | * |
||
50 | * @var boolean |
||
51 | */ |
||
52 | protected $latlong; |
||
53 | |||
54 | /** |
||
55 | * Filter duplicate results |
||
56 | * |
||
57 | * @var boolean |
||
58 | */ |
||
59 | protected $filter; |
||
60 | |||
61 | /** |
||
62 | * Highlight results |
||
63 | * |
||
64 | * @var boolean |
||
65 | */ |
||
66 | protected $highlight; |
||
67 | |||
68 | /** |
||
69 | * Days back to search |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | protected $fromage; |
||
74 | |||
75 | /** |
||
76 | * Max number of results |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | protected $limit; |
||
81 | |||
82 | /** |
||
83 | * Start results from this index |
||
84 | * |
||
85 | * @var string |
||
86 | */ |
||
87 | protected $start; |
||
88 | |||
89 | /** |
||
90 | * Job type |
||
91 | * |
||
92 | * @var string |
||
93 | */ |
||
94 | protected $jt; |
||
95 | |||
96 | /** |
||
97 | * Site type |
||
98 | * |
||
99 | * @var string |
||
100 | */ |
||
101 | protected $st; |
||
102 | |||
103 | /** |
||
104 | * Radius around location to search |
||
105 | * |
||
106 | * @var string |
||
107 | */ |
||
108 | protected $radius; |
||
109 | |||
110 | /** |
||
111 | * Sort by relevance or date |
||
112 | * |
||
113 | * @var string |
||
114 | */ |
||
115 | protected $sort; |
||
116 | |||
117 | /** |
||
118 | * Location |
||
119 | * |
||
120 | * @var string |
||
121 | */ |
||
122 | protected $l; |
||
123 | |||
124 | /** |
||
125 | * Javascript function for callback |
||
126 | * |
||
127 | * @var string |
||
128 | */ |
||
129 | protected $callback; |
||
130 | |||
131 | /** |
||
132 | * JSON or XML format |
||
133 | * |
||
134 | * @var string |
||
135 | */ |
||
136 | protected $format; |
||
137 | |||
138 | /** |
||
139 | * Version number |
||
140 | * |
||
141 | * @var string |
||
142 | */ |
||
143 | protected $v; |
||
144 | |||
145 | /** |
||
146 | * Publisher ID |
||
147 | * |
||
148 | * @var string |
||
149 | */ |
||
150 | protected $publisher; |
||
151 | |||
152 | /** |
||
153 | * Query |
||
154 | * |
||
155 | * @var string |
||
156 | */ |
||
157 | protected $q; |
||
158 | |||
159 | /** |
||
160 | * Get baseUrl |
||
161 | * |
||
162 | * @return string Value of the base url to this api |
||
163 | */ |
||
164 | 6 | public function getBaseUrl() |
|
165 | { |
||
166 | 6 | return 'http://api.indeed.com/ads/apisearch'; |
|
167 | } |
||
168 | |||
169 | /** |
||
170 | * Get keyword |
||
171 | * |
||
172 | * @return string Attribute being used as the search keyword |
||
173 | */ |
||
174 | 4 | public function getKeyword() |
|
175 | { |
||
176 | 4 | return $this->q; |
|
177 | } |
||
178 | |||
179 | /** |
||
180 | * Default parameters |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | 20 | protected function defaultAttributes() |
|
185 | { |
||
186 | return [ |
||
187 | 20 | 'useragent' => $this->userAgent(), |
|
188 | 20 | 'userip' => $this->userIp(), |
|
189 | 20 | 'v' => static::API_VERSION, |
|
190 | 20 | 'format' => static::API_FORMAT, |
|
191 | 20 | ]; |
|
192 | } |
||
193 | |||
194 | /** |
||
195 | * Required parameters |
||
196 | * |
||
197 | * @return array |
||
198 | */ |
||
199 | 6 | protected function requiredAttributes() |
|
200 | { |
||
201 | return [ |
||
202 | 6 | 'useragent', |
|
203 | 6 | 'userip', |
|
204 | 6 | 'publisher', |
|
205 | 6 | ]; |
|
206 | } |
||
207 | |||
208 | /** |
||
209 | * Return the user agent from server |
||
210 | * |
||
211 | * @return string |
||
212 | */ |
||
213 | 20 | protected function userAgent() |
|
0 ignored issues
–
show
|
|||
214 | { |
||
215 | 20 | return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; |
|
216 | } |
||
217 | |||
218 | /** |
||
219 | * Return the IP address from server |
||
220 | * |
||
221 | * @return string |
||
222 | */ |
||
223 | 20 | protected function userIp() |
|
0 ignored issues
–
show
userIp uses the super-global variable $_SERVER which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
Loading history...
|
|||
224 | { |
||
225 | 20 | return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; |
|
226 | } |
||
227 | } |
||
228 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: