Merge branch 'saas-dev' into saas-showbuilder

This commit is contained in:
Duncan Sommerville 2015-08-05 15:32:04 -04:00
commit 36f2e1844f
32 changed files with 489 additions and 493 deletions

View file

@ -34,9 +34,7 @@ class Application_Model_Auth
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
$success = Application_Model_Email::send($str, $message, $user->getDbEmail());
return $success;
return Application_Model_Email::send($str, $message, $user->getDbEmail());
}
public function invalidateTokens($user, $action)

View file

@ -2,18 +2,20 @@
class Application_Model_Email
{
/**
* Send email
*
* @param string $subject
* @param string $message
* @param mixed $tos
* @return void
* @param mixed $to
* @return boolean
*/
public static function send($subject, $message, $tos, $from = null)
{
public static function send($subject, $message, $to) {
return mail($tos, $subject, $message);
$headers = 'From: Airtime <noreply@account.sourcefabric.com>';
return mail($to, $subject, $message, $headers);
}
}

View file

@ -1161,87 +1161,6 @@ class Application_Model_Preference
{
return self::getValue("auto_switch");
}
public static function SetEnableSystemEmail($upload)
{
self::setValue("enable_system_email", $upload);
}
public static function GetEnableSystemEmail()
{
$v = self::getValue("enable_system_email");
return ($v === "") ? 0 : $v;
}
public static function SetSystemEmail($value)
{
self::setValue("system_email", $value, false);
}
public static function GetSystemEmail()
{
return self::getValue("system_email");
}
public static function SetMailServerConfigured($value)
{
self::setValue("mail_server_configured", $value, false);
}
public static function GetMailServerConfigured()
{
return self::getValue("mail_server_configured");
}
public static function SetMailServer($value)
{
self::setValue("mail_server", $value, false);
}
public static function GetMailServer()
{
return self::getValue("mail_server");
}
public static function SetMailServerEmailAddress($value)
{
self::setValue("mail_server_email_address", $value, false);
}
public static function GetMailServerEmailAddress()
{
return self::getValue("mail_server_email_address");
}
public static function SetMailServerPassword($value)
{
self::setValue("mail_server_password", $value, false);
}
public static function GetMailServerPassword()
{
return self::getValue("mail_server_password");
}
public static function SetMailServerPort($value)
{
self::setValue("mail_server_port", $value, false);
}
public static function GetMailServerPort()
{
return self::getValue("mail_server_port");
}
public static function SetMailServerRequiresAuth($value)
{
self::setValue("mail_server_requires_auth", $value, false);
}
public static function GetMailServerRequiresAuth()
{
return self::getValue("mail_server_requires_auth");
}
/* User specific preferences end */
public static function ShouldShowPopUp()
@ -1512,6 +1431,28 @@ class Application_Model_Preference
self::setValue("task_manager_lock", $value);
}
// SAAS-876 - Toggle indicating whether user is using custom stream settings
public static function getUsingCustomStreamSettings() {
return self::getValue("using_custom_stream_settings");
}
public static function setUsingCustomStreamSettings($value) {
self::setValue("using_custom_stream_settings", $value);
}
// SAAS-876 - Store the default Icecast password to restore when switching
// back to Airtime Pro streaming settings
public static function getDefaultIcecastPassword() {
$val = self::getValue("default_icecast_password");
return empty($val) ? DEFAULT_ICECAST_PASS : $val;
}
public static function setDefaultIcecastPassword($value) {
self::setValue("default_icecast_password", $value);
}
public static function getRadioPageDisplayLoginButton()
{
return self::getValue("radio_page_display_login_button");
@ -1521,4 +1462,14 @@ class Application_Model_Preference
{
self::setValue("radio_page_display_login_button", $value);
}
public static function getLangTimezoneSetupComplete()
{
return self::getValue("lang_tz_setup_complete");
}
public static function setLangTimezoneSetupComplete($value)
{
self::setValue("lang_tz_setup_complete", $value);
}
}

View file

@ -215,6 +215,7 @@ SQL;
$currentMedia["ends"] = $currentMedia["show_ends"];
}
$currentMediaName = "";
$currentMediaFileId = $currentMedia["file_id"];
$currentMediaStreamId = $currentMedia["stream_id"];
if (isset($currentMediaFileId)) {
@ -256,6 +257,7 @@ SQL;
->orderByDbStarts(Criteria::DESC)
->findOne();
if (isset($previousMedia)) {
$previousMediaName = "";
$previousMediaFileId = $previousMedia->getDbFileId();
$previousMediaStreamId = $previousMedia->getDbStreamId();
if (isset($previousMediaFileId)) {

View file

@ -246,6 +246,10 @@ class Application_Model_StreamSetting
} elseif (is_array($d)) {
$temp = explode('_', $key);
$prefix = $temp[0];
// SAAS-876 - If we're using Airtime Pro streaming, set the stream to use the default settings
if (!Application_Model_Preference::getUsingCustomStreamSettings()) {
$d = array_merge($d, static::getDefaults($prefix));
}
foreach ($d as $k => $v) {
$keyname = $prefix . "_" . $k;
if ($k == 'enable') {
@ -265,8 +269,28 @@ class Application_Model_StreamSetting
}
}
/**
* SAAS-876 - Get the default stream settings values for Airtime Pro streaming
*
* @param int $prefix
*
* @return array array of default stream setting values
*/
public static function getDefaults($prefix) {
$config = Config::getConfig();
return array(
'host' => $config['stationId'] . ".out.airtime.pro",
'port' => DEFAULT_ICECAST_PORT,
'output' => 'icecast',
'user' => $config['stationId'],
'pass' => Application_Model_Preference::getDefaultIcecastPassword(),
// Kind of ugly... convert prefix int to ascii char
'mount' => $config['stationId'] . '_' . chr($prefix[1] + 96),
);
}
/*
* Sets indivisual stream setting.
* Sets individual stream setting.
*
* $data - data array. $data is [].
* TODO: Make this SQL a prepared statement!

View file

@ -18,6 +18,11 @@ class CcSubjs extends BaseCcSubjs {
return $this->type === UTYPE_SUPERADMIN || $this->type === UTYPE_ADMIN || $this->type === UTYPE_PROGRAM_MANAGER;
}
public function isSuperAdmin()
{
return $this->type === UTYPE_SUPERADMIN;
}
public function isHostOfShow($showId)
{
return CcShowHostsQuery::create()