diff options
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rwxr-xr-x | modules/kajax/ajax.js | 83 | ||||
-rw-r--r-- | playlist.php | 70 | ||||
-rw-r--r-- | templates/show_playlist.inc.php | 9 |
4 files changed, 58 insertions, 105 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 018c14d8..6e2bd506 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.4-Alpha2 + - Fixed copyright notices (Thx porthose) - Fixed single downloads - Fixed weird CSS issue with a crafty little hack - Fixed a session fixation issue diff --git a/modules/kajax/ajax.js b/modules/kajax/ajax.js index 976808ce..1d6b57e8 100755 --- a/modules/kajax/ajax.js +++ b/modules/kajax/ajax.js @@ -1,39 +1,53 @@ - var http_request = false;
- var IE = true;
-
- // uid is an array of uids that need to be replaced
- function ajaxPut(url,source) {
+// Copyright (c) 2001 - 2007 Ampache.org
+// All rights reserved.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License v2
+// as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// uid is an array of uids that need to be replaced
+function ajaxPut(url,source) {
- if (document.getElementById(source)) {
- Event.stopObserving(source,'click',function(){ajaxPut(url,source);});
- }
+ if (document.getElementById(source)) {
+ Event.stopObserving(source,'click',function(){ajaxPut(url,source);});
+ }
- if (window.ActiveXObject) { // IE
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e) {}
- }
- }
- else { // Mozilla
- IE = false;
- http_request = new XMLHttpRequest();
+ if (window.ActiveXObject) { // IE
+ try {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e) {
+ try {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (e) {}
}
- if (!http_request) {
- return false;
- }
- http_request.onreadystatechange = function() { getContents(http_request); };
- http_request.open('GET', url, true);
- http_request.send(null);
+ }
+ else { // Mozilla
+ IE = false;
+ http_request = new XMLHttpRequest();
}
+ if (!http_request) {
+ return false;
+ }
+ http_request.onreadystatechange = function() { getContents(http_request); };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+}
+
- function getContents(http_request) {
- if (http_request.readyState == 4) {
- if (http_request.status == 200) {
+function getContents(http_request) {
+ if (http_request.readyState == 4) {
+ if (http_request.status == 200) {
var data = http_request.responseXML;
var newContent = http_request.responseXML.getElementsByTagName('content');
@@ -47,9 +61,9 @@ }
}
- }
+}
- function ajaxPost(url,input,source) {
+function ajaxPost(url,input,source) {
if (document.getElementById(source)) {
Event.stopObserving(source,'click',function(){ajaxPost(url,input,source);});
@@ -91,6 +105,5 @@ http_request.setRequestHeader("Connection", "close");
http_request.send(post_data);
-
- }
+}
diff --git a/playlist.php b/playlist.php index 3477ec2d..baff2e21 100644 --- a/playlist.php +++ b/playlist.php @@ -28,63 +28,9 @@ require_once 'lib/init.php'; show_header(); -/* Get the Vars we need for later cleaned up */ -$action = strtolower(scrub_in($_REQUEST['action'])); -$playlist = new Playlist(scrub_in($_REQUEST['playlist_id'])); /* Switch on the action passed in */ -switch ($action) { - case 'delete_playlist': - /* Make sure they have the rights */ - if (!$playlist->has_access()) { - access_denied(); - break; - } - /* Go for it! */ - $playlist->delete(); - show_confirmation(_('Playlist Deleted'),_('The Requested Playlist has been deleted'),'/playlist.php'); - break; - case 'show_delete_playlist': - /* Make sure they have the rights */ - if (!$playlist->has_access()) { - access_denied(); - break; - } - - /* Show Confirmation Question */ - $message = _('Are you sure you want to delete this playlist') . " " . $playlist->name . "?"; - show_confirmation(_('Confirm Action'),$message,'/playlist.php?action=delete_playlist&playlist_id=' . $playlist->id,1); - break; - case 'add_to': - case 'add to': - /* If we don't already have a playlist */ - if (!$playlist->id && $GLOBALS['user']->has_access(25)) { - $playlist_name = _('New Playlist') . " - " . date('m/j/y, g:i a'); - $id = $playlist->create($playlist_name, 'private'); - $playlist = new Playlist($id); - } - - if (!$playlist->has_access()) { - access_denied(); - break; - } - - if ($_REQUEST['type'] == 'album') { - $song_ids = get_songs_from_type($_REQUEST['type'],$_REQUEST['song'],$_REQUEST['artist_id']); - } - else { - $song_ids = $_REQUEST['song']; - } - - /* Add the songs */ - $playlist->add_songs($song_ids); - - /* Show the Playlist */ - $_REQUEST['playlist_id'] = $playlist->id; - /* Store this new id in the session for later use */ - $_SESSION['data']['playlist_id'] = $playlist->id; - show_playlist($playlist); - break; +switch ($_REQUEST['action']) { case 'add_dyn_song': /* Check Rights */ if (!$playlist->has_access()) { @@ -97,7 +43,6 @@ switch ($action) { show_playlist($playlist); break; case 'create_playlist': - case 'create': /* Check rights */ if (!$GLOBALS['user']->has_access(25)) { access_denied(); @@ -111,14 +56,7 @@ switch ($action) { $_SESSION['data']['playlist_id'] = $playlist->id; show_confirmation(_('Playlist Created'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been created'),'playlist.php'); break; - case 'edit': - show_playlist_edit($_REQUEST['playlist_id']); - break; - case 'new': - require (conf('prefix') . '/templates/show_add_playlist.inc.php'); - break; case 'remove_song': - case _('Remote Selected Tracks'): /* Check em for rights */ if (!$playlist->has_access()) { access_denied(); @@ -194,6 +132,8 @@ switch ($action) { show_confirmation($title,$body,$url); break; case 'normalize_tracks': + $playlist = new Playlist($_REQUEST['playlist_id']); + /* Make sure they have permission */ if (!$playlist->has_access()) { access_denied(); @@ -203,11 +143,9 @@ switch ($action) { /* Normalize the tracks */ $playlist->normalize_tracks(); - /* Show our wonderful work */ - show_playlist($playlist); break; default: - show_playlists(); + require_once Config::get('prefix') . '/templates/show_playlist.inc.php'; break; } // switch on the action diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php index 6ae2d5f1..5e99b8a9 100644 --- a/templates/show_playlist.inc.php +++ b/templates/show_playlist.inc.php @@ -26,9 +26,10 @@ $web_path = Config::get('web_path'); ?> <?php show_box_top($playlist->name . ' ' . _('Playlist')); ?> <ul class="text-action"> - <li><a href="<?php echo $web_path; ?>/playlist.php?action=normalize_tracks&playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Normalize Tracks'); ?></a></li> - <li><a href="<?php echo $web_path; ?>/stream.php?action=play_selected&playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Play This Playlist'); ?></a></li> - <li><a href="<?php echo $web_path; ?>/stream.php?action=playlist_random&playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Play Random'); ?></a></li> + <li><a href="<?php echo $web_path; ?>/playlist.php?action=normalize_tracks&playlist_id=<?php echo $playlist->id; ?>"><?php echo _('Normalize Tracks'); ?></a></li> + <li><a href="<?php echo $web_path; ?>/stream.php?action=play_selected&playlist_id=<?php echo $playlist->id; ?>"><?php echo _('Play This Playlist'); ?></a></li> + <li><a href="<?php echo $web_path; ?>/stream.php?action=playlist_random&playlist_id=<?php echo $playlist->id; ?>"><?php echo _('Play Random'); ?></a></li> </ul> <?php show_box_bottom(); ?> - +<div id="browse_content"> +</div> |