Some easy to replace "q" calls have been replaced by "DBA" calls (#5632)

* Some easy to replace "q" calls have been replaced by "DBA" calls

* Simplified the GUID creation

* And one in the API ...

* And OStatus has got some DBA calls more

* Just some more replaced database calls

* The event query is now simplified

* Events are now shown again

* subthread is now using the DBA calls as well

* Some more replaced database calls

* And some more replaced database calls and prevented notices

* Better use gravity

* Some more replaced database stuff

* Some more replaced database calls in DFRN.php

* The gcontact class now has got the new DBA functions as well

* The Contact class is now changed to new database functions as well

* Small correction

* We can now delete without cascade

* One more functionality is safe for future changes
This commit is contained in:
Michael Vogel 2018-08-19 14:46:11 +02:00 committed by Hypolite Petovan
parent dfe4413463
commit 7f3fb34c24
21 changed files with 275 additions and 501 deletions

View file

@ -1595,18 +1595,19 @@ class Probe
return false;
}
$x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
$user = DBA::selectFirst('user', ['prvkey'], ['uid' => $uid]);
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
$condition = ["`uid` = ? AND `server` != ''", $uid];
$mailacct = DBA::selectFirst('mailacct', ['pass', 'user'], $condition);
if (!DBA::isResult($x) || !DBA::isResult($r)) {
if (!DBA::isResult($user) || !DBA::isResult($mailacct)) {
return false;
}
$mailbox = Email::constructMailboxName($r[0]);
$mailbox = Email::constructMailboxName($mailacct);
$password = '';
openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
$mbox = Email::connect($mailbox, $r[0]['user'], $password);
openssl_private_decrypt(hex2bin($mailacct['pass']), $password, $user['prvkey']);
$mbox = Email::connect($mailbox, $mailacct['user'], $password);
if (!$mbox) {
return false;
}
@ -1659,7 +1660,6 @@ class Probe
if (!empty($mbox)) {
imap_close($mbox);
}
return $data;
}