}
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))) {
*/
public static function createFromItem($itemid)
{
- $messages = dba::select('item', ['uid', 'deleted', 'file'], ['id' => $itemid], ['limit' => 1]);
- if (!$messages) {
+ $message = dba::selectFirst('item', ['uid', 'deleted', 'file'], ['id' => $itemid]);
+ if (!\Friendica\Database\DBM::is_result($message)) {
return;
}
- $message = $messages[0];
-
// Clean up all tags
q("DELETE FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` IN (%d, %d)",
intval(TERM_OBJ_POST),
intval(TERM_FILE),
intval(TERM_CATEGORY));
- if ($message["deleted"])
+ if ($message["deleted"]) {
return;
+ }
if (preg_match_all("/\[(.*?)\]/ism", $message["file"], $files)) {
foreach ($files[1] as $file) {
- dba::insert('term', ['uid' => $message["uid"], 'oid' => $itemid, 'otype' => TERM_OBJ_POST, 'type' => TERM_FILE, 'term' => $file]);
+ dba::insert('term', [
+ 'uid' => $message["uid"],
+ 'oid' => $itemid,
+ 'otype' => TERM_OBJ_POST,
+ 'type' => TERM_FILE,
+ 'term' => $file
+ ]);
}
}
if (preg_match_all("/\<(.*?)\>/ism", $message["file"], $files)) {
foreach ($files[1] as $file) {
- dba::insert('term', ['uid' => $message["uid"], 'oid' => $itemid, 'otype' => TERM_OBJ_POST, 'type' => TERM_CATEGORY, 'term' => $file]);
+ dba::insert('term', [
+ 'uid' => $message["uid"],
+ 'oid' => $itemid,
+ 'otype' => TERM_OBJ_POST,
+ 'type' => TERM_CATEGORY,
+ 'term' => $file
+ ]);
}
}
}