function getServiceIdDatePair($route_short_name, $service_id, $date) { global $checkRouteAdd; // 1 - 1 mapping $trip_id = $route_short_name . $service_id . '1'; global $language; // processor list($route, $stop_times, $serviceId_date_pair) = RouteFetcher::fetchRouteAndStopTimes($route_short_name, $date, $trip_id, $service_id, $language); if ($serviceId_date_pair == null && $route != null && $stop_times != null) { // Add already for performance // routes.txt if (!isset($checkRouteAdd[$route_short_name])) { addRoute($route); $checkRouteAdd[$route_short_name] = true; } // trips.txt $trip = generateTrip($route_short_name, $service_id, $trip_id); addTrip($trip); // stop_times.txt addStopTimes($stop_times); } return $serviceId_date_pair; }
<?php include 'db-connection.php'; session_start(); if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; switch ($action) { case 'addTrip': addTrip($db); break; case 'deleteTrip': deleteTrip($db); break; case 'addComment': addComment($db); break; case 'updateTrip': updateTrip($db); break; case 'trip_post': tripPost($db); break; case 'addFavTrip': addFavTrip($db); break; case 'deleteFavTrip': deleteFavTrip($db); break; } } function addTrip($db)