diff --git a/action/importer_emission.php b/action/importer_emission.php index 3302398..4c4f334 100644 --- a/action/importer_emission.php +++ b/action/importer_emission.php @@ -34,10 +34,15 @@ function action_importer_emission_dist($arg = null) { $ogg_size = ""; $mp3_size = ""; try { - $jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json"); - $json = json_decode($jsonContents, true); - if (!$json) { - $erreurs[] = "JSON incorrect : https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json"; + $jsonUrl = "https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json"; + $jsonContents = file_get_contents($jsonUrl); + if ($jsonContents === false) { + $erreurs[] = "Erreur d'accès au fichier JSON :".$jsonUrl; + } else { + $json = json_decode($jsonContents, true); + if (!$json) { + $erreurs[] = "JSON incorrect :".$jsonUrl; + } } } catch (Exception $e) { $erreurs[] = $e->getMessage(); diff --git a/libreavous_fonctions.php b/libreavous_fonctions.php index 0e2159e..0cec66b 100644 --- a/libreavous_fonctions.php +++ b/libreavous_fonctions.php @@ -99,10 +99,15 @@ function libreavous_import_run($id_article) { $ogg_size = ""; $mp3_size = ""; try { - $jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json"); - $json = json_decode($jsonContents, true); - if (!$json) { - $erreurs[] = "JSON incorrect : https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json"; + $jsonUrl = "https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json"; + $jsonContents = file_get_contents($jsonUrl); + if ($jsonContents === false) { + $erreurs[] = "Erreur d'accès au fichier JSON :".$jsonUrl; + } else { + $json = json_decode($jsonContents, true); + if (!$json) { + $erreurs[] = "JSON incorrect :".$jsonUrl; + } } } catch (Exception $e) { $erreurs[] = $e->getMessage();