summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/album.lib.php2
-rw-r--r--lib/class/browse.class.php13
-rw-r--r--lib/class/playlist.class.php7
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/album.lib.php b/lib/album.lib.php
index bf491c2a..3216b35e 100644
--- a/lib/album.lib.php
+++ b/lib/album.lib.php
@@ -116,7 +116,7 @@ function get_random_albums($count=6) {
$sql = 'SELECT ';
- for ($i = 0; $i < ceil($count * 1.5); $i++) {
+ for ($i = 0; $i < ceil($count * 2); $i++) {
if ($i > 0) $sql .= ', ';
$sql .= 'floor(rand() * count(id))';
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index ae82d271..6eda41c7 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -62,7 +62,6 @@ class Browse {
switch ($key) {
case 'show_art':
- $key = $_REQUEST['key'];
if ($_SESSION['browse']['filter'][$key]) {
unset($_SESSION['browse']['filter'][$key]);
}
@@ -80,6 +79,11 @@ class Browse {
if ($value == _('All')) { $value = ''; }
$_SESSION['browse']['filter'][$key] = $value;
break;
+ case 'playlist_type':
+ // They must be content managers to turn this off
+ if ($_SESSION['browse']['filter'][$key] AND Access::check('interface','50')) { unset($_SESSION['browse']['filter'][$key]); }
+ else { $_SESSION['browse']['filter'][$key] = '1'; }
+ break;
default:
// Rien a faire
return false;
@@ -477,6 +481,10 @@ class Browse {
case 'alpha_match':
$filter_sql = " `playlist`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
break;
+ case 'playlist_type':
+ $user_id = intval($GLOBALS['user']->id);
+ $filter_sql = " (`playlist`.`type` = 'public' OR `playlist`.`user`='$user_id') AND ";
+ break;
default;
// Rien a faire
break;
@@ -553,6 +561,9 @@ class Browse {
case 'name':
$sql = "`playlist`.`name`";
break;
+ case 'user':
+ $sql = "`playlist`.`user`";
+ break;
} // end switch
break;
case 'live_stream':
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index 8310219c..b5cb8f71 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -78,6 +78,8 @@ class Playlist {
$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&amp;playlist_id=' . $this->id . '">' . $this->f_name . '</a>';
+ $this->f_type = ($this->type == 'private') ? get_user_icon('lock',_('Private')) : '';
+
$client = new User($this->user);
$this->f_user = $client->fullname;
@@ -263,6 +265,9 @@ class Playlist {
if ($data['name'] != $this->name) {
$this->update_name($data['name']);
}
+ if ($data['pl_type'] != $this->type) {
+ $this->update_type($data['pl_type']);
+ }
} // update
@@ -296,7 +301,7 @@ class Playlist {
*/
private function _update_item($field,$value,$level) {
- if ($GLOBALS['user']->id != $this->user AND !$GLOBALS['user']->has_access($level)) {
+ if ($GLOBALS['user']->id != $this->user AND !Access::check('interface',$level)) {
return false;
}