diff options
author | Alib <aliboba@free.fr> | 2010-03-15 17:56:22 +0100 |
---|---|---|
committer | Alib <aliboba@free.fr> | 2010-03-15 17:56:22 +0100 |
commit | 438912c0c4a4075a5cd74cf9689451c9df4bbe34 (patch) | |
tree | 334e03bbba01b002a34d3cbf81ee7e600ec7bff6 /includes | |
parent | a8012963c23e7e5eaf487ee9e192ae5c4d4ccff2 (diff) | |
download | istreamdev-438912c0c4a4075a5cd74cf9689451c9df4bbe34.tar.gz istreamdev-438912c0c4a4075a5cd74cf9689451c9df4bbe34.tar.bz2 |
New Jquery branch. Initial development version for istreamdev 1.0
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/inc_audio.php | 128 | ||||
-rwxr-xr-x | includes/inc_auth.php | 36 | ||||
-rwxr-xr-x | includes/inc_cat.php | 17 | ||||
-rwxr-xr-x | includes/inc_chan.php | 24 | ||||
-rwxr-xr-x | includes/inc_edittimer.php | 158 | ||||
-rwxr-xr-x | includes/inc_epg.php | 15 | ||||
-rwxr-xr-x | includes/inc_files.php | 172 | ||||
-rwxr-xr-x | includes/inc_home.php | 135 | ||||
-rwxr-xr-x | includes/inc_rec.php | 87 | ||||
-rwxr-xr-x | includes/inc_session.php | 88 | ||||
-rwxr-xr-x | includes/inc_stream.php | 139 | ||||
-rwxr-xr-x | includes/inc_streaminfo.php | 69 | ||||
-rwxr-xr-x | includes/inc_streaming.php | 68 | ||||
-rwxr-xr-x | includes/inc_svdrp.php | 446 | ||||
-rwxr-xr-x | includes/inc_timers.php | 44 | ||||
-rwxr-xr-x | includes/inc_utils.php | 95 | ||||
-rwxr-xr-x | includes/inc_vdr.php | 389 | ||||
-rwxr-xr-x | includes/inc_video.php | 117 | ||||
-rwxr-xr-x | includes/include.php | 137 |
19 files changed, 0 insertions, 2364 deletions
diff --git a/includes/inc_audio.php b/includes/inc_audio.php deleted file mode 100755 index 2960aa5..0000000 --- a/includes/inc_audio.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php - -global $httppath; - -$mediapath = $_REQUEST['mediapath']; -$subdir = $_REQUEST['subdir']; - -/* Add last slash to dirs */ -if ($mediapath[strlen($mediapath)-1] != '/') - $mediapath = $mediapath .'/'; -if ($subdir[strlen($subdir)-1] != '/') - $subdir = $subdir .'/'; - -print "<body class=\"ipodlist\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; - -print "<div id=\"leftnav\">\r\n"; -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"; - 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 " <ul>\r\n"; - -$dir_handle = @opendir($mediapath .$subdir); -if (!$dir_handle) - print "Unable to open $mediapath .$subdir"; -else while ($medianame = readdir($dir_handle)) -{ - // Add only mp3 files and dirs - if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') - continue; - - $type = mediagettype($mediapath .$subdir .$medianame); - if (($type != 2) && ($type != 3)) - continue; - - $medianame_array[] = $medianame; -} - -if ($medianame_array[0]) -{ - // Alphabetical sorting - sort($medianame_array); - - $count = count($medianame_array); - - // Directories - for ($cnt=0; $cnt < $count; $cnt++) - { - if (mediagettype($mediapath .$subdir .$medianame_array[$cnt]) == 3) - { - $medianame2=addslashes($medianame_array[$cnt]); - - print " <li>\r\n"; - print " <a class=\"noeffect\" href=\"javascript:sendForm('dir_$medianame2');\">\r\n"; - print " <span class=\"name\">{$medianame_array[$cnt]}</span><span class=\"time\">></span>\r\n"; - print " </a>\r\n"; - print " </li>\r\n"; - print " <form name=\"dir_{$medianame_array[$cnt]}\" id=\"dir_{$medianame_array[$cnt]}\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"audio\"/>\r\n"; - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}{$medianame_array[$cnt]}\" />\r\n"; - print " </form>\r\n"; - } - } - - - // Music files - $idx = 1; - for ($cnt=0; $cnt < $count; $cnt++) - { - $medianame2=addslashes($medianame_array[$cnt]); - $mediapath2=addslashes($mediapath); - $subdir2=addslashes($subdir); - - // Audio - if (mediagettype($mediapath .$subdir .$medianame_array[$cnt]) == 2) - { - print " <li>\r\n"; - - unset($track); - - for ($cnt2=$cnt; $cnt2<$count; $cnt2++) - { - if (mediagettype($mediapath .$subdir .$medianame_array[$cnt2]) == 2) - $track[$cnt2-$cnt] = $httppath ."playlist/" .addslashes($medianame_array[$cnt2]); - - } - $jsarray = php2js($track); - - print " <a class=\"noeffect\" href=\"javascript:var myarray = new Array({$jsarray});addplayer('{$mediapath2}{$subdir2}','{$medianame2}',myarray);document.player.Play();\">\r\n"; - - // Get song info - list($name, $duration) = mediagetmusicinfo($mediapath .$subdir .$medianame_array[$cnt]); - - print " <span class=\"number\">$idx</span><span class=\"stop\"></span><span class=\"name\">{$name}</span><span class=\"time\">{$duration}</span>\r\n"; - print " </a>\r\n"; - print " </li>\r\n"; - - $idx++; - } - } -} - -print "</div>\r\n"; - -$upsubdir = dirname($subdir); - -print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">\r\n"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"audio\" />\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"; - -print "<div style=\"position:absolute; left:0; top:0\" name=\"div_player\" id=\"div_player\">\r\n"; - -print("</div>"); - -?> - diff --git a/includes/inc_auth.php b/includes/inc_auth.php deleted file mode 100755 index 1545b7c..0000000 --- a/includes/inc_auth.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -global $user, $pass; - -session_start(); - -if (isset($_COOKIE['istream'])) -{ - if(sha1($pass) == $_COOKIE['istream'] ) { - setcookie ("istream", sha1($pass), time()+60*60*24*30); - $authorized = true; - } else { - $authorised = false; - } -} - -# checkup login and password -if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) -{ - if (($user == $_SERVER['PHP_AUTH_USER']) && ($pass == ($_SERVER['PHP_AUTH_PW'])) ) - { - setcookie ("istream", sha1($pass), time()+60*60*24*30); - $authorized = true; - } -} - -# login -if (!$authorized) -{ - header('WWW-Authenticate: Basic Realm="Login please"'); - header('HTTP/1.0 401 Unauthorized'); - echo "Login"; - exit; -} - -?> diff --git a/includes/inc_cat.php b/includes/inc_cat.php deleted file mode 100755 index 0b107d3..0000000 --- a/includes/inc_cat.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\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\">Category</span>\r\n"; -print " <ul class=\"pageitem\">\r\n"; - -vdrlistcategories(); - -print " </ul>"; -print "</div>\r\n"; -?> diff --git a/includes/inc_chan.php b/includes/inc_chan.php deleted file mode 100755 index ff73df6..0000000 --- a/includes/inc_chan.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -$cat = $_REQUEST['cat']; - -$_SESSION['currentcat'] = $cat; - -print "<body class=\"list\" onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; - -print "<div id=\"leftnav\">\r\n"; -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 " <ul><li class=\"title\">$cat</li>\r\n"; - -vdrlistchannels($cat); - -print " </ul>"; -print "</div>\r\n"; -print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" /></form>\r\n"; -?> diff --git a/includes/inc_edittimer.php b/includes/inc_edittimer.php deleted file mode 100755 index 8babf0c..0000000 --- a/includes/inc_edittimer.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -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\">iStream</div>\r\n"; -print "</div>\r\n"; -$timer = $_REQUEST['timer']; -if ($timer == -1) - print "<div id=\"content\"> <span class=\"graytitle\">New Timer</span>\r\n"; -else - print "<div id=\"content\"> <span class=\"graytitle\">Edit Timer</span>\r\n"; - -list($type, $channame, $date, $stime, $etime, $desc) = vdrgettimerinfo($timer); - -// Timer name -print "<form name=\"timer\" id=\"timer\" method=\"post\" action=\"index.php\" onsubmit='return checkform()'>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -if ($type & 0x1) - print " <li class=\"checkbox\"><span class=\"name\">Active</span><input name=\"timer_active\" type=\"checkbox\" checked/></li>\r\n"; -else - print " <li class=\"checkbox\"><span class=\"name\">Active</span><input name=\"timer_active\" type=\"checkbox\"/></li>\r\n"; -print " </ul>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Recording name</span></li>\r\n"; -print " <li class=\"bigfield\">\r\n"; - -if ($timer==-1) -{ -print " <input type=\"text\" placeholder=\"Enter recording name\" name=\"timer_name\" value=\"\" />\r\n"; -} -else -{ -print " <input type=\"text\" placeholder=\"Enter recording name\" name=\"timer_name\" value=\"{$desc}\" />\r\n"; -} -print " </li>\r\n"; -print " </ul>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Channel</span></li>\r\n"; -print " <li class=\"select\">\r\n"; - -// Channel selection -print " <select name=\"timer_chan\">\r\n"; - -vdrlistchannelsdrop($channame); - -print " </select>\r\n"; -print " <span class=\"arrow\"></span>"; -print " </li>\r\n"; -print " </ul>\r\n"; - -// Date selection -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Date</span></li>\r\n"; - -$datearray = explode("-", $date); - -print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:openSelectDate({$datearray[0]},{$datearray[1]},{$datearray[2]})\">\r\n"; - -if ($timer == -1) -{ -print " <span class=\"name\" id=\"layer_date\">Select date</span><span class=\"arrow\"></span></a>"; -} -else -{ -print " <span class=\"name\" id=\"layer_date\">{$date}</span><span class=\"arrow\"></span></a>"; - -} - -print " </li>\r\n"; -print " </ul>\r\n"; - -// Start/End time selection -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Start time</span></li>\r\n"; - -$smin = substr($stime, 0, 2); -$ssec = substr($stime, 2); - -print " <li class=\"menu\">"; -print " <a class=\"noeffect\" href=\"javascript:openSelectTime('layer_starttime',{$smin}, {$ssec})\">\r\n"; - -if ($timer == -1) -{ -print " <span class=\"name\" id=\"layer_starttime\">Select start time</span>"; -} -else -{ -print " <span class=\"name\" id=\"layer_starttime\">{$smin}h{$ssec}</span>"; -} -print " <span class=\"arrow\"></span>"; -print " </a>"; -print " </li>\r\n"; -print " </ul>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">End time</span></li>\r\n"; - -$emin = substr($etime, 0, 2); -$esec = substr($etime, 2); - -print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:openSelectTime('layer_endtime',{$emin},{$esec})\">\r\n"; -if ($timer == -1) -{ -print " <span class=\"name\" id=\"layer_endtime\">Select end time</span><span class=\"arrow\"></span></a></li>\r\n"; -} -else -{ -print " <span class=\"name\" id=\"layer_endtime\">{$emin}h{$esec}</span><span class=\"arrow\"></span></a></li>\r\n"; -} -print " </ul>\r\n"; -print "<input name=\"action\" type=\"hidden\" id=\"action\" value=\"addtimer\"/>\r\n"; - -if ($timer == -1) -{ -print "<input name=\"timer_date\" type=\"hidden\" id=\"timer_date\" value=\"\" />\r\n"; -print "<input name=\"timer_starttime\" type=\"hidden\" id=\"timer_starttime\" value=\"\" />\r\n"; -print "<input name=\"timer_endtime\" type=\"hidden\" id=\"timer_endtime\" value=\"\" />\r\n"; -} -else -{ -print "<input name=\"timer_date\" type=\"hidden\" id=\"timer_date\" value=\"{$date}\" />\r\n"; -print "<input name=\"timer_starttime\" type=\"hidden\" id=\"timer_starttime\" value=\"{$smin}{$ssec}\" />\r\n"; -print "<input name=\"timer_endtime\" type=\"hidden\" id=\"timer_endtime\" value=\"{$emin}{$esec}\" />\r\n"; -} - -print "<input name=\"prevtimer\" type=\"hidden\" id=\"prevtimer\" value=\"{$timer}\" />\r\n"; - -print "<ul class=\"pageitem\">\r\n"; -print "<li class=\"button\">\r\n"; -if ($timer == -1){ - print " <input name=\"Update\" type=\"Submit\" value=\"Create\" /></li>\r\n"; -} -else -{ - print " <input name=\"Update\" type=\"Submit\" value=\"Update\" /></li>\r\n"; -} -print "</ul>\r\n"; -print "</form>\r\n"; - -if ($timer != -1) -{ - print "<form name=\"deltimer\" id=\"deltimer\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"deletetimer\" />\r\n"; - print " <input name=\"timer\" type=\"hidden\" id=\"timer\" value=\"{$timer}\" />\r\n"; - print " <ul class=\"pageitem\">\r\n"; - print " <li class=\"button\">\r\n"; - print " <input name=\"Submit\" type=\"submit\" value=\"Delete\" /></li>\r\n"; - print "</ul>\r\n"; - print "</form>\r\n"; -} - -print "</div>\r\n"; -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"timers\" /></form>\r\n"; - -?> diff --git a/includes/inc_epg.php b/includes/inc_epg.php deleted file mode 100755 index 721cc9f..0000000 --- a/includes/inc_epg.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\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\">Program Guide</span>\r\n"; -print " <ul class=\"pageitem\">"; -print " <li class=\"textbox\"><span class=\"header\">Incoming feature</span"; -print " <p>To do...</p></li>"; -print "</div>\r\n"; -?> - diff --git a/includes/inc_files.php b/includes/inc_files.php deleted file mode 100755 index 60bc4f2..0000000 --- a/includes/inc_files.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php - -$audiotypes='mp3 aac wav '; - -function mediagetinfostream($stream) -{ - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($stream); - - $title = "Media:"; - $info = "Duration: <i>" .sec2hms($fileinfo['playtime_seconds']) ."</i><br>"; - if ($fileinfo['fileformat']) - $info .= "Format: <i>" .$fileinfo['fileformat'] ."</i><br>"; - if ($fileinfo['video']['codec']) - $info .= "Video: <i>" .$fileinfo['video']['codec'] ."</i><br>"; - if ($fileinfo['audio']['codec']) - $info .= "Audio: <i>" .$fileinfo['audio']['codec'] ."</i><br>"; - if ($fileinfo['video']['resolution_x']) - $info .= "Resolution: <i>" .$fileinfo['video']['resolution_x'] ."x" .$fileinfo['video']['resolution_y'] ."</i><br>"; - - return array($title, $info); -} - -function mediagentb($stream, $dest) -{ - global $ffmpegpath; - - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($stream); - - exec("rm " .$dest); - $path = dirname($stream); - - if (file_exists(substr($stream, 0, -4) .".tbn")) - $file = substr($stream, 0, -4) .".tbn"; - else if (file_exists($path ."/poster.jpg")) - $file = $path ."/poster.jpg"; - else if (file_exists($path ."/folder.jpg")) - $file = $path ."/folder.jpg"; - else - $file = ""; - - $resx = 180; - $resy = 100; - - if ($file) - { - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - } - - if ($fileinfo['video']['resolution_y'] && $fileinfo['video']['resolution_x']) - { - if ($fileinfo['video']['resolution_y'] < $fileinfo['video']['resolution_x']) - { - $resx = 180; - $resy = round(($fileinfo['video']['resolution_y'] * 180) / $fileinfo['video']['resolution_x']); - } - else - { - $resx = round (($fileinfo['video']['resolution_x'] * 100) / $fileinfo['video']['resolution_y']); - $resy = 100; - } - } - - if ($file) - exec("cp \"" .$file ."\" ram/stream-tb-tmp.jpg; " .$ffmpegpath ." -y -i ram/stream-tb-tmp.jpg -s " .$resx ."x" .$resy ." " .$dest ." ; rm ram/stream-tb-tmp.jpg"); - else - exec($ffmpegpath ." -y -i \"" .$stream ."\" -an -ss 00:00:05.00 -r 1 -vframes 1 -s " .$resx ."x" .$resy ." -f mjpeg " .$dest); - - if (!file_exists($dest)) - exec('cp logos/nologoMEDIA.png ' .$dest); -} - -function mediagetwidth($file) -{ - - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - - return $fileinfo['video']['resolution_x']; -} - -function mediagettype($file) -{ - global $videotypes, $audiotypes; - - // Get file extension - $fileext = end(explode(".", $file)); - $file = str_replace("\\'", "'", $file); - - if (is_dir($file)) - return 3; - else if (preg_match("$/$", $fileext)) - return 0; - else if (preg_match("/" .$fileext ." /", $videotypes)) - return 1; - else if (preg_match("/" .$fileext ." /", $audiotypes)) - return 2; - else - return 0; -} - -function mediadirhasaudio($dir) -{ - global $audiotypes; - - $audioextarray = explode(' ', $audiotypes); - - foreach ($audioextarray as $num => $audioext) - { - if (glob($dir .'*.' .$audioext)) - return 1; - } - - return 0; -} - -function mediagetmusicinfo($file ="") -{ - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - - $name = $fileinfo['tags']['id3v2']['title'][0]; - if ($name == "") - { - $name = $fileinfo['tags']['id3v1']['title'][0]; - if ($name == "") - { - $name = $fileinfo['filename']; - if ($name == "") - $name = "unknown"; - } - } - - if (!is_utf8($name)) - $name = utf8_encode($name); - - $duration = $fileinfo['playtime_string']; - - return array ($name, $duration); -} - -function generatelogo($type, $name, $dest) -{ - switch ($type) - { - case 1: - $channoslash = preg_replace("$/$", " ", $name); - $logopath = "logos/" .$channoslash .".png"; - if (!file_exists($logopath)) - $logopath = "logos/nologoTV.png"; - exec("cp \"" .$logopath ."\" " .$dest); - break; - case 2: - $channoslash = preg_replace("$/$", " ", $name); - $logopath = "logos/" .$channoslash .".png"; - if (!file_exists($logopath)) - $logopath = "logos/nologoREC.png"; - exec("cp \"" .$logopath ."\" " .$dest); - break; - case 3: - // Generate TB - mediagentb($name, $dest); - break; - } -} - -?> diff --git a/includes/inc_home.php b/includes/inc_home.php deleted file mode 100755 index f38518c..0000000 --- a/includes/inc_home.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php
-
-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";
-
-$sessioncnt = 0;
-
-print " <span class=\"graytitle\">SESSIONS</span>\r\n";
-print " <ul class=\"pageitem\">\r\n";
-
-// Streaming in progress
-$dir_handle = @opendir('ram/');
-if ($dir_handle)
-{
- while ($session = readdir($dir_handle))
- {
- if($session == "." || $session == ".." || $session == 'lost+found')
- continue;
-
- if (!is_dir('ram/' .$session))
- continue;
-
- // Get info
- list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session);
-
- switch ($type)
- {
- case 1:
- $sessionname = "Live: ";
- $picto = "tv";
- break;
- case 2:
- $sessionname = "Rec: ";
- $picto = "record";
- break;
- case 3:
- $sessionname = "Media: ";
- $picto = "media";
- break;
- default:
- continue;
- }
-
- // Check if encoding
- if (file_exists('ram/' .$session .'/segmenter.pid'))
- $sessionname = "*" .$sessionname;
-
- $sessioncnt++;
-
- $sessionname .= $realname;
-
- print " <li class=\"menu\">";
- print " <a href=\"javascript:sendForm('{$session}');\">";
- print " <img src=\"images/pictos/{$picto}.png\" />";
- print " <span class=\"name\">{$sessionname}</span><span class=\"arrow\"></span>";
- print " </a>";
- print " </li>\r\n";
- print " <form name=\"{$session}\" id=\"{$session}\" method=\"post\" action=\"index.php\">";
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"streaming\" />";
- print " <input name=\"session\" type=\"hidden\" id=\"session\" value=\"{$session}\" />";
- print " </form>\r\n";
- }
-
- closedir($dir_handle);
-}
-
-if (!$sessioncnt)
-{
- print " <li class=\"textbox\"><p>none</p></li>\r\n";
- print "</ul>\r\n";
-}
-else
-{
- print "</ul>\r\n";
- print "<form name=\"killall\" id=\"killall\" method=\"post\" action=\"index.php\">\r\n";
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stopallstreamings\" />\r\n";
- print " <ul class=\"pageitem\">\r\n";
- print " <li class=\"button\">\r\n";
- print " <input name=\"Submit\" type=\"submit\" value=\"Delete all sessions\" /></li>\r\n";
- print "</ul>\r\n";
- print "</form>\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>";
-}
-
-// Media menus
-print " <span class=\"graytitle\">MEDIA</span>\r\n";
-print " <ul class=\"pageitem\">\r\n";
-foreach($mediasources as $source)
-{
- $stype = $source[0];
- $sname = $source[1];
- $spath = $source[2];
-
- print " <li class=\"menu\">\r\n";
- print " <a class=\"noeffect\" href=\"javascript:sendForm('media {$sname} {$spath}');\">\r\n";
- if ($stype == 1)
- print " <img src=\"images/pictos/video.png\" />\r\n";
- else
- print " <img src=\"images/pictos/audio.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";
- if ($stype == 1)
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\" />\r\n";
- else
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"audio\" />\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 " </ul>";
-print "</div>";
-?>
diff --git a/includes/inc_rec.php b/includes/inc_rec.php deleted file mode 100755 index 63b757e..0000000 --- a/includes/inc_rec.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php - -global $vdrrecpath; - -$dir = $_REQUEST['dir']; -if ($dir == "") - $dir = $vdrrecpath; - -// Get current subdir -$subdir = preg_replace("'" .quotemeta($vdrrecpath) ."'", '', $dir); - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -if ($dir == $vdrrecpath) - 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 != $vdrrecpath) -{ -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\">Recordings</span>\r\n"; -print "<br>"; -print " <span class=\"graytitle\">" . stripslashes($subdir) . "</span>\r\n"; -print " <ul class=\"pageitem\">"; - -$dir = stripslashes($dir); - -$dir_handle = @opendir($dir); -if (!$dir_handle) -{ - print "Unable to open $dir"; -} -else while ($recname = readdir($dir_handle)) -{ - if($recname == "." || $recname == ".." || $recname == "epg.data" || $recname == 'lost+found') - continue; - - $recname2 = addslashes($recname); - - $date = preg_replace('/-/', '/', substr($recname2, 0, 10)); - $time = preg_replace('/\./', 'h', substr($recname2, 11, 5)); - $recnice = $date .' at ' .$time; - - if (strstr($recname, ".rec") == ".rec") - { - - $date = preg_replace('/-/', '/', substr($recname, 0, 10)); - $time = preg_replace('/\./', 'h', substr($recname, 11, 5)); - $recnice = $date .' at ' .$time; - - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$recname2');\"><span class=\"name\">$recnice</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$recname\" id=\"$recname\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=2 />"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}/{$recname}\" />"; - print "</form>\r\n"; - } - else - { - $recnice = $recname; - if ($recnice[0] == '@') - $recnice = substr($recnice, 1); - $recnice = preg_replace('/\_/', ' ', $recnice); - - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$recname2');\"><span class=\"name\">$recnice</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$recname\" id=\"$recname\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\"/>"; - print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}/{$recname}\" />"; - print "</form>\r\n"; - } -} - -$updir = dirname($dir); - -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\"/><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$updir}/\" /></form>\r\n"; - -if ($dir_handle) - closedir($dir_handle); - -print "</ul></div>\r\n"; -?> diff --git a/includes/inc_session.php b/includes/inc_session.php deleted file mode 100755 index 2e10155..0000000 --- a/includes/inc_session.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -function sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir) -{ - global $httppath, $ffmpegpath, $segmenterpath; - - // Get a free session - $i=0; - for ($i=0; $i<1000; $i++) - { - $session = "session" .$i; - if (!file_exists('ram/' .$session)) - break; - } - - // Create session - exec('mkdir ram/' .$session); - $url = str_replace("\\'", "'", $url); - switch ($type) - { - case 1: - $cmd = "export SHELL=\"/bin/sh\";printf \"./istream.sh \\\"" .$url ."\\\" " .$qparams ." " .$httppath ." 2 " .$ffmpegpath ." " .$segmenterpath ." " .$session ." \" | at now"; - break; - case 2: - $cmd = "export SHELL=\"/bin/sh\";printf \"cat \\\"" .$url ."\\\"/0* | ./istream.sh - " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." " .$segmenterpath ." " .$session ." \" | at now"; - break; - case 3: - $cmd = "export SHELL=\"/bin/sh\";printf \"./istream.sh \\\"" .$url ."\\\" " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." " .$segmenterpath ." " .$session ." \" | at now"; - break; - default: - $cmd = ""; - } - - $cmd = str_replace('%', '%%', $cmd); - exec ($cmd); - - // Write streaminfo - writeinfostream($session, $type, $name, $title, $desc, $qname, $category, $url, $mediapath, $subdir); - - // Create logo - if ($type == 3) - generatelogo($type, $url, 'ram/' .$session .'/logo.png'); - else - generatelogo($type, $name, 'ram/' .$session .'/logo.png'); - - return $session; -} - -function sessiondelete($session) -{ - if ($session == 'all') - { - $dir_handle = @opendir('ram/'); - if ($dir_handle) - { - while ($session = readdir($dir_handle)) - { - if($session == "." || $session == ".." || $session == 'lost+found') - continue; - - if (!is_dir('ram/' .$session)) - continue; - - // Get info - list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session); - - if ($type) - sessiondeletesingle($session); - } - } - } - else - return sessiondeletesingle($session); -} - -function sessiondeletesingle($session) -{ - $ram = "ram/" .$session ."/"; - - // Get segmenter PID if any - if (file_exists($ram ."segmenter.pid")) - $cmd = "kill `cat " .$ram ."segmenter.pid`; rm " .$ram ."segmenter.pid; "; - - $cmd .= "rm -rf " .$ram; - exec ($cmd); -} - -?> diff --git a/includes/inc_stream.php b/includes/inc_stream.php deleted file mode 100755 index 5837e22..0000000 --- a/includes/inc_stream.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php - -global $vdrstreamdev, $quality; - -$category = $_SESSION['currentcat']; - -$type = $_REQUEST['type']; -$name = $_REQUEST['name']; -$name = stripslashes($name); -switch ($type) -{ - // Live TV - case 1: - list($title, $desc, $realname) = vdrgetinfostream($name, 1); - $channum = vdrgetchannum($realname); - break; - // Recording - case 2: - $realname = $name; - list($title, $desc, $realname) = vdrgetinfostream($name, 0); - break; - // Media - case 3: - list($title, $desc) = mediagetinfostream($name); - $realname = basename($name); - break; - default: - $realname = ""; - $title = ""; - $desc = ""; - $channame = ""; -} - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; - -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; - -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\">Select stream mode</span>\r\n"; - -// Print the right logo -print " <ul class=\"pageitem\">\r\n"; - -// Get logo -if ($type == 2) - generatelogo($type, $realname, 'ram/tmp-logo.png'); -else - generatelogo($type, $name, 'ram/tmp-logo.png'); - -print " <center><img src=\"ram/tmp-logo.png\"></img></center>\r\n"; - -print " </ul>\r\n"; - -print " <div id=\"tributton\">\r\n"; -print " <div class=\"links\">\r\n"; - -foreach ($quality as $qname => $qparams) - print "<a href=\"javascript:sendForm('$qname')\">{$qname}</a>"; -print "\r\n"; - -print " </div></div>\r\n"; - -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">{$realname}</span><p><strong>{$title}</strong>\r\n"; -print " <br>{$desc}</p></li></ul>\r\n"; - -print " </div>\r\n"; - -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"; - switch ($type) - { - case 1: - print " <input name=\"url\" type=\"hidden\" id=\"url\" value=\"{$vdrstreamdev}{$channum}\" />\r\n"; - break; - case 3: - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $subdir = stripslashes($subdir); - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"" .stripslashes($subdir) ."\" />\r\n"; - // NO BREAK - case 2: - print " <input name=\"url\" type=\"hidden\" id=\"url\" value=\"" .stripslashes($name) ."\" />\r\n"; - break; - } - print " </form>"; -} - -print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">"; -switch ($type) -{ - case 1: - if ($category==null) - { - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" />"; - } - else - { - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\" />"; - print " <input name=\"cat\"type=\"hidden\" id=\"cat\" value=\"{$category}\" />"; - } - break; - case 2: - $dir = dirname($name); - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" />"; - print " <input name=\"dir\"type=\"hidden\" id=\"dir\" value=\"" . stripslashes($dir) . "\" />"; - break; - case 3: - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $subdir = stripslashes($subdir); - - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\" />"; - 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"; - -?> diff --git a/includes/inc_streaminfo.php b/includes/inc_streaminfo.php deleted file mode 100755 index 4124396..0000000 --- a/includes/inc_streaminfo.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -/* - Types: - 0 : Not running - 1 : VDR live - 2 : VDR recording - 3 : Media -*/ - -function writeinfostream($session, $type=0, $name="", $title="", $desc="", $mode="", $category="", $url="", $mediapath="", $subdir="") -{ - $ram = "ram/" .$session ."/"; - - $infofile = fopen($ram ."streaminfo", 'w'); - - fwrite($infofile, "type=" .$type ."\n"); - fwrite($infofile, "name=" .$name ."\n"); - fwrite($infofile, "title=" .$title ."\n"); - fwrite($infofile, "desc=" .$desc ."\n"); - 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); -} - - -function readinfostream($session) -{ - $ram = "ram/" .$session ."/"; - - if (!file_exists($ram ."streaminfo")) - return array(0, "", "", "", ""); - - $infofile = fopen($ram ."streaminfo", 'r'); - if (!$infofile) - return array(0, "", "", "", ""); - - while ($line = fgets($infofile, 1024)) - { - if (!strncmp($line, "type=", strlen("type="))) - $type = substr($line, strlen("type="), -1); - else if (!strncmp($line, "name=", strlen("name="))) - $name = substr($line, strlen("name="), -1); - else if (!strncmp($line, "title=", strlen("title="))) - $title = substr($line, strlen("title="), -1); - else if (!strncmp($line, "desc=", strlen("desc="))) - $desc = substr($line, strlen("desc="), -1); - else if (!strncmp($line, "mode=", strlen("mode="))) - $mode = substr($line, strlen("mode="), -1); - else if (!strncmp($line, "category=", strlen("category="))) - $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, $mediapath, $subdir); -} - -?> diff --git a/includes/inc_streaming.php b/includes/inc_streaming.php deleted file mode 100755 index 913f28e..0000000 --- a/includes/inc_streaming.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -global $vdrstreamdev, $quality; - -// Get $session if we are not directly included from startstream -if ($session == "") - $session = $_REQUEST['session']; - -$ram = "ram/" .$session ."/"; - -// Get current stream info -list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session); - -print "<body onorientationchange=\"updateOrientation();\" onload=\"ajax('{$session}');\">\r\n"; - -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"javascript:sendForm('stopstream');\">Stop Stream</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\">Now streaming</span>\r\n"; - -// Print the right logo -print " <ul class=\"pageitem\">\r\n"; - -$logopath=$ram ."/logo.png"; -$logowidth = mediagetwidth($logopath); -print " <center><video id=\"videofeed\" width=\"{$logowidth}\" poster=\"{$logopath}\" ></video></center>\r\n"; - -print " </ul>\r\n"; - -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">{$realname}</span><p><strong>" .stripslashes($title). "</strong>\r\n"; -print " <br>{$desc}</p></li></ul>\r\n"; - -print " <ul class=\"pageitem\">\r\n"; -print " <li id=\"modetext\" class=\"textbox\"><span class=\"header\">Mode</span>\r\n"; -print " <p id='streamtitle'>{$mode}</p></li></ul>\r\n"; - -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=\"session\" type=\"hidden\" id=\"session\" value=\"{$session}\" />"; -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 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; - -} - -print " </form>\r\n"; -?> diff --git a/includes/inc_svdrp.php b/includes/inc_svdrp.php deleted file mode 100755 index da83b49..0000000 --- a/includes/inc_svdrp.php +++ /dev/null @@ -1,446 +0,0 @@ -<?php - -// SVDRP is a class do communicate with a vdr via svdrp -class SVDRP -{ - var $cfgServer; - var $cfgPort; - var $cfgTimeOut; - - var $handle; - var $debug; - - function SVDRP($server = "localhost", $port=2001, $timeout = 30, $debug = 0) - { - $this->cfgServer = $server; - $this->cfgPort = $port; - $this->cfgTimeOut = $timeout; - $this->debug = $debug; - $this->handle = 0; - } - - function DebugMessage($msg) - { - if($this->debug) echo ($msg); - } - - function Connect() - { - if($this->handle) Disconnect(); - $errno = 0; - $errstr = ""; - $this->handle = fsockopen($this->cfgServer, $this->cfgPort, &$errno, &$errstr, $this->cfgTimeOut); - - if(!$this->handle) - { - $this->DebugMessage("error $errno: $errstr"); - return false; - } - - $this->DebugMessage("handle: $this->handle<br>\n"); - - - $input = fgets($this->handle,128); - - if(!preg_match("/^220 /", $input) || $input == "") - { - $this->DebugMessage("wrong welcome message: '$input'<br>\n"); - $this->Disconnect(); - return false; - } - - - $this->DebugMessage("Welcome message: $input<br><br>\n"); - - return true; - } - - function Command($cmd) - { - if(!$this->handle) return false; - - $ret = array(); - - $this->DebugMessage("Kommando $cmd<br><pr"."e>"); - fputs($this->handle, $cmd . "\n"); - $s = ""; - $nline = 0; - while($s .= fgets($this->handle,4096)) - { - $nline++; - - $this->DebugMessage($s); - if(!preg_match("/^(\\d{3})([ -])(.*)$/", $s, $data)) - { - continue; - } - - - - - $number = $data[1]; - // TODO: Fehlernummer bearbeiten - $ret[] = $data[3]; - if($data[2] != "-" && $nline == 1) $ret = $data[3] ; - if($data[2] != "-") break; - $s = ""; - - } - - $this->DebugMessage("</pr"."e>"); - return $ret; - } - - function ListChannels($numberorname="") - { - if(!$this->handle) return false; - $channels = array(); - $lines = $this->Command("LSTC$numberorname"); - if(!$lines) return false; - foreach($lines as $a => $l) - { - $a = split(":", $l); - $name = $a[0]; - $freq = $a[1]; - $b = split(";", $name); - $name = $b[0]; - if(!isset($b[1])) $b[1] = $name; - $group = $b[1]; - - - $c["name"] = $name; - $c["group"] = $group; - $c["frequency"] = $freq; - - $channels[] = $c; - - - } - return $channels; - } - - function Help() - { - return $this->Command("HELP"); - } - function Disconnect() - { - if(!$this->handle) return; - $this->Command("QUIT"); - - fclose($this->handle); - $this->handle = 0; - $this->DebugMessage("disconnected"); - } - function ClearEpg() - { - if(!$this->handle) return false; - $this->Command("CLRE"); - return true; - } - function SwitchUp() - { - if(!$this->handle) return false; - $this->Command("CHAN +"); - return true; - } - function SwitchDown() - { - if(!$this->handle) return false; - $this->Command("CHAN -"); - return true; - } - function SwitchChannel($channel) - { - if(!$this->handle) return false; - $this->Command("CHAN $channel"); - return true; - } - function DeleteChannel($id) - { - if(!$this->handle) return false; - $this->Command("DELC $id"); - return true; - } - function DeleteRecord($id) - { - if(!$this->handle) return false; - $this->Command("DELR $id"); - return true; - } - - function GrabImage($filename, $type="jpeg", $quality="", $width="", $height) - { - if(!$this->handle) return false; - $this->Command("GRAB $filename $type $quality $width $height"); - return true; - } - function HitKey($key) - { - if(!$this->handle) return false; - $this->Command("HITK $key"); - return true; - } - function PowerOff() - { - if(!$this->handle) return false; - $this->Command("HITK Power"); - return true; - - } - function GetKeys() - { - if(!$this->handle) return false; - - $lines = $this->Command("HITK"); - $keys = array(); - foreach($lines as $l) - { - if(!preg_match("/^ {4}(.*)$/", $l, $m)) continue; - $keys[] = $m[1]; - } - - return $keys; - } - function ListEPG($pStrChannel="", $pStrTime="") - { - if(!$this->handle) return false; - $lines = $this->Command("LSTE"); - - $epg = array (); - $channel = array(); - $event = array(); - - $channelname = ""; - foreach($lines as $l) - { - preg_match("/^(.)\\s*(.*)$/", $l, $m); - $type = $m[1]; - $text = $m[2]; - switch($type) - { - case 'C': // Channel - list( $channeldata, $channelname ) = explode( ' ', $text, 2 ); - - break; - case 'E': // new Event - sscanf($text, "%u %ld %d %X", $event["EventID"], $event["StartTime"], $event["Duration"], $event["TableID"]); - - break; - case 'T': // Title - $event["Title"] = $text; - break; - case 'S': // Short text - $event["Shottext"] = $text; - break; - case 'D': // Description - $event["Desc"] = $text; - break; - case 'V': // VPS - $event["VPS"] = $text; - break; - case 'e': // Event end - if ((trim($pStrTime) != '') && (( $event['StartTime'] > $pStrTime ) || ($event['StartTime'] + $event["Duration"] < $pStrTime))) - continue; - - $channel[] = $event; - $event = array(); - - break; - case 'c': // Channel end - if ((trim($pStrChannel) != '') && ($channelname != $pStrChannel)) - continue; - - $epg[$channelname] = $channel; - $channel = array(); - - break; - } - - } - if ((trim($pStrTime) == '') || (( $event['StartTime'] < $pStrTime ) && ($event['StartTime'] + $event["Duration"] > $pStrTime))) - $channel[] = $event; - - if ((trim($pStrChannel) != '') || ($channelname == $pStrChannel)) - $epg[$channelname] = $channel; - - return $epg; - } - - function Message($msg) - { - if(!$this->handle) return false; - $this->Command("MESG $msg"); - return true; - } - - - // Volume commands - function ToggleMute() - { - if(!$this->handle) return false; - $this->Command("VOLU mute"); - return true; - } - function VolumeUp() - { - if(!$this->handle) return false; - $this->Command("VOLU +"); - return true; - } - function VolumeDown() - { - if(!$this->handle) return false; - $this->Command("VOLU -"); - return true; - } - function SetVolume($v) - { - if(!$this->handle) return false; - $this->Command("VOLU $v"); - return true; - } - function GetVolume() - { - if(!$this->handle) return false; - $v = $this->Command("VOLU"); - if($v == "Audio is mute") return 0; - if(!preg_match("/Audio volume is (.*)/", $v, $m)) return false; - - return $m[1]; - } - function GetDiskStat() - { - if(!$this->handle) return false; - $stat = $this->Command("STAT DISK"); - sscanf($stat, "%dMB %dMB %d%%", $FreeMUsedMB, $FreeMB, $Percent); - $ret["FreeMB + UsedMB"] = $FreeMUsedMB; - $ret["FreeMB"] = $FreeMB; - $ret["UsedMB"] = $FreeMUsedMB - $FreeMB; - $ret["Percent"] = $Percent; - return $ret; - } - function StartScan() - { - if(!$this->handle) return false; - $this->Command("SCAN"); - return true; - } - function MoveChannel($number, $to) - { - if(!$this->handle) return false; - $this->Command("MOVC $number $to"); - return true; - - } - - function DeleteTimer($id) - { - if(!$this->handle) return false; - $this->Command("DELT $id"); - return true; - } - - function MoveTimer($number, $to) - { - if(!$this->handle) return false; - $this->Command("MOVT $number $to"); - return true; - } - - function TimerOnOff($n, $state = "on") - { - if(!$this->handle) return false; - //if($state == "1") $state = "on"; - //if($state == "0") $state = "off"; - //if($state == false) $state = "off"; - // if($state == true) $state = "on"; - switch($state) - { - case false: - case "off": - case "0": - $state = "off"; - break; - default: - $state = "on"; - break; - } - - return $this->Command("MODT $n $state"); - } - - function ListTimers() - { - - } - - function ShowMessage($msg = "") - { - if(!$this->handle) return false; - return $this->Command("MESG $msg"); - } - - function ListRecords() - { - if(!$this->handle) return false; - - $lines = $this->Command("LSTR"); - $records = array(); - foreach($lines as $l) - { - - if(!preg_match("/^(\\d)\s(\\d*)\\.(\\d*)\\.(\\d*) (\\d*)\\:(\\d*).\s(.*)$/", $l, $m)) continue; - $id = $m[1]; - $m["id"] = $m[1]; - $m["day"] = $m[2]; - $m["month"] = $m[3]; - $m["year"] = $m[4]; - $m["hour"] = $m[5]; - $m["minute"] = $m[6]; - $m["desc"] = $m[7]; - - $records[$id] = $m; - } - - return $records; - - } - - // TODO: perhaps better implementation - function ListRecord($n) - { - if(!$this->handle) return false; - $m = $this->Command("LSTR $n"); - return $m[0]; - } - - - - //TODO: Implement following commands: - /* - - - LSTT MODT NEWT UPDT - MODC NEWC - NEXT - PUTE - - */ -} - -// Small Example -/* -echo "<pr"."e>"; -$a = new SVDRP(); -$a->Connect(); -print_r($a->Help()); -print_r($a->ListChannels()); -$a->GetKeys(); -print_r($a->GetVolume()); -print_r($a->GetDiskStat()); -$a->Disconnect(); -*/ -?> - - diff --git a/includes/inc_timers.php b/includes/inc_timers.php deleted file mode 100755 index 5190494..0000000 --- a/includes/inc_timers.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\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\">Timers</span>\r\n"; - -// Status display -if ($message != "") -{ - print " <ul class=\"pageitem\">"; - print $message; - print " </ul>"; -} - -print " <ul class=\"pageitem\">"; -print " <li class=\"textbox\">"; -print " <span class=\"header\">Current timers</span>"; -print " </li>"; - -vdrlisttimers(); - -print "</ul>"; - -print "<ul class=\"pageitem\">"; -print " <li class=\"menu\">"; -print " <a href=\"javascript:sendForm('new_timer')\">"; -print " <span class=\"name\">New Timer</span>"; -print " <span class=\"arrow\"></span>"; -print " </a>"; -print " </li>"; -print " <form name=\"new_timer\" id=\"new_timer\" method=\"post\" action=\"index.php\">"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"edittimer\"/>"; -print " <input name=\"timer\" type=\"hidden\" id=\"timer\" value=\"-1\" />"; -print " </form>"; -print "</ul>"; - -print "</div>\r\n"; -a -?> - diff --git a/includes/inc_utils.php b/includes/inc_utils.php deleted file mode 100755 index e748c64..0000000 --- a/includes/inc_utils.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -function is_utf8($str) -{ - $c=0; $b=0; - $bits=0; - $len=strlen($str); - for($i=0; $i<$len; $i++) - { - $c=ord($str[$i]); - if($c > 128) - { - if(($c >= 254)) return false; - elseif($c >= 252) $bits=6; - elseif($c >= 248) $bits=5; - elseif($c >= 240) $bits=4; - elseif($c >= 224) $bits=3; - elseif($c >= 192) $bits=2; - else return false; - if(($i+$bits) > $len) return false; - while($bits > 1) - { - $i++; - $b=ord($str[$i]); - if($b < 128 || $b > 191) return false; - $bits--; - } - } - } - return true; -} - -function php2js ($var) -{ - if (is_array($var)) - { - $array = array(); - - foreach ($var as $a_var) - $array[] = php2js($a_var); - - return str_replace("\"", "'", join(",", $array)); - - - } - - elseif (is_bool($var)) - return ($var ? "true" : "false"); - - elseif (is_int($var) || is_integer($var) || is_double($var) || is_float($var)) - return $var; - - elseif (is_string($var)) - return "\"" .$var . "\""; - - else - return false; -} - -function sec2hms ($sec, $padHours = false) -{ - - // holds formatted string - $hms = ""; - - // there are 3600 seconds in an hour, so if we - // divide total seconds by 3600 and throw away - // the remainder, we've got the number of hours - $hours = intval(intval($sec) / 3600); - - // add to $hms, with a leading 0 if asked for - $hms .= ($padHours) - ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' - : $hours. ':'; - - // dividing the total seconds by 60 will give us - // the number of minutes, but we're interested in - // minutes past the hour: to get that, we need to - // divide by 60 again and keep the remainder - $minutes = intval(($sec / 60) % 60); - - // then add to $hms (with a leading 0 if needed) - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':'; - - // seconds are simple - just divide the total - // seconds by 60 and keep the remainder - $seconds = intval($sec % 60); - - // add to $hms, again with a leading 0 if needed - $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); - - // done! - return $hms; - -} -?> diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php deleted file mode 100755 index 6dee5dc..0000000 --- a/includes/inc_vdr.php +++ /dev/null @@ -1,389 +0,0 @@ -<?php -include ('includes/inc_svdrp.php'); - -function vdrsendcommand($cmd) -{ - global $svdrpip, $svdrpport; - - $svdrp = new SVDRP($svdrpip, $svdrpport); - $svdrp->Connect(); - $ret = $svdrp->Command($cmd); - $svdrp->Disconnect(); - - return $ret; -} - -function vdrgetinfostream($stream = "NULL", $ischan = 1) -{ - global $allepg, $allepgfilled; - $stream=stripslashes($stream); - if ($ischan) - { - // Fill epg if not yet done - if ($allepgfilled == 0) - { - $allepg = vdrsendcommand("LSTE NOW"); - $allepgfilled = 1; - } - - $channame = $stream; - } - else - { - $infofile = $stream ."/info"; - if (file_exists($infofile)) - $info= file_get_contents($infofile); - else - { - $infofile = $stream ."/info.vdr"; - if (file_exists($infofile)) - $info= file_get_contents($infofile); - else - $info=""; - } - - $allepg = explode("\n", $info); - } - - if ($ischan) - $chanfound = 0; - else - $chanfound = 1; - $epgtitlefound = 0; - - $epgtitle=""; - $epgdesc=""; - - // For all epg - $count = count($allepg); - for ($i = 0; $i < $count; $i++) - { - // Find the right chan (take the first one) - if ($chanfound == 0) - { - $streamArray = explode(";",$stream); - if (strstr($allepg[$i], $streamArray[0]) == $streamArray[0]) - $chanfound = 1; - } - else - { - // Now find T or C - if(ereg("^C", $allepg[$i])) - { - // Check if it is our chan too, else search again - if ($ischan) - { - if(!ereg("$stream$", $allepg[$i])) - { - $chanfound = 0; - continue; - } - } - else - { - $channame = substr($allepg[$i], 2); - $channames = explode(" ", $channame); - $channame = substr($channame, strlen($channames[0])+1); - } - } - else if(ereg("^T", $allepg[$i])) - $epgtitle=substr($allepg[$i], 2); - else if(ereg("^D", $allepg[$i])) - $epgdesc=substr($allepg[$i], 2); - } - } - - // Convert if needed - if (!is_utf8($epgtitle)) - $epgtitle = utf8_encode($epgtitle); - if (!is_utf8($epgdesc)) - $epgdesc = utf8_encode($epgdesc); - - - return array($epgtitle, $epgdesc, $channame); -} - -function vdrgettimerinfo($timernum=-1) -{ - if ($timernum != -1) - { - $timer = vdrsendcommand("LSTT " .$timernum); - - $timerarray = explode(":", $timer); - - $typearray = explode(" ", $timerarray[0]); - $type = $typearray[1]; - $channel = $timerarray[1]; - $date = $timerarray[2]; - $stime = $timerarray[3]; - $etime = $timerarray[4]; - $desc = $timerarray[7]; - } - else - { - $type = 1; - $channel = 1; - $date = date('Y-m-d'); - $stime = date('Hi'); - $etime = date('Hi'); - $desc = "New timer"; - } - - $channame = vdrgetchanname($channel); - - return array($type, $channame, $date, $stime, $etime, $desc); -} - -function vdrgetchannum($chan = "NULL") -{ - $channels = vdrsendcommand("LSTC"); - - // Get channel number - $channels = preg_grep(quotemeta('"'.$chan.';|'.$chan.':"'), $channels); - reset($channels); - - $channels = explode(" ", $channels[key($channels)]); - $channum = $channels[0]; - - return $channum; -} - -function vdrgetchanname($channum = 0) -{ - $channel = vdrsendcommand("LSTC " .$channum); - - // Get channel name - $chanarray = explode(":", $channel); - $chanarray = explode(";", $chanarray[0]); - $channame = $chanarray[0]; - $channame = substr($channame, strlen($channum)+1); - - return $channame; -} - - -function vdrlistcategories() -{ - global $vdrchannels; - - // All chans - 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 - if ($line[0] == ":") - { - // Remove : and @ - $cat = substr($line, 1, -1); - if($cat[0] == '@') - { - $cat_array = explode(' ', $cat); - $cat = substr($cat, strlen($cat_array[0])+1); - } - - $cat2 = addslashes($cat); - - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$cat2');\"><span class=\"name\">$cat</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$cat\" id=\"$cat\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\"/><input name=\"cat\" type=\"hidden\" id=\"cat\" value=\"$cat\" /></form>\r\n"; - } - } - fclose($fp); -} - -function vdrlistchannels($category = "NULL") -{ - global $epgtitle; - global $vdrchannels; - - if ($category == "All") - $cat_found=1; - else - $cat_found=0; - - 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) - { - if ($line[0] == ":") - { - if ($category == "All") - continue; - else - break; - } - - $channels = explode(":", $line); - $channels = explode(";", $channels[0]); - $chan = $channels[0]; - - // Get EPG title - $epgtitle = NULL; - list($epgtitle, $epgdesc, $channame) = vdrgetinfostream($chan, 1); - print "<li class=\"withimage\">"; - $chan2=addslashes($chan); - print " <a class=\"noeffect\" href=\"javascript:sendForm('$chan2');\">\r\n"; - $channoslash = preg_replace("$/$", " ", $chan); - if (!file_exists('logos/'.$channoslash.'.png')) - print " <img src=\"logos/nologoTV.png\" />\r\n"; - else - print " <img src=\"logos/{$channoslash}.png\" />\r\n"; - print " <span class=\"name\">$chan</span>\r\n"; - print " <span class=\"comment\">$epgtitle</span><span class=\"arrow\"></span></a>\r\n</li>\r\n"; - print " <form name=\"$chan\" id=\"$chan\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\" />"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=1 />"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"$chan\" />"; - print " </form>\r\n"; - } - else - { - if ($line[0] == ":") - { - // Remove : and @ - $cat = substr($line, 1, -1); - if($cat[0] == '@') - { - $cat_array = explode(' ', $cat); - $cat = substr($cat, strlen($cat_array[0])+1); - } - - // Check category - if ("$cat" == "$category") - $cat_found = 1; - } - } - } - fclose($fp); -} - -function vdrlistchannelsdrop($chansel = "") -{ - global $vdrchannels; - - $chanselected = 0; - - 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] == ":") - continue; - - $channels = explode(":", $line); - $channels = explode(";", $channels[0]); - $chan = $channels[0]; - if (($chan == $chansel) && !$chanselected) - { - print "<option selected value=\"{$chan}\">{$chan}</option>"; - $chanselected = 1; - } - else - print "<option value=\"{$chan}\">{$chan}</option>"; - } -} - -function vdrlisttimers() -{ - $timers = vdrsendcommand("LSTT"); - - if (gettype($timers) == "string") - { - if (!is_numeric(substr($timers,0,1))) - { - print "<li class=\"textbox\"><p>none</p></li>\r\n"; - return; - } - else - $timersarray[] = $timers; - } - else - $timersarray = $timers; - - foreach($timersarray as $timer) - { - // Extract timer # - $timerarray = explode(" ", $timer); - $timernum = $timerarray[0]; - - list($type, $channame, $date, $starthour, $endhour, $desc) = vdrgettimerinfo($timernum); - - print "<li class=\"menu\">"; - print " <a href=\"javascript:sendForm('timer {$timernum}')\">\r\n"; - - if ($type & 0x8) - print " <img alt=\"list\" src=\"images/pictos/timerrec.png\" />\r\n"; - else if ($type & 0x1) - print " <img alt=\"list\" src=\"images/pictos/timeron.png\" />\r\n"; - else - print " <img alt=\"list\" src=\"images/pictos/timeroff.png\" />\r\n"; - - print " <span class=\"name\">{$date}: {$desc}</span><span class=\"arrow\"></span>\r\n"; - - print " </a>\r\n"; - print "</li>\r\n"; - - print "<form name=\"timer {$timernum}\" id=\"timer {$timernum}\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"edittimer\"/>\r\n"; - print " <input name=\"timer\" type=\"hidden\" id=\"timer\" value=\"{$timernum}\" />\r\n"; - print "</form>\r\n"; - } -} - -function vdrdeltimer($timer=0) -{ - return vdrsendcommand("DELT " .$timer); -} - -function vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active) -{ - $channum = vdrgetchannum($channame); - if ($active) - $type = "1"; - else - $type = "0"; - - if ($prevtimer == -1) - $command = "NEWT " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc; - else - $command = "MODT " .$prevtimer ." " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc; - - return vdrsendcommand($command); -} - -?> diff --git a/includes/inc_video.php b/includes/inc_video.php deleted file mode 100755 index 8fc9208..0000000 --- a/includes/inc_video.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -$mediapath = $_REQUEST['mediapath']; -$subdir = $_REQUEST['subdir']; -$mediapath = stripslashes($mediapath); -$subdir = stripslashes($subdir); - -/* Add last slash to dirs */ -if ($mediapath[strlen($mediapath)-1] != '/') - $mediapath = $mediapath .'/'; -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 ($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"; - 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>" . stripslashes($subdir) . "</p></li>"; - -$noslashdir = stripslashes($mediapath.$subdir); -$dir_handle = @opendir($noslashdir); - -if (!$dir_handle) -{ - print "Unable to open $mediapath .$subdir"; -} -else while ($medianame = readdir($dir_handle)) -{ - if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') - continue; - - $medianame_array[] = $medianame; -} - -if ($medianame_array[0]) -{ - // Alphabetical sorting - sort($medianame_array); - - $audiocnt=0; - - foreach($medianame_array as $value) - { - $medianame2=addslashes($value); - - switch (mediagettype($mediapath .$subdir .$value)) - { - // Dir - case 3: - { - print "<li class=\"menu\">\r\n"; - print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n"; - print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n"; - print " </a>\r\n"; - print "</li>\r\n"; - print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\"/>"; - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"" .stripslashes($subdir) .stripslashes($value) ."\" />\r\n"; - print "</form>\r\n"; - break; - } - // Video - case 1: - { - print "<li class=\"menu\">\r\n"; - print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n"; - print " <img src=\"images/pictos/video.png\" />\r\n"; - print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n"; - print " </a>\r\n"; - print "</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=\"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"; - break; - } - // Rest of files - default: - continue; - } - } -} - -$upsubdir = dirname($subdir); - -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">\r\n"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\"/>\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); - -print "</ul></div>\r\n"; -?> diff --git a/includes/include.php b/includes/include.php deleted file mode 100755 index de9cfa4..0000000 --- a/includes/include.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -if (file_exists('config.php')) - include ('config.php'); -else - include ('config_default.php'); -include ('includes/inc_session.php'); -include ('includes/inc_utils.php'); -include ('includes/inc_auth.php'); -include ('includes/inc_vdr.php'); -include ('includes/inc_files.php'); -include ('includes/inc_streaminfo.php'); -include ('getid3/getid3.php'); - -function selectpage() -{ - global $maxencodingprocesses; - - // Sanity check - if (!file_exists('ram')) - die("Error: 'ram/' directory is missing, please create it!"); - - $action = $_REQUEST['action']; - - switch ($action) - { - case ("streaming"): - include('includes/inc_streaming.php'); - break; - case ("startstream"): - // Dont create a session if too much are running already - $nbencprocess = exec("find ram/ -name segmenter.pid | wc | awk '{ print $1 }'"); - if ($nbencprocess < $maxencodingprocesses) - { - $type = $_REQUEST['type']; - $name = $_REQUEST['name']; - $title = $_REQUEST['title']; - $desc = stripslashes ($_REQUEST['desc']); - $qname = $_REQUEST['qname']; - $qparams = $_REQUEST['qparams']; - $category = $_REQUEST['category']; - $url = $_REQUEST['url']; - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $session = sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir); - include('includes/inc_streaming.php'); - } - else - include('includes/inc_streaming.php'); - break; - case ("stopstream"): - sessiondelete($_REQUEST['session']); - // NO BREAK; - case ("stream"): - include('includes/inc_stream.php'); - break; - case ("stopallstreamings"): - sessiondelete('all'); - $_SESSION['currentcat'] = NULL; - include('includes/inc_home.php'); - break; - case ("listcategory"): - include('includes/inc_cat.php'); - break; - case ("listchannels"): - include('includes/inc_chan.php'); - break; - case ("recordings"): - include('includes/inc_rec.php'); - break; - case ("video"): - include('includes/inc_video.php'); - break; - case ("audio"): - include('includes/inc_audio.php'); - break; - case ("epg"): - include('includes/inc_epg.php'); - break; - case ("timers"): - include('includes/inc_timers.php'); - break; - case ("edittimer"): - include('includes/inc_edittimer.php'); - break; - case ("deletetimer"): - $timer = $_REQUEST['timer']; - delete_timer($timer); - include('includes/inc_timers.php'); - break; - case ("addtimer"): - $active = $_REQUEST['timer_active']; - $channame = $_REQUEST['timer_chan']; - $date = $_REQUEST['timer_date']; - $stime = $_REQUEST['timer_starttime']; - $etime = $_REQUEST['timer_endtime']; - $desc = $_REQUEST['timer_name']; - $prevtimer = $_REQUEST['prevtimer']; - set_timer($active, $channame, $date, $stime, $etime, $desc, $prevtimer); - include('includes/inc_timers.php'); - break; - case ("playdir"): - include('includes/inc_mp3.php'); - break; - default: - $_SESSION['currentcat'] = NULL; - include('includes/inc_home.php'); - break; - } -} - -function delete_timer($timer) -{ - $ret = vdrdeltimer($timer); - - $message = " <li class=\"textbox\"><p><font color='black'>Timer deleted successfully</font></p></li>"; - -} - -function set_timer($active, $channame, $date, $stime, $etime, $desc, $prevtimer) -{ - $ret = vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active); - - if ($prevtimer == -1) - $settype = "creat"; - else - $settype = "edit"; - - $retarray = explode(":", $ret); - - if (!is_numeric(substr($retarray[0], 0, 1))) - $message = " <li class=\"textbox\"><p><font color='red'>{$retarray[0]}</font></p></li>"; - else - $message = " <li class=\"textbox\"><p>Timer {$settype}ed successfully</p></li>"; -} - -?> |