]> git.mxchange.org Git - friendica-addons.git/commitdiff
twitter: Resolved a SQL error and some SQL warnings
authorMichael Vogel <icarus@dabo.de>
Wed, 16 Oct 2013 06:57:51 +0000 (08:57 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 16 Oct 2013 06:57:51 +0000 (08:57 +0200)
twitter/twitter.php

index 52a35801f8f2bfe200b66e5b74a5a4acf32b71fa..a6e9019772371d0454453f4b937309ef1e9b1da7 100755 (executable)
@@ -805,7 +805,7 @@ function twitter_post_hook(&$a,&$b) {
                                $image = "";
                        } elseif ($iscomment) {
                                logger('twitter_post: Update extid '.$result->id_str." for post id ".$b['id']);
-                               q("UPDATE `item` SET `extid` = '%s', `body` = '%s' WHERE `id` = %d LIMIT 1",
+                               q("UPDATE `item` SET `extid` = '%s', `body` = '%s' WHERE `id` = %d",
                                        dbesc("twitter::".$result->id_str),
                                        dbesc($result->text),
                                        intval($b['id'])
@@ -835,11 +835,11 @@ function twitter_post_hook(&$a,&$b) {
                                notice(t('Twitter post failed. Queued for retry.').EOL);
                        } elseif ($iscomment) {
                                logger('twitter_post: Update extid '.$result->id_str." 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("twitter::".$result->id_str),
                                        intval($b['id'])
                                );
-                               //q("UPDATE `item` SET `extid` = '%s', `body` = '%s' WHERE `id` = %d LIMIT 1",
+                               //q("UPDATE `item` SET `extid` = '%s', `body` = '%s' WHERE `id` = %d",
                                //      dbesc("twitter::".$result->id_str),
                                //      dbesc($result->text),
                                //      intval($b['id'])
@@ -1111,7 +1111,7 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
 
                $contact_id  = $r[0]['id'];
 
-               $g = q("select def_gid from user where uid = %d limit 1",
+               $g = q("SELECT def_gid FROM user WHERE uid = %d LIMIT 1",
                        intval($uid)
                );
 
@@ -1130,7 +1130,7 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
                                        `name-date` = '%s',
                                        `uri-date` = '%s',
                                        `avatar-date` = '%s'
-                               WHERE `id` = %d LIMIT 1",
+                               WHERE `id` = %d",
                        dbesc($photos[0]),
                        dbesc($photos[1]),
                        dbesc($photos[2]),
@@ -1165,8 +1165,8 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
                                                `nurl` = '%s',
                                                `addr` = '%s',
                                                `name` = '%s',
-                                               `nick` = '%s',
-                                       WHERE `id` = %d LIMIT 1",
+                                               `nick` = '%s'
+                                       WHERE `id` = %d",
                                dbesc($photos[0]),
                                dbesc($photos[1]),
                                dbesc($photos[2]),
@@ -1485,7 +1485,7 @@ function twitter_fetchhometimeline($a, $uid) {
        } else
                return;
 
-       $u = q("select * from user where uid = %d limit 1",
+       $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
                intval($uid));
        if(!count($u))
                return;