still some old Friendica database queries in diaspora_signed_retraction

This commit is contained in:
friendica 2014-09-16 21:08:34 -07:00
parent 53d0e855df
commit 19e8d10b7a

View File

@ -2043,35 +2043,33 @@ function diaspora_signed_retraction($importer,$xml,$msg) {
} }
if($type === 'StatusMessage' || $type === 'Comment' || $type === 'Like') { if($type === 'StatusMessage' || $type === 'Comment' || $type === 'Like') {
$r = q("select * from item where guid = '%s' and uid = %d and not file like '%%[%%' limit 1", $r = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($guid), dbesc($guid),
intval($importer['channel_id']) intval($importer['channel_id'])
); );
if(count($r)) { if($r) {
if(link_compare($r[0]['author-link'],$contact['url'])) { if($r[0]['author_xchan'] == $contact['xchan_hash']) {
q("update item set `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = '' where `id` = %d",
dbesc(datetime_convert()), drop_item($r[0]['id'],false, DROPITEM_PHASE1);
dbesc(datetime_convert()),
intval($r[0]['id'])
);
// Now check if the retraction needs to be relayed by us // Now check if the retraction needs to be relayed by us
// //
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent. // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item. // The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select origin from item where parent = %d and id = %d limit 1", $p = q("select item_flags from item where parent = %d and id = %d limit 1",
$r[0]['parent'], $r[0]['parent'],
$r[0]['parent'] $r[0]['parent']
); );
if(count($p)) { if($p) {
if(($p[0]['origin']) && (! $parent_author_signature)) { if(($p[0]['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) {
q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", // FIXME so we can relay this
$r[0]['id'], // q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
dbesc($signed_data), // $r[0]['id'],
dbesc($sig), // dbesc($signed_data),
dbesc($diaspora_handle) // dbesc($sig),
); // dbesc($diaspora_handle)
// );
// the existence of parent_author_signature would have meant the parent_author or owner // the existence of parent_author_signature would have meant the parent_author or owner
// is already relaying. // is already relaying.