- $r = q("INSERT INTO `item` (`uid`, `type`, `wall`, `resource-id`, `contact-id`,
- `owner-name`,`owner-link`,`owner-avatar`, `created`,
- `edited`, `changed`, `uri`, `parent-uri`, `title`, `body`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
- VALUES( %d, '%s', %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
- intval(get_uid()),
- dbesc('photo'),
- intval(1),
- dbesc($p[0]['resource-id']),
- intval($contact_record['id']),
- dbesc($contact_record['name']),
- dbesc($contact_record['url']),
- dbesc($contact_record['thumb']),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($uri),
- dbesc($uri),
- dbesc($title),
- dbesc($body),
- dbesc($p[0]['allow_cid']),
- dbesc($p[0]['allow_gid']),
- dbesc($p[0]['deny_cid']),
- dbesc($p[0]['deny_gid'])
+ $arr = array();
+
+ $arr['uid'] = get_uid();
+ $arr['uri'] = $uri;
+ $arr['parent-uri'] = $uri;
+ $arr['type'] = 'photo';
+ $arr['wall'] = 1;
+ $arr['resource-id'] = $p[0]['resource-id'];
+ $arr['contact-id'] = $contact_record['id'];
+ $arr['owner-name'] = $contact_record['name'];
+ $arr['owner-link'] = $contact_record['url'];
+ $arr['owner-avatar'] = $contact_record['thumb'];
+ $arr['title'] = $title;
+ $arr['allow_cid'] = $p[0]['allow_cid'];
+ $arr['allow_gid'] = $p[0]['allow_gid'];
+ $arr['deny_cid'] = $p[0]['deny_cid'];
+ $arr['deny_gid'] = $p[0]['deny_gid'];
+ $arr['last-child'] = 1;
+ $arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']'
+ . '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.jpg' . '[/img]'
+ . '[/url]';
+
+ $item_id = item_store($arr);