diff --git a/.styleci.yml b/.styleci.yml
index f39cf7868..533ce445f 100644
--- a/.styleci.yml
+++ b/.styleci.yml
@@ -26,8 +26,9 @@ disabled:
- phpdoc_params
- phpdoc_separation
- phpdoc_to_comment
+ - phpdoc_types
- phpdoc_var_without_name
- - pre_increment
+
finder:
exclude:
diff --git a/core/models/base/FeedModelBase.php b/core/models/base/FeedModelBase.php
index 4e9ea7bfd..e92990772 100644
--- a/core/models/base/FeedModelBase.php
+++ b/core/models/base/FeedModelBase.php
@@ -21,7 +21,7 @@
/** Feed Model Base */
abstract class FeedModelBase extends AppModel
{
- /** Constructor */
+ /** Constructor. */
public function __construct()
{
parent::__construct();
@@ -72,37 +72,45 @@ abstract protected function getFeeds(
$limit = 20
);
- /** add a community */
+ /** Add a community. */
abstract protected function addCommunity($feed, $community);
- /** Check policy */
+ /** Check policy. */
abstract public function policyCheck($feedDao, $userDao = null, $policy = 0);
- /** get feeds (filtered by policies)
- * @return Array of FeedDao
+ /**
+ * Get feeds (filtered by policies).
+ *
+ * @return array feed DAOs
*/
public function getGlobalFeeds($loggedUserDao, $policy = 0, $limit = 20)
{
return $this->getFeeds($loggedUserDao, null, null, $policy, $limit);
}
- /** get feeds by user (filtered by policies)
- * @return Array of FeedDao
+ /**
+ * Get feeds by user (filtered by policies).
+ *
+ * @return array feed DAOs
*/
public function getFeedsByUser($loggedUserDao, $userDao, $policy = 0, $limit = 20)
{
return $this->getFeeds($loggedUserDao, $userDao, null, $policy, $limit);
}
- /** get feeds by community (filtered by policies)
- * @return Array of FeedDao
+ /**
+ * Get feeds by community (filtered by policies).
+ *
+ * @return array feed DAOs
*/
public function getFeedsByCommunity($loggedUserDao, $communityDao, $policy = 0, $limit = 20)
{
return $this->getFeeds($loggedUserDao, null, $communityDao, $policy, $limit);
}
- /** Create a feed
+ /**
+ * Create a feed.
+ *
* @return FeedDao
*/
public function createFeed($userDao, $type, $resource, $communityDao = null)
diff --git a/core/models/base/UserModelBase.php b/core/models/base/UserModelBase.php
index 1f7a66f75..6e848e512 100644
--- a/core/models/base/UserModelBase.php
+++ b/core/models/base/UserModelBase.php
@@ -394,9 +394,9 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0,
* @param string $s Size in pixels, defaults to 80px [ 1 - 512 ]
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
- * @param boole $img True to return a complete IMG tag False for just the URL
+ * @param bool $img True to return a complete IMG tag False for just the URL
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
- * @return String containing either just a URL or a complete image tag
+ * @return string containing either just a URL or a complete image tag
* @source http://gravatar.com/site/implement/images/php/
*/
public function getGravatarUrl($email, $s = 32, $d = '404', $r = 'g', $img = false, $atts = array())
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/models/pdo/UserModel.php b/core/models/pdo/UserModel.php
index b8448904a..e9084fba6 100644
--- a/core/models/pdo/UserModel.php
+++ b/core/models/pdo/UserModel.php
@@ -305,7 +305,7 @@ public function getUsersFromSearch($search, $userDao, $limit = 14, $group = true
* NOTE: This may ONLY be used to authenticate site admins. This is meant to be
* used during the upgrade process only, not for general authentication.
*
- * @return True or false: whether the authentication succeeded
+ * @return bool True if the authentication succeeded
*/
public function legacyAuthenticate($userDao, $instanceSalt, $password, $hash = 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');
diff --git a/modules/packages/models/pdo/PackageModel.php b/modules/packages/models/pdo/PackageModel.php
index a54af0662..79043b0dd 100644
--- a/modules/packages/models/pdo/PackageModel.php
+++ b/modules/packages/models/pdo/PackageModel.php
@@ -27,7 +27,7 @@ class Packages_PackageModel extends Packages_PackageModelBase
* Return all the record in the table.
*
* @param params Optional associative array specifying an 'os', 'arch', 'submissiontype' and 'packagetype'.
- * @return Array of package Daos
+ * @return array Package DAOs
*/
public function get(
$params = array(