diaspora_like - sql error

This commit is contained in:
friendica 2014-09-08 21:08:50 -07:00
parent 21290bffce
commit b7c1ad8cb2

View File

@ -1684,36 +1684,29 @@ function diaspora_photo($importer,$xml,$msg,$attempt=1) {
return 202; 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']), intval($importer['channel_id']),
dbesc($status_message_guid) dbesc($status_message_guid)
); );
if(! count($r)) { if(! $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)
);
}
logger('diaspora_photo: attempt = ' . $attempt . '; status message not found: ' . $status_message_guid . ' for photo: ' . $guid); logger('diaspora_photo: attempt = ' . $attempt . '; status message not found: ' . $status_message_guid . ' for photo: ' . $guid);
return; 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, // $link_text = scale_external_images($link_text, true,
array($remote_photo_name, 'scaled_full_' . $remote_photo_name)); // array($remote_photo_name, 'scaled_full_' . $remote_photo_name));
if(strpos($parent_item['body'],$link_text) === false) { // if(strpos($parent_item['body'],$link_text) === false) {
$r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d", // $r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d",
dbesc($link_text . $parent_item['body']), // dbesc($link_text . $parent_item['body']),
intval($parent_item['id']), // intval($parent_item['id']),
intval($parent_item['uid']) // intval($parent_item['uid'])
); // );
} // }
return; return;
} }
@ -1750,7 +1743,7 @@ function diaspora_like($importer,$xml,$msg) {
return 202; 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']), intval($importer['channel_id']),
dbesc($parent_guid) dbesc($parent_guid)
); );
@ -1761,7 +1754,7 @@ function diaspora_like($importer,$xml,$msg) {
$parent_item = $r[0]; $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']), intval($importer['channel_id']),
dbesc($guid) dbesc($guid)
); );