From c11a6fccfe76152f1bf0e26bbe2af3cf81d91c34 Mon Sep 17 00:00:00 2001 From: TheTroll Date: Fri, 26 Feb 2010 16:40:40 +0100 Subject: Added more check when opening a file --- includes/inc_vdr.php | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'includes/inc_vdr.php') 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 "
  • All channels
  • \r\n"; print "
    \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] == ":") -- cgit v1.2.3