- if($parent) {
- $r = q("SELECT `uri`, `private`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`
- FROM `item` WHERE `id` = %d AND `parent` = %d AND `uid` = %d LIMIT 1",
- intval($parent),
- intval($parent),
- intval($uid)
- );
- if (DBM::is_result($r)) {
- $parent_uri = $r[0]['uri'];
- $private = $r[0]['private'];
- $allow_cid = $r[0]['allow_cid'];
- $allow_gid = $r[0]['allow_gid'];
- $deny_cid = $r[0]['deny_cid'];
- $deny_gid = $r[0]['deny_gid'];
+ if ($parent) {
+ $fields = ['uri', 'private', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
+ $condition = ['id' => $parent, 'parent' => $parent, 'uid' => $uid];
+ $item = Item::selectFirst($fields, $condition);
+
+ if (DBM::is_result($item)) {
+ $parent_uri = $item['uri'];
+ $private = $item['private'];
+ $allow_cid = $item['allow_cid'];
+ $allow_gid = $item['allow_gid'];
+ $deny_cid = $item['deny_cid'];
+ $deny_gid = $item['deny_gid'];