summaryrefslogtreecommitdiffstats
path: root/server/ajax.server.php
diff options
context:
space:
mode:
authorPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-06-09 01:35:50 +0000
committerPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-06-09 01:35:50 +0000
commitb95a7b1ecc22abeddb786105e6b9cb1417fd2735 (patch)
tree2847bbd9b370f50379082f4c60fea8b37e139ce6 /server/ajax.server.php
parenta22acbd014dae01d10639779777819d630e85b40 (diff)
downloadampache-b95a7b1ecc22abeddb786105e6b9cb1417fd2735.tar.gz
ampache-b95a7b1ecc22abeddb786105e6b9cb1417fd2735.tar.bz2
ampache-b95a7b1ecc22abeddb786105e6b9cb1417fd2735.zip
I should have done it this way in the first place, instead of that ugly
show_playlist_full_row hack.
Diffstat (limited to 'server/ajax.server.php')
-rw-r--r--server/ajax.server.php61
1 files changed, 46 insertions, 15 deletions
diff --git a/server/ajax.server.php b/server/ajax.server.php
index 653b6173..d2fce49c 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -98,28 +98,28 @@ switch ($_REQUEST['action']) {
$level = '50';
switch ($_GET['type']) {
- case 'album':
+ case 'album_row':
$key = 'album_' . $_GET['id'];
$album = new Album($_GET['id']);
$album->format();
break;
- case 'artist':
+ case 'artist_row':
$key = 'artist_' . $_GET['id'];
$artist = new Artist($_GET['id']);
$artist->format();
break;
- case 'song':
+ case 'song_row':
$key = 'song_' . $_GET['id'];
$song = new Song($_GET['id']);
$song->format();
break;
- case 'live_stream':
+ case 'live_stream_row':
$key = 'live_stream_' . $_GET['id'];
$radio = new Radio($_GET['id']);
$radio->format();
break;
- case 'playlist':
- case 'playlist_full':
+ case 'playlist_row':
+ case 'playlist_title':
$key = 'playlist_row_' . $_GET['id'];
$playlist = new Playlist($_GET['id']);
$playlist->format();
@@ -128,6 +128,15 @@ switch ($_REQUEST['action']) {
$level = '25';
}
break;
+ case 'smartplaylist_row':
+ case 'smartplaylist_title':
+ $key = 'playlist_row_' . $_GET['id'];
+ $playlist = new Search('song', $_GET['id']);
+ $playlist->format();
+ if ($playlist->user == $GLOBALS['user']->id) {
+ $level = '25';
+ }
+ break;
default:
$key = 'rfc3514';
echo xml_from_array(array($key=>'0x1'));
@@ -142,7 +151,7 @@ switch ($_REQUEST['action']) {
}
ob_start();
- require Config::get('prefix') . '/templates/show_edit_' . $_GET['type'] . '_row.inc.php';
+ require Config::get('prefix') . '/templates/show_edit_' . $_GET['type'] . '.inc.php';
$results[$key] = ob_get_contents();
ob_end_clean();
break;
@@ -150,12 +159,19 @@ switch ($_REQUEST['action']) {
$level = '50';
- if ($_POST['type'] == 'playlist' || $_POST['type'] == 'playlist_full') {
+ if ($_POST['type'] == 'playlist_row' || $_POST['type'] == 'playlist_title') {
$playlist = new Playlist($_POST['id']);
if ($GLOBALS['user']->id == $playlist->user) {
$level = '25';
}
}
+ if ($_POST['type'] == 'smartplaylist_row' ||
+ $_POST['type'] == 'smartplaylist_title') {
+ $playlist = new Search('song', $_POST['id']);
+ if ($GLOBALS['user']->id == $playlist->user) {
+ $level = '25';
+ }
+ }
// Make sure we've got them rights
if (!Access::check('interface',$level) || Config::get('demo_mode')) {
@@ -164,7 +180,7 @@ switch ($_REQUEST['action']) {
}
switch ($_POST['type']) {
- case 'album':
+ case 'album_row':
$key = 'album_' . $_POST['id'];
$album = new Album($_POST['id']);
$songs = $album->get_songs();
@@ -177,7 +193,7 @@ switch ($_REQUEST['action']) {
}
$album->format();
break;
- case 'artist':
+ case 'artist_row':
$key = 'artist_' . $_POST['id'];
$artist = new Artist($_POST['id']);
$songs = $artist->get_songs();
@@ -190,21 +206,29 @@ switch ($_REQUEST['action']) {
}
$artist->format();
break;
- case 'song':
+ case 'song_row':
$key = 'song_' . $_POST['id'];
$song = new Song($_POST['id']);
Flag::add($song->id,'song','retag','Inline Single Song Update');
$song->update($_POST);
$song->format();
break;
- case 'playlist':
- case 'playlist_full':
+ case 'playlist_row':
+ case 'playlist_title':
$key = 'playlist_row_' . $_POST['id'];
$playlist->update($_POST);
$playlist->format();
$count = $playlist->get_song_count();
break;
- case 'live_stream':
+ case 'smartplaylist_row':
+ case 'smartplaylist_title':
+ $key = 'playlist_row_' . $_POST['id'];
+ $playlist->name = $_POST['name'];
+ $playlist->type = $_POST['pl_type'];
+ $playlist->update();
+ $playlist->format();
+ break;
+ case 'live_stream_row':
$key = 'live_stream_' . $_POST['id'];
Radio::update($_POST);
$radio = new Radio($_POST['id']);
@@ -218,7 +242,7 @@ switch ($_REQUEST['action']) {
} // end switch on type
ob_start();
- require Config::get('prefix') . '/templates/show_' . $_POST['type'] . '_row.inc.php';
+ require Config::get('prefix') . '/templates/show_' . $_POST['type'] . '.inc.php';
$results[$key] = ob_get_contents();
ob_end_clean();
break;
@@ -275,6 +299,13 @@ switch ($_REQUEST['action']) {
$GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']);
}
break;
+ case 'smartplaylist':
+ $playlist = new Search('song', $_REQUEST['id']);
+ $items = $playlist->get_items();
+ foreach ($items as $item) {
+ $GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']);
+ }
+ break;
case 'clear_all':
$GLOBALS['user']->playlist->clear();
break;