From: Alexander Sadleir Date: Tue, 20 Sep 2011 08:33:51 +0000 Subject: Fix some minor warning issues (index outside range etc.) X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=2fb1aedb00480c64cc9644de49f95d91151be897 --- Fix some minor warning issues (index outside range etc.) --- --- a/include/common-request.inc.php +++ b/include/common-request.inc.php @@ -33,10 +33,18 @@ if (isset($_REQUEST['suburb'])) { $suburb = $_REQUEST['suburb']; } -$pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); -$lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); -$lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); -$max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT); +if (isset($_REQUEST['pageKey'])) { + $pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); +} +if (isset($_REQUEST['lat'])) { + $lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); +} +if (isset($_REQUEST['lon'])) { + $lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); +} +if (isset($_REQUEST['radius'])) { + $max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT); +} if (isset($_REQUEST['numberSeries'])) { $numberSeries = filter_var($_REQUEST['numberSeries'], FILTER_SANITIZE_NUMBER_INT); } --- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -42,7 +42,7 @@ } function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) { - global $basePath, $serviceAlertsEnabled; + global $basePath, $GTFSREnabled; echo ' @@ -179,9 +179,11 @@ } if ($GTFSREnabled) { $serviceAlerts = getServiceAlertsAsArray("agency", "0"); - foreach ($serviceAlerts['entity'] as $entity) { - echo "
" . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['start'])) . " to " . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end'])) . "{$entity['alert']['header_text']['translation'][0]['text']}
Warning: {$entity['alert']['description_text']['translation'][0]['text']} -
Source
"; + if (isset($serviceAlerts['entity']) && sizeof($serviceAlerts['entity']) > 0) { + foreach ($serviceAlerts['entity'] as $entity) { + echo "
" . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['start'])) . " to " . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end'])) . "{$entity['alert']['header_text']['translation'][0]['text']}
Warning: {$entity['alert']['description_text']['translation'][0]['text']} +
Source
"; + } } } } --- a/trip.php +++ b/trip.php @@ -69,7 +69,7 @@ $tripStopTimes = getTimeInterpolatedTrip($tripid); echo '
  • ' . $tripStopTimes[0]['arrival_time'] . ' to ' . $tripStopTimes[sizeof($tripStopTimes) - 1]['arrival_time'] . ' ' . $trip['route_long_name'] . ' (' . ucwords($tripStopTimes[0]['service_id']) . ')
  • '; foreach ($tripStopTimes as $key => $tripStopTime) { - if (($tripStopTimes[$key]["stop_name"] != $tripStopTimes[$key + 1]["stop_name"]) || $key + 1 >= sizeof($tripStopTimes)) { + if ($key + 1 > sizeof($tripStopTimes) || ($tripStopTimes[$key]["stop_name"] != $tripStopTimes[$key + 1]["stop_name"])) { echo '
  • '; if (!startsWith($tripStopTime['stop_code'], "Wj")) echo 'Timing Point';