Merge branch 'saas-dev' into saas
Conflicts: airtime_mvc/application/common/FileDataHelper.php
This commit is contained in:
commit
75914b791c
40 changed files with 615 additions and 603 deletions
|
@ -30,13 +30,13 @@ class Application_Model_Auth
|
|||
$e_link_port = $_SERVER['SERVER_PORT'];
|
||||
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
|
||||
|
||||
$message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin());
|
||||
$message = sprintf(_("Hi %s, \n\nPlease click this link to reset your password: "), $user->getDbLogin());
|
||||
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
|
||||
$message .= sprintf(_pro("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_EMAIL_ADDRESS);
|
||||
$message .= sprintf(_pro("\n\nThank you,\nThe %s Team"), SAAS_PRODUCT_BRANDING_NAME);
|
||||
|
||||
$str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
|
||||
$success = Application_Model_Email::send($str, $message, $user->getDbEmail());
|
||||
|
||||
return $success;
|
||||
$str = sprintf(_('%s Password Reset'), SAAS_PRODUCT_BRANDING_NAME);
|
||||
return Application_Model_Email::send($str, $message, $user->getDbEmail());
|
||||
}
|
||||
|
||||
public function invalidateTokens($user, $action)
|
||||
|
|
|
@ -2,75 +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)
|
||||
{
|
||||
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
||||
$mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false;
|
||||
$success = true;
|
||||
public static function send($subject, $message, $to) {
|
||||
|
||||
if ($mailServerConfigured) {
|
||||
$mailServer = Application_Model_Preference::GetMailServer();
|
||||
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
||||
if (!empty($mailServerPort)) {
|
||||
$port = $mailServerPort;
|
||||
}
|
||||
|
||||
if ($mailServerRequiresAuth) {
|
||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||
$password = Application_Model_Preference::GetMailServerPassword();
|
||||
|
||||
$config = array(
|
||||
'auth' => 'login',
|
||||
'ssl' => 'ssl',
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
);
|
||||
} else {
|
||||
$config = array(
|
||||
'ssl' => 'tls'
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($port)) {
|
||||
$config['port'] = $port;
|
||||
}
|
||||
|
||||
$transport = new Zend_Mail_Transport_Smtp($mailServer, $config);
|
||||
}
|
||||
|
||||
$mail = new Zend_Mail('utf-8');
|
||||
$mail->setSubject($subject);
|
||||
$mail->setBodyText($message);
|
||||
|
||||
foreach ((array) $tos as $to) {
|
||||
$mail->addTo($to);
|
||||
}
|
||||
|
||||
if ($mailServerConfigured) {
|
||||
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetMailServerEmailAddress());
|
||||
try {
|
||||
$mail->send($transport);
|
||||
} catch (Exception $e) {
|
||||
$success = false;
|
||||
}
|
||||
} else {
|
||||
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail());
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $success;
|
||||
$headers = sprintf('From: %s <noreply@account.sourcefabric.com>', SAAS_PRODUCT_BRANDING_NAME);
|
||||
return mail($to, $subject, $message, $headers);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1096,6 +1096,13 @@ class Application_Model_Preference
|
|||
|
||||
public static function GetSourceSwitchStatus($sourcename)
|
||||
{
|
||||
// Scheduled play switch should always be "on".
|
||||
// Even though we've hidden this element in the dashboard we should
|
||||
// always make sure it's on or else a station's stream could go offline.
|
||||
if ($sourcename == "scheduled_play") {
|
||||
return "on";
|
||||
}
|
||||
|
||||
$value = self::getValue($sourcename."_switch");
|
||||
return ($value == null || $value == "off") ? 'off' : 'on';
|
||||
}
|
||||
|
@ -1161,87 +1168,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 +1438,29 @@ 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() {
|
||||
$val = self::getValue("using_custom_stream_settings");
|
||||
return empty($val) ? false : $val;
|
||||
}
|
||||
|
||||
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 +1470,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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue