parent
9d8c9149fd
commit
8b12f692cd
|
@ -134,16 +134,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
|
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
|
||||||
$view->headScript()->appendFile($baseUrl.'js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
|
||||||
&& !($_SERVER['REQUEST_URI'] == $baseUrl.'Dashboard/stream-player' ||
|
|
||||||
strncmp($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview', strlen($baseUrl.'audiopreview/audio-preview'))==0)) {
|
|
||||||
|
|
||||||
$client_id = Application_Model_Preference::GetClientId();
|
|
||||||
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
|
|
||||||
$view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _initViewHelpers()
|
protected function _initViewHelpers()
|
||||||
|
|
|
@ -692,26 +692,24 @@ class ApiController extends Zend_Controller_Action
|
||||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||||
|
|
||||||
//send ip, subdomain
|
//send ip, subdomain
|
||||||
if (Application_Model_Preference::GetPlanLevel() != 'disabled'){
|
if ($component == "pypo"){
|
||||||
if ($component == "pypo"){
|
$split = explode('.', $_SERVER['SERVER_NAME']);
|
||||||
$split = explode('.', $_SERVER['SERVER_NAME']);
|
$subdomain = array();
|
||||||
$subdomain = array();
|
foreach ($split as $value) {
|
||||||
foreach ($split as $value) {
|
if ($value == 'airtime') {
|
||||||
if ($value == 'airtime') {
|
break;
|
||||||
break;
|
} else {
|
||||||
} else {
|
$subdomain[] = $value;
|
||||||
$subdomain[] = $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (count($subdomain) > 0){
|
}
|
||||||
$subDomain = implode('.',$subdomain);
|
if (count($subdomain) > 0){
|
||||||
|
$subDomain = implode('.',$subdomain);
|
||||||
|
|
||||||
$md = array();
|
$md = array();
|
||||||
$md["sub_domain"] = $subDomain;
|
$md["sub_domain"] = $subDomain;
|
||||||
$md["pypo_ip"] = $remoteAddr;
|
$md["pypo_ip"] = $remoteAddr;
|
||||||
|
|
||||||
Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md);
|
Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
@ -123,19 +121,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function directoryConfigAction()
|
public function directoryConfigAction()
|
||||||
{
|
{
|
||||||
$CC_CONFIG = Config::getConfig();
|
|
||||||
|
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
|
||||||
|
|
||||||
$this->view->form = $watched_dirs_pref;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function streamSettingAction()
|
public function streamSettingAction()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
class Airtime_View_Helper_IsTrial extends Zend_View_Helper_Abstract{
|
class Airtime_View_Helper_IsTrial extends Zend_View_Helper_Abstract{
|
||||||
public function isTrial(){
|
public function isTrial(){
|
||||||
$plan = Application_Model_Preference::GetPlanLevel();
|
$plan = Application_Model_Preference::GetPlanLevel();
|
||||||
if($plan == 'trial'){
|
return $plan == 'trial';
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,46 +12,6 @@
|
||||||
class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
|
class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
|
||||||
|
|
||||||
public function versionNotify(){
|
public function versionNotify(){
|
||||||
if(Application_Model_Preference::GetPlanLevel() != 'disabled'){
|
return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// retrieve and validate current and latest versions,
|
|
||||||
$current = Application_Model_Preference::GetAirtimeVersion();
|
|
||||||
$latest = Application_Model_Preference::GetLatestVersion();
|
|
||||||
$link = Application_Model_Preference::GetLatestLink();
|
|
||||||
$currentExploded = explode('.', $current);
|
|
||||||
$latestExploded = explode('.', $latest);
|
|
||||||
if(count($currentExploded) != 3 || count($latestExploded) != 3) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the version difference;
|
|
||||||
// Example: if current = 1.9.5 and latest = 3.0.0, diff = 105
|
|
||||||
// Note: algorithm assumes the number after 1st dot never goes above 9
|
|
||||||
$versionDifference = (intval($latestExploded[0]) * 100 + intval($latestExploded[1]) *10 + intval($latestExploded[2]))
|
|
||||||
- (intval($currentExploded[0]) * 100 + intval($currentExploded[1] *10 + intval($currentExploded[2])));
|
|
||||||
|
|
||||||
// Pick icon based on distance this version is to the latest version available
|
|
||||||
if($versionDifference <= 0) {
|
|
||||||
// current version is up to date or newer
|
|
||||||
$class = "uptodate";
|
|
||||||
} else if($versionDifference < 20) {
|
|
||||||
// 2 or less major versions back
|
|
||||||
$class = "update";
|
|
||||||
} else if($versionDifference < 30) {
|
|
||||||
// 3 major versions back
|
|
||||||
$class = "update2";
|
|
||||||
} else {
|
|
||||||
// more than 3 major versions back
|
|
||||||
$class = "outdated";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = "<div id='version-diff' style='display:none'>" . $versionDifference . "</div>"
|
|
||||||
. "<div id='version-current' style='display:none'>" . $current . "</div>"
|
|
||||||
. "<div id='version-latest' style='display:none'>" . $latest . "</div>"
|
|
||||||
. "<div id='version-link' style='display:none'>" . $link . "</div>"
|
|
||||||
. "<div id='version-icon' class='" . $class . "'></div>";
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,30 +88,6 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get latest version from stat server and store to db
|
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
|
||||||
$url = 'http://stat.sourcefabric.org/airtime-stats/airtime_latest_version';
|
|
||||||
//$url = 'http://localhost:9999/index.php?p=airtime';
|
|
||||||
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
$result = curl_exec($ch);
|
|
||||||
|
|
||||||
if(curl_errno($ch)) {
|
|
||||||
echo "curl error: " . curl_error($ch) . "\n";
|
|
||||||
} else {
|
|
||||||
$resultArray = explode("\n", $result);
|
|
||||||
if (isset($resultArray[0])) {
|
|
||||||
Application_Model_Preference::SetLatestVersion($resultArray[0]);
|
|
||||||
}
|
|
||||||
if (isset($resultArray[1])) {
|
|
||||||
Application_Model_Preference::SetLatestLink($resultArray[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
curl_close($ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that the user is running this PHP script with root
|
* Ensures that the user is running this PHP script with root
|
||||||
|
|
Loading…
Reference in New Issue