]> git.mxchange.org Git - friendica.git/commitdiff
Some more changed calls
authorMichael <heluecht@pirati.ca>
Wed, 22 Nov 2017 09:11:44 +0000 (09:11 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 22 Nov 2017 09:11:44 +0000 (09:11 +0000)
include/api.php
include/group.php

index 9f91139d1fc4fa293ab3937f9fe7a879f3f4cc73..7c012ddbb72bec5ef948e8a9c6e19837bf527f32 100644 (file)
@@ -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) {
index d3c3a817108d1c22a77b6a5a2ad9c5a92dcffb7b..6e7348c4e269e8416a1fc5124d01cf18fc3297b0 100644 (file)
@@ -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;
 }