}
// now let's delete all photos from the album
- $result = q(
- "DELETE FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
- intval(api_user()),
- dbesc($album)
- );
+ $result = dba::delete('photo', array('uid' => api_user(), 'album' => $album));
// return success of deletion or error message
if ($result) {
throw new BadRequestException("photo not available");
}
// now we can perform on the deletion of the photo
- $result = q(
- "DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
- intval(api_user()),
- dbesc($photo_id)
- );
+ $result = dba::delete('photo', array('uid' => api_user(), 'resource-id' => $photo_id));
// return success of deletion or error message
if ($result) {
}
// remove all members
- $r = q("DELETE FROM `group_member` WHERE `uid` = %d AND `gid` = %d ",
- intval($uid),
- intval($group_id)
- );
+ dba::delete('group_member', array('uid' => $uid, 'pid' => $group_id));
// remove group
$r = q("UPDATE `group` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s'",
return false;
}
-function group_rmv_member($uid,$name,$member) {
- $gid = group_byname($uid,$name);
- if (! $gid)
- return false;
- if (! ( $uid && $gid && $member))
+function group_rmv_member($uid, $name, $member) {
+ $gid = group_byname($uid, $name);
+
+ if (!$gid) {
return false;
- $r = q("DELETE FROM `group_member` WHERE `uid` = %d AND `gid` = %d AND `contact-id` = %d",
- intval($uid),
- intval($gid),
- intval($member)
- );
- return $r;
+ }
+ if (!($uid && $gid && $member)) {
+ return false;
+ }
+ $r = dba::delete('group_member', array('uid' => $uid, 'gid' => $gid, 'contact-id' => $member));
+ return $r;
}