diff options
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/inc_home.php | 51 | ||||
-rwxr-xr-x | includes/inc_media.php | 62 | ||||
-rwxr-xr-x | includes/inc_stream.php | 63 | ||||
-rwxr-xr-x | includes/inc_streaminfo.php | 10 | ||||
-rwxr-xr-x | includes/include.php | 8 |
5 files changed, 113 insertions, 81 deletions
diff --git a/includes/inc_home.php b/includes/inc_home.php index 4996969..9515860 100755 --- a/includes/inc_home.php +++ b/includes/inc_home.php @@ -1,30 +1,47 @@ <?php
-global $vdrenabled, $vdrrecpath;
+global $vdrenabled, $vdrrecpath, $mediasources;
print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n";
print "<div id=\"topbar\" class=\"transparent\">\r\n";
print "<div id=\"title\">iStreamdev</div>\r\n";
print "</div>\r\n";
print "<div id=\"content\">\r\n";
+
+// VDR menus
if ($vdrenabled)
{
- print " <span class=\"graytitle\">VDR</span>\r\n";
- print " <ul class=\"pageitem\">\r\n";
- print " <li class=\"menu\"><a href=\"javascript:sendForm('channels');\"><img src=\"images/pictos/tv.png\" /><span class=\"name\">Channels</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"channels\" id=\"channels\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" /></form>\r\n";
- print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('recordings');\"><img src=\"images/pictos/record.png\" /><span class=\"name\">Recordings</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"recordings\" id=\"recordings\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" /><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$vdrrecpath}\" /></form>\r\n";
- print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('epg');\"><img src=\"images/pictos/epg.png\" /><span class=\"name\">Program Guide</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"epg\" id=\"epg\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"epg\" /></form>\r\n";
- print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('timers');\"><img src=\"images/pictos/timers.png\" /><span class=\"name\">Timers</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"timers\" id=\"timers\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"timers\" /></form>\r\n";
- print " </ul>";
+ print " <span class=\"graytitle\">VDR</span>\r\n";
+ print " <ul class=\"pageitem\">\r\n";
+ print " <li class=\"menu\"><a href=\"javascript:sendForm('channels');\"><img src=\"images/pictos/tv.png\" /><span class=\"name\">Channels</span><span class=\"arrow\"></span></a></li>\r\n";
+ print " <form name=\"channels\" id=\"channels\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" /></form>\r\n";
+ print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('recordings');\"><img src=\"images/pictos/record.png\" /><span class=\"name\">Recordings</span><span class=\"arrow\"></span></a></li>\r\n";
+ print " <form name=\"recordings\" id=\"recordings\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" /><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$vdrrecpath}\" /></form>\r\n";
+ print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('epg');\"><img src=\"images/pictos/epg.png\" /><span class=\"name\">Program Guide</span><span class=\"arrow\"></span></a></li>\r\n";
+ print " <form name=\"epg\" id=\"epg\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"epg\" /></form>\r\n";
+ print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('timers');\"><img src=\"images/pictos/timers.png\" /><span class=\"name\">Timers</span><span class=\"arrow\"></span></a></li>\r\n";
+ print " <form name=\"timers\" id=\"timers\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"timers\" /></form>\r\n";
+ print " </ul>";
+}
+
+// Media menus
+print " <span class=\"graytitle\">MEDIA</span>\r\n";
+print " <ul class=\"pageitem\">\r\n";
+foreach($mediasources as $sname => $spath)
+{
+ print " <li class=\"menu\">\r\n";
+ print " <a class=\"noeffect\" href=\"javascript:sendForm('media {$sname} {$spath}');\">\r\n";
+ print " <img src=\"images/pictos/media.png\" />\r\n";
+ print " <span class=\"name\">{$sname}</span>\r\n";
+ print " <span class=\"arrow\"></span>\r\n";
+ print " </a>\r\n";
+ print " </li>\r\n";
+ print " <form name=\"media\" id=\"media {$sname} {$spath}\" method=\"post\" action=\"index.php\">\r\n";
+ print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\" />\r\n";
+ print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$spath}\" />\r\n";
+ print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"/\" />\r\n";
+ print " </form>\r\n";
}
-print " <span class=\"graytitle\">MEDIA</span>\r\n";
-print " <ul class=\"pageitem\">\r\n";
-print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('media');\"><img src=\"images/pictos/media.png\" /><span class=\"name\">Media Files</span><span class=\"arrow\"></span></a></li>\r\n";
-print " <form name=\"media\" id=\"media\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\" /></form>\r\n";
-print " </ul>";
+print " </ul>";
print "</div>";
?>
diff --git a/includes/inc_media.php b/includes/inc_media.php index f39272a..9da2798 100755 --- a/includes/inc_media.php +++ b/includes/inc_media.php @@ -1,45 +1,41 @@ <?php -global $mediapath, $videotypes, $audiotypes; +global $videotypes, $audiotypes; -$dir = $_REQUEST['dir']; -if ($dir == "") - $dir = $mediapath; +$subdir = $_REQUEST['subdir']; +$mediapath = $_REQUEST['mediapath']; /* Add last slash to dirs */ if ($mediapath[strlen($mediapath)-1] != '/') $mediapath = $mediapath .'/'; - -if ($dir[strlen($dir)-1] != '/') - $dir = $dir .'/'; - -// Get current subdir -$subdir = preg_replace("'" .quotemeta($mediapath) ."'", '', $dir); +if ($subdir[strlen($subdir)-1] != '/') + $subdir = $subdir .'/'; print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; print "<div id=\"topbar\" class=\"transparent\">\r\n"; print "<div id=\"leftnav\">\r\n"; -if ($dir == $mediapath) + +if ($subdir == '/') print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; else - print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; -if ($dir != $mediapath) { + print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; print "<div id=\"rightnav\">\r\n"; print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; } + print "<div id=\"title\">iStreamdev</div>\r\n"; print "</div>\r\n"; print "<div id=\"content\">\r\n"; print " <span class=\"graytitle\">Media</span>\r\n"; print "<br>"; print " <ul class=\"pageitem\">"; -print " <li class=\"textbox\"><span class=\"header\">Current path:</span><p>/{$subdir}</p></li>"; +print " <li class=\"textbox\"><span class=\"header\">Current path:</span><p>{$subdir}</p></li>"; -$dir_handle = @opendir($dir); +$dir_handle = @opendir($mediapath .$subdir); if (!$dir_handle) { - print "Unable to open $dir"; + print "Unable to open $mediapath .$subdir"; } else while ($medianame = readdir($dir_handle)) { @@ -47,16 +43,9 @@ else while ($medianame = readdir($dir_handle)) continue; $medianame_array[] = $medianame; - //} } -//closedir? -// -if ($medianame_array[0] == NULL) -{ - //do nothing -} -else +if ($medianame_array[0]) { // Alphabetical sorting sort($medianame_array); @@ -66,12 +55,13 @@ else $medianame2=addslashes($value); // Directories - if (is_dir($dir ."/" .$value)) + if (is_dir($mediapath .$subdir .$value)) { print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><span class=\"name\">$value</span><span class=\"arrow\"></span></a></li>\r\n"; print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>"; - print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}{$value}/\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>"; + print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />"; + print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}{$value}\" />\r\n"; print "</form>\r\n"; } else @@ -86,24 +76,30 @@ else { print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><img src=\"images/pictos/video.png\" /><span class=\"name\">$value</span><span class=\"arrow\"></span></a></li>\r\n"; print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=3 />"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}{$value}\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; + print " <input name=\"type\" type=\"hidden\" id=\"type\" value=3 />"; + print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />"; + print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; + print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$mediapath}{$subdir}{$value}\" />"; print "</form>\r\n"; } else if ( preg_match("'" .$fileext ." '", $audiotypes) || preg_match("'" .$fileext ." $'", $audiotypes) ) { - print "<li class=\"menu\"><a href=\"streammusic.php?dir={$dir}&file={$value}\"><img src=\"images/pictos/audio.png\" /><span class=\"name\">$value</span><span class=\"arrow\"></span></a></li>\r\n"; + print "<li class=\"menu\"><a href=\"streammusic.php?dir={$mediapath}{$subdir}&file={$value}\"><img src=\"images/pictos/audio.png\" /><span class=\"name\">$value</span><span class=\"arrow\"></span></a></li>\r\n"; } } } } -$updir = dirname($dir); +$upsubdir = dirname($subdir); -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$updir}/\" /></form>\r\n"; +print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">\r\n"; +print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>\r\n"; +print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; +print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$upsubdir}\" />\r\n"; +print "</form>\r\n"; if ($dir_handle) closedir($dir_handle); diff --git a/includes/inc_stream.php b/includes/inc_stream.php index 0150797..ff15d51 100755 --- a/includes/inc_stream.php +++ b/includes/inc_stream.php @@ -6,7 +6,7 @@ global $vdrstreamdev, $quality; if (infostreamexist()) { // Get current stream info - list($type, $realname, $title, $desc, $mode, $category, $url) = readinfostream(); + list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream(); print "<body onorientationchange=\"updateOrientation();\" onload=\"ajax();\">\r\n"; @@ -58,16 +58,19 @@ if (infostreamexist()) print " </div>\r\n"; print " <form name=\"stopstream\" id=\"stopstream\" method=\"post\" action=\"index.php\">"; - print " <input name =\"action\" type=\"hidden\" id=\"action\" value=\"stopstream\" />"; - print " <input name =\"actionafterstop\" type=\"hidden\" id=\"actionafterstop\" value=\"stream\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stopstream\" />"; + print " <input name=\"actionafterstop\" type=\"hidden\" id=\"actionafterstop\" value=\"stream\" />"; print " <input name=\"type\" type=\"hidden\" id=\"type\" value={$type} />"; switch ($type) { case 1: print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />"; break; - case 2: - case 3: + case 3: + print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; + print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; + // NO BREAK + case 2: print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$url}\" />"; break; @@ -166,48 +169,56 @@ else foreach ($quality as $qname => $qparams) { - print " <form name=\"{$qname}\" id=\"{$qname}\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name =\"action\" type=\"hidden\" id=\"action\" value=\"startstream\" />\r\n"; - print " <input name =\"type\" type=\"hidden\" id=\"type\" value={$type} />\r\n"; - print " <input name =\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />\r\n"; - print " <input name =\"title\" type=\"hidden\" id=\"title\" value=\"{$title}\" />\r\n"; - print " <input name =\"desc\" type=\"hidden\" id=\"desc\" value=\"{$desc}\" />\r\n"; - print " <input name =\"qname\" type=\"hidden\" id=\"qname\" value=\"{$qname}\" />\r\n"; - print " <input name =\"qparams\" type=\"hidden\" id=\"qparams\" value=\"{$qparams}\" />\r\n"; - print " <input name =\"category\" type=\"hidden\" id=\"category\" value=\"{$category}\" />\r\n"; + print " <form name=\"{$qname}\" id=\"{$qname}\" method=\"post\" action=\"index.php\">\r\n"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"startstream\" />\r\n"; + print " <input name=\"type\" type=\"hidden\" id=\"type\" value={$type} />\r\n"; + print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />\r\n"; + print " <input name=\"title\" type=\"hidden\" id=\"title\" value=\"{$title}\" />\r\n"; + print " <input name=\"desc\" type=\"hidden\" id=\"desc\" value=\"{$desc}\" />\r\n"; + print " <input name=\"qname\" type=\"hidden\" id=\"qname\" value=\"{$qname}\" />\r\n"; + print " <input name=\"qparams\" type=\"hidden\" id=\"qparams\" value=\"{$qparams}\" />\r\n"; + print " <input name=\"category\" type=\"hidden\" id=\"category\" value=\"{$category}\" />\r\n"; switch ($type) { case 1: - print " <input name =\"url\" type=\"hidden\" id=\"url\" value=\"{$vdrstreamdev}{$channum}\" />\r\n"; + print " <input name=\"url\" type=\"hidden\" id=\"url\" value=\"{$vdrstreamdev}{$channum}\" />\r\n"; break; - case 2: case 3: - print " <input name =\"url\" type=\"hidden\" id=\"url\" value=\"{$name}\" />\r\n"; + $mediapath = $_REQUEST['mediapath']; + $subdir = $_REQUEST['subdir']; + print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; + print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; + // NO BREAK + case 2: + print " <input name=\"url\" type=\"hidden\" id=\"url\" value=\"{$name}\" />\r\n"; break; } - print " </form>"; + print " </form>"; } - print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">"; + print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">"; switch ($type) { case 1: - print " <input name =\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\" />"; - print " <input name =\"cat\"type=\"hidden\" id=\"cat\" value=\"{$category}\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\" />"; + print " <input name=\"cat\"type=\"hidden\" id=\"cat\" value=\"{$category}\" />"; break; default: case 2: $dir = dirname($name); - print " <input name =\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" />"; - print " <input name =\"dir\"type=\"hidden\" id=\"dir\" value=\"{$dir}\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" />"; + print " <input name=\"dir\"type=\"hidden\" id=\"dir\" value=\"{$dir}\" />"; break; case 3: + $mediapath = $_REQUEST['mediapath']; + $subdir = $_REQUEST['subdir']; $dir = dirname($name); - print " <input name =\"action\" type=\"hidden\" id=\"action\" value=\"media\" />"; - print " <input name =\"dir\"type=\"hidden\" id=\"dir\" value=\"{$dir}\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\" />"; + print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; + print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; break; } - print " </form>\r\n"; + print " </form>\r\n"; } diff --git a/includes/inc_streaminfo.php b/includes/inc_streaminfo.php index a45920c..5342573 100755 --- a/includes/inc_streaminfo.php +++ b/includes/inc_streaminfo.php @@ -8,7 +8,7 @@ 3 : Media */ -function writeinfostream($type=0, $name="", $title="", $desc="", $mode="", $category="", $url="") +function writeinfostream($type=0, $name="", $title="", $desc="", $mode="", $category="", $url="", $mediapath="", $subdir="") { $infofile = fopen("ram/streaminfo", 'w'); @@ -19,6 +19,8 @@ function writeinfostream($type=0, $name="", $title="", $desc="", $mode="", $cate fwrite($infofile, "mode=" .$mode ."\n"); fwrite($infofile, "category=" .$category ."\n"); fwrite($infofile, "url=" .$url ."\n"); + fwrite($infofile, "mediapath=" .$mediapath ."\n"); + fwrite($infofile, "subdir=" .$subdir ."\n"); fclose($infofile); } @@ -46,11 +48,15 @@ function readinfostream() $category = substr($line, strlen("category="), -1); else if (!strncmp($line, "url=", strlen("url="))) $url = substr($line, strlen("url="), -1); + else if (!strncmp($line, "mediapath=", strlen("mediapath="))) + $mediapath = substr($line, strlen("mediapath="), -1); + else if (!strncmp($line, "subdir=", strlen("subdir="))) + $subdir = substr($line, strlen("subdir="), -1); } fclose($infofile); - return array($type, $name, $title, $desc, $mode, $category, $url); + return array($type, $name, $title, $desc, $mode, $category, $url, $mediapath, $subdir); } function infostreamexist() diff --git a/includes/include.php b/includes/include.php index 2bf7aa8..5985ffa 100755 --- a/includes/include.php +++ b/includes/include.php @@ -74,7 +74,9 @@ function selectpage() $qparams = $_REQUEST['qparams']; $category = $_REQUEST['category']; $url = $_REQUEST['url']; - start_stream($type, $name, $title, $desc, $qname, $qparams, $category, $url); + $mediapath = $_REQUEST['mediapath']; + $subdir = $_REQUEST['subdir']; + start_stream($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir); break; default: gen_home(); @@ -129,7 +131,7 @@ function gen_edit_timer() -function start_stream($type, $name, $title, $desc, $qname, $qparams, $category, $url) +function start_stream($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir) { global $httppath, $ffmpegpath, $segmenterpath; @@ -150,7 +152,7 @@ function start_stream($type, $name, $title, $desc, $qname, $qparams, $category, exec ($cmd); // Write streaminfo - writeinfostream($type, $name, $title, $desc, $qname, $category, $url); + writeinfostream($type, $name, $title, $desc, $qname, $category, $url, $mediapath, $subdir); include('includes/inc_stream.php'); } |