Merge branch 'airtime-2.0.x' of dev.sourcefabric.org:airtime into airtime-2.0.x
This commit is contained in:
commit
09d50e7e25
212 changed files with 343 additions and 19663 deletions
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__."/configs/ACL.php";
|
||||
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
||||
|
||||
require_once __DIR__."/logging/Logging.php";
|
||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once __DIR__."/configs/conf.php";
|
||||
|
||||
require_once __DIR__."/configs/ACL.php";
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
||||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once 'DB.php';
|
||||
|
||||
require_once 'Preference.php';
|
||||
|
|
|
@ -9,15 +9,12 @@
|
|||
*/
|
||||
|
||||
|
||||
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||
$ini = parse_ini_file($configFile, true);
|
||||
|
||||
$dbhost = $ini['database']['host'];
|
||||
$dbname = $ini['database']['dbname'];
|
||||
$dbuser = $ini['database']['dbuser'];
|
||||
$dbpass = $ini['database']['dbpass'];
|
||||
|
||||
global $CC_CONFIG;
|
||||
|
||||
$dbhost = $CC_CONFIG['dsn']['hostspec'];
|
||||
$dbname = $CC_CONFIG['dsn']['database'];
|
||||
$dbuser = $CC_CONFIG['dsn']['username'];
|
||||
$dbpass = $CC_CONFIG['dsn']['password'];
|
||||
|
||||
$conf = array (
|
||||
'datasources' =>
|
||||
|
|
|
@ -19,8 +19,7 @@ $CC_CONFIG = array(
|
|||
|
||||
"rootDir" => __DIR__."/../..",
|
||||
'pearPath' => dirname(__FILE__).'/../../library/pear',
|
||||
'zendPath' => dirname(__FILE__).'/../../library/Zend',
|
||||
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
||||
'zendPath' => dirname(__FILE__).'/../../library/Zend'
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -745,6 +745,7 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
||||
/*
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
{
|
||||
|
@ -763,10 +764,13 @@ class ApiController extends Zend_Controller_Action
|
|||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
),
|
||||
"partitions"=>Application_Model_Systemstatus::GetDiskInfo()
|
||||
)
|
||||
);
|
||||
|
||||
if ($getDiskInfo){
|
||||
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
||||
}
|
||||
|
||||
$this->view->status = $status;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,13 @@ class SystemstatusController extends Zend_Controller_Action
|
|||
$services = array(
|
||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(),
|
||||
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus()
|
||||
);
|
||||
|
||||
if (!isset($_SERVER["AIRTIME_SRV"])){
|
||||
$services["show-recorder"]=Application_Model_Systemstatus::GetShowRecorderStatus();
|
||||
}
|
||||
|
||||
$partitions = Application_Model_Systemstatus::GetDiskInfo();
|
||||
|
||||
|
|
|
@ -27,7 +27,9 @@ class Application_Model_Nowplaying
|
|||
$status = ($dbRow['show_ends'] < $dbRow['item_ends']) ? "x" : "";
|
||||
|
||||
$type = "a";
|
||||
$type .= ($itemEndDateTime->getTimestamp() > $epochNow && $itemStartDateTime->getTimestamp() <= $epochNow) ? "c" : "";
|
||||
$type .= ($itemStartDateTime->getTimestamp() <= $epochNow
|
||||
&& $epochNow < $itemEndDateTime->getTimestamp()
|
||||
&& $epochNow < $showEndDateTime->getTimestamp()) ? "c" : "";
|
||||
|
||||
// remove millisecond from the time format
|
||||
$itemStart = explode('.', $dbRow['item_starts']);
|
||||
|
|
|
@ -680,6 +680,18 @@ class Application_Model_Preference
|
|||
return $val;
|
||||
}
|
||||
|
||||
public static function SetDiskQuota($value){
|
||||
self::SetValue("disk_quota", $value, false);
|
||||
}
|
||||
|
||||
public static function GetDiskQuota(){
|
||||
$val = self::GetValue("disk_quota");
|
||||
if(strlen($val) == 0) {
|
||||
$val = "0";
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
/* User specific preferences end */
|
||||
}
|
||||
|
||||
|
|
|
@ -176,32 +176,51 @@ class Application_Model_Systemstatus
|
|||
return $data;
|
||||
}
|
||||
|
||||
public static function GetRabbitMqStatus(){
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
public static function GetRabbitMqStatus(){
|
||||
|
||||
if (isset($_SERVER["RABBITMQ_HOST"])){
|
||||
$rabbitmq_host = $_SERVER["RABBITMQ_HOST"];
|
||||
} else {
|
||||
$rabbitmq_host = "localhost";
|
||||
}
|
||||
$docRoot = self::GetMonitStatus($rabbitmq_host);
|
||||
$data = self::ExtractServiceInformation($docRoot, "rabbitmq-server");
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetDiskInfo(){
|
||||
/* First lets get all the watched directories. Then we can group them
|
||||
* into the same paritions by comparing the partition sizes. */
|
||||
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
||||
|
||||
|
||||
$partions = array();
|
||||
|
||||
foreach($musicDirs as $md){
|
||||
$totalSpace = disk_total_space($md->getDirectory());
|
||||
|
||||
if (!isset($partitions[$totalSpace])){
|
||||
$partitions[$totalSpace] = new StdClass;
|
||||
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
|
||||
}
|
||||
|
||||
if (isset($_SERVER['AIRTIME_SRV'])){
|
||||
//connect to DB and find how much total space user has allocated.
|
||||
$totalSpace = Application_Model_Preference::GetDiskQuota();
|
||||
|
||||
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
||||
$storPath = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||
|
||||
list($usedSpace,) = preg_split("/[\s]+/", exec("du -bs $storPath"));
|
||||
|
||||
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
|
||||
Logging::log($partitions[$totalSpace]->totalFreeSpace);
|
||||
} else {
|
||||
/* First lets get all the watched directories. Then we can group them
|
||||
* into the same partitions by comparing the partition sizes. */
|
||||
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
||||
|
||||
foreach($musicDirs as $md){
|
||||
$totalSpace = disk_total_space($md->getDirectory());
|
||||
|
||||
if (!isset($partitions[$totalSpace])){
|
||||
$partitions[$totalSpace] = new StdClass;
|
||||
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
|
||||
|
||||
}
|
||||
|
||||
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
return array_values($partitions);
|
||||
|
|
|
@ -5,6 +5,9 @@ class Airtime_View_Helper_TrialRemaining extends Zend_View_Helper_Abstract
|
|||
public function trialRemaining()
|
||||
{
|
||||
$ending_date = Application_Model_Preference::GetTrialEndingDate();
|
||||
if ($ending_date == '') {
|
||||
return '';
|
||||
}
|
||||
$datetime1 = new DateTime();
|
||||
$datetime2 = new DateTime($ending_date);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
|
|
|
@ -60,7 +60,7 @@ $(document).ready(function(){
|
|||
if ($type == "ogg")
|
||||
$type = "oga";
|
||||
|
||||
$label = $streamData["${id}_description"]." (".$streamData["${id}_bitrate"]." Kbit/s)";
|
||||
$label = "(".$streamData["${id}_host"].") ".$streamData["${id}_description"]." - ".$streamData["${id}_bitrate"]." Kbit/s";
|
||||
echo sprintf("<option class='stream' value='%s' data-url='%s' data-type='%s' server-type='%s'>%s</option>", $id, $url, $type, $serverType, $label);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -36,15 +36,15 @@
|
|||
<li><span class="name"><?php echo $this->user ?></span> | <a href="/Login/logout">Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if($this->is_trial){?>
|
||||
<?php if($this->trial_remain != '' && $this->trial_remain != "Trial expired."){?>
|
||||
<div class="trial-box">
|
||||
<p>Your Trial expires in</p>
|
||||
<p>Your trial expires in</p>
|
||||
<div class="trial-box-calendar">
|
||||
<span class="trial-box-calendar-white"><?php echo $this->trial_remain?></span>
|
||||
<div class="trial-box-calendar-gray">days</div>
|
||||
</div>
|
||||
<div class="trial-box-button">
|
||||
<a title="Purchase your copy of Airtime" href="https://account.sourcefabric.com/clientarea.php" target="_blank">Buy Now</a>
|
||||
<a title="Purchase your copy of Airtime" href="https://account.sourcefabric.com/clientarea.php" target="_blank">My Account</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue