replace some boolean-evaluations with calls to empty()
This commit is contained in:
parent
6d6de3c1c7
commit
7df082abb8
|
@ -172,7 +172,7 @@ class Notice extends Memcached_DataObject
|
||||||
throw new ClientException(_('Problem saving notice. Too long.'));
|
throw new ClientException(_('Problem saving notice. Too long.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$profile) {
|
if (empty($profile)) {
|
||||||
throw new ClientException(_('Problem saving notice. Unknown user.'));
|
throw new ClientException(_('Problem saving notice. Unknown user.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,11 +307,11 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
static function checkDupes($profile_id, $content) {
|
static function checkDupes($profile_id, $content) {
|
||||||
$profile = Profile::staticGet($profile_id);
|
$profile = Profile::staticGet($profile_id);
|
||||||
if (!$profile) {
|
if (empty($profile)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$notice = $profile->getNotices(0, NOTICE_CACHE_WINDOW);
|
$notice = $profile->getNotices(0, NOTICE_CACHE_WINDOW);
|
||||||
if ($notice) {
|
if (!empty($notice)) {
|
||||||
$last = 0;
|
$last = 0;
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
if (time() - strtotime($notice->created) >= common_config('site', 'dupelimit')) {
|
if (time() - strtotime($notice->created) >= common_config('site', 'dupelimit')) {
|
||||||
|
@ -337,7 +337,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
static function checkEditThrottle($profile_id) {
|
static function checkEditThrottle($profile_id) {
|
||||||
$profile = Profile::staticGet($profile_id);
|
$profile = Profile::staticGet($profile_id);
|
||||||
if (!$profile) {
|
if (empty($profile)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
# Get the Nth notice
|
# Get the Nth notice
|
||||||
|
@ -658,7 +658,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
|
|
||||||
if (!$cache) {
|
if (empty($cache)) {
|
||||||
return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
|
return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
# If there are no hits, just return the value
|
# If there are no hits, just return the value
|
||||||
|
|
||||||
if (!$notice) {
|
if (empty($notice)) {
|
||||||
return $notice;
|
return $notice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,12 +1061,12 @@ class Notice extends Memcached_DataObject
|
||||||
for ($i=0; $i<count($names); $i++) {
|
for ($i=0; $i<count($names); $i++) {
|
||||||
$nickname = $names[$i];
|
$nickname = $names[$i];
|
||||||
$recipient = common_relative_profile($sender, $nickname, $this->created);
|
$recipient = common_relative_profile($sender, $nickname, $this->created);
|
||||||
if (!$recipient) {
|
if (empty($recipient)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Don't save replies from blocked profile to local user
|
// Don't save replies from blocked profile to local user
|
||||||
$recipient_user = User::staticGet('id', $recipient->id);
|
$recipient_user = User::staticGet('id', $recipient->id);
|
||||||
if ($recipient_user && $recipient_user->hasBlocked($sender)) {
|
if (!empty($recipient_user) && $recipient_user->hasBlocked($sender)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$reply = new Reply();
|
$reply = new Reply();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user