2010-12-07 20:19:27 +01:00
|
|
|
<?php
|
|
|
|
|
2012-01-09 23:47:58 +01:00
|
|
|
require_once __DIR__."/logging/Logging.php";
|
|
|
|
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
|
|
|
|
|
|
|
require_once __DIR__."/configs/conf.php";
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2012-01-09 23:47:58 +01:00
|
|
|
require_once __DIR__."/configs/ACL.php";
|
2010-12-07 20:19:27 +01:00
|
|
|
require_once 'propel/runtime/lib/Propel.php';
|
2011-11-29 22:07:38 +01:00
|
|
|
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2011-03-24 04:24:06 +01:00
|
|
|
require_once __DIR__."/configs/constants.php";
|
2010-12-07 20:19:27 +01:00
|
|
|
require_once 'DB.php';
|
|
|
|
|
2011-09-26 21:32:56 +02:00
|
|
|
require_once 'Preference.php';
|
2011-03-24 04:24:06 +01:00
|
|
|
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2011-08-12 21:36:00 +02:00
|
|
|
global $CC_CONFIG, $CC_DBC;
|
|
|
|
$dsn = $CC_CONFIG['dsn'];
|
|
|
|
|
|
|
|
$CC_DBC = DB::connect($dsn, FALSE);
|
|
|
|
if (PEAR::isError($CC_DBC)) {
|
|
|
|
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
|
|
|
2012-02-08 22:21:57 +01:00
|
|
|
$CC_CONFIG['airtime_version'] = Application_Model_Preference::GetAirtimeVersion();
|
|
|
|
|
2011-11-15 22:10:40 +01:00
|
|
|
require_once __DIR__."/configs/navigation.php";
|
|
|
|
|
2011-08-12 21:36:00 +02:00
|
|
|
//DateTime in PHP 5.3.0+ need a default timezone set.
|
|
|
|
date_default_timezone_set(Application_Model_Preference::GetTimezone());
|
|
|
|
|
|
|
|
Zend_Validate::setDefaultNamespaces("Zend");
|
|
|
|
|
|
|
|
$front = Zend_Controller_Front::getInstance();
|
2012-01-16 09:56:57 +01:00
|
|
|
$front->registerPlugin(new RabbitMqPlugin());
|
2011-08-12 21:36:00 +02:00
|
|
|
|
2012-03-01 23:58:44 +01:00
|
|
|
//Logging::debug($_SERVER['REQUEST_URI']);
|
2011-08-12 21:36:00 +02:00
|
|
|
|
2012-01-16 09:56:57 +01:00
|
|
|
/* The bootstrap class should only be used to initialize actions that return a view.
|
2011-08-12 21:36:00 +02:00
|
|
|
Actions that return JSON will not use the bootstrap class! */
|
2010-12-07 20:19:27 +01:00
|
|
|
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|
|
|
{
|
2011-08-23 18:45:03 +02:00
|
|
|
protected function _initDoctype()
|
2010-12-07 20:19:27 +01:00
|
|
|
{
|
|
|
|
$this->bootstrap('view');
|
|
|
|
$view = $this->getResource('view');
|
|
|
|
$view->doctype('XHTML1_STRICT');
|
|
|
|
}
|
|
|
|
|
2011-08-23 18:45:03 +02:00
|
|
|
protected function _initHeadLink()
|
|
|
|
{
|
2012-02-08 22:21:57 +01:00
|
|
|
global $CC_CONFIG;
|
2012-02-09 18:07:32 +01:00
|
|
|
|
2011-08-23 18:45:03 +02:00
|
|
|
$view = $this->getResource('view');
|
2011-04-18 17:02:09 +02:00
|
|
|
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
2012-01-27 21:30:44 +01:00
|
|
|
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
2011-04-18 17:02:09 +02:00
|
|
|
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']);
|
|
|
|
$view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']);
|
|
|
|
$view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css?'.$CC_CONFIG['airtime_version']);
|
|
|
|
$view->headLink()->appendStylesheet($baseUrl.'/css/styles.css?'.$CC_CONFIG['airtime_version']);
|
2011-08-23 18:45:03 +02:00
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2011-08-23 18:45:03 +02:00
|
|
|
protected function _initHeadScript()
|
|
|
|
{
|
2012-02-01 16:57:38 +01:00
|
|
|
global $CC_CONFIG;
|
2012-02-06 11:07:10 +01:00
|
|
|
|
2011-08-23 18:45:03 +02:00
|
|
|
$view = $this->getResource('view');
|
2011-04-18 17:02:09 +02:00
|
|
|
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
2012-01-27 21:30:44 +01:00
|
|
|
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
2011-04-18 17:02:09 +02:00
|
|
|
|
2012-02-07 23:58:36 +01:00
|
|
|
$view->headScript()->appendFile('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
|
2012-02-04 02:07:32 +01:00
|
|
|
$view->headScript()->appendFile('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js');
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2012-02-09 18:07:32 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version']);
|
2011-09-30 20:46:09 +02:00
|
|
|
$view->headScript()->appendScript("var baseUrl='$baseUrl/'");
|
2011-01-31 05:05:49 +01:00
|
|
|
|
2011-02-01 17:43:52 +01:00
|
|
|
//scripts for now playing bar
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2012-01-16 09:56:57 +01:00
|
|
|
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2012-02-09 18:07:32 +01:00
|
|
|
|
2011-12-09 00:04:32 +01:00
|
|
|
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
|
|
|
&& $_SERVER['REQUEST_URI'] != '/Dashboard/stream-player') {
|
2011-12-09 17:12:42 +01:00
|
|
|
$client_id = Application_Model_Preference::GetClientId();
|
2011-12-09 18:37:31 +01:00
|
|
|
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
2011-12-08 22:45:11 +01:00
|
|
|
}
|
2012-02-01 16:57:38 +01:00
|
|
|
if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1){
|
2012-02-08 22:21:57 +01:00
|
|
|
$view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2012-02-01 16:57:38 +01:00
|
|
|
}
|
2011-02-03 23:51:35 +01:00
|
|
|
}
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2011-03-24 04:24:06 +01:00
|
|
|
protected function _initViewHelpers()
|
|
|
|
{
|
2011-02-03 23:51:35 +01:00
|
|
|
$view = $this->getResource('view');
|
2011-01-31 00:20:47 +01:00
|
|
|
$view->addHelperPath('../application/views/helpers', 'Airtime_View_Helper');
|
2011-01-30 22:47:11 +01:00
|
|
|
}
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2011-03-24 04:24:06 +01:00
|
|
|
protected function _initTitle()
|
|
|
|
{
|
2011-02-03 23:51:35 +01:00
|
|
|
$view = $this->getResource('view');
|
2011-02-04 01:17:52 +01:00
|
|
|
$view->headTitle(Application_Model_Preference::GetHeadTitle());
|
2011-02-03 23:51:35 +01:00
|
|
|
}
|
2011-08-22 16:12:53 +02:00
|
|
|
|
|
|
|
protected function _initZFDebug()
|
|
|
|
{
|
|
|
|
if (APPLICATION_ENV == "development"){
|
|
|
|
global $CC_DBC;
|
2012-01-16 09:56:57 +01:00
|
|
|
|
2011-08-22 16:12:53 +02:00
|
|
|
$autoloader = Zend_Loader_Autoloader::getInstance();
|
|
|
|
$autoloader->registerNamespace('ZFDebug');
|
|
|
|
|
|
|
|
$options = array(
|
2012-01-16 09:56:57 +01:00
|
|
|
'plugins' => array('Variables',
|
2011-08-22 16:12:53 +02:00
|
|
|
'Exception',
|
|
|
|
'Memory',
|
|
|
|
'Time')
|
|
|
|
);
|
|
|
|
$debug = new ZFDebug_Controller_Plugin_Debug($options);
|
|
|
|
|
|
|
|
$this->bootstrap('frontController');
|
|
|
|
$frontController = $this->getResource('frontController');
|
|
|
|
$frontController->registerPlugin($debug);
|
|
|
|
}
|
|
|
|
}
|
2012-01-16 09:56:57 +01:00
|
|
|
|
2011-12-22 01:01:29 +01:00
|
|
|
protected function _initRouter()
|
|
|
|
{
|
|
|
|
$front = Zend_Controller_Front::getInstance();
|
|
|
|
$router = $front->getRouter();
|
2012-01-16 09:56:57 +01:00
|
|
|
|
2011-12-22 01:01:29 +01:00
|
|
|
$router->addRoute(
|
|
|
|
'password-change',
|
|
|
|
new Zend_Controller_Router_Route('password-change/:user_id/:token', array(
|
|
|
|
'module' => 'default',
|
|
|
|
'controller' => 'auth',
|
|
|
|
'action' => 'password-change',
|
|
|
|
)));
|
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|