From 0dd2958333d5271f70e5e8a68d64e24a7b5d06dd Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 16 Jul 2015 14:24:07 -0400 Subject: [PATCH 1/8] SAAS-922 - urlencode content headers to ensure compatibility --- .../application/cloud_storage/Amazon_S3StorageBackend.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php index 0d86ef52c..2f023aeea 100644 --- a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php +++ b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php @@ -46,7 +46,7 @@ class Amazon_S3StorageBackend extends StorageBackend { $urls = array(); - $s3args = array('ResponseContentDisposition' => 'attachment; filename="' . $contentDispositionFilename. '"'); + $s3args = array('ResponseContentDisposition' => 'attachment; filename="' . urlencode($contentDispositionFilename) . '"'); $signedS3Url = $this->s3Client->getObjectUrl($this->getBucket(), $resourceId, '+60 minutes', $s3args); //If we're using the proxy cache, we need to modify the request URL after it has @@ -65,7 +65,7 @@ class Amazon_S3StorageBackend extends StorageBackend $p["path"] = substr($p["path"], 1 + strlen($this->getBucket())); } $proxyUrl = $p["scheme"] . "://" . $p["host"] . $p["path"] . "?" . $p["query"]; - //Add this proxy cache URL to the list of download URLs. + //Add this proxy cache URL to the list of download URLs.s array_push($urls, $proxyUrl); } From 07f02260dbe4ab04121c9dd07d9f671f535d25b8 Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 17 Jul 2015 09:57:24 -0400 Subject: [PATCH 2/8] Fix undefined index: nextMediaName --- airtime_mvc/application/models/Schedule.php | 1 + 1 file changed, 1 insertion(+) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 07e72136b..811b90bd7 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -288,6 +288,7 @@ SQL; ->orderByDbStarts(Criteria::ASC) ->findOne(); if (isset($nextMedia)) { + $nextMediaName = ""; $nextMediaFileId = $nextMedia->getDbFileId(); $nextMediaStreamId = $nextMedia->getDbStreamId(); if (isset($nextMediaFileId)) { From 7f4fbf65e144c05d7427b059e3f15d32b47bb4ec Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 17 Jul 2015 12:48:57 -0400 Subject: [PATCH 3/8] SAAS-960 Change hint for currently playing linked show --- .../application/common/UsabilityHints.php | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php index 38f09356d..837c9e747 100644 --- a/airtime_mvc/application/common/UsabilityHints.php +++ b/airtime_mvc/application/common/UsabilityHints.php @@ -67,12 +67,22 @@ class Application_Common_UsabilityHints ""); } } else if (self::isCurrentShowEmpty()) { - if ($userIsOnCalendarPage) { - return _("To start broadcasting, click on the current show and select 'Add / Remove Content'"); + // If the current show is linked users cannot add content to it so we have to provide a different message. + if (self::isCurrentShowLinked()) { + if ($userIsOnCalendarPage) { + return _("To start broadcasting, first you need to cancel the current linked show by clicking on it and selecting 'Cancel Current Show'."); + } else { + return sprintf(_("Linked shows need to be filled with tracks before it starts. You need to schedule a non-linked show to start broadcasting. + %sCreate a non-linked show now.%s"), "", ""); + } } else { - return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now.%s"), - "", - ""); + if ($userIsOnCalendarPage) { + return _("To start broadcasting, click on the current show and select 'Add / Remove Content'"); + } else { + return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now.%s"), + "", + ""); + } } } else if (!self::getCurrentShow() && self::isNextShowEmpty()) { if ($userIsOnCalendarPage) { @@ -181,4 +191,21 @@ class Application_Common_UsabilityHints ->orderByDbStarts() ->findOne(); } + + private static function isCurrentShowLinked() + { + $currentShow = self::getCurrentShow(); + if (!is_null($currentShow)) { + $show = CcShowQuery::create() + ->filterByDbId($currentShow->getDbShowId()) + ->findOne(); + if ($show->isLinked()) { + return true; + } else { + return false; + } + } else { + return false; + } + } } \ No newline at end of file From a6854ea507983fed7f810b616b02961edc60c424 Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 17 Jul 2015 16:28:33 -0400 Subject: [PATCH 4/8] SAAS-957: Error on "update show" --- airtime_mvc/public/js/airtime/schedule/add-show.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 36910bdd5..f6b359953 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -48,7 +48,6 @@ function toggleAddShowButton(){ } function setupStartTimeWidgets() { - if ($('input[name=add_show_start_now]:checked').val() == 'now') { $('#add_show_start_date').prop('disabled', 'true'); $('#add_show_start_time').prop('disabled', 'true'); @@ -66,8 +65,16 @@ function setupStartTimeWidgets() { $('#add_show_end_time').val(nowShowEnd.format('HH:mm')); } else { - $('#add_show_start_date').removeProp('disabled'); - $('#add_show_start_time').removeProp('disabled'); + //Prevent enabling of elements that should always be disabled. + //i.e. when editing a show that has already started + if (!$('#add_show_start_date').prop('disabled')) { + $('#add_show_start_date').removeProp('disabled'); + } + + if (!$('#add_show_start_time').prop('disabled')) { + $('#add_show_start_time').removeProp('disabled'); + } + } } From 3e60713590aa88e91e98bb06bb3f0a55ebc66389 Mon Sep 17 00:00:00 2001 From: drigato Date: Mon, 20 Jul 2015 15:20:50 -0400 Subject: [PATCH 5/8] SAAS-962: "Now" option should not be available for linked shows Also added fix for SAAS-957 --- .../public/js/airtime/schedule/add-show.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index f6b359953..3e3ceec0b 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -64,14 +64,14 @@ function setupStartTimeWidgets() { $('#add_show_end_date_no_repeat').val(nowShowEnd.format('YYYY-MM-DD')); $('#add_show_end_time').val(nowShowEnd.format('HH:mm')); - } else { - //Prevent enabling of elements that should always be disabled. - //i.e. when editing a show that has already started - if (!$('#add_show_start_date').prop('disabled')) { - $('#add_show_start_date').removeProp('disabled'); - } + //Disabled linked show option since user won't be able to schedule + //content + $('#add_show_linked').prop('disabled', 'true'); - if (!$('#add_show_start_time').prop('disabled')) { + } else { + //Do not enable start date and time option when a show has already started + if (!$('#add_show_start_now-now').prop('disabled')) { + $('#add_show_start_date').removeProp('disabled'); $('#add_show_start_time').removeProp('disabled'); } @@ -248,6 +248,10 @@ function setAddShowEvents(form) { form.find('input:radio[name=add_show_start_now]').click(function() { setupStartTimeWidgets(); + + if ($(this).val() == "future") { + $('#add_show_linked').removeProp('disabled'); + } }); From 6f09ef4af154d6846ef907c362d944fe32246a0f Mon Sep 17 00:00:00 2001 From: drigato Date: Tue, 21 Jul 2015 07:27:26 -0400 Subject: [PATCH 6/8] Change usability hint wording --- airtime_mvc/application/common/UsabilityHints.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php index 837c9e747..594170cc5 100644 --- a/airtime_mvc/application/common/UsabilityHints.php +++ b/airtime_mvc/application/common/UsabilityHints.php @@ -72,8 +72,8 @@ class Application_Common_UsabilityHints if ($userIsOnCalendarPage) { return _("To start broadcasting, first you need to cancel the current linked show by clicking on it and selecting 'Cancel Current Show'."); } else { - return sprintf(_("Linked shows need to be filled with tracks before it starts. You need to schedule a non-linked show to start broadcasting. - %sCreate a non-linked show now.%s"), "", ""); + return sprintf(_("Linked shows need to be filled with tracks before it starts. To start broadcasting cancel the current linked show and schedule an unlinked show. + %sCreate an unlinked show now.%s"), "", ""); } } else { if ($userIsOnCalendarPage) { From a1a2bf93689e999ad91cc1d02e7bafb483a82edc Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Wed, 22 Jul 2015 11:19:37 -0400 Subject: [PATCH 7/8] Test out existing email functionality --- .../controllers/LoginController.php | 64 +++++++++---------- airtime_mvc/application/models/Email.php | 59 +---------------- .../views/scripts/form/login.phtml | 12 ++-- 3 files changed, 39 insertions(+), 96 deletions(-) diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 920a258cc..e810d4246 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -140,43 +140,43 @@ class LoginController extends Zend_Controller_Action Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); - if (!Application_Model_Preference::GetEnableSystemEmail()) { - $this->_redirect('login'); - } else { - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); +// if (!Application_Model_Preference::GetEnableSystemEmail()) { +// $this->_redirect('login'); +// } else { + //uses separate layout without a navigation. + $this->_helper->layout->setLayout('login'); - $form = new Application_Form_PasswordRestore(); + $form = new Application_Form_PasswordRestore(); - $request = $this->getRequest(); - if ($request->isPost() && $form->isValid($request->getPost())) { - if (is_null($form->username->getValue()) || $form->username->getValue() == '') { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->findOne(); - } else { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->filterByDbLogin($form->username->getValue()) - ->findOne(); - } - - if (!empty($user)) { - $auth = new Application_Model_Auth(); - - $success = $auth->sendPasswordRestoreLink($user, $this->view); - if ($success) { - $this->_helper->redirector('password-restore-after', 'login'); - } else { - $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); - } - } else { - $form->email->addError($this->view->translate(_("Given email not found."))); - } + $request = $this->getRequest(); + if ($request->isPost() && $form->isValid($request->getPost())) { + if (is_null($form->username->getValue()) || $form->username->getValue() == '') { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->findOne(); + } else { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->filterByDbLogin($form->username->getValue()) + ->findOne(); } - $this->view->form = $form; + if (!empty($user)) { + $auth = new Application_Model_Auth(); + + $success = $auth->sendPasswordRestoreLink($user, $this->view); + if ($success) { + $this->_helper->redirector('password-restore-after', 'login'); + } else { + $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); + } + } else { + $form->email->addError($this->view->translate(_("Given email not found."))); + } } + + $this->view->form = $form; +// } } public function passwordRestoreAfterAction() diff --git a/airtime_mvc/application/models/Email.php b/airtime_mvc/application/models/Email.php index 234f20397..774617c1e 100644 --- a/airtime_mvc/application/models/Email.php +++ b/airtime_mvc/application/models/Email.php @@ -12,65 +12,8 @@ class Application_Model_Email */ 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; - 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; + return mail($tos, $subject, $message); } } diff --git a/airtime_mvc/application/views/scripts/form/login.phtml b/airtime_mvc/application/views/scripts/form/login.phtml index e8d80a84d..09893410d 100644 --- a/airtime_mvc/application/views/scripts/form/login.phtml +++ b/airtime_mvc/application/views/scripts/form/login.phtml @@ -30,12 +30,12 @@ element->getElement('csrf') ?> - - -
- -
- + + +
+ +
+ element->getElement('captcha') ?>
 
From ce0cc946abdd5683baf5c2b28cfabefa01ef01e4 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 23 Jul 2015 13:00:34 -0400 Subject: [PATCH 8/8] Disable password reset in saas-dev (moved to saas-email branch) --- .../controllers/LoginController.php | 64 +++++++++---------- .../views/scripts/form/login.phtml | 12 ++-- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index e810d4246..920a258cc 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -140,43 +140,43 @@ class LoginController extends Zend_Controller_Action Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); -// if (!Application_Model_Preference::GetEnableSystemEmail()) { -// $this->_redirect('login'); -// } else { - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); + if (!Application_Model_Preference::GetEnableSystemEmail()) { + $this->_redirect('login'); + } else { + //uses separate layout without a navigation. + $this->_helper->layout->setLayout('login'); - $form = new Application_Form_PasswordRestore(); + $form = new Application_Form_PasswordRestore(); - $request = $this->getRequest(); - if ($request->isPost() && $form->isValid($request->getPost())) { - if (is_null($form->username->getValue()) || $form->username->getValue() == '') { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->findOne(); - } else { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->filterByDbLogin($form->username->getValue()) - ->findOne(); - } - - if (!empty($user)) { - $auth = new Application_Model_Auth(); - - $success = $auth->sendPasswordRestoreLink($user, $this->view); - if ($success) { - $this->_helper->redirector('password-restore-after', 'login'); + $request = $this->getRequest(); + if ($request->isPost() && $form->isValid($request->getPost())) { + if (is_null($form->username->getValue()) || $form->username->getValue() == '') { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->findOne(); } else { - $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->filterByDbLogin($form->username->getValue()) + ->findOne(); } - } else { - $form->email->addError($this->view->translate(_("Given email not found."))); - } - } - $this->view->form = $form; -// } + if (!empty($user)) { + $auth = new Application_Model_Auth(); + + $success = $auth->sendPasswordRestoreLink($user, $this->view); + if ($success) { + $this->_helper->redirector('password-restore-after', 'login'); + } else { + $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); + } + } else { + $form->email->addError($this->view->translate(_("Given email not found."))); + } + } + + $this->view->form = $form; + } } public function passwordRestoreAfterAction() diff --git a/airtime_mvc/application/views/scripts/form/login.phtml b/airtime_mvc/application/views/scripts/form/login.phtml index 09893410d..c286c45be 100644 --- a/airtime_mvc/application/views/scripts/form/login.phtml +++ b/airtime_mvc/application/views/scripts/form/login.phtml @@ -30,12 +30,12 @@ element->getElement('csrf') ?> - -
-
- -
- + + +
+ +
+ element->getElement('captcha') ?>