diff --git a/core/models/dao/FeedDao.php b/core/models/dao/FeedDao.php index 5ea28cb97..1d09750b3 100644 --- a/core/models/dao/FeedDao.php +++ b/core/models/dao/FeedDao.php @@ -92,7 +92,7 @@ public function getResource() case MIDAS_FEED_DELETE_ITEM: return $this->resource; default: - throw new Zend_Exception('Unable to define the type of feed.'); + return false; } } diff --git a/core/views/element/feed.phtml b/core/views/element/feed.phtml index 5e220cc00..cc216b462 100644 --- a/core/views/element/feed.phtml +++ b/core/views/element/feed.phtml @@ -118,12 +118,14 @@ if (!isset($feeds) || empty($feeds)) { echo "
"; foreach ($feeds as $key => $feed) { - echo "
"; - if (isset($this->lastFeedVisit) && $this->lastFeedVisit < strtotime($feed->getDate()) - ) { - echo ""; + if ($feed->getResource() !== false) { + echo "
"; + if (isset($this->lastFeedVisit) && $this->lastFeedVisit < strtotime($feed->getDate()) + ) { + echo ""; + } + createFeedElement($this, $feed); + echo "
"; } - createFeedElement($this, $feed); - echo "
"; } echo "
"; diff --git a/library/Midas/Mail.php b/library/Midas/Mail.php index d26a7def6..d87db4eb2 100644 --- a/library/Midas/Mail.php +++ b/library/Midas/Mail.php @@ -62,11 +62,12 @@ public function getBcc() * Add one or more "CC" email addresses. * * @param array|string $emails "CC" email address or addresses + * @param string $name provided for compatibility with Zend Mail * @return $this this mail instance */ - public function addCc($emails) + public function addCc($emails, $name = '') { - parent::addCc($emails); + parent::addCc($emails, $name); if (!is_array($emails)) { $emails = array($emails); diff --git a/modules/googleauth/controllers/CallbackController.php b/modules/googleauth/controllers/CallbackController.php index 35802b06c..b9e5537ee 100644 --- a/modules/googleauth/controllers/CallbackController.php +++ b/modules/googleauth/controllers/CallbackController.php @@ -90,58 +90,28 @@ protected function _getUserInfo($code) ) ); - // Make the request for the access token - if (extension_loaded('curl')) { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, GOOGLE_AUTH_OAUTH2_URL); - curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, $content); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_PORT, 443); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - $response = curl_exec($curl); - $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); - - if ($status != 200) { - throw new Zend_Exception('Access token request failed: '.$response); - } - } else { - $context = array('http' => array('method' => 'POST', 'header' => $headers, 'content' => $content)); - $context = stream_context_create($context); - $response = file_get_contents(GOOGLE_AUTH_OAUTH2_URL, false, $context); + // Make the request for the access token. + $context = array('http' => array('method' => 'POST', 'header' => $headers, 'content' => $content)); + $context = stream_context_create($context); + $response = file_get_contents(GOOGLE_AUTH_OAUTH2_URL, false, $context); - if ($response === false) { - throw new Zend_Exception('Access token request failed.'); - } + if ($response === false) { + throw new Zend_Exception('Access token request failed.'); } $response = json_decode($response); $accessToken = $response->access_token; $tokenType = $response->token_type; - // Use the access token to request info about the user + // Use the access token to request info about the user. $headers = 'Authorization: '.$tokenType.' '.$accessToken; + $context = array('http' => array('header' => $headers)); + $context = stream_context_create($context); + $params = 'fields=emails/value,id,name(familyName,givenName)'; + $response = file_get_contents(GOOGLE_AUTH_PLUS_URL.'?'.urlencode($params), false, $context); - if (extension_loaded('curl')) { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, GOOGLE_AUTH_PLUS_URL); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_PORT, 443); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - $response = curl_exec($curl); - $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); - - if ($status != 200) { - throw new Zend_Exception('Get Google user info request failed: '.$response); - } - } else { - $context = array('http' => array('header' => $headers)); - $context = stream_context_create($context); - $response = file_get_contents(GOOGLE_AUTH_PLUS_URL, false, $context); - - if ($response === false) { - throw new Zend_Exception('Get Google user info request failed.'); - } + if ($response === false) { + throw new Zend_Exception('Get Google user info request failed.'); } $response = json_decode($response); @@ -172,7 +142,7 @@ protected function _createOrGetUser($info) $closeRegistration = (int) $this->Setting->getValueByNameWithDefault('close_registration', 1); if ($closeRegistration === 1) { throw new Zend_Exception( - 'Access to this instance is by invitation '.'only, please contact an administrator.' + 'Access to this instance is by invitation only, please contact an administrator.' ); } $user = $this->User->createUser($info['email'], null, $info['firstName'], $info['lastName'], 0, ''); diff --git a/modules/mail/forms/Admin.php b/modules/mail/forms/Admin.php index 4dd20856b..ca67c7594 100644 --- a/modules/mail/forms/Admin.php +++ b/modules/mail/forms/Admin.php @@ -59,6 +59,7 @@ public function init() $sendGridPassword = new Zend_Form_Element_Password(MAIL_SEND_GRID_PASSWORD_KEY); $sendGridPassword->setLabel('SendGrid Password'); + $sendGridPassword->setRenderPassword(true); $sendGridPassword->addValidator('NotEmpty', true); $this->addDisplayGroup(array($sendGridUsername, $sendGridPassword), 'send_grid'); @@ -84,6 +85,7 @@ public function init() $smtpPassword = new Zend_Form_Element_Password(MAIL_SMTP_PASSWORD_KEY); $smtpPassword->setLabel('Password'); + $smtpPassword->setRenderPassword(true); $smtpPassword->addValidator('NotEmpty', true); $this->addDisplayGroup(array($smtpHost, $smtpPort, $smtpUseSsl, $smtpUsername, $smtpPassword), 'smtp');