From 72960593c7b6f0ac9cd84df3b921a0a241fd659e Mon Sep 17 00:00:00 2001
From: jo <ljonas@riseup.net>
Date: Thu, 7 Jul 2022 23:27:28 +0200
Subject: [PATCH] chore(legacy): use Config::getBasePath helper

Replace Application_Common_OsPath::getBaseDir with Config::getBasePath.
---
 legacy/application/Bootstrap.php              |   2 +-
 legacy/application/common/OsPath.php          |  16 --
 .../application/controllers/ApiController.php |   2 +-
 .../controllers/AudiopreviewController.php    |  12 +-
 .../controllers/DashboardController.php       |   4 +-
 .../EmbeddablewidgetsController.php           |   4 +-
 .../controllers/ErrorController.php           |   2 +-
 .../controllers/IndexController.php           |   2 +-
 .../controllers/LibraryController.php         |   2 +-
 .../controllers/ListenerstatController.php    |   4 +-
 .../controllers/LoginController.php           |   6 +-
 .../controllers/PlayouthistoryController.php  |   2 +-
 .../PlayouthistorytemplateController.php      |   4 +-
 .../controllers/PluploadController.php        |   2 +-
 .../controllers/PodcastController.php         |   2 +-
 .../controllers/PreferenceController.php      |   4 +-
 .../controllers/ScheduleController.php        |   2 +-
 .../controllers/ShowbuilderController.php     |   6 +-
 .../controllers/SystemstatusController.php    |   2 +-
 .../controllers/TracktypeController.php       |   2 +-
 .../controllers/UserController.php            |   2 +-
 .../plugins/PageLayoutInitPlugin.php          |   6 +-
 legacy/application/forms/EditAudioMD.php      |   1 -
 legacy/application/forms/Preferences.php      |   2 -
 .../application/layouts/scripts/layout.phtml  | 219 +++++++++--------
 legacy/application/models/Auth.php            |   4 +-
 legacy/application/models/StoredFile.php      |   2 +-
 .../application/services/CalendarService.php  |   2 +-
 .../scripts/embeddablewidgets/facebook.phtml  |   6 +-
 .../scripts/embeddablewidgets/player.phtml    |   2 +-
 .../scripts/embeddablewidgets/schedule.phtml  |  11 +-
 .../views/scripts/library/library.phtml       |  14 +-
 .../views/scripts/preference/index.phtml      |   4 +-
 .../scripts/preference/stream-setting.phtml   | 228 +++++++++---------
 34 files changed, 288 insertions(+), 297 deletions(-)

diff --git a/legacy/application/Bootstrap.php b/legacy/application/Bootstrap.php
index 68a494f1d..a9882feca 100644
--- a/legacy/application/Bootstrap.php
+++ b/legacy/application/Bootstrap.php
@@ -50,7 +50,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
     {
         $front = Zend_Controller_Front::getInstance();
         $router = $front->getRouter();
-        $front->setBaseUrl(Application_Common_OsPath::getBaseDir());
+        $front->setBaseUrl(Config::getBasePath());
 
         $router->addRoute(
             'password-change',
diff --git a/legacy/application/common/OsPath.php b/legacy/application/common/OsPath.php
index 71b62d6bc..aaf43aec3 100644
--- a/legacy/application/common/OsPath.php
+++ b/legacy/application/common/OsPath.php
@@ -73,22 +73,6 @@ class Application_Common_OsPath
         return implode(DIRECTORY_SEPARATOR, $paths);
     }
 
-    public static function getBaseDir()
-    {
-        $CC_CONFIG = Config::getConfig();
-        $baseUrl = $CC_CONFIG['baseDir'];
-
-        if ($baseUrl[0] != '/') {
-            $baseUrl = '/' . $baseUrl;
-        }
-
-        if ($baseUrl[strlen($baseUrl) - 1] != '/') {
-            $baseUrl = $baseUrl . '/';
-        }
-
-        return $baseUrl;
-    }
-
     public static function formatDirectoryWithDirectorySeparators($dir)
     {
         if ($dir[0] != '/') {
diff --git a/legacy/application/controllers/ApiController.php b/legacy/application/controllers/ApiController.php
index bea4e790d..6b66ef63c 100644
--- a/legacy/application/controllers/ApiController.php
+++ b/legacy/application/controllers/ApiController.php
@@ -1516,7 +1516,7 @@ class ApiController extends Zend_Controller_Action
      */
     public function showTracksAction()
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $prefTimezone = Application_Model_Preference::GetTimezone();
 
         $instanceId = $this->_getParam('instance_id');
diff --git a/legacy/application/controllers/AudiopreviewController.php b/legacy/application/controllers/AudiopreviewController.php
index 9fbc06d30..913619fbb 100644
--- a/legacy/application/controllers/AudiopreviewController.php
+++ b/legacy/application/controllers/AudiopreviewController.php
@@ -24,7 +24,7 @@ class AudiopreviewController extends Zend_Controller_Action
         $audioFileID = $this->_getParam('audioFileID');
         $type = $this->_getParam('type');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile(
             $baseUrl . 'js/airtime/audiopreview/preview_jplayer.js?' . $CC_CONFIG['airtime_version'],
@@ -81,7 +81,7 @@ class AudiopreviewController extends Zend_Controller_Action
         $playlistIndex = $this->_getParam('playlistIndex');
         $playlistID = $this->_getParam('playlistID');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/audiopreview/preview_jplayer.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
         $this->view->headScript()->appendFile($baseUrl . 'js/jplayer/jplayer.playlist.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
@@ -107,7 +107,7 @@ class AudiopreviewController extends Zend_Controller_Action
         $blockIndex = $this->_getParam('blockIndex');
         $blockId = $this->_getParam('blockId');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/audiopreview/preview_jplayer.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
         $this->view->headScript()->appendFile($baseUrl . 'js/jplayer/jplayer.playlist.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
@@ -182,7 +182,7 @@ class AudiopreviewController extends Zend_Controller_Action
 
     private function createElementMap($track)
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $elementMap = [
             'element_title' => isset($track['track_title']) ? $track['track_title'] : '',
@@ -229,7 +229,7 @@ class AudiopreviewController extends Zend_Controller_Action
         $showID = $this->_getParam('showID');
         $showIndex = $this->_getParam('showIndex');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/audiopreview/preview_jplayer.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
         $this->view->headScript()->appendFile($baseUrl . 'js/jplayer/jplayer.playlist.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
@@ -254,7 +254,7 @@ class AudiopreviewController extends Zend_Controller_Action
      */
     public function getShowAction()
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         // disable the view and the layout
         $this->view->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
diff --git a/legacy/application/controllers/DashboardController.php b/legacy/application/controllers/DashboardController.php
index 707b1ca51..a54f21043 100644
--- a/legacy/application/controllers/DashboardController.php
+++ b/legacy/application/controllers/DashboardController.php
@@ -95,7 +95,7 @@ class DashboardController extends Zend_Controller_Action
     {
         $CC_CONFIG = Config::getConfig();
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headLink()->appendStylesheet($baseUrl . 'js/jplayer/skin/jplayer.blue.monday.css?' . $CC_CONFIG['airtime_version']);
         $this->_helper->layout->setLayout('livestream');
@@ -122,7 +122,7 @@ class DashboardController extends Zend_Controller_Action
 
         $CC_CONFIG = Config::getConfig();
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $headScript = $this->view->headScript();
         AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
diff --git a/legacy/application/controllers/EmbeddablewidgetsController.php b/legacy/application/controllers/EmbeddablewidgetsController.php
index 80d725d0c..2242db977 100644
--- a/legacy/application/controllers/EmbeddablewidgetsController.php
+++ b/legacy/application/controllers/EmbeddablewidgetsController.php
@@ -11,7 +11,7 @@ class EmbeddableWidgetsController extends Zend_Controller_Action
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Widgets');
 
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $this->view->headLink()->appendStylesheet($baseUrl . 'css/player-form.css?' . $CC_CONFIG['airtime_version']);
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/player/player.js?' . $CC_CONFIG['airtime_version']);
 
@@ -54,7 +54,7 @@ class EmbeddableWidgetsController extends Zend_Controller_Action
         }
 
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $facebookAppId = $CC_CONFIG['facebook-app-id'];
         $this->view->headScript()->appendScript('var FACEBOOK_APP_ID = ' . json_encode($facebookAppId) . ';');
diff --git a/legacy/application/controllers/ErrorController.php b/legacy/application/controllers/ErrorController.php
index 5c2a5e241..a81e1e1d5 100644
--- a/legacy/application/controllers/ErrorController.php
+++ b/legacy/application/controllers/ErrorController.php
@@ -13,7 +13,7 @@ class ErrorController extends Zend_Controller_Action
         try {
             $service_user = new Application_Service_UserService();
             $service_user->getCurrentUser();
-            $this->view->helpUrl = Application_Common_OsPath::getBaseDir() . 'dashboard/help';
+            $this->view->helpUrl = Config::getBasePath() . 'dashboard/help';
         } catch (Exception $e) {
             $this->view->helpUrl = HELP_URL;
         }
diff --git a/legacy/application/controllers/IndexController.php b/legacy/application/controllers/IndexController.php
index ca2e15ea0..5d9f97f10 100644
--- a/legacy/application/controllers/IndexController.php
+++ b/legacy/application/controllers/IndexController.php
@@ -9,7 +9,7 @@ class IndexController extends Zend_Controller_Action
     public function indexAction()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $this->view->headTitle(Application_Model_Preference::GetHeadTitle());
         $this->view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
 
diff --git a/legacy/application/controllers/LibraryController.php b/legacy/application/controllers/LibraryController.php
index e92f8144e..f2311f532 100644
--- a/legacy/application/controllers/LibraryController.php
+++ b/legacy/application/controllers/LibraryController.php
@@ -76,7 +76,7 @@ class LibraryController extends Zend_Controller_Action
 
     public function contextMenuAction()
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $id = $this->_getParam('id');
         $type = $this->_getParam('type');
         // playlist||timeline
diff --git a/legacy/application/controllers/ListenerstatController.php b/legacy/application/controllers/ListenerstatController.php
index 1d1e31f72..e07cad215 100644
--- a/legacy/application/controllers/ListenerstatController.php
+++ b/legacy/application/controllers/ListenerstatController.php
@@ -15,7 +15,7 @@ class ListenerstatController extends Zend_Controller_Action
         $CC_CONFIG = Config::getConfig();
 
         $request = $this->getRequest();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
 
@@ -61,7 +61,7 @@ class ListenerstatController extends Zend_Controller_Action
         $CC_CONFIG = Config::getConfig();
 
         $request = $this->getRequest();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $headScript = $this->view->headScript();
         AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
diff --git a/legacy/application/controllers/LoginController.php b/legacy/application/controllers/LoginController.php
index 6148c6d1c..392cee93e 100644
--- a/legacy/application/controllers/LoginController.php
+++ b/legacy/application/controllers/LoginController.php
@@ -5,7 +5,7 @@ class LoginController extends Zend_Controller_Action
     public function init()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headLink(['rel' => 'icon', 'href' => $baseUrl . 'favicon.ico?' . $CC_CONFIG['airtime_version'], 'type' => 'image/x-icon'], 'PREPEND')
             ->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version'])
@@ -43,7 +43,7 @@ class LoginController extends Zend_Controller_Action
 
         $this->view->error = false;
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $form = new Application_Form_Login();
 
@@ -113,7 +113,7 @@ class LoginController extends Zend_Controller_Action
     {
         $CC_CONFIG = Config::getConfig();
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/login/password-restore.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
 
diff --git a/legacy/application/controllers/PlayouthistoryController.php b/legacy/application/controllers/PlayouthistoryController.php
index d46783b22..46f87802e 100644
--- a/legacy/application/controllers/PlayouthistoryController.php
+++ b/legacy/application/controllers/PlayouthistoryController.php
@@ -22,7 +22,7 @@ class PlayouthistoryController extends Zend_Controller_Action
     public function indexAction()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
 
diff --git a/legacy/application/controllers/PlayouthistorytemplateController.php b/legacy/application/controllers/PlayouthistorytemplateController.php
index f56b1ae80..717c0b1d6 100644
--- a/legacy/application/controllers/PlayouthistorytemplateController.php
+++ b/legacy/application/controllers/PlayouthistorytemplateController.php
@@ -16,7 +16,7 @@ class PlayouthistorytemplateController extends Zend_Controller_Action
     public function indexAction()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
 
@@ -32,7 +32,7 @@ class PlayouthistorytemplateController extends Zend_Controller_Action
     public function configureTemplateAction()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
 
diff --git a/legacy/application/controllers/PluploadController.php b/legacy/application/controllers/PluploadController.php
index 9584adf69..c79fe0cec 100644
--- a/legacy/application/controllers/PluploadController.php
+++ b/legacy/application/controllers/PluploadController.php
@@ -14,7 +14,7 @@ class PluploadController extends Zend_Controller_Action
     {
         $CC_CONFIG = Config::getConfig();
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $locale = Application_Model_Preference::GetLocale();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/datatables/js/jquery.dataTables.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
diff --git a/legacy/application/controllers/PodcastController.php b/legacy/application/controllers/PodcastController.php
index 7821f5838..99f517b40 100644
--- a/legacy/application/controllers/PodcastController.php
+++ b/legacy/application/controllers/PodcastController.php
@@ -5,7 +5,7 @@ class PodcastController extends Zend_Controller_Action
     public function init()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $headScript = $this->view->headScript();
         AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
diff --git a/legacy/application/controllers/PreferenceController.php b/legacy/application/controllers/PreferenceController.php
index 40b254da2..c28a587e6 100644
--- a/legacy/application/controllers/PreferenceController.php
+++ b/legacy/application/controllers/PreferenceController.php
@@ -25,7 +25,7 @@ class PreferenceController extends Zend_Controller_Action
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/preferences/preferences.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
         $this->view->statusMsg = '';
@@ -137,7 +137,7 @@ class PreferenceController extends Zend_Controller_Action
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/preferences/streamsetting.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
 
diff --git a/legacy/application/controllers/ScheduleController.php b/legacy/application/controllers/ScheduleController.php
index 76fa1bc50..9b4b99a56 100644
--- a/legacy/application/controllers/ScheduleController.php
+++ b/legacy/application/controllers/ScheduleController.php
@@ -44,7 +44,7 @@ class ScheduleController extends Zend_Controller_Action
     {
         $CC_CONFIG = Config::getConfig();
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         // Embed the schedule in our page response so we don't have to make an AJAX request to get this data after the page load.
         $scheduleController = new ScheduleController($this->getRequest(), $this->getResponse());
diff --git a/legacy/application/controllers/ShowbuilderController.php b/legacy/application/controllers/ShowbuilderController.php
index e3ccf6943..f82592434 100644
--- a/legacy/application/controllers/ShowbuilderController.php
+++ b/legacy/application/controllers/ShowbuilderController.php
@@ -18,7 +18,7 @@ class ShowbuilderController extends Zend_Controller_Action
     public function indexAction()
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $userType = Application_Model_User::GetCurrentUser()->getType();
 
         // $this->_helper->layout->setLayout("showbuilder");
@@ -100,7 +100,7 @@ class ShowbuilderController extends Zend_Controller_Action
     public function checkAndShowSetupPopup($request)
     {
         $CC_CONFIG = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $setupComplete = Application_Model_Preference::getLangTimezoneSetupComplete();
         $previousPage = strtolower($request->getHeader('Referer'));
         $userService = new Application_Service_UserService();
@@ -119,7 +119,7 @@ class ShowbuilderController extends Zend_Controller_Action
 
     public function contextMenuAction()
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $id = $this->_getParam('id');
         $now = floatval(microtime(true));
diff --git a/legacy/application/controllers/SystemstatusController.php b/legacy/application/controllers/SystemstatusController.php
index 8cc7cb433..85d57a4ba 100644
--- a/legacy/application/controllers/SystemstatusController.php
+++ b/legacy/application/controllers/SystemstatusController.php
@@ -7,7 +7,7 @@ class SystemstatusController extends Zend_Controller_Action
     public function init()
     {
         $config = Config::getConfig();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $this->view->headScript()->appendFile($baseUrl . 'js/airtime/status/status.js?' . $config['airtime_version'], 'text/javascript');
         $this->version = $config['airtime_version'];
     }
diff --git a/legacy/application/controllers/TracktypeController.php b/legacy/application/controllers/TracktypeController.php
index 615136a6e..7de28c2d8 100644
--- a/legacy/application/controllers/TracktypeController.php
+++ b/legacy/application/controllers/TracktypeController.php
@@ -22,7 +22,7 @@ class TracktypeController extends Zend_Controller_Action
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $js_files = [
             'js/datatables/js/jquery.dataTables.js?',
diff --git a/legacy/application/controllers/UserController.php b/legacy/application/controllers/UserController.php
index efd3b0c26..b49f4ce9e 100644
--- a/legacy/application/controllers/UserController.php
+++ b/legacy/application/controllers/UserController.php
@@ -24,7 +24,7 @@ class UserController extends Zend_Controller_Action
 
         Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $js_files = [
             'js/datatables/js/jquery.dataTables.js?',
diff --git a/legacy/application/controllers/plugins/PageLayoutInitPlugin.php b/legacy/application/controllers/plugins/PageLayoutInitPlugin.php
index 9e06a2b1f..1d640a99d 100644
--- a/legacy/application/controllers/plugins/PageLayoutInitPlugin.php
+++ b/legacy/application/controllers/plugins/PageLayoutInitPlugin.php
@@ -73,7 +73,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
         }
 
         $view = $this->_bootstrap->getResource('view');
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $view->headScript()->appendScript("var baseUrl = '{$baseUrl}';");
         $this->_initTranslationGlobals($view);
@@ -156,7 +156,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
 
         $view = $this->_bootstrap->getResource('view');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $view->headLink(['rel' => 'icon', 'href' => $baseUrl . 'favicon.ico?' . $CC_CONFIG['airtime_version'], 'type' => 'image/x-icon'], 'PREPEND')
             ->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version'])
@@ -178,7 +178,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
 
         $view = $this->_bootstrap->getResource('view');
 
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
             ->appendFile($baseUrl . 'js/libs/jquery-ui-1.8.24.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
diff --git a/legacy/application/forms/EditAudioMD.php b/legacy/application/forms/EditAudioMD.php
index 3bb20071e..e46954a94 100644
--- a/legacy/application/forms/EditAudioMD.php
+++ b/legacy/application/forms/EditAudioMD.php
@@ -8,7 +8,6 @@ class Application_Form_EditAudioMD extends Zend_Form
 
     public function startForm($p_id)
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
         // Set the method for the display form to POST
         $this->setMethod('post');
 
diff --git a/legacy/application/forms/Preferences.php b/legacy/application/forms/Preferences.php
index 58fd218e9..ff5489bf9 100644
--- a/legacy/application/forms/Preferences.php
+++ b/legacy/application/forms/Preferences.php
@@ -4,8 +4,6 @@ class Application_Form_Preferences extends Zend_Form
 {
     public function init()
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
-
         $this->setDecorators([
             ['ViewScript', ['viewScript' => 'form/preferences.phtml']],
         ]);
diff --git a/legacy/application/layouts/scripts/layout.phtml b/legacy/application/layouts/scripts/layout.phtml
index 808479d1f..746148273 100644
--- a/legacy/application/layouts/scripts/layout.phtml
+++ b/legacy/application/layouts/scripts/layout.phtml
@@ -1,125 +1,133 @@
 <?php echo $this->doctype() ?>
 <html xmlns="http://www.w3.org/1999/xhtml">
+
 <head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <?php echo $this->headTitle() ?>
-	<?php echo $this->headLink() ?>
-	<?php echo $this->headScript() ?>
-	<?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+    <?php echo $this->headLink() ?>
+    <?php echo $this->headScript() ?>
+    <?php $baseUrl = Config::getBasePath(); ?>
 </head>
+
 <body>
     <div id="Panel" class="sticky">
-    <?php
-						/*
+        <?php
+        /*
 						NOTE: Temporarily disabled version notification to avoid confusion,
 						Users can check current version in Settings > Status.
 						*/
-						//echo $this->versionNotify();
-            $sss = $this->SourceSwitchStatus();
-            $scs = $this->SourceConnectionStatus();
-    ?>
-    <?php echo $this->partial('partialviews/header.phtml', array("live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
-                "scheduled_play_switch"=>$sss['scheduled_play'])) ?>
-<?php 	$partial = array('menu.phtml', 'default');
-    $this->navigation()->menu()->setPartial($partial); ?>
+        //echo $this->versionNotify();
+        $sss = $this->SourceSwitchStatus();
+        $scs = $this->SourceConnectionStatus();
+        ?>
+        <?php echo $this->partial('partialviews/header.phtml', array(
+            "live_dj_switch" => $sss['live_dj'], "live_dj_connection" => $scs['live_dj'], "master_dj_switch" => $sss['master_dj'], "master_dj_connection" => $scs['master_dj'],
+            "scheduled_play_switch" => $sss['scheduled_play']
+        )) ?>
+        <?php $partial = array('menu.phtml', 'default');
+        $this->navigation()->menu()->setPartial($partial); ?>
 
 
-    <script type="text/javascript">
-        var schedulePreLoaded = <?php
-        //Awful hack to speed up loading - Embed the schedule in the response so that the dashboard
-        //doesn't have to make a separate AJAX request to get this data.
-    ScheduleController::printCurrentPlaylistForEmbedding();
- ?>;
-        //The DOM elements that these calls depend on exist by this point:
-        parseItems(schedulePreLoaded.entries);
-        parseSourceStatus(schedulePreLoaded.source_status);
-        parseSwitchStatus(schedulePreLoaded.switch_status);
-
-    </script>
-</div>
-
-<div id="media_type_nav"> <!-- class="content-pane" -->
-    <div class="btn-group">
-        <ul class="dropdown-menu">
-            <li id="new-playlist">
-                <a href="#"><?php echo _("Playlist") ?></a>
-            </li>
-            <li id="new-smart-block">
-                <a href="#"><?php echo _("Smart Block") ?></a>
-            </li>
-            <li id="new-webstream">
-                <a href="#"><?php echo _("Webstream") ?></a>
-            </li>
-        </ul>
-        <a href="<?php echo Application_Common_OsPath::getBaseDir() . 'plupload' ?>">
-            <button id="add_media_btn" class="btn btn-small dashboard-btn btn-new">
-                <span><?php echo _("Upload") ?></span>
-            </button>
-        </a>
+        <script type="text/javascript">
+            var schedulePreLoaded = <?php
+                                    //Awful hack to speed up loading - Embed the schedule in the response so that the dashboard
+                                    //doesn't have to make a separate AJAX request to get this data.
+                                    ScheduleController::printCurrentPlaylistForEmbedding();
+                                    ?>;
+            //The DOM elements that these calls depend on exist by this point:
+            parseItems(schedulePreLoaded.entries);
+            parseSourceStatus(schedulePreLoaded.source_status);
+            parseSwitchStatus(schedulePreLoaded.switch_status);
+        </script>
     </div>
 
-    <div class="media_type_selector top-link" data-selection-id="<?php echo MediaType::getDefault(); ?>">
-        <a href="<?php echo Application_Common_OsPath::getBaseDir() . 'showbuilder#' ?>">
-            <i class='icon-home icon-white'></i>
-            <?php echo _("Dashboard") ?>
-        </a>
-    </div>
-    <?php $subnavPrefix = "/showbuilder"; require_once APPLICATION_PATH . "/views/scripts/partialviews/dashboard-sub-nav.php"; ?>
-    <div class="media_type_selector dashboard_sub_nav" data-selection-id="<?php echo MediaType::PODCAST ?>">
-        <a href="<?php echo $subnavPrefix; ?>#podcasts">
-            <span class="selector-name"><i class='icon-headphones icon-white'></i><?php echo _("Podcasts") ?></span>
-        </a>
-    </div>
+    <div id="media_type_nav">
+        <!-- class="content-pane" -->
+        <div class="btn-group">
+            <ul class="dropdown-menu">
+                <li id="new-playlist">
+                    <a href="#"><?php echo _("Playlist") ?></a>
+                </li>
+                <li id="new-smart-block">
+                    <a href="#"><?php echo _("Smart Block") ?></a>
+                </li>
+                <li id="new-webstream">
+                    <a href="#"><?php echo _("Webstream") ?></a>
+                </li>
+            </ul>
+            <a href="<?php echo Config::getBasePath() . 'plupload' ?>">
+                <button id="add_media_btn" class="btn btn-small dashboard-btn btn-new">
+                    <span><?php echo _("Upload") ?></span>
+                </button>
+            </a>
+        </div>
 
-    <hr style="margin-left: 5px; margin-right: 5px">
-    <div id="nav">
-        <?php echo $this->navigation()->menu(); ?>
-    </div>
+        <div class="media_type_selector top-link" data-selection-id="<?php echo MediaType::getDefault(); ?>">
+            <a href="<?php echo Config::getBasePath() . 'showbuilder#' ?>">
+                <i class='icon-home icon-white'></i>
+                <?php echo _("Dashboard") ?>
+            </a>
+        </div>
+        <?php $subnavPrefix = "/showbuilder";
+        require_once APPLICATION_PATH . "/views/scripts/partialviews/dashboard-sub-nav.php"; ?>
+        <div class="media_type_selector dashboard_sub_nav" data-selection-id="<?php echo MediaType::PODCAST ?>">
+            <a href="<?php echo $subnavPrefix; ?>#podcasts">
+                <span class="selector-name"><i class='icon-headphones icon-white'></i><?php echo _("Podcasts") ?></span>
+            </a>
+        </div>
 
-    <script>
-    <?php
-    $partitions = Application_Model_Systemstatus::GetDiskInfo();
-    $status = new StdClass;
-    $disk = $partitions[0];
-    $used = $disk->totalSpace-$disk->totalFreeSpace;
-    $total = $disk->totalSpace;
-    echo "var remainingDiskSpace = ".$disk->totalFreeSpace.";";
-    ?>
-    </script>
-    <div id="disk_usage">
-        <!--<div style="padding-bottom: 2px;">Disk Usage</div>-->
-        <div class="disk_usage_progress_bar"></div>
-        <div class="disk_usage_percent_in_use"><?php echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30)); ?></div>
-        <div class="disk_usage_used" style="width:<?php echo sprintf("%01.1f%%", min(100, $used/$total*100)) ?>;"></div>
+        <hr style="margin-left: 5px; margin-right: 5px">
+        <div id="nav">
+            <?php echo $this->navigation()->menu(); ?>
+        </div>
 
-        <!--<div style="margin-top: 15px; font-size: 12px;">
-            <?php //echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30)); ?>
+        <script>
+            <?php
+            $partitions = Application_Model_Systemstatus::GetDiskInfo();
+            $status = new StdClass;
+            $disk = $partitions[0];
+            $used = $disk->totalSpace - $disk->totalFreeSpace;
+            $total = $disk->totalSpace;
+            echo "var remainingDiskSpace = " . $disk->totalFreeSpace . ";";
+            ?>
+        </script>
+        <div id="disk_usage">
+            <!--<div style="padding-bottom: 2px;">Disk Usage</div>-->
+            <div class="disk_usage_progress_bar"></div>
+            <div class="disk_usage_percent_in_use"><?php echo sprintf("%01.1fGB of %01.1fGB", $used / pow(2, 30), $total / pow(2, 30)); ?></div>
+            <div class="disk_usage_used" style="width:<?php echo sprintf("%01.1f%%", min(100, $used / $total * 100)) ?>;"></div>
+
+            <!--<div style="margin-top: 15px; font-size: 12px;">
+            <?php //echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30));
+            ?>
         </div>-->
 
+        </div>
+
     </div>
 
-</div>
+    <?php $hint = Application_Common_UsabilityHints::getUsabilityHint(); ?>
+    <div class="usability_hint <?php if ($hint == "") {
+                                    echo "hidden";
+                                } ?>"><?php echo $hint; ?></div>
 
-<?php $hint = Application_Common_UsabilityHints::getUsabilityHint(); ?>
-<div class="usability_hint <?php if ($hint == "") { echo "hidden"; } ?>"><?php echo $hint; ?></div>
-
-<div class="wrapper <?php if (isset($this->layout()->parent_page)) echo "wrapper_panel";?>" id="content">
-    <?php echo $this->layout()->content ?>
-</div>
-<?php if (isset($this->layout()->parent_page)) { ?>
-    <div id="sub-menu">
-        <h3><?php //parent_page is passed in from controller
-            echo _($this->layout()->parent_page); ?></h3>
-        <hr>
-        <?php
-        $page = $this->navigation()->findOneBy('title', $this->layout()->parent_page);
-        echo $this->navigation()->menu()->render($page);
-        ?>
+    <div class="wrapper <?php if (isset($this->layout()->parent_page)) echo "wrapper_panel"; ?>" id="content">
+        <?php echo $this->layout()->content ?>
     </div>
-<?php } ?>
+    <?php if (isset($this->layout()->parent_page)) { ?>
+        <div id="sub-menu">
+            <h3><?php //parent_page is passed in from controller
+                echo _($this->layout()->parent_page); ?></h3>
+            <hr>
+            <?php
+            $page = $this->navigation()->findOneBy('title', $this->layout()->parent_page);
+            echo $this->navigation()->menu()->render($page);
+            ?>
+        </div>
+    <?php } ?>
 
-<script id="tmpl-pl-cues" type="text/template">
-<div class="waveform-cues">
+    <script id="tmpl-pl-cues" type="text/template">
+        <div class="waveform-cues">
   <div class="playlist-time-scale"></div>
   <div class="playlist-tracks"></div>
   <div class="playlist-controls">
@@ -144,8 +152,8 @@
 </div>
 </script>
 
-<script id="tmpl-pl-fades" type="text/template">
-<div class="waveform-fades">
+    <script id="tmpl-pl-fades" type="text/template">
+        <div class="waveform-fades">
   <div class="playlist-time-scale"></div>
   <div class="playlist-tracks"></div>
   <div class="playlist-controls left-floated">
@@ -161,11 +169,11 @@
 </div>
 </script>
 
-<?php
+    <?php
     // Show users the What's New dialog if they haven't seen it yet
     // TODO: If you're updating this, be sure to update defaultdata! (Suboptimal, is there a better way?)
     if (!Application_Model_Preference::getWhatsNewDialogViewed()) {
-        ?>
+    ?>
         <div id="whatsnew">
             <div>
                 <div id="whatsnew_video">
@@ -197,13 +205,14 @@
                 });
             });
         </script>
-        <?php
+    <?php
         Application_Model_Preference::setWhatsNewDialogViewed(true);
     }
-?>
+    ?>
 
-<div id="fb-root"></div>
+    <div id="fb-root"></div>
 
 
 </body>
+
 </html>
diff --git a/legacy/application/models/Auth.php b/legacy/application/models/Auth.php
index 286627e74..b111640a3 100644
--- a/legacy/application/models/Auth.php
+++ b/legacy/application/models/Auth.php
@@ -140,11 +140,9 @@ class Application_Model_Auth
      */
     public static function pinSessionToClient($auth)
     {
-        $CC_CONFIG = Config::getConfig();
-
         $serverName = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
         $remoteAddr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
-        $sessionIdentifier = 'Airtime' . '-' . $serverName . '-' . $remoteAddr . '-' . Application_Model_Preference::GetClientId() . '-' . $CC_CONFIG['baseDir'];
+        $sessionIdentifier = 'Airtime' . '-' . $serverName . '-' . $remoteAddr . '-' . Application_Model_Preference::GetClientId() . '-' . Config::getBasePath();
         $auth->setStorage(new Zend_Auth_Storage_Session($sessionIdentifier));
     }
 }
diff --git a/legacy/application/models/StoredFile.php b/legacy/application/models/StoredFile.php
index b2c51a3ac..0996ba26e 100644
--- a/legacy/application/models/StoredFile.php
+++ b/legacy/application/models/StoredFile.php
@@ -682,7 +682,7 @@ SQL;
 
     public static function searchLibraryFiles($datatables)
     {
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
 
         $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
 
diff --git a/legacy/application/services/CalendarService.php b/legacy/application/services/CalendarService.php
index 0021dc3df..2996f21eb 100644
--- a/legacy/application/services/CalendarService.php
+++ b/legacy/application/services/CalendarService.php
@@ -27,7 +27,7 @@ class Application_Service_CalendarService
     {
         $menu = [];
         $now = time();
-        $baseUrl = Application_Common_OsPath::getBaseDir();
+        $baseUrl = Config::getBasePath();
         $isAdminOrPM = $this->currentUser->isAdminOrPM();
         $isHostOfShow = $this->currentUser->isHostOfShow($this->ccShow->getDbId());
 
diff --git a/legacy/application/views/scripts/embeddablewidgets/facebook.phtml b/legacy/application/views/scripts/embeddablewidgets/facebook.phtml
index f89317ac0..f56760898 100644
--- a/legacy/application/views/scripts/embeddablewidgets/facebook.phtml
+++ b/legacy/application/views/scripts/embeddablewidgets/facebook.phtml
@@ -1,6 +1,6 @@
 <div id="weekly-schedule-widget" class="prefpanel ui-widget simple-formblock clearfix padded-strong ">
 
-    <?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+    <?php $baseUrl = Config::getBasePath(); ?>
 
     <h2 style="text-align:center"><?php echo _("Facebook Radio Player") ?></h2>
     <div style="clear:both"></div>
@@ -27,10 +27,10 @@
         <h3 style="padding-left: 0px"><?php echo _("Tips:") ?></h3>
         <p>
             <?php echo _("To make the tab more visible on your Facebook page, click 'More', and 'Manage Tabs':") ?><br><br>
-            <img src="<?php echo($baseUrl) . "images/doc/facebook_widget1.png"?>"><br><br>
+            <img src="<?php echo ($baseUrl) . "images/doc/facebook_widget1.png" ?>"><br><br>
 
             <?php echo _("Then, drag the Radio Player item higher in the list, and click Save. It will now appear as one of the default tabs instead of being buried under 'More':") ?><br><br>
-            <img src="<?php echo($baseUrl) . "images/doc/facebook_widget2.png"?>">
+            <img src="<?php echo ($baseUrl) . "images/doc/facebook_widget2.png" ?>">
 
         </p>
     </div>
diff --git a/legacy/application/views/scripts/embeddablewidgets/player.phtml b/legacy/application/views/scripts/embeddablewidgets/player.phtml
index d81cb1e40..808172edc 100644
--- a/legacy/application/views/scripts/embeddablewidgets/player.phtml
+++ b/legacy/application/views/scripts/embeddablewidgets/player.phtml
@@ -1,6 +1,6 @@
 <div id="player-widget" class="ui-widget prefpanel simple-formblock embed-player-form clearfix padded-strong ">
 
-    <?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+    <?php $baseUrl = Config::getBasePath(); ?>
 
     <form method="post" id="player_form" enctype="multipart/form-data">
         <h2 style="text-align:center"><?php echo _("Player") ?></h2>
diff --git a/legacy/application/views/scripts/embeddablewidgets/schedule.phtml b/legacy/application/views/scripts/embeddablewidgets/schedule.phtml
index 0c592a01b..17042f5aa 100644
--- a/legacy/application/views/scripts/embeddablewidgets/schedule.phtml
+++ b/legacy/application/views/scripts/embeddablewidgets/schedule.phtml
@@ -1,6 +1,6 @@
 <div id="weekly-schedule-widget" class="prefpanel ui-widget simple-formblock clearfix padded-strong ">
 
-    <?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+    <?php $baseUrl = Config::getBasePath(); ?>
 
     <h2 style="text-align:center"><?php echo _("Weekly Schedule") ?></h2>
     <div style="clear:both"></div>
@@ -13,15 +13,16 @@
         <div id="weekly-schedule-widget-preview" <?php if (isset($this->weekly_schedule_error_msg)) echo "style=display:none"; ?>>
             <!-- <label><?php echo _("Preview:") ?></label> -->
             <div class="schedule_iframe_wrapper">
-                <iframe id="schedule_iframe" height="400px" width="550px" scrolling="no" frameborder="0" src="<?php echo Application_Common_HTTPHelper::getStationUrl()."embed/weekly-program"?>"></iframe>
+                <iframe id="schedule_iframe" height="400px" width="550px" scrolling="no" frameborder="0" src="<?php echo Application_Common_HTTPHelper::getStationUrl() . "embed/weekly-program" ?>"></iframe>
             </div>
 
             <div style="clear:both"></div>
             <label><?php echo _("Embeddable code:") ?><br><br></label>
-            <textarea style="width:98%" rows="3" readonly="readonly"><iframe height="400px" width="550px" scrolling="no" frameborder="0" src="<?php echo Application_Common_HTTPHelper::getStationUrl()."embed/weekly-program"?>"></iframe>
+            <textarea style="width:98%" rows="3" readonly="readonly"><iframe height="400px" width="550px" scrolling="no" frameborder="0" src="<?php echo Application_Common_HTTPHelper::getStationUrl() . "embed/weekly-program" ?>"></iframe>
             </textarea>
-            <div><p>
-                 <?php echo _("Copy this code and paste it into your website's HTML to embed the weekly schedule in your site. Adjust the height and width attributes to your desired size.") ?>
+            <div>
+                <p>
+                    <?php echo _("Copy this code and paste it into your website's HTML to embed the weekly schedule in your site. Adjust the height and width attributes to your desired size.") ?>
                 </p>
             </div>
         </div>
diff --git a/legacy/application/views/scripts/library/library.phtml b/legacy/application/views/scripts/library/library.phtml
index 8edf9efa2..dae4f2b5f 100644
--- a/legacy/application/views/scripts/library/library.phtml
+++ b/legacy/application/views/scripts/library/library.phtml
@@ -1,15 +1,15 @@
-<?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+<?php $baseUrl = Config::getBasePath(); ?>
 <div id="import_status" class="library_import" style="display:none">
 	<?php echo _("File import in progress..."); ?>
-	<img src=<?php echo $baseUrl . "css/images/file_import_loader.gif"?>></img>
+	<img src=<?php echo $baseUrl . "css/images/file_import_loader.gif" ?>></img>
 </div>
 
 <fieldset class="toggle closed" id="filter_options">
-    <legend style="cursor: pointer;">
-    	<span class="ui-icon ui-icon-triangle-2-n-s"></span>
-    	<?php echo _("Advanced Search Options") ?>
-    </legend>
-    <div id="advanced_search" class="advanced_search form-horizontal"></div>
+	<legend style="cursor: pointer;">
+		<span class="ui-icon ui-icon-triangle-2-n-s"></span>
+		<?php echo _("Advanced Search Options") ?>
+	</legend>
+	<div id="advanced_search" class="advanced_search form-horizontal"></div>
 </fieldset>
 
 <table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
diff --git a/legacy/application/views/scripts/preference/index.phtml b/legacy/application/views/scripts/preference/index.phtml
index 1cd3d68a7..a98da8a8f 100644
--- a/legacy/application/views/scripts/preference/index.phtml
+++ b/legacy/application/views/scripts/preference/index.phtml
@@ -1,6 +1,6 @@
 <div class="ui-widget prefpanel simple-formblock clearfix padded-strong preferences">
     <h2 id="preferences_header"><?php echo _("General") ?></h2>
-    <?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+    <?php $baseUrl = Config::getBasePath(); ?>
     <form method="post" id="pref_form" enctype="multipart/form-data">
 
         <?php echo $this->form->getElement('submit')->render() ?>
@@ -10,6 +10,6 @@
         echo $this->statusMsg;
         echo $this->form;
         ?>
-        <br/>
+        <br />
     </form>
 </div>
diff --git a/legacy/application/views/scripts/preference/stream-setting.phtml b/legacy/application/views/scripts/preference/stream-setting.phtml
index 3037dbb58..ef732f4c2 100644
--- a/legacy/application/views/scripts/preference/stream-setting.phtml
+++ b/legacy/application/views/scripts/preference/stream-setting.phtml
@@ -1,121 +1,123 @@
 <div class="ui-widget prefpanel simple-formblock clearfix padded-strong stream-config">
     <h2 style="float:left"><?php echo _("Stream Settings") ?></h2>
-    <?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
+    <?php $baseUrl = Config::getBasePath(); ?>
     <form method="post" id="stream_form" enctype="application/x-www-form-urlencoded">
-    <button name="stream_save" id="stream_save_top" type="button" class="btn right-floated"><?php echo _("Save") ?></button>
-    <?php echo $this->form->getElement('csrf') ?>
-    <div style="clear:both"></div>
-  <?php echo $this->statusMsg;?>
-  <div style="float: left; margin-right: 10px; width: 50%; overflow: auto;">
+        <button name="stream_save" id="stream_save_top" type="button" class="btn right-floated"><?php echo _("Save") ?></button>
+        <?php echo $this->form->getElement('csrf') ?>
+        <div style="clear:both"></div>
+        <?php echo $this->statusMsg; ?>
+        <div style="float: left; margin-right: 10px; width: 50%; overflow: auto;">
 
-    <h3><?php echo _("Global") ?></h3>
-    <fieldset class="padded stream-setting-global">
-        <dl class="zend_form">
-        <?php if($this->form->getElement('output_sound_device') != null){?>
-            <dt id="hardwareOut-label">
-                <label class="required">
-                <?php echo $this->form->getElement('output_sound_device')->getLabel() ?> :
-                </label>
-            </dt>
-            <dd id="hardwareOut-element">
-                <?php echo $this->form->getElement('output_sound_device') ?>
-            </dd>
-            <dt id="hardwareOutType-label">
-                <label class="required">
-                <?php echo $this->form->getElement('output_sound_device_type')->getLabel() ?> :
-                </label>
-            </dt>
-            <dd id="hardwareOutType-element">
-                <?php echo $this->form->getElement('output_sound_device_type') ?>
-            </dd>
-        <?php } ?>
-            <dt id="vorbisMetadata-label">
-                <label class="required">
-                    <?php echo $this->form->getElement('icecast_vorbis_metadata')->getLabel() ?> :
-                    <span class='icecast_metadata_help_icon'></span>
-                </label>
-            </dt>
-            <dd id="vorbisMetadata-element">
-                <?php echo $this->form->getElement('icecast_vorbis_metadata') ?>
-            </dd>
+            <h3><?php echo _("Global") ?></h3>
+            <fieldset class="padded stream-setting-global">
+                <dl class="zend_form">
+                    <?php if ($this->form->getElement('output_sound_device') != null) { ?>
+                        <dt id="hardwareOut-label">
+                            <label class="required">
+                                <?php echo $this->form->getElement('output_sound_device')->getLabel() ?> :
+                            </label>
+                        </dt>
+                        <dd id="hardwareOut-element">
+                            <?php echo $this->form->getElement('output_sound_device') ?>
+                        </dd>
+                        <dt id="hardwareOutType-label">
+                            <label class="required">
+                                <?php echo $this->form->getElement('output_sound_device_type')->getLabel() ?> :
+                            </label>
+                        </dt>
+                        <dd id="hardwareOutType-element">
+                            <?php echo $this->form->getElement('output_sound_device_type') ?>
+                        </dd>
+                    <?php } ?>
+                    <dt id="vorbisMetadata-label">
+                        <label class="required">
+                            <?php echo $this->form->getElement('icecast_vorbis_metadata')->getLabel() ?> :
+                            <span class='icecast_metadata_help_icon'></span>
+                        </label>
+                    </dt>
+                    <dd id="vorbisMetadata-element">
+                        <?php echo $this->form->getElement('icecast_vorbis_metadata') ?>
+                    </dd>
 
-            <dt id="streamFormat-label">
-                <label class="optional"><?php echo $this->form->getElement('streamFormat')->getLabel() ?></label>
-            </dt>
-            <br>
-            <dd id="streamFormat-element" class="radio-inline-list">
-                <?php $i=0;
-                      $value = $this->form->getElement('streamFormat')->getValue();
+                    <dt id="streamFormat-label">
+                        <label class="optional"><?php echo $this->form->getElement('streamFormat')->getLabel() ?></label>
+                    </dt>
+                    <br>
+                    <dd id="streamFormat-element" class="radio-inline-list">
+                        <?php $i = 0;
+                        $value = $this->form->getElement('streamFormat')->getValue();
+                        ?>
+                        <?php foreach ($this->form->getElement('streamFormat')->getMultiOptions() as $radio) : ?>
+                            <label for="streamFormat-<?php echo $i ?>">
+                                <input type="radio" value="<?php echo $i ?>" id="streamFormat-<?php echo $i ?>" name="streamFormat" <?php if ($i == $value) {
+                                                                                                                                        echo 'checked="checked"';
+                                                                                                                                    } ?>>
+                                <?php echo $radio ?> <br><br>
+                                </input>
+                            </label>
+                            <?php $i = $i + 1; ?>
+                        <?php endforeach; ?>
+                        <?php if ($this->form->getElement('streamFormat')->hasErrors()) : ?>
+                            <ul class='errors'>
+                                <?php foreach ($this->form->getElement('streamFormat')->getMessages() as $error) : ?>
+                                    <li><?php echo $error; ?></li>
+                                <?php endforeach; ?>
+                            </ul>
+                        <?php endif; ?>
+                    </dd>
+                    <dt id="offAirMeta-label">
+                        <label>
+                            <?php echo $this->form->getElement('offAirMeta')->getLabel() ?> :
+                        </label>
+                    </dt>
+                    <dd id="offAirMeta-element">
+                        <?php echo $this->form->getElement('offAirMeta') ?>
+                    </dd>
+                    <dt id="enableReplayGain-label">
+                        <label>
+                            <?php echo $this->form->getElement('enableReplayGain')->getLabel() ?> :
+                        </label>
+                    </dt>
+                    <dd id="enableReplayGain-element">
+                        <?php echo $this->form->getElement('enableReplayGain') ?>
+                    </dd>
+                    <dt id="replayGainModifier-label" class="block-display">
+                        <label><?php echo $this->form->getElement('replayGainModifier')->getLabel() ?>:
+                        </label>
+                        <span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
+                            <?php echo $this->form->getElement('replayGainModifier')->getValue() ?>
+                        </span>
+                        <?php echo _("dB") ?>
+                    </dt>
+                    <dd id="replayGainModifier-element" class="block-display">
+                        <?php echo $this->form->getElement('replayGainModifier') ?>
+                        <?php if ($this->form->getElement('replayGainModifier')->hasErrors()) : ?>
+                            <ul class='errors'>
+                                <?php foreach ($this->form->getElement('replayGainModifier')->getMessages() as $error) : ?>
+                                    <li><?php echo $error; ?></li>
+                                <?php endforeach; ?>
+                            </ul>
+                        <?php endif; ?>
+                        <div id="slider-range-max" style="width: 99%"></div>
+                    </dd>
+                </dl>
+            </fieldset>
+            <?php echo $this->form->getSubform('live_stream_subform'); ?>
+        </div>
+        <div style="float: left; width: 48%;">
+            <h3><?php echo _("Output Streams") ?></h3>
+            <fieldset class="padded">
+                <?php
+                // TODO: replace this with something that looks good
+                echo $this->form->getElement('customStreamSettings')->render();
+                for ($i = 1; $i <= $this->num_stream; $i++) {
+                    echo $this->form->getSubform("s" . $i . "_subform");
+                }
                 ?>
-                <?php foreach ($this->form->getElement('streamFormat')->getMultiOptions() as $radio) : ?>
-                    <label for="streamFormat-<?php echo $i ?>">
-                        <input type="radio" value="<?php echo $i ?>" id="streamFormat-<?php echo $i ?>" name="streamFormat" <?php if($i == $value){echo 'checked="checked"';}?> >
-                            <?php echo $radio ?> <br><br>
-                        </input>
-                    </label>
-                    <?php $i = $i + 1; ?>
-                <?php endforeach; ?>
-                <?php if($this->form->getElement('streamFormat')->hasErrors()) : ?>
-                    <ul class='errors'>
-                        <?php foreach($this->form->getElement('streamFormat')->getMessages() as $error): ?>
-                            <li><?php echo $error; ?></li>
-                        <?php endforeach; ?>
-                    </ul>
-                <?php endif; ?>
-            </dd>
-            <dt id="offAirMeta-label">
-                <label>
-                    <?php echo $this->form->getElement('offAirMeta')->getLabel() ?> :
-                </label>
-            </dt>
-            <dd id="offAirMeta-element">
-                <?php echo $this->form->getElement('offAirMeta') ?>
-            </dd>
-            <dt id="enableReplayGain-label">
-                <label>
-                <?php echo $this->form->getElement('enableReplayGain')->getLabel() ?> :
-                </label>
-            </dt>
-            <dd id="enableReplayGain-element">
-                <?php echo $this->form->getElement('enableReplayGain') ?>
-            </dd>
-            <dt id="replayGainModifier-label" class="block-display">
-                <label><?php echo $this->form->getElement('replayGainModifier')->getLabel() ?>:
-                </label>
-                <span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
-                    <?php echo $this->form->getElement('replayGainModifier')->getValue() ?>
-                </span>
-                <?php echo _("dB")?>
-            </dt>
-            <dd id="replayGainModifier-element" class="block-display">
-                <?php echo $this->form->getElement('replayGainModifier') ?>
-                <?php if($this->form->getElement('replayGainModifier')->hasErrors()) : ?>
-                    <ul class='errors'>
-                        <?php foreach($this->form->getElement('replayGainModifier')->getMessages() as $error): ?>
-                            <li><?php echo $error; ?></li>
-                        <?php endforeach; ?>
-                    </ul>
-                <?php endif; ?>
-                <div id="slider-range-max" style="width: 99%"></div>
-            </dd>
-        </dl>
-    </fieldset>
-    <?php echo $this->form->getSubform('live_stream_subform'); ?>
-  </div>
-  <div style="float: left; width: 48%;">
-      <h3><?php echo _("Output Streams") ?></h3>
-    <fieldset class="padded">
-        <?php
-            // TODO: replace this with something that looks good
-            echo $this->form->getElement('customStreamSettings')->render();
-            for($i=1;$i<=$this->num_stream;$i++){
-                echo $this->form->getSubform("s".$i."_subform");
-            }
-        ?>
-    </fieldset>
-    <br />
-      <div style="clear: both"></div>
-    <button name="stream_save" id="stream_save_bottom" type="button" class="btn right-floated"><?php echo _("Save") ?></button>
-  </div>
+            </fieldset>
+            <br />
+            <div style="clear: both"></div>
+            <button name="stream_save" id="stream_save_bottom" type="button" class="btn right-floated"><?php echo _("Save") ?></button>
+        </div>
     </form>
 </div>