php-integration #21

Closed
fred.boniface wants to merge 146 commits from php-integration into main
22 changed files with 776 additions and 176 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 7.2 KiB

23
error-pages/403.php Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<?php
include '../page-blocks/headers.php';
?>
<title>Athena - Error 403</title>
</head>
<body>
<!-- Main Content Begins -->
<?php require "../page-blocks/title-image.php";?>
<h1>You're not allowed to see that!</h1>
<p><a class="actionbutton" href="/">Go back to the homepage</a></p>
<h3>403 - Forbidden</h3>
</body>
</html>

23
error-pages/404.php Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<?php
include '../page-blocks/headers.php';
?>
<title>Athena - Error 404</title>
</head>
<body>
<!-- Main Content Begins -->
<?php include "../page-blocks/title-image.php";?>
<h1>Oh no! That page can't be found</h1>
<p><a class="actionbutton" href="/">Go back to the homepage</a></p>
<h3>404 - Not Found</h3>
</body>
</html>

23
error-pages/50x.php Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<?php
include '../page-blocks/headers.php';
?>
<title>Athena - Server Error</title>
</head>
<body>
<!-- Main Content Begins -->
<?php require "../page-blocks/title-image.php";?>
<h1>Ah, sorry. There's a problem at our end</h1>
<p><a class="actionbutton" href="/">Try the homepage</a></p>
<h3>50x - Server Error</h3>
</body>
</html>

34
help.php Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<?php include './page-blocks/headers.php';?>
<title>Athena - Report Issue</title>
</head>
<body>
<!-- Popup Menu -->
<?php require "./page-blocks/nav-menu.php";?>
<!-- Main Content Begins -->
<?php require "./page-blocks/title-image.php";?>
<h2>Help</h2>
<div class="text-description">
<p>Just type in a three character CRS code or a TIPLOC into the text
box and tap the Lookup button.</p>
<p>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.</p>
<p>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.</p>
<p>I am working on a new version that will provide data for every
station in the National Rail database.</p>
</div>
<!-- Footer -->
<?php include './page-blocks/footer.php';?>
</body>
</html>

View File

@ -1,107 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Athena</title>
<meta charset="UTF-8"/>
<meta name="description" content="Athena - Quick links to live train departures for traincrew."/>
<meta name="viewport" content="width=device-width, initial=scale=1.0">
<meta name="application-name" content="Athena">
<meta name="author" content="Frederick Boniface">
<link rel="stylesheet" type="text/css" href="./styles/style.css"/>
<link rel="icon" type="image/png" href="./assets/icons/favicon.ico"/>
<link rel="manifest" type="application/json" href="./manifest.json"/>
<script src="./scripts/tiploc-finder.js"></script>
<script src="./scripts/nav.js"></script>
</head>
<body>
<!-- Popup Menu -->
<div id="menu-button" class="menu-button">
<img onclick="openMenu()" src="./assets/icons/menu.png"></img>
</div>
<div id="menu" class="menu">
<button class="menuitem" onclick="openAboutPopup(),closeMenu()">Help</button>
<button class="menuitem" onclick="openTiplocPopup(),closeMenu()">Code Lookup</button>
<img onclick="closeMenu()" class="popup-close" src="./assets/icons/close-circle.png"></img>
</div>
<!-- Main Content Begins -->
<img class="titleimg" src="./assets/title/title.webp"></img>
<br>
<input class="lookup-box" type="text" id="crs-lookup" name="crs-lookup" placeholder="Enter CRS/TIPLOC"/>
<br>
<button class="lookup-button" onclick="getTextEntry()">Lookup Departure Board</button>
<br>
<br>
<h2>Quick Links</h2>
<button class="quicklink" onclick="gotoInfoBoard('bathspa')">BTH</button>
<button class="quicklink" onclick="gotoInfoBoard('brstltm')">BRI</button>
<button class="quicklink" onclick="gotoInfoBoard('brstpwy')">BPW</button>
<button class="quicklink" onclick="gotoInfoBoard('crdfcen')">CDF</button>
<button class="quicklink" onclick="gotoInfoBoard('gloster')">GCR</button>
<button class="quicklink" onclick="gotoInfoBoard('oldfldp')">OLF</button>
<button class="quicklink" onclick="gotoInfoBoard('soton')">SOU</button>
<button class="quicklink" onclick="gotoInfoBoard('wstbryw')">WSB</button>
<button class="quicklink" onclick="gotoInfoBoard('wsmare')">WSM</button>
<br>
<br>
<p>This is an Alpha release and is under testing.</p>
<p>Some features may not work and some stations may not be available.</p>
<!-- Popup Boxes (Usually Hidden with CSS) -->
<div id="popup-about" class="popup-info">
<img onclick="closeAboutPopup()" class="popup-close" src="./assets/icons/close-circle.png"></img>
<h2>Help</h2>
<p>Just type in a three character CRS code or a TIPLOC into the text
box and tap the Lookup button.</p>
<p>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.</p>
<p>Use the TIPLOC Lookup option from the menu to look up a TIPLOC from
a given CRS code.</p>
<p>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.</p>
<p>Until there is a more modern public API offering access to Darwin,
I have no interest in supporting any more than simply linking to
the relevent Tiger page.</p>
</div>
<div id="popup-tiploc" class="popup-info">
<img onclick="closeTiplocPopup()" class="popup-close" src="./assets/icons/close-circle.png"></img>
<h2>Code Lookup</h2>
<p hidden>Enter a CRS Code in the textbox and tap Go.</p>
<p hidden>All GWR managed stations can be looked up but others cannot be
gauranteed.</p>
<p>THIS FEATURE IS NOT YET IMPLEMENTED</p>
<input type="text" id="lookup-tiploc" name="lookup-tiploc" placeholder="Enter CRS"/>
<button onclick="tiplocFinder()">Go</button>
<br>
<p id="resultCRS">CRS: </p>
<p id="resultName">Name: </p>
<p id="resultTIPLOC">TIPLOC: </p>
<p id="resultSTANME">STANME: </p>
<p id="resultSTANOX">STANOX: </p>
</div>
<!-- Footer -->
<footer>
<p>Created by Fred Boniface - v0.2.1-alpha</p>
</footer>
</body>
</html>

51
index.php Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<?php include './page-blocks/headers.php';?>
<title>Athena</title>
<script src="/js/tiploc-finder.js" async></script>
</head>
<body>
<!-- Popup Menu -->
<?php require "./page-blocks/nav-menu.php";?>
<!-- Main Content Begins -->
<?php require "./page-blocks/title-image.php";?>
<br>
<input class="lookup-box" type="text" id="crs-lookup" name="crs-lookup" placeholder="Enter CRS/TIPLOC"/>
<br>
<button class="lookup-button" onclick="getTextEntry()">Lookup Departure Board</button>
<br>
<br>
<h2>Quick Links</h2>
<button class="actionbutton" onclick="gotoInfoBoard('bathspa')">BTH</button>
<button class="actionbutton" onclick="gotoInfoBoard('brstltm')">BRI</button>
<button class="actionbutton" onclick="gotoInfoBoard('brstpwy')">BPW</button>
<button class="actionbutton" onclick="gotoInfoBoard('crdfcen')">CDF</button>
<button class="actionbutton" onclick="gotoInfoBoard('gloster')">GCR</button>
<button class="actionbutton" onclick="gotoInfoBoard('oldfldp')">OLF</button>
<button class="actionbutton" onclick="gotoInfoBoard('soton')">SOU</button>
<button class="actionbutton" onclick="gotoInfoBoard('wstbryw')">WSB</button>
<button class="actionbutton" onclick="gotoInfoBoard('wsmare')">WSM</button>
<br>
<br>
<div class="text-description">
<p>This is an Alpha release and is under testing.</p>
<p>Some features may not work and some stations may not be available.</p>
</div>
<!-- Footer -->
<?php include "./page-blocks/footer.php" ?>
</body>
</html>

85
issue.php Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<?php
include './page-blocks/headers.php';
include_once './php/version.php';
?>
<title>Athena - Report Issue</title>
</head>
<body>
<?php
// Imports the functions needed to validate and submit data
require './php/submitIssue.php';
// Set initial values
$title = $detail = "";
$ua_str = $_SERVER["HTTP_USER_AGENT"];
// If the page has been POSTed to then run this:
if ($_SERVER["REQUEST_METHOD"] == "POST" ) {
$title = cleanInput($_POST["subject"]);
$detail = cleanInput($_POST["detail"]);
// Prepare $detail to POST
$body = "Athena Version: " . $athenaVersion . "\n\n" . "User Agent: " . $ua_str . "\n\n Server PHP Version: " . PHP_VERSION . "\n\nUser Comments:\n" . $detail;
// Call POST function
sendInput($title,$body);
// Redirect to submit-done.php
echo "<script>setTimeout(function(){window.location.href = '/submit-done.php';}, 100);</script>";
};
?>
<!-- Popup Menu -->
<?php require "./page-blocks/nav-menu.php";?>
<!-- Main Content Begins -->
<?php require "./page-blocks/title-image.php";?>
<h1>Please help us fix your issue</h1>
<p>Give as much detail as possible so we can try to fix the problem.</p>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<span class="form-info">Subject:</span>
<br>
<input class="form-text-small" type="text" name="subject" placeholder="Subject" value="<?php echo $title;?>">
<br>
<br>
<span class="form-info">Details:</span>
<br>
<textarea class="form-text-large" placeholder="Please give as much detail here as possible" name="detail"><?php echo $detail;?></textarea>
<br>
<br>
<br>
<div class="text-description">
<p>
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 <a class="inlinelink" href="https://git.fjla.uk/fred.boniface/athena.fb-infra.uk/issues?q=&state=open">
issue tracker</a>.
</p>
<br>
<br>
<span class="form-info">
Your user agent is:
</span>
<br>
<?php echo $ua_str; ?>
</div>
<br>
<br>
<input class="actionbutton" type="submit">
</form>
<!-- Footer -->
<?php include "./page-blocks/footer.php" ?>
</body>
</html>

View File

@ -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();
}

5
page-blocks/footer.php Normal file
View File

@ -0,0 +1,5 @@
<?php
include "./php/version.php";
echo "<footer>";
echo "<p>Created by Fred Boniface - v$athenaVersion</p>";
echo "</footer>";

10
page-blocks/headers.php Normal file
View File

@ -0,0 +1,10 @@
<?php
echo '<meta charset="UTF-8"/>';
echo '<meta name="description" content="Athena - Live train departures for traincrew."/>';
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
echo '<meta name="application-name" content="Athena">';
echo '<meta name="author" content="Frederick Boniface">';
echo '<link rel="stylesheet" type="text/css" href="/styles/style.css"/>';
echo '<link rel="icon" type="image/png" href="/assets/icons/favicon.ico"/>';
echo '<link rel="manifest" type="application/json" href="/manifest.json"/>';

12
page-blocks/nav-menu.php Normal file
View File

@ -0,0 +1,12 @@
<?php
echo '<script src="/js/nav.js" async></script>';
echo '<div id="menu-button" class="menu-button">';
echo '<img onclick="openMenu()" src="/assets/icons/menu.png"></img>';
echo '</div>';
echo '<div id="menu" class="menu">';
echo '<a href="/" class="menuitem" onclick="closeMenu()"">Home</a>';
echo '<a href="/issue.php" class="menuitem" onclick="closeMenu()"">Report Issue</a>"';
echo '<a href="/help.php" class="menuitem" onclick="closeMenu()"">Help</a>';
echo '<img class="menu-button" onclick="closeMenu()" class="popup-close" src="/assets/icons/close-circle.png"></img>';
echo '</div>';

View File

@ -0,0 +1,3 @@
<?php
echo '<a href="/"><img class="titleimg" src="/assets/title/title.webp"></img></a>';

View File

@ -0,0 +1,8 @@
<?php
require("./php/openLDBSVWS.php");
date_default_timezone_set("Europe/London");
$OpenLDBSVWS = new OpenLDBSVWS("ACCESS TOKEN");
$response = $OpenLDBSVWS->GetDepartureBoardByCRS(10,"BRI",date("H:i:s",time()),120,"","","","","True");
header("Content-Type: text/plain");
print_r($response);
?>

3
php/LDB-Tests/test.php Executable file
View File

@ -0,0 +1,3 @@
<?php
phpinfo();
?>

341
php/openLDBSVWS.php Normal file
View File

@ -0,0 +1,341 @@
<?php
class OpenLDBSVWS
{
private $accessToken;
private $trace;
private $wsdl = '<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:sv="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/"
targetNamespace="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/">
<wsdl:import
namespace="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/"
location="http://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/rtti_2017-10-01_ldbsv.wsdl"/>
<wsdl:service name="ldbsv">
<wsdl:port name="LDBSVServiceSoap12" binding="sv:LDBSVServiceSoap12">
<soap12:address location="http://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsv12.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>';
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 = '<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:sv="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/"
targetNamespace="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/">
<wsdl:import
namespace="http://thalesgroup.com/RTTI/2015-05-14/ldbsv_ref/"
location="http://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/rtti_2015-05-14_ldbsv_ref.wsdl"/>
<wsdl:service name="ldbsv">
<wsdl:port name="LDBSVRefServiceSoap12" binding="ref:LDBSVRefServiceSoap12">
<soap12:address location="http://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsvref.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>';
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);
}
}
?>

41
php/submitIssue.php Normal file
View File

@ -0,0 +1,41 @@
<?php
function sendInput($title,$body) {
// Get API Key for git.fjla.uk
require '/srv/php-keys/athena/gitea.php';
// Set httpHeaders
$httpHeaders = array(
"accept: application/json",
$giteaKey,
"Content-Type: application/json"
);
// Prepare the request
$rawData = array(
'body' => $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;
}

2
php/version.php Normal file
View File

@ -0,0 +1,2 @@
<?php
$athenaVersion = '0.4.0-alpha';

View File

@ -1,6 +1,6 @@
body {
background-color: #aac4ee;
color: #359aff;
color: #0280e5;
font-family: sans-serif;
text-align: center;
padding-bottom: 60px; /*Footer height*/
@ -11,6 +11,7 @@ body {
padding-top: 50px;
padding-bottom: 50px;
max-width: 500px;
transition: 0.2s;
}
.lookup-box {
@ -21,6 +22,64 @@ body {
margin-bottom: 5px;
font-size: 18px;
text-transform: uppercase;
transition: 0.2s;
}
.form-text-small {
text-align: center;
border: black;
width: 80%;
border-radius: 5px;
padding: 10px;
font-size: 18px;
transition: 0.2s;
}
@media only screen and (min-width: 600px) {
.form-text-small {
width: 50%;
}
}
.form-text-large {
text-align: left;
border: black;
width: 80%;
height: 90px;
border-radius: 5px;
padding: 5px;
font-size: 16px;
transition: 0.2s;
}
@media only screen and (min-width: 600px) {
.form-text-large {
width: 50%;
}
}
.form-info {
color: #0280e5;
font-size: 17px;
font-weight: bolder;
margin-bottom: 4px;
}
.text-description {
display: inline-block;
width: 80%;
color: #0280e5;
padding-top: 5px;
padding-bottom: 5px;
margin-left: auto;
margin-right: auto;
transition: 0.2s;
}
@media only screen and (min-width: 600px) {
.text-description{
width: 50%;
}
}
.lookup-button {
@ -36,19 +95,9 @@ body {
cursor: pointer;
}
a {
display: float;
background-color: #3c78d8;
color: #f6f5f4;
padding: 7px;
border-radius: 5px;
text-decoration: none;
margin-bottom: 10px;
line-height: 3;
}
.quicklink {
.actionbutton {
display: inline-block;
text-decoration: none;
cursor: pointer;
background-color: #3c78d8;
border: none;
@ -59,6 +108,12 @@ a {
font-size: 16px;
}
.inlinelink {
text-decoration: underline;
color: #3c78d8;
cursor: pointer;
}
.menu {
display: none;
background-color: #3c78d8;
@ -80,6 +135,7 @@ a {
.menuitem {
background-color: #2256aa;
text-decoration: none;
color: #f6f5f4;
border: none;
border-radius: 18px;
@ -88,6 +144,8 @@ a {
padding: 3px;
padding-left: 8px;
padding-right: 8px;
margin-left: 10px;
margin-right: 10px;
cursor: pointer;
}
@ -95,26 +153,6 @@ a {
background-color: #112b55;
}
.popup-info {
display: none;
position: absolute;
margin: 0 auto;
left: 0;
right: 0;
top: 20px;
width: 80%;
background-color: rgba(41,106,163,0.9);
color: white;
border-radius: 50px;
padding: 30px;
}
.popup-close {
position: absolute;
right: 30px;
cursor: pointer;
}
footer {
background-color: #7fa7e6;
color: white;

40
submit-done.php Normal file
View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<?php include './page-blocks/headers.php';?>
<title>Sent</title>
</head>
<body>
<!-- Popup Menu -->
<?php require "./page-blocks/nav-menu.php";?>
<!-- Main Content Begins -->
<?php require "./page-blocks/title-image.php";?>
<br>
<h1>Report Submitted</h1>
<div class="text-description">
<p>Thanks for your report or suggestion.</p>
<p>You're helping to make Athena better for everyone.</p>
<br>
<br>
<p>You will be redirected to the homepage in five seconds.</p>
</div>
<script>
setTimeout(function(){
window.location.href = '/';
}, 5000);
</script>
<!-- Footer -->
<?php include "./page-blocks/footer.php" ?>
</body>
</html>