Use isset() for all param and arg checks.
This commit is contained in:
parent
fcf006adf2
commit
d6e7a3deb4
|
@ -159,7 +159,7 @@ function farm_sensor_listener_page_callback($public_key) {
|
|||
// If the path includes "/summary" after the public key, output value
|
||||
// summary info and return success.
|
||||
$args = func_get_args();
|
||||
if (!empty($args[1]) && $args[1] == 'summary') {
|
||||
if (isset($args[1]) && $args[1] == 'summary') {
|
||||
$data = farm_sensor_listener_values_info($sensor->id);
|
||||
drupal_json_output($data);
|
||||
return MENU_FOUND;
|
||||
|
@ -167,31 +167,31 @@ function farm_sensor_listener_page_callback($public_key) {
|
|||
|
||||
// If the 'name' parameter is set, filter by name.
|
||||
$name = '';
|
||||
if (!empty($params['name'])) {
|
||||
if (isset($params['name'])) {
|
||||
$name = $params['name'];
|
||||
}
|
||||
|
||||
// If the 'start' parameter is set, limit results to timestamps after it.
|
||||
$start = NULL;
|
||||
if (!empty($params['start'])) {
|
||||
if (isset($params['start'])) {
|
||||
$start = $params['start'];
|
||||
}
|
||||
|
||||
// If the 'end' parameter is set, limit to results before it.
|
||||
$end = NULL;
|
||||
if (!empty($params['end'])) {
|
||||
if (isset($params['end'])) {
|
||||
$end = $params['end'];
|
||||
}
|
||||
|
||||
// If the 'limit' parameter is set, limit the number of results.
|
||||
$limit = 1;
|
||||
if (!is_null($params['limit'])) {
|
||||
if (isset($params['limit'])) {
|
||||
$limit = $params['limit'];
|
||||
}
|
||||
|
||||
// If the 'offset' parameter is set, offset the results.
|
||||
$offset = 0;
|
||||
if (!empty($params['offset'])) {
|
||||
if (isset($params['offset'])) {
|
||||
$offset = $params['offset'];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue