X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Ffsuggest.php;h=58bb11670070bbf22ceeee11fa1ede56c97b766c;hb=41663c7592abe55a958632c3a48265e0a8544d2b;hp=2195f455af56605e5ed3288ad74b02029f57c934;hpb=53e9203d37ee0c1a2afed0faf295e3c622ac2e17;p=friendica.git diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 2195f455af..58bb116700 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -23,15 +23,11 @@ function fsuggest_post(App $a) $contact_id = intval($a->argv[1]); - $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($contact_id), - intval(local_user()) - ); - if (! DBA::isResult($r)) { + $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]); + if (! DBA::isResult($contact)) { notice(L10n::t('Contact not found.') . EOL); return; } - $contact = $r[0]; $new_contact = intval($_POST['suggest']); @@ -45,14 +41,14 @@ function fsuggest_post(App $a) intval(local_user()) ); if (DBA::isResult($r)) { - $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) + q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", intval(local_user()), intval($contact_id), - DBA::escape($r[0]['name']), - DBA::escape($r[0]['url']), - DBA::escape($r[0]['request']), - DBA::escape($r[0]['photo']), + DBA::escape($contact['name']), + DBA::escape($contact['url']), + DBA::escape($contact['request']), + DBA::escape($contact['photo']), DBA::escape($hash), DBA::escape(DateTimeFormat::utcNow()) ); @@ -61,7 +57,7 @@ function fsuggest_post(App $a) intval(local_user()) ); if (DBA::isResult($r)) { - $fsuggest_id = $r[0]['id']; + $fsuggest_id = $contact['id']; q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d", DBA::escape($note), intval($fsuggest_id), @@ -88,16 +84,11 @@ function fsuggest_content(App $a) $contact_id = intval($a->argv[1]); - $r = q( - "SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($contact_id), - intval(local_user()) - ); - if (! DBA::isResult($r)) { + $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]); + if (! DBA::isResult($contact)) { notice(L10n::t('Contact not found.') . EOL); return; } - $contact = $r[0]; $o = '