Added functions that check for valid input. Added functions that return appropriate array with data
This commit is contained in:
parent
a156ee0c84
commit
13d26994f8
1 changed files with 41 additions and 0 deletions
41
libdata.php
41
libdata.php
|
@ -34,4 +34,45 @@ function getRoutesByStop($stopId){
|
|||
return $tmp;
|
||||
}
|
||||
|
||||
function isValidRoute($id){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['id'] == $id){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isValidLine($line){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['line'] == $line){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getRouteInfo($id){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['id'] == $id){
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getStopInfo($id){
|
||||
global $stops;
|
||||
foreach ($stops as $stop){
|
||||
if ($stop['id'] == $id){
|
||||
return $stop;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
Reference in a new issue