Exemplo n.º 1
0
/**
 * Main
 * @return int Program exit code
 */
function main()
{
    logMessage("VPN Connection at ", date("Y-m-d H:i:s"));
    logMessage("System arguments:\n", getArgumentsDump($_SERVER['argv']));
    // Load in the routes.json config
    $routes = getRoutes();
    if (!$routes) {
        return 1;
    }
    $remoteIp = $_SERVER['argv'][5];
    $remoteIpConfigs = expectObjectGetArray($routes['remotes'], "Invalid remotes value in routes.json");
    // If we have a list of networks to send to this remote IP, set them
    if (isset($remoteIpConfigs[$remoteIp])) {
        logMessage("Configuring routes for {$remoteIp}");
        setRoutes($remoteIpConfigs[$remoteIp]);
    } else {
        // this remote IP is not known by the config
        logMessage("Notice: No routes configured for remote {$remoteIp}");
    }
    return 0;
}
Exemplo n.º 2
0
        zoom: 12,
        mapTypeControlOptions: {
            mapTypeIds: [google.maps.MapTypeId.TERRAIN, 'map_style'],
            position: google.maps.ControlPosition.BOTTOM_CENTER
        }
    };
    var map = new google.maps.Map(document.getElementById("map-canvas"),
        mapOptions);

    <?php 
$coordsJson = getJsonContents($baseURL . '/json/routeCoords.json');
//get the route coordinates and create latlng objects in javascript
prepRoutes($coordsJson);
drawRoutes($coordsJson);
drawRouteInfoBubbles($coordsJson);
setRoutes($coordsJson);
placeMapMarkers($pageId, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
function prepRoutes($coordsJson)
{
    $coordsJS = '';
    foreach ($coordsJson['routes'] as $route) {
        $count = 0;
        $coordsJS .= "\r\n";
        $coordsJS .= 'var ' . strtolower($route['class']) . 'TripCoords = [';
        $coordsJS .= "\r\n";
        foreach ($route['coords'] as $coords) {
            $count++;
            $coordsJS .= 'new google.maps.LatLng(' . $coords['lat'] . ',' . $coords['lng'] . ')';
            if ($count < count($route['coords'])) {
                $coordsJS .= ',';
                $coordsJS .= "\r\n";