Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
a85b394d63
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__."/configs/conf.php";
|
require_once __DIR__."/configs/conf.php";
|
||||||
|
Config::loadConfig();
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
require_once __DIR__."/configs/ACL.php";
|
require_once __DIR__."/configs/ACL.php";
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
|
|
||||||
|
@ -20,13 +23,11 @@ require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
require_once (APPLICATION_PATH."/logging/Logging.php");
|
require_once (APPLICATION_PATH."/logging/Logging.php");
|
||||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||||
|
Logging::info($CC_CONFIG);
|
||||||
date_default_timezone_set(Application_Model_Preference::GetTimezone());
|
date_default_timezone_set(Application_Model_Preference::GetTimezone());
|
||||||
|
|
||||||
global $CC_CONFIG;
|
Config::setAirtimeVersion();
|
||||||
$airtime_version = Application_Model_Preference::GetAirtimeVersion();
|
$CC_CONFIG = Config::getConfig();
|
||||||
$uniqueid = Application_Model_Preference::GetUniqueId();
|
|
||||||
$CC_CONFIG['airtime_version'] = md5($airtime_version.$uniqueid);
|
|
||||||
require_once __DIR__."/configs/navigation.php";
|
require_once __DIR__."/configs/navigation.php";
|
||||||
|
|
||||||
Zend_Validate::setDefaultNamespaces("Zend");
|
Zend_Validate::setDefaultNamespaces("Zend");
|
||||||
|
@ -67,7 +68,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
|
|
||||||
protected function _initHeadLink()
|
protected function _initHeadLink()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
|
|
||||||
protected function _initHeadScript()
|
protected function _initHeadScript()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
|
|
||||||
|
@ -127,8 +128,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
||||||
&& !($_SERVER['REQUEST_URI'] == $baseUrl.'Dashboard/stream-player' ||
|
&& !($_SERVER['REQUEST_URI'] == $baseUrl.'Dashboard/stream-player' ||
|
||||||
strncmp($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview', strlen($baseUrl.'audiopreview/audio-preview'))==0)) {
|
strncmp($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview', strlen($baseUrl.'audiopreview/audio-preview'))==0)) {
|
||||||
|
|
||||||
$client_id = Application_Model_Preference::GetClientId();
|
$client_id = Application_Model_Preference::GetClientId();
|
||||||
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
|
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
|
||||||
$view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
@ -151,7 +153,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
protected function _initZFDebug()
|
protected function _initZFDebug()
|
||||||
{
|
{
|
||||||
|
|
||||||
Zend_Controller_Front::getInstance()->throwExceptions(true);
|
Zend_Controller_Front::getInstance()->throwExceptions(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (APPLICATION_ENV == "development") {
|
if (APPLICATION_ENV == "development") {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* that the user can customize these.
|
* that the user can customize these.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$dbhost = $CC_CONFIG['dsn']['hostspec'];
|
$dbhost = $CC_CONFIG['dsn']['hostspec'];
|
||||||
$dbname = $CC_CONFIG['dsn']['database'];
|
$dbname = $CC_CONFIG['dsn']['database'];
|
||||||
|
|
|
@ -6,53 +6,20 @@
|
||||||
* /etc/airtime/recorder.cfg
|
* /etc/airtime/recorder.cfg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $CC_CONFIG;
|
|
||||||
|
|
||||||
$CC_CONFIG = array(
|
|
||||||
// prefix for table names in the database
|
|
||||||
'tblNamePrefix' => 'cc_',
|
|
||||||
|
|
||||||
/* ================================================ storage configuration */
|
|
||||||
|
|
||||||
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
|
||||||
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
|
||||||
|
|
||||||
"rootDir" => __DIR__."/../.."
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
|
||||||
Config::loadConfig($configFile);
|
|
||||||
|
|
||||||
// Add database table names
|
|
||||||
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
|
||||||
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents';
|
|
||||||
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files';
|
|
||||||
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access';
|
|
||||||
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms';
|
|
||||||
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess';
|
|
||||||
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs';
|
|
||||||
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb';
|
|
||||||
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
|
|
||||||
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule';
|
|
||||||
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
|
|
||||||
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule';
|
|
||||||
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days';
|
|
||||||
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show';
|
|
||||||
$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'].'show_instances';
|
|
||||||
|
|
||||||
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
|
|
||||||
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';
|
|
||||||
$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'].'_id';
|
|
||||||
$CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id';
|
|
||||||
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
|
|
||||||
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
|
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
public static function loadConfig($p_path) {
|
private static $CC_CONFIG;
|
||||||
global $CC_CONFIG;
|
public static function loadConfig() {
|
||||||
|
$CC_CONFIG = array(
|
||||||
|
/* ================================================ storage configuration */
|
||||||
|
|
||||||
$filename = $p_path;
|
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
||||||
|
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
||||||
|
|
||||||
|
"rootDir" => __DIR__."/../.."
|
||||||
|
);
|
||||||
|
|
||||||
|
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
|
||||||
$values = parse_ini_file($filename, true);
|
$values = parse_ini_file($filename, true);
|
||||||
|
|
||||||
// Name of the web server user
|
// Name of the web server user
|
||||||
|
@ -61,6 +28,7 @@ class Config {
|
||||||
|
|
||||||
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
||||||
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
||||||
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||||
|
|
||||||
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
|
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
|
||||||
|
|
||||||
|
@ -85,6 +53,17 @@ class Config {
|
||||||
|
|
||||||
if(isset($values['demo']['demo'])){
|
if(isset($values['demo']['demo'])){
|
||||||
$CC_CONFIG['demo'] = $values['demo']['demo'];
|
$CC_CONFIG['demo'] = $values['demo']['demo'];
|
||||||
}
|
}
|
||||||
|
self::$CC_CONFIG = $CC_CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setAirtimeVersion() {
|
||||||
|
$airtime_version = Application_Model_Preference::GetAirtimeVersion();
|
||||||
|
$uniqueid = Application_Model_Preference::GetUniqueId();
|
||||||
|
self::$CC_CONFIG['airtime_version'] = md5($airtime_version.$uniqueid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getConfig() {
|
||||||
|
return self::$CC_CONFIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,6 @@
|
||||||
* yet available because airtime.conf hasn't been updated yet. This situation ends up throwing a lot of errors to stdout.
|
* yet available because airtime.conf hasn't been updated yet. This situation ends up throwing a lot of errors to stdout.
|
||||||
* airtime*/
|
* airtime*/
|
||||||
|
|
||||||
global $CC_CONFIG;
|
require_once("conf.php");
|
||||||
|
|
||||||
$filename = "/etc/airtime/airtime.conf";
|
$CC_CONFIG = Config::getConfig();
|
||||||
$values = parse_ini_file($filename, true);
|
|
||||||
|
|
||||||
// Database config
|
|
||||||
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
|
|
||||||
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
|
|
||||||
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
|
|
||||||
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
|
|
||||||
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function checkAuth()
|
public function checkAuth()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$api_key = $this->_getParam('api_key');
|
$api_key = $this->_getParam('api_key');
|
||||||
|
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
|
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
|
||||||
|
|
|
@ -19,7 +19,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
public function audioPreviewAction()
|
public function audioPreviewAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$audioFileID = $this->_getParam('audioFileID');
|
$audioFileID = $this->_getParam('audioFileID');
|
||||||
$audioFileArtist = $this->_getParam('audioFileArtist');
|
$audioFileArtist = $this->_getParam('audioFileArtist');
|
||||||
|
@ -73,7 +73,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
public function playlistPreviewAction()
|
public function playlistPreviewAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$playlistIndex = $this->_getParam('playlistIndex');
|
$playlistIndex = $this->_getParam('playlistIndex');
|
||||||
$playlistID = $this->_getParam('playlistID');
|
$playlistID = $this->_getParam('playlistID');
|
||||||
|
@ -99,7 +99,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function blockPreviewAction()
|
public function blockPreviewAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$blockIndex = $this->_getParam('blockIndex');
|
$blockIndex = $this->_getParam('blockIndex');
|
||||||
$blockId = $this->_getParam('blockId');
|
$blockId = $this->_getParam('blockId');
|
||||||
|
@ -226,7 +226,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
public function showPreviewAction()
|
public function showPreviewAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$showID = $this->_getParam('showID');
|
$showID = $this->_getParam('showID');
|
||||||
$showIndex = $this->_getParam('showIndex');
|
$showIndex = $this->_getParam('showIndex');
|
||||||
|
|
|
@ -96,7 +96,7 @@ class DashboardController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function streamPlayerAction()
|
public function streamPlayerAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
|
@ -12,7 +12,7 @@ class ListenerstatController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
|
@ -9,7 +9,7 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function passwordRestoreAction()
|
public function passwordRestoreAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class PluploadController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
$locale = Application_Model_Preference::GetLocale();
|
$locale = Application_Model_Preference::GetLocale();
|
||||||
|
|
|
@ -20,7 +20,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
@ -80,7 +80,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function supportSettingAction()
|
public function supportSettingAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function directoryConfigAction()
|
public function directoryConfigAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function streamSettingAction()
|
public function streamSettingAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
|
@ -879,8 +879,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function contentContextMenuAction()
|
public function contentContextMenuAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
|
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
|
|
||||||
$params = '/format/json/id/#id#/';
|
$params = '/format/json/id/#id#/';
|
||||||
|
@ -922,8 +920,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function calculateDurationAction()
|
public function calculateDurationAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
|
|
||||||
$startParam = $this->_getParam('startTime');
|
$startParam = $this->_getParam('startTime');
|
||||||
$endParam = $this->_getParam('endTime');
|
$endParam = $this->_getParam('endTime');
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class SystemstatusController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class UserController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function addUserAction()
|
public function addUserAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
@ -48,8 +48,8 @@ class UserController extends Zend_Controller_Action
|
||||||
|
|
||||||
if ($form->isValid($formData)) {
|
if ($form->isValid($formData)) {
|
||||||
|
|
||||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
|
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
|
||||||
&& $formData['login'] == 'admin'
|
&& $formData['login'] == 'admin'
|
||||||
&& $formData['user_id'] != 0) {
|
&& $formData['user_id'] != 0) {
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->successMessage = "<div class='errors'>"._("Specific action is not allowed in demo version!")."</div>";
|
$this->view->successMessage = "<div class='errors'>"._("Specific action is not allowed in demo version!")."</div>";
|
||||||
|
@ -131,12 +131,12 @@ class UserController extends Zend_Controller_Action
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
$formData = $request->getPost();
|
$formData = $request->getPost();
|
||||||
|
|
||||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
|
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
|
||||||
&& $formData['cu_login'] == 'admin') {
|
&& $formData['cu_login'] == 'admin') {
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->successMessage = "<div class='errors'>"._("Specific action is not allowed in demo version!")."</div>";
|
$this->view->successMessage = "<div class='errors'>"._("Specific action is not allowed in demo version!")."</div>";
|
||||||
die(json_encode(array("html"=>$this->view->render('user/edit-user.phtml'))));
|
die(json_encode(array("html"=>$this->view->render('user/edit-user.phtml'))));
|
||||||
} else if ($form->isValid($formData) &&
|
} else if ($form->isValid($formData) &&
|
||||||
$form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) {
|
$form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) {
|
||||||
$user = new Application_Model_User($formData['cu_user_id']);
|
$user = new Application_Model_User($formData['cu_user_id']);
|
||||||
$user->setFirstName($formData['cu_first_name']);
|
$user->setFirstName($formData['cu_first_name']);
|
||||||
|
@ -186,7 +186,7 @@ class UserController extends Zend_Controller_Action
|
||||||
# only delete when valid action is selected for the owned files
|
# only delete when valid action is selected for the owned files
|
||||||
if (! in_array($files_action, $valid_actions) ) {
|
if (! in_array($files_action, $valid_actions) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$userId = $userInfo->id;
|
$userId = $userInfo->id;
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
||||||
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
|
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function updateVariables()
|
public function updateVariables()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
||||||
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
|
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_Login extends Zend_Form
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
// Set the method for the display form to POST
|
// Set the method for the display form to POST
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
|
@ -940,9 +940,8 @@ SQL;
|
||||||
|
|
||||||
public static function getBlockCount()
|
public static function getBlockCount()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"];
|
$sql = 'SELECT count(*) as cnt FROM cc_playlist';
|
||||||
|
|
||||||
return $con->query($sql)->fetchColumn(0);
|
return $con->query($sql)->fetchColumn(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -869,9 +869,8 @@ SQL;
|
||||||
|
|
||||||
public static function getPlaylistCount()
|
public static function getPlaylistCount()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"];
|
$sql = 'SELECT count(*) as cnt FROM cc_playlist';
|
||||||
|
|
||||||
return $con->query($sql)->fetchColumn(0);
|
return $con->query($sql)->fetchColumn(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Application_Model_RabbitMq
|
||||||
|
|
||||||
private static function sendMessage($exchange, $data)
|
private static function sendMessage($exchange, $data)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||||
$CC_CONFIG["rabbitmq"]["port"],
|
$CC_CONFIG["rabbitmq"]["port"],
|
||||||
|
|
|
@ -181,15 +181,14 @@ SQL;
|
||||||
|
|
||||||
public static function GetLastScheduleItem($p_timeNow)
|
public static function GetLastScheduleItem($p_timeNow)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT ft.artist_name,
|
SELECT ft.artist_name,
|
||||||
ft.track_title,
|
ft.track_title,
|
||||||
st.starts AS starts,
|
st.starts AS starts,
|
||||||
st.ends AS ends
|
st.ends AS ends
|
||||||
FROM cc_schedule st
|
FROM cc_schedule st
|
||||||
LEFT JOIN $CC_CONFIG[filesTable] ft ON st.file_id = ft.id
|
LEFT JOIN cc_files ft ON st.file_id = ft.id
|
||||||
LEFT JOIN $CC_CONFIG[showInstances] sit ON st.instance_id = sit.id
|
LEFT JOIN cc_show_instances sit ON st.instance_id = sit.id
|
||||||
-- this and the next line are necessary since we can overbook shows.
|
-- this and the next line are necessary since we can overbook shows.
|
||||||
WHERE st.ends < TIMESTAMP :timeNow
|
WHERE st.ends < TIMESTAMP :timeNow
|
||||||
|
|
||||||
|
@ -204,7 +203,6 @@ SQL;
|
||||||
|
|
||||||
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId)
|
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
/* Note that usually there will be one result returned. In some
|
/* Note that usually there will be one result returned. In some
|
||||||
* rare cases two songs are returned. This happens when a track
|
* rare cases two songs are returned. This happens when a track
|
||||||
* that was overbooked from a previous show appears as if it
|
* that was overbooked from a previous show appears as if it
|
||||||
|
@ -213,8 +211,8 @@ SQL;
|
||||||
* this is the *real* track that is currently playing. So this
|
* this is the *real* track that is currently playing. So this
|
||||||
* is why we are ordering by track start time. */
|
* is why we are ordering by track start time. */
|
||||||
$sql = "SELECT *"
|
$sql = "SELECT *"
|
||||||
." FROM $CC_CONFIG[scheduleTable] st"
|
." FROM cc_schedule st"
|
||||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
." LEFT JOIN cc_files ft"
|
||||||
." ON st.file_id = ft.id"
|
." ON st.file_id = ft.id"
|
||||||
." WHERE st.starts <= TIMESTAMP :timeNow1"
|
." WHERE st.starts <= TIMESTAMP :timeNow1"
|
||||||
." AND st.instance_id = :instanceId"
|
." AND st.instance_id = :instanceId"
|
||||||
|
@ -229,14 +227,13 @@ SQL;
|
||||||
|
|
||||||
public static function GetNextScheduleItem($p_timeNow)
|
public static function GetNextScheduleItem($p_timeNow)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$sql = "SELECT"
|
$sql = "SELECT"
|
||||||
." ft.artist_name, ft.track_title,"
|
." ft.artist_name, ft.track_title,"
|
||||||
." st.starts as starts, st.ends as ends"
|
." st.starts as starts, st.ends as ends"
|
||||||
." FROM $CC_CONFIG[scheduleTable] st"
|
." FROM cc_schedule st"
|
||||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
." LEFT JOIN cc_files ft"
|
||||||
." ON st.file_id = ft.id"
|
." ON st.file_id = ft.id"
|
||||||
." LEFT JOIN $CC_CONFIG[showInstances] sit"
|
." LEFT JOIN cc_show_instances sit"
|
||||||
." ON st.instance_id = sit.id"
|
." ON st.instance_id = sit.id"
|
||||||
." WHERE st.starts > TIMESTAMP :timeNow"
|
." WHERE st.starts > TIMESTAMP :timeNow"
|
||||||
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
||||||
|
@ -260,7 +257,6 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$p_start_str = $p_start->format("Y-m-d H:i:s");
|
$p_start_str = $p_start->format("Y-m-d H:i:s");
|
||||||
|
@ -386,9 +382,8 @@ SQL;
|
||||||
|
|
||||||
public static function UpdateMediaPlayedStatus($p_id)
|
public static function UpdateMediaPlayedStatus($p_id)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
$sql = "UPDATE cc_schedule"
|
||||||
." SET media_item_played=TRUE";
|
." SET media_item_played=TRUE";
|
||||||
// we need to update 'broadcasted' column as well
|
// we need to update 'broadcasted' column as well
|
||||||
// check the current switch status
|
// check the current switch status
|
||||||
|
@ -427,9 +422,8 @@ SQL;
|
||||||
|
|
||||||
public static function getSchduledPlaylistCount()
|
public static function getSchduledPlaylistCount()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['scheduleTable'];
|
$sql = "SELECT count(*) as cnt FROM cc_schedule";
|
||||||
|
|
||||||
return $con->query($sql)->fetchColumn(0);
|
return $con->query($sql)->fetchColumn(0);
|
||||||
}
|
}
|
||||||
|
@ -769,7 +763,7 @@ SQL;
|
||||||
|
|
||||||
private static function getRangeStartAndEnd($p_fromDateTime, $p_toDateTime)
|
private static function getRangeStartAndEnd($p_fromDateTime, $p_toDateTime)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
/* if $p_fromDateTime and $p_toDateTime function parameters are null,
|
/* if $p_fromDateTime and $p_toDateTime function parameters are null,
|
||||||
then set range * from "now" to "now + 24 hours". */
|
then set range * from "now" to "now + 24 hours". */
|
||||||
|
@ -918,15 +912,13 @@ SQL;
|
||||||
|
|
||||||
public static function deleteAll()
|
public static function deleteAll()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$con->exec("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
|
$con->exec("TRUNCATE TABLE cc_schedule");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteWithFileId($fileId)
|
public static function deleteWithFileId($fileId)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$sql = "DELETE FROM cc_schedule WHERE file_id=:file_id";
|
||||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=:file_id";
|
|
||||||
Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ SQL;
|
||||||
->find($con);
|
->find($con);
|
||||||
|
|
||||||
/* Check two things:
|
/* Check two things:
|
||||||
1. If the show being resized and any of its repeats end in the past
|
1. If the show being resized and any of its repeats end in the past
|
||||||
2. If the show being resized and any of its repeats overlap
|
2. If the show being resized and any of its repeats overlap
|
||||||
with other scheduled shows */
|
with other scheduled shows */
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ SQL;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Logging::info($e->getMessage());
|
Logging::info($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ SQL;
|
||||||
$startDateTime = new DateTime($show["starts"], $utc);
|
$startDateTime = new DateTime($show["starts"], $utc);
|
||||||
$startDateTime->setTimezone($dtz);
|
$startDateTime->setTimezone($dtz);
|
||||||
|
|
||||||
$rebroadcastsLocal[$i]["start_date"] =
|
$rebroadcastsLocal[$i]["start_date"] =
|
||||||
$startDateTime->format("Y-m-d");
|
$startDateTime->format("Y-m-d");
|
||||||
$rebroadcastsLocal[$i]["start_time"] =
|
$rebroadcastsLocal[$i]["start_time"] =
|
||||||
$startDateTime->format("H:i");
|
$startDateTime->format("H:i");
|
||||||
|
@ -533,7 +533,7 @@ SQL;
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
if (!is_null($showDaysRow))
|
if (!is_null($showDaysRow))
|
||||||
return $showDaysRow->getDbRepeatType();
|
return $showDaysRow->getDbRepeatType();
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -582,7 +582,7 @@ WHERE starts > :timestamp::TIMESTAMP
|
||||||
AND show_id = :showId
|
AND show_id = :showId
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql,
|
Application_Common_Database::prepareAndExecute( $sql,
|
||||||
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
||||||
':showId' => $this->getId()), 'execute');
|
':showId' => $this->getId()), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,7 +838,7 @@ WHERE show_id = :show_id
|
||||||
AND ends > :timestamp::TIMESTAMP
|
AND ends > :timestamp::TIMESTAMP
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
Application_Common_Database::prepareAndExecute( $sql, array(
|
Application_Common_Database::prepareAndExecute( $sql, array(
|
||||||
':add_show_duration' => $p_data['add_show_duration'],
|
':add_show_duration' => $p_data['add_show_duration'],
|
||||||
':show_id' => $p_data['add_show_id'],
|
':show_id' => $p_data['add_show_id'],
|
||||||
':timestamp' => $timestamp), "execute");
|
':timestamp' => $timestamp), "execute");
|
||||||
|
@ -1222,12 +1222,12 @@ SQL;
|
||||||
SELECT :rebroadcast::date - :start::date
|
SELECT :rebroadcast::date - :start::date
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$offset_days =
|
$offset_days =
|
||||||
Application_Common_Database::prepareAndExecute($sql,
|
Application_Common_Database::prepareAndExecute($sql,
|
||||||
array(
|
array(
|
||||||
'rebroadcast' =>
|
'rebroadcast' =>
|
||||||
$data["add_show_rebroadcast_date_absolute_$i"],
|
$data["add_show_rebroadcast_date_absolute_$i"],
|
||||||
'start' =>
|
'start' =>
|
||||||
$data['add_show_start_date']), "column" );
|
$data['add_show_start_date']), "column" );
|
||||||
|
|
||||||
//$r = $con->query($sql);
|
//$r = $con->query($sql);
|
||||||
|
@ -1770,7 +1770,7 @@ SQL;
|
||||||
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$startsDT = DateTime::createFromFormat("Y-m-d G:i:s",
|
$startsDT = DateTime::createFromFormat("Y-m-d G:i:s",
|
||||||
$show["starts"],$utc);
|
$show["starts"],$utc);
|
||||||
$endsDT = DateTime::createFromFormat("Y-m-d G:i:s",
|
$endsDT = DateTime::createFromFormat("Y-m-d G:i:s",
|
||||||
$show["ends"], $utc);
|
$show["ends"], $utc);
|
||||||
|
@ -1907,7 +1907,7 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public static function getCurrentShow($timeNow=null)
|
public static function getCurrentShow($timeNow=null)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
if ($timeNow == null) {
|
if ($timeNow == null) {
|
||||||
$date = new Application_Common_DateHelper;
|
$date = new Application_Common_DateHelper;
|
||||||
|
@ -1953,7 +1953,7 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public static function getPrevCurrentNext($p_timeNow)
|
public static function getPrevCurrentNext($p_timeNow)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
//
|
//
|
||||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Application_Model_Soundcloud
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$this->_soundcloud = new Services_Soundcloud(
|
$this->_soundcloud = new Services_Soundcloud(
|
||||||
$CC_CONFIG['soundcloud-client-id'],
|
$CC_CONFIG['soundcloud-client-id'],
|
||||||
$CC_CONFIG['soundcloud-client-secret']);
|
$CC_CONFIG['soundcloud-client-secret']);
|
||||||
|
@ -25,11 +25,11 @@ class Application_Model_Soundcloud
|
||||||
|
|
||||||
public function uploadTrack($filepath, $filename, $description,
|
public function uploadTrack($filepath, $filename, $description,
|
||||||
$tags=array(), $release=null, $genre=null)
|
$tags=array(), $release=null, $genre=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!$this->getToken()) {
|
if (!$this->getToken()) {
|
||||||
throw new NoSoundCloundToken();
|
throw new NoSoundCloundToken();
|
||||||
}
|
}
|
||||||
if (count($tags)) {
|
if (count($tags)) {
|
||||||
$tags = join(" ", $tags);
|
$tags = join(" ", $tags);
|
||||||
$tags = $tags." ".Application_Model_Preference::GetSoundCloudTags();
|
$tags = $tags." ".Application_Model_Preference::GetSoundCloudTags();
|
||||||
|
@ -88,7 +88,7 @@ class Application_Model_Soundcloud
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function uploadSoundcloud($id)
|
public static function uploadSoundcloud($id)
|
||||||
{
|
{
|
||||||
$cmd = "/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &";
|
$cmd = "/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &";
|
||||||
Logging::info("Uploading soundcloud with command: $cmd");
|
Logging::info("Uploading soundcloud with command: $cmd");
|
||||||
|
|
|
@ -504,7 +504,7 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function getFileUrlUsingConfigAddress()
|
public function getFileUrlUsingConfigAddress()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
if (isset($CC_CONFIG['baseUrl'])) {
|
if (isset($CC_CONFIG['baseUrl'])) {
|
||||||
$serverName = $CC_CONFIG['baseUrl'];
|
$serverName = $CC_CONFIG['baseUrl'];
|
||||||
|
@ -1218,7 +1218,7 @@ SQL;
|
||||||
// note: never call this method from controllers because it does a sleep
|
// note: never call this method from controllers because it does a sleep
|
||||||
public function uploadToSoundCloud()
|
public function uploadToSoundCloud()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$file = $this->_file;
|
$file = $this->_file;
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
|
|
|
@ -20,9 +20,8 @@ class Application_Model_Subjects
|
||||||
|
|
||||||
public static function increaseLoginAttempts($login)
|
public static function increaseLoginAttempts($login)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = login_attempts+1"
|
$sql = "UPDATE cc_subjs SET login_attempts = login_attempts+1"
|
||||||
." WHERE login='$login'";
|
." WHERE login='$login'";
|
||||||
$res = $con->exec($sql);
|
$res = $con->exec($sql);
|
||||||
|
|
||||||
|
@ -31,9 +30,8 @@ class Application_Model_Subjects
|
||||||
|
|
||||||
public static function resetLoginAttempts($login)
|
public static function resetLoginAttempts($login)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
$sql = "UPDATE cc_subjs SET login_attempts = '0'"
|
||||||
." WHERE login='$login'";
|
." WHERE login='$login'";
|
||||||
$res = $con->exec($sql);
|
$res = $con->exec($sql);
|
||||||
|
|
||||||
|
@ -42,9 +40,8 @@ class Application_Model_Subjects
|
||||||
|
|
||||||
public static function getLoginAttempts($login)
|
public static function getLoginAttempts($login)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "SELECT login_attempts FROM ".$CC_CONFIG['subjTable']." WHERE login='$login'";
|
$sql = "SELECT login_attempts FROM cc_subjs WHERE login='$login'";
|
||||||
$res = $con->query($sql)->fetchColumn(0);
|
$res = $con->query($sql)->fetchColumn(0);
|
||||||
|
|
||||||
return ($res !== false) ? $res : 0;
|
return ($res !== false) ? $res : 0;
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
public static function GetMonitStatus($p_ip)
|
public static function GetMonitStatus($p_ip)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$monit_user = $CC_CONFIG['monit_user'];
|
$monit_user = $CC_CONFIG['monit_user'];
|
||||||
$monit_password = $CC_CONFIG['monit_password'];
|
$monit_password = $CC_CONFIG['monit_password'];
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,10 @@ else
|
||||||
echo "NGINX config for Airtime already exists..."
|
echo "NGINX config for Airtime already exists..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Install Sourcefabric's custom Liquidsoap debian package
|
||||||
|
apt-get -y --force-yes install sourcefabric-keyring
|
||||||
|
apt-get -y --force-yes install liquidsoap
|
||||||
|
|
||||||
# php-fpm Airtime pool file
|
# php-fpm Airtime pool file
|
||||||
echo "----------------------------------------------------"
|
echo "----------------------------------------------------"
|
||||||
echo "2.2 Airtime php pool file"
|
echo "2.2 Airtime php pool file"
|
||||||
|
|
|
@ -126,7 +126,7 @@ class AirtimeInstall
|
||||||
*/
|
*/
|
||||||
public static function DbConnect($p_exitOnError = true)
|
public static function DbConnect($p_exitOnError = true)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -147,7 +147,7 @@ class AirtimeInstall
|
||||||
* install script. */
|
* install script. */
|
||||||
public static function InstallStorageDirectory()
|
public static function InstallStorageDirectory()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
echo "* Storage directory setup".PHP_EOL;
|
echo "* Storage directory setup".PHP_EOL;
|
||||||
|
|
||||||
$ini = parse_ini_file(__DIR__."/airtime-install.ini");
|
$ini = parse_ini_file(__DIR__."/airtime-install.ini");
|
||||||
|
@ -183,7 +183,7 @@ class AirtimeInstall
|
||||||
|
|
||||||
public static function CreateDatabaseUser()
|
public static function CreateDatabaseUser()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
echo " * Creating Airtime database user".PHP_EOL;
|
echo " * Creating Airtime database user".PHP_EOL;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class AirtimeInstall
|
||||||
|
|
||||||
public static function CreateDatabase()
|
public static function CreateDatabase()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
echo " * Creating Airtime database".PHP_EOL;
|
echo " * Creating Airtime database".PHP_EOL;
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ class AirtimeInstall
|
||||||
|
|
||||||
public static function InstallPhpCode()
|
public static function InstallPhpCode()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
echo "* Installing PHP code to ".AirtimeInstall::CONF_DIR_WWW.PHP_EOL;
|
echo "* Installing PHP code to ".AirtimeInstall::CONF_DIR_WWW.PHP_EOL;
|
||||||
exec("mkdir -p ".AirtimeInstall::CONF_DIR_WWW);
|
exec("mkdir -p ".AirtimeInstall::CONF_DIR_WWW);
|
||||||
exec("cp -R ".AirtimeInstall::GetAirtimeSrcDir()."/* ".AirtimeInstall::CONF_DIR_WWW);
|
exec("cp -R ".AirtimeInstall::GetAirtimeSrcDir()."/* ".AirtimeInstall::CONF_DIR_WWW);
|
||||||
|
@ -461,7 +461,7 @@ class AirtimeInstall
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CreateZendPhpLogFile(){
|
public static function CreateZendPhpLogFile(){
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$path = AirtimeInstall::CONF_DIR_LOG;
|
$path = AirtimeInstall::CONF_DIR_LOG;
|
||||||
$file = $path.'/zendphp.log';
|
$file = $path.'/zendphp.log';
|
||||||
|
|
|
@ -10,6 +10,8 @@ require_once(__DIR__.'/AirtimeInstall.php');
|
||||||
require_once(__DIR__.'/airtime-constants.php');
|
require_once(__DIR__.'/airtime-constants.php');
|
||||||
|
|
||||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||||
|
Config::loadConfig();
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
||||||
|
|
||||||
|
@ -24,7 +26,6 @@ AirtimeInstall::DbConnect(true);
|
||||||
AirtimeInstall::InstallPostgresScriptingLanguage();
|
AirtimeInstall::InstallPostgresScriptingLanguage();
|
||||||
|
|
||||||
//Load Database parameters
|
//Load Database parameters
|
||||||
global $CC_CONFIG;
|
|
||||||
$dbuser = $CC_CONFIG['dsn']['username'];
|
$dbuser = $CC_CONFIG['dsn']['username'];
|
||||||
$dbpasswd = $CC_CONFIG['dsn']['password'];
|
$dbpasswd = $CC_CONFIG['dsn']['password'];
|
||||||
$dbname = $CC_CONFIG['dsn']['database'];
|
$dbname = $CC_CONFIG['dsn']['database'];
|
||||||
|
|
|
@ -16,6 +16,8 @@ $iniExists = file_exists("/etc/airtime/airtime.conf");
|
||||||
if ($iniExists){
|
if ($iniExists){
|
||||||
//reinstall, Will ask if we should rewrite config files.
|
//reinstall, Will ask if we should rewrite config files.
|
||||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||||
|
Config::loadConfig();
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
||||||
$version = AirtimeInstall::GetVersionInstalled();
|
$version = AirtimeInstall::GetVersionInstalled();
|
||||||
|
@ -51,6 +53,8 @@ if ($overwrite) {
|
||||||
}
|
}
|
||||||
if (!$iniExists){
|
if (!$iniExists){
|
||||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||||
|
Config::loadConfig();
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ if (!file_exists(AirtimeIni::CONF_FILE_AIRTIME)) {
|
||||||
}
|
}
|
||||||
require_once(__DIR__.'/airtime-constants.php');
|
require_once(__DIR__.'/airtime-constants.php');
|
||||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||||
|
Config::loadConfig();
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
|
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
|
@ -37,6 +39,7 @@ $sql = "SELECT pg_cancel_backend(procpid) FROM pg_stat_activity WHERE datname =
|
||||||
$command = "echo \"$sql\" | su postgres -c psql";
|
$command = "echo \"$sql\" | su postgres -c psql";
|
||||||
@exec($command, $output);
|
@exec($command, $output);
|
||||||
|
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
echo " * Dropping the database '".$CC_CONFIG["dsn"]["database"]."'...".PHP_EOL;
|
echo " * Dropping the database '".$CC_CONFIG["dsn"]["database"]."'...".PHP_EOL;
|
||||||
|
|
||||||
//dropdb returns 1 if other sessions are using the database, otherwise returns 0
|
//dropdb returns 1 if other sessions are using the database, otherwise returns 0
|
||||||
|
|
|
@ -36,7 +36,7 @@ $version = AirtimeInstall::GetVersionInstalled();
|
||||||
|
|
||||||
echo "******************************** Upgrade Begin *********************************".PHP_EOL;
|
echo "******************************** Upgrade Begin *********************************".PHP_EOL;
|
||||||
|
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$user = $CC_CONFIG['dsn']['username'];
|
$user = $CC_CONFIG['dsn']['username'];
|
||||||
$password = $CC_CONFIG['dsn']['password'];
|
$password = $CC_CONFIG['dsn']['password'];
|
||||||
$host = $CC_CONFIG['dsn']['hostspec'];
|
$host = $CC_CONFIG['dsn']['hostspec'];
|
||||||
|
@ -83,11 +83,11 @@ if (strcmp($version, "2.0.3") < 0) {
|
||||||
if (strcmp($version, "2.1.0") < 0) {
|
if (strcmp($version, "2.1.0") < 0) {
|
||||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.0/airtime-upgrade.php");
|
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.0/airtime-upgrade.php");
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
if (strcmp($version, "2.1.1") < 0) {
|
if (strcmp($version, "2.1.1") < 0) {
|
||||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.1/airtime-upgrade.php");
|
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.1/airtime-upgrade.php");
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
if (strcmp($version, "2.1.2") < 0) {
|
if (strcmp($version, "2.1.2") < 0) {
|
||||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.2/airtime-upgrade.php");
|
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.2/airtime-upgrade.php");
|
||||||
pause();
|
pause();
|
||||||
|
@ -95,13 +95,13 @@ if (strcmp($version, "2.1.2") < 0) {
|
||||||
if (strcmp($version, "2.1.3") < 0) {
|
if (strcmp($version, "2.1.3") < 0) {
|
||||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.3/airtime-upgrade.php");
|
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.3/airtime-upgrade.php");
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
if (strcmp($version, "2.2.0") < 0) {
|
if (strcmp($version, "2.2.0") < 0) {
|
||||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.2.0/airtime-upgrade.php");
|
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.2.0/airtime-upgrade.php");
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
if (strcmp($version, "2.2.1") < 0) {
|
if (strcmp($version, "2.2.1") < 0) {
|
||||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.2.1/airtime-upgrade.php");
|
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.2.1/airtime-upgrade.php");
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
echo "******************************* Upgrade Complete *******************************".PHP_EOL;
|
echo "******************************* Upgrade Complete *******************************".PHP_EOL;
|
||||||
|
|
|
@ -5,7 +5,12 @@ exitIfNotRoot();
|
||||||
date_default_timezone_set("UTC");
|
date_default_timezone_set("UTC");
|
||||||
|
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||||
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||||
|
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
|
||||||
|
Config::loadConfig();
|
||||||
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
|
/*
|
||||||
// Name of the web server user
|
// Name of the web server user
|
||||||
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
|
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
|
||||||
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||||
|
@ -25,11 +30,11 @@ $CC_CONFIG['apiKey'] = array($values['general']['api_key']);
|
||||||
|
|
||||||
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
|
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
|
||||||
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
|
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
|
||||||
|
*/
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php');
|
require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
|
//require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
|
||||||
|
|
||||||
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
//$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||||
|
|
||||||
// Ensure library/ is on include_path
|
// Ensure library/ is on include_path
|
||||||
set_include_path(implode(PATH_SEPARATOR, array(
|
set_include_path(implode(PATH_SEPARATOR, array(
|
||||||
|
@ -38,7 +43,7 @@ realpath($CC_CONFIG['phpDir'] . '/library')
|
||||||
)));
|
)));
|
||||||
|
|
||||||
function my_autoload($classname){
|
function my_autoload($classname){
|
||||||
global $CC_CONFIG;
|
$CC_CONFIG = Config::getConfig();
|
||||||
$info = explode('_', $classname);
|
$info = explode('_', $classname);
|
||||||
if (isset($info[1]) && isset($info[2])) {
|
if (isset($info[1]) && isset($info[2])) {
|
||||||
$filename = $info[2].".php";
|
$filename = $info[2].".php";
|
||||||
|
|
Loading…
Reference in New Issue