Primo Commit
This commit is contained in:
54
config/getStation.inc.php
Normal file
54
config/getStation.inc.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
// Funzione per caricare il file XML delle radio
|
||||
function loadRadioStations() {
|
||||
$xml = simplexml_load_file('./data/radio.xml');
|
||||
if ($xml === false) {
|
||||
error_log("Errore nel caricamento del file XML: data/radio.xml");
|
||||
return [];
|
||||
}
|
||||
return $xml->station;
|
||||
}
|
||||
|
||||
// Funzione per ottenere una singola stazione radio
|
||||
function getRadioStation($id) {
|
||||
$xml = simplexml_load_file('./data/radio.xml');
|
||||
if ($xml === false) {
|
||||
error_log("Errore nel caricamento del file XML: data/radio.xml");
|
||||
return null;
|
||||
}
|
||||
foreach ($xml->station as $station) {
|
||||
if ((int)$station->id === $id) {
|
||||
return $station;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Funzione per caricare il file XML delle TV
|
||||
function loadTVStations() {
|
||||
$xml = simplexml_load_file('./data/tv.xml');
|
||||
if ($xml === false) {
|
||||
error_log("Errore nel caricamento del file XML: data/tv.xml");
|
||||
return [];
|
||||
}
|
||||
return $xml->station;
|
||||
}
|
||||
|
||||
// Funzione per ottenere una singola stazione TV
|
||||
function getTVStation($id) {
|
||||
$xml = simplexml_load_file('./data/tv.xml');
|
||||
if ($xml === false) {
|
||||
error_log("Errore nel caricamento del file XML: data/tv.xml");
|
||||
return null;
|
||||
}
|
||||
foreach ($xml->station as $station) {
|
||||
if ((int)$station->id === $id) {
|
||||
return $station;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
$changelog = simplexml_load_file("./data/changelog.xml") or die("Errore: Impossibile accedere al file CHANGELOG");
|
||||
$version_app = $changelog->version->number[0];
|
||||
Reference in New Issue
Block a user