<?php | <?php |
include ("include/common.inc.php"); | include ("include/common.inc.php"); |
include_header("Feedback", "feedback"); | include_header("Feedback", "feedback"); |
function sendEmail($topic, $message) | function sendEmail($topic, $message) |
{ | { |
$address = "maxious@lambdacomplex.org"; | $address = "maxious@lambdacomplex.org"; |
if (file_exists("/tmp/aws.php")) { | if (file_exists("/tmp/aws.php")) { |
include_once ("lib/ses.php"); | include_once ("lib/ses.php"); |
include_once ("/tmp/aws.php"); | include_once ("/tmp/aws.php"); |
$con = new SimpleEmailService($accessKey, $secretKey); | $con = new SimpleEmailService($accessKey, $secretKey); |
//$con->verifyEmailAddress($address); | //$con->verifyEmailAddress($address); |
//$con->listVerifiedEmailAddresses(); | //$con->listVerifiedEmailAddresses(); |
$m = new SimpleEmailServiceMessage(); | $m = new SimpleEmailServiceMessage(); |
$m->addTo($address); | $m->addTo($address); |
$m->setFrom($address); | $m->setFrom($address); |
$m->setSubject($topic); | $m->setSubject($topic); |
$m->setMessageFromString($message); | $m->setMessageFromString($message); |
$con->sendEmail($m); | $con->sendEmail($m); |
} | } |
else { | else { |
// In case any of our lines are larger than 70 characters, we should use wordwrap() | // In case any of our lines are larger than 70 characters, we should use wordwrap() |
$message = wordwrap($message, 70); | $message = wordwrap($message, 70); |
// Send | // Send |
mail($address, $topic, $message); | mail($address, $topic, $message); |
} | } |
} | } |
if (isset($_REQUEST['feedback']) || isset($_REQUEST['newlocation'])){ | |
sendEmail("bus.lambda feedback",print_r($_REQUEST,true)); | |
echo "<center><h2>Thank you for your feedback!</h2></center>"; | |
} else { | |
$stopid = ""; | $stopid = ""; |
$stopcode = ""; | $stopcode = ""; |
$urlparts = explode("?",$_SERVER["HTTP_REFERER"]); | $urlparts = explode("?",$_SERVER["HTTP_REFERER"]); |
if (isset($urlparts[1])) { | if (isset($urlparts[1])) { |
$getparams = explode("&",$urlparts[1]); | $getparams = explode("&",$urlparts[1]); |
foreach ($getparams as $param) { | foreach ($getparams as $param) { |
$paramparts=explode("=",$param); | $paramparts=explode("=",$param); |
if ($paramparts[0] == "stopid") $stopid = $paramparts[1]; | if ($paramparts[0] == "stopid") $stopid = $paramparts[1]; |
if ($paramparts[0] == "stopcode") $stopcode = $paramparts[1]; | if ($paramparts[0] == "stopcode") $stopcode = $paramparts[1]; |
} | } |
} | } |
?> | ?> |
<h3>Add/Move/Delete a Bus Stop Location</h3> | <h3>Add/Move/Delete a Bus Stop Location</h3> |
<form action="feedback.php" method="post"> | |
StopID: <input type="text" name="stopid" value="<?php echo $stopid ?>"/><br> | StopID: <input type="text" name="stopid" value="<?php echo $stopid ?>"/><br> |
or StopCode: <input type="text" name="stopcode" value="<?php echo $stopcode ?>"/><br> | or StopCode: <input type="text" name="stopcode" value="<?php echo $stopcode ?>"/><br> |
<small> if you click on feedback from a stop page, these will get filled in automatically. else describe the location/street of the stop in one of these boxes </small><br> | <small> if you click on feedback from a stop page, these will get filled in automatically. else describe the location/street of the stop in one of these boxes </small><br> |
Suggested Stop Location (lat/long or words): <input type="text" name="newlocation"/><br> | Suggested Stop Location (lat/long or words): <input type="text" name="newlocation"/><br> |
<small> if your device supports javascript, you can pick a location from the map above</small><br> | <small> if your device supports javascript, you can pick a location from the map above</small><br> |
<input type="submit" value="Submit!"/> | <input type="submit" value="Submit!"/> |
</form> | |
<h3>Bug Report/Feedback</h3> | <h3>Bug Report/Feedback</h3> |
Please leave feedback about bugs/errors or general suggestions about improvements that could be made to the way the data is presented! | Please leave feedback about bugs/errors or general suggestions about improvements that could be made to the way the data is presented! |
<textarea id="feedback"> | <form action="feedback.php" method="post"> |
<textarea name="feedback"> | |
</textarea> | </textarea> |
<textarea id="extrainfo"> | <textarea name="extrainfo" id="extrainfo"> |
<?php | <?php |
echo "Referrer URL: ".$_SERVER["HTTP_REFERER"]; | echo "Referrer URL: ".$_SERVER["HTTP_REFERER"]; |
echo "\nCurrent page URL: ".curPageURL(); | |
echo "\nUser Agent: ".$_SERVER["HTTP_USER_AGENT"]; | echo "\nUser Agent: ".$_SERVER["HTTP_USER_AGENT"]; |
echo "\nUser host/IP: ".$_SERVER["HTTP_X_FORWARDED_FOR"]." ".$_SERVER["REMOTE_ADDR"]; | echo "\nUser host/IP: ".$_SERVER["HTTP_X_FORWARDED_FOR"]." ".$_SERVER["REMOTE_ADDR"]; |
echo "\nServer host/IP: ".php_uname("n"); | echo "\nServer host/IP: ".php_uname("n"); |
echo "\nCurrent date/time: ". date("c"); | echo "\nCurrent date/time: ". date("c"); |
echo "\nCurrent code revision: ".exec("git rev-parse --short HEAD"); | echo "\nCurrent code revision: ".exec("git rev-parse --short HEAD"); |
echo "\nCurrent timetables version: ".@filemtime('cbrfeed.zip'); | echo "\nCurrent timetables version: ".date("c",@filemtime('cbrfeed.zip')); |
echo "\nDump of session: ".print_r($_SESSION,true); | echo "\nDump of session: ".print_r($_SESSION,true); |
?> | ?> |
</textarea> | </textarea> |
<input type="submit" value="Submit!"/> | <input type="submit" value="Submit!"/> |
</form> | |
<?php | |
} | |
include_footer(); | |
?> | |
<?php | <?php |
function getPage($url) | function getPage($url) |
{ | { |
debug($url, "json"); | debug($url, "json"); |
$ch = curl_init($url); | $ch = curl_init($url); |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
curl_setopt($ch, CURLOPT_HEADER, 0); | curl_setopt($ch, CURLOPT_HEADER, 0); |
curl_setopt($ch, CURLOPT_TIMEOUT, 30); | curl_setopt($ch, CURLOPT_TIMEOUT, 30); |
$page = curl_exec($ch); | $page = curl_exec($ch); |
if (curl_errno($ch)) { | if (curl_errno($ch)) { |
echo "<font color=red> Database temporarily unavailable: "; | echo "<font color=red> Database temporarily unavailable: "; |
echo curl_errno($ch) . " " . curl_error($ch); | echo curl_errno($ch) . " " . curl_error($ch); |
if (isDebug()) { | if (isDebug()) { |
echo $url; | echo $url; |
} | } |
echo "</font><br>"; | echo "</font><br>"; |
} | } |
curl_close($ch); | curl_close($ch); |
debug(print_r($page,true),"json"); | debug(print_r($page,true),"json"); |
return $page; | return $page; |
} | } |
function curPageURL() | function curPageURL() |
{ | { |
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"); | $isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"); |
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443"))); | $port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443"))); |
$port = ($port) ? ':' . $_SERVER["SERVER_PORT"] : ''; | $port = ($port) ? ':' . $_SERVER["SERVER_PORT"] : ''; |
$url = ($isHTTPS ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"] . $port . htmlentities(dirname($_SERVER['PHP_SELF']) , ENT_QUOTES) . "/"; | $url = ($isHTTPS ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"] . $port . htmlentities(dirname($_SERVER['PHP_SELF']) , ENT_QUOTES); |
return $url; | return $url; |
} | } |
?> | ?> |
<?php | |
// you have to open the session to be able to modify or remove it | |
session_start(); | |
if (isset($_REQUEST['service_period'])) { | |
$_SESSION['service_period'] = filter_var($_REQUEST['service_period'], FILTER_SANITIZE_STRING); | |
sessionUpdated(); | |
} | |
if (isset($_REQUEST['time'])) { | |
$_SESSION['time'] = filter_var($_REQUEST['time'], FILTER_SANITIZE_STRING); | |
sessionUpdated(); | |
} | |
if (isset($_REQUEST['geolocate'])) { | |
$geocoded = false; | |
if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) { | |
$_SESSION['lat'] = trim(filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); | |
$_SESSION['lon'] = trim(filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); | |
} | |
else { | |
$geolocate = filter_var($_REQUEST['geolocate'], FILTER_SANITIZE_URL); | |
echo $_REQUEST['geolocate']; | |
if (startsWith($geolocate, "-")) { | |
$locateparts = explode(",", $geolocate); | |
$_SESSION['lat'] = $locateparts[0]; | |
$_SESSION['lon'] = $locateparts[1]; | |
} | |
else { | |
$contents = geocode($geolocate, true); | |
print_r($contents); | |
if (isset($contents[0]->centroid)) { | |
$geocoded = true; | |
$_SESSION['lat'] = $contents[0]->centroid->coordinates[0]; | |
$_SESSION['lon'] = $contents[0]->centroid->coordinates[1]; | |
} | |
else { | |
$_SESSION['lat'] = ""; | |
$_SESSION['lon'] = ""; | |
} | |
} | |
} | |
if ($_SESSION['lat'] != "" && isAnalyticsOn()) { | |
trackEvent("Geolocation","Updated Location", "Geocoded - ".($geocoded ? "Yes" : "No")); | |
} | |
sessionUpdated(); | |
} | |
function sessionUpdated() { | |
$_SESSION['lastUpdated'] = time(); | |
} | |
// timeoutSession | |
$TIMEOUT_LIMIT = 60*5; // 5 minutes | |
if (isset($_SESSION['lastUpdated']) && $_SESSION['lastUpdated']+$TIMEOUT_LIMIT < time()) { | |
debug ("Session timeout ".($_SESSION['lastUpdated']+$TIMEOUT_LIMIT).">".time(),"session"); | |
session_destroy(); | |
session_start(); | |
} | |
debug(print_r($_SESSION, true) , "session"); | |
?> |
<?php | <?php |
// Copyright 2009 Google Inc. All Rights Reserved. | // Copyright 2009 Google Inc. All Rights Reserved. |
$GA_ACCOUNT = "MO-22173039-1"; | $GA_ACCOUNT = "MO-22173039-1"; |
$GA_PIXEL = "/lib/ga.php"; | $GA_PIXEL = "/lib/ga.php"; |
function googleAnalyticsGetImageUrl() { | function googleAnalyticsGetImageUrl() { |
global $GA_ACCOUNT, $GA_PIXEL; | global $GA_ACCOUNT, $GA_PIXEL; |
$url = ""; | $url = ""; |
$url .= $GA_PIXEL . "?"; | $url .= $GA_PIXEL . "?"; |
$url .= "utmac=" . $GA_ACCOUNT; | $url .= "utmac=" . $GA_ACCOUNT; |
$url .= "&utmn=" . rand(0, 0x7fffffff); | $url .= "&utmn=" . rand(0, 0x7fffffff); |
$referer = $_SERVER["HTTP_REFERER"]; | $referer = $_SERVER["HTTP_REFERER"]; |
$query = $_SERVER["QUERY_STRING"]; | $query = $_SERVER["QUERY_STRING"]; |
$path = $_SERVER["REQUEST_URI"]; | $path = $_SERVER["REQUEST_URI"]; |
if (empty($referer)) { | if (empty($referer)) { |
$referer = "-"; | $referer = "-"; |
} | } |
$url .= "&utmr=" . urlencode($referer); | $url .= "&utmr=" . urlencode($referer); |
if (!empty($path)) { | if (!empty($path)) { |
$url .= "&utmp=" . urlencode($path); | $url .= "&utmp=" . urlencode($path); |
} | } |
$url .= "&guid=ON"; | $url .= "&guid=ON"; |
return str_replace("&", "&", $url); | return str_replace("&", "&", $url); |
} | } |
function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) | function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) |
{ | { |
echo ' | echo ' |
<!DOCTYPE html> | <!DOCTYPE html> |
<html lang="en"> | <html lang="en"> |
<head> | <head> |
<meta charset="UTF-8"> | <meta charset="UTF-8"> |
<title>' . $pageTitle . '</title> | <title>' . $pageTitle . '</title> |
<meta name="google-site-verification" | <meta name="google-site-verification" |
content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />'; | content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />'; |
if ($datepicker) echo '<link rel="stylesheet" href="css/jquery.ui.datepicker.mobile.css" />'; | if ($datepicker) echo '<link rel="stylesheet" href="css/jquery.ui.datepicker.mobile.css" />'; |
if (isDebugServer()) echo '<link rel="stylesheet" href="css/jquery-mobile-1.0a3.css" /> | if (isDebugServer()) echo '<link rel="stylesheet" href="css/jquery-mobile-1.0a3.css" /> |
<script type="text/javascript" src="js/jquery-1.5.js"></script> | <script type="text/javascript" src="js/jquery-1.5.js"></script> |
<script>$(document).bind("mobileinit", function(){ | <script>$(document).bind("mobileinit", function(){ |
$.mobile.ajaxEnabled = false; | $.mobile.ajaxEnabled = false; |
}); | }); |
</script> | </script> |
<script type="text/javascript" src="js/jquery-mobile-1.0a3.js"></script>'; | <script type="text/javascript" src="js/jquery-mobile-1.0a3.js"></script>'; |
else echo '<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /> | else echo '<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /> |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script> | <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script> |
<script>$(document).bind("mobileinit", function(){ | <script>$(document).bind("mobileinit", function(){ |
$.mobile.ajaxEnabled = false; | $.mobile.ajaxEnabled = false; |
}); | }); |
</script> | </script> |
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>'; | <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>'; |
if ($datepicker) echo '<script> | if ($datepicker) echo '<script> |
//reset type=date inputs to text | //reset type=date inputs to text |
$( document ).bind( "mobileinit", function(){ | $( document ).bind( "mobileinit", function(){ |
$.mobile.page.prototype.options.degradeInputs.date = true; | $.mobile.page.prototype.options.degradeInputs.date = true; |
}); | }); |
</script> | </script> |
<script src="js/jQuery.ui.datepicker.js"></script>'; | <script src="js/jQuery.ui.datepicker.js"></script>'; |
echo '<style type="text/css"> | echo '<style type="text/css"> |
.ui-navbar { | .ui-navbar { |
width: 100%; | width: 100%; |
} | } |
.ui-btn-inner { | .ui-btn-inner { |
white-space: normal !important; | white-space: normal !important; |
} | } |
.ui-li-heading { | .ui-li-heading { |
white-space: normal !important; | white-space: normal !important; |
} | } |
.ui-listview-filter { | .ui-listview-filter { |
margin: 0 !important; | margin: 0 !important; |
} | } |
.ui-icon-navigation { | .ui-icon-navigation { |
background-image: url(css/images/113-navigation.png); | background-image: url(css/images/113-navigation.png); |
background-position: 1px 0; | background-position: 1px 0; |
} | } |
#footer { | #footer { |
text-size: 0.75em; | text-size: 0.75em; |
text-align: center; | text-align: center; |
} | } |
body { | body { |
background-color: #F0F0F0; | background-color: #F0F0F0; |
} | } |
#jqm-homeheader { | #jqm-homeheader { |
text-align: center; | text-align: center; |
} | } |
.viaPoints { | .viaPoints { |
display: none; | display: none; |
text-size: 0.2em; | text-size: 0.2em; |
} | } |
.min-width-480px .viaPoints { | .min-width-480px .viaPoints { |
display: block; | display: inline; |
} | } |
#extrainfo { | #extrainfo { |
visibility: hidden; | visibility: hidden; |
display: none; | display: none; |
} | } |
// source http://webaim.org/techniques/skipnav/ | // source http://webaim.org/techniques/skipnav/ |
#skip a, #skip a:hover, #skip a:visited | #skip a, #skip a:hover, #skip a:visited |
{ | { |
position:absolute; | position:absolute; |
left:0px; | left:0px; |
top:-500px; | top:-500px; |
width:1px; | width:1px; |
height:1px; | height:1px; |
overflow:hidden; | overflow:hidden; |
} | } |
#skip a:active, #skip a:focus | #skip a:active, #skip a:focus |
{ | { |
position:static; | position:static; |
width:auto; | width:auto; |
height:auto; | height:auto; |
} | } |
</style>'; | </style>'; |
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod')) { | if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod')) { |
echo '<meta name="apple-mobile-web-app-capable" content="yes" /> | echo '<meta name="apple-mobile-web-app-capable" content="yes" /> |
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
<link rel="apple-touch-startup-image" href="startup.png" /> | <link rel="apple-touch-startup-image" href="startup.png" /> |
<link rel="apple-touch-icon" href="apple-touch-icon.png" />'; | <link rel="apple-touch-icon" href="apple-touch-icon.png" />'; |
} | } |
if ($geolocate) { | if ($geolocate) { |
echo "<script> | echo "<script> |
function success(position) { | function success(position) { |
$('#error').val('Location now detected. Please wait for data to load.'); | $('#error').val('Location now detected. Please wait for data to load.'); |
$('#geolocate').val(position.coords.latitude+','+position.coords.longitude); | $('#geolocate').val(position.coords.latitude+','+position.coords.longitude); |
$.ajax({ url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude }); | $.ajax({ url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude }); |
location.reload(true); | location.reload(true); |
} | } |
function error(msg) { | function error(msg) { |
$('#error').val('Error: '+msg); | $('#error').val('Error: '+msg); |
} | } |
function geolocate() { | function geolocate() { |
if (navigator.geolocation) { | if (navigator.geolocation) { |
var options = { | var options = { |
enableHighAccuracy: true, | enableHighAccuracy: true, |
timeout: 60000, | timeout: 60000, |
maximumAge: 10000 | maximumAge: 10000 |
} | } |
navigator.geolocation.getCurrentPosition(success, error, options); | navigator.geolocation.getCurrentPosition(success, error, options); |
} | } |
} | } |
$(document).ready(function() { | $(document).ready(function() { |
$('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); | $('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); |
$('#here').show(); | $('#here').show(); |
}); | }); |
"; | "; |
if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") echo "geolocate();"; | if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") echo "geolocate();"; |
echo "</script> "; | echo "</script> "; |
} | } |
if (isAnalyticsOn()) echo ' | if (isAnalyticsOn()) echo ' |
<script type="text/javascript">'." | <script type="text/javascript">'." |
var _gaq = _gaq || []; | var _gaq = _gaq || []; |
_gaq.push(['_setAccount', 'UA-22173039-1']); | _gaq.push(['_setAccount', 'UA-22173039-1']); |
_gaq.push(['_trackPageview']); | _gaq.push(['_trackPageview']); |
</script>"; | </script>"; |
echo '</head> | echo '</head> |
<body> | <body> |
<div id="skip"> | <div id="skip"> |
<a href="#maincontent">Skip to content</a> | <a href="#maincontent">Skip to content</a> |
</div> | </div> |
'; | '; |
if ($opendiv) { | if ($opendiv) { |
echo '<div data-role="page"> | echo '<div data-role="page"> |
<script> | <script> |
$(document).ready(function () | $(document).ready(function () |
{ | { |
document.title = "' . $pageTitle . '"; | document.title = "' . $pageTitle . '"; |
}); | }); |
</script> | </script> |
<div data-role="header" data-position="inline"> | <div data-role="header" data-position="inline"> |
<a href="'.$_SERVER["HTTP_REFERER"].'" data-icon="arrow-l" data-rel="back">Back</a> | <a href="'.$_SERVER["HTTP_REFERER"].'" data-icon="arrow-l" data-rel="back">Back</a> |
<h1>' . $pageTitle . '</h1> | <h1>' . $pageTitle . '</h1> |
</div><!-- /header --> | </div><!-- /header --> |
<a name="maincontent" id="maincontent"></a> | <a name="maincontent" id="maincontent"></a> |
<div data-role="content"> '; | <div data-role="content"> '; |
} | } |
} | } |
function include_footer() | function include_footer() |
{ | { |
echo '<div id="footer"><a href="about.php">About/Contact Us</a> <a href="feedback.php">Feedback/Bug Report</a></a>'; | echo '<div id="footer"><a href="about.php">About/Contact Us</a> <a href="feedback.php">Feedback/Bug Report</a></a>'; |
echo '</div>'; | echo '</div>'; |
if (isAnalyticsOn()) { | if (isAnalyticsOn()) { |
echo "<script> (function() { | echo "<script> (function() { |
var ga = document.createElement('script'); ga.type = | var ga = document.createElement('script'); ga.type = |
'text/javascript'; ga.async = true; | 'text/javascript'; ga.async = true; |
ga.src = ('https:' == document.location.protocol ? | ga.src = ('https:' == document.location.protocol ? |
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
var s = document.getElementsByTagName('script')[0]; | var s = document.getElementsByTagName('script')[0]; |
s.parentNode.insertBefore(ga, s); | s.parentNode.insertBefore(ga, s); |
})();</script>"; | })();</script>"; |
$googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); | $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); |
echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>'; | echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>'; |
} | } |
} | } |
function timePlaceSettings($geolocate = false) | function timePlaceSettings($geolocate = false) |
{ | { |
global $service_periods; | global $service_periods; |
$geoerror = false; | $geoerror = false; |
if ($geolocate == true) { | if ($geolocate == true) { |
$geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; | $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; |
} | } |
if ($geoerror) { | if ($geoerror) { |
echo '<div id="error">Sorry, but your location could not currently be detected. | echo '<div id="error">Sorry, but your location could not currently be detected. |
Please allow location permission, wait for your location to be detected, | Please allow location permission, wait for your location to be detected, |
or enter an address/co-ordinates in the box below.</div>'; | or enter an address/co-ordinates in the box below.</div>'; |
} | } |
echo '<div data-role="collapsible" data-collapsed="' . !$geoerror . '"> | echo '<div data-role="collapsible" data-collapsed="' . !$geoerror . '"> |
<h3>Change Time/Place (' . (isset($_SESSION['time']) ? $_SESSION['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...</h3> | <h3>Change Time/Place (' . (isset($_SESSION['time']) ? $_SESSION['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...</h3> |
<form action="'.basename($_SERVER['PHP_SELF'])."?".$_SERVER['QUERY_STRING'].'" method="post"> | <form action="'.basename($_SERVER['PHP_SELF'])."?".$_SERVER['QUERY_STRING'].'" method="post"> |
<div class="ui-body"> | <div class="ui-body"> |
<div data-role="fieldcontain"> | <div data-role="fieldcontain"> |
<label for="geolocate"> Current Location: </label> | <label for="geolocate"> Current Location: </label> |
<input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a> | <input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a> |
</div> | </div> |
<div data-role="fieldcontain"> | <div data-role="fieldcontain"> |
<label for="time"> Time: </label> | <label for="time"> Time: </label> |
<input type="time" name="time" id="time" value="' . (isset($_SESSION['time']) ? $_SESSION['time'] : date("H:i")) . '"/> | <input type="time" name="time" id="time" value="' . (isset($_SESSION['time']) ? $_SESSION['time'] : date("H:i")) . '"/> |
<a href="#" name="currentTime" id="currentTime" onClick="var d = new Date();'. "$('#time').val(d.getHours() +':'+ (d.getMinutes().toString().length = 1 ? '0'+ d.getMinutes(): d.getMinutes()));".'">Current Time?</a> | <a href="#" name="currentTime" id="currentTime" onClick="var d = new Date();'. "$('#time').val(d.getHours() +':'+ (d.getMinutes().toString().length = 1 ? '0'+ d.getMinutes(): d.getMinutes()));".'">Current Time?</a> |
</div> | </div> |
<div data-role="fieldcontain"> | <div data-role="fieldcontain"> |
<label for="service_period"> Service Period: </label> | <label for="service_period"> Service Period: </label> |
<select name="service_period" id="service_period">'; | <select name="service_period" id="service_period">'; |
foreach ($service_periods as $service_period) { | foreach ($service_periods as $service_period) { |
echo "<option value=\"$service_period\"" . (service_period() === $service_period ? " SELECTED" : "") . '>' . ucwords($service_period) . '</option>'; | echo "<option value=\"$service_period\"" . (service_period() === $service_period ? " SELECTED" : "") . '>' . ucwords($service_period) . '</option>'; |
} | } |
echo '</select> | echo '</select> |
<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a> | <a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a> |
</div> | </div> |
<input type="submit" value="Update"/> | <input type="submit" value="Update"/> |
</form> | </form> |
</div></div>'; | </div></div>'; |
} | } |
function trackEvent($category, $action, $label = "", $value = -1) { | function trackEvent($category, $action, $label = "", $value = -1) { |
if (isAnalyticsOn()) { | if (isAnalyticsOn()) { |
echo "<script> _gaq.push(['_trackEvent', $category, $action".($label != "" ? ", $label" : "").($value != -1 ? ", $value" : "")."]);</script>"; | echo "<script> _gaq.push(['_trackEvent', $category, $action".($label != "" ? ", $label" : "").($value != -1 ? ", $value" : "")."]);</script>"; |
} | } |
} | } |
?> | ?> |
<?php | <?php |
date_default_timezone_set('Australia/ACT'); | date_default_timezone_set('Australia/ACT'); |
$APIurl = "http://localhost:8765"; | $APIurl = "http://localhost:8765"; |
$debugOkay = Array( | $debugOkay = Array( |
"session", | "session", |
"json", | "json", |
"phperror", | "phperror", |
//"awsgtfs", | //"awsgtfs", |
"awsotp", | "awsotp", |
//"squallotp", | //"squallotp", |
//"vanilleotp", | //"vanilleotp", |
"other" | "other" |
); | ); |
if (isDebug("awsgtfs")) { | if (isDebug("awsgtfs")) { |
$APIurl = "http://bus-main.lambdacomplex.org:8765"; | $APIurl = "http://bus-main.lambdacomplex.org:8765"; |
} | } |
$cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6"; | $cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6"; |
$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q"; | $googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q"; |
$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/'; |
if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") { | if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") { |
$otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("squallotp")) { | if (isDebug("squallotp")) { |
$otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("vanilleotp")) { | if (isDebug("vanilleotp")) { |
$otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE); | if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE); |
include_once ("common-geo.inc.php"); | include_once ("common-geo.inc.php"); |
include_once ("common-net.inc.php"); | include_once ("common-net.inc.php"); |
include_once ("common-transit.inc.php"); | |
include_once ("common-session.inc.php"); | |
include_once ("common-template.inc.php"); | include_once ("common-template.inc.php"); |
include_once ("common-transit.inc.php"); | |
// you have to open the session to be able to modify or remove it | |
session_start(); | |
if (isset($_REQUEST['service_period'])) { | |
$_SESSION['service_period'] = filter_var($_REQUEST['service_period'], FILTER_SANITIZE_STRING); | |
} | |
if (isset($_REQUEST['time'])) { | |
$_SESSION['time'] = filter_var($_REQUEST['time'], FILTER_SANITIZE_STRING); | |
} | |
if (isset($_REQUEST['geolocate'])) { | |
$geocoded = false; | |
if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) { | |
$_SESSION['lat'] = trim(filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); | |
$_SESSION['lon'] = trim(filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); | |
} | |
else { | |
$geolocate = filter_var($_REQUEST['geolocate'], FILTER_SANITIZE_URL); | |
echo $_REQUEST['geolocate']; | |
if (startsWith($geolocate, "-")) { | |
$locateparts = explode(",", $geolocate); | |
$_SESSION['lat'] = $locateparts[0]; | |
$_SESSION['lon'] = $locateparts[1]; | |
} | |
else { | |
$contents = geocode($geolocate, true); | |
print_r($contents); | |
if (isset($contents[0]->centroid)) { | |
$geocoded = true; | |
$_SESSION['lat'] = $contents[0]->centroid->coordinates[0]; | |
$_SESSION['lon'] = $contents[0]->centroid->coordinates[1]; | |
} | |
else { | |
$_SESSION['lat'] = ""; | |
$_SESSION['lon'] = ""; | |
} | |
} | |
} | |
if ($_SESSION['lat'] != "" && isAnalyticsOn()) { | |
trackEvent("Geolocation","Updated Location", "Geocoded - ".($geocoded ? "Yes" : "No")); | |
} | |
} | |
debug(print_r($_SESSION, true) , "session"); | |
function isDebugServer() | function isDebugServer() |
{ | { |
return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME']; | return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME']; |
} | } |
function isAnalyticsOn() | function isAnalyticsOn() |
{ | { |
return !isDebugServer(); | return !isDebugServer(); |
} | } |
function isDebug($debugReason = "other") | function isDebug($debugReason = "other") |
{ | { |
global $debugOkay; | global $debugOkay; |
return in_array($debugReason, $debugOkay, false) && isDebugServer(); | return in_array($debugReason, $debugOkay, false) && isDebugServer(); |
} | } |
function debug($msg, $debugReason = "other") | function debug($msg, $debugReason = "other") |
{ | { |
if (isDebug($debugReason)) echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n"; | if (isDebug($debugReason)) echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n"; |
} | } |
function isJQueryMobileDevice() | function isJQueryMobileDevice() |
{ | { |
// http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 | // http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 |
$user_agent = $_SERVER['HTTP_USER_AGENT']; | $user_agent = $_SERVER['HTTP_USER_AGENT']; |
return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); | return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); |
} | } |
function isFastDevice() | function isFastDevice() |
{ | { |
$ua = $_SERVER['HTTP_USER_AGENT']; | $ua = $_SERVER['HTTP_USER_AGENT']; |
$fastDevices = Array( | $fastDevices = Array( |
"Mozilla/5.0 (X11;", | "Mozilla/5.0 (X11;", |
"Mozilla/5.0 (Windows;", | "Mozilla/5.0 (Windows;", |
"Mozilla/5.0 (iP", | "Mozilla/5.0 (iP", |
"Mozilla/5.0 (Linux; U; Android", | "Mozilla/5.0 (Linux; U; Android", |
"Mozilla/4.0 (compatible; MSIE" | "Mozilla/4.0 (compatible; MSIE" |
); | ); |
$slowDevices = Array( | $slowDevices = Array( |
"J2ME", | "J2ME", |
"MIDP", | "MIDP", |
"Opera/", | "Opera/", |
"Mozilla/2.0 (compatible;", | "Mozilla/2.0 (compatible;", |
"Mozilla/3.0 (compatible;" | "Mozilla/3.0 (compatible;" |
); | ); |
return true; | return true; |
} | } |
function array_flatten($a, $f = array()) | function array_flatten($a, $f = array()) |
{ | { |
if (!$a || !is_array($a)) return ''; | if (!$a || !is_array($a)) return ''; |
foreach ($a as $k => $v) { | foreach ($a as $k => $v) { |
if (is_array($v)) $f = array_flatten($v, $f); | if (is_array($v)) $f = array_flatten($v, $f); |
else $f[$k] = $v; | else $f[$k] = $v; |
} | } |
return $f; | return $f; |
} | } |
function remove_spaces($string) | function remove_spaces($string) |
{ | { |
return str_replace(' ', '', $string); | return str_replace(' ', '', $string); |
} | } |
function object2array($object) | function object2array($object) |
{ | { |
if (is_object($object)) { | if (is_object($object)) { |
foreach ($object as $key => $value) { | foreach ($object as $key => $value) { |
$array[$key] = $value; | $array[$key] = $value; |
} | } |
} | } |
else { | else { |
$array = $object; | $array = $object; |
} | } |
return $array; | return $array; |
} | } |
function startsWith($haystack, $needle, $case = true) | function startsWith($haystack, $needle, $case = true) |
{ | { |
if ($case) { | if ($case) { |
return (strcmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); | return (strcmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); |
} | } |
return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); | return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); |
} | } |
function endsWith($haystack, $needle, $case = true) | function endsWith($haystack, $needle, $case = true) |
{ | { |
if ($case) { | if ($case) { |
return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); | return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); |
} | } |
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); | return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); |
} | } |
function bracketsMeanNewLine($input) | function bracketsMeanNewLine($input) |
{ | { |
return str_replace(")", "</small>", str_replace("(", "<br><small>", $input)); | return str_replace(")", "</small>", str_replace("(", "<br><small>", $input)); |
} | } |
function sksort(&$array, $subkey = "id", $sort_ascending = false) | function sksort(&$array, $subkey = "id", $sort_ascending = false) |
{ | { |
if (count($array)) $temp_array[key($array) ] = array_shift($array); | if (count($array)) $temp_array[key($array) ] = array_shift($array); |
foreach ($array as $key => $val) { | foreach ($array as $key => $val) { |
$offset = 0; | $offset = 0; |
$found = false; | $found = false; |
foreach ($temp_array as $tmp_key => $tmp_val) { | foreach ($temp_array as $tmp_key => $tmp_val) { |
if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { | if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { |
$temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( | $temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( |
$key => $val | $key => $val |
) , array_slice($temp_array, $offset)); | ) , array_slice($temp_array, $offset)); |
$found = true; | $found = true; |
} | } |
$offset++; | $offset++; |
} | } |
if (!$found) $temp_array = array_merge($temp_array, array( | if (!$found) $temp_array = array_merge($temp_array, array( |
$key => $val | $key => $val |
)); | )); |
} | } |
if ($sort_ascending) $array = array_reverse($temp_array); | if ($sort_ascending) $array = array_reverse($temp_array); |
else $array = $temp_array; | else $array = $temp_array; |
} | } |
?> | ?> |
<?php | <?php |
include ('include/common.inc.php'); | include ('include/common.inc.php'); |
$stopid = filter_var($_REQUEST['stopid'], FILTER_SANITIZE_NUMBER_INT); | $stopid = filter_var($_REQUEST['stopid'], FILTER_SANITIZE_NUMBER_INT); |
$stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING); | $stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING); |
$url = $APIurl . "/json/stop?stop_id=" . $stopid; | $url = $APIurl . "/json/stop?stop_id=" . $stopid; |
$stop = json_decode(getPage($url)); | $stop = json_decode(getPage($url)); |
if ($stopcode != "" && $stop[5] != $stopcode) { | if ($stopcode != "" && $stop[5] != $stopcode) { |
$url = $APIurl . "/json/stopcodesearch?q=" . $stopcode; | $url = $APIurl . "/json/stopcodesearch?q=" . $stopcode; |
$stopsearch = json_decode(getPage($url)); | $stopsearch = json_decode(getPage($url)); |
$stopid = $stopsearch[0][0]; | $stopid = $stopsearch[0][0]; |
$url = $APIurl . "/json/stop?stop_id=" . $stopid; | $url = $APIurl . "/json/stop?stop_id=" . $stopid; |
$stop = json_decode(getPage($url)); | $stop = json_decode(getPage($url)); |
} | } |
if (!startsWith($stop[5], "Wj") && strpos($stop[1], "Platform") === false) { | if (!startsWith($stop[5], "Wj") && strpos($stop[1], "Platform") === false) { |
// expand out to all platforms | // expand out to all platforms |
} | } |
$stops = Array(); | $stops = Array(); |
$stopPositions = Array(); | $stopPositions = Array(); |
$stopNames = Array(); | $stopNames = Array(); |
$tripStopNumbers = Array(); | $tripStopNumbers = Array(); |
$allStopsTrips = Array(); | $allStopsTrips = Array(); |
$stopLinks = ""; | $stopLinks = ""; |
if (isset($_REQUEST['stopids'])) { | if (isset($_REQUEST['stopids'])) { |
$stopids = explode(",", filter_var($_REQUEST['stopids'], FILTER_SANITIZE_STRING)); | $stopids = explode(",", filter_var($_REQUEST['stopids'], FILTER_SANITIZE_STRING)); |
foreach ($stopids as $sub_stopid) { | foreach ($stopids as $sub_stopid) { |
$url = $APIurl . "/json/stop?stop_id=" . $sub_stopid; | $url = $APIurl . "/json/stop?stop_id=" . $sub_stopid; |
$stop = json_decode(getPage($url)); | $stop = json_decode(getPage($url)); |
$stops[] = $stop; | $stops[] = $stop; |
} | } |
$stop = $stops[0]; | $stop = $stops[0]; |
$stopid = $stops[0][0]; | $stopid = $stops[0][0]; |
$stopLinks.= "Individual stop pages: "; | $stopLinks.= "Individual stop pages: "; |
foreach ($stops as $key => $sub_stop) { | foreach ($stops as $key => $sub_stop) { |
$stopNames[$key] = $sub_stop[1] . ' Stop #' . ($key + 1); | // $stopNames[$key] = $sub_stop[1] . ' Stop #' . ($key + 1); |
$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop[0] . '&stopcode=' . $sub_stop[5] . '">' . $stopNames[$key] . '</a> '; | if (strpos($stop[1], |
"Station")) { | |
$stopNames[$key] = 'Platform ' . ($key + 1); | |
$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop[0] . '&stopcode=' . $sub_stop[5] . '">' . $sub_stop[1] . '</a> '; | |
} else { | |
$stopNames[$key] = '#' . ($key + 1); | |
$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop[0] . '&stopcode=' . $sub_stop[5] . '">' . $sub_stop[1] . ' Stop #' . ($key + 1) . '</a> '; | |
} | |
$stopPositions[$key] = Array( | $stopPositions[$key] = Array( |
$sub_stop[2], | $sub_stop[2], |
$sub_stop[3] | $sub_stop[3] |
); | ); |
$url = $APIurl . "/json/stoptrips?stop=" . $sub_stop[0] . "&time=" . midnight_seconds() . "&service_period=" . service_period(); | $url = $APIurl . "/json/stoptrips?stop=" . $sub_stop[0] . "&time=" . midnight_seconds() . "&service_period=" . service_period(); |
$trips = json_decode(getPage($url)); | $trips = json_decode(getPage($url)); |
foreach ($trips as $trip) { | foreach ($trips as $trip) { |
if (!isset($allStopsTrips[$trip[1][0]])) $allStopsTrips[$trip[1][0]] = $trip; | if (!isset($allStopsTrips[$trip[1][0]])) $allStopsTrips[$trip[1][0]] = $trip; |
$tripStopNumbers[$trip[1][0]][] = $key; | $tripStopNumbers[$trip[1][0]][] = $key; |
} | } |
} | } |
} | } |
include_header($stop[1], "stop"); | include_header($stop[1], "stop"); |
timePlaceSettings(); | timePlaceSettings(); |
echo '<div data-role="content" class="ui-content" role="main"> <a name="maincontent" id="maincontent"></a>'; | echo '<div data-role="content" class="ui-content" role="main"> <a name="maincontent" id="maincontent"></a>'; |
echo $stopLinks; | echo $stopLinks; |
if (sizeof($stops) > 0) { | if (sizeof($stops) > 0) { |
trackEvent("View Stops","View Combined Stops", $stop[1], $stop[0]); | trackEvent("View Stops","View Combined Stops", $stop[1], $stop[0]); |
echo '<p>' . staticmap($stopPositions) . '</p>'; | echo '<p>' . staticmap($stopPositions) . '</p>'; |
} | } |
else { | else { |
trackEvent("View Stops","View Single Stop", $stop[1], $stop[0]); | trackEvent("View Stops","View Single Stop", $stop[1], $stop[0]); |
echo '<p>' . staticmap(Array( | echo '<p>' . staticmap(Array( |
0 => Array( | 0 => Array( |
$stop[2], | $stop[2], |
$stop[3] | $stop[3] |
) | ) |
)) . '</p>'; | )) . '</p>'; |
} | } |
echo ' <ul data-role="listview" data-inset="true">'; | echo ' <ul data-role="listview" data-inset="true">'; |
if (sizeof($allStopsTrips) > 0) { | if (sizeof($allStopsTrips) > 0) { |
sksort($allStopsTrips,0, $true); | |
$trips = $allStopsTrips; | $trips = $allStopsTrips; |
} | } |
else { | else { |
$url = $APIurl . "/json/stoptrips?stop=" . $stopid . "&time=" . midnight_seconds() . "&service_period=" . service_period(); | $url = $APIurl . "/json/stoptrips?stop=" . $stopid . "&time=" . midnight_seconds() . "&service_period=" . service_period(); |
$trips = json_decode(getPage($url)); | $trips = json_decode(getPage($url)); |
} | } |
foreach ($trips as $row) { | foreach ($trips as $row) { |
echo '<li>'; | echo '<li>'; |
echo '<h3><a href="trip.php?stopid=' . $stopid . '&tripid=' . $row[1][0] . '">' . $row[1][1]; | echo '<h3><a href="trip.php?stopid=' . $stopid . '&tripid=' . $row[1][0] . '">' . $row[1][1]; |
$viaPoints = viaPointNames($row[1][0], $stopid); | $viaPoints = viaPointNames($row[1][0], $stopid); |
if ($viaPoints != "") echo '<div class="viaPoints">Via: ' . $viaPoints . '</div>'; | if ($viaPoints != "") echo '<br><span class="viaPoints">Via: ' . $viaPoints . '</span>'; |
if (sizeof($tripStopNumbers) > 0) { | if (sizeof($tripStopNumbers) > 0) { |
echo '<br><small>Boarding At: '; | echo '<br><small>Boarding At: '; |
foreach ($tripStopNumbers[$row[1][0]] as $key) { | foreach ($tripStopNumbers[$row[1][0]] as $key) { |
echo $stopNames[$key] .' '; | echo $stopNames[$key] .' '; |
} | } |
echo '</small>'; | echo '</small>'; |
} | } |
echo '</a></h3>'; | echo '</a></h3>'; |
echo '<p class="ui-li-aside"><strong>' . midnight_seconds_to_time($row[0]) . '</strong></p>'; | echo '<p class="ui-li-aside"><strong>' . midnight_seconds_to_time($row[0]) . '</strong></p>'; |
echo '</li>'; | echo '</li>'; |
} | } |
if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>"; | if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>"; |
echo '</ul></div>'; | echo '</ul></div>'; |
include_footer(); | include_footer(); |
?> | ?> |