From f1864e79d8441f2fa9da3eae9df8225bbb89622a Mon Sep 17 00:00:00 2001
From: Martin Konecny <martin@martin-ThinkPad-T410.(none)>
Date: Fri, 14 Oct 2011 00:12:33 +0200
Subject: [PATCH] CC-2973: Api key is being used for downloads in the "Show
 Content" window + "Playlist Builder" page.

-fixed
---
 airtime_mvc/application/controllers/LibraryController.php  | 2 +-
 airtime_mvc/application/controllers/ScheduleController.php | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index bd37ab15e..8e6b3a341 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -84,7 +84,7 @@ class LibraryController extends Zend_Controller_Action
 	    	$file_id = $this->_getParam('id', null);
 	        $file = StoredFile::Recall($file_id);
 
-	        $url = $file->getRelativeFileUrl($baseUrl).'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
+	        $url = $file->getRelativeFileUrl($baseUrl).'/download/true';
             $menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
             				'title' => 'Download');
 
diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index 793dcbfff..3e1400942 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -703,8 +703,9 @@ class ScheduleController extends Zend_Controller_Action
 
         $file_id = $this->_getParam('id', null);
         $file = StoredFile::Recall($file_id);
-
-        $url = $file->getFileURL().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
+        
+        $baseUrl = $this->getRequest()->getBaseUrl();
+        $url = $file->getRelativeFileUrl($baseUrl).'/download/true';
         $menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
             				'title' => 'Download');