Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
James 2011-11-29 20:16:01 -05:00
commit 48d9d2d93b
184 changed files with 69419 additions and 100 deletions

View file

@ -3,7 +3,7 @@
require_once __DIR__."/configs/ACL.php";
require_once 'propel/runtime/lib/Propel.php';
Propel::init(__DIR__."/configs/airtime-conf.php");
Propel::init(__DIR__."/configs/airtime-conf-production.php");
require_once __DIR__."/logging/Logging.php";
require_once __DIR__."/configs/constants.php";

View file

@ -0,0 +1,36 @@
<?php
// This file generated by Propel 1.5.2 convert-conf target
// from XML runtime conf file /home/james/src/airtime/airtime_mvc/build/runtime-conf.xml
/* The original name of this file is airtime-conf.php but since we need to make custom changes
* to it I've renamed it so that our changes aren't removed everytime we regenerate a database schema.
* our custom changes requires the database parameters to be loaded from /etc/airtime/airtime.conf so
* that the user can customize these.
*/
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
$dbhost = $ini['database']['host'];
$dbname = $ini['database']['dbname'];
$dbuser = $ini['database']['dbuser'];
$dbpass = $ini['database']['dbpass'];
$conf = array (
'datasources' =>
array (
'airtime' =>
array (
'adapter' => 'pgsql',
'connection' =>
array (
'dsn' => "pgsql:host=$dbhost;port=5432;dbname=$dbname;user=$dbuser;password=$dbpass",
),
),
'default' => 'airtime',
),
'generator_version' => '1.5.2',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;

View file

@ -43,7 +43,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$enable = new Zend_Form_Element_Checkbox('enable');
$enable->setLabel('Enabled:')
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
->setDecorators(array('ViewHelper'));
if($disable_all){
$enable->setAttrib("disabled", "disabled");

View file

@ -7,8 +7,8 @@ class Application_Model_StreamSetting {
global $CC_DBC;
$sql = "SELECT * "
."FROM cc_stream_setting "
."WHERE keyname LIKE '%_output' "
."AND value != 'disabled'";
."WHERE keyname LIKE '%_enable' "
."AND value == true";
$rows = $CC_DBC->getAll($sql);
$ids = array();
@ -75,21 +75,18 @@ class Application_Model_StreamSetting {
*/
public static function setStreamSetting($data){
global $CC_DBC;
foreach($data as $key=>$d){
if($key == "output_sound_device" || $key == "icecast_vorbis_metadata"){
foreach ($data as $key=>$d) {
if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") {
$v = $d == 1?"true":"false";
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
$CC_DBC->query($sql);
}
else{
} else {
$temp = explode('_', $key);
$prefix = $temp[0];
foreach($d as $k=>$v){
$keyname = $prefix."_".$k;
if( $k == 'output'){
if( $d["enable"] == 0){
$v = 'disabled';
}
foreach ($d as $k=>$v) {
$keyname = $prefix . "_" . $k;
if ($k == 'enable') {
$v = $d['enable'] == 1 ? 'true' : 'false';
}
$v = trim($v);
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
@ -152,17 +149,15 @@ class Application_Model_StreamSetting {
public static function getStreamEnabled($stream_id){
global $CC_DBC;
$keyname = "s".$stream_id."_output";
$keyname = "s" . $stream_id . "_enable";
$sql = "SELECT value FROM cc_stream_setting"
." WHERE keyname = '$keyname'";
$result = $CC_DBC->GetOne($sql);
if($result == 'disabled'){
if ($result == 'false') {
$result = false;
}else{
} else {
$result = true;
}
return $result;
}
}