diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-08 06:38:06 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-08 06:38:06 +0000 |
commit | db10ee8e7883dc00c3e2f559532124f842f59e5d (patch) | |
tree | 45f82abd3c60ae598a9f829035d2424ffe0d5794 /lib/class/playlist.class.php | |
parent | 2bb59dfa45f008846305c62962616bd3fff3884d (diff) | |
download | ampache-db10ee8e7883dc00c3e2f559532124f842f59e5d.tar.gz ampache-db10ee8e7883dc00c3e2f559532124f842f59e5d.tar.bz2 ampache-db10ee8e7883dc00c3e2f559532124f842f59e5d.zip |
a few tweaks
Diffstat (limited to 'lib/class/playlist.class.php')
-rw-r--r-- | lib/class/playlist.class.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index f0ef69ff..c89ac420 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -92,7 +92,7 @@ class Playlist { */ function get_items() { - $sql = "SELECT * FROM playlist_data WHERE playlist='" . sql_escape($this->id) . "'"; + $sql = "SELECT * FROM playlist_data WHERE playlist='" . sql_escape($this->id) . "' ORDER BY track"; $db_results = mysql_query($sql, dbh()); while ($r = mysql_fetch_assoc($db_results)) { @@ -198,6 +198,34 @@ class Playlist { } // get_song_count /** + * has_access + * This takes no arguments. It looks at the currently logged in user (_SESSION) + * This accounts for admin powers and the access on a per list basis + */ + function has_access() { + + if (!$GLOBALS['user']->has_access(25)) { return false; } + + /* If they are a full admin, then they always get rights */ + if ($GLOBALS['user']->has_access(100)) { return true; } + + if ($this->user == $GLOBALS['user']->username) { return true; } + + /* Check the Playlist_permission table */ + $sql = "SELECT id FROM playlist_permission WHERE " . + "playlist='" . sql_escape($this->id) . "' AND userid='" . sql_escape($GLOBALS['user']->username) . "'" . + " AND level >= '25'"; + $db_results = mysql_query($sql, dbh()); + + $results = mysql_fetch_row($db_results); + + if ($results) { return true; } + + return false; + + } // has_access + + /** * update_type * This updates the playlist type, it calls the generic update_item function */ |