Added $base_url to fix PATH_INFO issues (still need to edit links to use it)
[mirrors/JukeBox.git] / index.php
index fa52b99e5b30c72291b88b73d7ec70885ca4db8e..92a0507e1a624794501b3d2b81ae7ffa4053b491 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -18,7 +18,8 @@ Version info:
 
 //Config-basic
 $title =               'Harvie\'s JuKe!Box'; //Title of jukebox
-$music_dir =           './music'; //Local path to directory with music
+$music_dir =           'music'; //Local path to directory with music
+$base_url =            dirname($_SERVER['SCRIPT_NAME']); //URL of this directory ("./")
 $music_dir_url =       'http://your-server.net/jukebox/music'; //URL path to the same directory
 $cache_passwd =        'renew123'; //You need this passwd to refresh search cache
 $sort =                        3; //Sort? 0 = none, 1 = playlists, 2 = 1+listings; 3 = 2+search-EXPERIMENTAL! (sorting could eat lot of memory)
@@ -35,11 +36,11 @@ $default_random_count =     30; //How many random songs by defaul?
 
 //External files
 $indexlist =           array('index.html', 'index.txt'); //Search for this file in each directory
-$bonus_dir =           './jbx'; //Misc. files directory
+$bonus_dir =           'jbx'; //Misc. files directory
 ////
 $search_cache =        $bonus_dir.'/cache.db'; //Database for searching music (php +rw) - .htaccess: Deny from all!!!
-$css_file =            $bonus_dir.'/themes/default/jukebox.css'; //CSS (Design)
-$favicon_file =                './favicon.png'; //favicon
+$css_file =            $base_url.'/'.$bonus_dir.'/themes/default/jukebox.css'; //CSS (Design)
+$favicon_file =                $base_url.'/favicon.png'; //favicon
 $header_file =         $bonus_dir.'/header.html'; //header file
 $footer_file =         $bonus_dir.'/footer.html'; //footer file
 
@@ -76,6 +77,7 @@ if(get_magic_quotes_gpc()) die("Error: magic_quotes_gpc needs to be disabled!\n"
 $useflash = is_file($flash_player_swf);
 
 //Little magic with directories ;o)
+if($_SERVER['PATH_INFO']!='') $_GET['dir']=$_SERVER['PATH_INFO'];
 $current_dir = ereg_replace('/+', '/', '/'.$_GET['dir'].'/');
 if(eregi('(/|\\\\)\\.\\.(/|\\\\)', $current_dir)) { //check for directory traversal ;)
        header('Location: ?');
@@ -279,7 +281,7 @@ function flash_mp3_player() {
 <style> * { margin: 0; padding: 0; border: 0; } </style></head><body>
 <object width="100%" height="344">
         <embed src="<?php
-               echo($GLOBALS['flash_player_swf'].$GLOBALS['flash_player_options']);
+               echo($GLOBALS['base_url'].'/'.$GLOBALS['flash_player_swf'].$GLOBALS['flash_player_options']);
                if(isset($_GET['song'])) echo(rawurlencode($_GET['song']));
                if(isset($_GET['playlist'])) generate_m3u($GLOBALS['dir'], dirname($GLOBALS['music_dir_url']), isset($_GET['recursive']), ',', true);
        ?>"
@@ -295,6 +297,7 @@ function flash_mp3_player() {
 }
 
 //GET
+if(isset($_GET['dj'])) { ?><title><?php echo "DJ MODE @ $title"; ?></title><frameset cols="*,*"><frame name="dj-left" src="./"><frame name="dj-right" src="./"></frameset><?php die(); }
 if(isset($_GET['download'])) serve_download($playlist_name);
 if(isset($_GET['f'])) flash_mp3_player();
 if(isset($_GET['song'])) {
@@ -349,7 +352,8 @@ if(isset($_GET['blank'])) {
        <a name="up"></a>
        <iframe src="about:blank" name="playframe-hide" width="0" height="0" style="border: none;" class="hide"></iframe><!-- -----------???--------------- -->
        <span class="icon">&lt;</span> <a href="javascript: history.go(-1)" class="icon iback">BACK</a>
-       | <a href="?" class="icon ihome">HOME&nbsp;(<?=$music_dir?>)</a>
+       | <a href="?" target="_parent" class="icon ihome">HOME&nbsp;(<?=$music_dir?>)</a>
+       | <a href="?dj" class="icon idjmode">DJ</a>
        | <a href="?help" class="icon ihelp">ABOUT/HELP</a>
        | <a href="?logout" class="icon ilogout">LOGOUT</a>
 </div>
This page took 0.109072 seconds and 4 git commands to generate.