From b7c1ad8cb2d50da98d38166500c83e17c611e163 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 8 Sep 2014 21:08:50 -0700 Subject: diaspora_like - sql error --- include/diaspora.php | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'include/diaspora.php') diff --git a/include/diaspora.php b/include/diaspora.php index 0d797d915..9a85a0587 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1684,36 +1684,29 @@ function diaspora_photo($importer,$xml,$msg,$attempt=1) { return 202; } - $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `mid` = '%s' LIMIT 1", intval($importer['channel_id']), dbesc($status_message_guid) ); - if(! count($r)) { - if($attempt <= 3) { - q("INSERT INTO dsprphotoq (uid, msg, attempt) VALUES (%d, '%s', %d)", - intval($importer['channel_id']), - dbesc(serialize($msg)), - intval($attempt + 1) - ); - } + if(! $r) { logger('diaspora_photo: attempt = ' . $attempt . '; status message not found: ' . $status_message_guid . ' for photo: ' . $guid); return; } - $parent_item = $r[0]; +// $parent_item = $r[0]; - $link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n"; +// $link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n"; - $link_text = scale_external_images($link_text, true, - array($remote_photo_name, 'scaled_full_' . $remote_photo_name)); +// $link_text = scale_external_images($link_text, true, +// array($remote_photo_name, 'scaled_full_' . $remote_photo_name)); - if(strpos($parent_item['body'],$link_text) === false) { - $r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d", - dbesc($link_text . $parent_item['body']), - intval($parent_item['id']), - intval($parent_item['uid']) - ); - } +// if(strpos($parent_item['body'],$link_text) === false) { +// $r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d", +// dbesc($link_text . $parent_item['body']), +// intval($parent_item['id']), +// intval($parent_item['uid']) +// ); +// } return; } @@ -1750,7 +1743,7 @@ function diaspora_like($importer,$xml,$msg) { return 202; } - $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `mid` = '%s' LIMIT 1", intval($importer['channel_id']), dbesc($parent_guid) ); @@ -1761,7 +1754,7 @@ function diaspora_like($importer,$xml,$msg) { $parent_item = $r[0]; - $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `mid` = '%s' LIMIT 1", intval($importer['channel_id']), dbesc($guid) ); -- cgit v1.2.3