diff --git a/assets/icons/close-circle.png b/assets/icons/close-circle.png index 42b54d1..265d8f6 100644 Binary files a/assets/icons/close-circle.png and b/assets/icons/close-circle.png differ diff --git a/error-pages/403.php b/error-pages/403.php new file mode 100644 index 0000000..3334b71 --- /dev/null +++ b/error-pages/403.php @@ -0,0 +1,23 @@ + + + + + Athena - Error 403 + + + + + + + +

You're not allowed to see that!

+ +

Go back to the homepage

+ +

403 - Forbidden

+ + + + diff --git a/error-pages/404.php b/error-pages/404.php new file mode 100644 index 0000000..1f760fc --- /dev/null +++ b/error-pages/404.php @@ -0,0 +1,23 @@ + + + + + Athena - Error 404 + + + + + + + +

Oh no! That page can't be found

+ +

Go back to the homepage

+ +

404 - Not Found

+ + + + diff --git a/error-pages/50x.php b/error-pages/50x.php new file mode 100644 index 0000000..1c6b35a --- /dev/null +++ b/error-pages/50x.php @@ -0,0 +1,23 @@ + + + + + Athena - Server Error + + + + + + + +

Ah, sorry. There's a problem at our end

+ +

Try the homepage

+ +

50x - Server Error

+ + + + diff --git a/help.php b/help.php new file mode 100644 index 0000000..1fe4fef --- /dev/null +++ b/help.php @@ -0,0 +1,34 @@ + + + + + Athena - Report Issue + + + + + + + + + +

Help

+
+

Just type in a three character CRS code or a TIPLOC into the text + box and tap the Lookup button.

+

If you enter a TIPLOC, this will not be verified - if it is + incorrect or unavailable on Tiger, you will be redirected to a + blank board. CRS codes will be verified against a lookup file + before redirecting.

+

Some stations are not on Tiger and these stations are not supported + here either. Notably TfW and Chiltern stations that border the GWR + network. Most GWR Central served stations are now available to + lookup.

+

I am working on a new version that will provide data for every + station in the National Rail database.

+
+ + + + + diff --git a/index.html b/index.html deleted file mode 100644 index 7c3e9f0..0000000 --- a/index.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - Athena - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
-
- -

Quick Links

- - - - - - - - - - -
-
- -

This is an Alpha release and is under testing.

-

Some features may not work and some stations may not be available.

- - - - - - - - - - - - diff --git a/index.php b/index.php new file mode 100644 index 0000000..48bdb04 --- /dev/null +++ b/index.php @@ -0,0 +1,51 @@ + + + + + Athena + + + + + + + + + + + + + +
+ + +
+ + +
+
+ +

Quick Links

+ + + + + + + + + + +
+
+
+

This is an Alpha release and is under testing.

+

Some features may not work and some stations may not be available.

+
+ + + + + + + diff --git a/issue.php b/issue.php new file mode 100644 index 0000000..529a351 --- /dev/null +++ b/issue.php @@ -0,0 +1,85 @@ + + + + + Athena - Report Issue + + + + + setTimeout(function(){window.location.href = '/submit-done.php';}, 100);"; + }; + ?> + + + + + + + +

Please help us fix your issue

+ +

Give as much detail as possible so we can try to fix the problem.

+ +
" method="post"> + Subject: +
+ +
+
+ Details: +
+ +
+
+
+
+

+ On submission of this form, your browsers User Agent string will be + collected alongside the information you provide above and will be + posted to the + issue tracker. +

+
+
+ + Your user agent is: + +
+ +
+
+
+ +
+ + + + + + + diff --git a/scripts/nav.js b/js/nav.js similarity index 100% rename from scripts/nav.js rename to js/nav.js diff --git a/scripts/sw.js b/js/sw.js similarity index 100% rename from scripts/sw.js rename to js/sw.js diff --git a/scripts/tiploc-finder.js b/js/tiploc-finder.js similarity index 65% rename from scripts/tiploc-finder.js rename to js/tiploc-finder.js index 68b1a56..edbcbfa 100644 --- a/scripts/tiploc-finder.js +++ b/js/tiploc-finder.js @@ -1,7 +1,7 @@ const url = "https://tiger.worldline.global/"; const view = "/staff;scrollbar=true"; -console.group("Athena - v0.2.1-alpha") +console.group("Athena - Departure Boards") console.info("Initialising"); @@ -88,38 +88,3 @@ function gotoInfoBoard(station) { console.groupEnd(); return 0; } - -/*This function provides the Lookup TIPLOC from CRS function from the menu*/ -function tiplocFinder() { - console.group("Athena: function: tiplocFinder()"); - let crs_to_find = document.getElementById("lookup-tiploc").value; - console.info("You are trying to lookup the TIPLOC for:" + crs_to_find.toUpperCase()); - console.info("Checking if CRS code exists in look up data"); - let hasKey = dataGlobal.hasOwnProperty(crs_to_find); - if (hasKey) { //If key exists then log and continue - console.info(crs_to_find.toUpperCase() + " does exist in lookup file"); - } else { //If key does not exist then stop further processing - console.warn(crs_to_find.toUpperCase() + "does not exist in lookup file"); - console.error(crs_to_find.toUpperCase() + " is an incorrect code or not supported."); - alert(crs_to_find.toUpperCase() + " is not a valid or supported CRS, " + - "please see the help section for more information"); - console.groupEnd(); - return 0; - } - let crs_obj = dataGlobal[crs_to_find]; - let name = crs_obj['name'].toUpperCase(); - let crs = crs_to_find.toUpperCase(); - let stanme = crs_obj['stanme'].toUpperCase(); - let stanox = crs_obj['stanox']; - let tiploc = crs_obj['tiploc']; - console.info("Found Data for " + crs +": Name: " + name + ", STANME: " + stanme + - ", STANOX: " + stanox + ", TIPLOC: " + tiploc); - console.warn("Attempt writing to DOM, feature incomplete"); - document.getElementById("resultCRS").innerHTML = "CRS: " + crs_to_find.toUpperCase(); - document.getElementById("resultTIPLOC").innerHTML = "TIPLOC: " + tiploc.toUpperCase(); - document.getElementById("resultSTANME").innerHTML = "STANME: " + stanme.toUpperCase(); - document.getElementById("resultName").innerHTML = "Name: " + name.toUpperCase(); - document.getElementById("resultSTANOX").innerHTML = "STANOX: " + stanox; - console.info("Writing to DOM Complete") - console.groupEnd(); -} diff --git a/page-blocks/footer.php b/page-blocks/footer.php new file mode 100644 index 0000000..df5398d --- /dev/null +++ b/page-blocks/footer.php @@ -0,0 +1,5 @@ +"; +echo "

Created by Fred Boniface - v$athenaVersion

"; +echo ""; diff --git a/page-blocks/headers.php b/page-blocks/headers.php new file mode 100644 index 0000000..6f0a09f --- /dev/null +++ b/page-blocks/headers.php @@ -0,0 +1,10 @@ +'; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; diff --git a/page-blocks/nav-menu.php b/page-blocks/nav-menu.php new file mode 100644 index 0000000..7ec96f1 --- /dev/null +++ b/page-blocks/nav-menu.php @@ -0,0 +1,12 @@ +'; + +echo ''; +echo ''; diff --git a/page-blocks/title-image.php b/page-blocks/title-image.php new file mode 100644 index 0000000..6b8d5b3 --- /dev/null +++ b/page-blocks/title-image.php @@ -0,0 +1,3 @@ +'; diff --git a/php/LDB-Tests/example.php b/php/LDB-Tests/example.php new file mode 100644 index 0000000..30e423a --- /dev/null +++ b/php/LDB-Tests/example.php @@ -0,0 +1,8 @@ + GetDepartureBoardByCRS(10,"BRI",date("H:i:s",time()),120,"","","","","True"); + header("Content-Type: text/plain"); + print_r($response); +?> diff --git a/php/LDB-Tests/test.php b/php/LDB-Tests/test.php new file mode 100755 index 0000000..4e1b63b --- /dev/null +++ b/php/LDB-Tests/test.php @@ -0,0 +1,3 @@ + diff --git a/php/openLDBSVWS.php b/php/openLDBSVWS.php new file mode 100644 index 0000000..66d6dc6 --- /dev/null +++ b/php/openLDBSVWS.php @@ -0,0 +1,341 @@ + + + + + + + + + '; + + function __construct($accessToken,$trace=FALSE) + { + $this->accessToken = $accessToken; + + $this->trace = $trace; + + $soapOptions = array("trace"=>$this->trace,"soap_version"=>SOAP_1_2,"features"=>SOAP_SINGLE_ELEMENT_ARRAYS); + + if (extension_loaded("zlib")) $soapOptions["compression"] = SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP; + + $this->soapClient = new SoapClient("data:text/plain;base64,".base64_encode($this->wsdl),$soapOptions); + + $soapVar = new SoapVar(array("ns2:TokenValue"=>$this->accessToken),SOAP_ENC_OBJECT); + + $soapHeader = new SoapHeader("http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes","AccessToken",$soapVar,FALSE); + + $this->soapClient->__setSoapHeaders($soapHeader); + } + + private function call($method,$params) + { + try + { + $response = $this->soapClient->$method($params); + } + catch(SoapFault $soapFault) + { + if ($this->trace) + { + $traceOutput["soapFaultMessage"] = $soapFault->getMessage(); + + $traceOutput["soapClientRequest"] = str_replace($this->accessToken,"",$this->soapClient->__getLastRequest()); + + $traceOutput["soapClientResponse"] = $this->soapClient->__getLastResponse(); + + print_r($traceOutput); + } + } + + return (isset($response)?$response:FALSE); + } + + function GetBoardByCRS($method,$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices) + { + $params = array(); + + if ($numRows) $params["numRows"] = $numRows; + + if ($crs) $params["crs"] = $crs; + + if ($time) $params["time"] = $time; + + if ($timeWindow) $params["timeWindow"] = $timeWindow; + + if ($filtercrs) $params["filtercrs"] = $filtercrs; + + if ($filterType) $params["filterType"] = $filterType; + + if ($filterTOC) $params["filterTOC"] = $filterTOC; + + if ($services) $params["services"] = $services; + + if ($getNonPassengerServices) $params["getNonPassengerServices"] = $getNonPassengerServices; + + return $this->call($method,$params); + } + + function GetArrivalDepartureBoardByCRS($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByCRS("GetArrivalDepartureBoardByCRS",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetArrivalBoardByCRS($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByCRS("GetArrivalBoardByCRS",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetDepartureBoardByCRS($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByCRS("GetDepartureBoardByCRS",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetArrDepBoardWithDetails($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByCRS("GetArrDepBoardWithDetails",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetArrBoardWithDetails($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByCRS("GetArrBoardWithDetails",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetDepBoardWithDetails($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByCRS("GetDepBoardWithDetails",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetBoardByTIPLOC($method,$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices) + { + $params = array(); + + if ($numRows) $params["numRows"] = $numRows; + + if ($tiploc) $params["tiploc"] = $tiploc; + + if ($time) $params["time"] = $time; + + if ($timeWindow) $params["timeWindow"] = $timeWindow; + + if ($filterTiploc) $params["filterTiploc"] = $filterTiploc; + + if ($filterType) $params["filterType"] = $filterType; + + if ($filterTOC) $params["filterTOC"] = $filterTOC; + + if ($services) $params["services"] = $services; + + if ($getNonPassengerServices) $params["getNonPassengerServices"] = $getNonPassengerServices; + + return $this->call($method,$params); + } + + function GetArrivalDepartureBoardByTIPLOC($numRows="",$tiploc="",$time="",$timeWindow="",$filterTiploc="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByTIPLOC("GetArrivalDepartureBoardByTIPLOC",$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetArrivalBoardByTIPLOC($numRows="",$tiploc="",$time="",$timeWindow="",$filterTiploc="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByTIPLOC("GetArrivalBoardByTIPLOC",$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetDepartureBoardByTIPLOC($numRows="",$tiploc="",$time="",$timeWindow="",$filterTiploc="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="") + { + return $this->GetBoardByTIPLOC("GetDepartureBoardByTIPLOC",$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices); + } + + function GetDepartures($method,$crs,$filterList,$time,$timeWindow,$filterTOC,$services) + { + $params = array(); + + if ($crs) $params["crs"] = $crs; + + if ($filterList) $params["filterList"] = $filterList; + + if ($time) $params["time"] = $time; + + if ($timeWindow) $params["timeWindow"] = $timeWindow; + + if ($filterTOC) $params["filterTOC"] = $filterTOC; + + if ($services) $params["services"] = $services; + + return $this->call($method,$params); + } + + function GetNextDepartures($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="") + { + return $this->GetDepartures("GetNextDepartures",$crs,$filterList,$time,$timeWindow,$filterTOC,$services); + } + + function GetFastestDepartures($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="") + { + return $this->GetDepartures("GetFastestDepartures",$crs,$filterList,$time,$timeWindow,$filterTOC,$services); + } + + function GetNextDeparturesWithDetails($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="") + { + return $this->GetDepartures("GetNextDeparturesWithDetails",$crs,$filterList,$time,$timeWindow,$filterTOC,$services); + } + + function GetFastestDeparturesWithDetails($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="") + { + return $this->GetDepartures("GetFastestDeparturesWithDetails",$crs,$filterList,$time,$timeWindow,$filterTOC,$services); + } + + function GetServiceDetailsByRID($rid="") + { + $params = array(); + + if ($rid) $params["rid"] = $rid; + + return $this->call("GetServiceDetailsByRID",$params); + } + + function QueryServices($serviceID="",$sdd="",$filterTime="",$filtercrs="",$tocFilter="") + { + $params = array(); + + if ($serviceID) $params["serviceID"] = $serviceID; + + if ($sdd) $params["sdd"] = $sdd; + + if ($filterTime) $params["filterTime"] = $filterTime; + + if ($filtercrs) $params["filtercrs"] = $filtercrs; + + if ($tocFilter) $params["tocFilter"] = $tocFilter; + + return $this->call("QueryServices",$params); + } + + function GetDisruptionList($CRSList="") + { + $params = array(); + + if ($CRSList) $params["CRSList"] = $CRSList; + + return $this->call("GetDisruptionList",$params); + } + } + + class OpenLDBSVREFWS + { + private $accessToken; + + private $trace; + + private $wsdl = ' + + + + + + + + '; + + function __construct($accessToken,$trace=FALSE) + { + $this->accessToken = $accessToken; + + $this->trace = $trace; + + $soapOptions = array("trace"=>$this->trace,"soap_version"=>SOAP_1_2,"features"=>SOAP_SINGLE_ELEMENT_ARRAYS); + + if (extension_loaded("zlib")) $soapOptions["compression"] = SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP; + + $this->soapClient = new SoapClient("data:text/plain;base64,".base64_encode($this->wsdl),$soapOptions); + + $soapVar = new SoapVar(array("ns2:TokenValue"=>$this->accessToken),SOAP_ENC_OBJECT); + + $soapHeader = new SoapHeader("http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes","AccessToken",$soapVar,FALSE); + + $this->soapClient->__setSoapHeaders($soapHeader); + } + + private function call($method,$params) + { + try + { + $response = $this->soapClient->$method($params); + } + catch(SoapFault $soapFault) + { + if ($this->trace) + { + $traceOutput["soapFaultMessage"] = $soapFault->getMessage(); + + $traceOutput["soapClientRequest"] = str_replace($this->accessToken,"",$this->soapClient->__getLastRequest()); + + $traceOutput["soapClientResponse"] = $this->soapClient->__getLastResponse(); + + print_r($traceOutput); + } + } + + return (isset($response)?$response:FALSE); + } + + function GetReasonCode($reasonCode="") + { + $params = array(); + + if ($reasonCode) $params["reasonCode"] = $reasonCode; + + return $this->call("GetReasonCode",$params); + } + + function GetReasonCodeList() + { + $params = array(); + + return $this->call("GetReasonCodeList",$params); + } + + function GetSourceInstanceNames() + { + $params = array(); + + return $this->call("GetSourceInstanceNames",$params); + } + + function GetTOCList($currentVersion="") + { + $params = array(); + + if ($currentVersion) $params["currentVersion"] = $currentVersion; + + return $this->call("GetTOCList",$params); + } + + function GetStationList($currentVersion="") + { + $params = array(); + + if ($currentVersion) $params["currentVersion"] = $currentVersion; + + return $this->call("GetStationList",$params); + } + } +?> diff --git a/php/submitIssue.php b/php/submitIssue.php new file mode 100644 index 0000000..c73ac58 --- /dev/null +++ b/php/submitIssue.php @@ -0,0 +1,41 @@ + $body, + 'title' => $title + ); + + $preparedData = json_encode($rawData); + + // Prepare CURL + $curlConnection = curl_init('https://git.fjla.uk/api/v1/repos/fred.boniface/athena.fb-infra.uk/issues'); + curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $preparedData); + curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curlConnection, CURLOPT_HTTPHEADER, $httpHeaders); + + // Get response and exit CURL + $response = curl_exec($curlConnection); + curl_close($curlConnection); + + return $response; +} + +function cleanInput($data) { + $data = trim($data); + $data = stripslashes($data); + $data = htmlspecialchars($data); + return $data; +} diff --git a/php/version.php b/php/version.php new file mode 100644 index 0000000..7a75c42 --- /dev/null +++ b/php/version.php @@ -0,0 +1,2 @@ + + + + + Sent + + + + + + + + + + + +
+ +

Report Submitted

+ +
+

Thanks for your report or suggestion.

+

You're helping to make Athena better for everyone.

+
+
+

You will be redirected to the homepage in five seconds.

+
+ + + + + + + + +