Don't die if file tags.lst doesn't exist.

die() cuts the document at the position of the error. We just return an
empty datalist.
This commit is contained in:
tastytea 2021-01-21 22:20:54 +01:00
parent 55ea37eb9b
commit 353a16847f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 6 deletions

View File

@ -292,16 +292,18 @@
<datalist id="list_tags">
<?php
$file = fopen("tags.lst", "r") or die("Unable to open autocompletion file.");
while(!feof($file))
if ($file = fopen("tags.lst", "r"))
{
$tag = rtrim(fgets($file));
if ($tag != "")
while(!feof($file))
{
printf("<option value=\"%s\">\n", $tag);
$tag = rtrim(fgets($file));
if ($tag != "")
{
printf("<option value=\"%s\">\n", $tag);
}
}
fclose($file);
}
fclose($file);
?>
</datalist>
</body>