diff options
-rw-r--r-- | lib/class/song.class.php | 4 | ||||
-rw-r--r-- | lib/class/update.class.php | 105 | ||||
-rw-r--r-- | lib/init.php | 5 | ||||
-rw-r--r-- | modules/infotools/AmazonSearchEngine.class.php (renamed from modules/amazon/AmazonSearchEngine.class.php) | 0 | ||||
-rw-r--r-- | modules/infotools/Snoopy.class.php (renamed from modules/amazon/Snoopy.class.php) | 0 | ||||
-rw-r--r-- | modules/infotools/jamendoSearch.class.php (renamed from modules/amazon/jamendoSearch.class.php) | 0 | ||||
-rwxr-xr-x | modules/slimserver/slim.class.php | 168 | ||||
-rw-r--r-- | templates/show_recently_played.inc.php | 13 |
8 files changed, 116 insertions, 179 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 69f86db5..8e3581a5 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -607,8 +607,10 @@ class Song { // Format the title $this->f_title = truncate_with_ellipse($this->title,conf('ellipse_threshold_title')); - // Create A link inclduing the title + // Create Links for the different objects $this->f_link = "<a href=\"" . conf('web_path') . "/song.php?action=single_song&song_id=" . $this->id . "\">$this->f_title</a>"; + $this->f_album_link = "<a href=\"" . conf('web_path') . "/album.php?action=show&album_id=" . $this->album . "\">$this->f_album</a>"; + $this->f_artist_link = "<a href=\"" . conf('web_path') . "/artist.php?action=show&artist_id=" . $this->artist . "\">$this->f_artist</a>"; // Format the Bitrate $this->f_bitrate = intval($this->bitrate/1000) . "-" . strtoupper($this->mode); diff --git a/lib/class/update.class.php b/lib/class/update.class.php index c3fdac68..41d56f3d 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -143,6 +143,31 @@ class Update { } // need_update + /** + * plugins_installed + * This function checks to make sure that there are no plugins + * installed before allowing you to run the update. this is + * to protect the integrity of the database + */ + function plugins_installed() { + + /* Pull all version info */ + $sql = "SELECT * FROM `update_info`"; + $db_results = mysql_query($sql,dbh()); + + while ($results = mysql_fetch_assoc($db_results)) { + + /* We have only one allowed string */ + if ($results['key'] != 'db_version') { + return false; + } + + } // while update_info results + + return true; + + } // plugins_installed + /*! @function populate_version @discussion just sets an array the current differences @@ -304,6 +329,12 @@ class Update { $version[] = array('version' => '333001','description' => $update_string); + $update_string = '- Added object_tag table for Web2.0 Tag information.<br />' . + '- Added song_ext_data for holding comments,lyrics and other large fields, not commonly used.<br />' . + '- Added Timezone as a per user preference.'; + + //$version[] = array('version' => '333002','description' => $update_string); + return $version; } // populate_version @@ -351,6 +382,12 @@ class Update { $sql = "DELETE * FROM session"; $db_results = mysql_query($sql, dbh()); + /* Verify that there are no plugins installed */ + if (!$this->plugins_installed()) { + $GLOBALS['error']->add_error('general',_('Plugins detected, please remove all Plugins and try again')); + return false; + } + $methods = array(); $current_version = $this->get_version(); @@ -1993,5 +2030,73 @@ class Update { } // update_333001 + /** + * update_333002 + * This updated adds two tables and a preference + */ + function update_333002 () { + + /* First add the two tables */ + $sql = "CREATE TABLE `song_ext_data` (`song_id` INT( 11 ) UNSIGNED NOT NULL ,`comment` TEXT NULL ,`lyrics` TEXT NULL , UNIQUE (`song_id`)"; + $db_results = mysql_query($sql,dbh()); + + $sql = "CREATE TABLE `tags` (`map_id` INT( 11 ) UNSIGNED NOT NULL ,`name` VARCHAR( 32 ) NOT NULL ,`order` TINYINT( 2 ) NOT NULL)"; + $db_results = mysql_query($sql,dbh()); + + $sql = "ALTER TABLE `tags` ADD INDEX ( `order` )"; + $db_results = mysql_query($sql,dbh()); + + $sql = "ALTER TABLE `tags` ADD INDEX ( `map_id` )"; + $db_results = mysql_query($sql,dbh()); + + $sql = "CREATE TABLE `tag_map` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,`object_id` INT( 11 ) UNSIGNED NOT NULL ,`object_type` VARCHAR( 16 ) NOT NULL ,`user_id` INT( 11 ) UNSIGNED NOT NULL)"; + $db_results = mysql_query($sql,dbh()); + + $sql = "ALTER TABLE `tag_map` ADD INDEX ( `object_id` )"; + $db_results = mysql_query($sql,dbh()); + + $sql = "ALTER TABLE `tag_map` ADD INDEX ( `object_type` )"; + $db_results = mysql_query($sql,dbh()); + + $sql = "ALTER TABLE `tag_map` ADD INDEX ( `user_id` )"; + $db_results = mysql_query($sql,dbh()); + + /* Move all of the comment data out of the song table */ + $sql = "SELECT id,comment FROM song"; + $db_results = mysql_query($sql,dbh()); + + while ($results = mysql_fetch_assoc($db_results)) { + $song_id = sql_escape($results['id']); + $comment = sql_escape($results['comment']); + + $sql = "INSERT INTO song_ext_data (`song_id`,`comment`) VALUES ('$song_id','$comment')"; + $insert_results = mysql_query($sql,dbh()); + + } // end while comments fetching + + + $sql = "ALTER TABLE `song` DROP `comment`"; + $db_results = mysql_query($sql,dbh()); + + /* Add the Preference for Timezone */ + $sql = "INSERT INTO preferences (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + " VALUES ('time_zone','GMT','Local Timezone','5','string','interface')"; + $db_results = mysql_query($sql,dbh()); + + /* Fix every users preferences */ + $sql = "SELECT * FROM user"; + $db_results = mysql_query($sql, dbh()); + + $user = new User(); + $user->fix_preferences('-1'); + + while ($r = mysql_fetch_assoc($db_results)) { + $user->fix_preferences($r['username']); + } // while results + + $this->set_version('db_version','333002'); + + } // update_333002 + } // end update class ?> diff --git a/lib/init.php b/lib/init.php index 483720fe..5a9895fb 100644 --- a/lib/init.php +++ b/lib/init.php @@ -156,8 +156,9 @@ require_once(conf('prefix') . '/modules/lib.php'); require_once(conf('prefix') . '/modules/catalog.php'); require_once(conf('prefix') . "/modules/id3/getid3/getid3.php"); require_once(conf('prefix') . '/modules/id3/vainfo.class.php'); -require_once(conf('prefix') . '/modules/amazon/Snoopy.class.php'); -require_once(conf('prefix') . '/modules/amazon/AmazonSearchEngine.class.php'); +require_once(conf('prefix') . '/modules/infotools/Snoopy.class.php'); +require_once(conf('prefix') . '/modules/infotools/AmazonSearchEngine.class.php'); +require_once(conf('prefix') . '/modules/infotools/jamendoSearch.class.php'); require_once(conf('prefix') . '/lib/xmlrpc.php'); require_once(conf('prefix') . '/modules/xmlrpc/xmlrpc.inc'); diff --git a/modules/amazon/AmazonSearchEngine.class.php b/modules/infotools/AmazonSearchEngine.class.php index 700d4e95..700d4e95 100644 --- a/modules/amazon/AmazonSearchEngine.class.php +++ b/modules/infotools/AmazonSearchEngine.class.php diff --git a/modules/amazon/Snoopy.class.php b/modules/infotools/Snoopy.class.php index f625f67a..f625f67a 100644 --- a/modules/amazon/Snoopy.class.php +++ b/modules/infotools/Snoopy.class.php diff --git a/modules/amazon/jamendoSearch.class.php b/modules/infotools/jamendoSearch.class.php index b89f1a67..b89f1a67 100644 --- a/modules/amazon/jamendoSearch.class.php +++ b/modules/infotools/jamendoSearch.class.php diff --git a/modules/slimserver/slim.class.php b/modules/slimserver/slim.class.php deleted file mode 100755 index 6b88f9f5..00000000 --- a/modules/slimserver/slim.class.php +++ /dev/null @@ -1,168 +0,0 @@ -<?php
-/**
-*
-* Slimp3-Class
-* for querying the slimp3 and the squeezebox players
-*
-* feel free to modify and use it whereever you want.
-* would be nice if you could send me your changes,
-*
-* Homepage:
-* http://trendwhores.de/slimclass.php
-*
-* Tobias Schlottke <tschlottke chr(64) virtualminds chr(46) de>
-* http://www.trendwhores.de
-*
-* Modifications by Andreas <php chr(64) simply chr(46) nu>
-* + Added more options to slimp3()
-* + Added playlist() /w related options
-* + Modified display() to get strings with spaces instead of +'s provided by urlencode
-* + Modified _parse() to handle new options. Quick'n'dirty hack, could probably be prettier!
-*
-* Updated by Vollmer (vollmer@ampache.org)
-* + Added timeout on fsockopen and error information
-* + Added comments and cleaned up code to fix ampache coding standards
-* License: GPL
-*
-*/
-
-class Slimserver {
-
- var $host = 'localhost';
- var $port = 9090;
-
- var $_connection;
-
- var $playerindex;
- var $playercount;
-
- function Slimserver($host = NULL, $port = 9090) {
-
- if ($host && $port) {
- $this->host = $host;
- $this->port = $port;
- }
-
- /* Attempt to establish connection */
- if (!$this->_connection = fsockopen($this->host, $this->port,$errno,$errstr,'.5')) {
- debug_event('slimserver','Error: Unable to open socket,' . $errno . ' - ' . $errstr,1);
- return false;
- }
-
- $this->playercount = $this->_psend("player count ?");
-
- for($i = 0; $i < $this->playercount; $i++) {
- $this->playerindex[$i]['name'] = $this->_psend("player name $i ?");
- $this->playerindex[$i]['ip'] = $this->_psend("player ip $i ?");
- $this->playerindex[$i]['address'] = $this->_psend("player address $i ?");
-
- # Added some more options /andreas
- $this->playerindex[$i]['mode'] = $this->_psend($this->playerindex[$i]["address"] . " mode ?");
- $this->playerindex[$i]['power'] = $this->_psend($this->playerindex[$i]["address"] . " power ?");
- $this->playerindex[$i]['volume'] = $this->_psend($this->playerindex[$i]["address"] . " mixer volume ?");
- $this->playerindex[$i]['treble'] = $this->_psend($this->playerindex[$i]["address"] . " mixer treble ?");
- $this->playerindex[$i]['bass'] = $this->_psend($this->playerindex[$i]["address"] . " mixer bass ?");
- $this->playerindex[$i]['tracks'] = $this->_psend($this->playerindex[$i]["address"] . " info total songs ?");
- $this->playerindex[$i]['albums'] = $this->_psend($this->playerindex[$i]["address"] . " info total albums ?");
- $this->playerindex[$i]['artists'] = $this->_psend($this->playerindex[$i]["address"] . " info total artists ?");
- $this->playerindex[$i]['genres'] = $this->_psend($this->playerindex[$i]["address"] . " info total genres ?");
- }
-
- return true;
-
- } // end constructor
-
- function nowplaying($player = 0) {
- $song = array(
- "artist" => $this->_psend("artist $player ?"),
- "title" => $this->_psend("title $player ?"),
- "path" => $this->_psend("path $player ?"),
- "duration" => $this->_psend("duration $player ?"),
- "genre" => $this->_psend("genre $player ?"),
- "album" => $this->_psend("album $player ?")
- );
- return $song;
- }
-
- # Added playlist() for related options /andreas
- function playlist($player = 0) {
- #Information related to playlist!
- $index = $this->_psend("playlist index ?");
- $index++;
- $song = array(
- "index" => $index,
- "total" => $this->_psend("playlist tracks ?"),
- # Spaces added to the end of the two first below, quick'n'dirty fix for parsing error... ;)
- "nextartist" => $this->_psend("playlist artist " . $index . " "),
- "nexttitle" => $this->_psend("playlist title " . $index . " "),
- "shuffle" => $this->_psend("playlist shuffle ?"),
- "repeat" => $this->_psend("playlist repeat ?")
- );
- return $song;
- }
-
-
- function display($l1, $l2, $duration = 5, $player = 0) {
- #$this->_send("display ".urlencode($l1)." ".urlencode($l2)." ".$duration);
- # above code gave me urlencoded strings on my displat, ie "Hello%20World", below did not... /andreas (php chr(64) simply chr(46) nu)
- $l1 = str_replace(" ", "%20", $l1);
- $l2 = str_replace(" ", "%20", $l2);
- $this->_send("display ".$l1." ".$l2." ".$duration);
- }
-
- function cdisplay() {
- return urldecode($this->_send("display ? ?"));
- }
-
- function close() {
- $this->_send("exit");
- return true;
- }
- # Modified by andreas (php chr(64) simply chr(46) nu)
- # Don't ask why I did stuff here, don't remember ;)
- function _parse($string, $cmd = NULL) {
-
- if (!$cmd);
- $cmd = $this->_lastcmd;
-
- $quoted = preg_quote(substr($cmd, 0, -1), "\\");
-
- if (preg_match("/^".$quoted."(.*)/i", $string, $matches)) {
- $dec = urldecode(trim($matches[1]));
- return $dec;
- } elseif(preg_match("/^".substr($quoted, 0, -2)."(.*)/i", $string, $matches)) {
- $dec = urldecode(trim($matches[1]));
- if (substr($dec, -1, 1) == '?')
- return substr($dec, 0, -1);
- else
- return $dec;
-
- # extra parsing for cmd's where MAC address is involved. Me not good at regexps so... ;)
- } elseif(preg_match("/^".$quoted."(.*)/i", urldecode(trim($string)), $matches)) {
- $dec = trim($matches[1]);
- if ($dec == "0")
- return "play";
- else
- return $dec;
- } else {
- return "unable to parse reply: ".$string."<br>(cmd was: $cmd)";
- }
- }
-
- function _send($string) {
-
- $this->_lastcmd = $string;
-
- if (fputs($this->_connection, $string."\n"))
- return fgets($this->_connection);
- else
- return false;
- }
-
- function _psend($string) {
- return $this->_parse($this->_send($string));
- }
-
-}
-
-?>
diff --git a/templates/show_recently_played.inc.php b/templates/show_recently_played.inc.php index eeae6186..a3afad34 100644 --- a/templates/show_recently_played.inc.php +++ b/templates/show_recently_played.inc.php @@ -24,22 +24,19 @@ <tr class="table-header"> <td><?php echo _('Username'); ?></td> <td><?php echo _('Song'); ?></td> - <td><?php echo _('Date'); ?></td> + <td><?php echo _('Album'); ?></td> + <td><?php echo _('Artist'); ?></td> </tr> <?php foreach ($data as $row) { $row_user = new User($row['user']); $song = new Song($row['object_id']); $song->format_song(); - /* Prepare the variables */ - $title = scrub_out(truncate_with_ellipse($song->title,'25')); - $album = scrub_out(truncate_with_ellipse($song->f_album_full,'25')); - $artist = scrub_out(truncate_with_ellipse($song->f_artist_full,'25')); - $song_name = $title . ' - ' . $album . '/' . $artist; ?> <tr> <td><?php echo scrub_out($row_user->fullname); ?></td> - <td><?php echo $song_name; ?></td> - <td><?php echo date("d/m/Y H:i:s",$row['date']); ?></td> + <td><?php echo $song->f_link; ?></td> + <td><?php echo $song->f_album_link; ?></td> + <td><?php echo $song->f_artist_link; ?></td> </tr> <?php } ?> </table> |