1
0
Fork 0

Some improvements/fix:

- fixed curly brace bug (introduced by myself)
- make all SQL keywords upper-case, column and table names lower-case
- used some more dbm::is_result

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-09-20 22:18:35 +02:00
parent 50d168ab6b
commit c1a15befc5
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -269,7 +269,7 @@ function dfrn_request_post(&$a) {
dbesc(datetime_convert('UTC','UTC','now - 24 hours')), dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
intval($uid) intval($uid)
); );
if(count($r) > $maxreq) { if(dbm::is_result($r) && count($r) > $maxreq) {
notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL); notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL);
notice( t('Spam protection measures have been invoked.') . EOL); notice( t('Spam protection measures have been invoked.') . EOL);
notice( t('Friends are advised to please try again in 24 hours.') . EOL); notice( t('Friends are advised to please try again in 24 hours.') . EOL);
@ -368,8 +368,7 @@ function dfrn_request_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if(! count($r)) { if(! dbm::is_result($r)) {
notice( t('This account has not been configured for email. Request failed.') . EOL); notice( t('This account has not been configured for email. Request failed.') . EOL);
return; return;
} }
@ -429,8 +428,8 @@ function dfrn_request_post(&$a) {
$hash = random_string(); $hash = random_string();
$r = q("insert into intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked ) $r = q("INSERT INTO intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked )
values( %d , %d, %d, '%s', '%s', '%s', %d ) ", VALUES( %d , %d, %d, '%s', '%s', '%s', %d ) ",
intval($uid), intval($uid),
intval($contact_id), intval($contact_id),
((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0), ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
@ -475,7 +474,7 @@ function dfrn_request_post(&$a) {
dbesc($url) dbesc($url)
); );
if(count($ret)) { if(dbm::is_result($ret)) {
if(strlen($ret[0]['issued-id'])) { if(strlen($ret[0]['issued-id'])) {
notice( t('You have already introduced yourself here.') . EOL ); notice( t('You have already introduced yourself here.') . EOL );
return; return;
@ -572,7 +571,7 @@ function dfrn_request_post(&$a) {
$parms['url'], $parms['url'],
$parms['issued-id'] $parms['issued-id']
); );
if(dbm::is_result($r)) if(dbm::is_result($r)) {
$contact_record = $r[0]; $contact_record = $r[0];
update_contact_avatar($photo, $uid, $contact_record["id"], true); update_contact_avatar($photo, $uid, $contact_record["id"], true);
} }