Merge branch 'saas' into saas-speedy

This commit is contained in:
Albert Santoni 2015-04-15 16:44:43 -04:00
commit 8449194ca1
51 changed files with 4395 additions and 640 deletions

View file

@ -523,6 +523,7 @@ class ApiController extends Zend_Controller_Action
$result["description"] = Application_Model_Preference::GetStationDescription();
$result["timezone"] = Application_Model_Preference::GetDefaultTimezone();
$result["locale"] = Application_Model_Preference::GetDefaultLocale();
$result["stream_data"] = Application_Model_StreamSetting::getEnabledStreamData();
// used by caller to determine if the airtime they are running or widgets in use is out of date.
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
@ -1310,7 +1311,7 @@ class ApiController extends Zend_Controller_Action
}
public function getStreamParametersAction() {
$streams = array("s1", "s2", "s3");
$streams = array("s1", "s2", "s3", "s4");
$stream_params = array();
foreach ($streams as $s) {
$stream_params[$s] =

View file

@ -0,0 +1,57 @@
<?php
class EmbedController extends Zend_Controller_Action
{
public function init()
{
}
/**
* This is the action that is called to insert the player onto a web page.
* It passes all the js and css files to the view, as well as all the
* stream customization information.
*
* The view for this action contains all the inline javascript needed to
* create the player.
*/
public function playerAction()
{
$this->view->layout()->disableLayout();
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$this->view->css = Application_Common_HTTPHelper::getStationUrl() . "css/player.css?".$CC_CONFIG['airtime_version'];
$this->view->mrp_js = Application_Common_HTTPHelper::getStationUrl() . "js/airtime/player/mrp.js?".$CC_CONFIG['airtime_version'];
$this->view->jquery = Application_Common_HTTPHelper::getStationUrl() . "js/libs/jquery-1.10.2.js";
$this->view->muses_swf = Application_Common_HTTPHelper::getStationUrl() . "js/airtime/player/muses.swf";
$this->view->metadata_api_url = Application_Common_HTTPHelper::getStationUrl() . "api/live-info";
$this->view->player_title = json_encode($request->getParam('title'));
$stream = $request->getParam('stream');
$streamData = Application_Model_StreamSetting::getEnabledStreamData();
$availableMobileStreams = array();
$availableDesktopStreams = array();
if ($stream == "auto") {
$this->view->playerMode = "auto";
$this->view->streamURL = json_encode("");
foreach ($streamData as $s) {
if ($s["mobile"]) {
array_push($availableMobileStreams, $s);
} else if (!$s["mobile"]) {
array_push($availableDesktopStreams, $s);
}
}
} elseif (!empty($stream)) {
$this->view->playerMode = "manual";
$selectedStreamData = $streamData[$stream];
$this->view->streamURL = json_encode($selectedStreamData["url"]);
$this->view->codec = $selectedStreamData["codec"];
}
$this->view->availableMobileStreams = json_encode($availableMobileStreams);
$this->view->availableDesktopStreams = json_encode($availableDesktopStreams);
}
}

View file

@ -0,0 +1,31 @@
<?php
class PlayerController extends Zend_Controller_Action
{
public function init()
{
}
public function customizeAction()
{
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$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']);
$form = new Application_Form_Player();
$apiEnabled = Application_Model_Preference::GetAllow3rdPartyApi();
$numEnabledStreams = $form->getElement('player_stream_url')->getAttrib('numberOfEnabledStreams');
if ($numEnabledStreams > 0 && $apiEnabled) {
$this->view->form = $form;
} else {
$this->view->errorMsg = "To configure and use the embeddable player you must:<br><br>
1. Enable at least one MP3, AAC, or OGG stream under System -> Streams<br>
2. Enable the Public Airtime API under System -> Preferences";
}
}
}

View file

@ -141,11 +141,7 @@ class PreferenceController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// get current settings
$temp = Application_Model_StreamSetting::getStreamSetting();
$setting = array();
foreach ($temp as $t) {
$setting[$t['keyname']] = $t['value'];
}
$setting = Application_Model_StreamSetting::getStreamSetting();
$name_map = array(
'ogg' => 'Ogg Vorbis',
@ -208,6 +204,7 @@ class PreferenceController extends Zend_Controller_Action
$s1_data = array();
$s2_data = array();
$s3_data = array();
$s4_data = array();
$values = array();
foreach($postData as $k=>$v) {
$v = explode('=', urldecode($v));
@ -223,6 +220,9 @@ class PreferenceController extends Zend_Controller_Action
} elseif (strpos($v[0], "s3_data") !== false) {
preg_match('/\[(.*)\]/', $v[0], $matches);
$s3_data[$matches[1]] = $v[1];
} elseif (strpos($v[0], "s4_data") !== false) {
preg_match('/\[(.*)\]/', $v[0], $matches);
$s4_data[$matches[1]] = $v[1];
} else {
$values[$v[0]] = $v[1];
}
@ -230,6 +230,7 @@ class PreferenceController extends Zend_Controller_Action
$values["s1_data"] = $s1_data;
$values["s2_data"] = $s2_data;
$values["s3_data"] = $s3_data;
$values["s4_data"] = $s4_data;
$error = false;
if ($form->isValid($values)) {
@ -245,6 +246,7 @@ class PreferenceController extends Zend_Controller_Action
$s1_set_admin_pass = !empty($values["s1_data"]["admin_pass"]);
$s2_set_admin_pass = !empty($values["s2_data"]["admin_pass"]);
$s3_set_admin_pass = !empty($values["s3_data"]["admin_pass"]);
$s4_set_admin_pass = !empty($values["s4_data"]["admin_pass"]);
// this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
@ -290,6 +292,7 @@ class PreferenceController extends Zend_Controller_Action
"s1_set_admin_pass"=>$s1_set_admin_pass,
"s2_set_admin_pass"=>$s2_set_admin_pass,
"s3_set_admin_pass"=>$s3_set_admin_pass,
"s4_set_admin_pass"=>$s4_set_admin_pass,
));
} else {
$live_stream_subform->updateVariables();
@ -441,7 +444,8 @@ class PreferenceController extends Zend_Controller_Action
public function getAdminPasswordStatusAction()
{
$out = array();
for ($i=1; $i<=3; $i++) {
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
for ($i=1; $i<=$num_of_stream; $i++) {
if (Application_Model_StreamSetting::getAdminPass('s'.$i)=='') {
$out["s".$i] = false;
} else {

View file

@ -118,7 +118,8 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
"locale",
"upgrade",
'whmcs-login',
"provisioning"
"provisioning",
"embed"
)))
{
$this->setRoleName("G");