}
if ($params['type'] != SYSTEM_EMAIL) {
- $user = dba::select('user', array('nickname', 'page-flags'),
- array('uid' => $params['uid']), array('limit' => 1));
+ $user = dba::selectFirst('user', ['nickname', 'page-flags'],
+ ['uid' => $params['uid']]);
// There is no need to create notifications for forum accounts
if (!DBM::is_result($user) || in_array($user["page-flags"], array(PAGE_COMMUNITY, PAGE_PRVGROUP))) {
}
if ($params['type'] == NOTIFY_COMMENT) {
- $p = dba::select('thread', ['ignored'], ['iid' => $parent_id], ['limit' => 1]);
- if (DBM::is_result($p) && $p["ignored"]) {
+ $thread = dba::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
+ if (DBM::is_result($thread) && $thread["ignored"]) {
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
return;
}
// if it's a post figure out who's post it is.
- $p = null;
+ $item = null;
if ($params['otype'] === 'item' && $parent_id) {
- $p = dba::select('item', [], ['id' => $parent_id], ['limit' => 1]);
+ $item = dba::selectFirst('item', [], ['id' => $parent_id]);
}
- $item_post_type = item_post_type($p);
+ $item_post_type = item_post_type($item);
// "a post"
$dest_str = sprintf(t('%1$s commented on [url=%2$s]a %3$s[/url]'),
$item_post_type);
// "George Bull's post"
- if ($p) {
+ if ($item) {
$dest_str = sprintf(t('%1$s commented on [url=%2$s]%3$s\'s %4$s[/url]'),
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$itemlink,
- $p['author-name'],
+ $item['author-name'],
$item_post_type);
}
// "your post"
- if ($p['owner-name'] == $p['author-name'] && $p['wall']) {
+ if (DBM::is_result($item) && $item['owner-name'] == $item['author-name'] && $item['wall']) {
$dest_str = sprintf(t('%1$s commented on [url=%2$s]your %3$s[/url]'),
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
$itemlink,
$profiles = $notification_data["profiles"];
$fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
- $user = dba::select('user', $fields, ['uid' => $uid], ['limit' => 1]);
+ $user = dba::selectFirst('user', $fields, ['uid' => $uid]);
if (!DBM::is_result($user)) {
return false;
}
- $owner = dba::select('contact', ['url'], ['self' => true, 'uid' => $uid], ['limit' => 1]);
+ $owner = dba::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
if (!DBM::is_result($owner)) {
return false;
}