Esempio n. 1
0
function list_stations()
{
    $stations = file_get_contents("./data/stations.txt");
    if ($stations === false) {
        err("stations file unreadable or does not exist", 1201);
    }
    if (!trim($stations)) {
        err("stations file is empty", 1202);
    }
    $stations = explode("\n", trim($stations));
    $ret = array();
    foreach ($stations as $s) {
        $ret[] = get_station($s);
    }
    return $ret;
}
Esempio n. 2
0
function get_template_name($id)
{
    global $db;
    global $schema;
    $select = $db->select();
    $columns['id'] = "stid";
    $columns['name'] = "name";
    $select->from($schema . "station_template", $columns);
    $select->where("stid='" . $id . "'");
    $stmt = $select->query();
    $result = $stmt->fetchAll();
    $insert['name'] = $result[0]['name'];
    $insert['stid'] = $result[0]['id'];
    $insert['status'] = 'ready';
    $insert['request'] = 'done';
    $db->insert($schema . 'station', $insert);
    $lid = $db->lastInsertId($schema . 'station', 'sid');
    $result[0]['id'] = $lid;
    $sql = 'insert into ' . $schema . 'station_variables ("name", "type", "value", "sid", "description", "show", "order" ) select "name", "type", "value", ' . $lid . ', "description", "show", "order" from ' . $schema . 'station_variables_template where "stid"=' . $id . ';';
    $res = $db->fetchAll($sql);
    return get_station($lid);
}
Esempio n. 3
0
<?php

include_once 'common.php';
$parts = explode('/', $_SERVER['QUERY_STRING']);
$callsign = array_shift($parts);
$request = implode('/', $parts);
$station = get_station(['callsign' => $callsign]);
if ($station) {
    // Don't redirect unless needed
    $url = 'http://' . $station['base_url'] . '/' . implode("/", array_map("rawurlencode", explode("/", $request)));
    if (strpos($request, '.xml') !== false || strpos($request, '.pls') !== false || strpos($request, '.m3u') !== false || array_search($request, ['my_uuid', 'heartbeat', 'help', 'stats']) !== false) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        $data = curl_exec($ch);
        $info = curl_getinfo($ch);
        header('Content-Type: ' . $info['content_type']);
        header('X-Forwarded-URL: ' . $url);
        echo $data;
    } else {
        header('Location: ' . $url);
    }
}
Esempio n. 4
0
        $num2f = pg_numfields($res2);
        for ($j = 0; $j < $num2; $j++) {
            $insvals = "";
            for ($z = 0; $z < $num2f; $z++) {
                $insvals .= "'" . pg_result($res2, $j, $z) . "',";
            }
            $insvals = substr($insvals, 0, -1);
            $sql = "INSERT INTO MovableTimeTable VALUES ('{$mov}', {$insvals})";
            echo $sql . "\n";
            //pg_query($sql);
        }
    }
    exit;
}
if ($argv[1] == "get_station") {
    get_station($argv[2]);
    exit;
}
$html = file_get_dom("http://vred.hznet.hr/hzinfo/?category=hzinfo&service=izvr3");
$htmls = explode("\n", $html);
echo sizeof($htmls);
foreach ($htmls as $line) {
    $line = trim($line);
    //echo "$line\n";
    if (strtoupper(substr($line, 0, 8)) == "<OPTION>") {
        $line = trim(substr($line, 8));
        $stationname = trim(recode("windows-1250..UTF-8", $line));
        echo $stationname . "\n";
        $statid = get_station_id($stationname);
        if ($statid == -1) {
            $statid = create_station($stationname);
Esempio n. 5
0
File: modify.php Progetto: EQ4/DRR
    } else {
        $_POST['active'] = 1;
        $res = add_station($_POST);
    }
    $dir = dirname($_SERVER['REQUEST_URI']);
    if (!empty($dir) && strlen($dir) > 2) {
        $dir .= '/';
    } else {
        $dir = 'http://indycast.net/';
    }
    header('Location: /admin.php');
    exit(0);
}
$station = false;
if (!empty($_GET['id'])) {
    $station = get_station(['id' => $_GET['id']]);
}
if (!$station) {
    $station = [];
    echo '<title>new station | indycast</title>';
} else {
    echo '<title>' . $station['callsign'] . ' modify | indycast</title>';
}
?>
<link href='http://fonts.googleapis.com/css?family=Lora' rel='stylesheet' type='text/css'>
<style>
  body { margin: 2em }
  * { font-family: 'Lora', serif; }
form { display: inline-block }
form > * { padding: 0.5em }
form > :nth-child(2n) { background: #ddd }