Fix double slash jQm click handler bug
--- a/feedback.php
+++ b/feedback.php
@@ -55,10 +55,13 @@
<textarea id="extrainfo">
<?php
echo "Referrer URL: ".$_SERVER["HTTP_REFERER"];
+ echo "\nCurrent page URL: ".curPageURL();
echo "\nUser Agent: ".$_SERVER["HTTP_USER_AGENT"];
echo "\nUser host/IP: ".$_SERVER["HTTP_X_FORWARDED_FOR"]." ".$_SERVER["REMOTE_ADDR"];
echo "\nServer host/IP: ".php_uname("n");
echo "\nCurrent date/time: ". date("c");
+ echo "\nCurrent code revision: ".exec("git rev-parse --short HEAD");
+ echo "\nCurrent timetables version: ".@filemtime('cbrfeed.zip');
echo "\nDump of session: ".print_r($_SESSION,true);
?>
</textarea>
--- a/include/common-net.inc.php
+++ b/include/common-net.inc.php
@@ -24,7 +24,8 @@
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$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;
}
?>
+
--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -121,18 +121,19 @@
echo "<script>
function success(position) {
+$('#error').val('Location now detected. Please wait for data to load.');
$('#geolocate').val(position.coords.latitude+','+position.coords.longitude);
$.ajax({ url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude });
location.reload(true);
}
function error(msg) {
- console.log(msg);
+$('#error').val('Error: '+msg);
}
function geolocate() {
if (navigator.geolocation) {
var options = {
- enableHighAccuracy: false,
+ enableHighAccuracy: true,
timeout: 60000,
maximumAge: 10000
}
@@ -168,7 +169,8 @@
document.title = "' . $pageTitle . '";
});
</script>
- <div data-role="header">
+ <div data-role="header" data-position="inline">
+ <a href="'.$_SERVER["HTTP_REFERER"].'" data-icon="arrow-l" data-rel="back">Back</a>
<h1>' . $pageTitle . '</h1>
</div><!-- /header -->
<a name="maincontent" id="maincontent"></a>
@@ -200,7 +202,7 @@
$geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "";
}
if ($geoerror) {
- echo '<div class="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,
or enter an address/co-ordinates in the box below.</div>';
}
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -5,7 +5,7 @@
"session",
"json",
"phperror",
- "awsgtfs",
+ //"awsgtfs",
"awsotp",
//"squallotp",
//"vanilleotp",
--- a/schedule_viewer.py
+++ b/schedule_viewer.py
@@ -316,8 +316,19 @@
except:
print "Error for GetStartTime of trip #" + t.trip_id + sys.exc_info()[0]
else:
- result.append ( (starttime, t.trip_id) )
- return sorted(result, key=lambda trip: trip[0])
+ cursor = t._schedule._connection.cursor()
+ cursor.execute(
+ 'SELECT arrival_secs,departure_secs FROM stop_times WHERE '
+ 'trip_id=? ORDER BY stop_sequence DESC LIMIT 1', (t.trip_id,))
+ (arrival_secs, departure_secs) = cursor.fetchone()
+ if arrival_secs != None:
+ endtime = arrival_secs
+ elif departure_secs != None:
+ endtime = departure_secs
+ else:
+ endtime =0
+ result.append ( (starttime, t.trip_id, endtime) )
+ return sorted(result, key=lambda trip: trip[2])
def handle_json_GET_triprows(self, params):
"""Return a list of rows from the feed file that are related to this
--- a/trip.php
+++ b/trip.php
@@ -9,7 +9,7 @@
$url = $APIurl . "/json/routetrips?route_id=" . $routeid;
$routetrips = json_decode(getPage($url));
foreach ($routetrips as $trip) {
- if ($trip[0] > midnight_seconds()) {
+ if ($trip[2] > midnight_seconds()) {
$tripid = $trip[1];
break;
}