From c6c180e8b92edc20f059fa9071e53d9cfee5664d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 22 Nov 2017 09:11:44 +0000 Subject: [PATCH] Some more changed calls --- include/api.php | 12 ++---------- include/group.php | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/include/api.php b/include/api.php index 9f91139d1f..7c012ddbb7 100644 --- a/include/api.php +++ b/include/api.php @@ -3435,11 +3435,7 @@ function api_fr_photoalbum_delete($type) } // 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) { @@ -3722,11 +3718,7 @@ function api_fr_photo_delete($type) 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) { diff --git a/include/group.php b/include/group.php index d3c3a81710..6e7348c4e2 100644 --- a/include/group.php +++ b/include/group.php @@ -79,10 +79,7 @@ function group_rmv($uid,$name) { } // 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'", @@ -109,20 +106,19 @@ function group_byname($uid,$name) { 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; } -- 2.39.5