- else {
- // create contact record
- $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `addr`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
- `writable`, `blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
- intval(local_user()),
- dbesc(datetime_convert()),
- dbesc($ret['url']),
- dbesc($ret['addr']),
- dbesc($ret['alias']),
- dbesc($ret['notify']),
- dbesc($ret['poll']),
- dbesc($ret['name']),
- dbesc($ret['nick']),
- dbesc($ret['photo']),
- dbesc($ret['network']),
- intval(($ret['network'] === NETWORK_MAIL) ? REL_BUD : REL_FAN),
- intval($ret['priority']),
- intval($writeable)
- );
- }
-
- $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($ret['url']),
- intval(local_user())
- );
-
- if(! count($r)) {
- notice( t('Unable to retrieve contact information.') . EOL);
- goaway($_SESSION['return_url']);
- // NOTREACHED
- }
-
- $contact = $r[0];
- $contact_id = $r[0]['id'];
-
- require_once("Photo.php");
-
- $photos = import_profile_photo($ret['photo'],local_user(),$contact_id);