X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;ds=inline;f=index.php;h=6c13be1c91d36d293f791851959de114437f2c1e;hb=1bbbe5ac2b423f46130ea57a7f8f14d702c70484;hp=2e1b5b116b37bd13b61d43c4bc7ab4c9fed93009;hpb=ca88871f4c51e904ec23305abf2fd1aa17226103;p=mirrors%2FJukeBox.git
diff --git a/index.php b/index.php
index 2e1b5b1..6c13be1 100755
--- a/index.php
+++ b/index.php
@@ -1,23 +1,32 @@
- 'http://google.com/search?q=',
+ 'Images' => 'http://google.com/images?q=',
+ 'Karaoke-Lyrics.net' => 'http://www.karaoke-lyrics.net/index.php?page=find&q=',
+ 'Jyxo.cz multimedia' => 'http://jyxo.cz/s?d=mm&q=',
+ 'Centrum.cz mp3' => 'http://search.centrum.cz/index.php?sec=mp3&q=',
+ 'YOUTube.com' => 'http://youtube.com/results?search_query='
+);
+
+//Flash MusicPlayer (info about settings: http://wpaudioplayer.com/standalone)
+$flash_player_swf = $bonus_dir.'/player.swf'; //path to musicplayer
+$flash_player_frame = 'playframe-show'; //FlashPlayer Target (playframe-show|playframe-hide) - usefull for compatibility with old music player
+$flash_player_options = '?bg=000099&loader=000000&tracker=AAAAFF&skip=FFFFFF' //.'&leftbg=000077&rightbg=000077&righticon=999999'
+ .'&autostart=yes&initialvolume=100&soundFile='; //& arguments (urlencoded song url will be added)
+
//Security
-error_reporting(0);
+error_reporting(0); //This will disable error reporting, wich can pass sensitive data to users
+
+//External configuration file (overrides index.php configuration)
+@include('./_config.php');
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Init
srand(time());
+@ini_set('magic_quotes_gpc' , 'off');
+if(get_magic_quotes_gpc()) die("Error: magic_quotes_gpc needs to be disabled!\n");
+
+//Enable flash?
+$useflash = is_file($flash_player_swf);
+
+//Little magic with directories ;o)
$current_dir = ereg_replace('/+', '/', '/'.$_GET['dir'].'/');
+if(eregi('(/|\\\\)\\.\\.(/|\\\\)', $current_dir)) { //check for directory traversal ;)
+ header('Location: ?');
+ die('Error - directory not found!');
+}
$dir = $music_dir.$current_dir;
$url = $music_dir_url.$current_dir;
$parent_dir = dirname($current_dir);
@@ -57,26 +99,54 @@ function serve_download($filename) {
header('X-PHP-Application: Harvie\'s JuKe!Box');
}
-function generate_m3u($dir, $prefix='', $recursive=0) {
+$nchars_f = array('Ã','Ã','Ä','Ã','Ä','Ã','Ä','Ã','Ã','Å','Ã','Ã','Å','Å ','Ť','Ã','Å®','Ã','Ã','Ž','á','ä','Ä','ç','Ä','é','Ä','ë','Ã','Å','ó','ö','Å','Å¡','Å¥','ú','ů','ü','ý','ž');
+$nchars_t = array('A','A','C','C','D','E','E','E','I','N','O','O','R','S','T','U','U','U','Y','Z','a','a','c','c','d','e','e','e','i','n','o','o','r','s','t','u','u','u','y','z');
+
+function unational($text) {
+ if(!$GLOBALS['national_characters']) return $text;
+ return(str_replace($GLOBALS['nchars_f'], $GLOBALS['nchars_t'], $text));
+}
+
+function generate_m3u($dir, $prefix='', $recursive=0, $nl="\r\n", $doubleenc=0) {
$dir = $dir . '/';
- $dd = opendir($dir);
- while(($item = readdir($dd)) != false) {
- if($item == '.' || $item == '..') continue;
- if( is_file($dir.$item) && eregi(('\.('.$GLOBALS['m3u_exts'].')$'), $item) ) {
- if($GLOBALS['sort'] > 0) {
- $temp[] = $item;
- } else {
- echo($prefix.'/'.str_replace('%2F', '/', (rawurlencode($dir.$item)))."\r\n");
+ if(isset($_GET['newline'])) $nl = $_GET['newline'];
+ if(!isset($_GET['search'])) {
+ $dd = opendir($dir);
+ while(($item = readdir($dd)) != false) {
+ if($item == '.' || $item == '..') continue;
+ if( is_file($dir.$item) && eregi(('\.('.$GLOBALS['m3u_exts'].')$'), $item) ) {
+ if($GLOBALS['sort'] > 0) {
+ $temp[] = $item;
+ } else {
+ $item=($prefix.'/'.str_replace('%2F', '/', (rawurlencode($dir.$item))).$nl);
+ if($doubleenc) $item = rawurlencode($item);
+ echo($item);
+ }
+ }
+ if($recursive && is_dir($dir.$item)) {
+ generate_m3u($dir.$item, $prefix, $recursive, $nl, $doubleenc);
+ }
+ }
+ } else {
+ if(!($searchfp = fopen($GLOBALS['search_cache'], 'r')))
+ die("Cannot read cache from $outfile
Refresh cache or set permissions properly!
\n");
+ while(!feof($searchfp)) {
+ $line = trim(fgets($searchfp));
+ if(@eregi(str_replace(' ', '(.*)', unational($_GET['search'])), unational($line))) {
+ $line=(dirname($GLOBALS['music_dir_url']).'/'.str_replace('%2F', '/', (rawurlencode($line))).$nl);
+ if($doubleenc) $line = rawurlencode($line);
+ echo($line);
}
}
- if($recursive && is_dir($dir.$item)) {
- generate_m3u($dir.$item, $prefix);
- }
}
+
if($GLOBALS['sort'] > 0) {
@sort($temp);
- foreach($temp as $item)
- echo($prefix.'/'.str_replace('%2F', '/', (rawurlencode($dir.$item)))."\r\n");
+ foreach($temp as $item) {
+ $temp=($prefix.'/'.str_replace('%2F', '/', (rawurlencode($dir.$item))).$nl);
+ if($doubleenc) $temp = rawurlencode($temp);
+ echo($temp);
+ }
}
}
@@ -117,35 +187,120 @@ function generate_search_cache($dir, $outfile) {
}
function render_file_line($dir, $item, $dir_url, $index, $filesize, $parent = false) {
- $parclass=($index%2?"even":"odd"); $parcolor=($index%2?"lightblue":"white");
+ $parclass=($index%2?'even':'odd'); $parcolor=($index%2?'lightblue':'white');
$temp=str_replace('&', '%26', dirname($dir_url)).'/'.str_replace('%2F', '/', (rawurlencode($dir.$item)));
if(is_numeric($filesize)) $filesize = round($filesize/(1024*1024), 2);
- echo("