- $name = defaults($_POST, 'name' , $contact['name']);
- $nick = defaults($_POST, 'nick' , '');
- $url = defaults($_POST, 'url' , '');
- $request = defaults($_POST, 'request' , '');
- $confirm = defaults($_POST, 'confirm' , '');
- $notify = defaults($_POST, 'notify' , '');
- $poll = defaults($_POST, 'poll' , '');
- $attag = defaults($_POST, 'attag' , '');
- $photo = defaults($_POST, 'photo' , '');
- $remote_self = defaults($_POST, 'remote_self', false);
- $nurl = normalise_link($url);
-
- $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `nurl` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s' , `remote_self` = %d
- WHERE `id` = %d AND `uid` = %d",
- dbesc($name),
- dbesc($nick),
- dbesc($url),
- dbesc($nurl),
- dbesc($request),
- dbesc($confirm),
- dbesc($notify),
- dbesc($poll),
- dbesc($attag),
- intval($remote_self),
- intval($contact['id']),
- local_user()
+ $name = ($_POST['name'] ?? '') ?: $contact['name'];
+ $nick = $_POST['nick'] ?? '';
+ $url = $_POST['url'] ?? '';
+ $alias = $_POST['alias'] ?? '';
+ $request = $_POST['request'] ?? '';
+ $confirm = $_POST['confirm'] ?? '';
+ $notify = $_POST['notify'] ?? '';
+ $poll = $_POST['poll'] ?? '';
+ $attag = $_POST['attag'] ?? '';
+ $photo = $_POST['photo'] ?? '';
+ $remote_self = $_POST['remote_self'] ?? false;
+ $nurl = Strings::normaliseLink($url);
+
+ $r = DBA::update(
+ 'contact',
+ [
+ 'name' => $name,
+ 'nick' => $nick,
+ 'url' => $url,
+ 'nurl' => $nurl,
+ 'alias' => $alias,
+ 'request' => $request,
+ 'confirm' => $confirm,
+ 'notify' => $notify,
+ 'poll' => $poll,
+ 'attag' => $attag,
+ 'remote_self' => $remote_self,
+ ],
+ ['id' => $contact['id'], 'uid' => local_user()]