From 709e117f418ba8b70a7dcbc90b348b0aa95cc8d6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 6 Mar 2012 13:50:07 -0500 Subject: [PATCH] CC-3391: Audio Preview cannot play tracks with commas in their filename - The content distribution header filename attribute, wasn't properly quoted for inline content. This causes a bug for files with comma names. - changed the play button in library back to the speaker icon - removed some dead code preview_player.js - removed the file name attribute, will need better approch to presenting the user with audio information. --- .../application/controllers/ApiController.php | 11 ++--- .../controllers/PlaylistController.php | 6 +-- airtime_mvc/application/models/StoredFile.php | 2 +- .../playlist/audio-preview-player.phtml | 3 +- .../public/js/airtime/library/library.js | 10 ++-- .../js/airtime/library/preview_jplayer.js | 48 ++----------------- airtime_mvc/public/js/airtime/library/spl.js | 3 +- .../jplayer.audio-preview.blue.monday.css | 6 +-- 8 files changed, 22 insertions(+), 67 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 369d424bb..40cb57c18 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -116,10 +116,9 @@ class ApiController extends Zend_Controller_Action return; } - $name = $this->_getParam("name"); - $filename = $this->_getParam("filename"); - - $file_id = substr($filename, 0, strpos($filename, ".")); + $fileID = $this->_getParam("fileID"); + $file_id = substr($fileID, 0, strpos($fileID, ".")); + if (ctype_alnum($file_id) && strlen($file_id) == 32) { $media = Application_Model_StoredFile::RecallByGunid($file_id); @@ -132,7 +131,7 @@ class ApiController extends Zend_Controller_Action $file_base_name = substr($file_base_name, 1); // possibly use fileinfo module here in the future. // http://www.php.net/manual/en/book.fileinfo.php - $ext = pathinfo($filename, PATHINFO_EXTENSION); + $ext = pathinfo($fileID, PATHINFO_EXTENSION); //Download user left clicks a track and selects Download. if ("true" == $this->_getParam('download')){ //path_info breaks up a file path into seperate pieces of informaiton. @@ -146,7 +145,7 @@ class ApiController extends Zend_Controller_Action header('Content-Disposition: attachment; filename="'.$file_base_name.'"'); }else{ //user clicks play button for track and downloads it. - header("Content-Disposition: inline; filename=$file_base_name"); + header('Content-Disposition: inline; filename="'.$file_base_name.'"'); } $this->smartReadFile($filepath, $ext); diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 80ebaf47e..5351812be 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -198,8 +198,7 @@ class PlaylistController extends Zend_Controller_Action public function audioPreviewPlayerAction() { - $name = $this->_getParam('name'); - $fileName = $this->_getParam('filename'); + $fileID = $this->_getParam('fileID'); $playlistIndex = $this->_getParam('index'); $request = $this->getRequest(); @@ -218,8 +217,7 @@ class PlaylistController extends Zend_Controller_Action $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; } - $this->view->name = $name; - $this->view->fileName = $fileName; + $this->view->fileName = $fileID; $this->view->playlistIndex= $playlistIndex; } diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 1a8821a41..9dfd99e46 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -660,7 +660,7 @@ Logging::log("getting media! - 2"); if($type == "au"){//&& isset( $audioResults )) { $row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); - $row['image'] = '
'; + $row['image'] = '
'; } else { $row['image'] = ''; diff --git a/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml b/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml index a01b2e9ff..cce1ea02b 100644 --- a/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml +++ b/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml @@ -1,6 +1,5 @@
- name" ?> - fileName" ?> + fileName" ?>