diff options
-rw-r--r-- | lib/class/song.class.php | 11 | ||||
-rw-r--r-- | lib/song.php | 34 | ||||
-rw-r--r-- | modules/lib.php | 32 |
3 files changed, 40 insertions, 37 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 47600ee5..8349208d 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -44,6 +44,7 @@ class Song { var $type; var $mime; var $played; + var $enabled; var $addition_time; var $update_time; @@ -85,7 +86,7 @@ class Song { $this->flaguser = $info->flaguser; $this->flagtype = $info->flagtype; $this->flagcomment = $info->flagcomment; - $this->status = $info->status; + $this->enabled = $info->enabled; // Format the Type of the song $this->format_type(); @@ -105,7 +106,7 @@ class Song { /* Grab the basic information from the catalog and return it */ $sql = "SELECT song.id,file,catalog,album,song.comment,year,artist,". - "title,bitrate,rate,mode,size,time,track,genre,played,status,update_time,". + "title,bitrate,rate,mode,size,time,track,genre,played,song.enabled,update_time,". "addition_time,flagged.id as flagid,flagged.user as flaguser,flagged.type ". "as flagtype,flagged.date as flagdate,flagged.comment as flagcomment FROM ". "song LEFT JOIN flagged ON song.id = flagged.song WHERE song.id = '$this->id'"; @@ -327,7 +328,7 @@ class Song { $this->update_album($new_song->album,$song_id); $this->update_year($new_song->year,$song_id); $this->update_comment($new_song->comment,$song_id); - $this->update_played('false',$song_id); + $this->update_played(0,$song_id); $this->update_utime($song_id); } // update_song @@ -505,7 +506,7 @@ class Song { function update_enabled($new_enabled,$song_id=0) { if ($_SESSION['userdata']['access'] === 'admin' || $_SESSION['userdata']['access'] === '100') { - $this->update_item('status',$new_enabled,$song_id); + $this->update_item('enabled',$new_enabled,$song_id); } } // update_enabled @@ -575,7 +576,7 @@ class Song { // Set style if (preg_match("/id3/", $this->flagtype)) { $this->f_style = "style=\"color: #33c;\""; } elseif (preg_match("/(mp3|del|sort|ren)/", $this->flagtype)) { $this->f_style = "style=\"color: #C00;\""; } - if ($this->status === 'disabled') { $this->f_style = "style=\"text-decoration: line-through;\""; } + if (!$this->enabled) { $this->f_style = "style=\"text-decoration: line-through;\""; } return true; diff --git a/lib/song.php b/lib/song.php index 0e847ad9..7c9a3282 100644 --- a/lib/song.php +++ b/lib/song.php @@ -53,5 +53,39 @@ function format_song($song) { } // format_song +/** + * get_popular_songs + * This returns the current popular songs + * @package Stream + * @catagory Get + */ +function get_popular_songs( $threshold, $type, $user_id = '' ) { + + $dbh = dbh(); + + if ( $type == 'your' ) { + $sql = "SELECT object_id FROM object_count" . + " WHERE object_type = 'song'" . + " AND userid = '$user_id'" . + " ORDER BY count DESC LIMIT $threshold"; + } + else { + $sql = "SELECT object_id FROM object_count" . + " WHERE object_type = 'song'" . + " ORDER BY count DESC LIMIT $threshold"; + } + + $db_result = mysql_query($sql, $dbh); + $songs = array(); + + while ( $id = mysql_fetch_array($db_result) ) { + $songs[] = $id[0]; + } + + return $songs; + +} // get_popular_songs() + + ?> diff --git a/modules/lib.php b/modules/lib.php index 2d8adef8..2f89fbbe 100644 --- a/modules/lib.php +++ b/modules/lib.php @@ -104,38 +104,6 @@ function show_local_catalog_info() { /* - * get_popular_songs() - * - */ - -function get_popular_songs( $threshold, $type, $user_id = '' ) { - - $dbh = dbh(); - - if ( $type == 'your' ) { - $sql = "SELECT object_id FROM object_count" . - " WHERE object_type = 'song'" . - " AND userid = '$user_id'" . - " ORDER BY count DESC LIMIT $threshold"; - } - else { - $sql = "SELECT object_id FROM object_count" . - " WHERE object_type = 'song'" . - " ORDER BY count DESC LIMIT $threshold"; - } - - $db_result = mysql_query($sql, $dbh); - $songs = array(); - - while ( $id = mysql_fetch_array($db_result) ) { - $songs[] = $id[0]; - } - - return $songs; -} // get_popular_songs() - - -/* * show_random_play() * */ |