function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) { global $basePath, $GTFSREnabled, $stopid, $routeid; echo ' <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>' . $pageTitle . ' - Canberra Bus Timetable</title> <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" /> <link rel="dns-prefetch" href="//code.jquery.com"/> <link rel="dns-prefetch" href="//ajax.googleapis.com"/> <link rel="profile" href="http://microformats.org/profile/hcalendar"/> <link rel="profile" href="http://microformats.org/profile/geo"/> <link rel="stylesheet" href="' . $basePath . 'css/jquery-ui-1.8.12.custom.css" />'; $jqmVersion = "1.1.1"; if (isDebugServer()) { $jqmcss = $basePath . "css/jquery.mobile-{$jqmVersion}.min.css"; $jqjs = $basePath . "js/jquery-1.8.0.min.js"; $jqmjs = $basePath . "js/jquery.mobile-{$jqmVersion}.min.js"; } else { $jqmcss = "//code.jquery.com/mobile/{$jqmVersion}/jquery.mobile-{$jqmVersion}.min.css"; $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"; $jqmjs = "//code.jquery.com/mobile/{$jqmVersion}/jquery.mobile-{$jqmVersion}.min.js"; } echo '<link rel="stylesheet" href="' . $jqmcss . '" /> <script type="text/javascript" src="' . $jqjs . '"></script> <script type="text/javascript">$(document).bind("mobileinit", function(){ $.mobile.ajaxEnabled = false; }); </script> <script type="text/javascript" src="' . $jqmjs . '"></script> <script type="text/javascript" src="' . $basePath . 'js/jquery.ui.core.min.js"></script> <script type="text/javascript" src="' . $basePath . 'js/jquery.ui.position.min.js"></script> <script type="text/javascript" src="' . $basePath . 'js/jquery.ui.widget.min.js"></script> <script type="text/javascript" src="' . $basePath . 'js/jquery.ui.autocomplete.min.js"></script> <script type="text/javascript"> $(function() { $( "#geolocate" ).autocomplete({ source: "lib/autocomplete.php", minLength: 3 }); $( "#from" ).autocomplete({ source: "lib/autocomplete.php", minLength: 3 }); $( "#to" ).autocomplete({ source: "lib/autocomplete.php", minLength: 3 }); }); </script>'; echo '<style type="text/css">'; if (strstr($_SERVER['HTTP_USER_AGENT'], 'Android')) { echo '.ui-shadow,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-b,.ui-btn-up-b,.ui-btn-hover-b, .ui-btn-down-b,.ui-bar-c,.ui-body-c,.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c,.ui-bar-c,.ui-body-d, .ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d,.ui-bar-d,.ui-body-e,.ui-btn-up-e,.ui-btn-hover-e, .ui-btn-down-e,.ui-bar-e,.ui-overlay-shadow,.ui-shadow,.ui-btn-active,.ui-body-a,.ui-bar-a { text-shadow: none; box-shadow: none; -webkit-box-shadow: none; }'; } echo '</style>'; echo '<link rel="stylesheet" href="' . $basePath . 'css/local.css.php" />'; if (isIOSDevice()) { echo '<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <link rel="apple-touch-startup-image" href="startup.png" /> <link rel="apple-touch-icon" href="apple-touch-icon.png" />'; } if ($geolocate) { echo "<script type=\"text/javascript\">\n\nfunction success(position) {\n\$('#error').val('Location now detected. Please wait for data to load.');\n\$('#geolocate').val(position.coords.latitude+','+position.coords.longitude);\n\$.ajax({ async: false, \nsuccess: function(){\n\tlocation.reload(true);\n },\nurl: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude });\n}\nfunction error(msg) {\n\$('#error').val('Error: '+msg);\n}\n\nfunction geolocate() {\nif (navigator.geolocation) {\nvar options = {\n enableHighAccuracy: true,\n timeout: 60000,\n maximumAge: 10000\n}\n navigator.geolocation.getCurrentPosition(success, error, options);\n}\n}\n\$(document).ready(function() {\n \$('#here').click(function(event) { \$('#geolocate').val(geolocate()); return false;});\n \$('#here').show();\n});\n"; if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") { echo "geolocate();"; } echo "</script> "; } if (isAnalyticsOn()) { echo ' <script type="text/javascript">' . "\n\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', 'UA-22173039-1']);\n _gaq.push(['_trackPageview']);\n _gaq.push(['_trackPageLoadTime']);\n</script>"; } echo '</head> <body> <div id="skip"> <a href="#maincontent">Skip to content</a> </div> '; if ($opendiv) { echo '<div data-role="page" ' . (isset($stopid) ? 'itemscope itemtype="http://schema.org/BusStop"' : '') . '>'; echo '<div data-role="header" data-position="inline"> <a href="' . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "javascript:history.go(-1)") . '" data-icon="arrow-l" data-rel="back" class="ui-btn-left">Back</a> <h1 itemprop="name">' . $pageTitle . '</h1> <a href="' . $basePath . '/index.php" data-icon="home" class="ui-btn-right" rel="home">Home</a> </div><!-- /header --> <a name="maincontent" id="maincontent"></a> <div data-role="content"> '; if ($GTFSREnabled) { $overrides = getServiceOverride(); if (isset($overrides['service_id'])) { if ($overrides['service_id'] == "noservice") { echo '<div class="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; } else { echo '<div class="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; } } $serviceAlerts = array(); $globalAlerts = getServiceAlertsAsArray("agency", "0"); if ($globalAlerts != null) { // echo "getting alerts due to network wide"; $serviceAlerts = array_merge($serviceAlerts, $globalAlerts); } if (isset($stopid)) { $stopAlerts = getServiceAlertsAsArray("stop", $stopid); if ($stopAlerts != null) { // echo "getting alerts due to stop $stopid"; $serviceAlerts = array_merge($serviceAlerts, $stopAlerts); } } if (isset($routeid)) { $routeAlerts = getServiceAlertsAsArray("route", $routeid); if ($routeAlerts != null) { // echo "getting alerts due to route $routeid"; $serviceAlerts = array_merge($serviceAlerts, $routeAlerts); } } if (isset($serviceAlerts['entity']) && sizeof($serviceAlerts['entity']) > 0) { foreach ($serviceAlerts['entity'] as $entity) { echo "<div class='servicewarning'><b>{$entity['alert']['header_text']['translation'][0]['text']}</b> <small>" . date("F jS Y, g:i a", $entity['alert']['active_period'][0]['start']) . " to " . date("F jS Y, g:i a", $entity['alert']['active_period'][0]['end']) . "</small>\n <br>Warning: {$entity['alert']['description_text']['translation'][0]['text']} \n <br><a href='{$entity['alert']['url']['translation'][0]['text']}'>Source</a> </div>"; } } } } }
Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ if (strstr(php_uname('n'), 'actbus')) { $conn = new PDO('pgsql:dbname=transitdata;user=transitdata;password=transitdata;host=bus-main.lambdacomplex.org'); } else { if (isDebugServer()) { $conn = new PDO('pgsql:dbname=transitdata;user=postgres;password=snmc;host=localhost'); } else { $conn = new PDO('pgsql:dbname=transitdata;user=transitdata;password=transitdata;host=localhost'); } } if (!$conn) { die('A database error occurred.' . PHP_EOL); } function databaseError($errMsg) { if ($errMsg[1] != '') { die(print_r($errMsg, true)); } } include 'db/route-dao.inc.php';
function isDebug($debugReason = 'other') { global $debugOkay; return in_array($debugReason, $debugOkay, false) && isDebugServer(); }