diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-05 22:39:53 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-05 22:39:53 +0000 |
commit | 246c321617b18035725b3d42c6a313386687cedc (patch) | |
tree | 45262291e66caae786ed06873c2fe9e67089f8ae | |
parent | ad3d2363c4c20d6b5049c8db92d08786650bd2ae (diff) | |
download | ampache-246c321617b18035725b3d42c6a313386687cedc.tar.gz ampache-246c321617b18035725b3d42c6a313386687cedc.tar.bz2 ampache-246c321617b18035725b3d42c6a313386687cedc.zip |
fixed some typos, minor bugs, updated the sql, added playlist as a browse type
-rw-r--r-- | config/ampache.cfg.php.dist | 6 | ||||
-rwxr-xr-x | docs/CHANGELOG | 4 | ||||
-rw-r--r-- | lib/album.lib.php | 8 | ||||
-rw-r--r-- | lib/class/playlist.class.php | 100 | ||||
-rw-r--r-- | lib/class/update.class.php | 58 | ||||
-rw-r--r-- | lib/install.php | 2 | ||||
-rw-r--r-- | lib/preferences.php | 2 | ||||
-rw-r--r-- | play/index.php | 2 | ||||
-rw-r--r-- | server/ajax.server.php | 13 | ||||
-rwxr-xr-x | sql/ampache.sql | 84 | ||||
-rw-r--r-- | templates/show_playlist_row.inc.php | 35 | ||||
-rw-r--r-- | templates/show_playlists.inc.php | 41 |
12 files changed, 237 insertions, 118 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index 011ef844..ee79c431 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -228,6 +228,12 @@ album_art_order = "db,id3,folder,lastfm,amazon" ; DEFAULT: true show_album_art = "true" +; MyStrands Developer ID +; This is needed for any of the OpenStrands functionality to work correctly +; this is the developer ID you obtained from http://www.mystrands.com/openstrands/overview.vm +; DEFAULT: false +;mystrands_developer_key = "" + ; Amazon Developer Key ; This is needed in order to actually use the amazon album art ; DEFAULT: false diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 0caa9633..580308bd 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,10 @@ -------------------------------------------------------------------------- v.3.4-Alpha2 + - Added Playlists as a browse type and fixed playback + - Fixed an issue where albums of the moment would show when you + had 0 albums + - Fixed warnings on Update & typo in Install - Removed redundent GPL licence file - Fixed filesize() issue on config re-gen - Fixed an issue with seeking causing incorrect stats counts diff --git a/lib/album.lib.php b/lib/album.lib.php index 8812cb4c..e04d494c 100644 --- a/lib/album.lib.php +++ b/lib/album.lib.php @@ -90,6 +90,14 @@ function get_image_from_source($data) { * this is used by the index to return some 'potential' albums to play */ function get_random_albums($count=6) { + + // Make sure that we have anything to pick from + $sql = "SELECT `id` FROM `album` LIMIT 7"; + $db_results = Dba::query($sql); + + $rows = Dba::num_rows($db_results); + if ($rows < 7) { return false; } + // There's a slight chance with this logic that the number of albums // returned will be less than the number requested if the id's for the // albums have signifigant gaps, but the speed increase is probably diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index 863a28a5..493e335a 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -30,6 +30,7 @@ class Playlist { public $name; public $user; public $type; + public $genre; public $date; /* Generated Elements */ @@ -74,7 +75,12 @@ class Playlist { */ public function format() { - $this->f_link = '<a href="' . Config::get('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $this->id . '">' . $this->name . '</a>'; + $this->f_name = truncate_with_ellipsis($this->name,Config::get('ellipse_threshold_title')); + $this->f_link = '<a href="' . Config::get('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $this->id . '">' . $this->f_name . '</a>'; + + $client = new User($this->user); + + $this->f_user = $client->fullname; } // format @@ -102,12 +108,16 @@ class Playlist { $results = array(); - $sql = "SELECT * FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY `track`"; + $sql = "SELECT `object_id`,`object_type`,`dynamic_song` FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY `track`"; $db_results = Dba::query($sql); while ($row = Dba::fetch_assoc($db_results)) { - $key = $row['id']; - $results[$key] = $row['song']; + + if (strlen($row['dynamic_song'])) { + // Do something here FIXME! + } + + $results[] = array('type'=>$row['object_type'],'object_id'=>$row['object_id']); } // end while return $results; @@ -115,85 +125,56 @@ class Playlist { } // get_items /** - * get_songs - * This returns an array of song_ids accounting for any dyn_song entries this playlist - * may have. This is what should be called when trying to generate a m3u or other playlist + * get_random_items + * This is the same as before but we randomize the buggers! */ - function get_songs($array=array()) { - - $results = array(); - - /* If we've passed in some songs */ - if (count($array)) { - - foreach ($array as $data) { - - $sql = "SELECT song,dyn_song FROM playlist_data WHERE id='" . sql_escape($data) . "' ORDER BY track"; - $db_results = mysql_query($sql, dbh()); + public function get_random_items() { - $r = mysql_fetch_assoc($db_results); - if ($r['dyn_song']) { - $array = $this->get_dyn_songs($r['dyn_song']); - $results = array_merge($array,$results); - } - else { - $results[] = $r['song']; - } - - } // end foreach songs - - return $results; + $results = array(); - } // end if we were passed some data + $sql = "SELECT `object_id`,`object_type`,`dynamic_song` FROM `playlist_data` " . + "WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY RAND()"; + $db_results = Dba::query($sql); - $sql = "SELECT * FROM playlist_data WHERE playlist='" . sql_escape($this->id) . "' ORDER BY track"; - $db_results = mysql_query($sql, dbh()); + while ($row = Dba::fetch_assoc($db_results)) { - while ($r = mysql_fetch_assoc($db_results)) { - if ($r['dyn_song']) { - $array = $this->get_dyn_songs($r['dyn_song']); - $results = array_merge($array,$results); - } - else { - $results[] = $r['song']; + if (strlen($row['dynamic_song'])) { + // Do something here FIXME!!! } - } // end while + $results[] = array('type'=>$row['object_type'],'object_id'=>$row['object_id']); + } // end while - return $results; + return $results; - } // get_songs + } // get_random_items /** - * get_random_songs - * This returns all of the songs in a random order, except those - * pulled from dyn_songs, takes an optional limit + * get_songs + * This is called by the batch script, because we can't pass in Dynamic objects they pulled once and then their + * target song.id is pushed into the array */ - function get_random_songs($limit='') { - - if ($limit) { - $limit_sql = "LIMIT " . intval($limit); - } - - $sql = "SELECT * FROM playlist_data WHERE playlist='" . sql_escape($this->id) . "'" . - " ORDER BY RAND() $limit_sql"; - $db_results = mysql_query($sql, dbh()); + function get_songs() { $results = array(); - while ($r = mysql_fetch_assoc($db_results)) { + $sql = "SELECT * FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY `track`"; + $db_results = Dba::query($sql); + + while ($r = Dba::fetch_assoc($db_results)) { if ($r['dyn_song']) { $array = $this->get_dyn_songs($r['dyn_song']); $results = array_merge($array,$results); } else { - $results[] = $r['song']; - } + $results[] = $r['object_id']; + } + } // end while return $results; - } // get_random_songs + } // get_songs /** * get_dyn_songs @@ -298,7 +279,6 @@ class Playlist { /** * update_track_numbers - * This function takes an array of $array['song_id'] $array['track'] where song_id is really the * playlist_data.id and updates them */ diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 2af04264..2c5f5694 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -220,6 +220,13 @@ class Update { $version[] = array('version' => '340007','description' => $update_string); + $update_string = '- Modified Playlist_Data table to account for multiple object types.<br />' . + '- Verified previous updates, adjusting as needed.<br />' . + '- Dropped Allow Downsampling pref, configured in cfg file.<br />' . + '- Renamed Downsample Rate --> Transcode Rate to reflect new terminiology.<br />'; + + $version[] = array('version' => '340008','description' => $update_string); + return $version; } // populate_version @@ -309,7 +316,7 @@ class Update { * This updates the 'update_info' which is used by the updater * and plugins */ - private function set_version($key,$value) { + private static function set_version($key,$value) { $sql = "UPDATE update_info SET value='$value' WHERE `key`='$key'"; $db_results = Dba::query($sql); @@ -848,5 +855,54 @@ class Update { } // update_340007 + /** + * update_340008 + * This modifies the playlist table to handle the different types of objects that it needs to be able to + * store, and tweaks how dynamic playlist stuff works + */ + public static function update_340008() { + + $sql = "ALTER TABLE `playlist_data` CHANGE `song` `object_id` INT( 11 ) UNSIGNED NULL DEFAULT NULL"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `playlist_data` CHANGE `dyn_song` `dynamic_song` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `playlist_data` ADD `object_type` VARCHAR( 32 ) NOT NULL DEFAULT 'song' AFTER `object_id`"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `playlist` ADD `genre` INT( 11 ) UNSIGNED NOT NULL AFTER `type`"; + $db_results = Dba::query($sql); + + $sql = "DELETE FROM `preference` WHERE `name`='allow_downsample_playback'"; + $db_results = Dba::query($sql); + + $sql = "UPDATE `preference` SET `description`='Transcode Bitrate' WHERE `name`='sample_rate'"; + $db_results = Dba::query($sql); + + // Check for old tables and drop if found, seems like there was a glitch that caused them + // not to get droped.. *shrug* + $sql = "DROP TABLE IF EXISTS `preferences`"; + $db_results = Dba::query($sql); + + $sql = "DROP TABLE IF EXISTS `song_ext_data`"; + $db_results = Dba::query($sql); + + $sql = "DROP TABLE IF EXISTS `ratings`"; + $db_results = Dba::query($sql); + + $sql = "SELECT `id` FROM `user`"; + $db_results = Dba::query($sql); + + User::fix_preferences('-1'); + + while ($r = Dba::fetch_assoc($db_results)) { + User::fix_preferences($r['id']); + } + + self::set_version('db_version','340008'); + + } // update_340008 + } // end update class ?> diff --git a/lib/install.php b/lib/install.php index ede48a17..d9636f3a 100644 --- a/lib/install.php +++ b/lib/install.php @@ -120,7 +120,7 @@ function install_insert_db($username,$password,$hostname,$database) { $db_selected = @mysql_select_db($database, $dbh); if ($db_selected && !$_POST['overwrite_db']) { - Error::add('general','Error: Database Already exists and Overwrite no checked'); + Error::add('general','Error: Database Already exists and Overwrite not checked'); return false; } if (!$db_selected) { diff --git a/lib/preferences.php b/lib/preferences.php index a2dc0afe..e956cef5 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -231,7 +231,6 @@ function create_preference_input($name,$value) { case 'use_auth': case 'access_control': case 'allow_stream_playback': - case 'allow_downsample_playback': case 'allow_democratic_playback': case 'allow_localplay_playback': case 'demo_mode': @@ -348,6 +347,7 @@ function create_preference_input($name,$value) { case 'transcode': ${$value} = ' selected="selected"'; echo "<select name=\"$name\">\n"; + echo "\t<option value=\"never\"$never>" . _('Never') . "</option>\n"; echo "\t<option value=\"default\"$default>" . _('Default') . "</option>\n"; echo "\t<option value=\"always\"$always>" . _('Always') . "</option>\n"; echo "</select>\n"; diff --git a/play/index.php b/play/index.php index d4aa0710..95840d70 100644 --- a/play/index.php +++ b/play/index.php @@ -248,7 +248,7 @@ if (Config::get('access_control') AND Config::get('downsample_remote')) { } // if access_control // If they are downsampling, or if the song is not a native stream or it's non-local -if ($GLOBALS['user']->prefs['transcode'] == 'always' || !$song->native_stream() || $not_local) { +if (($GLOBALS['user']->prefs['transcode'] == 'always' || !$song->native_stream() || $not_local) && $GLOBALS['user']->prefs['transcode'] != 'never') { debug_event('downsample','Starting Downsample...','5'); $results = start_downsample($song,$lastid,$song_name); $fp = $results['handle']; diff --git a/server/ajax.server.php b/server/ajax.server.php index 16fc6bd2..7133fb26 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -198,9 +198,16 @@ switch ($action) { break; case 'playlist': $playlist = new Playlist($_REQUEST['id']); - $songs = $playlist->get_items(); - foreach ($songs as $song_id) { - $GLOBALS['user']->playlist->add_object($song_id,'song'); + $items = $playlist->get_items(); + foreach ($items as $item) { + $GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']); + } + break; + case 'playlist_random': + $playlist = new Playlist($_REQUEST['id']); + $items = $playlist->get_random_items(); + foreach ($items as $item) { + $GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']); } break; case 'clear_all': diff --git a/sql/ampache.sql b/sql/ampache.sql index 1beffc8f..9600906d 100755 --- a/sql/ampache.sql +++ b/sql/ampache.sql @@ -2,7 +2,7 @@ -- -- Host: localhost Database: ampache -- ------------------------------------------------------ --- Server version 5.0.36-Debian_1-log +-- Server version 5.0.45-Debian_1-log /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -70,7 +70,7 @@ UNLOCK TABLES; DROP TABLE IF EXISTS `album_data`; CREATE TABLE `album_data` ( `album_id` int(11) unsigned NOT NULL, - `art` blob, + `art` mediumblob, `art_mime` varchar(64) default NULL, `thumb` blob, `thumb_mime` varchar(64) default NULL, @@ -249,11 +249,10 @@ UNLOCK TABLES; DROP TABLE IF EXISTS `now_playing`; CREATE TABLE `now_playing` ( - `id` int(11) unsigned NOT NULL auto_increment, + `id` varchar(64) NOT NULL, `song_id` int(11) unsigned NOT NULL default '0', `user` int(11) NOT NULL, - `start_time` int(11) unsigned NOT NULL default '0', - `session` varchar(64) default NULL, + `expire` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM; @@ -303,6 +302,7 @@ CREATE TABLE `playlist` ( `name` varchar(128) NOT NULL default '', `user` int(11) NOT NULL, `type` enum('private','public') NOT NULL default 'private', + `genre` int(11) unsigned NOT NULL, `date` timestamp NOT NULL, PRIMARY KEY (`id`), KEY `name` (`name`), @@ -326,8 +326,9 @@ DROP TABLE IF EXISTS `playlist_data`; CREATE TABLE `playlist_data` ( `id` int(11) unsigned NOT NULL auto_increment, `playlist` int(11) unsigned NOT NULL default '0', - `song` int(11) unsigned default NULL, - `dyn_song` text, + `object_id` int(11) unsigned default NULL, + `object_type` varchar(32) NOT NULL default 'song', + `dynamic_song` text, `track` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `playlist` (`playlist`) @@ -358,7 +359,7 @@ CREATE TABLE `preference` ( PRIMARY KEY (`id`), KEY `catagory` (`catagory`), KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=52; +) TYPE=MyISAM AUTO_INCREMENT=56; -- -- Dumping data for table `preference` @@ -366,7 +367,7 @@ CREATE TABLE `preference` ( LOCK TABLES `preference` WRITE; /*!40000 ALTER TABLE `preference` DISABLE KEYS */; -INSERT INTO `preference` VALUES (1,'download','0','Allow Downloads',100,'boolean','options'),(4,'popular_threshold','10','Popular Threshold',25,'integer','interface'),(19,'sample_rate','32','Downsample Bitrate',25,'string','streaming'),(22,'site_title','Ampache :: Pour l\'Amour de la Musique','Website Title',100,'string','system'),(23,'lock_songs','0','Lock Songs',100,'boolean','system'),(24,'force_http_play','1','Forces Http play regardless of port',100,'boolean','system'),(25,'http_port','80','Non-Standard Http Port',100,'integer','system'),(26,'catalog_echo_count','50','Catalog Echo Interval',100,'integer','system'),(41,'localplay_controller','0','Localplay Type',100,'special','streaming'),(29,'play_type','stream','Type of Playback',25,'special','streaming'),(30,'direct_link','1','Allow Direct Links',100,'boolean','options'),(31,'lang','en_US','Language',100,'special','interface'),(32,'playlist_type','m3u','Playlist Type',100,'special','streaming'),(33,'theme_name','classic','Theme',0,'special','interface'),(34,'ellipse_threshold_album','27','Album Ellipse Threshold',0,'integer','interface'),(35,'ellipse_threshold_artist','27','Artist Ellipse Threshold',0,'integer','interface'),(36,'ellipse_threshold_title','27','Title Ellipse Threshold',0,'integer','interface'),(51,'offset_limit','50','Offset Limit',5,'integer','interface'),(40,'localplay_level','0','Localplay Access Level',100,'special','streaming'),(43,'allow_downsample_playback','0','Allow Downsampling',100,'boolean','system'),(44,'allow_stream_playback','1','Allow Streaming',100,'boolean','system'),(45,'allow_democratic_playback','0','Allow Democratic Play',100,'boolean','system'),(46,'allow_localplay_playback','0','Allow Localplay Play',100,'boolean','system'),(47,'stats_threshold','7','Statistics Day Threshold',25,'integer','interface'),(49,'min_object_count','1','Min Element Count',5,'integer','interface'),(50,'random_method','default','Random Method',5,'string','interface'); +INSERT INTO `preference` VALUES (1,'download','0','Allow Downloads',100,'boolean','options'),(4,'popular_threshold','10','Popular Threshold',25,'integer','interface'),(19,'sample_rate','32','Transcode Bitrate',25,'string','streaming'),(22,'site_title','Ampache :: Pour l\'Amour de la Musique','Website Title',100,'string','system'),(23,'lock_songs','0','Lock Songs',100,'boolean','system'),(24,'force_http_play','1','Forces Http play regardless of port',100,'boolean','system'),(25,'http_port','80','Non-Standard Http Port',100,'integer','system'),(26,'catalog_echo_count','100','Catalog Echo Interval',100,'integer','system'),(41,'localplay_controller','0','Localplay Type',100,'special','streaming'),(29,'play_type','stream','Type of Playback',25,'special','streaming'),(30,'direct_link','1','Allow Direct Links',100,'boolean','options'),(31,'lang','en_US','Language',100,'special','interface'),(32,'playlist_type','m3u','Playlist Type',100,'special','playlist'),(33,'theme_name','classic','Theme',0,'special','interface'),(34,'ellipse_threshold_album','27','Album Ellipse Threshold',0,'integer','interface'),(35,'ellipse_threshold_artist','27','Artist Ellipse Threshold',0,'integer','interface'),(36,'ellipse_threshold_title','27','Title Ellipse Threshold',0,'integer','interface'),(51,'offset_limit','50','Offset Limit',5,'integer','interface'),(40,'localplay_level','0','Localplay Access Level',100,'special','streaming'),(44,'allow_stream_playback','1','Allow Streaming',100,'boolean','system'),(45,'allow_democratic_playback','0','Allow Democratic Play',100,'boolean','system'),(46,'allow_localplay_playback','0','Allow Localplay Play',100,'boolean','system'),(47,'stats_threshold','7','Statistics Day Threshold',25,'integer','interface'),(49,'min_object_count','1','Min Element Count',5,'integer','interface'),(52,'rate_limit','8192','Rate Limit',100,'integer','streaming'),(53,'playlist_method','normal','Playlist Method',5,'string','playlist'),(54,'playlist_add','append','Add Behavior',5,'string','playlist'),(55,'transcode','default','Transcoding',25,'string','streaming'); /*!40000 ALTER TABLE `preference` ENABLE KEYS */; UNLOCK TABLES; @@ -380,7 +381,7 @@ CREATE TABLE `rating` ( `user` int(11) NOT NULL, `object_type` enum('artist','album','song','steam','video') NOT NULL default 'artist', `object_id` int(11) unsigned NOT NULL default '0', - `user_rating` enum('00','0','1','2','3','4','5') NOT NULL default '0', + `rating` enum('-1','0','1','2','3','4','5') NOT NULL default '0', PRIMARY KEY (`id`), KEY `object_id` (`object_id`) ) TYPE=MyISAM; @@ -400,10 +401,10 @@ UNLOCK TABLES; DROP TABLE IF EXISTS `session`; CREATE TABLE `session` ( - `id` varchar(32) NOT NULL default '', + `id` varchar(64) NOT NULL, `username` varchar(16) NOT NULL default '', `expire` int(11) unsigned NOT NULL default '0', - `value` text NOT NULL, + `value` longtext NOT NULL, `ip` int(11) unsigned default NULL, `type` enum('sso','mysql','ldap','http') NOT NULL default 'mysql', PRIMARY KEY (`id`), @@ -420,6 +421,29 @@ LOCK TABLES `session` WRITE; UNLOCK TABLES; -- +-- Table structure for table `session_stream` +-- + +DROP TABLE IF EXISTS `session_stream`; +CREATE TABLE `session_stream` ( + `id` varchar(64) NOT NULL, + `user` int(11) unsigned NOT NULL, + `agent` varchar(255) default NULL, + `expire` int(11) unsigned NOT NULL, + `ip` int(11) unsigned default NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM; + +-- +-- Dumping data for table `session_stream` +-- + +LOCK TABLES `session_stream` WRITE; +/*!40000 ALTER TABLE `session_stream` DISABLE KEYS */; +/*!40000 ALTER TABLE `session_stream` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `song` -- @@ -569,6 +593,7 @@ DROP TABLE IF EXISTS `tmp_playlist_data`; CREATE TABLE `tmp_playlist_data` ( `id` int(11) unsigned NOT NULL auto_increment, `tmp_playlist` int(11) unsigned NOT NULL, + `object_type` varchar(32) default NULL, `object_id` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `tmp_playlist` (`tmp_playlist`) @@ -591,7 +616,8 @@ DROP TABLE IF EXISTS `update_info`; CREATE TABLE `update_info` ( `key` varchar(128) NOT NULL default '', `value` varchar(255) NOT NULL default '', - UNIQUE KEY `key` (`key`) + UNIQUE KEY `key_2` (`key`), + KEY `key` (`key`) ) TYPE=MyISAM; -- @@ -600,7 +626,7 @@ CREATE TABLE `update_info` ( LOCK TABLES `update_info` WRITE; /*!40000 ALTER TABLE `update_info` DISABLE KEYS */; -INSERT INTO `update_info` VALUES ('db_version','340003'); +INSERT INTO `update_info` VALUES ('db_version','340008'); /*!40000 ALTER TABLE `update_info` ENABLE KEYS */; UNLOCK TABLES; @@ -656,6 +682,34 @@ LOCK TABLES `user_preference` WRITE; UNLOCK TABLES; -- +-- Table structure for table `user_shout` +-- + +DROP TABLE IF EXISTS `user_shout`; +CREATE TABLE `user_shout` ( + `id` int(11) unsigned NOT NULL auto_increment, + `user` int(11) NOT NULL, + `text` text NOT NULL, + `date` int(11) unsigned NOT NULL, + `sticky` tinyint(1) unsigned NOT NULL default '0', + `object_id` int(11) unsigned NOT NULL, + `object_type` varchar(32) NOT NULL, + PRIMARY KEY (`id`), + KEY `sticky` (`sticky`), + KEY `date` (`date`), + KEY `user` (`user`) +) TYPE=MyISAM; + +-- +-- Dumping data for table `user_shout` +-- + +LOCK TABLES `user_shout` WRITE; +/*!40000 ALTER TABLE `user_shout` DISABLE KEYS */; +/*!40000 ALTER TABLE `user_shout` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `user_vote` -- @@ -684,4 +738,4 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2007-05-14 7:11:20 +-- Dump completed on 2007-08-05 22:13:37 diff --git a/templates/show_playlist_row.inc.php b/templates/show_playlist_row.inc.php new file mode 100644 index 00000000..f4c4cc3b --- /dev/null +++ b/templates/show_playlist_row.inc.php @@ -0,0 +1,35 @@ +<?php +/* + + Copyright (c) 2001 - 2007 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. + +*/ +?> +<td> + <?php echo Ajax::button('?action=basket&type=playlist&id=' . $playlist->id,'add',_('Add'),'add_playlist_' . $playlist->id); ?> + <?php echo Ajax::button('?action=basket&type=playlist_random&id=' . $playlist->id,'random',_('Random'),'random_playlist_' . $playlist->id); ?> +</td> +<td><?php echo $playlist->f_link; ?></td> +<td><?php echo $count; ?></td> +<td><?php echo scrub_out($playlist->f_user); ?></td> +<td> + <?php if (Access::check_function('batch_download')) { ?> + <a href="<?php echo Config::get('web_path'); ?>/batch.php?action=playlist&id=<?php echo $playlist->id; ?>"> + <?php echo get_user_icon('batch_download',_('Batch Download')); ?> + </a> + <?php } ?> +</td> diff --git a/templates/show_playlists.inc.php b/templates/show_playlists.inc.php index ca07c5ef..4b925fe8 100644 --- a/templates/show_playlists.inc.php +++ b/templates/show_playlists.inc.php @@ -19,13 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - ?> <table class="tabledata" cellspacing="0" cellpadding="0" border="0"> <!-- Playlist Table --> <tr class="table-header"> - <th align="center"> - - </th> + <th> </th> <th><?php echo _('Playlist Name'); ?></th> <th><?php echo _('# Songs'); ?></th> <th><?php echo _('Owner'); ?></th> @@ -34,39 +31,11 @@ <?php foreach ($object_ids as $playlist_id) { $playlist = new Playlist($playlist_id); + $playlist->format(); $count = $playlist->get_song_count(); ?> - <tr class="<?php echo flip_class(); ?>"> - <td align="center"> - </td> - <td> - <a href="<?php echo $web_path; ?>/playlist.php?action=show_playlist&playlist_id=<?php echo $playlist->id; ?>"> - <?php echo scrub_out($playlist->name); ?> - </a> - </td> - <td><?php echo $count; ?></td> - <td><?php echo scrub_out($playlist_user->fullname); ?></td> - <td> - | <a href="<?php echo $web_path; ?>/playlist.php?action=show_playlist&playlist_id=<?php echo $playlist->id; ?>"> - <?php echo _('View'); ?></a> - <?php if (($GLOBALS['user']->username == $playlist->user) || ($GLOBALS['user']->has_access(100))) { ?> - | <a href="<?php echo $web_path; ?>/playlist.php?action=edit&playlist_id=<?php echo $playlist->id; ?>"> - <?php echo _('Edit'); ?></a> - | <a href="<?php echo $web_path; ?>/playlist.php?action=show_delete_playlist&playlist_id=<?php echo $playlist->id; ?>"> - <?php echo _('Delete'); ?></a> - <?php } ?> - <?php if ($count > 0) { ?> - | <a href="<?php echo $web_path; ?>/stream.php?action=playlist&playlist_id=<?php echo $playlist->id; ?>"> - <?php echo _('Play'); ?></a> - | <a href="<?php echo $web_path; ?>/stream.php?action=playlist_random&playlist_id=<?php echo $playlist->id; ?>"> - <?php echo _('Random'); ?></a> - <?php if (batch_ok()) { ?> - | <a href="<?php echo $web_path; ?>/batch.php?action=pl&id=<?php echo $playlist->id; ?>"> - <?php echo _('Download'); ?></a> - <?php } ?> - <?php } ?> - | - </td> - </tr> +<tr class="<?php echo flip_class(); ?>" id="playlist_row_<?php echo $playlist->id; ?>"> + <?php require Config::get('prefix') . '/templates/show_playlist_row.inc.php'; ?> +</tr> <?php } // end foreach ($playlists as $playlist) ?> </table> |