<?php
/* Legacy App that dynamically forwards to LSR app */
require_once "../../config/settings.inc.php";

$ts = isset($_GET["ts"]) ? strtotime($_GET["ts"]) : time();
$ts2 = isset($_GET["ts2"]) ? strtotime($_GET["ts2"]) : $ts;
$wfo = isset($_GET["wfo"]) ? $_GET["wfo"] : "";
$mywfos = isset($_GET["wfos"]) ? $_GET["wfos"] : array();
if (sizeof($mywfos) == 0 && $wfo != "") {
    $mywfos[] = $wfo;
}
$url = sprintf(
    "/lsr/?by=wfo&wfo=%s&sts=%s&ets=%s",
    implode(",", $mywfos),
    date("YmdHi", $ts),
    date("YmdHi", $ts2)
);
header("Location: $url");
