summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xincludes/inc_media.php61
-rwxr-xr-xincludes/inc_rec.php8
-rw-r--r--includes/inc_utils.php27
-rwxr-xr-xincludes/inc_vdr.php7
-rwxr-xr-xincludes/include.php1
5 files changed, 73 insertions, 31 deletions
diff --git a/includes/inc_media.php b/includes/inc_media.php
index d6b6e59..7c5f133 100755
--- a/includes/inc_media.php
+++ b/includes/inc_media.php
@@ -25,8 +25,8 @@ else
print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n";
if ($dir != $mediapath)
{
-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=\"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";
@@ -54,42 +54,45 @@ else while ($medianame = readdir($dir_handle))
//
if ($medianame_array[0] == NULL)
{
-//do nothing
+ //do nothing
}
else
{
-sort($medianame_array);
-foreach($medianame_array as $value)
- {
- $medianame2=addslashes($value);
- // Directories
- if (is_dir($dir ."/" .$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 "</form>\r\n";
- }
- else
- {
- // Get file extension
- $fileext = end(explode(".", $value));
+ // Alphabetical sorting
+ sort($medianame_array);
+
+ foreach($medianame_array as $value)
+ {
+ $medianame2=addslashes($value);
- // Check if it is supported
- if ( preg_match("'" .$fileext ." '", $videotypes)
- || preg_match("'" .$fileext ." $'", $videotypes)
- )
+ // Directories
+ if (is_dir($dir ."/" .$value))
{
- 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 "<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=\"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=\"media\"/>";
+ print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}{$value}/\" />";
print "</form>\r\n";
}
+ else
+ {
+ // Get file extension
+ $fileext = end(explode(".", $value));
+
+ // Check if it is supported
+ if ( preg_match("'" .$fileext ." '", $videotypes)
+ || preg_match("'" .$fileext ." $'", $videotypes)
+ )
+ {
+ 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 "</form>\r\n";
+ }
+ }
}
- }
}
$updir = dirname($dir);
diff --git a/includes/inc_rec.php b/includes/inc_rec.php
index b01a64c..a950d14 100755
--- a/includes/inc_rec.php
+++ b/includes/inc_rec.php
@@ -39,11 +39,15 @@ else while ($recname = readdir($dir_handle))
if($recname == "." || $recname == ".." || $recname == "epg.data" || $recname == 'lost+found')
continue;
- $recname2=addslashes($recname);
+ $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")
{
- print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$recname2');\"><span class=\"name\">$recname</span><span class=\"arrow\"></span></a></li>\r\n";
+ 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 />";
diff --git a/includes/inc_utils.php b/includes/inc_utils.php
new file mode 100644
index 0000000..a984794
--- /dev/null
+++ b/includes/inc_utils.php
@@ -0,0 +1,27 @@
+<?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;
+}
+?>
diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php
index 07880e7..c96217c 100755
--- a/includes/inc_vdr.php
+++ b/includes/inc_vdr.php
@@ -83,6 +83,13 @@ function vdrgetinfostream($stream = "NULL", $ischan = 1)
$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);
}
diff --git a/includes/include.php b/includes/include.php
index 830b4b1..913b22a 100755
--- a/includes/include.php
+++ b/includes/include.php
@@ -4,6 +4,7 @@ if (file_exists('config.php'))
include ('config.php');
else
include ('config_default.php');
+include ('includes/inc_utils.php');
include ('includes/inc_auth.php');
include ('includes/inc_vdr.php');
include ('includes/inc_files.php');