diff options
author | TheTroll <trolldev@gmail.com> | 2010-02-26 16:40:40 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-02-26 16:40:40 +0100 |
commit | c11a6fccfe76152f1bf0e26bbe2af3cf81d91c34 (patch) | |
tree | b398a6e418e8e9f74e2e901f417a4e92bdf71989 /includes/inc_vdr.php | |
parent | d85aa30e9aa6ef1f1f42fb4af54364f6884cfa3a (diff) | |
download | istreamdev-c11a6fccfe76152f1bf0e26bbe2af3cf81d91c34.tar.gz istreamdev-c11a6fccfe76152f1bf0e26bbe2af3cf81d91c34.tar.bz2 |
Added more check when opening a file
Diffstat (limited to 'includes/inc_vdr.php')
-rwxr-xr-x | includes/inc_vdr.php | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php index 1ab233f..d8ebf93 100755 --- a/includes/inc_vdr.php +++ b/includes/inc_vdr.php @@ -170,7 +170,18 @@ function vdrlistcategories() print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('All');\"><span class=\"name\">All channels</span><span class=\"arrow\"></span></a></li>\r\n"; print "<form name=\"All channels\" id=\"All\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\"/><input name=\"cat\" type=\"hidden\" id=\"cat\" value=\"All\" /></form>\r\n"; + if (!file_exists($vdrchannels)) + { + print "Error: channels file not found"; + return; + } + $fp = fopen ($vdrchannels,"r"); + if (!fp) + { + print "Unable to open channels file"; + return; + } while ($line = fgets($fp, 1024)) { // Check if it is a categorie @@ -203,7 +214,18 @@ function vdrlistchannels($category = "NULL") else $cat_found=0; - $fp = fopen ($vdrchannels,"r"); + if (!file_exists($vdrchannels)) + { + print "Error: channels file not found"; + return; + } + + $fp = fopen ($vdrchannels,"r"); + if (!fp) + { + print "Unable to open channels file"; + return; + } while ($line = fgets($fp, 1024)) { if ($cat_found) @@ -265,7 +287,18 @@ function vdrlistchannelsdrop($chansel = "") $chanselected = 0; - $fp = fopen ($vdrchannels,"r"); + if (!file_exists($vdrchannels)) + { + print "Error: channels file not found"; + return; + } + + $fp = fopen ($vdrchannels,"r"); + if (!fp) + { + print "Unable to open channels file"; + return; + } while ($line = fgets($fp, 1024)) { if ($line[0] == ":") |