From: maxious Date: Fri, 29 Apr 2011 05:38:08 +0000 Subject: Escape GET variables centrally X-Git-Url: https://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=15b043704227f088801cbb15b65bd1cf299691ea --- Escape GET variables centrally --- --- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -182,7 +182,7 @@ if ($opendiv) { echo '
- Back + Back

' . $pageTitle . '

Home
--- a/include/common.inc.php +++ b/include/common.inc.php @@ -33,6 +33,7 @@ include_once ("common-session.inc.php"); include_once ("common-db.inc.php"); include_once ("common-template.inc.php"); +include_once ("common-request.inc.php"); function isDebugServer() { --- a/index.php +++ b/index.php @@ -13,14 +13,14 @@
  • Timetables - Stops
  • Major (Timing Point) Stops
  • All Stops
  • -
  • Stops By Suburb
  • +
  • Stops By Suburb
  • Nearby Stops
  • {$route['route_short_name']} {$route['route_long_name']}"; foreach (getRouteTrips($routeid) as $key => $trip) { --- a/layar_api.php +++ b/layar_api.php @@ -5,11 +5,8 @@ $output['layer'] = "canberrabusstops"; $max_page = 10; $max_results = 50; -$page_start = 0 + filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); -$page_end = $max_page + 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); +$page_start = 0 + $pageKey; +$page_end = $max_page + $pageKey; $contents = getNearbyStops($lat, $lon, 50, $max_distance); $stopNum = 0; foreach ($contents as $stop) { --- a/routeList.php +++ b/routeList.php @@ -7,72 +7,70 @@
    '; } -if ($_REQUEST['bysuburb']) { +if (isset($bysuburbs)) { include_header("Routes by Suburb", "routeList"); navbar(); echo ' '; } -else if ($_REQUEST['nearby'] || $_REQUEST['suburb']) { +else if (isset($nearby) || isset($suburb)) { $routes = Array(); - if ($_REQUEST['suburb']) { - $suburb = filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING); - include_header($suburb ." - ".ucwords(service_period()), "routeList"); - navbar(); - timePlaceSettings(); - trackEvent("Route Lists", "Routes By Suburb", $suburb); - $routes = getRoutesBySuburb($suburb); - + if ($suburb) { + include_header($suburb . " - " . ucwords(service_period()) , "routeList"); + navbar(); + timePlaceSettings(); + trackEvent("Route Lists", "Routes By Suburb", $suburb); + $routes = getRoutesbysuburbs($suburb); } - if ($_REQUEST['nearby']) { + if (isset($nearby)) { include_header("Routes Nearby", "routeList", true, true); - trackEvent("Route Lists", "Routes Nearby", $_SESSION['lat'].",".$_SESSION['lon']); - navbar(); - timePlaceSettings(true); + trackEvent("Route Lists", "Routes Nearby", $_SESSION['lat'] . "," . $_SESSION['lon']); + navbar(); + timePlaceSettings(true); if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") { include_footer(); die(); } - $routes = getRoutesNearby($_SESSION['lat'],$_SESSION['lon']); + $routes = getRoutesNearby($_SESSION['lat'], $_SESSION['lon']); } - echo '