diff options
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/class/stream.class.php | 31 | ||||
-rw-r--r-- | lib/class/tmp_playlist.class.php | 57 | ||||
-rw-r--r-- | lib/preferences.php | 13 | ||||
-rw-r--r-- | modules/flash/xspf_player.php | 46 | ||||
-rw-r--r-- | song.php | 6 | ||||
-rw-r--r-- | templates/show_now_playing.inc | 2 | ||||
-rw-r--r-- | templates/show_xspf_player.inc.php | 3 | ||||
-rw-r--r-- | themes/classic/templates/default.css | 583 |
9 files changed, 728 insertions, 15 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 331b0dc8..1f8e39d8 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.3.3-Alpha2 + - Added XSPF Flash player, rough around the edges but it works + (Thx pb1dft/GrinningArmor) - Fixed bug with Album --> Artist sorting, wasn't allowing you to sort Z-A - Fixed bug with most popular where links weren't being generated diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index cda7a1d3..7d0566bb 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -227,9 +227,36 @@ class Stream { /* First insert the songs we've got into * a tmp_playlist */ + $tmp_playlist = new tmpPlaylist(); + $playlist_id = $tmp_playlist->create($this->sess,'xspf','song',''); + $tmp_playlist = new tmpPlaylist($playlist_id); - /* Echo some ugly javascript to make it pop-open the player */ - + /* Add the songs to this new playlist */ + foreach ($this->songs as $song_id) { + $tmp_playlist->add_object($song_id); + } // end foreach + + /* Build the extra info we need to have it pass */ + $play_info = "?action=show&tmpplaylist_id=" . $tmp_playlist->id; + + // start ugly evil javascript code + //FIXME: This needs to go in a template, here for now though + echo "<html><head>\n"; + echo "<title>" . conf('site_title') . "</title>\n"; + echo "<script language=\"javascript\" type=\"text/javascript\">\n"; + echo "<!-- begin\n"; + echo "function PlayerPopUp(URL) {\n"; + echo "window.open(URL, 'XSPF_player', 'width=400,height=168,scrollbars=0,toolbar=0,location=0,directories=0,status=1,resizable=0');\n"; + echo "window.location = '" . return_referer() . "';\n"; + echo "return false;\n"; + echo "}\n"; + echo "// end -->\n"; + echo "</script>\n"; + echo "</head>\n"; + + echo "<body onLoad=\"javascript:PlayerPopUp('" . conf('web_path') . "/modules/flash/xspf_player.php" . $play_info . "')\">\n"; + echo "</body>\n"; + echo "</html>\n"; } // create_xspf_player diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php index 8829c41e..acd78329 100644 --- a/lib/class/tmp_playlist.class.php +++ b/lib/class/tmp_playlist.class.php @@ -89,7 +89,7 @@ class tmpPlaylist { $db_results = mysql_query($sql, dbh()); while ($results = mysql_fetch_assoc($db_results)) { - $items[] = $results['id']; + $items[] = $results['object_id']; } return $items; @@ -97,7 +97,7 @@ class tmpPlaylist { } // get_items /** - * ceate + * create * This function initializes a new tmpPlaylist it is assoicated with the current * session rather then a user, as you could have same user multiple locations */ @@ -114,11 +114,64 @@ class tmpPlaylist { $id = mysql_insert_id(dbh()); + /* Clean any other playlists assoicated with this sessoin */ + $this->delete($sessid,$id); + return $id; } // create /** + * delete + * This deletes any other tmp_playlists assoicated with this + * session + */ + function delete($sessid,$id) { + + $sessid = sql_escape($sessid); + $id = sql_escape($id); + + $sql = "DELETE FROM tmp_playlist WHERE session='$sessid' AND id != '$id'"; + $db_results = mysql_query($sql,dbh()); + + /* Remove assoicated tracks */ + $this->prune_tracks(); + + return true; + + } // delete + + /** + * prune_tracks + * This prunes tracks that don't have playlists + */ + function prune_tracks() { + + $sql = "DELETE FROM tmp_playlist_data USING tmp_playlist_data " . + "LEFT JOIN tmp_playlist ON tmp_playlist_data.tmp_playlist=tmp_playlist.id " . + "WHERE tmp_playlist.id IS NULL"; + $db_results = mysql_query($sql,dbh()); + + } // prune_tracks + + /** + * add_object + * This adds the object of $this->object_type to this tmp playlist + */ + function add_object($object_id) { + + $object_id = sql_escape($object_id); + $playlist_id = sql_escape($this->id); + + $sql = "INSERT INTO tmp_playlist_data (`object_id`,`tmp_playlist`) " . + " VALUES ('$object_id','$playlist_id')"; + $db_results = mysql_query($sql, dbh()); + + return true; + + } // add_object + + /** * vote * This function is called by users to vote on a system wide playlist * This adds the specified objects to the tmp_playlist and adds a 'vote' diff --git a/lib/preferences.php b/lib/preferences.php index 8bd01020..0022911b 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -286,12 +286,13 @@ function create_preference_input($name,$value) { $var_name = $value . "_type"; ${$var_name} = "selected=\"selected\""; echo "<select name=\"$name\">\n"; - echo "\t<option value=\"m3u\" $m3u_type>" . _("M3U") . "</option>\n"; - echo "\t<option value=\"simple_m3u\" $simple_m3u_type>" . _("Simple M3U") . "</option>\n"; - echo "\t<option value=\"pls\" $pls_type>" . _("PLS") . "</option>\n"; - echo "\t<option value=\"asx\" $asx_type>" . _("Asx") . "</option>\n"; - echo "\t<option value=\"ram\" $ram_type>" . _("RAM") . "</option>\n"; - echo "\t<option value=\"xspf\" $xspf_type>" . _("XSPF") . "</option>\n"; + echo "\t<option value=\"m3u\" $m3u_type>" . _('M3U') . "</option>\n"; + echo "\t<option value=\"simple_m3u\" $simple_m3u_type>" . _('Simple M3U') . "</option>\n"; + echo "\t<option value=\"pls\" $pls_type>" . _('PLS') . "</option>\n"; + echo "\t<option value=\"asx\" $asx_type>" . _('Asx') . "</option>\n"; + echo "\t<option value=\"ram\" $ram_type>" . _('RAM') . "</option>\n"; + echo "\t<option value=\"xspf\" $xspf_type>" . _('XSPF') . "</option>\n"; + echo "\t<option value=\"xspf_player\">" . _('Flash') . "</option>\n"; echo "</select>\n"; break; case 'lang': diff --git a/modules/flash/xspf_player.php b/modules/flash/xspf_player.php new file mode 100644 index 00000000..c88999c5 --- /dev/null +++ b/modules/flash/xspf_player.php @@ -0,0 +1,46 @@ +<?php +/* + + Copyright (c) 2001 - 2006 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +require_once('../../lib/init.php'); + + +$dbh = dbh(); +$web_path = conf('web_path'); + +/* Attempt to build the temp playlist */ +$action = scrub_in($_REQUEST['action']); + +switch ($action) { + default: + case 'tmp_playlist': + $tmp_playlist = new tmpPlaylist($_REQUEST['tmp_id']); + $items = $tmp_playlist->get_items(); + $stream = new Stream('xspf',$items); + $stream->start(); + break; + case 'show': + $play_info = "?tmp_id=" . scrub_out($_REQUEST['tmpplaylist_id']); + require_once (conf('prefix') . '/templates/show_xspf_player.inc.php'); + break; +} // end switch + + +?> @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +//FIXME: This should be renamed to stream.php as it makes a little more sense +//FIXME: considering what this file does require('lib/init.php'); /* If we are running a demo, quick while you still can! */ @@ -25,7 +27,6 @@ if (conf('demo_mode') || !$user->has_access('25')) { access_denied(); } - $song_ids = array(); $web_path = conf('web_path'); @@ -50,7 +51,8 @@ switch ($action) { break; /* This is run if we need to gather info based on a tmp playlist */ case 'tmp_playlist': - + $tmp_playlist = new tmpPlaylist($_REQUEST['tmpplaylist_id']); + $song_ids = $tmp_playlist->get_items(); break; case 'single_song': $song_ids[] = scrub_in($_REQUEST['song_id']); diff --git a/templates/show_now_playing.inc b/templates/show_now_playing.inc index db9fefd9..2f06dece 100644 --- a/templates/show_now_playing.inc +++ b/templates/show_now_playing.inc @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if (count($results)) { ?> -<table class="box" cellspacing="0" cellpadding="0" style="width:625px;"> +<table class="box" cellspacing="0"> <tr> <td class="box-left-top"></td> <td class="box-top"></td> diff --git a/templates/show_xspf_player.inc.php b/templates/show_xspf_player.inc.php index f0494cb2..0602c4dd 100644 --- a/templates/show_xspf_player.inc.php +++ b/templates/show_xspf_player.inc.php @@ -19,7 +19,6 @@ */ ?> - <html> <head><title>Ampache XSPF Player</title></head> <body style="margin:0px; padding:0px; border:0px;"> @@ -28,7 +27,7 @@ <param name="movie" value="<?php echo conf('web_path'); ?>/modules/flash/xspf_player.swf?playlist_url=<?php echo conf('web_path'); ?>/song.php<?php echo $play_info; ?>&autoplay=true&autoload=true"/> <param name="quality" value="high"/> <param name="bgcolor" value="#E6E6E6"/> -<embed src="<?php echo conf('web_path'); ?>/modules/flash/xspf_player.swf?playlist_url=<?php echo conf('web_path'); ?>/song.php<?php echo $play_info; ?>&autoplay=true&autoload=true" quality="high" bgcolor="#E6E6E6" name="xspf_player" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="center" height="168" width="400"></embed> +<embed src="<?php echo conf('web_path'); ?>/modules/flash/xspf_player.swf?playlist_url=<?php echo conf('web_path'); ?>/modules/flash/xspf_player.php<?php echo $play_info; ?>&autoplay=true&autoload=true" quality="high" bgcolor="#E6E6E6" name="xspf_player" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="center" height="168" width="400"></embed> </object> </body> </html> diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css new file mode 100644 index 00000000..bb85573a --- /dev/null +++ b/themes/classic/templates/default.css @@ -0,0 +1,583 @@ +<!-- +/* + + Copyright (c) 2001 - 2006 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +--> +p { + color: #000000; +} + +a { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; +} +a:visited + { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + } +a:active { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; +} +.text-box { + display: table-cell; + padding-left:5px; + padding-top:5px; + padding-right:5px; + margin-bottom:10px; + background-color: #bbbbbb; + border-right:2px solid #000000; + border-bottom:2px solid #000000; + border-left:2px solid #000000; + border-top:2px solid #000000; +} +.selected_button { + background-color: black;color:white; +} +.unselected_button { + /* there really isn't anything for this */ +} +.display {} + +#mpdpl td { + padding: 0px 2px 0px 2px; + text-align: left; +} +table.tabledata {} +td { + padding: 0px 8px 0px 8px; + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; +} +th { + padding-right: 10px; +} +input { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + font-weight: bold; + background-color: #dddddd; + margin: 2px 2px 2px 2px; +} +select { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + background-color: #dddddd; +} +textarea { + background-color: #dddddd; + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; +} +.table-header { + background: url(../images/ampache-light-bg.gif) #dddddd repeat-x; + vertical-align: top; +} + .header1 + { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + font-size: 18px; + font-weight: 900; + } + .header2 + { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + font-size: 14px; + font-weight: 900; + } + .headrow + { + background:#cccccc; + font-size: 12px; + } + .odd + { + background:#bbbbbb; + font-size: 12px; + } + .even + { + background:#dddddd; + font-size: 12px; + } +.blank { + background: #fff; +} +.border { + background:#000000; +} +.header { + font-size: 12px; +} +.error { + color: #990033; +} +.fatalerror { + padding-top: 3px; + padding-left: 3px; + padding-right: 3px; + display: table-cell; + padding-bottom: 3px; + color: #990033; + font-weight:bold; + border-right:2px solid #990033; + border-bottom:2px solid #990033; + border-left:2px solid #990033; + border-top:2px solid #990033; +} +#container div.fatalerror { + background:none; + height:auto; + padding:5px; + margin:10px; + display:block; +} +.disabled { + text-decoration: line-through; +} +.smallbutton { + border:0px; + padding-left:1px; + padding-right:1px; + font-size: 11px; + cursor: pointer; +} +/* These three lines make a menu vertical */ + #sidebar li { float: none; } + #sidebar li ul { margin: -1.5em 0 0 9em; } + +/* ////////////////////////////////////////////////////////////////*/ +/* De aqui pa'bajo, ros esta creando una hoja de estilos unica para todo Ampache */ + +/* General style rules */ +body{ + padding-top: 0px; + margin-top: 0px; + margin-left: 0px; + margin-right: 0px; + background-color:#d3d3d3; + font-family:Arial, Helvetica, Sans-Serif; +} + +#maincontainer{ + margin: 0px; +} + +.alphabet { + margin: 10px; + font-size: 10px; + font-weight: normal; +} + +/* Content block */ +#content { + top:90px; + float: none; + margin-top:7px; + margin-left:135px; + /*float:left; use for horizontal menu; comment out otherwise */ + /* background:#fff url("../images/bg_content.gif") repeat-y right top; */ +} + +h3#content_title{ + font-family:Arial,Helvetica,Sans-Serif; + font-size:12px; + line-height:32px; + color:#fff; + margin:0px; + padding:0px; + background:#8B8B8B url("../images/content_corner.gif") no-repeat right top; +} + +h3#content_title span { + text-align:left; +} + +/* Styles for Header */ +div#Header{ + height:80px; + margin-bottom:3px; + padding:0px; +} + +#Header h1 { + background: transparent url("../images/bg_login_0.jpg") no-repeat top left; + border:0px; + width: 439px; + height: 84px; + float: left; + margin:0px; + padding:0px; +} + +#Header h1 span { + display:none +} + +#Header h2 { + background: transparent url(001/h2.gif) no-repeat top left; + margin-top: 75px; + width: 200px; + height: 18px; + float: right; +} + +#Header h2 span { + font-size:10px; + margin-left:10px; +} + + +/* Sidebar */ +/** + * Experimental for menus (Thx Sigger) + * TO DO: Fill in 1px border around menus & submenu items + * Make padding apply to the li, not just an a. Moving padding: to li throws off the dropdown menu alignment. + */ + +div#sidebar{ + clear:both; + position:absolute; + left:5px; + top:87px; +} + +#sidebar h3 { + border:0px; + width: 120px; + height: 28px; + margin:0px; + padding:0px; + background: transparent url("../images/sidebar_top.jpg") no-repeat left; + +} + +#sidebar h3 span { + display:none +} + +#sidebar ul { + margin: 0px; + list-style: none; + font-family:Arial, Helvetica, Sans-Serif; + font-size:10px; + padding: 0px; + line-height: 1.0; +} + +#sidebar li { + margin: 0; + display: block; + border-bottom: 1px solid #8B8B8B; + border-left: 1px solid #8B8B8B; + border-right: 4px solid #B4B4B4; + border-top: 1px solid #8B8B8B; + /* float: left; /* use for horizontal menu; comment out otherwise */ + padding: 5px 0px 5px 10px; + width: 10.5em; + background-color:#FFFFFF; +} + +#sidebar ul.subnavside li { + border-right: 1px solid #B4B4B4; +} + +#sidebar a, .navbutton { + display: block; /*Not sure why this is neccesary, but it is for IE*/ + text-decoration: none; +} + +#sidebar li:hover, #sidebar li.sfhover { + color:#000000; + background-color:#DDDDDD; +} + +#sidebar li.hover:active { + background-color:#CCCCCC; + z-index:30; +} + +#sidebar li ul { + float: left; + position: absolute; + width: 9em; + margin: -1.5em 0 0 10.5em; /* for vertical menu; comment out otherwise */ +/* margin: 0.5em 0 0 -1.1em; /* for horizontal menu; comment out otherwise */ + left: -999em; /* this -999em puts the submenu item way off to the left until it's called back by a hover (below) */ + z-index:30; +} + +#sidebar li:hover ul, #sidebar li.sfhover ul { + left: auto; /* this calls the submenu back when the parent li is hovered. */ +} + +/* Styles for Now Playing */ +#nowplaying{ + clear: both; + width: 625px; +} + +#np_container1{ + width: 260px; + height: 18px; + padding: 0px; + margin: 0px; + background: #fff url("../images/tb_tab.jpg") no-repeat top left; +} + +#np_container1 h1{ + font-size: 10px; + font-weight: bold; + padding: 2px; +} + +#np_container2{ + border-width: 1px 1px 1px 1px; + border-style: solid; + border-color:#ddd #999 #999 #ccc; + padding: 6px; + font-family: Verdana, sans-serif; + font-size: 10px; + line-height: 12px; + color: #000; + background: #D6D6D4 url("../images/bg_row.jpg") repeat top left; +} + + +/* Styles for Login template */ +#container{ + margin:100px auto 0px auto; + width:437px; + font-size: 12px; + text-align:center; +} +#container h1{ + background:url("../images/bg_login_0.jpg") no-repeat; + height:81px; + margin-bottom:8px; +} +#container h1 span{ + display:none; +} +#container div{ + background:url("../images/bg_login_1.jpg") no-repeat; + height:285px; +} +#loginp_0{ + color:#333; + margin-top:0px; + padding-top:60px; +} +.loginp_1{ + text-align:right; + padding-right:100px; +} +.loginp_1 span{ + font-weight:bold; +} +.loginp_1 input{ + border:1px solid #999; +} +input.text_input { +width:12em; +} +.loginp_1 input.check_input { +margin-right:5em; +} +/* Footer */ +#footer { + margin-left: 150px; + margin-bottom: 10px; +} + +#footer p { + color:#999999; + font-size:10px; +} +#topbar { + height: 80px; + padding-top:3px; + padding-left:10px; +} +#topbarright { + float: right; + font-size: 10px; +} +#topbarleft, #topbarleft a{ + float: left; +} + +/* Box Related Styles */ +.box { + padding:0px; + background: #f7f7f7; +} +.box-title { + border-bottom: solid 1px #000000; + font-size: 1.05em; + font-weight: bold; +} +.box-left-top { + background: url(../images/topleft.gif) no-repeat; + height:16px; +} +.box-left-bottom { + background: url(../images/bottomleft.gif) no-repeat; + height:18px; +} +.box-left { + background: url(../images/left.gif); +} +.box-bottom { + background: url(../images/bottom.gif); + height:18px; +} +.box-right-bottom { + background: url(../images/bottomright.gif) no-repeat; +} +.box-right-top { + background: url(../images/topright.gif) no-repeat; +} +.box-right { + background: url(../images/right.gif); +} +.box-top { + background: url(../images/top.gif); +} +/* List Header Styles */ +.list-header { + text-decoration: none; +} +.list-header:hover { + color:#071fd4; +} + + +.confirmation-box { + padding-left:5px; + padding-top:5px; + padding-right:5px; + margin-bottom:10px; + display: table-cell; + background-color: #bbbbbb; + border-right:2px solid #000000; + border-bottom:2px solid #000000; + border-left:2px solid #000000; + border-top:2px solid #000000;} +.text-action, .text-action li { + margin-top:5px; + list-style: none; + margin-bottom:5px; + padding-left:0px; +} +.text-action a, .text-action span { + background: #dddddd; + border:1px solid #000000; + padding-left:2px; + padding-right:2px; + text-decoration: none; +} +.text-action #pt_active { + background: #000000; + color: #ffffff; + border:1px solid #dddddd; +} +#nowplaying { + width:600px; +} +.np_row { + padding-top: 3px; + padding-bottom: 3px; + display: block; +} +.np_cell { + margin: 10px; +} + +/* 'Tab' Preferences, used by preferences.php */ + +#tablist { + padding: 3px 0; + margin: 12px 0 0 0; + font: bold 12px Verdana, sans-serif; +} + +#tablist li { + list-style: none; + margin: 0; + display: inline; +} + +#tablist li a { + padding: 3px 0.5em; + margin-left: 3px; + border: 1px solid #cccccc; + border-bottom: none; + background: #dddddd; + text-decoration: none; +} + +#tablist li a:link { color: #222222; } +#tablist li a:visited { color: #000000; } + +#tablist li a:hover { + color: #000000; + background: #bbbbbb; + border-color: #000000; +} + +#tablist li a#current { + color: #000000; + background: #bbbbbb; + border-color: #000000; + border-bottom: 1px solid #000000; +} + + + +/* TV Page Related Styles */ +#tv_control { + float:left; +} + +#tv_np { + float:right; +} + +#tv_playlist { + clear: both; +} +/* User Online/Offline style, used in users.php */ +td.user_online { + background-color: green; +} +td.user_offline { + background-color: #7f0000; +} +td.user_disabled { + background-color: gray; +} + |