A live bird collage card for your Home Assistant dashboard.
fix: un-escape quotes before writing to file
frederik18c51f80d148
diff --git a/homepage/views.php b/homepage/views.phpindex 5a87e4b2..17947ffb 100644--- a/homepage/views.php+++ b/homepage/views.php@@ -197,7 +197,7 @@ if(isset($_GET['view'])){file_put_contents("$file", "$str");if(isset($_GET['species'])){foreach ($_GET['species'] as $selectedOption)- file_put_contents("./scripts/include_species_list.txt", $selectedOption."\n", FILE_APPEND);+ file_put_contents("./scripts/include_species_list.txt", htmlspecialchars_decode($selectedOption, ENT_QUOTES)."\n", FILE_APPEND);}} elseif(isset($_GET['species']) && isset($_GET['del'])){$file = './scripts/include_species_list.txt';@@ -207,6 +207,7 @@ if(isset($_GET['view'])){foreach($_GET['species'] as $selectedOption) {$content = file_get_contents("../BirdNET-Pi/include_species_list.txt");$newcontent = str_replace($selectedOption, "", "$content");+ $newcontent = str_replace(htmlspecialchars_decode($selectedOption, ENT_QUOTES), "", "$newcontent");file_put_contents("./scripts/include_species_list.txt", "$newcontent");}$file = './scripts/include_species_list.txt';@@ -223,7 +224,7 @@ if(isset($_GET['view'])){$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);file_put_contents("$file", "$str");foreach ($_GET['species'] as $selectedOption)- file_put_contents("./scripts/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);+ file_put_contents("./scripts/exclude_species_list.txt", htmlspecialchars_decode($selectedOption, ENT_QUOTES)."\n", FILE_APPEND);} elseif (isset($_GET['species']) && isset($_GET['del'])){$file = './scripts/exclude_species_list.txt';$str = file_get_contents("$file");@@ -232,6 +233,7 @@ if(isset($_GET['view'])){foreach($_GET['species'] as $selectedOption) {$content = file_get_contents("./scripts/exclude_species_list.txt");$newcontent = str_replace($selectedOption, "", "$content");+ $newcontent = str_replace(htmlspecialchars_decode($selectedOption, ENT_QUOTES), "", "$content");file_put_contents("./scripts/exclude_species_list.txt", "$newcontent");}$file = './scripts/exclude_species_list.txt';