--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -27,7 +27,7 @@
$url.= $GA_PIXEL . "?";
$url.= "utmac=" . $GA_ACCOUNT;
$url.= "&utmn=" . rand(0, 0x7fffffff);
- $referer = $_SERVER["HTTP_REFERER"];
+ $referer = (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "");
$query = $_SERVER["QUERY_STRING"];
$path = $_SERVER["REQUEST_URI"];
if (empty($referer)) {
@@ -42,7 +42,7 @@
}
function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) {
- global $basePath, $GTFSREnabled;
+ global $basePath, $GTFSREnabled, $stopid, $routeid;
echo '
@@ -52,31 +52,24 @@
';
- $overrides = getServiceOverride();
- if ($overrides['service_id']) {
- if ($overrides['service_id'] == "noservice") {
- echo '
';
- } else {
- echo '
';
- }
- }
- if ($GTFSREnabled) {
- $serviceAlerts = getServiceAlertsAsArray("agency", "0");
+ } else {
+ echo '
';
+ }
+ }
+ $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 "
" . 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']}
+ echo "
{$entity['alert']['header_text']['translation'][0]['text']} "
+ . 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']) . "
+
Warning: {$entity['alert']['description_text']['translation'][0]['text']}
Source ";
}
}
@@ -203,13 +223,43 @@
s.parentNode.insertBefore(ga, s);
})();";
$googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
- echo '
';
+ echo '
';
}
echo "\n