- $nick = ((x($_POST,'nick')) ? $_POST['nick'] : null);
- $url = ((x($_POST,'url')) ? $_POST['url'] : null);
- $request = ((x($_POST,'request')) ? $_POST['request'] : null);
- $confirm = ((x($_POST,'confirm')) ? $_POST['confirm'] : null);
- $notify = ((x($_POST,'notify')) ? $_POST['notify'] : null);
- $poll = ((x($_POST,'poll')) ? $_POST['poll'] : null);
-
-
- $r = q("UPDATE `contact` SET `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s'
- WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ $name = ((x($_POST,'name')) ? $_POST['name'] : $contact['name']);
+ $nick = ((x($_POST,'nick')) ? $_POST['nick'] : '');
+ $url = ((x($_POST,'url')) ? $_POST['url'] : '');
+ $request = ((x($_POST,'request')) ? $_POST['request'] : '');
+ $confirm = ((x($_POST,'confirm')) ? $_POST['confirm'] : '');
+ $notify = ((x($_POST,'notify')) ? $_POST['notify'] : '');
+ $poll = ((x($_POST,'poll')) ? $_POST['poll'] : '');
+ $attag = ((x($_POST,'attag')) ? $_POST['attag'] : '');
+ $photo = ((x($_POST,'photo')) ? $_POST['photo'] : '');
+ $remote_self = ((x($_POST,'remote_self')) ? $_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),