summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xincludes/inc_streaminfo.php6
-rwxr-xr-xincludes/inc_vdr.php37
-rwxr-xr-xincludes/include.php15
3 files changed, 49 insertions, 9 deletions
diff --git a/includes/inc_streaminfo.php b/includes/inc_streaminfo.php
index 5342573..576bd5d 100755
--- a/includes/inc_streaminfo.php
+++ b/includes/inc_streaminfo.php
@@ -28,11 +28,15 @@ function writeinfostream($type=0, $name="", $title="", $desc="", $mode="", $cate
function readinfostream()
{
+
+ if (!file_exists("ram/streaminfo"))
+ return array(0, "", "", "", "");
+
$infofile = fopen("ram/streaminfo", 'r');
if (!$infofile)
return array(0, "", "", "", "");
- while ($line = fgets($infofile, 1024))
+ while ($line = fgets($infofile, 1024))
{
if (!strncmp($line, "type=", strlen("type=")))
$type = substr($line, strlen("type="), -1);
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] == ":")
diff --git a/includes/include.php b/includes/include.php
index 1678b6d..5324609 100755
--- a/includes/include.php
+++ b/includes/include.php
@@ -20,13 +20,16 @@ function selectpage()
$subcmd = "";
// Get segmenter PID
- $pidfile = fopen('ram/streamsegmenterpid', 'r');
- if ($pidfile)
+ if (file_exists("ram/streamsegmenterpid"))
{
- $pid = fgets($pidfile);
- $pid = substr($pid, 0, -1);
- $subcmd = "kill " .$pid ." ; ";
- fclose($pidfile);
+ $pidfile = fopen('ram/streamsegmenterpid', 'r');
+ if ($pidfile)
+ {
+ $pid = fgets($pidfile);
+ $pid = substr($pid, 0, -1);
+ $subcmd = "kill " .$pid ." ; ";
+ fclose($pidfile);
+ }
}
$cmd= $subcmd ."rm ram/stream*";