From 9ad282fe934b4a3a5075b97a7affe28fa789116a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 19 Oct 2013 00:27:22 +0200 Subject: [PATCH] pumpio: Avoiding some SQL warnings --- pumpio/pumpio.php | 14 +++++++++----- statusnet/statusnet.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 4bab7be5..24532b41 100755 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -484,7 +484,7 @@ function pumpio_send(&$a,&$b) { logger('pumpio_send '.$username.': success '.$post_id); if($post_id AND $iscomment) { logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']); - q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d LIMIT 1", + q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", dbesc($post_id), intval($b['id']) ); @@ -925,7 +925,7 @@ function pumpio_get_contact($uid, $contact) { `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s' - WHERE `id` = %d LIMIT 1 + WHERE `id` = %d ", dbesc($photos[0]), dbesc($photos[1]), @@ -952,8 +952,10 @@ function pumpio_get_contact($uid, $contact) { `micro` = '%s', `name-date` = '%s', `uri-date` = '%s', - `avatar-date` = '%s' - WHERE `id` = %d LIMIT 1 + `avatar-date` = '%s', + `name` = '%s', + `nick` = '%s' + WHERE `id` = %d ", dbesc($photos[0]), dbesc($photos[1]), @@ -961,6 +963,8 @@ function pumpio_get_contact($uid, $contact) { dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(datetime_convert()), + dbesc($contact->displayName), + dbesc($contact->preferredUsername), intval($r[0]['id']) ); } @@ -1347,7 +1351,7 @@ function pumpio_queue_hook(&$a,&$b) { logger('pumpio_queue: send '.$username.': success '.$post_id); if($post_id AND $iscomment) { logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']); - q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d LIMIT 1", + q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", dbesc($post_id), intval($z['item']) ); diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 2c979540..66aa3bd5 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -548,7 +548,7 @@ function statusnet_shortenmsg($b, $max_char) { $msglink = $b["plink"]; // If the message is short enough then don't modify it. (if the link exists in the original message) - if ((strlen(trim($origmsg)) <= $max_char) AND (strpos($origmsg, $msglink) OR ($msglink == ""))) + if ((strlen(trim($origmsg)) <= $max_char) AND (($msglink == "") OR strpos($origmsg, $msglink))) return(array("msg"=>trim($origmsg), "image"=>"")); // If the message is short enough and contains a picture then post the picture as well