Rename Friendica\Database\dba to Friendica\Database\DBA

This commit is contained in:
Hypolite Petovan 2018-07-20 08:19:26 -04:00
commit af6dbc654f
127 changed files with 1169 additions and 1169 deletions

View file

@ -6,7 +6,7 @@ use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Item;
@ -264,7 +264,7 @@ function acl_content(App $a)
while ($author = Item::fetch($authors)) {
$item_authors[$author['author-link']] = $author['author-link'];
}
dba::close($authors);
DBA::close($authors);
foreach ($item_authors as $author) {
if (in_array($author, $known_contacts)) {

View file

@ -14,7 +14,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
use Friendica\Model\Contact;
@ -472,14 +472,14 @@ function admin_page_contactblock(App $a)
{
$condition = ['uid' => 0, 'blocked' => true];
$total = dba::count('contact', $condition);
$total = DBA::count('contact', $condition);
$a->set_pager_total($total);
$a->set_pager_itemspage(30);
$statement = dba::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
$statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
$contacts = dba::inArray($statement);
$contacts = DBA::inArray($statement);
$t = get_markup_template('admin/contactblock.tpl');
$o = replace_macros($t, [
@ -781,8 +781,8 @@ function admin_page_queue(App $a)
function admin_page_workerqueue(App $a)
{
// get jobs from the workerqueue table
$statement = dba::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
$r = dba::inArray($statement);
$statement = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
$r = DBA::inArray($statement);
for($i = 0; $i < count($r); $i++) {
$r[$i]['parameter'] = stripslashes(implode(': ', explode('","', $r[$i]['parameter'])));
@ -817,7 +817,7 @@ function admin_page_workerqueue(App $a)
function admin_page_summary(App $a)
{
// are there MyISAM tables in the DB? If so, trigger a warning message
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(dba::database_name()));
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(DBA::database_name()));
$showwarning = false;
$warningtext = [];
if (DBM::is_result($r)) {
@ -963,7 +963,7 @@ function admin_page_site_post(App $a)
$r = q("UPDATE %s SET %s;", $table_name, $upds);
if (!DBM::is_result($r)) {
notice("Failed updating '$table_name': " . dba::errorMessage());
notice("Failed updating '$table_name': " . DBA::errorMessage());
goaway('admin/site');
}
}
@ -1731,7 +1731,7 @@ function admin_page_users(App $a)
{
if ($a->argc > 2) {
$uid = $a->argv[3];
$user = dba::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
$user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
if (!DBM::is_result($user)) {
notice('User not found' . EOL);
goaway('admin/users');

View file

@ -7,7 +7,7 @@ use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -35,7 +35,7 @@ function allfriends_content(App $a)
$uid = $a->user['uid'];
$contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
if (!DBM::is_result($contact)) {
return;

View file

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
require_once 'include/dba.php';
@ -22,7 +22,7 @@ function attach_init(App $a)
// Check for existence, which will also provide us the owner uid
$r = dba::selectFirst('attach', [], ['id' => $item_id]);
$r = DBA::selectFirst('attach', [], ['id' => $item_id]);
if (!DBM::is_result($r)) {
notice(L10n::t('Item was not found.'). EOL);
return;

View file

@ -13,7 +13,7 @@ use Friendica\Content\Widget;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Event;
@ -37,7 +37,7 @@ function cal_init(App $a)
if ($a->argc > 1) {
$nick = $a->argv[1];
$user = dba::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
$user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
if (!DBM::is_result($user)) {
return;
}

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -38,14 +38,14 @@ function common_content(App $a)
}
if ($cmd === 'loc' && $cid) {
$contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
if (DBM::is_result($contact)) {
$a->page['aside'] = "";
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
}
} else {
$contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
if (DBM::is_result($contact)) {
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
@ -66,11 +66,11 @@ function common_content(App $a)
}
if (!$cid && Profile::getMyURL()) {
$contact = dba::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
if (DBM::is_result($contact)) {
$cid = $contact['id'];
} else {
$gcontact = dba::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
if (DBM::is_result($gcontact)) {
$zcid = $gcontact['id'];
}

View file

@ -9,7 +9,7 @@ use Friendica\Core\ACL;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
function community_init(App $a)
@ -190,7 +190,7 @@ function community_content(App $a, $update = 0)
function community_getitems($start, $itemspage, $content)
{
if ($content == 'local') {
$r = dba::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
$r = DBA::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
@ -198,14 +198,14 @@ function community_getitems($start, $itemspage, $content)
AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin`
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
);
return dba::inArray($r);
return DBA::inArray($r);
} elseif ($content == 'global') {
$r = dba::p("SELECT `uri` FROM `thread`
$r = DBA::p("SELECT `uri` FROM `thread`
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
WHERE `thread`.`uid` = 0 AND NOT `author`.`hidden` AND NOT `author`.`blocked`
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage));
return dba::inArray($r);
return DBA::inArray($r);
}
// Should never happen

View file

@ -12,7 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -42,7 +42,7 @@ function contacts_init(App $a)
$contact = null;
if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
$contact_id = intval($a->argv[1]);
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
}
if (DBM::is_result($contact)) {
@ -181,7 +181,7 @@ function contacts_post(App $a)
return;
}
if (!dba::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
return; // NOTREACHED
@ -191,7 +191,7 @@ function contacts_post(App $a)
$profile_id = intval($_POST['profile-assign']);
if ($profile_id) {
if (!dba::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
notice(L10n::t('Could not locate selected profile.') . EOL);
return;
}
@ -231,7 +231,7 @@ function contacts_post(App $a)
notice(L10n::t('Failed to update contact record.') . EOL);
}
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
if (DBM::is_result($contact)) {
$a->data['contact'] = $contact;
}
@ -243,7 +243,7 @@ function contacts_post(App $a)
function _contact_update($contact_id)
{
$contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
if (!DBM::is_result($contact)) {
return;
}
@ -264,7 +264,7 @@ function _contact_update($contact_id)
function _contact_update_profile($contact_id)
{
$contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
if (!DBM::is_result($contact)) {
return;
}
@ -396,7 +396,7 @@ function contacts_content(App $a)
$cmd = $a->argv[2];
$orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
if (!DBM::is_result($orig_record)) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
@ -910,7 +910,7 @@ function contact_posts($a, $contact_id)
{
$o = contacts_tab($a, $contact_id, 1);
$contact = dba::selectFirst('contact', ['url'], ['id' => $contact_id]);
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id]);
if (DBM::is_result($contact)) {
$a->page['aside'] = "";
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -21,7 +21,7 @@ function crepair_init(App $a)
$contact = null;
if (($a->argc == 2) && intval($a->argv[1])) {
$contact = dba::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
$contact = DBA::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
}
if (!x($a->page, 'aside')) {
@ -44,7 +44,7 @@ function crepair_post(App $a)
$contact = null;
if ($cid) {
$contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
}
if (!DBM::is_result($contact)) {
@ -105,7 +105,7 @@ function crepair_content(App $a)
$contact = null;
if ($cid) {
$contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
}
if (!DBM::is_result($contact)) {

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\User;
@ -34,7 +34,7 @@ function delegate_post(App $a)
$parent_password = defaults($_POST, 'parent_password', '');
if ($parent_uid != 0) {
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
if (!DBM::is_result($user)) {
notice(L10n::t('Parent user not found.') . EOL);
return;
@ -47,7 +47,7 @@ function delegate_post(App $a)
}
}
dba::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
}
function delegate_content(App $a)
@ -65,14 +65,14 @@ function delegate_content(App $a)
$user_id = $a->argv[2];
$user = dba::selectFirst('user', ['nickname'], ['uid' => $user_id]);
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $user_id]);
if (DBM::is_result($user)) {
$condition = [
'uid' => local_user(),
'nurl' => normalise_link(System::baseUrl() . '/profile/' . $user['nickname'])
];
if (dba::exists('contact', $condition)) {
dba::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
if (DBA::exists('contact', $condition)) {
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
}
}
goaway(System::baseUrl() . '/delegate');
@ -84,7 +84,7 @@ function delegate_content(App $a)
goaway(System::baseUrl() . '/delegate');
}
dba::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
DBA::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
goaway(System::baseUrl() . '/delegate');
}
@ -136,19 +136,19 @@ function delegate_content(App $a)
settings_init($a);
$user = dba::selectFirst('user', ['parent-uid', 'email'], ['uid' => local_user()]);
$user = DBA::selectFirst('user', ['parent-uid', 'email'], ['uid' => local_user()]);
$parent_user = null;
if (DBM::is_result($user)) {
if (!dba::exists('user', ['parent-uid' => local_user()])) {
if (!DBA::exists('user', ['parent-uid' => local_user()])) {
$parent_uid = $user['parent-uid'];
$parents = [0 => L10n::t('No parent user')];
$fields = ['uid', 'username', 'nickname'];
$condition = ['email' => $user['email'], 'verified' => true, 'blocked' => false, 'parent-uid' => 0];
$parent_users = dba::select('user', $fields, $condition);
while ($parent = dba::fetch($parent_users)) {
$parent_users = DBA::select('user', $fields, $condition);
while ($parent = DBA::fetch($parent_users)) {
if ($parent['uid'] != local_user()) {
$parents[$parent['uid']] = sprintf('%s (%s)', $parent['username'], $parent['nickname']);
}

View file

@ -21,7 +21,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -67,7 +67,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
return;
}
$user = dba::selectFirst('user', [], ['uid' => $uid]);
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
if (!DBM::is_result($user)) {
notice(L10n::t('Profile not found.') . EOL);
return;
@ -280,13 +280,13 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
if (($status == 0) && $intro_id) {
$intro = dba::selectFirst('intro', ['note'], ['id' => $intro_id]);
$intro = DBA::selectFirst('intro', ['note'], ['id' => $intro_id]);
if (DBM::is_result($intro)) {
dba::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
DBA::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
}
// Success. Delete the notification.
dba::delete('intro', ['id' => $intro_id]);
DBA::delete('intro', ['id' => $intro_id]);
}
if ($status != 0) {
@ -358,7 +358,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
}
dba::delete('intro', ['id' => $intro_id]);
DBA::delete('intro', ['id' => $intro_id]);
$r = q("UPDATE `contact` SET `name-date` = '%s',
`uri-date` = '%s',
@ -391,7 +391,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
// reload contact info
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
if (DBM::is_result($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
$ret = Diaspora::sendShare($user, $contact);
@ -443,7 +443,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
// Find our user's account
$user = dba::selectFirst('user', [], ['nickname' => $node]);
$user = DBA::selectFirst('user', [], ['nickname' => $node]);
if (!DBM::is_result($user)) {
$message = L10n::t('No user record found for \'%s\' ', $node);
System::xmlExit(3, $message); // failure
@ -471,7 +471,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// NOTREACHED
}
$contact = dba::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
$contact = DBA::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
if (!DBM::is_result($contact)) {
if (strstr($decrypted_source_url, 'http:')) {
$newurl = str_replace('http:', 'https:', $decrypted_source_url);
@ -479,7 +479,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$newurl = str_replace('https:', 'http:', $decrypted_source_url);
}
$contact = dba::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
$contact = DBA::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
if (!DBM::is_result($contact)) {
// this is either a bogus confirmation (?) or we deleted the original introduction.
$message = L10n::t('Contact record was not found for you on our site.');
@ -511,7 +511,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$dfrn_pubkey = $public_key;
}
if (dba::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
if (DBA::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
$message = L10n::t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
System::xmlExit(1, $message); // Birthday paradox - duplicate dfrn-id
// NOTREACHED
@ -537,7 +537,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
// We're good but now we have to scrape the profile photo and send notifications.
$contact = dba::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
$contact = DBA::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
if (DBM::is_result($contact)) {
$photo = $contact['photo'];
} else {

View file

@ -9,7 +9,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Protocol\DFRN;
@ -27,7 +27,7 @@ function dfrn_notify_post(App $a) {
if (is_object($data)) {
$nick = defaults($a->argv, 1, '');
$user = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
$user = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBM::is_result($user)) {
System::httpExit(500);
}
@ -63,12 +63,12 @@ function dfrn_notify_post(App $a) {
$dfrn_id = substr($dfrn_id, 2);
}
if (!dba::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
if (!DBA::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
logger('could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
System::xmlExit(3, 'Could not match challenge');
}
dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
// find the local user who owns this relationship.
@ -121,7 +121,7 @@ function dfrn_notify_post(App $a) {
if ((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) {
$fields = ['writable' => ($writable == (-1)) ? $importer['writable'] : $writable,
'forum' => $forum, 'prv' => $prv];
dba::update('contact', $fields, ['id' => $importer['id']]);
DBA::update('contact', $fields, ['id' => $importer['id']]);
if ($writable != (-1)) {
$importer['writable'] = $writable;
@ -213,7 +213,7 @@ function dfrn_dispatch_public($postdata)
}
// We now have some contact, so we fetch it
$importer = dba::fetch_first("SELECT *, `name` as `senderName`
$importer = DBA::fetch_first("SELECT *, `name` as `senderName`
FROM `contact`
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
$contact['id']);
@ -252,7 +252,7 @@ function dfrn_dispatch_private($user, $postdata)
}
// We now have some contact, so we fetch it
$importer = dba::fetch_first("SELECT *, `name` as `senderName`
$importer = DBA::fetch_first("SELECT *, `name` as `senderName`
FROM `contact`
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
$cid);
@ -302,11 +302,11 @@ function dfrn_notify_content(App $a) {
$status = 0;
dba::delete('challenge', ["`expire` < ?", time()]);
DBA::delete('challenge', ["`expire` < ?", time()]);
$fields = ['challenge' => $hash, 'dfrn-id' => $dfrn_id, 'expire' => time() + 90,
'type' => $type, 'last_update' => $last_update];
dba::insert('challenge', $fields);
DBA::insert('challenge', $fields);
logger('challenge=' . $hash, LOGGER_DATA);

View file

@ -8,7 +8,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Module\Login;
use Friendica\Protocol\DFRN;
@ -143,7 +143,7 @@ function dfrn_poll_init(App $a)
if ($type === 'profile-check' && $dfrn_version < 2.2) {
if ((strlen($challenge)) && (strlen($sec))) {
dba::delete('profile_check', ["`expire` < ?", time()]);
DBA::delete('profile_check', ["`expire` < ?", time()]);
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec)
);
@ -208,7 +208,7 @@ function dfrn_poll_init(App $a)
break;
}
dba::delete('profile_check', ["`expire` < ?", time()]);
DBA::delete('profile_check', ["`expire` < ?", time()]);
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
dbesc($dfrn_id));
if (DBM::is_result($r)) {
@ -235,7 +235,7 @@ function dfrn_poll_post(App $a)
if (strlen($challenge) && strlen($sec)) {
logger('dfrn_poll: POST: profile-check');
dba::delete('profile_check', ["`expire` < ?", time()]);
DBA::delete('profile_check', ["`expire` < ?", time()]);
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec)
);
@ -308,7 +308,7 @@ function dfrn_poll_post(App $a)
$type = $r[0]['type'];
$last_update = $r[0]['last_update'];
dba::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
$sql_extra = '';
switch ($direction) {
@ -413,7 +413,7 @@ function dfrn_poll_content(App $a)
$status = 0;
dba::delete('challenge', ["`expire` < ?", time()]);
DBA::delete('challenge', ["`expire` < ?", time()]);
if ($type !== 'profile') {
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )

View file

@ -16,7 +16,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -262,9 +262,9 @@ function dfrn_request_post(App $a)
if (DBM::is_result($r)) {
foreach ($r as $rr) {
if (!$rr['rel']) {
dba::delete('contact', ['id' => $rr['cid'], 'self' => false]);
DBA::delete('contact', ['id' => $rr['cid'], 'self' => false]);
}
dba::delete('intro', ['id' => $rr['iid']]);
DBA::delete('intro', ['id' => $rr['iid']]);
}
}

View file

@ -9,7 +9,7 @@ use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -83,7 +83,7 @@ function directory_content(App $a)
$publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 " );
$cnt = dba::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
$cnt = DBA::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
if (DBM::is_result($cnt)) {
@ -94,7 +94,7 @@ function directory_content(App $a)
$limit = intval($a->pager['start'])."," . intval($a->pager['itemspage']);
$r = dba::p("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`,
$r = DBA::p("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`,
`contact`.`addr`, `contact`.`url` AS profile_url FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
@ -108,7 +108,7 @@ function directory_content(App $a)
$photo = 'photo';
}
while ($rr = dba::fetch($r)) {
while ($rr = DBA::fetch($r)) {
$itemurl= '';
$itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
@ -196,7 +196,7 @@ function directory_content(App $a)
$entries[] = $arr['entry'];
}
dba::close($r);
DBA::close($r);
$tpl = get_markup_template('directory_header.tpl');

View file

@ -10,7 +10,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -203,7 +203,7 @@ function dirfind_content(App $a, $prefix = "") {
if ($jj->cid > 0) {
$connlnk = "";
$conntxt = "";
$contact = dba::selectFirst('contact', [], ['id' => $jj->cid]);
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
if (DBM::is_result($contact)) {
$photo_menu = Contact::photoMenu($contact);
$details = _contact_detail_for_template($contact);

View file

@ -11,7 +11,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -87,7 +87,7 @@ function display_init(App $a)
$nickname = str_replace(normalise_link(System::baseUrl())."/profile/", "", normalise_link($profiledata["url"]));
if (($nickname != $a->user["nickname"])) {
$profile = dba::fetch_first("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
$profile = DBA::fetch_first("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
$nickname
@ -106,7 +106,7 @@ function display_init(App $a)
function display_fetchauthor($a, $item)
{
$author = dba::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
$author = DBA::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
$profiledata = [];
$profiledata['uid'] = -1;
@ -248,7 +248,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
// We are displaying an "alternate" link if that post was public. See issue 2864
$is_public = dba::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
$is_public = DBA::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
if ($is_public) {
// For the atom feed the nickname doesn't matter at all, we only need the item id.
$alternate = System::baseUrl().'/display/feed-item/'.$item_id.'.atom';
@ -280,7 +280,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
if ($contact_id) {
$groups = Group::getIdsByContactId($contact_id);
$remote_contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
$remote_contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
if (DBM::is_result($remote_contact)) {
$contact = $remote_contact;
$is_remote_contact = true;
@ -294,7 +294,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
}
$page_contact = dba::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
if (DBM::is_result($page_contact)) {
$a->page_contact = $page_contact;
}
@ -325,7 +325,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
if (local_user() && (local_user() == $a->profile['uid'])) {
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
$unseen = dba::exists('item', $condition);
$unseen = DBA::exists('item', $condition);
} else {
$unseen = false;
}

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Protocol\Feed;
use Friendica\Util\Network;
@ -26,11 +26,11 @@ function feedtest_content(App $a)
if (!empty($_REQUEST['url'])) {
$url = $_REQUEST['url'];
$importer = dba::selectFirst('user', [], ['uid' => local_user()]);
$importer = DBA::selectFirst('user', [], ['uid' => local_user()]);
$contact_id = Contact::getIdForURL($url, local_user(), true);
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
$ret = Network::curl($contact['poll']);
$xml = $ret['body'];

View file

@ -11,7 +11,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -47,7 +47,7 @@ function hovercard_content()
$cid = 0;
if (strpos($profileurl, 'redir/') === 0) {
$cid = intval(substr($profileurl, 6));
$remote_contact = dba::selectFirst('contact', ['nurl'], ['id' => $cid]);
$remote_contact = DBA::selectFirst('contact', ['nurl'], ['id' => $cid]);
$profileurl = defaults($remote_contact, 'nurl', '');
}

View file

@ -7,7 +7,7 @@ use Friendica\App;
use Friendica\Core\Install;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Util\Temporal;
@ -53,7 +53,7 @@ function install_post(App $a) {
$phpath = notags(trim($_POST['phpath']));
require_once("include/dba.php");
if (!dba::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
if (!DBA::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
$a->data['db_conn_failed'] = true;
}
@ -71,7 +71,7 @@ function install_post(App $a) {
$adminmail = notags(trim($_POST['adminmail']));
// connect to db
dba::connect($dbhost, $dbuser, $dbpass, $dbdata);
DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
Install::install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
@ -112,7 +112,7 @@ function install_content(App $a) {
$db_return_text .= $txt;
}
if (dba::$connected) {
if (DBA::$connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`");
if (DBM::is_result($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');

View file

@ -23,7 +23,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Item;
@ -146,7 +146,7 @@ function item_post(App $a) {
// Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') && ($profile_uid != 0)) {
if (dba::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
if (DBA::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
return;
}
@ -174,7 +174,7 @@ function item_post(App $a) {
$orig_post = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
}
$user = dba::selectFirst('user', [], ['uid' => $profile_uid]);
$user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
if (!DBM::is_result($user) && !$parent) {
return;
@ -268,7 +268,7 @@ function item_post(App $a) {
// if using the API, we won't see pubmail_enable - figure out if it should be set
if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) {
if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
$pubmail_enabled = dba::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
$pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
}
}
@ -305,7 +305,7 @@ function item_post(App $a) {
if (local_user() && ((local_user() == $profile_uid) || $allow_comment)) {
$self = true;
$author = dba::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
$author = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
} elseif (remote_user()) {
if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) {
@ -316,7 +316,7 @@ function item_post(App $a) {
}
}
if ($contact_id) {
$author = dba::selectFirst('contact', [], ['id' => $contact_id]);
$author = DBA::selectFirst('contact', [], ['id' => $contact_id]);
}
}
@ -328,7 +328,7 @@ function item_post(App $a) {
if ($profile_uid == local_user() || $allow_comment) {
$contact_record = $author;
} else {
$contact_record = dba::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
$contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
}
// Look for any tags and linkify them
@ -458,14 +458,14 @@ function item_post(App $a) {
$condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
'resource-id' => $image_uri, 'uid' => $profile_uid];
if (!dba::exists('photo', $condition)) {
if (!DBA::exists('photo', $condition)) {
continue;
}
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
$condition = ['resource-id' => $image_uri, 'uid' => $profile_uid, 'album' => L10n::t('Wall Photos')];
dba::update('photo', $fields, $condition);
DBA::update('photo', $fields, $condition);
}
}
}
@ -486,14 +486,14 @@ function item_post(App $a) {
$condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
'id' => $attach];
if (!dba::exists('attach', $condition)) {
if (!DBA::exists('attach', $condition)) {
continue;
}
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
$condition = ['id' => $attach];
dba::update('attach', $fields, $condition);
DBA::update('attach', $fields, $condition);
}
}
}
@ -536,7 +536,7 @@ function item_post(App $a) {
if (preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
foreach ($match[2] as $mtch) {
$fields = ['id', 'filename', 'filesize', 'filetype'];
$attachment = dba::selectFirst('attach', $fields, ['id' => $mtch]);
$attachment = DBA::selectFirst('attach', $fields, ['id' => $mtch]);
if (DBM::is_result($attachment)) {
if (strlen($attachments)) {
$attachments .= ',';
@ -636,7 +636,7 @@ function item_post(App $a) {
// This field is for storing the raw conversation data
$datarray['protocol'] = PROTOCOL_DFRN;
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
if (DBM::is_result($conversation)) {
if ($conversation['conversation-uri'] != '') {
$datarray['conversation-uri'] = $conversation['conversation-uri'];
@ -960,32 +960,32 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
if (strrpos($name, '+')) {
// Is it in format @nick+number?
$tagcid = intval(substr($name, strrpos($name, '+') + 1));
$contact = dba::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
$contact = DBA::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
}
// select someone by nick or attag in the current network
if (!DBM::is_result($contact) && ($network != "")) {
$condition = ["(`nick` = ? OR `attag` = ?) AND `network` = ? AND `uid` = ?",
$name, $name, $network, $profile_uid];
$contact = dba::selectFirst('contact', $fields, $condition);
$contact = DBA::selectFirst('contact', $fields, $condition);
}
//select someone by name in the current network
if (!DBM::is_result($contact) && ($network != "")) {
$condition = ['name' => $name, 'network' => $network, 'uid' => $profile_uid];
$contact = dba::selectFirst('contact', $fields, $condition);
$contact = DBA::selectFirst('contact', $fields, $condition);
}
// select someone by nick or attag in any network
if (!DBM::is_result($contact)) {
$condition = ["(`nick` = ? OR `attag` = ?) AND `uid` = ?", $name, $name, $profile_uid];
$contact = dba::selectFirst('contact', $fields, $condition);
$contact = DBA::selectFirst('contact', $fields, $condition);
}
// select someone by name in any network
if (!DBM::is_result($contact)) {
$condition = ['name' => $name, 'uid' => $profile_uid];
$contact = dba::selectFirst('contact', $fields, $condition);
$contact = DBA::selectFirst('contact', $fields, $condition);
}
}

View file

@ -7,7 +7,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\User;
use Friendica\Util\DateTimeFormat;
@ -24,7 +24,7 @@ function lostpass_post(App $a)
}
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
$user = dba::selectFirst('user', ['uid', 'username', 'email'], $condition);
$user = DBA::selectFirst('user', ['uid', 'username', 'email'], $condition);
if (!DBM::is_result($user)) {
notice(L10n::t('No valid account found.') . EOL);
goaway(System::baseUrl());
@ -36,7 +36,7 @@ function lostpass_post(App $a)
'pwdreset' => $pwdreset_token,
'pwdreset_time' => DateTimeFormat::utcNow()
];
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {
info(L10n::t('Password reset request issued. Check your email.') . EOL);
}
@ -86,7 +86,7 @@ function lostpass_content(App $a)
if ($a->argc > 1) {
$pwdreset_token = $a->argv[1];
$user = dba::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
$user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
if (!DBM::is_result($user)) {
notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
@ -99,7 +99,7 @@ function lostpass_content(App $a)
'pwdreset' => null,
'pwdreset_time' => null
];
dba::update('user', $fields, ['uid' => $user['uid']]);
DBA::update('user', $fields, ['uid' => $user['uid']]);
notice(L10n::t('Request has expired, please make a new one.'));

View file

@ -10,7 +10,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\ACL;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Mail;
@ -150,7 +150,7 @@ function message_content(App $a)
$cmd = $a->argv[1];
if ($cmd === 'drop') {
if (dba::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
info(L10n::t('Message deleted.') . EOL);
}
@ -165,7 +165,7 @@ function message_content(App $a)
$parent = $r[0]['parent-uri'];
$convid = $r[0]['convid'];
if (dba::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
if (DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
info(L10n::t('Conversation removed.') . EOL);
}
}

View file

@ -15,7 +15,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -41,13 +41,13 @@ function network_init(App $a)
}
if (x($_GET, 'save')) {
$exists = dba::exists('search', ['uid' => local_user(), 'term' => $search]);
$exists = DBA::exists('search', ['uid' => local_user(), 'term' => $search]);
if (!$exists) {
dba::insert('search', ['uid' => local_user(), 'term' => $search]);
DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
}
}
if (x($_GET, 'remove')) {
dba::delete('search', ['uid' => local_user(), 'term' => $search]);
DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
}
$is_a_date_query = false;
@ -182,10 +182,10 @@ function saved_searches($search)
$o = '';
$terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]);
$terms = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
$saved = [];
while ($rr = dba::fetch($terms)) {
while ($rr = DBA::fetch($terms)) {
$saved[] = [
'id' => $rr['id'],
'term' => $rr['term'],
@ -317,7 +317,7 @@ function networkSetSeen($condition)
return;
}
$unseen = dba::exists('item', $condition);
$unseen = DBA::exists('item', $condition);
if ($unseen) {
$r = Item::update(['unseen' => false], $condition);
@ -442,13 +442,13 @@ function networkFlatView(App $a, $update = 0)
$condition = ["`term` = ? AND `otype` = ? AND `type` = ? AND `uid` = ?",
$file, TERM_OBJ_POST, TERM_FILE, local_user()];
$params = ['order' => ['tid' => true], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
$result = dba::select('term', ['oid'], $condition);
$result = DBA::select('term', ['oid'], $condition);
$posts = [];
while ($term = dba::fetch($result)) {
while ($term = DBA::fetch($result)) {
$posts[] = $term['oid'];
}
dba::close($terms);
DBA::close($terms);
$condition = ['uid' => local_user(), 'id' => $posts];
} else {
@ -525,10 +525,10 @@ function networkThreadedView(App $a, $update, $parent)
}
if ($nets) {
$r = dba::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
$r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
$str = '';
while ($rr = dba::fetch($r)) {
while ($rr = DBA::fetch($r)) {
$str .= '<' . $rr['id'] . '>';
}
if (strlen($str)) {
@ -556,7 +556,7 @@ function networkThreadedView(App $a, $update, $parent)
if ($cid) {
// If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
$condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
$contact = dba::selectFirst('contact', ['addr', 'nick'], $condition);
$contact = DBA::selectFirst('contact', ['addr', 'nick'], $condition);
if (DBM::is_result($contact)) {
if ($contact['addr'] != '') {
$content = '!' . $contact['addr'];
@ -609,7 +609,7 @@ function networkThreadedView(App $a, $update, $parent)
$sql_tag_nets = (($nets) ? sprintf(" AND `item`.`network` = '%s' ", dbesc($nets)) : '');
if ($gid) {
$group = dba::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
$group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
if (!DBM::is_result($group)) {
if ($update) {
killme();
@ -625,7 +625,7 @@ function networkThreadedView(App $a, $update, $parent)
$contact_str_self = '';
$contact_str = implode(',', $contacts);
$self = dba::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
if (DBM::is_result($self)) {
$contact_str_self = $self['id'];
}
@ -645,7 +645,7 @@ function networkThreadedView(App $a, $update, $parent)
$fields = ['id', 'name', 'network', 'writable', 'nurl',
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
$contact = dba::selectFirst('contact', $fields, $condition);
$contact = DBA::selectFirst('contact', $fields, $condition);
if (DBM::is_result($contact)) {
$sql_extra = " AND " . $sql_table . ".`contact-id` = " . intval($cid);
@ -835,7 +835,7 @@ function networkThreadedView(App $a, $update, $parent)
$top_limit = DateTimeFormat::utcNow();
}
$items = dba::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
$items = DBA::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
STRAIGHT_JOIN (SELECT `oid` FROM `term` WHERE `term` IN
(SELECT SUBSTR(`term`, 2) FROM `search` WHERE `uid` = ? AND `term` LIKE '#%') AND `otype` = ? AND `type` = ? AND `uid` = 0) AS `term`
ON `item`.`id` = `term`.`oid`
@ -845,7 +845,7 @@ function networkThreadedView(App $a, $update, $parent)
local_user(), TERM_OBJ_POST, TERM_HASHTAG,
$top_limit, $bottom_limit);
$data = dba::inArray($items);
$data = DBA::inArray($items);
if (count($data) > 0) {
$tag_top_limit = current($data)['order_date'];
@ -862,7 +862,7 @@ function networkThreadedView(App $a, $update, $parent)
// Don't show hash tag posts from blocked or ignored contacts
$condition = ["`nurl` = ? AND `uid` = ? AND (`blocked` OR `readonly`)",
normalise_link($item['author-link']), local_user()];
if (!dba::exists('contact', $condition)) {
if (!DBA::exists('contact', $condition)) {
$s[$item['uri']] = $item;
}
}

View file

@ -9,7 +9,7 @@ use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Util\Network;
require_once 'include/dba.php';
@ -215,11 +215,11 @@ function nodeinfo_cron() {
logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
}
$local_posts = dba::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
$local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts);
logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
$local_comments = dba::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
$local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments);
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);

View file

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Profile;
@ -45,7 +45,7 @@ function noscrape_init(App $a)
$keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords);
$keywords = explode(',', $keywords);
$contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
$contactPhoto = DBA::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
$json_info['fn'] = $a->profile['name'];
$json_info['photo'] = $contactPhoto["photo"];
@ -74,13 +74,13 @@ function noscrape_init(App $a)
// We display the last activity (post or login), reduced to year and week number
$last_active = 0;
$condition = ['uid' => $a->profile['uid'], 'self' => true];
$contact = dba::selectFirst('contact', ['last-item'], $condition);
$contact = DBA::selectFirst('contact', ['last-item'], $condition);
if (DBM::is_result($contact)) {
$last_active = strtotime($contact['last-item']);
}
$condition = ['uid' => $a->profile['uid']];
$user = dba::selectFirst('user', ['login_date'], $condition);
$user = DBA::selectFirst('user', ['login_date'], $condition);
if (DBM::is_result($user)) {
if ($last_active < strtotime($user['login_date'])) {
$last_active = strtotime($user['login_date']);

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Item;
use Friendica\Model\Profile;
@ -74,7 +74,7 @@ function notes_content(App $a, $update = false)
while ($rr = Item::fetch($r)) {
$parents_arr[] = $rr['id'];
}
dba::close($r);
DBA::close($r);
$condition = ['uid' => local_user(), 'parent' => $parents_arr];
$result = Item::selectForUser(local_user(), [], $condition);

View file

@ -10,7 +10,7 @@ use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Core\NotificationsManager;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
function notifications_post(App $a)
@ -26,7 +26,7 @@ function notifications_post(App $a)
}
if ($request_id) {
$intro = dba::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
$intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
if (DBM::is_result($intro)) {
$intro_id = $intro['id'];
@ -42,20 +42,20 @@ function notifications_post(App $a)
$fid = $intro['fid'];
if ($_POST['submit'] == L10n::t('Discard')) {
dba::delete('intro', ['id' => $intro_id]);
DBA::delete('intro', ['id' => $intro_id]);
if (!$fid) {
// The check for blocked and pending is in case the friendship was already approved
// and we just want to get rid of the now pointless notification
$condition = ['id' => $contact_id, 'uid' => local_user(),
'self' => false, 'blocked' => true, 'pending' => true];
dba::delete('contact', $condition);
DBA::delete('contact', $condition);
}
goaway('notifications/intros');
}
if ($_POST['submit'] == L10n::t('Ignore')) {
dba::update('intro', ['ignore' => true], ['id' => $intro_id]);
DBA::update('intro', ['ignore' => true], ['id' => $intro_id]);
goaway('notifications/intros');
}
}

View file

@ -13,7 +13,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -1350,7 +1350,7 @@ function photos_content(App $a)
$link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
$a->set_pager_total(dba::count('item', $condition));
$a->set_pager_total(DBA::count('item', $condition));
$params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
$result = Item::selectForUser($link_item['uid'], [], $condition, $params);

View file

@ -12,7 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Group;
use Friendica\Model\Item;
@ -347,7 +347,7 @@ function profile_content(App $a, $update = 0)
if ($is_owner) {
$unseen = dba::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
$unseen = DBA::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
if ($unseen) {
$r = Item::update(['unseen' => false],
['wall' => true, 'unseen' => true, 'uid' => local_user()]);

View file

@ -13,7 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -123,7 +123,7 @@ function profiles_init(App $a) {
$r1[0]['net-publish'] = 0;
$r1[0]['profile-name'] = dbesc($name);
dba::insert('profile', $r1[0]);
DBA::insert('profile', $r1[0]);
$r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
intval(local_user()),

View file

@ -7,7 +7,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
use Friendica\Object\Image;
@ -150,7 +150,7 @@ function proxy_init(App $a) {
$valid = true;
$photo = null;
if (!$direct_cache && ($cachefile == '')) {
$photo = dba::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
$photo = DBA::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
if (DBM::is_result($photo)) {
$img_str = $photo['data'];
$mime = $photo['desc'];
@ -193,7 +193,7 @@ function proxy_init(App $a) {
'filename' => basename($_REQUEST['url']), 'type' => '', 'album' => '', 'height' => imagesy($image), 'width' => imagesx($image),
'datasize' => 0, 'data' => $img_str, 'scale' => 100, 'profile' => 0,
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime];
dba::insert('photo', $fields);
DBA::insert('photo', $fields);
} else {
$Image = new Image($img_str, $mime);
if ($Image->isValid() && !$direct_cache && ($cachefile == '')) {

View file

@ -1,7 +1,7 @@
<?php
use Friendica\App;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Protocol\OStatus;
@ -44,7 +44,7 @@ function pubsub_init(App $a)
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
$owner = dba::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
$owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBM::is_result($owner)) {
logger('Local account not found: ' . $nick);
hub_return(false, '');
@ -56,7 +56,7 @@ function pubsub_init(App $a)
$condition['hub-verify'] = $hub_verify;
}
$contact = dba::selectFirst('contact', ['id', 'poll'], $condition);
$contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
if (!DBM::is_result($contact)) {
logger('Contact ' . $contact_id . ' not found.');
hub_return(false, '');
@ -76,7 +76,7 @@ function pubsub_init(App $a)
}
if (!empty($hub_mode)) {
dba::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
DBA::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
logger($hub_mode . ' success for contact ' . $contact_id . '.');
}
hub_return(true, $hub_challenge);
@ -93,19 +93,19 @@ function pubsub_post(App $a)
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
$importer = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBM::is_result($importer)) {
hub_post_return();
}
$condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
$contact = dba::selectFirst('contact', [], $condition);
$contact = DBA::selectFirst('contact', [], $condition);
if (!DBM::is_result($contact)) {
$author = OStatus::salmonAuthor($xml, $importer);
if (!empty($author['contact-id'])) {
$condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
$contact = dba::selectFirst('contact', [], $condition);
$contact = DBA::selectFirst('contact', [], $condition);
logger('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
}
if (!DBM::is_result($contact)) {

View file

@ -3,7 +3,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\PushSubscriber;
use Friendica\Util\Network;
@ -64,7 +64,7 @@ function pubsubhubbub_init(App $a) {
// fetch user from database given the nickname
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
$owner = dba::selectFirst('user', ['uid', 'hidewall'], $condition);
$owner = DBA::selectFirst('user', ['uid', 'hidewall'], $condition);
if (!DBM::is_result($owner)) {
logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
System::httpExit(404);
@ -79,7 +79,7 @@ function pubsubhubbub_init(App $a) {
// get corresponding row from contact table
$condition = ['uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'self' => true];
$contact = dba::selectFirst('contact', ['poll'], $condition);
$contact = DBA::selectFirst('contact', ['poll'], $condition);
if (!DBM::is_result($contact)) {
logger('Self contact for user ' . $owner['uid'] . ' not found.');
System::httpExit(404);

View file

@ -7,7 +7,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Protocol\Diaspora;
@ -34,7 +34,7 @@ function receive_post(App $a)
}
$guid = $a->argv[2];
$importer = dba::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
$importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
if (!DBM::is_result($importer)) {
System::httpExit(500);
}

View file

@ -3,7 +3,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -24,7 +24,7 @@ function redir_init(App $a) {
if (!empty($cid)) {
$fields = ['id', 'uid', 'nurl', 'url', 'addr', 'name', 'network', 'poll', 'issued-id', 'dfrn-id', 'duplex'];
$contact = dba::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
if (!DBM::is_result($contact)) {
notice(L10n::t('Contact not found.'));
goaway(System::baseUrl());
@ -42,7 +42,7 @@ function redir_init(App $a) {
if ($contact['uid'] == 0 && local_user()) {
// Let's have a look if there is an established connection
// between the puplic contact we have found and the local user.
$contact = dba::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
if (DBM::is_result($contact)) {
$cid = $contact['id'];
@ -96,7 +96,7 @@ function redir_init(App $a) {
$fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
'sec' => $sec, 'expire' => time() + 45];
dba::insert('profile_check', $fields);
DBA::insert('profile_check', $fields);
logger('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);

View file

@ -8,7 +8,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\User;
use Friendica\Module\Login;
@ -89,8 +89,8 @@ function user_deny($hash)
intval($register[0]['uid'])
);
dba::delete('user', ['uid' => $register[0]['uid']]);
dba::delete('register', ['hash' => $register[0]['hash']]);
DBA::delete('user', ['uid' => $register[0]['uid']]);
DBA::delete('register', ['hash' => $register[0]['hash']]);
notice(L10n::t('Registration revoked for %s', $user[0]['username']) . EOL);
return true;

View file

@ -7,7 +7,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\User;
@ -39,7 +39,7 @@ function removeme_post(App $a)
// send email to admins
$admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
foreach ($admin_mails as $mail) {
$admin = dba::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
$admin = DBA::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
if (!DBM::is_result($admin)) {
continue;
}

View file

@ -10,7 +10,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Item;
@ -69,11 +69,11 @@ function search_init(App $a) {
dbesc($search)
);
if (!DBM::is_result($r)) {
dba::insert('search', ['uid' => local_user(), 'term' => $search]);
DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
}
}
if (x($_GET,'remove') && $search) {
dba::delete('search', ['uid' => local_user(), 'term' => $search]);
DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
}
/// @todo Check if there is a case at all that "aside" is prefilled here
@ -210,13 +210,13 @@ function search_content(App $a) {
local_user(), TERM_OBJ_POST, TERM_HASHTAG, $search];
$params = ['order' => ['created' => true],
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
$terms = dba::select('term', ['oid'], $condition, $params);
$terms = DBA::select('term', ['oid'], $condition, $params);
$itemids = [];
while ($term = dba::fetch($terms)) {
while ($term = DBA::fetch($terms)) {
$itemids[] = $term['oid'];
}
dba::close($terms);
DBA::close($terms);
if (!empty($itemids)) {
$params = ['order' => ['id' => true]];

View file

@ -14,7 +14,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -150,7 +150,7 @@ function settings_post(App $a)
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
$key = $_POST['remove'];
dba::delete('tokens', ['id' => $key, 'uid' => local_user()]);
DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
goaway(System::baseUrl(true)."/settings/oauth/");
return;
}
@ -241,12 +241,12 @@ function settings_post(App $a)
intval(local_user())
);
if (!DBM::is_result($r)) {
dba::insert('mailacct', ['uid' => local_user()]);
DBA::insert('mailacct', ['uid' => local_user()]);
}
if (strlen($mail_pass)) {
$pass = '';
openssl_public_encrypt($mail_pass, $pass, $a->user['pubkey']);
dba::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
}
$r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
`action` = %d, `movetofolder` = '%s',
@ -706,7 +706,7 @@ function settings_content(App $a)
if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
dba::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
DBA::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
goaway(System::baseUrl(true)."/settings/oauth/");
return;
}
@ -989,7 +989,7 @@ function settings_content(App $a)
* ACCOUNT SETTINGS
*/
$profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
$profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
if (!DBM::is_result($profile)) {
notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
return;

View file

@ -8,7 +8,7 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Widget;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -46,7 +46,7 @@ function suggest_init(App $a) {
}
// Now check how the user responded to the confirmation query
if (!$_REQUEST['canceled']) {
dba::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]);
DBA::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]);
}
}

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -30,7 +30,7 @@ function unfollow_post(App $a)
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
$uid, CONTACT_IS_FRIEND, normalise_link($url),
normalise_link($url), $url, NETWORK_STATUSNET];
$contact = dba::selectFirst('contact', [], $condition);
$contact = DBA::selectFirst('contact', [], $condition);
if (!DBM::is_result($contact)) {
notice(L10n::t("Contact wasn't found or can't be unfollowed."));
@ -44,7 +44,7 @@ function unfollow_post(App $a)
Contact::terminateFriendship($r[0], $contact);
}
}
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
DBA::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
info(L10n::t('Contact unfollowed').EOL);
goaway(System::baseUrl().'/contacts/'.$contact['id']);
@ -69,7 +69,7 @@ function unfollow_content(App $a)
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
local_user(), CONTACT_IS_FRIEND, normalise_link($url),
normalise_link($url), $url, NETWORK_STATUSNET];
$contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
if (!DBM::is_result($contact)) {
notice(L10n::t("You aren't a friend of this contact.").EOL);

View file

@ -7,7 +7,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Mimetype;
@ -130,7 +130,7 @@ function wall_attach_post(App $a) {
'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,
'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => ''];
$r = dba::insert('attach', $fields);
$r = DBA::insert('attach', $fields);
@unlink($src);

View file

@ -6,7 +6,7 @@
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
function worker_init()
@ -44,7 +44,7 @@ function worker_init()
$fields = ['executed' => DateTimeFormat::utcNow(), 'pid' => getmypid(), 'done' => false];
$condition = ['id' => $r[0]["id"], 'pid' => 0];
if (dba::update('workerqueue', $fields, $condition)) {
if (DBA::update('workerqueue', $fields, $condition)) {
Worker::execute($r[0]);
}
}

View file

@ -6,7 +6,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Database\dba;
use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Protocol\Salmon;
@ -39,7 +39,7 @@ function xrd_init(App $a)
$name = substr($local, 0, strpos($local, '@'));
}
$user = dba::selectFirst('user', [], ['nickname' => $name]);
$user = DBA::selectFirst('user', [], ['nickname' => $name]);
if (!DBM::is_result($user)) {
killme();
}