From 0ec44f3e8a73229c3aadea86f61b5571a701c6b7 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 21 Jul 2018 08:40:21 -0400 Subject: [PATCH] Rename DBM method calls to DBA method calls --- boot.php | 6 +- include/api.php | 87 ++++++++++---------- include/conversation.php | 9 +- include/enotify.php | 17 ++-- include/items.php | 9 +- include/security.php | 19 ++--- include/text.php | 19 ++--- index.php | 3 +- mod/acl.php | 5 +- mod/admin.php | 9 +- mod/allfriends.php | 5 +- mod/api.php | 4 +- mod/attach.php | 5 +- mod/cal.php | 7 +- mod/common.php | 13 ++- mod/community.php | 3 +- mod/contactgroup.php | 6 +- mod/contacts.php | 27 +++--- mod/crepair.php | 7 +- mod/delegate.php | 13 ++- mod/dfrn_confirm.php | 25 +++--- mod/dfrn_notify.php | 11 ++- mod/dfrn_poll.php | 23 +++--- mod/dfrn_request.php | 21 +++-- mod/directory.php | 5 +- mod/dirfind.php | 5 +- mod/display.php | 19 ++--- mod/editpost.php | 6 +- mod/events.php | 10 +-- mod/fetch.php | 6 +- mod/follow.php | 4 +- mod/friendica.php | 6 +- mod/fsuggest.php | 10 +-- mod/group.php | 12 +-- mod/ignored.php | 4 +- mod/install.php | 3 +- mod/item.php | 23 +++--- mod/lockview.php | 12 +-- mod/lostpass.php | 7 +- mod/manage.php | 20 ++--- mod/match.php | 4 +- mod/message.php | 17 ++-- mod/modexp.php | 4 +- mod/msearch.php | 6 +- mod/network.php | 13 ++- mod/nogroup.php | 2 +- mod/noscrape.php | 9 +- mod/notes.php | 5 +- mod/notice.php | 4 +- mod/notifications.php | 3 +- mod/notify.php | 4 +- mod/openid.php | 4 +- mod/photo.php | 8 +- mod/photos.php | 47 ++++++----- mod/ping.php | 24 +++--- mod/poco.php | 10 +-- mod/poke.php | 8 +- mod/profile.php | 11 ++- mod/profile_photo.php | 9 +- mod/profiles.php | 29 ++++--- mod/profperm.php | 12 +-- mod/proxy.php | 5 +- mod/pubsub.php | 11 ++- mod/pubsubhubbub.php | 5 +- mod/receive.php | 3 +- mod/redir.php | 5 +- mod/regmod.php | 9 +- mod/removeme.php | 3 +- mod/salmon.php | 12 +-- mod/search.php | 7 +- mod/settings.php | 35 ++++---- mod/share.php | 4 +- mod/starred.php | 4 +- mod/subthread.php | 10 +-- mod/suggest.php | 3 +- mod/tagger.php | 12 +-- mod/tagrm.php | 6 +- mod/uexport.php | 8 +- mod/unfollow.php | 7 +- mod/videos.php | 14 ++-- mod/viewcontacts.php | 8 +- mod/viewsrc.php | 4 +- mod/wall_attach.php | 7 +- mod/wall_upload.php | 6 +- mod/wallmessage.php | 6 +- mod/xrd.php | 3 +- src/App.php | 5 +- src/Content/ContactSelector.php | 5 +- src/Content/ForumManager.php | 3 +- src/Content/Nav.php | 3 +- src/Content/OEmbed.php | 3 +- src/Content/Widget.php | 5 +- src/Content/Widget/TagCloud.php | 3 +- src/Core/ACL.php | 7 +- src/Core/Addon.php | 3 +- src/Core/Cache/DatabaseCacheDriver.php | 3 +- src/Core/Config/JITConfigAdapter.php | 3 +- src/Core/Config/JITPConfigAdapter.php | 5 +- src/Core/Config/PreloadConfigAdapter.php | 3 +- src/Core/Config/PreloadPConfigAdapter.php | 3 +- src/Core/Console/GlobalCommunitySilence.php | 3 +- src/Core/Console/NewPassword.php | 3 +- src/Core/Lock/DatabaseLockDriver.php | 5 +- src/Core/NotificationsManager.php | 18 ++-- src/Core/Session/DatabaseSessionHandler.php | 3 +- src/Core/Worker.php | 15 ++-- src/Database/DBA.php | 4 +- src/Database/DBStructure.php | 30 +++---- src/Database/PostUpdate.php | 4 +- src/Model/Contact.php | 85 ++++++++++--------- src/Model/Conversation.php | 3 +- src/Model/Event.php | 17 ++-- src/Model/GContact.php | 35 ++++---- src/Model/Group.php | 9 +- src/Model/Item.php | 91 ++++++++++----------- src/Model/Mail.php | 3 +- src/Model/OpenWebAuthToken.php | 3 +- src/Model/PermissionSet.php | 3 +- src/Model/Photo.php | 5 +- src/Model/Profile.php | 23 +++--- src/Model/PushSubscriber.php | 7 +- src/Model/Queue.php | 9 +- src/Model/Term.php | 5 +- src/Model/User.php | 9 +- src/Module/Login.php | 7 +- src/Module/Owa.php | 3 +- src/Network/FKOAuth1.php | 5 +- src/Network/FKOAuthDataStore.php | 7 +- src/Network/Probe.php | 3 +- src/Object/Image.php | 4 +- src/Object/Post.php | 5 +- src/Protocol/DFRN.php | 53 ++++++------ src/Protocol/Diaspora.php | 71 ++++++++-------- src/Protocol/Feed.php | 4 +- src/Protocol/OStatus.php | 31 ++++--- src/Protocol/PortableContact.php | 21 +++-- src/Util/ExAuth.php | 3 +- src/Util/HTTPSignature.php | 3 +- src/Worker/Cron.php | 3 +- src/Worker/CronJobs.php | 9 +- src/Worker/Delivery.php | 23 +++--- src/Worker/Directory.php | 4 +- src/Worker/DiscoverPoCo.php | 5 +- src/Worker/Expire.php | 3 +- src/Worker/GProbe.php | 6 +- src/Worker/Notifier.php | 23 +++--- src/Worker/OnePoll.php | 15 ++-- src/Worker/PubSubPublish.php | 3 +- src/Worker/Queue.php | 9 +- src/Worker/UpdateGContact.php | 4 +- update.php | 3 +- view/theme/frio/theme.php | 12 +-- view/theme/vier/theme.php | 8 +- 153 files changed, 813 insertions(+), 918 deletions(-) diff --git a/boot.php b/boot.php index ade27341e..d18aaf144 100644 --- a/boot.php +++ b/boot.php @@ -29,7 +29,7 @@ use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Model\Contact; use Friendica\Model\Conversation; @@ -803,7 +803,7 @@ function run_update_function($x, $prefix) function check_addons(App $a) { $r = q("SELECT * FROM `addon` WHERE `installed` = 1"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $installed = $r; } else { $installed = []; @@ -1002,7 +1002,7 @@ function feed_birthday($uid, $tz) intval($uid) ); - if (DBM::is_result($p)) { + if (DBA::is_result($p)) { $tmp_dob = substr($p[0]['dob'], 5); if (intval($tmp_dob)) { $y = DateTimeFormat::timezoneNow($tz, 'Y'); diff --git a/include/api.php b/include/api.php index b119177d2..67612c092 100644 --- a/include/api.php +++ b/include/api.php @@ -20,7 +20,6 @@ use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -235,7 +234,7 @@ function api_login(App $a) } } - if (!DBM::is_result($record)) { + if (!DBA::is_result($record)) { logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); header('WWW-Authenticate: Basic realm="Friendica"'); //header('HTTP/1.0 401 Unauthorized'); @@ -501,7 +500,7 @@ function api_unique_id_to_nurl($id) { $r = DBA::selectFirst('contact', ['nurl'], ['id' => $id]); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $r["nurl"]; } else { return false; @@ -631,14 +630,14 @@ function api_get_user(App $a, $contact_id = null) } // if the contact wasn't found, fetch it from the contacts with uid = 0 - if (!DBM::is_result($uinfo)) { + if (!DBA::is_result($uinfo)) { $r = []; if ($url != "") { $r = q("SELECT * FROM `contact` WHERE `uid` = 0 AND `nurl` = '%s' LIMIT 1", dbesc(normalise_link($url))); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $network_name = ContactSelector::networkToName($r[0]['network'], $r[0]['url']); // If no nick where given, extract it from the address @@ -1184,7 +1183,7 @@ function api_statuses_update($type) intval(requestdata('media_ids')), api_user() ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $phototypes = Image::supportedTypes(); $ext = $phototypes[$r[0]['type']]; $_REQUEST['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']'; @@ -1280,7 +1279,7 @@ function api_status_show($type) 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]]; $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]); - if (DBM::is_result($lastwall)) { + if (DBA::is_result($lastwall)) { $in_reply_to = api_in_reply_to($lastwall); $converted = api_convert_item($lastwall); @@ -1365,7 +1364,7 @@ function api_users_show($type) 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'private' => false]; $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]); - if (DBM::is_result($lastwall)) { + if (DBA::is_result($lastwall)) { $in_reply_to = api_in_reply_to($lastwall); $converted = api_convert_item($lastwall); @@ -1440,11 +1439,11 @@ function api_users_search($type) if (x($_GET, 'q')) { $r = q("SELECT id FROM `contact` WHERE `uid` = 0 AND `name` = '%s'", dbesc($_GET["q"])); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q("SELECT `id` FROM `contact` WHERE `uid` = 0 AND `nick` = '%s'", dbesc($_GET["q"])); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $k = 0; foreach ($r as $user) { $user_info = api_get_user($a, $user["id"]); @@ -1824,12 +1823,12 @@ function api_statuses_show($type) // try to fetch the item for the local user - or the public item, if there is no local one $uri_item = Item::selectFirst(['uri'], ['id' => $id]); - if (!DBM::is_result($uri_item)) { + if (!DBA::is_result($uri_item)) { throw new BadRequestException("There is no status with this id."); } $item = Item::selectFirst(['id'], ['uri' => $uri_item['uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { throw new BadRequestException("There is no status with this id."); } @@ -1846,7 +1845,7 @@ function api_statuses_show($type) $statuses = Item::selectForUser(api_user(), [], $condition, $params); /// @TODO How about copying this to above methods which don't check $r ? - if (!DBM::is_result($statuses)) { + if (!DBA::is_result($statuses)) { throw new BadRequestException("There is no status with this id."); } @@ -1904,12 +1903,12 @@ function api_conversation_show($type) // try to fetch the item for the local user - or the public item, if there is no local one $item = Item::selectFirst(['parent-uri'], ['id' => $id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { throw new BadRequestException("There is no status with this id."); } $parent = Item::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { throw new BadRequestException("There is no status with this id."); } @@ -1926,7 +1925,7 @@ function api_conversation_show($type) $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; $statuses = Item::selectForUser(api_user(), [], $condition, $params); - if (!DBM::is_result($statuses)) { + if (!DBA::is_result($statuses)) { throw new BadRequestException("There is no status with id $id."); } @@ -1976,7 +1975,7 @@ function api_statuses_repeat($type) $fields = ['body', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink']; $item = Item::selectFirst($fields, ['id' => $id, 'private' => false]); - if (DBM::is_result($item) && $item['body'] != "") { + if (DBA::is_result($item) && $item['body'] != "") { if (strpos($item['body'], "[/share]") !== false) { $pos = strpos($item['body'], "[share"); $post = substr($item['body'], $pos); @@ -2226,7 +2225,7 @@ function api_favorites_create_destroy($type) $item = Item::selectFirstForUser(api_user(), [], ['id' => $itemid, 'uid' => api_user()]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { throw new BadRequestException("Invalid item."); } @@ -3410,7 +3409,7 @@ function api_ff_ids($type) WHERE `contact`.`uid` = %s AND NOT `contact`.`self`", intval(api_user()) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -3486,7 +3485,7 @@ function api_direct_messages_new($type) dbesc($_POST['screen_name']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // Selecting the id by priority, friendica first api_best_nickname($r); @@ -3590,7 +3589,7 @@ function api_direct_messages_destroy($type) ); // error message if specified id is not in database - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { if ($verbose == "true") { $answer = ['result' => 'error', 'message' => 'message id not in database']; return api_format_data("direct_messages_delete", $type, ['$result' => $answer]); @@ -3695,7 +3694,7 @@ function api_direct_messages_box($type, $box, $verbose) intval($start), intval($count) ); - if ($verbose == "true" && !DBM::is_result($r)) { + if ($verbose == "true" && !DBA::is_result($r)) { $answer = ['result' => 'error', 'message' => 'no mails available']; return api_format_data("direct_messages_all", $type, ['$result' => $answer]); } @@ -3850,7 +3849,7 @@ function api_fr_photoalbum_delete($type) intval(api_user()), dbesc($album) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { throw new BadRequestException("album not available"); } @@ -3860,7 +3859,7 @@ function api_fr_photoalbum_delete($type) $condition = ['uid' => local_user(), 'resource-id' => $rr['resource-id'], 'type' => 'photo']; $photo_item = Item::selectFirstForUser(local_user(), ['id'], $condition); - if (!DBM::is_result($photo_item)) { + if (!DBA::is_result($photo_item)) { throw new InternalServerErrorException("problem with deleting items occured"); } Item::deleteForUser(['id' => $photo_item['id']], api_user()); @@ -3940,7 +3939,7 @@ function api_fr_photos_list($type) 'image/gif' => 'gif' ]; $data = ['photo'=>[]]; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $photo = []; $photo['id'] = $rr['resource-id']; @@ -4012,7 +4011,7 @@ function api_fr_photo_create_update($type) dbesc($photo_id), dbesc($album) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { throw new BadRequestException("photo not available"); } } @@ -4135,7 +4134,7 @@ function api_fr_photo_delete($type) intval(api_user()), dbesc($photo_id) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { throw new BadRequestException("photo not available"); } // now we can perform on the deletion of the photo @@ -4147,7 +4146,7 @@ function api_fr_photo_delete($type) $condition = ['uid' => local_user(), 'resource-id' => $photo_id, 'type' => 'photo']; $photo_item = Item::selectFirstForUser(local_user(), ['id'], $condition); - if (!DBM::is_result($photo_item)) { + if (!DBA::is_result($photo_item)) { throw new InternalServerErrorException("problem with deleting items occured"); } // function for setting the items to "deleted = 1" which ensures that comments, likes etc. are not shown anymore @@ -4214,7 +4213,7 @@ function api_account_update_profile_image($type) if ($profile_id != 0) { $profile = DBA::selectFirst('profile', ['is-default'], ['uid' => api_user(), 'id' => $profile_id]); // error message if specified profile id is not in database - if (!DBM::is_result($profile)) { + if (!DBA::is_result($profile)) { throw new BadRequestException("profile_id not available"); } $is_default_profile = $profile['is-default']; @@ -4346,7 +4345,7 @@ function check_acl_input($acl_string) intval($cid), intval(api_user()) ); - $contact_not_found |= !DBM::is_result($contact); + $contact_not_found |= !DBA::is_result($contact); } return $contact_not_found; } @@ -4608,7 +4607,7 @@ function prepare_photo_data($type, $scale, $photo_id) ]; // prepare output data for photo - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $data = ['photo' => $r[0]]; $data['photo']['id'] = $data['photo']['resource-id']; if ($scale !== false) { @@ -4703,7 +4702,7 @@ function api_friendica_remoteauth() $contact = DBA::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]); - if (!DBM::is_result($contact) || ($contact['network'] !== NETWORK_DFRN)) { + if (!DBA::is_result($contact) || ($contact['network'] !== NETWORK_DFRN)) { throw new BadRequestException("Unknown contact"); } @@ -4854,7 +4853,7 @@ function api_get_nick($profile) dbesc(normalise_link($profile)) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $nick = $r[0]["nick"]; } @@ -4864,7 +4863,7 @@ function api_get_nick($profile) dbesc(normalise_link($profile)) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $nick = $r[0]["nick"]; } } @@ -4939,7 +4938,7 @@ function api_in_reply_to($item) if (($item['thr-parent'] != $item['uri']) && (intval($item['parent']) != intval($item['id']))) { $parent = Item::selectFirst(['id'], ['uid' => $item['uid'], 'uri' => $item['thr-parent']]); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { $in_reply_to['status_id'] = intval($parent['id']); } else { $in_reply_to['status_id'] = intval($item['parent']); @@ -4950,7 +4949,7 @@ function api_in_reply_to($item) $fields = ['author-nick', 'author-name', 'author-id', 'author-link']; $parent = Item::selectFirst($fields, ['id' => $in_reply_to['status_id']]); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { if ($parent['author-nick'] == "") { $parent['author-nick'] = api_get_nick($parent['author-link']); } @@ -5127,7 +5126,7 @@ function api_friendica_group_show($type) intval($gid) ); // error message if specified gid is not in database - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { throw new BadRequestException("gid not available"); } } else { @@ -5197,7 +5196,7 @@ function api_friendica_group_delete($type) intval($gid) ); // error message if specified gid is not in database - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { throw new BadRequestException('gid not available'); } @@ -5209,7 +5208,7 @@ function api_friendica_group_delete($type) dbesc($name) ); // error message if specified gid is not in database - if (!DBM::is_result($rname)) { + if (!DBA::is_result($rname)) { throw new BadRequestException('wrong group name'); } @@ -5294,7 +5293,7 @@ function group_create($name, $uid, $users = []) dbesc($name) ); // error message if specified group name already exists - if (DBM::is_result($rname)) { + if (DBA::is_result($rname)) { throw new BadRequestException('group name already exists'); } @@ -5305,7 +5304,7 @@ function group_create($name, $uid, $users = []) dbesc($name) ); // error message if specified group name already exists - if (DBM::is_result($rname)) { + if (DBA::is_result($rname)) { $reactivate_group = true; } @@ -5636,7 +5635,7 @@ function api_friendica_notification_seen($type) if ($note['otype']=='item') { // would be really better with an ItemsManager and $im->getByID() :-P $item = Item::selectFirstForUser(api_user(), [], ['id' => $note['iid'], 'uid' => api_user()]); - if (DBM::is_result($$item)) { + if (DBA::is_result($$item)) { // we found the item, return it to the user $ret = api_format_items([$item], $user_info, false, $type); $data = ['status' => $ret]; @@ -5735,7 +5734,7 @@ function api_friendica_direct_messages_search($type, $box = "") $profile_url = $user_info["url"]; // message if nothing was found - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $success = ['success' => false, 'search_results' => 'problem with query']; } elseif (count($r) == 0) { $success = ['success' => false, 'search_results' => 'nothing found']; @@ -5793,7 +5792,7 @@ function api_friendica_profile_show($type) ); // error message if specified gid is not in database - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { throw new BadRequestException("profile_id not available"); } } else { diff --git a/include/conversation.php b/include/conversation.php index 5dfd571ea..276b3e1b4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -13,7 +13,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\Profile; @@ -136,7 +135,7 @@ function localize_item(&$item) $fields = ['author-link', 'author-name', 'verb', 'object-type', 'resource-id', 'body', 'plink']; $obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]); - if (!DBM::is_result($obj)) { + if (!DBA::is_result($obj)) { return; } @@ -267,7 +266,7 @@ function localize_item(&$item) $fields = ['author-id', 'author-link', 'author-name', 'author-network', 'verb', 'object-type', 'resource-id', 'body', 'plink']; $obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]); - if (!DBM::is_result($obj)) { + if (!DBA::is_result($obj)) { return; } @@ -322,7 +321,7 @@ function localize_item(&$item) if (strlen($obj->id)) { $fields = ['author-link', 'author-name', 'plink']; $target = Item::selectFirst($fields, ['uri' => $obj->id, 'uid' => $item['uid']]); - if (DBM::is_result($target) && $target['plink']) { + if (DBA::is_result($target) && $target['plink']) { $Bname = $target['author-name']; $Blink = $target['author-link']; $A = '[url=' . Contact::magicLink($Alink) . ']' . $Aname . '[/url]'; @@ -830,7 +829,7 @@ function item_photo_menu($item) { $rel = 0; $condition = ['uid' => local_user(), 'nurl' => normalise_link($item['author-link'])]; $contact = DBA::selectFirst('contact', ['id', 'network', 'rel'], $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $cid = $contact['id']; $network = $contact['network']; $rel = $contact['rel']; diff --git a/include/enotify.php b/include/enotify.php index b0a8c4b66..1990f2ef9 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -9,7 +9,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; use Friendica\Util\DateTimeFormat; use Friendica\Util\Emailer; @@ -54,7 +53,7 @@ function notification($params) ['uid' => $params['uid']]); // There is no need to create notifications for forum accounts - if (!DBM::is_result($user) || in_array($user["page-flags"], [PAGE_COMMUNITY, PAGE_PRVGROUP])) { + if (!DBA::is_result($user) || in_array($user["page-flags"], [PAGE_COMMUNITY, PAGE_PRVGROUP])) { return; } } @@ -108,7 +107,7 @@ function notification($params) if ($params['type'] == NOTIFY_COMMENT) { $thread = DBA::selectFirst('thread', ['ignored'], ['iid' => $parent_id]); - if (DBM::is_result($thread) && $thread["ignored"]) { + if (DBA::is_result($thread) && $thread["ignored"]) { logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG); return; } @@ -156,7 +155,7 @@ function notification($params) } // "your post" - if (DBM::is_result($item) && $item['owner-id'] == $item['author-id'] && $item['wall']) { + if (DBA::is_result($item) && $item['owner-id'] == $item['author-id'] && $item['wall']) { $dest_str = L10n::t('%1$s commented on [url=%2$s]your %3$s[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]', $itemlink, @@ -438,7 +437,7 @@ function notification($params) $hash = random_string(); $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1", dbesc($hash)); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $dups = true; } } while ($dups == true); @@ -690,12 +689,12 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { $fields = ['notify-flags', 'language', 'username', 'email', 'nickname']; $user = DBA::selectFirst('user', $fields, ['uid' => $uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return false; } $owner = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]); - if (!DBM::is_result($owner)) { + if (!DBA::is_result($owner)) { return false; } @@ -746,7 +745,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { 'guid', 'parent-uri', 'uri', 'contact-id', 'network']; $condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]]; $item = Item::selectFirst($fields, $condition); - if (!DBM::is_result($item) || in_array($item['author-id'], $contacts)) { + if (!DBA::is_result($item) || in_array($item['author-id'], $contacts)) { return; } @@ -773,7 +772,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { $tags = q("SELECT `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` = %d AND `uid` = %d", intval(TERM_OBJ_POST), intval($itemid), intval(TERM_MENTION), intval($uid)); - if (DBM::is_result($tags)) { + if (DBA::is_result($tags)) { foreach ($tags AS $tag) { $condition = ['nurl' => normalise_link($tag["url"]), 'uid' => $uid, 'notify_new_posts' => true]; $r = DBA::exists('contact', $condition); diff --git a/include/items.php b/include/items.php index 69472e96f..4a116f4e0 100644 --- a/include/items.php +++ b/include/items.php @@ -10,7 +10,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; use Friendica\Protocol\DFRN; use Friendica\Protocol\Feed; @@ -266,7 +265,7 @@ function consume_feed($xml, $importer, $contact, &$hub, $datedir = 0, $pass = 0) WHERE `contact`.`id` = %d AND `user`.`uid` = %d", dbesc($contact["id"]), dbesc($importer["uid"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { logger("Now import the DFRN feed"); DFRN::import($xml, $r[0], true); return; @@ -290,7 +289,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') { * through the direct Diaspora protocol. If we try and use * the feed, we'll get duplicates. So don't. */ - if ((!DBM::is_result($r)) || $contact['network'] === NETWORK_DIASPORA) { + if ((!DBA::is_result($r)) || $contact['network'] === NETWORK_DIASPORA) { return; } @@ -341,7 +340,7 @@ function drop_item($id) { $fields = ['id', 'uid', 'contact-id', 'deleted']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { notice(L10n::t('Item not found.') . EOL); goaway(System::baseUrl() . '/' . $_SESSION['return_url']); } @@ -462,7 +461,7 @@ function posted_date_widget($url, $uid, $wall) { $ret = list_post_dates($uid, $wall); - if (!DBM::is_result($ret)) { + if (!DBA::is_result($ret)) { return $o; } diff --git a/include/security.php b/include/security.php index 53e554c3d..5112eeca4 100644 --- a/include/security.php +++ b/include/security.php @@ -9,7 +9,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Group; use Friendica\Util\DateTimeFormat; @@ -101,7 +100,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive if ((x($_SESSION, 'submanage')) && intval($_SESSION['submanage'])) { $user = DBA::selectFirst('user', [], ['uid' => $_SESSION['submanage']]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $master_record = $user; } } @@ -115,7 +114,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive // Then add all the children $r = DBA::select('user', ['uid', 'username', 'nickname'], ['parent-uid' => $master_record['uid'], 'account_removed' => false]); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->identities = array_merge($a->identities, DBA::toArray($r)); } } else { @@ -125,14 +124,14 @@ function authenticate_success($user_record, $login_initial = false, $interactive // First entry is our parent $r = DBA::select('user', ['uid', 'username', 'nickname'], ['uid' => $master_record['parent-uid'], 'account_removed' => false]); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->identities = DBA::toArray($r); } // Then add all siblings $r = DBA::select('user', ['uid', 'username', 'nickname'], ['parent-uid' => $master_record['parent-uid'], 'account_removed' => false]); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->identities = array_merge($a->identities, DBA::toArray($r)); } } @@ -143,7 +142,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive WHERE `user`.`account_removed` = 0 AND `manage`.`uid` = ?", $master_record['uid'] ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->identities = array_merge($a->identities, DBA::toArray($r)); } @@ -155,7 +154,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive } $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $a->contact = $contact; $a->cid = $contact['id']; $_SESSION['cid'] = $a->cid; @@ -247,7 +246,7 @@ function can_write_wall($owner) intval(PAGE_COMMUNITY) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $verified = 2; return true; } else { @@ -302,7 +301,7 @@ function permissions_sql($owner_id, $remote_verified = false, $groups = null) intval($remote_user), intval($owner_id) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $remote_verified = true; $groups = Group::getIdsByContactId($remote_user); } @@ -365,7 +364,7 @@ function item_permissions_sql($owner_id, $remote_verified = false, $groups = nul intval($remote_user), intval($owner_id) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $remote_verified = true; $groups = Group::getIdsByContactId($remote_user); } diff --git a/include/text.php b/include/text.php index a7984a614..c554777cf 100644 --- a/include/text.php +++ b/include/text.php @@ -13,11 +13,10 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Event; use Friendica\Model\Item; -use Friendica\Model\Profile; use Friendica\Render\FriendicaSmarty; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; @@ -760,7 +759,7 @@ function contact_block() { dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $total = intval($r[0]['total']); } if (!$total) { @@ -779,7 +778,7 @@ function contact_block() { dbesc(NETWORK_DIASPORA), intval($shown) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contacts = []; foreach ($r AS $contact) { $contacts[] = $contact["id"]; @@ -787,7 +786,7 @@ function contact_block() { $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)", dbesc(implode(",", $contacts))); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contacts = L10n::tt('%d Contact', '%d Contacts', $total); $micropro = []; foreach ($r as $rr) { @@ -1470,7 +1469,7 @@ function generate_user_guid() { $x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1", dbesc($guid) ); - if (!DBM::is_result($x)) { + if (!DBA::is_result($x)) { $found = false; } } while ($found == true); @@ -1759,7 +1758,7 @@ function file_tag_update_pconfig($uid, $file_old, $file_new, $type = 'file') { intval($termtype), intval($uid)); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { unset($deleted_tags[$key]); } else { $filetags_updated = str_replace($lbracket . file_tag_encode($tag) . $rbracket,'',$filetags_updated); @@ -1783,7 +1782,7 @@ function file_tag_save_file($uid, $item_id, $file) } $item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { if (!stristr($item['file'],'[' . file_tag_encode($file) . ']')) { $fields = ['file' => $item['file'] . '[' . file_tag_encode($file) . ']']; Item::update($fields, ['id' => $item_id]); @@ -1812,7 +1811,7 @@ function file_tag_unsave_file($uid, $item_id, $file, $cat = false) } $item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return false; } @@ -1825,7 +1824,7 @@ function file_tag_unsave_file($uid, $item_id, $file, $cat = false) intval($termtype), intval($uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $saved = PConfig::get($uid, 'system', 'filetags'); PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved)); } diff --git a/index.php b/index.php index f3655ff72..86209ada4 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,6 @@ use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Profile; use Friendica\Module\Login; @@ -96,7 +95,7 @@ if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) { // we haven't loaded user data yet, but we need user language $user = DBA::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]); $_SESSION['language'] = $lang; - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $_SESSION['language'] = $user['language']; } } diff --git a/mod/acl.php b/mod/acl.php index c1467d593..e82762386 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -7,7 +7,6 @@ use Friendica\Content\Widget; use Friendica\Core\ACL; use Friendica\Core\Addon; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; @@ -210,7 +209,7 @@ function acl_content(App $a) exit; } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $forums = []; foreach ($r as $g) { $entry = [ @@ -243,7 +242,7 @@ function acl_content(App $a) if ($conv_id) { // In multi threaded posts the conv_id is not the parent of the whole thread $parent_item = Item::selectFirst(['parent'], ['id' => $conv_id]); - if (DBM::is_result($parent_item)) { + if (DBA::is_result($parent_item)) { $conv_id = $parent_item['parent']; } diff --git a/mod/admin.php b/mod/admin.php index 7b8295dba..08003a541 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -15,7 +15,6 @@ use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Database\DBStructure; use Friendica\Model\Contact; use Friendica\Model\Item; @@ -819,7 +818,7 @@ function admin_page_summary(App $a) $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(DBA::databaseName())); $showwarning = false; $warningtext = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $showwarning = true; $warningtext[] = L10n::t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the command php bin/console.php dbstructure toinnodb of your Friendica installation for an automatic conversion.
', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); } @@ -961,7 +960,7 @@ function admin_page_site_post(App $a) $r = q("UPDATE %s SET %s;", $table_name, $upds); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice("Failed updating '$table_name': " . DBA::errorMessage()); goaway('admin/site'); } @@ -1581,7 +1580,7 @@ function admin_page_dbsync(App $a) $failed = []; $r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' "); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $upd = intval(substr($rr['k'], 7)); if ($upd < 1139 || $rr['v'] === 'success') { @@ -1731,7 +1730,7 @@ function admin_page_users(App $a) if ($a->argc > 2) { $uid = $a->argv[3]; $user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { notice('User not found' . EOL); goaway('admin/users'); return ''; // NOTREACHED diff --git a/mod/allfriends.php b/mod/allfriends.php index 585f787cd..7726d0456 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -8,7 +8,6 @@ use Friendica\Content\ContactSelector; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Profile; @@ -37,7 +36,7 @@ function allfriends_content(App $a) $contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return; } @@ -49,7 +48,7 @@ function allfriends_content(App $a) $a->set_pager_total($total); $r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $o .= L10n::t('No friends to display.'); return $o; } diff --git a/mod/api.php b/mod/api.php index e9e913012..a43134248 100644 --- a/mod/api.php +++ b/mod/api.php @@ -5,7 +5,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Module\Login; require_once 'include/api.php'; @@ -22,7 +22,7 @@ function oauth_get_client($request) WHERE `clients`.`client_id`=`tokens`.`client_id` AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'", dbesc($token)); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return null; } diff --git a/mod/attach.php b/mod/attach.php index e76fe8486..6a5f0a39e 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -6,7 +6,6 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; require_once 'include/security.php'; @@ -23,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]); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice(L10n::t('Item was not found.'). EOL); return; } @@ -36,7 +35,7 @@ function attach_init(App $a) dbesc($item_id) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice(L10n::t('Permission denied.') . EOL); return; } diff --git a/mod/cal.php b/mod/cal.php index 3c55a9cc8..f39ed7573 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -14,7 +14,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Event; use Friendica\Model\Group; @@ -38,7 +37,7 @@ function cal_init(App $a) if ($a->argc > 1) { $nick = $a->argv[1]; $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return; } @@ -132,7 +131,7 @@ function cal_content(App $a) intval($contact_id), intval($a->profile['profile_uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $remote_contact = true; } } @@ -230,7 +229,7 @@ function cal_content(App $a) $links = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $r = Event::sortByDate($r); foreach ($r as $rr) { $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j'); diff --git a/mod/common.php b/mod/common.php index 3fb67b20e..c2095eefd 100644 --- a/mod/common.php +++ b/mod/common.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Content\ContactSelector; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Profile; @@ -40,14 +39,14 @@ function common_content(App $a) if ($cmd === 'loc' && $cid) { $contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]); - if (DBM::is_result($contact)) { + if (DBA::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]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [ '$name' => htmlentities($contact['name']), '$photo' => $contact['photo'], @@ -61,17 +60,17 @@ function common_content(App $a) } } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return; } if (!$cid && Profile::getMyURL()) { $contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $cid = $contact['id']; } else { $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]); - if (DBM::is_result($gcontact)) { + if (DBA::is_result($gcontact)) { $zcid = $gcontact['id']; } } @@ -100,7 +99,7 @@ function common_content(App $a) $r = GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']); } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return $o; } diff --git a/mod/community.php b/mod/community.php index 61b523ba4..c082731bd 100644 --- a/mod/community.php +++ b/mod/community.php @@ -10,7 +10,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Database\DBA; -use Friendica\Database\DBM; function community_init(App $a) { @@ -138,7 +137,7 @@ function community_content(App $a, $update = 0) $r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { info(L10n::t('No results.') . EOL); return $o; } diff --git a/mod/contactgroup.php b/mod/contactgroup.php index 388725c00..ac6d5e6b6 100644 --- a/mod/contactgroup.php +++ b/mod/contactgroup.php @@ -1,7 +1,7 @@ argv[2]), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $change = intval($a->argv[2]); } } @@ -27,7 +27,7 @@ function contactgroup_content(App $a) intval($a->argv[1]), intval(local_user()) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { killme(); } diff --git a/mod/contacts.php b/mod/contacts.php index 8832862b8..a71411f9e 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -13,7 +13,6 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Group; @@ -45,7 +44,7 @@ function contacts_init(App $a) $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]); } - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { if ($contact['self']) { if (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts")) { goaway('profile/' . $contact['nick']); @@ -225,14 +224,14 @@ function contacts_post(App $a) intval($contact_id), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { info(L10n::t('Contact updated.') . EOL); } else { notice(L10n::t('Failed to update contact record.') . EOL); } $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $a->data['contact'] = $contact; } @@ -244,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()]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return; } @@ -265,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()]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return; } @@ -336,7 +335,7 @@ function _contact_block($contact_id, $orig_record) intval($contact_id), intval(local_user()) ); - return DBM::is_result($r); + return DBA::is_result($r); } function _contact_ignore($contact_id, $orig_record) @@ -347,7 +346,7 @@ function _contact_ignore($contact_id, $orig_record) intval($contact_id), intval(local_user()) ); - return DBM::is_result($r); + return DBA::is_result($r); } function _contact_archive($contact_id, $orig_record) @@ -358,7 +357,7 @@ function _contact_archive($contact_id, $orig_record) intval($contact_id), intval(local_user()) ); - return DBM::is_result($r); + return DBA::is_result($r); } function _contact_drop($orig_record) @@ -369,7 +368,7 @@ function _contact_drop($orig_record) WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1", intval($a->user['uid']) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -397,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]); - if (!DBM::is_result($orig_record)) { + if (!DBA::is_result($orig_record)) { notice(L10n::t('Could not access contact record.') . EOL); goaway('contacts'); return; // NOTREACHED @@ -788,7 +787,7 @@ function contacts_content(App $a) WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", intval($_SESSION['uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->set_pager_total($r[0]['total']); $total = $r[0]['total']; } @@ -802,7 +801,7 @@ function contacts_content(App $a) intval($a->pager['start']), intval($a->pager['itemspage']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $contacts[] = _contact_detail_for_template($rr); } @@ -911,7 +910,7 @@ function contact_posts($a, $contact_id) $o = contacts_tab($a, $contact_id, 1); $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $a->page['aside'] = ""; Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"])); $o .= Contact::getPostsFromUrl($contact["url"]); diff --git a/mod/crepair.php b/mod/crepair.php index 12ec9672f..d47136d7d 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -28,7 +27,7 @@ function crepair_init(App $a) $a->page['aside'] = ''; } - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $a->data['contact'] = $contact; Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"])); } @@ -47,7 +46,7 @@ function crepair_post(App $a) $contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]); } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return; } @@ -108,7 +107,7 @@ function crepair_content(App $a) $contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]); } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { notice(L10n::t('Contact not found.') . EOL); return; } diff --git a/mod/delegate.php b/mod/delegate.php index 7a98be755..5604e9133 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; require_once 'mod/settings.php'; @@ -35,7 +34,7 @@ function delegate_post(App $a) if ($parent_uid != 0) { $user = DBA::selectFirst('user', ['nickname'], ['uid' => $parent_uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { notice(L10n::t('Parent user not found.') . EOL); return; } @@ -66,7 +65,7 @@ function delegate_content(App $a) $user_id = $a->argv[2]; $user = DBA::selectFirst('user', ['nickname'], ['uid' => $user_id]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $condition = [ 'uid' => local_user(), 'nurl' => normalise_link(System::baseUrl() . '/profile/' . $user['nickname']) @@ -93,7 +92,7 @@ function delegate_content(App $a) $r = q("SELECT * FROM `user` WHERE `uid` IN (SELECT `uid` FROM `manage` WHERE `mid` = %d)", intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $delegates = $r; } @@ -115,7 +114,7 @@ function delegate_content(App $a) intval(local_user()), dbesc(NETWORK_DFRN) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $nicknames = []; foreach ($r as $rr) { $nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'"; @@ -125,7 +124,7 @@ function delegate_content(App $a) // get user records for all potential page delegates who are not already delegates or managers $r = q("SELECT `uid`, `username`, `nickname` FROM `user` WHERE `nickname` IN ($nicks)"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { if (!in_array($rr['uid'], $uids)) { $potentials[] = $rr; @@ -140,7 +139,7 @@ function delegate_content(App $a) $parent_user = null; - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { if (!DBA::exists('user', ['parent-uid' => local_user()])) { $parent_uid = $user['parent-uid']; $parents = [0 => L10n::t('No parent user')]; diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 317eb9e2e..75bbb2318 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -22,7 +22,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\User; @@ -68,7 +67,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) } $user = DBA::selectFirst('user', [], ['uid' => $uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { notice(L10n::t('Profile not found.') . EOL); return; } @@ -122,7 +121,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) intval($cid), intval($uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger('Contact not found in DB.'); notice(L10n::t('Contact not found.') . EOL); notice(L10n::t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL); @@ -281,7 +280,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) if (($status == 0) && $intro_id) { $intro = DBA::selectFirst('intro', ['note'], ['id' => $intro_id]); - if (DBM::is_result($intro)) { + if (DBA::is_result($intro)) { DBA::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]); } @@ -386,14 +385,14 @@ function dfrn_confirm_post(App $a, $handsfree = null) ); } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice(L10n::t('Unable to set contact photo.') . EOL); } // reload contact info $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)) { + if (DBA::is_result($contact) && ($contact['network'] === NETWORK_DIASPORA)) { $ret = Diaspora::sendShare($user, $contact); logger('share returns: ' . $ret); } @@ -444,7 +443,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) // Find our user's account $user = DBA::selectFirst('user', [], ['nickname' => $node]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { $message = L10n::t('No user record found for \'%s\' ', $node); System::xmlExit(3, $message); // failure // NOTREACHED @@ -472,7 +471,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) } $contact = DBA::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { if (strstr($decrypted_source_url, 'http:')) { $newurl = str_replace('http:', 'https:', $decrypted_source_url); } else { @@ -480,7 +479,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) } $contact = DBA::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]); - if (!DBM::is_result($contact)) { + if (!DBA::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.'); System::xmlExit(3, $message); @@ -522,7 +521,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) dbesc($dfrn_pubkey), intval($dfrn_record) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $message = L10n::t('Unable to set your contact credentials on our system.'); System::xmlExit(3, $message); } @@ -538,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]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $photo = $contact['photo']; } else { $photo = System::baseUrl() . '/images/person-175.jpg'; @@ -577,7 +576,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) dbesc(NETWORK_DFRN), intval($dfrn_record) ); - if (!DBM::is_result($r)) { // indicates schema is messed up or total db failure + if (!DBA::is_result($r)) { // indicates schema is messed up or total db failure $message = L10n::t('Unable to update your contact profile details on our system'); System::xmlExit(3, $message); } @@ -595,7 +594,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) LIMIT 1", intval($dfrn_record) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $combined = $r[0]; if ($combined['notify-flags'] & NOTIFY_CONFIRM) { diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 08c43d0fb..7a128f0d2 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -10,7 +10,6 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Protocol\DFRN; use Friendica\Protocol\Diaspora; @@ -28,7 +27,7 @@ function dfrn_notify_post(App $a) { $nick = defaults($a->argv, 1, ''); $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { System::httpExit(500); } dfrn_dispatch_private($user, $postdata); @@ -108,7 +107,7 @@ function dfrn_notify_post(App $a) { dbesc($a->argv[1]) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger('contact not found for dfrn_id ' . $dfrn_id); System::xmlExit(3, 'Contact not found'); //NOTREACHED @@ -221,7 +220,7 @@ function dfrn_dispatch_public($postdata) $importer['importer_uid'] = 0; // This should never fail - if (!DBM::is_result($importer)) { + if (!DBA::is_result($importer)) { logger('Contact not found for address ' . $msg['author']); System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found'); } @@ -258,7 +257,7 @@ function dfrn_dispatch_private($user, $postdata) $cid); // This should never fail - if (!DBM::is_result($importer)) { + if (!DBA::is_result($importer)) { logger('Contact not found for address ' . $msg['author']); System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found'); } @@ -335,7 +334,7 @@ function dfrn_notify_content(App $a) { dbesc($a->argv[1]) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger('No user data found for ' . $a->argv[1] . ' - SQL: ' . $sql_extra); killme(); } diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index fa9ad13f5..85829926e 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -9,7 +9,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Module\Login; use Friendica\Protocol\DFRN; use Friendica\Protocol\OStatus; @@ -101,7 +100,7 @@ function dfrn_poll_init(App $a) dbesc($a->argv[1]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check'); logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA); @@ -147,7 +146,7 @@ function dfrn_poll_init(App $a) $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1", dbesc($sec) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { System::xmlExit(3, 'No ticket'); // NOTREACHED } @@ -160,7 +159,7 @@ function dfrn_poll_init(App $a) $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($r[0]['cid']) ); - if (!DBM::is_result($c)) { + if (!DBA::is_result($c)) { System::xmlExit(3, 'No profile'); } @@ -211,7 +210,7 @@ function dfrn_poll_init(App $a) 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)) { + if (DBA::is_result($r)) { System::xmlExit(1); return; // NOTREACHED } @@ -239,7 +238,7 @@ function dfrn_poll_post(App $a) $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1", dbesc($sec) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { System::xmlExit(3, 'No ticket'); // NOTREACHED } @@ -252,7 +251,7 @@ function dfrn_poll_post(App $a) $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($r[0]['cid']) ); - if (!DBM::is_result($c)) { + if (!DBA::is_result($c)) { System::xmlExit(3, 'No profile'); } @@ -301,7 +300,7 @@ function dfrn_poll_post(App $a) dbesc($challenge) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { killme(); } @@ -330,7 +329,7 @@ function dfrn_poll_post(App $a) } $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { killme(); } @@ -346,7 +345,7 @@ function dfrn_poll_post(App $a) $reputation = 0; $text = ''; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $reputation = $r[0]['rating']; $text = $r[0]['reason']; @@ -458,7 +457,7 @@ function dfrn_poll_content(App $a) AND `user`.`nickname` = '%s' $sql_extra LIMIT 1", dbesc($nickname) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $challenge = ''; $encrypted_id = ''; $id_str = $my_id . '.' . mt_rand(1000, 9999); @@ -499,7 +498,7 @@ function dfrn_poll_content(App $a) ]); } - $profile = ((DBM::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); + $profile = ((DBA::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); switch ($destination_url) { case 'profile': diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index fd0498a5f..cce0ecdbb 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -17,7 +17,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Profile; @@ -88,7 +87,7 @@ function dfrn_request_post(App $a) dbesc(normalise_link($dfrn_url)) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { if (strlen($r[0]['dfrn-id'])) { // We don't need to be here. It has already happened. notice(L10n::t("This introduction has already been accepted.") . EOL); @@ -130,7 +129,7 @@ function dfrn_request_post(App $a) $photo = $parms["photo"]; // Escape the entire array - DBM::esc_array($parms); + DBA::esc_array($parms); // Create a contact record on our site for the other person $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `addr`, `name`, `nick`, `photo`, `site-pubkey`, @@ -167,7 +166,7 @@ function dfrn_request_post(App $a) dbesc($dfrn_url), $parms['key'] // this was already escaped ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { Group::addMember(User::getDefaultGroup(local_user(), $r[0]["network"]), $r[0]['id']); if (isset($photo)) { @@ -243,7 +242,7 @@ function dfrn_request_post(App $a) dbesc(DateTimeFormat::utc('now - 24 hours')), intval($uid) ); - if (DBM::is_result($r) && count($r) > $maxreq) { + if (DBA::is_result($r) && count($r) > $maxreq) { notice(L10n::t('%s has received too many connection requests today.', $a->profile['name']) . EOL); notice(L10n::t('Spam protection measures have been invoked.') . EOL); notice(L10n::t('Friends are advised to please try again in 24 hours.') . EOL); @@ -259,7 +258,7 @@ function dfrn_request_post(App $a) WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE " ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { if (!$rr['rel']) { DBA::delete('contact', ['id' => $rr['cid'], 'self' => false]); @@ -306,7 +305,7 @@ function dfrn_request_post(App $a) dbesc($url) ); - if (DBM::is_result($ret)) { + if (DBA::is_result($ret)) { if (strlen($ret[0]['issued-id'])) { notice(L10n::t('You have already introduced yourself here.') . EOL); return; @@ -372,7 +371,7 @@ function dfrn_request_post(App $a) $parms['issued-id'] = $issued_id; $photo = $parms["photo"]; - DBM::esc_array($parms); + DBA::esc_array($parms); $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`, `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `blocked`, `pending` ) VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )", @@ -404,7 +403,7 @@ function dfrn_request_post(App $a) $parms['url'], $parms['issued-id'] ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact_record = $r[0]; Contact::updateAvatar($photo, $uid, $contact_record["id"], true); } @@ -538,7 +537,7 @@ function dfrn_request_content(App $a) dbesc($_GET['confirm_key']) ); - if (DBM::is_result($intro)) { + if (DBA::is_result($intro)) { $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` WHERE `contact`.`id` = %d LIMIT 1", intval($intro[0]['contact-id']) @@ -546,7 +545,7 @@ function dfrn_request_content(App $a) $auto_confirm = false; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { if ($r[0]['page-flags'] != PAGE_NORMAL && $r[0]['page-flags'] != PAGE_PRVGROUP) { $auto_confirm = true; } diff --git a/mod/directory.php b/mod/directory.php index 08354e3a9..09bcdbeb3 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -10,7 +10,6 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -86,7 +85,7 @@ function directory_content(App $a) $cnt = DBA::fetchFirst("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)) { + if (DBA::is_result($cnt)) { $a->set_pager_total($cnt['total']); } @@ -101,7 +100,7 @@ function directory_content(App $a) WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `contact`.`self` $sql_extra $order LIMIT $limit" ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { if (in_array('small', $a->argv)) { $photo = 'thumb'; } else { diff --git a/mod/dirfind.php b/mod/dirfind.php index 04fb104de..845124a55 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -11,7 +11,6 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Network\Probe; @@ -113,7 +112,7 @@ function dirfind_content(App $a, $prefix = "") { $search2 = "%".$search."%"; - /// @TODO These 2 SELECTs are not checked on validity with DBM::is_result() + /// @TODO These 2 SELECTs are not checked on validity with DBA::is_result() $count = q("SELECT count(*) AS `total` FROM `gcontact` WHERE NOT `hide` AND `network` IN ('%s', '%s', '%s') AND ((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND @@ -204,7 +203,7 @@ function dirfind_content(App $a, $prefix = "") { $connlnk = ""; $conntxt = ""; $contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $photo_menu = Contact::photoMenu($contact); $details = _contact_detail_for_template($contact); $alt_text = $details['alt_text']; diff --git a/mod/display.php b/mod/display.php index 98478024f..3216a28f3 100644 --- a/mod/display.php +++ b/mod/display.php @@ -12,7 +12,6 @@ use Friendica\Core\L10n; use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -53,20 +52,20 @@ function display_init(App $a) // Does the local user have this item? if (local_user()) { $item = Item::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'uid' => local_user()]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $nick = $a->user["nickname"]; } } // Is it an item with uid=0? - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { $item = Item::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'private' => [0, 2], 'uid' => 0]); } } elseif (($a->argc == 3) && ($nick == 'feed-item')) { $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $a->argv[2], 'private' => [0, 2], 'uid' => 0]); } - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { $a->error = 404; notice(L10n::t('Item not found.') . EOL); return; @@ -92,7 +91,7 @@ function display_init(App $a) WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1", $nickname ); - if (DBM::is_result($profile)) { + if (DBA::is_result($profile)) { $profiledata = $profile; } $profiledata["network"] = NETWORK_DFRN; @@ -222,7 +221,7 @@ function display_content(App $a, $update = false, $update_uid = 0) if (local_user()) { $condition = ['guid' => $a->argv[1], 'uid' => local_user()]; $item = Item::selectFirstForUser(local_user(), $fields, $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $item_id = $item["id"]; $item_parent = $item["parent"]; $item_parent_uri = $item['parent-uri']; @@ -232,7 +231,7 @@ function display_content(App $a, $update = false, $update_uid = 0) if ($item_parent == 0) { $condition = ['private' => [0, 2], 'guid' => $a->argv[1], 'uid' => 0]; $item = Item::selectFirstForUser(local_user(), $fields, $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $item_id = $item["id"]; $item_parent = $item["parent"]; $item_parent_uri = $item['parent-uri']; @@ -281,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']]); - if (DBM::is_result($remote_contact)) { + if (DBA::is_result($remote_contact)) { $contact = $remote_contact; $is_remote_contact = true; } @@ -295,7 +294,7 @@ function display_content(App $a, $update = false, $update_uid = 0) } $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]); - if (DBM::is_result($page_contact)) { + if (DBA::is_result($page_contact)) { $a->page_contact = $page_contact; } $is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false); @@ -339,7 +338,7 @@ function display_content(App $a, $update = false, $update_uid = 0) $params = ['order' => ['uid', 'parent' => true, 'gravity', 'id']]; $items_obj = Item::selectForUser(local_user(), [], $condition, $params); - if (!DBM::is_result($items_obj)) { + if (!DBA::is_result($items_obj)) { notice(L10n::t('Item not found.') . EOL); return $o; } diff --git a/mod/editpost.php b/mod/editpost.php index 7994e9e23..eff588f96 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -9,7 +9,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Model\Item; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function editpost_content(App $a) { @@ -30,7 +30,7 @@ function editpost_content(App $a) { $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'type', 'body', 'title', 'file']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { notice(L10n::t('Item not found') . EOL); return; } @@ -78,7 +78,7 @@ function editpost_content(App $a) { $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $mail_enabled = true; if (intval($r[0]['pubmail'])) { $pubmail_enabled = true; diff --git a/mod/events.php b/mod/events.php index 7914b93d0..c1179afdf 100644 --- a/mod/events.php +++ b/mod/events.php @@ -11,7 +11,7 @@ use Friendica\Core\ACL; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Event; use Friendica\Model\Item; use Friendica\Model\Profile; @@ -346,7 +346,7 @@ function events_content(App $a) { $links = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $r = Event::sortByDate($r); foreach ($r as $rr) { $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j'); @@ -359,7 +359,7 @@ function events_content(App $a) { $events = []; // transform the event in a usable array - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $r = Event::sortByDate($r); $events = Event::prepareListForTemplate($r); } @@ -417,7 +417,7 @@ function events_content(App $a) { intval($event_id), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $orig_event = $r[0]; } } @@ -545,7 +545,7 @@ function events_content(App $a) { $ev = Event::getListById(local_user(), $event_id); // Delete only real events (no birthdays) - if (DBM::is_result($ev) && $ev[0]['type'] == 'event') { + if (DBA::is_result($ev) && $ev[0]['type'] == 'event') { $del = Item::deleteForUser(['id' => $ev[0]['itemid']], local_user()); } diff --git a/mod/fetch.php b/mod/fetch.php index 5f1b24a79..c5781d237 100644 --- a/mod/fetch.php +++ b/mod/fetch.php @@ -10,7 +10,7 @@ use Friendica\Protocol\Diaspora; use Friendica\Model\Item; use Friendica\Model\User; use Friendica\Util\XML; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function fetch_init(App $a) { @@ -27,10 +27,10 @@ function fetch_init(App $a) 'event-id', 'resource-id', 'author-link', 'owner-link', 'attach']; $condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]]; $item = Item::selectFirst($fields, $condition); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { $condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]]; $item = Item::selectFirst(['author-link'], $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $parts = parse_url($item["author-link"]); $host = $parts["scheme"]."://".$parts["host"]; diff --git a/mod/follow.php b/mod/follow.php index fbd0be590..3a391ea33 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -9,7 +9,7 @@ use Friendica\Core\System; use Friendica\Model\Contact; use Friendica\Model\Profile; use Friendica\Network\Probe; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function follow_post(App $a) { @@ -104,7 +104,7 @@ function follow_content(App $a) $ret['url'] = $ret['addr']; } - if (($ret['network'] === NETWORK_DFRN) && !DBM::is_result($r)) { + if (($ret['network'] === NETWORK_DFRN) && !DBA::is_result($r)) { $request = $ret['request']; $tpl = get_markup_template('dfrn_request.tpl'); } else { diff --git a/mod/friendica.php b/mod/friendica.php index f1b0fb476..0a5ce86f7 100644 --- a/mod/friendica.php +++ b/mod/friendica.php @@ -8,7 +8,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function friendica_init(App $a) { @@ -34,7 +34,7 @@ function friendica_init(App $a) $visible_addons = []; if (is_array($a->addons) && count($a->addons)) { $r = q("SELECT * FROM `addon` WHERE `hidden` = 0"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $visible_addons[] = $rr['name']; } @@ -93,7 +93,7 @@ function friendica_content(App $a) $visible_addons = []; if (is_array($a->addons) && count($a->addons)) { $r = q("SELECT * FROM `addon` WHERE `hidden` = 0"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $visible_addons[] = $rr['name']; } diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 4f432d840..cf17af9dc 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -7,7 +7,7 @@ use Friendica\App; use Friendica\Core\ACL; use Friendica\Core\L10n; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; function fsuggest_post(App $a) @@ -26,7 +26,7 @@ function fsuggest_post(App $a) intval($contact_id), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Contact not found.') . EOL); return; } @@ -43,7 +43,7 @@ function fsuggest_post(App $a) intval($new_contact), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", intval(local_user()), @@ -59,7 +59,7 @@ function fsuggest_post(App $a) dbesc($hash), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $fsuggest_id = $r[0]['id']; q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d", dbesc($note), @@ -92,7 +92,7 @@ function fsuggest_content(App $a) intval($contact_id), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Contact not found.') . EOL); return; } diff --git a/mod/group.php b/mod/group.php index 05a358ba7..ff27da25e 100644 --- a/mod/group.php +++ b/mod/group.php @@ -10,7 +10,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Group; @@ -52,7 +52,7 @@ function group_post(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Group not found.') . EOL); goaway(System::baseUrl() . '/contacts'); return; // NOTREACHED @@ -147,7 +147,7 @@ function group_content(App $a) { $result = null; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $result = Group::removeByName(local_user(), $r[0]['name']); } @@ -168,7 +168,7 @@ function group_content(App $a) { intval($a->argv[2]), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $change = intval($a->argv[2]); } } @@ -181,7 +181,7 @@ function group_content(App $a) { intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Group not found.') . EOL); goaway(System::baseUrl() . '/contacts'); } @@ -276,7 +276,7 @@ function group_content(App $a) { $context['$desc'] = L10n::t('Click on a contact to add or remove.'); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // Format the data of the contacts who aren't in the contact group foreach ($r as $member) { if (! in_array($member['id'], $preselected)) { diff --git a/mod/ignored.php b/mod/ignored.php index 9931a556a..ffd8a3c1c 100644 --- a/mod/ignored.php +++ b/mod/ignored.php @@ -2,7 +2,7 @@ use Friendica\App; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function ignored_init(App $a) { @@ -22,7 +22,7 @@ function ignored_init(App $a) { intval(local_user()), intval($message_id) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { killme(); } diff --git a/mod/install.php b/mod/install.php index d55ee6ea8..67326a604 100644 --- a/mod/install.php +++ b/mod/install.php @@ -8,7 +8,6 @@ use Friendica\Core\Install; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\Temporal; $install_wizard_pass = 1; @@ -114,7 +113,7 @@ function install_content(App $a) { if (DBA::$connected) { $r = q("SELECT COUNT(*) as `total` FROM `user`"); - if (DBM::is_result($r) && $r[0]['total']) { + if (DBA::is_result($r) && $r[0]['total']) { $tpl = get_markup_template('install.tpl'); return replace_macros($tpl, [ '$title' => $install_title, diff --git a/mod/item.php b/mod/item.php index 72e9f5252..c11bb5230 100644 --- a/mod/item.php +++ b/mod/item.php @@ -24,7 +24,6 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Protocol\Diaspora; @@ -102,7 +101,7 @@ function item_post(App $a) { } // if this isn't the real parent of the conversation, find it - if (DBM::is_result($parent_item)) { + if (DBA::is_result($parent_item)) { // The URI and the contact is taken from the direct parent which needn't to be the top parent $thr_parent_uri = $parent_item['uri']; @@ -113,7 +112,7 @@ function item_post(App $a) { } } - if (!DBM::is_result($parent_item)) { + if (!DBA::is_result($parent_item)) { notice(L10n::t('Unable to locate original post.') . EOL); if (x($_REQUEST, 'return')) { goaway($return_path); @@ -176,7 +175,7 @@ function item_post(App $a) { $user = DBA::selectFirst('user', [], ['uid' => $profile_uid]); - if (!DBM::is_result($user) && !$parent) { + if (!DBA::is_result($user) && !$parent) { return; } @@ -320,7 +319,7 @@ function item_post(App $a) { } } - if (DBM::is_result($author)) { + if (DBA::is_result($author)) { $contact_id = $author['id']; } @@ -537,7 +536,7 @@ function item_post(App $a) { foreach ($match[2] as $mtch) { $fields = ['id', 'filename', 'filesize', 'filetype']; $attachment = DBA::selectFirst('attach', $fields, ['id' => $mtch]); - if (DBM::is_result($attachment)) { + if (DBA::is_result($attachment)) { if (strlen($attachments)) { $attachments .= ','; } @@ -637,7 +636,7 @@ function item_post(App $a) { $datarray['protocol'] = PROTOCOL_DFRN; $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]); - if (DBM::is_result($conversation)) { + if (DBA::is_result($conversation)) { if ($conversation['conversation-uri'] != '') { $datarray['conversation-uri'] = $conversation['conversation-uri']; } @@ -733,7 +732,7 @@ function item_post(App $a) { $datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]); - if (!DBM::is_result($datarray)) { + if (!DBA::is_result($datarray)) { logger("Item with id ".$post_id." couldn't be fetched."); goaway($return_path); } @@ -964,26 +963,26 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone by nick or attag in the current network - if (!DBM::is_result($contact) && ($network != "")) { + if (!DBA::is_result($contact) && ($network != "")) { $condition = ["(`nick` = ? OR `attag` = ?) AND `network` = ? AND `uid` = ?", $name, $name, $network, $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } //select someone by name in the current network - if (!DBM::is_result($contact) && ($network != "")) { + if (!DBA::is_result($contact) && ($network != "")) { $condition = ['name' => $name, 'network' => $network, 'uid' => $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } // select someone by nick or attag in any network - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $condition = ["(`nick` = ? OR `attag` = ?) AND `uid` = ?", $name, $name, $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } // select someone by name in any network - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $condition = ['name' => $name, 'uid' => $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } diff --git a/mod/lockview.php b/mod/lockview.php index 5134bfdb6..e3d2ac609 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -5,7 +5,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function lockview_content(App $a) { @@ -27,7 +27,7 @@ function lockview_content(App $a) { dbesc($type), intval($item_id) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { killme(); } $item = $r[0]; @@ -59,7 +59,7 @@ function lockview_content(App $a) { $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", dbesc(implode(', ', $allowed_groups)) ); - if (DBM::is_result($r)) + if (DBA::is_result($r)) foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } @@ -67,7 +67,7 @@ function lockview_content(App $a) { $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", dbesc(implode(', ',$allowed_users)) ); - if (DBM::is_result($r)) + if (DBA::is_result($r)) foreach($r as $rr) $l[] = $rr['name']; @@ -77,7 +77,7 @@ function lockview_content(App $a) { $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", dbesc(implode(', ', $deny_groups)) ); - if (DBM::is_result($r)) + if (DBA::is_result($r)) foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } @@ -85,7 +85,7 @@ function lockview_content(App $a) { $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", dbesc(implode(', ',$deny_users)) ); - if (DBM::is_result($r)) + if (DBA::is_result($r)) foreach($r as $rr) $l[] = '' . $rr['name'] . ''; diff --git a/mod/lostpass.php b/mod/lostpass.php index 59071b104..e4204c4f8 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -8,7 +8,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; use Friendica\Util\DateTimeFormat; @@ -25,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); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { notice(L10n::t('No valid account found.') . EOL); goaway(System::baseUrl()); } @@ -87,7 +86,7 @@ function lostpass_content(App $a) $pwdreset_token = $a->argv[1]; $user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.")); return lostpass_form(); @@ -132,7 +131,7 @@ function lostpass_generate_password($user) $new_password = User::generateNewPassword(); $result = User::updatePassword($user['uid'], $new_password); - if (DBM::is_result($result)) { + if (DBA::is_result($result)) { $tpl = get_markup_template('pwdreset.tpl'); $o .= replace_macros($tpl, [ '$lbl1' => L10n::t('Password Reset'), diff --git a/mod/manage.php b/mod/manage.php index 0f60e704e..f0b8381b4 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; require_once "include/text.php"; @@ -23,7 +23,7 @@ function manage_post(App $a) { $r = q("select * from user where uid = %d limit 1", intval($_SESSION['submanage']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $uid = intval($r[0]['uid']); $orig_record = $r[0]; } @@ -43,7 +43,7 @@ function manage_post(App $a) { $limited_id = 0; $original_id = $uid; - if (DBM::is_result($submanage)) { + if (DBA::is_result($submanage)) { foreach ($submanage as $m) { if ($identity == $m['mid']) { $limited_id = $m['mid']; @@ -64,7 +64,7 @@ function manage_post(App $a) { ); // Check if the target user is one of our siblings - if (!DBM::is_result($r) && ($orig_record['parent-uid'] != 0)) { + if (!DBA::is_result($r) && ($orig_record['parent-uid'] != 0)) { $r = q("SELECT * FROM `user` WHERE `uid` = %d AND `parent-uid` = %d LIMIT 1", intval($identity), dbesc($orig_record['parent-uid']) @@ -72,21 +72,21 @@ function manage_post(App $a) { } // Check if it's our parent - if (!DBM::is_result($r) && ($orig_record['parent-uid'] != 0) && ($orig_record['parent-uid'] == $identity)) { + if (!DBA::is_result($r) && ($orig_record['parent-uid'] != 0) && ($orig_record['parent-uid'] == $identity)) { $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($identity) ); } // Finally check if it's out own user - if (!DBM::is_result($r) && ($orig_record['uid'] != 0) && ($orig_record['uid'] == $identity)) { + if (!DBA::is_result($r) && ($orig_record['uid'] != 0) && ($orig_record['uid'] == $identity)) { $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($identity) ); } } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -155,21 +155,21 @@ function manage_content(App $a) { $r = q("SELECT DISTINCT(`parent`) FROM `notify` WHERE `uid` = %d AND NOT `seen` AND NOT (`type` IN (%d, %d))", intval($id['uid']), intval(NOTIFY_INTRO), intval(NOTIFY_MAIL)); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $notifications = sizeof($r); } $r = q("SELECT DISTINCT(`convid`) FROM `mail` WHERE `uid` = %d AND NOT `seen`", intval($id['uid'])); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $notifications = $notifications + sizeof($r); } $r = q("SELECT COUNT(*) AS `introductions` FROM `intro` WHERE NOT `blocked` AND NOT `ignore` AND `uid` = %d", intval($id['uid'])); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $notifications = $notifications + $r[0]["introductions"]; } diff --git a/mod/match.php b/mod/match.php index b06007483..f01768c70 100644 --- a/mod/match.php +++ b/mod/match.php @@ -7,7 +7,7 @@ use Friendica\Content\Widget; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Profile; use Friendica\Util\Network; @@ -41,7 +41,7 @@ function match_content(App $a) "SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { return; } if (! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) { diff --git a/mod/message.php b/mod/message.php index 5cdf0f233..e2e138358 100644 --- a/mod/message.php +++ b/mod/message.php @@ -11,7 +11,6 @@ use Friendica\Core\ACL; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Mail; use Friendica\Util\DateTimeFormat; @@ -176,7 +175,7 @@ function message_content(App $a) intval($a->argv[2]), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $parent = $r[0]['parent-uri']; $convid = $r[0]['convid']; @@ -215,21 +214,21 @@ function message_content(App $a) intval(local_user()), intval($a->argv[2]) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1", intval(local_user()), dbesc(normalise_link(base64_decode($a->argv[2]))) ); } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1", intval(local_user()), dbesc(base64_decode($a->argv[2])) ); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $prename = $r[0]['name']; $preurl = $r[0]['url']; $preid = $r[0]['id']; @@ -280,13 +279,13 @@ function message_content(App $a) intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->set_pager_total($r[0]['total']); } $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { info(L10n::t('No messages.') . EOL); return $o; } @@ -308,7 +307,7 @@ function message_content(App $a) intval(local_user()), intval($a->argv[1]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact_id = $r[0]['contact-id']; $convid = $r[0]['convid']; @@ -327,7 +326,7 @@ function message_content(App $a) } else { $messages = false; } - if (!DBM::is_result($messages)) { + if (!DBA::is_result($messages)) { notice(L10n::t('Message not available.') . EOL); return $o; } diff --git a/mod/modexp.php b/mod/modexp.php index 6fdc1884d..83b823a45 100644 --- a/mod/modexp.php +++ b/mod/modexp.php @@ -1,7 +1,7 @@ $rr['name'], diff --git a/mod/network.php b/mod/network.php index 18c2037dd..e14a0ab3c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -16,7 +16,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -557,7 +556,7 @@ function networkThreadedView(App $a, $update, $parent) // 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); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { if ($contact['addr'] != '') { $content = '!' . $contact['addr']; } else { @@ -610,7 +609,7 @@ function networkThreadedView(App $a, $update, $parent) if ($gid) { $group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]); - if (!DBM::is_result($group)) { + if (!DBA::is_result($group)) { if ($update) { killme(); } @@ -626,7 +625,7 @@ function networkThreadedView(App $a, $update, $parent) $contact_str = implode(',', $contacts); $self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]); - if (DBM::is_result($self)) { + if (DBA::is_result($self)) { $contact_str_self = $self['id']; } @@ -646,7 +645,7 @@ function networkThreadedView(App $a, $update, $parent) 'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location']; $condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid]; $contact = DBA::selectFirst('contact', $fields, $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $sql_extra = " AND " . $sql_table . ".`contact-id` = " . intval($cid); $entries[0] = [ @@ -806,7 +805,7 @@ function networkThreadedView(App $a, $update, $parent) // Only show it when unfiltered (no groups, no networks, ...) if (in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) { - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $top_limit = current($r)['order_date']; $bottom_limit = end($r)['order_date']; if (empty($_SESSION['network_last_top_limit']) || ($_SESSION['network_last_top_limit'] < $top_limit)) { @@ -875,7 +874,7 @@ function networkThreadedView(App $a, $update, $parent) $items = $r; - if (DBM::is_result($items)) { + if (DBA::is_result($items)) { $parents_arr = []; foreach ($items as $item) { diff --git a/mod/nogroup.php b/mod/nogroup.php index 570164dce..18681d768 100644 --- a/mod/nogroup.php +++ b/mod/nogroup.php @@ -5,7 +5,7 @@ use Friendica\App; use Friendica\Content\ContactSelector; use Friendica\Core\L10n; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Core\System; diff --git a/mod/noscrape.php b/mod/noscrape.php index e9ced2518..5fc417dd4 100644 --- a/mod/noscrape.php +++ b/mod/noscrape.php @@ -6,7 +6,6 @@ use Friendica\App; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Profile; function noscrape_init(App $a) @@ -55,7 +54,7 @@ function noscrape_init(App $a) /// @todo What should this value tell us? $r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1", intval($a->profile['uid'])); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $json_info["updated"] = date("c", strtotime($r[0]['updated'])); } @@ -66,7 +65,7 @@ function noscrape_init(App $a) dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $json_info["contacts"] = intval($r[0]['total']); } } @@ -75,13 +74,13 @@ function noscrape_init(App $a) $last_active = 0; $condition = ['uid' => $a->profile['uid'], 'self' => true]; $contact = DBA::selectFirst('contact', ['last-item'], $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $last_active = strtotime($contact['last-item']); } $condition = ['uid' => $a->profile['uid']]; $user = DBA::selectFirst('user', ['login_date'], $condition); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { if ($last_active < strtotime($user['login_date'])) { $last_active = strtotime($user['login_date']); } diff --git a/mod/notes.php b/mod/notes.php index 3bc9e0fad..86d730067 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Content\Nav; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; use Friendica\Model\Profile; @@ -70,7 +69,7 @@ function notes_content(App $a, $update = false) $count = 0; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $count = count($r); $parents_arr = []; @@ -82,7 +81,7 @@ function notes_content(App $a, $update = false) $condition = ['uid' => local_user(), 'parent' => $parents_arr]; $result = Item::selectForUser(local_user(), [], $condition); - if (DBM::is_result($result)) { + if (DBA::is_result($result)) { $items = conv_sort(Item::inArray($result), 'commented'); $o .= conversation($a, $items, 'notes', $update); } diff --git a/mod/notice.php b/mod/notice.php index c2d85db16..632600573 100644 --- a/mod/notice.php +++ b/mod/notice.php @@ -7,13 +7,13 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function notice_init(App $a) { $id = $a->argv[1]; $r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id)); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $nick = $r[0]['nickname']; $url = System::baseUrl() . "/display/$nick/$id"; goaway($url); diff --git a/mod/notifications.php b/mod/notifications.php index b639b089f..aa986b2d5 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -11,7 +11,6 @@ use Friendica\Core\L10n; use Friendica\Core\NotificationsManager; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; function notifications_post(App $a) { @@ -28,7 +27,7 @@ function notifications_post(App $a) if ($request_id) { $intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]); - if (DBM::is_result($intro)) { + if (DBA::is_result($intro)) { $intro_id = $intro['id']; $contact_id = $intro['contact-id']; } else { diff --git a/mod/notify.php b/mod/notify.php index f22c1cf5b..87ab68366 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -8,7 +8,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\L10n; use Friendica\Core\NotificationsManager; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; use Friendica\Module\Login; use Friendica\Util\Temporal; @@ -64,7 +64,7 @@ function notify_content(App $a) $not_tpl = get_markup_template('notify.tpl'); $r = $nm->getAll(['seen'=>0]); - if (DBM::is_result($r) > 0) { + if (DBA::is_result($r) > 0) { foreach ($r as $it) { $notif_content .= replace_macros($not_tpl, [ '$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'], diff --git a/mod/openid.php b/mod/openid.php index 3baeec28d..fa98da5e8 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -7,7 +7,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function openid_content(App $a) { @@ -44,7 +44,7 @@ function openid_content(App $a) { dbesc($authid), dbesc(normalise_openid($authid)) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // successful OpenID login diff --git a/mod/photo.php b/mod/photo.php index 653802d30..c8e2fc87d 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -4,7 +4,7 @@ * @file mod/photo.php */ use Friendica\App; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Object\Image; require_once 'include/security.php'; @@ -83,7 +83,7 @@ function photo_init(App $a) intval($resolution), intval($uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $data = $r[0]['data']; $mimetype = $r[0]['type']; } @@ -110,7 +110,7 @@ function photo_init(App $a) dbesc($photo), intval($resolution) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $sql_extra = permissions_sql($r[0]['uid']); // Now we'll see if we can access the photo @@ -118,7 +118,7 @@ function photo_init(App $a) dbesc($photo), intval($resolution) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $resolution = $r[0]['scale']; $data = $r[0]['data']; $mimetype = $r[0]['type']; diff --git a/mod/photos.php b/mod/photos.php index 6d611cafa..d0e06a806 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -14,7 +14,6 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -49,7 +48,7 @@ function photos_init(App $a) { dbesc($nick) ); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return; } @@ -170,7 +169,7 @@ function photos_post(App $a) intval($page_owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $can_post = true; $visitor = $contact_id; } @@ -202,7 +201,7 @@ function photos_post(App $a) dbesc($album), intval($page_owner_uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice(L10n::t('Album not found.') . EOL); goaway($_SESSION['photo_return']); return; // NOTREACHED @@ -271,7 +270,7 @@ function photos_post(App $a) dbesc($album) ); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $res[] = "'" . dbesc($rr['rid']) . "'" ; } @@ -337,7 +336,7 @@ function photos_post(App $a) ); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", intval($page_owner_uid), dbesc($r[0]['resource-id']) @@ -379,7 +378,7 @@ function photos_post(App $a) intval($page_owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $image = new Image($r[0]['data'], $r[0]['type']); if ($image->isValid()) { @@ -432,7 +431,7 @@ function photos_post(App $a) dbesc($resource_id), intval($page_owner_uid) ); - if (DBM::is_result($p)) { + if (DBA::is_result($p)) { $ext = $phototypes[$p[0]['type']]; $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d", dbesc($desc), @@ -496,7 +495,7 @@ function photos_post(App $a) if ($item_id) { $item = Item::selectFirst(['tag', 'inform'], ['id' => $item_id, 'uid' => $page_owner_uid]); } - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $old_tag = $item['tag']; $old_inform = $item['inform']; } @@ -559,7 +558,7 @@ function photos_post(App $a) intval($page_owner_uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { //select someone by attag or nick and the name passed in $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), @@ -569,7 +568,7 @@ function photos_post(App $a) } } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $newname = $r[0]['name']; $profile = $r[0]['url']; $notify = 'cid:' . $r[0]['id']; @@ -712,7 +711,7 @@ function photos_post(App $a) intval($page_owner_uid) ); - if (!DBM::is_result($r) || ($album == L10n::t('Profile Photos'))) { + if (!DBA::is_result($r) || ($album == L10n::t('Profile Photos'))) { $visible = 1; } else { $visible = 0; @@ -985,7 +984,7 @@ function photos_content(App $a) intval($contact_id), intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $can_post = true; $contact = $r[0]; $remote_contact = true; @@ -1014,7 +1013,7 @@ function photos_content(App $a) intval($contact_id), intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; $remote_contact = true; } @@ -1114,7 +1113,7 @@ function photos_content(App $a) intval($owner_uid), dbesc($album) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->set_pager_total(count($r)); $a->set_pager_itemspage(20); } @@ -1170,7 +1169,7 @@ function photos_content(App $a) $photos = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // "Twist" is only used for the duepunto theme with style "slackr" $twist = false; foreach ($r as $rr) { @@ -1220,13 +1219,13 @@ function photos_content(App $a) dbesc($datum) ); - if (!DBM::is_result($ph)) { + if (!DBA::is_result($ph)) { $ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1", intval($owner_uid), dbesc($datum) ); - if (DBM::is_result($ph)) { + if (DBA::is_result($ph)) { notice(L10n::t('Permission denied. Access to this item may be restricted.')); } else { notice(L10n::t('Photo not available') . EOL); @@ -1257,7 +1256,7 @@ function photos_content(App $a) intval($owner_uid) ); - if (DBM::is_result($prvnxt)) { + if (DBA::is_result($prvnxt)) { foreach ($prvnxt as $z => $entry) { if ($entry['resource-id'] == $ph[0]['resource-id']) { $prv = $z - 1; @@ -1354,7 +1353,7 @@ function photos_content(App $a) $map = null; $link_item = []; - if (DBM::is_result($linked_items)) { + if (DBA::is_result($linked_items)) { // This is a workaround to not being forced to rewrite the while $sql_extra handling $link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]); @@ -1450,7 +1449,7 @@ function photos_content(App $a) ]); } - if (!DBM::is_result($items)) { + if (!DBA::is_result($items)) { if (($can_post || can_write_wall($owner_uid))) { $comments .= replace_macros($cmnt_tpl, [ '$return_path' => '', @@ -1477,7 +1476,7 @@ function photos_content(App $a) ]; // display comments - if (DBM::is_result($items)) { + if (DBA::is_result($items)) { foreach ($items as $item) { builtin_activity_puller($item, $conv_responses); } @@ -1620,7 +1619,7 @@ function photos_content(App $a) dbesc(L10n::t('Contact Photos')) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->set_pager_total(count($r)); $a->set_pager_itemspage(20); } @@ -1638,7 +1637,7 @@ function photos_content(App $a) ); $photos = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // "Twist" is only used for the duepunto theme with style "slackr" $twist = false; foreach ($r as $rr) { diff --git a/mod/ping.php b/mod/ping.php index f68040a2c..b899fdb9d 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -13,7 +13,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -135,7 +135,7 @@ function ping_init(App $a) $params = ['order' => ['created' => true]]; $items = Item::selectForUser(local_user(), $fields, $condition, $params); - if (DBM::is_result($items)) { + if (DBA::is_result($items)) { $items_unseen = Item::inArray($items); $arr = ['items' => $items_unseen]; Addon::callHooks('network_ping', $arr); @@ -153,7 +153,7 @@ function ping_init(App $a) if (intval(Feature::isEnabled(local_user(), 'groups'))) { // Find out how unseen network posts are spread across groups $group_counts = Group::countUnseen(); - if (DBM::is_result($group_counts)) { + if (DBA::is_result($group_counts)) { foreach ($group_counts as $group_count) { if ($group_count['count'] > 0) { $groups_unseen[] = $group_count; @@ -164,7 +164,7 @@ function ping_init(App $a) if (intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) { $forum_counts = ForumManager::countUnseenItems(); - if (DBM::is_result($forum_counts)) { + if (DBA::is_result($forum_counts)) { foreach ($forum_counts as $forum_count) { if ($forum_count['count'] > 0) { $forums_unseen[] = $forum_count; @@ -208,7 +208,7 @@ function ping_init(App $a) WHERE `contact`.`self` = 1" ); - if (DBM::is_result($regs)) { + if (DBA::is_result($regs)) { $register_count = count($regs); } } @@ -224,12 +224,12 @@ function ping_init(App $a) dbesc(DateTimeFormat::utc('now + 7 days')), dbesc(DateTimeFormat::utcNow()) ); - if (DBM::is_result($ev)) { + if (DBA::is_result($ev)) { Cache::set($cachekey, $ev, CACHE_HOUR); } } - if (DBM::is_result($ev)) { + if (DBA::is_result($ev)) { $all_events = count($ev); if ($all_events) { @@ -267,7 +267,7 @@ function ping_init(App $a) $data['birthdays'] = $birthdays; $data['birthdays-today'] = $birthdays_today; - if (DBM::is_result($notifs)) { + if (DBA::is_result($notifs)) { foreach ($notifs as $notif) { if ($notif['seen'] == 0) { $sysnotify_count ++; @@ -276,7 +276,7 @@ function ping_init(App $a) } // merge all notification types in one array - if (DBM::is_result($intros)) { + if (DBA::is_result($intros)) { foreach ($intros as $intro) { $notif = [ 'id' => 0, @@ -292,7 +292,7 @@ function ping_init(App $a) } } - if (DBM::is_result($mails)) { + if (DBA::is_result($mails)) { foreach ($mails as $mail) { $notif = [ 'id' => 0, @@ -308,7 +308,7 @@ function ping_init(App $a) } } - if (DBM::is_result($regs)) { + if (DBA::is_result($regs)) { foreach ($regs as $reg) { $notif = [ 'id' => 0, @@ -345,7 +345,7 @@ function ping_init(App $a) }; usort($notifs, $sort_function); - if (DBM::is_result($notifs)) { + if (DBA::is_result($notifs)) { // Are the nofications called from the regular process or via the friendica app? $regularnotifications = (intval($_GET['uid']) && intval($_GET['_'])); diff --git a/mod/poco.php b/mod/poco.php index d263afc9a..fe81f98d3 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -9,7 +9,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Protocol\PortableContact; use Friendica\Util\DateTimeFormat; @@ -25,7 +25,7 @@ function poco_init(App $a) { } if (empty($user)) { $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1"); - if (!DBM::is_result($c)) { + if (!DBA::is_result($c)) { System::httpExit(401); } $system_mode = true; @@ -67,7 +67,7 @@ function poco_init(App $a) { where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1", dbesc($user) ); - if (! DBM::is_result($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) { + if (! DBA::is_result($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) { System::httpExit(404); } @@ -107,7 +107,7 @@ function poco_init(App $a) { dbesc(NETWORK_STATUSNET) ); } - if (DBM::is_result($contacts)) { + if (DBA::is_result($contacts)) { $totalResults = intval($contacts[0]['total']); } else { $totalResults = 0; @@ -203,7 +203,7 @@ function poco_init(App $a) { } if (is_array($contacts)) { - if (DBM::is_result($contacts)) { + if (DBA::is_result($contacts)) { foreach ($contacts as $contact) { if (!isset($contact['updated'])) { $contact['updated'] = ''; diff --git a/mod/poke.php b/mod/poke.php index 561a5b798..0ffb31628 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -18,7 +18,7 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; require_once 'include/security.php'; @@ -61,7 +61,7 @@ function poke_init(App $a) { intval($uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger('poke: no contact ' . $contact_id); return; } @@ -73,7 +73,7 @@ function poke_init(App $a) { $condition = ['id' => $parent, 'parent' => $parent, 'uid' => $uid]; $item = Item::selectFirst($fields, $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $parent_uri = $item['uri']; $private = $item['private']; $allow_cid = $item['allow_cid']; @@ -154,7 +154,7 @@ function poke_content(App $a) { intval($_GET['c']), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $name = $item['name']; $id = $item['id']; } diff --git a/mod/profile.php b/mod/profile.php index 9550fe25e..b7e628410 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -13,7 +13,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\Profile; @@ -31,7 +30,7 @@ function profile_init(App $a) $which = htmlspecialchars($a->argv[1]); } else { $r = q("SELECT `nickname` FROM `user` WHERE `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 ORDER BY RAND() LIMIT 1"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { goaway(System::baseUrl() . '/profile/' . $r[0]['nickname']); } else { logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG); @@ -155,7 +154,7 @@ function profile_content(App $a, $update = 0) intval($contact_id), intval($a->profile['profile_uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; $remote_contact = true; } @@ -250,7 +249,7 @@ function profile_content(App $a, $update = 0) intval($a->profile['profile_uid']), intval(GRAVITY_ACTIVITY) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return ''; } } else { @@ -281,7 +280,7 @@ function profile_content(App $a, $update = 0) intval(PAGE_PRVGROUP) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id']))); } else { $sql_extra3 = ""; @@ -328,7 +327,7 @@ function profile_content(App $a, $update = 0) // search for new items (update routine) $_SESSION['last_updated'][$last_updated_key] = time(); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $parents_arr[] = $rr['item_id']; } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 4565f6e23..e17ba4c40 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -8,7 +8,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Photo; use Friendica\Model\Profile; @@ -42,7 +42,7 @@ function profile_photo_post(App $a) intval(local_user()) ); - if (DBM::is_result($r) && (!intval($r[0]['is-default']))) { + if (DBA::is_result($r) && (!intval($r[0]['is-default']))) { $is_default_profile = 0; } } @@ -73,8 +73,7 @@ function profile_photo_post(App $a) dbesc(local_user()), intval($scale)); $url = System::baseUrl() . '/profile/' . $a->user['nickname']; - if (DBM::is_result($r)) { - + if (DBA::is_result($r)) { $base_image = $r[0]; $Image = new Image($base_image['data'], $base_image['type']); @@ -195,7 +194,7 @@ function profile_photo_content(App $a) dbesc($resource_id) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice(L10n::t('Permission denied.') . EOL); return; } diff --git a/mod/profiles.php b/mod/profiles.php index 448463554..a83f0a104 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -14,7 +14,6 @@ use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Profile; @@ -35,7 +34,7 @@ function profiles_init(App $a) { intval($a->argv[2]), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Profile not found.') . EOL); goaway('profiles'); return; // NOTREACHED @@ -54,7 +53,7 @@ function profiles_init(App $a) { intval($a->argv[2]), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { info(L10n::t('Profile deleted.').EOL); } @@ -69,7 +68,7 @@ function profiles_init(App $a) { $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", intval(local_user())); - $num_profiles = (DBM::is_result($r0) ? count($r0) : 0); + $num_profiles = (DBA::is_result($r0) ? count($r0) : 0); $name = L10n::t('Profile-') . ($num_profiles + 1); @@ -91,7 +90,7 @@ function profiles_init(App $a) { ); info(L10n::t('New profile created.') . EOL); - if (DBM::is_result($r3) && count($r3) == 1) { + if (DBA::is_result($r3) && count($r3) == 1) { goaway('profiles/' . $r3[0]['id']); } @@ -105,14 +104,14 @@ function profiles_init(App $a) { $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", intval(local_user())); - $num_profiles = (DBM::is_result($r0) ? count($r0) : 0); + $num_profiles = (DBA::is_result($r0) ? count($r0) : 0); $name = L10n::t('Profile-') . ($num_profiles + 1); $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval(local_user()), intval($a->argv[2]) ); - if(! DBM::is_result($r1)) { + if(! DBA::is_result($r1)) { notice(L10n::t('Profile unavailable to clone.') . EOL); killme(); return; @@ -130,7 +129,7 @@ function profiles_init(App $a) { dbesc($name) ); info(L10n::t('New profile created.') . EOL); - if ((DBM::is_result($r3)) && (count($r3) == 1)) { + if ((DBA::is_result($r3)) && (count($r3) == 1)) { goaway('profiles/'.$r3[0]['id']); } @@ -145,7 +144,7 @@ function profiles_init(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Profile not found.') . EOL); killme(); return; @@ -192,7 +191,7 @@ function profiles_post(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! DBM::is_result($orig)) { + if (! DBA::is_result($orig)) { notice(L10n::t('Profile not found.') . EOL); return; } @@ -287,13 +286,13 @@ function profiles_post(App $a) { dbesc($newname), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1", dbesc($lookup), intval(local_user()) ); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $prf = $r[0]['url']; $newname = $r[0]['name']; } @@ -522,7 +521,7 @@ function profiles_content(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Profile not found.') . EOL); return; } @@ -654,7 +653,7 @@ function profiles_content(App $a) { $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1", local_user() ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { //Go to the default profile. goaway('profiles/' . $r[0]['id']); } @@ -663,7 +662,7 @@ function profiles_content(App $a) { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_user()); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $tpl = get_markup_template('profile_entry.tpl'); diff --git a/mod/profperm.php b/mod/profperm.php index 0f864d42f..e2b0738e0 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Profile; function profperm_init(App $a) @@ -51,7 +51,7 @@ function profperm_content(App $a) { intval($a->argv[2]), intval(local_user()) ); - if (DBM::is_result($r)) + if (DBA::is_result($r)) $change = intval($a->argv[2]); } @@ -61,7 +61,7 @@ function profperm_content(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('Invalid profile identifier.') . EOL ); return; } @@ -73,7 +73,7 @@ function profperm_content(App $a) { ); $ingroup = []; - if (DBM::is_result($r)) + if (DBA::is_result($r)) foreach($r as $member) $ingroup[] = $member['id']; @@ -103,7 +103,7 @@ function profperm_content(App $a) { $members = $r; $ingroup = []; - if (DBM::is_result($r)) + if (DBA::is_result($r)) foreach($r as $member) $ingroup[] = $member['id']; } @@ -147,7 +147,7 @@ function profperm_content(App $a) { dbesc(NETWORK_DFRN) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); foreach($r as $member) { if(! in_array($member['id'],$ingroup)) { diff --git a/mod/proxy.php b/mod/proxy.php index 6546ce435..66ddcaa78 100644 --- a/mod/proxy.php +++ b/mod/proxy.php @@ -8,7 +8,6 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Photo; use Friendica\Object\Image; use Friendica\Util\DateTimeFormat; @@ -151,7 +150,7 @@ function proxy_init(App $a) { $photo = null; if (!$direct_cache && ($cachefile == '')) { $photo = DBA::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]); - if (DBM::is_result($photo)) { + if (DBA::is_result($photo)) { $img_str = $photo['data']; $mime = $photo['desc']; if ($mime == '') { @@ -160,7 +159,7 @@ function proxy_init(App $a) { } } - if (!DBM::is_result($photo)) { + if (!DBA::is_result($photo)) { // It shouldn't happen but it does - spaces in URL $_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']); $redirects = 0; diff --git a/mod/pubsub.php b/mod/pubsub.php index 7843f7352..1ddebf541 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -2,7 +2,6 @@ use Friendica\App; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Protocol\OStatus; require_once('include/security.php'); @@ -45,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]); - if (!DBM::is_result($owner)) { + if (!DBA::is_result($owner)) { logger('Local account not found: ' . $nick); hub_return(false, ''); } @@ -57,7 +56,7 @@ function pubsub_init(App $a) } $contact = DBA::selectFirst('contact', ['id', 'poll'], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { logger('Contact ' . $contact_id . ' not found.'); hub_return(false, ''); } @@ -94,21 +93,21 @@ function pubsub_post(App $a) $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 ); $importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); - if (!DBM::is_result($importer)) { + if (!DBA::is_result($importer)) { hub_post_return(); } $condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false]; $contact = DBA::selectFirst('contact', [], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::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); logger('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.'); } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { logger('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml); hub_post_return(); } diff --git a/mod/pubsubhubbub.php b/mod/pubsubhubbub.php index 1128e8b45..2f4f62ba7 100644 --- a/mod/pubsubhubbub.php +++ b/mod/pubsubhubbub.php @@ -4,7 +4,6 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\PushSubscriber; use Friendica\Util\Network; @@ -65,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); - if (!DBM::is_result($owner)) { + if (!DBA::is_result($owner)) { logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback); System::httpExit(404); } @@ -80,7 +79,7 @@ function pubsubhubbub_init(App $a) { $condition = ['uid' => $owner['uid'], 'blocked' => false, 'pending' => false, 'self' => true]; $contact = DBA::selectFirst('contact', ['poll'], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { logger('Self contact for user ' . $owner['uid'] . ' not found.'); System::httpExit(404); } diff --git a/mod/receive.php b/mod/receive.php index ebc20cfcd..5e0ecd978 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -8,7 +8,6 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Protocol\Diaspora; /** @@ -35,7 +34,7 @@ function receive_post(App $a) $guid = $a->argv[2]; $importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]); - if (!DBM::is_result($importer)) { + if (!DBA::is_result($importer)) { System::httpExit(500); } } diff --git a/mod/redir.php b/mod/redir.php index 20e205076..fed36107a 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -4,7 +4,6 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -25,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()]]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { notice(L10n::t('Contact not found.')); goaway(System::baseUrl()); } @@ -44,7 +43,7 @@ function redir_init(App $a) { // between the puplic contact we have found and the local user. $contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $cid = $contact['id']; } diff --git a/mod/regmod.php b/mod/regmod.php index 283b23dfb..68c635696 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -9,7 +9,6 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; use Friendica\Module\Login; @@ -24,7 +23,7 @@ function user_allow($hash) ); - if (!DBM::is_result($register)) { + if (!DBA::is_result($register)) { return false; } @@ -32,7 +31,7 @@ function user_allow($hash) intval($register[0]['uid']) ); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { killme(); } @@ -48,7 +47,7 @@ function user_allow($hash) $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1", intval($user[0]['uid']) ); - if (DBM::is_result($r) && $r[0]['net-publish']) { + if (DBA::is_result($r) && $r[0]['net-publish']) { $url = System::baseUrl() . '/profile/' . $user[0]['nickname']; if ($url && strlen(Config::get('system', 'directory'))) { Worker::add(PRIORITY_LOW, "Directory", $url); @@ -81,7 +80,7 @@ function user_deny($hash) dbesc($hash) ); - if (!DBM::is_result($register)) { + if (!DBA::is_result($register)) { return false; } diff --git a/mod/removeme.php b/mod/removeme.php index 1676b7b57..17d494a67 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -8,7 +8,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; require_once 'include/enotify.php'; @@ -40,7 +39,7 @@ function removeme_post(App $a) $admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))); foreach ($admin_mails as $mail) { $admin = DBA::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]); - if (!DBM::is_result($admin)) { + if (!DBA::is_result($admin)) { continue; } notification([ diff --git a/mod/salmon.php b/mod/salmon.php index 22da151cf..790a6dda0 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -5,7 +5,7 @@ use Friendica\App; use Friendica\Core\PConfig; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Protocol\OStatus; use Friendica\Protocol\Salmon; @@ -27,7 +27,7 @@ function salmon_post(App $a, $xml = '') { $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", dbesc($nick) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { System::httpExit(500); } @@ -152,7 +152,7 @@ function salmon_post(App $a, $xml = '') { dbesc(normalise_link($author_link)), intval($importer['uid']) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { logger('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.'); if(PConfig::get($importer['uid'],'system','ostatus_autofriend')) { $result = Contact::createFromProbe($importer['uid'], $author_link); @@ -171,8 +171,8 @@ function salmon_post(App $a, $xml = '') { // Have we ignored the person? // If so we can not accept this post. - //if((DBM::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) { - if (DBM::is_result($r) && $r[0]['blocked']) { + //if((DBA::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) { + if (DBA::is_result($r) && $r[0]['blocked']) { logger('Ignoring this author.'); System::httpExit(202); // NOTREACHED @@ -181,7 +181,7 @@ function salmon_post(App $a, $xml = '') { // Placeholder for hub discovery. $hub = ''; - $contact_rec = ((DBM::is_result($r)) ? $r[0] : null); + $contact_rec = ((DBA::is_result($r)) ? $r[0] : null); OStatus::import($data, $importer, $contact_rec, $hub); diff --git a/mod/search.php b/mod/search.php index 8f3d897ae..1d35221af 100644 --- a/mod/search.php +++ b/mod/search.php @@ -11,7 +11,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; require_once 'include/security.php'; @@ -30,7 +29,7 @@ function search_saved_searches() { intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $saved = []; foreach ($r as $rr) { $saved[] = [ @@ -68,7 +67,7 @@ function search_init(App $a) { intval(local_user()), dbesc($search) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { DBA::insert('search', ['uid' => local_user(), 'term' => $search]); } } @@ -237,7 +236,7 @@ function search_content(App $a) { $r = Item::inArray($items); } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { info(L10n::t('No results.') . EOL); return $o; } diff --git a/mod/settings.php b/mod/settings.php index 34b52a7d7..0436f5dc7 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -15,7 +15,6 @@ use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Group; @@ -240,7 +239,7 @@ function settings_post(App $a) $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", intval(local_user()) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { DBA::insert('mailacct', ['uid' => local_user()]); } if (strlen($mail_pass)) { @@ -265,7 +264,7 @@ function settings_post(App $a) $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $eacct = $r[0]; $mb = Email::constructMailboxName($eacct); @@ -404,7 +403,7 @@ function settings_post(App $a) if (!$err) { $result = User::updatePassword(local_user(), $newpass); - if (DBM::is_result($result)) { + if (DBA::is_result($result)) { info(L10n::t('Password changed.') . EOL); } else { notice(L10n::t('Password update failed. Please try again.') . EOL); @@ -605,7 +604,7 @@ function settings_post(App $a) dbesc($language), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { info(L10n::t('Settings updated.') . EOL); } @@ -682,7 +681,7 @@ function settings_content(App $a) dbesc($a->argv[3]), local_user()); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { notice(L10n::t("You can't edit this application.")); return; } @@ -711,7 +710,7 @@ function settings_content(App $a) return; } - /// @TODO validate result with DBM::is_result() + /// @TODO validate result with DBA::is_result() $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my FROM clients LEFT JOIN tokens ON clients.client_id=tokens.client_id @@ -740,7 +739,7 @@ function settings_content(App $a) $settings_addons = ""; $r = q("SELECT * FROM `hook` WHERE `hook` = 'addon_settings' "); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $settings_addons = L10n::t('No Addon settings configured'); } @@ -813,15 +812,15 @@ function settings_content(App $a) $r = null; } - $mail_server = ((DBM::is_result($r)) ? $r[0]['server'] : ''); - $mail_port = ((DBM::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); - $mail_ssl = ((DBM::is_result($r)) ? $r[0]['ssltype'] : ''); - $mail_user = ((DBM::is_result($r)) ? $r[0]['user'] : ''); - $mail_replyto = ((DBM::is_result($r)) ? $r[0]['reply_to'] : ''); - $mail_pubmail = ((DBM::is_result($r)) ? $r[0]['pubmail'] : 0); - $mail_action = ((DBM::is_result($r)) ? $r[0]['action'] : 0); - $mail_movetofolder = ((DBM::is_result($r)) ? $r[0]['movetofolder'] : ''); - $mail_chk = ((DBM::is_result($r)) ? $r[0]['last_check'] : NULL_DATE); + $mail_server = ((DBA::is_result($r)) ? $r[0]['server'] : ''); + $mail_port = ((DBA::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); + $mail_ssl = ((DBA::is_result($r)) ? $r[0]['ssltype'] : ''); + $mail_user = ((DBA::is_result($r)) ? $r[0]['user'] : ''); + $mail_replyto = ((DBA::is_result($r)) ? $r[0]['reply_to'] : ''); + $mail_pubmail = ((DBA::is_result($r)) ? $r[0]['pubmail'] : 0); + $mail_action = ((DBA::is_result($r)) ? $r[0]['action'] : 0); + $mail_movetofolder = ((DBA::is_result($r)) ? $r[0]['movetofolder'] : ''); + $mail_chk = ((DBA::is_result($r)) ? $r[0]['last_check'] : NULL_DATE); $tpl = get_markup_template('settings/connectors.tpl'); @@ -990,7 +989,7 @@ function settings_content(App $a) */ $profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]); - if (!DBM::is_result($profile)) { + if (!DBA::is_result($profile)) { notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL); return; } diff --git a/mod/share.php b/mod/share.php index fb4495019..229c6d3eb 100644 --- a/mod/share.php +++ b/mod/share.php @@ -1,7 +1,7 @@ $post_id]); - if (!DBM::is_result($item) || $item['private'] == 1) { + if (!DBA::is_result($item) || $item['private'] == 1) { killme(); } diff --git a/mod/starred.php b/mod/starred.php index 443308c27..8d46f5bb8 100644 --- a/mod/starred.php +++ b/mod/starred.php @@ -4,7 +4,7 @@ */ use Friendica\App; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; function starred_init(App $a) { @@ -22,7 +22,7 @@ function starred_init(App $a) { } $item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $message_id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { killme(); } diff --git a/mod/subthread.php b/mod/subthread.php index 3cd089d63..c5d8ee688 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; require_once 'include/security.php'; @@ -25,7 +25,7 @@ function subthread_content(App $a) { $condition = ["`parent` = ? OR `parent-uri` = ? AND `parent` = `id`", $item_id, $item_id]; $item = Item::selectFirst([], $condition); - if (empty($item_id) || !DBM::is_result($item)) { + if (empty($item_id) || !DBA::is_result($item)) { logger('subthread: no item ' . $item_id); return; } @@ -44,7 +44,7 @@ function subthread_content(App $a) { intval($item['contact-id']), intval($item['uid']) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } if (!$r[0]['self']) { @@ -60,7 +60,7 @@ function subthread_content(App $a) { intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $owner = $r[0]; } @@ -84,7 +84,7 @@ function subthread_content(App $a) { intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; } } diff --git a/mod/suggest.php b/mod/suggest.php index 51ec06b10..263f4493d 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -9,7 +9,6 @@ use Friendica\Content\Widget; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; @@ -70,7 +69,7 @@ function suggest_content(App $a) { $r = GContact::suggestionQuery(local_user()); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { $o .= L10n::t('No suggestions available. If this is a new site, please try again in 24 hours.'); return $o; } diff --git a/mod/tagger.php b/mod/tagger.php index 0c515f9c8..1243ebfa5 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -7,7 +7,7 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; require_once 'include/security.php'; @@ -34,7 +34,7 @@ function tagger_content(App $a) { $item = Item::selectFirst([], ['id' => $item_id]); - if (!$item_id || !DBM::is_result($item)) { + if (!$item_id || !DBA::is_result($item)) { logger('tagger: no item ' . $item_id); return; } @@ -46,7 +46,7 @@ function tagger_content(App $a) { $r = q("select `nickname`,`blocktags` from user where uid = %d limit 1", intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $owner_nick = $r[0]['nickname']; $blocktags = $r[0]['blocktags']; } @@ -58,7 +58,7 @@ function tagger_content(App $a) { $r = q("select * from contact where self = 1 and uid = %d limit 1", intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; } else { logger('tagger: no contact_id'); @@ -175,7 +175,7 @@ EOT; // if the original post is on this site, update it. $original_item = Item::selectFirst(['tag', 'id', 'uid'], ['origin' => true, 'uri' => $item['uri']]); - if (DBM::is_result($original_item)) { + if (DBA::is_result($original_item)) { $x = q("SELECT `blocktags` FROM `user` WHERE `uid`=%d LIMIT 1", intval($original_item['uid']) ); @@ -184,7 +184,7 @@ EOT; dbesc($term) ); - if (DBM::is_result($x) && !$x[0]['blocktags'] && $t[0]['tcount'] == 0){ + if (DBA::is_result($x) && !$x[0]['blocktags'] && $t[0]['tcount'] == 0){ q("INSERT INTO term (`oid`, `otype`, `type`, `term`, `url`, `uid`) VALUE (%d, %d, %d, '%s', '%s', %d)", intval($original_item['id']), $term_objtype, diff --git a/mod/tagrm.php b/mod/tagrm.php index dbe6f1087..260a5ce7f 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -7,7 +7,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; function tagrm_post(App $a) @@ -24,7 +24,7 @@ function tagrm_post(App $a) $item_id = (x($_POST,'item') ? intval($_POST['item']) : 0); $item = Item::selectFirst(['tag'], ['id' => $item_id, 'uid' => local_user()]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { goaway(System::baseUrl() . '/' . $_SESSION['photo_return']); } @@ -64,7 +64,7 @@ function tagrm_content(App $a) } $item = Item::selectFirst(['tag'], ['id' => $item_id, 'uid' => local_user()]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { goaway(System::baseUrl() . '/' . $_SESSION['photo_return']); } diff --git a/mod/uexport.php b/mod/uexport.php index c1b3dd1e4..4d404707d 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function uexport_init(App $a) { if (!local_user()) { @@ -57,7 +57,7 @@ function uexport_content(App $a) { function _uexport_multirow($query) { $result = []; $r = q($query); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $p = []; foreach ($rr as $k => $v) { @@ -72,7 +72,7 @@ function _uexport_multirow($query) { function _uexport_row($query) { $result = []; $r = q($query); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { foreach ($rr as $k => $v) { $result[$k] = $v; @@ -145,7 +145,7 @@ function uexport_all(App $a) { $r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ", intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $total = $r[0]['total']; } // chunk the output to avoid exhausting memory diff --git a/mod/unfollow.php b/mod/unfollow.php index 545faf8fd..3cc4be25c 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -32,7 +31,7 @@ function unfollow_post(App $a) normalise_link($url), $url, NETWORK_STATUSNET]; $contact = DBA::selectFirst('contact', [], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { notice(L10n::t("Contact wasn't found or can't be unfollowed.")); } else { if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN])) { @@ -40,7 +39,7 @@ function unfollow_post(App $a) WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1", intval($uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { Contact::terminateFriendship($r[0], $contact); } } @@ -71,7 +70,7 @@ function unfollow_content(App $a) normalise_link($url), $url, NETWORK_STATUSNET]; $contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { notice(L10n::t("You aren't a friend of this contact.").EOL); $submit = ""; // NOTREACHED diff --git a/mod/videos.php b/mod/videos.php index 0dd653e91..4b1ca3410 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -9,7 +9,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -158,7 +158,7 @@ function videos_post(App $a) { dbesc($video_id) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'", intval(local_user()), dbesc($video_id) @@ -168,7 +168,7 @@ function videos_post(App $a) { intval(local_user()) ); - if (DBM::is_result($i)) { + if (DBA::is_result($i)) { Item::deleteForUser(['id' => $i[0]['id']], local_user()); } } @@ -262,7 +262,7 @@ function videos_content(App $a) { intval($contact_id), intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $can_post = true; $contact = $r[0]; $remote_contact = true; @@ -291,7 +291,7 @@ function videos_content(App $a) { intval($contact_id), intval($owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; $remote_contact = true; } @@ -351,7 +351,7 @@ function videos_content(App $a) { $sql_extra GROUP BY hash", intval($a->data['user']['uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->set_pager_total(count($r)); $a->set_pager_itemspage(20); } @@ -369,7 +369,7 @@ function videos_content(App $a) { $videos = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $alt_e = $rr['filename']; $name_e = $rr['album']; diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index af5ecd9d6..013e3a4de 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -7,7 +7,7 @@ use Friendica\Content\ContactSelector; use Friendica\Content\Nav; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -25,7 +25,7 @@ function viewcontacts_init(App $a) dbesc($nick) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { return; } @@ -67,7 +67,7 @@ function viewcontacts_content(App $a) dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $a->set_pager_total($r[0]['total']); } @@ -83,7 +83,7 @@ function viewcontacts_content(App $a) intval($a->pager['start']), intval($a->pager['itemspage']) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { info(L10n::t('No contacts.').EOL); return $o; } diff --git a/mod/viewsrc.php b/mod/viewsrc.php index 087b9f3d2..2b91d6fc4 100644 --- a/mod/viewsrc.php +++ b/mod/viewsrc.php @@ -4,7 +4,7 @@ */ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; function viewsrc_content(App $a) @@ -25,7 +25,7 @@ function viewsrc_content(App $a) $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { if (is_ajax()) { echo str_replace("\n", '
', $item['body']); killme(); diff --git a/mod/wall_attach.php b/mod/wall_attach.php index cf5d11f8b..ea60bcd45 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -8,7 +8,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; use Friendica\Util\Mimetype; @@ -21,7 +20,7 @@ function wall_attach_post(App $a) { $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", dbesc($nick) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { if ($r_json) { echo json_encode(['error'=>L10n::t('Invalid request.')]); killme(); @@ -64,7 +63,7 @@ function wall_attach_post(App $a) { intval($contact_id), intval($page_owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $can_post = true; $visitor = $contact_id; } @@ -150,7 +149,7 @@ function wall_attach_post(App $a) { dbesc($hash) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { $msg = L10n::t('File upload failed.'); if ($r_json) { echo json_encode(['error'=>$msg]); diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 8bf296615..92a6c29ed 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -12,7 +12,7 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Config; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Photo; use Friendica\Object\Image; @@ -33,7 +33,7 @@ function wall_upload_post(App $a, $desktopmode = true) dbesc($nick) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { if ($r_json) { echo json_encode(['error' => L10n::t('Invalid request.')]); killme(); @@ -89,7 +89,7 @@ function wall_upload_post(App $a, $desktopmode = true) intval($contact_id), intval($page_owner_uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $can_post = true; $visitor = $contact_id; } diff --git a/mod/wallmessage.php b/mod/wallmessage.php index 75aca1f68..6a78aefb3 100644 --- a/mod/wallmessage.php +++ b/mod/wallmessage.php @@ -5,7 +5,7 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Mail; use Friendica\Model\Profile; @@ -29,7 +29,7 @@ function wallmessage_post(App $a) { dbesc($recipient) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { logger('wallmessage: no recipient'); return; } @@ -91,7 +91,7 @@ function wallmessage_content(App $a) { dbesc($recipient) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { notice(L10n::t('No recipient.') . EOL); logger('wallmessage: no recipient'); return; diff --git a/mod/xrd.php b/mod/xrd.php index cd72e5018..b5c1b4c11 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Protocol\Salmon; function xrd_init(App $a) @@ -40,7 +39,7 @@ function xrd_init(App $a) } $user = DBA::selectFirst('user', [], ['nickname' => $name]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { killme(); } diff --git a/src/App.php b/src/App.php index 49c85abec..c6f8f459e 100644 --- a/src/App.php +++ b/src/App.php @@ -11,7 +11,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'boot.php'; require_once 'include/dba.php'; @@ -1032,7 +1031,7 @@ class App } } - $processlist = DBM::processlist(); + $processlist = DBA::processlist(); if ($processlist['list'] != '') { logger('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG); @@ -1397,7 +1396,7 @@ class App // Allow folks to override user themes and always use their own on their own site. // This works only if the user is on the same server $user = DBA::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]); - if (DBM::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) { + if (DBA::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) { $page_theme = $user['theme']; } } diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 21757d429..18854128c 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -7,7 +7,6 @@ namespace Friendica\Content; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; /** * @brief ContactSelector class @@ -29,7 +28,7 @@ class ContactSelector $s = DBA::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]); $r = DBA::toArray($s); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $selected = (($rr['id'] == $current || ($current == 0 && $rr['is-default'] == 1)) ? " selected=\"selected\" " : ""); $o .= "\r\n"; @@ -106,7 +105,7 @@ class ContactSelector INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url` WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile)); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $networkname = $r['platform']; } } diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index 535f6483e..99cdde12f 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -9,7 +9,6 @@ use Friendica\Content\Feature; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; require_once 'include/dba.php'; @@ -99,7 +98,7 @@ class ForumManager $total = count($contacts); $visible_forums = 10; - if (DBM::is_result($contacts)) { + if (DBA::is_result($contacts)) { $id = 0; foreach ($contacts as $contact) { diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 31911688d..a01e9a71c 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -11,7 +11,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Profile; require_once 'boot.php'; @@ -107,7 +106,7 @@ class Nav // user info $contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]); $userinfo = [ - 'icon' => (DBM::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'), + 'icon' => (DBA::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'), 'name' => $a->user['username'], ]; } else { diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index fe59567b2..27ebfd2c9 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -16,7 +16,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\ParseUrl; @@ -64,7 +63,7 @@ class OEmbed $condition = ['url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth]; $oembed = DBA::selectFirst('oembed', ['content'], $condition); - if (DBM::is_result($oembed)) { + if (DBA::is_result($oembed)) { $txt = $oembed["content"]; } else { $txt = Cache::get($a->videowidth . $embedurl); diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 230f2b695..5928cb316 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -12,7 +12,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Profile; @@ -277,11 +276,11 @@ class Widget if (Profile::getMyURL()) { $contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $cid = $contact['id']; } else { $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]); - if (DBM::is_result($gcontact)) { + if (DBA::is_result($gcontact)) { $zcid = $gcontact['id']; } } diff --git a/src/Content/Widget/TagCloud.php b/src/Content/Widget/TagCloud.php index 65646ba0d..667cc663d 100644 --- a/src/Content/Widget/TagCloud.php +++ b/src/Content/Widget/TagCloud.php @@ -9,7 +9,6 @@ namespace Friendica\Content\Widget; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; require_once 'include/security.php'; @@ -99,7 +98,7 @@ class TagCloud $type, TERM_OBJ_POST ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return []; } diff --git a/src/Core/ACL.php b/src/Core/ACL.php index e0fbff7eb..ce1cd6589 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -9,7 +9,6 @@ namespace Friendica\Core; use Friendica\BaseObject; use Friendica\Content\Feature; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Util\Network; @@ -113,7 +112,7 @@ class ACL extends BaseObject // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow' Addon::callHooks($a->module . '_pre_' . $selname, $arr); - if (DBM::is_result($contacts)) { + if (DBA::is_result($contacts)) { foreach ($contacts as $contact) { if (in_array($contact['id'], $preselected)) { $selected = ' selected="selected" '; @@ -180,7 +179,7 @@ class ACL extends BaseObject $receiverlist = []; - if (DBM::is_result($contacts)) { + if (DBA::is_result($contacts)) { foreach ($contacts as $contact) { if (in_array($contact['id'], $preselected)) { $selected = ' selected="selected"'; @@ -274,7 +273,7 @@ class ACL extends BaseObject if (!$imap_disabled) { $mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]); - if (DBM::is_result($mailacct)) { + if (DBA::is_result($mailacct)) { $mail_enabled = true; $pubmail_enabled = !empty($mailacct['pubmail']); } diff --git a/src/Core/Addon.php b/src/Core/Addon.php index 68ea88483..aaca0d570 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -6,7 +6,6 @@ namespace Friendica\Core; use Friendica\App; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -80,7 +79,7 @@ class Addon $addons = Config::get('system', 'addon'); if (strlen($addons)) { $r = DBA::select('addon', [], ['installed' => 1]); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $installed = DBA::toArray($r); } else { $installed = []; diff --git a/src/Core/Cache/DatabaseCacheDriver.php b/src/Core/Cache/DatabaseCacheDriver.php index 2c85d5232..579574f03 100644 --- a/src/Core/Cache/DatabaseCacheDriver.php +++ b/src/Core/Cache/DatabaseCacheDriver.php @@ -4,7 +4,6 @@ namespace Friendica\Core\Cache; use Friendica\Core\Cache; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; /** @@ -18,7 +17,7 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver { $cache = DBA::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]); - if (DBM::is_result($cache)) { + if (DBA::is_result($cache)) { $cached = $cache['v']; $value = @unserialize($cached); diff --git a/src/Core/Config/JITConfigAdapter.php b/src/Core/Config/JITConfigAdapter.php index 7b0c6b417..631427ef4 100644 --- a/src/Core/Config/JITConfigAdapter.php +++ b/src/Core/Config/JITConfigAdapter.php @@ -3,7 +3,6 @@ namespace Friendica\Core\Config; use Friendica\BaseObject; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -57,7 +56,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter } $config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]); - if (DBM::is_result($config)) { + if (DBA::is_result($config)) { // manage array value $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']); diff --git a/src/Core/Config/JITPConfigAdapter.php b/src/Core/Config/JITPConfigAdapter.php index 07b15a360..4ba4f0199 100644 --- a/src/Core/Config/JITPConfigAdapter.php +++ b/src/Core/Config/JITPConfigAdapter.php @@ -3,7 +3,6 @@ namespace Friendica\Core\Config; use Friendica\BaseObject; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -23,7 +22,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter $a = self::getApp(); $pconfigs = DBA::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]); - if (DBM::is_result($pconfigs)) { + if (DBA::is_result($pconfigs)) { while ($pconfig = DBA::fetch($pconfigs)) { $k = $pconfig['k']; @@ -59,7 +58,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter } $pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]); - if (DBM::is_result($pconfig)) { + if (DBA::is_result($pconfig)) { $val = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']); self::getApp()->setPConfigValue($uid, $cat, $k, $val); diff --git a/src/Core/Config/PreloadConfigAdapter.php b/src/Core/Config/PreloadConfigAdapter.php index ec68665dc..152452eff 100644 --- a/src/Core/Config/PreloadConfigAdapter.php +++ b/src/Core/Config/PreloadConfigAdapter.php @@ -5,7 +5,6 @@ namespace Friendica\Core\Config; use Exception; use Friendica\BaseObject; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -44,7 +43,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter { if ($refresh) { $config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]); - if (DBM::is_result($config)) { + if (DBA::is_result($config)) { self::getApp()->setConfigValue($cat, $k, $config['v']); } } diff --git a/src/Core/Config/PreloadPConfigAdapter.php b/src/Core/Config/PreloadPConfigAdapter.php index 07d0adb44..606a85aa6 100644 --- a/src/Core/Config/PreloadPConfigAdapter.php +++ b/src/Core/Config/PreloadPConfigAdapter.php @@ -5,7 +5,6 @@ namespace Friendica\Core\Config; use Exception; use Friendica\BaseObject; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -52,7 +51,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter if ($refresh) { $config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]); - if (DBM::is_result($config)) { + if (DBA::is_result($config)) { self::getApp()->setPConfigValue($uid, $cat, $k, $config['v']); } else { self::getApp()->deletePConfigValue($uid, $cat, $k); diff --git a/src/Core/Console/GlobalCommunitySilence.php b/src/Core/Console/GlobalCommunitySilence.php index 6220a507f..d583a747a 100644 --- a/src/Core/Console/GlobalCommunitySilence.php +++ b/src/Core/Console/GlobalCommunitySilence.php @@ -4,7 +4,6 @@ namespace Friendica\Core\Console; use Friendica\Core\Protocol; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Network\Probe; use RuntimeException; @@ -82,7 +81,7 @@ HELP; $nurl = normalise_link($net['url']); $contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]); $this->out('NOTICE: The account should be silenced from the global community page'); } else { diff --git a/src/Core/Console/NewPassword.php b/src/Core/Console/NewPassword.php index 6a00e3488..4f687ad9b 100644 --- a/src/Core/Console/NewPassword.php +++ b/src/Core/Console/NewPassword.php @@ -5,7 +5,6 @@ namespace Friendica\Core\Console; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; use RuntimeException; @@ -65,7 +64,7 @@ HELP; $nick = $this->getArgument(0); $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { throw new RuntimeException(L10n::t('User not found')); } diff --git a/src/Core/Lock/DatabaseLockDriver.php b/src/Core/Lock/DatabaseLockDriver.php index b46d17125..2b28538d2 100644 --- a/src/Core/Lock/DatabaseLockDriver.php +++ b/src/Core/Lock/DatabaseLockDriver.php @@ -4,7 +4,6 @@ namespace Friendica\Core\Lock; use Friendica\Core\Cache; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; /** @@ -24,7 +23,7 @@ class DatabaseLockDriver extends AbstractLockDriver DBA::lock('locks'); $lock = DBA::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]); - if (DBM::is_result($lock)) { + if (DBA::is_result($lock)) { if ($lock['locked']) { // We want to lock something that was already locked by us? So we got the lock. if ($lock['pid'] == getmypid()) { @@ -80,7 +79,7 @@ class DatabaseLockDriver extends AbstractLockDriver { $lock = DBA::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]); - if (DBM::is_result($lock)) { + if (DBA::is_result($lock)) { return $lock['locked'] !== false; } else { return false; diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index 8e4d2a76e..3f231d151 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -9,7 +9,7 @@ namespace Friendica\Core; use Friendica\BaseObject; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Util\DateTimeFormat; @@ -96,7 +96,7 @@ class NotificationsManager extends BaseObject intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $this->_set_extra($r); } @@ -116,7 +116,7 @@ class NotificationsManager extends BaseObject intval($id), intval(local_user()) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $this->_set_extra($r)[0]; } return null; @@ -224,7 +224,7 @@ class NotificationsManager extends BaseObject $notif = []; $arr = []; - if (DBM::is_result($notifs)) { + if (DBA::is_result($notifs)) { foreach ($notifs as $it) { // Because we use different db tables for the notification query // we have sometimes $it['unseen'] and sometimes $it['seen]. @@ -405,7 +405,7 @@ class NotificationsManager extends BaseObject $items = Item::selectForUser(local_user(), $fields, $condition, $params); - if (DBM::is_result($items)) { + if (DBA::is_result($items)) { $notifs = $this->formatNotifs(Item::inArray($items), $ident); } @@ -447,7 +447,7 @@ class NotificationsManager extends BaseObject intval($limit) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $notifs = $this->formatNotifs($r, $ident); } @@ -492,7 +492,7 @@ class NotificationsManager extends BaseObject $items = Item::selectForUser(local_user(), $fields, $condition, $params); - if (DBM::is_result($items)) { + if (DBA::is_result($items)) { $notifs = $this->formatNotifs(Item::inArray($items), $ident); } @@ -532,7 +532,7 @@ class NotificationsManager extends BaseObject $params = ['order' => ['created' => true], 'limit' => [$start, $limit]]; $items = Item::selectForUser(local_user(), $fields, $condition, $params); - if (DBM::is_result($items)) { + if (DBA::is_result($items)) { $notifs = $this->formatNotifs(Item::inArray($items), $ident); } @@ -584,7 +584,7 @@ class NotificationsManager extends BaseObject intval($start), intval($limit) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $notifs = $this->formatIntros($r); } diff --git a/src/Core/Session/DatabaseSessionHandler.php b/src/Core/Session/DatabaseSessionHandler.php index f9ceaabaf..5486b129a 100644 --- a/src/Core/Session/DatabaseSessionHandler.php +++ b/src/Core/Session/DatabaseSessionHandler.php @@ -5,7 +5,6 @@ namespace Friendica\Core\Session; use Friendica\BaseObject; use Friendica\Core\Session; use Friendica\Database\DBA; -use Friendica\Database\DBM; use SessionHandlerInterface; require_once 'boot.php'; @@ -31,7 +30,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa } $session = DBA::selectFirst('session', ['data'], ['sid' => $session_id]); - if (DBM::is_result($session)) { + if (DBA::is_result($session)) { Session::$exists = true; return $session['data']; } diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 5f1093c84..11dda93e3 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -5,7 +5,6 @@ namespace Friendica\Core; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Process; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -163,7 +162,7 @@ class Worker { $condition = ["`executed` <= ? AND NOT `done`", NULL_DATE]; $workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]); - if (DBM::is_result($workerqueue)) { + if (DBA::is_result($workerqueue)) { return $workerqueue["priority"]; } else { return 0; @@ -478,7 +477,7 @@ class Worker if ($max == 0) { // the maximum number of possible user connections can be a system variable $r = DBA::fetchFirst("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $max = $r["Value"]; } // Or it can be granted. This overrides the system variable @@ -514,7 +513,7 @@ class Worker // We will now check for the system values. // This limit could be reached although the user limits are fine. $r = DBA::fetchFirst("SHOW VARIABLES WHERE `variable_name` = 'max_connections'"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } $max = intval($r["Value"]); @@ -522,7 +521,7 @@ class Worker return false; } $r = DBA::fetchFirst("SHOW STATUS WHERE `variable_name` = 'Threads_connected'"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } $used = intval($r["Value"]); @@ -735,7 +734,7 @@ class Worker ); // No active processes at all? Fine - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } $priorities = []; @@ -872,7 +871,7 @@ class Worker // There can already be jobs for us in the queue. $r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { self::$db_duration += (microtime(true) - $stamp); return DBA::toArray($r); } @@ -1164,7 +1163,7 @@ class Worker $row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => 1]); // When we don't have a row, no job is running - if (!DBM::is_result($row)) { + if (!DBA::is_result($row)) { return false; } diff --git a/src/Database/DBA.php b/src/Database/DBA.php index daa90314e..bc13b7507 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -216,7 +216,7 @@ class DBA } $r = self::p("EXPLAIN ".$query); - if (!DBM::is_result($r)) { + if (!self::is_result($r)) { return; } @@ -269,7 +269,7 @@ class DBA switch (self::$driver) { case 'pdo': $r = self::p("SELECT 1"); - if (DBM::is_result($r)) { + if (self::is_result($r)) { $row = self::toArray($r); $connected = ($row[0]['1'] == '1'); } diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 708a20b45..80ea85c2c 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -29,7 +29,7 @@ class DBStructure $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'", dbesc(DBA::databaseName())); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { echo L10n::t('There are no tables on MyISAM.')."\n"; return; } @@ -39,7 +39,7 @@ class DBStructure echo $sql."\n"; $result = DBA::e($sql); - if (!DBM::is_result($result)) { + if (!DBA::is_result($result)) { self::printUpdateError($sql); } } @@ -61,7 +61,7 @@ class DBStructure ); // No valid result? - if (!DBM::is_result($adminlist)) { + if (!DBA::is_result($adminlist)) { logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_INFO); // Don't continue @@ -105,7 +105,7 @@ class DBStructure $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table); - if (DBM::is_result($table_status)) { + if (DBA::is_result($table_status)) { $table_status = $table_status[0]; } else { $table_status = []; @@ -114,7 +114,7 @@ class DBStructure $fielddata = []; $indexdata = []; - if (DBM::is_result($indexes)) { + if (DBA::is_result($indexes)) { foreach ($indexes AS $index) { if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) { $indexdata[$index["Key_name"]] = ['UNIQUE']; @@ -129,7 +129,7 @@ class DBStructure $indexdata[$index["Key_name"]][] = $column; } } - if (DBM::is_result($structures)) { + if (DBA::is_result($structures)) { foreach ($structures AS $field) { // Replace the default size values so that we don't have to define them $search = ['tinyint(1)', 'tinyint(3) unsigned', 'tinyint(4)', 'smallint(5) unsigned', 'smallint(6)', 'mediumint(8) unsigned', 'mediumint(9)', 'bigint(20)', 'int(10) unsigned', 'int(11)']; @@ -154,7 +154,7 @@ class DBStructure } } } - if (DBM::is_result($full_columns)) { + if (DBA::is_result($full_columns)) { foreach ($full_columns AS $column) { $fielddata[$column["Field"]]["Collation"] = $column["Collation"]; $fielddata[$column["Field"]]["comment"] = $column["Comment"]; @@ -222,7 +222,7 @@ class DBStructure $tables = q("SHOW TABLES"); } - if (DBM::is_result($tables)) { + if (DBA::is_result($tables)) { foreach ($tables AS $table) { $table = current($table); @@ -253,7 +253,7 @@ class DBStructure $temp_name = $name; if (!isset($database[$name])) { $r = self::createTable($name, $structure, $verbose, $action); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($name); } $is_new_table = true; @@ -479,13 +479,13 @@ class DBStructure DBA::e("SET session old_alter_table=1;"); } else { $r = DBA::e("DROP TABLE IF EXISTS `".$temp_name."`;"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($sql3); return $errors; } $r = DBA::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($sql3); return $errors; } @@ -493,7 +493,7 @@ class DBStructure } $r = DBA::e($sql3); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($sql3); } if ($is_unique && ($temp_name != $name)) { @@ -501,17 +501,17 @@ class DBStructure DBA::e("SET session old_alter_table=0;"); } else { $r = DBA::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($sql3); return $errors; } $r = DBA::e("DROP TABLE `".$name."`;"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($sql3); return $errors; } $r = DBA::e("RENAME TABLE `".$temp_name."` TO `".$name."`;"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $errors .= self::printUpdateError($sql3); return $errors; } diff --git a/src/Database/PostUpdate.php b/src/Database/PostUpdate.php index 0a75a0f19..4d4b31008 100644 --- a/src/Database/PostUpdate.php +++ b/src/Database/PostUpdate.php @@ -146,7 +146,7 @@ class PostUpdate (`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)"); logger("Updated threads", LOGGER_DEBUG); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { Config::set("system", "post_update_version", 1198); logger("Done", LOGGER_DEBUG); return true; @@ -207,7 +207,7 @@ class PostUpdate FROM `user` INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } foreach ($r as $user) { diff --git a/src/Model/Contact.php b/src/Model/Contact.php index c6e270b6e..b2b7e0972 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -12,7 +12,6 @@ use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Network\Probe; use Friendica\Object\Image; use Friendica\Protocol\Diaspora; @@ -54,7 +53,7 @@ class Contact extends BaseObject $gid, local_user() ); - if (DBM::is_result($stmt)) { + if (DBA::is_result($stmt)) { $return = DBA::toArray($stmt); } } @@ -104,7 +103,7 @@ class Contact extends BaseObject } $user = DBA::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return false; } @@ -147,20 +146,20 @@ class Contact extends BaseObject $fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'gender', 'avatar', 'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'nurl']; $self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]); - if (!DBM::is_result($self)) { + if (!DBA::is_result($self)) { return; } $fields = ['nickname', 'page-flags', 'account-type']; $user = DBA::selectFirst('user', $fields, ['uid' => $uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return; } $fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region', 'country-name', 'gender', 'pub_keywords', 'xmpp']; $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]); - if (!DBM::is_result($profile)) { + if (!DBA::is_result($profile)) { return; } @@ -171,7 +170,7 @@ class Contact extends BaseObject 'contact-type' => $user['account-type'], 'xmpp' => $profile['xmpp']]; $avatar = DBA::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]); - if (DBM::is_result($avatar)) { + if (DBA::is_result($avatar)) { if ($update_avatar) { $fields['avatar-date'] = DateTimeFormat::utcNow(); } @@ -245,7 +244,7 @@ class Contact extends BaseObject { // We want just to make sure that we don't delete our "self" contact $contact = DBA::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]); - if (!DBM::is_result($contact) || !intval($contact['uid'])) { + if (!DBA::is_result($contact) || !intval($contact['uid'])) { return; } @@ -404,7 +403,7 @@ class Contact extends BaseObject $r = DBA::toArray($s); // Fetch contact data from the contact table for the given user, checking with the alias - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self` FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = ?", normalise_link($url), $url, $ssl_url, $uid); @@ -412,7 +411,7 @@ class Contact extends BaseObject } // Fetch the data from the contact table with "uid=0" (which is filled automatically) - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self` FROM `contact` WHERE `nurl` = ? AND `uid` = 0", normalise_link($url)); @@ -420,7 +419,7 @@ class Contact extends BaseObject } // Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self` FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = 0", normalise_link($url), $url, $ssl_url); @@ -428,14 +427,14 @@ class Contact extends BaseObject } // Fetch the data from the gcontact table - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $s = DBA::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`, `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, 0 AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self` FROM `gcontact` WHERE `nurl` = ?", normalise_link($url)); $r = DBA::toArray($s); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // If there is more than one entry we filter out the connector networks if (count($r) > 1) { foreach ($r as $id => $result) { @@ -541,7 +540,7 @@ class Contact extends BaseObject intval($uid) ); // Fetch the data from the contact table with "uid=0" (which is filled automatically) - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self` FROM `contact` WHERE `addr` = '%s' AND `uid` = 0", @@ -550,7 +549,7 @@ class Contact extends BaseObject } // Fetch the data from the gcontact table - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`, `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self` FROM `gcontact` WHERE `addr` = '%s'", @@ -558,7 +557,7 @@ class Contact extends BaseObject ); } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $data = Probe::uri($addr); $profile = self::getDetailsByURL($data['url'], $uid); @@ -603,7 +602,7 @@ class Contact extends BaseObject // Look for our own contact if the uid doesn't match and isn't public $contact_own = DBA::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]); - if (DBM::is_result($contact_own)) { + if (DBA::is_result($contact_own)) { return self::photoMenu($contact_own, $uid); } else { $profile_link = self::magicLink($contact['url']); @@ -749,19 +748,19 @@ class Contact extends BaseObject $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]); // Then the addr (nick@server.tld) - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]); } // Then the alias (which could be anything) - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { // The link could be provided as http although we stored it as https $ssl_url = str_replace('http://', 'https://', $url); $condition = ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid]; $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition); } - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $contact_id = $contact["id"]; // Update the contact every 7 days @@ -791,25 +790,25 @@ class Contact extends BaseObject // Get data from the gcontact table $fields = ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network']; $contact = DBA::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $contact = DBA::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]); } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick', 'photo', 'keywords', 'location', 'about', 'network', 'priority', 'batch', 'request', 'confirm', 'poco']; $contact = DBA::selectFirst('contact', $fields, ['addr' => $url]); } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { // The link could be provided as http although we stored it as https $ssl_url = str_replace('http://', 'https://', $url); $condition = ['alias' => [$url, normalise_link($url), $ssl_url]]; $contact = DBA::selectFirst('contact', $fields, $condition); } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick', 'photo', 'network', 'priority', 'batch', 'request', 'confirm']; $condition = ['url' => [$url, normalise_link($url), $ssl_url]]; @@ -820,7 +819,7 @@ class Contact extends BaseObject $contact = $default; } - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return 0; } else { $data = array_merge($data, $contact); @@ -867,7 +866,7 @@ class Contact extends BaseObject $s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]); $contacts = DBA::toArray($s); - if (!DBM::is_result($contacts)) { + if (!DBA::is_result($contacts)) { return 0; } @@ -875,7 +874,7 @@ class Contact extends BaseObject // Update the newly created contact from data in the gcontact table $gcontact = DBA::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]); - if (DBM::is_result($gcontact)) { + if (DBA::is_result($gcontact)) { // Only use the information when the probing hadn't fetched these values if ($data['keywords'] != '') { unset($gcontact['keywords']); @@ -901,7 +900,7 @@ class Contact extends BaseObject $contact = DBA::selectFirst('contact', $fields, ['id' => $contact_id]); // This condition should always be true - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return $contact_id; } @@ -972,7 +971,7 @@ class Contact extends BaseObject } $blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]); - if (!DBM::is_result($blocked)) { + if (!DBA::is_result($blocked)) { return false; } return (bool) $blocked['blocked']; @@ -992,7 +991,7 @@ class Contact extends BaseObject } $hidden = DBA::selectFirst('contact', ['hidden'], ['id' => $cid]); - if (!DBM::is_result($hidden)) { + if (!DBA::is_result($hidden)) { return false; } return (bool) $hidden['hidden']; @@ -1018,7 +1017,7 @@ class Contact extends BaseObject dbesc(normalise_link($contact_url)) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return ''; } @@ -1138,7 +1137,7 @@ class Contact extends BaseObject public static function updateAvatar($avatar, $uid, $cid, $force = false) { $contact = DBA::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return false; } else { $data = [$contact["photo"], $contact["thumb"], $contact["micro"]]; @@ -1157,7 +1156,7 @@ class Contact extends BaseObject // Update the public contact (contact id = 0) if ($uid != 0) { $pcontact = DBA::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]); - if (DBM::is_result($pcontact)) { + if (DBA::is_result($pcontact)) { self::updateAvatar($avatar, 0, $pcontact['id'], $force); } } @@ -1182,7 +1181,7 @@ class Contact extends BaseObject $fields = ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network']; $contact = DBA::selectFirst('contact', $fields, ['id' => $id]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return false; } @@ -1303,7 +1302,7 @@ class Contact extends BaseObject dbesc($ret['network']) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` = '%s' AND NOT `pending` LIMIT 1", intval($uid), dbesc(normalise_link($url)), @@ -1311,7 +1310,7 @@ class Contact extends BaseObject ); } - if (($ret['network'] === NETWORK_DFRN) && !DBM::is_result($r)) { + if (($ret['network'] === NETWORK_DFRN) && !DBA::is_result($r)) { if ($interactive) { if (strlen($a->urlpath)) { $myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']); @@ -1373,7 +1372,7 @@ class Contact extends BaseObject $writeable = 1; } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // update contact $new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING); @@ -1410,7 +1409,7 @@ class Contact extends BaseObject } $contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { $result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL; return $result; } @@ -1432,7 +1431,7 @@ class Contact extends BaseObject intval($uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN])) { // create a follow slap $item = []; @@ -1541,7 +1540,7 @@ class Contact extends BaseObject /// @TODO Encapsulate this into a function/method $fields = ['uid', 'username', 'email', 'page-flags', 'notify-flags', 'language']; $user = DBA::selectFirst('user', $fields, ['uid' => $importer['uid']]); - if (DBM::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) { + if (DBA::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) { // create notification $hash = random_string(); @@ -1572,7 +1571,7 @@ class Contact extends BaseObject ]); } - } elseif (DBM::is_result($user) && in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) { + } elseif (DBA::is_result($user) && in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) { q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1", intval($importer['uid']), dbesc($url) @@ -1610,7 +1609,7 @@ class Contact extends BaseObject // In-network birthdays are handled within local_delivery $r = q("SELECT * FROM `contact` WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`, 1, 4) != `bdyear` "); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { logger('update_contact_birthday: ' . $rr['bd']); @@ -1628,7 +1627,7 @@ class Contact extends BaseObject $s = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1", intval($rr['uid']), intval($rr['id']), dbesc(DateTimeFormat::utc($nextbd)), dbesc('birthday')); - if (DBM::is_result($s)) { + if (DBA::is_result($s)) { continue; } diff --git a/src/Model/Conversation.php b/src/Model/Conversation.php index 3113d5389..32004d911 100644 --- a/src/Model/Conversation.php +++ b/src/Model/Conversation.php @@ -5,7 +5,6 @@ namespace Friendica\Model; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; require_once "include/dba.php"; @@ -55,7 +54,7 @@ class Conversation $fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source']; $old_conv = DBA::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]); - if (DBM::is_result($old_conv)) { + if (DBA::is_result($old_conv)) { // Don't update when only the source has changed. // Only do this when there had been no source before. if ($old_conv['source'] != '') { diff --git a/src/Model/Event.php b/src/Model/Event.php index c7dc57a93..4392686a5 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -12,7 +12,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; @@ -267,11 +266,11 @@ class Event extends BaseObject if ($event['id']) { // has the event actually changed? $existing_event = DBA::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]); - if (!DBM::is_result($existing_event) || ($existing_event['edited'] === $event['edited'])) { + if (!DBA::is_result($existing_event) || ($existing_event['edited'] === $event['edited'])) { $item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]); - return DBM::is_result($item) ? $item['id'] : 0; + return DBA::is_result($item) ? $item['id'] : 0; } $updated_fields = [ @@ -289,7 +288,7 @@ class Event extends BaseObject DBA::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]); $item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $object = '' . xmlify(ACTIVITY_OBJ_EVENT) . '' . xmlify($event['uri']) . ''; $object .= '' . xmlify(self::getBBCode($event)) . ''; $object .= '' . "\n"; @@ -470,7 +469,7 @@ class Event extends BaseObject intval($event_id) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $return = self::removeDuplicates($r); } @@ -519,7 +518,7 @@ class Event extends BaseObject dbesc($event_params["adjust_finish"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $return = self::removeDuplicates($r); } @@ -540,7 +539,7 @@ class Event extends BaseObject $fmt = L10n::t('l, F j'); foreach ($event_result as $event) { $item = Item::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link'], ['id' => $event['itemid']]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $event = array_merge($event, $item); } @@ -738,7 +737,7 @@ class Event extends BaseObject } $events = DBA::select('event', $fields, $conditions); - if (DBM::is_result($events)) { + if (DBA::is_result($events)) { $return = DBA::toArray($events); } @@ -762,7 +761,7 @@ class Event extends BaseObject $process = false; $user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $timezone = $user['timezone']; } diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 6a6f6cd34..6b585f5be 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -11,7 +11,6 @@ use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Network\Probe; use Friendica\Protocol\PortableContact; use Friendica\Util\DateTimeFormat; @@ -106,7 +105,7 @@ class GContact intval($zcid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { q( "INSERT INTO `glink` (`cid`, `uid`, `gcid`, `zcid`, `updated`) VALUES (%d, %d, %d, %d, '%s') ", intval($cid), @@ -180,7 +179,7 @@ class GContact dbesc(normalise_link($gcontact['url'])), dbesc(NETWORK_STATUSNET) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $gcontact['network'] = $r[0]["network"]; } @@ -191,7 +190,7 @@ class GContact dbesc(normalise_link($gcontact['url'])), dbesc(NETWORK_STATUSNET) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $gcontact['network'] = $r[0]["network"]; } } @@ -205,7 +204,7 @@ class GContact dbesc(normalise_link($gcontact['url'])) ); - if (DBM::is_result($x)) { + if (DBA::is_result($x)) { if (!isset($gcontact['network']) && ($x[0]["network"] != NETWORK_STATUSNET)) { $gcontact['network'] = $x[0]["network"]; } @@ -290,7 +289,7 @@ class GContact ); // logger("countCommonFriends: $uid $cid {$r[0]['total']}"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $r[0]['total']; } return 0; @@ -312,7 +311,7 @@ class GContact intval($uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $r[0]['total']; } @@ -353,7 +352,7 @@ class GContact intval($limit) ); - /// @TODO Check all calling-findings of this function if they properly use DBM::is_result() + /// @TODO Check all calling-findings of this function if they properly use DBA::is_result() return $r; } @@ -385,7 +384,7 @@ class GContact intval($limit) ); - /// @TODO Check all calling-findings of this function if they properly use DBM::is_result() + /// @TODO Check all calling-findings of this function if they properly use DBA::is_result() return $r; } @@ -405,7 +404,7 @@ class GContact intval($uid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $r[0]['total']; } @@ -436,7 +435,7 @@ class GContact intval($limit) ); - /// @TODO Check all calling-findings of this function if they properly use DBM::is_result() + /// @TODO Check all calling-findings of this function if they properly use DBA::is_result() return $r; } @@ -496,7 +495,7 @@ class GContact intval($limit) ); - if (DBM::is_result($r) && count($r) >= ($limit -1)) { + if (DBA::is_result($r) && count($r) >= ($limit -1)) { /* * Uncommented because the result of the queries are to big to store it in the cache. * We need to decide if we want to change the db column type or if we want to delete it. @@ -585,7 +584,7 @@ class GContact dbesc(NETWORK_DIASPORA) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $base = substr($rr['poco'], 0, strrpos($rr['poco'], '/')); if (! in_array($base, $done)) { @@ -694,7 +693,7 @@ class GContact dbesc(normalise_link($contact["url"])) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $gcontact_id = $r[0]["id"]; // Update every 90 days @@ -729,7 +728,7 @@ class GContact dbesc(normalise_link($contact["url"])) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $gcontact_id = $r[0]["id"]; $doprobing = in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""]); @@ -878,7 +877,7 @@ class GContact /// @todo Check if we really should do this. // The quality of the gcontact table is mostly lower than the public contact $public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]); - if (DBM::is_result($public_contact)) { + if (DBA::is_result($public_contact)) { logger("Update public contact ".$public_contact["id"], LOGGER_DEBUG); Contact::updateAvatar($contact["photo"], 0, $public_contact["id"]); @@ -1053,7 +1052,7 @@ class GContact dbesc($last_update) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -1076,7 +1075,7 @@ class GContact dbesc(NETWORK_DFRN) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return dirname($r[0]['url']); } diff --git a/src/Model/Group.php b/src/Model/Group.php index f789e98ad..32ef7593d 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -7,7 +7,6 @@ namespace Friendica\Model; use Friendica\BaseObject; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'boot.php'; require_once 'include/dba.php'; @@ -39,7 +38,7 @@ class Group extends BaseObject // access lists. What we're doing here is reviving the dead group, but old content which // was restricted to this group may now be seen by the new group members. $group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]); - if (DBM::is_result($group) && $group['deleted']) { + if (DBA::is_result($group) && $group['deleted']) { DBA::update('group', ['deleted' => 0], ['id' => $gid]); notice(L10n::t('A deleted group with this name was revived. Existing item permissions may apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL); } @@ -133,7 +132,7 @@ class Group extends BaseObject } $group = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]); - if (DBM::is_result($group)) { + if (DBA::is_result($group)) { return $group['id']; } @@ -152,13 +151,13 @@ class Group extends BaseObject } $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]); - if (!DBM::is_result($group)) { + if (!DBA::is_result($group)) { return false; } // remove group from default posting lists $user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $change = false; if ($user['def_gid'] == $gid) { diff --git a/src/Model/Item.php b/src/Model/Item.php index 46d0187da..0d5038d54 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -15,7 +15,6 @@ use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Object\Image; use Friendica\Protocol\Diaspora; use Friendica\Protocol\OStatus; @@ -819,7 +818,7 @@ class Item extends BaseObject // Fetch the uri-hash from an existing item entry if there is one $item_condition = ["`uri` = ? AND `uri-hash` != ''", $item['uri']]; $existing = DBA::selectfirst('item', ['uri-hash'], $item_condition); - if (DBM::is_result($existing)) { + if (DBA::is_result($existing)) { $item['uri-hash'] = $existing['uri-hash']; } else { $item['uri-hash'] = self::itemHash($item['uri'], $item['created']); @@ -840,7 +839,7 @@ class Item extends BaseObject if (empty($item['iaid'])) { $item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]); - if (DBM::is_result($item_activity)) { + if (DBA::is_result($item_activity)) { $item_fields = ['iaid' => $item_activity['id'], 'icid' => null]; foreach (self::MIXED_CONTENT_FIELDLIST as $field) { if (self::isLegacyMode()) { @@ -872,7 +871,7 @@ class Item extends BaseObject if (empty($item['icid'])) { $item_content = DBA::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]); - if (DBM::is_result($item_content)) { + if (DBA::is_result($item_content)) { $item_fields = ['icid' => $item_content['id']]; // Clear all fields in the item table that have a content in the item-content table foreach ($item_content as $field => $content) { @@ -975,7 +974,7 @@ class Item extends BaseObject 'deleted', 'file', 'resource-id', 'event-id', 'attach', 'verb', 'object-type', 'object', 'target', 'contact-id']; $item = self::selectFirst($fields, ['id' => $item_id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { logger('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG); return false; } @@ -986,7 +985,7 @@ class Item extends BaseObject } $parent = self::selectFirst(['origin'], ['id' => $item['parent']]); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { $parent = ['origin' => false]; } @@ -1070,7 +1069,7 @@ class Item extends BaseObject // When we delete just our local user copy of an item, we have to set a marker to hide it $global_item = self::selectFirst(['id'], ['uri' => $item['uri'], 'uid' => 0, 'deleted' => false]); - if (DBM::is_result($global_item)) { + if (DBA::is_result($global_item)) { DBA::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true); } } @@ -1094,7 +1093,7 @@ class Item extends BaseObject } $i = self::selectFirst(['id', 'contact-id', 'tag'], ['uri' => $xt->id, 'uid' => $item['uid']]); - if (!DBM::is_result($i)) { + if (!DBA::is_result($i)) { return; } @@ -1195,7 +1194,7 @@ class Item extends BaseObject // Still missing? Then use the "self" contact of the current user if ($contact_id == 0) { $self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $item['uid']]); - if (DBM::is_result($self)) { + if (DBA::is_result($self)) { $contact_id = $self["id"]; } } @@ -1291,7 +1290,7 @@ class Item extends BaseObject $expire_interval = Config::get('system', 'dbclean-expire-days', 0); $user = DBA::selectFirst('user', ['expire'], ['uid' => $uid]); - if (DBM::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) { + if (DBA::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) { $expire_interval = $user['expire']; } @@ -1314,7 +1313,7 @@ class Item extends BaseObject trim($item['uri']), $item['uid'], NETWORK_DIASPORA, NETWORK_DFRN, NETWORK_OSTATUS]; $existing = self::selectFirst(['id', 'network'], $condition); - if (DBM::is_result($existing)) { + if (DBA::is_result($existing)) { // We only log the entries with a different user id than 0. Otherwise we would have too many false positives if ($uid != 0) { logger("Item with uri ".$item['uri']." already existed for user ".$uid." with id ".$existing["id"]." target network ".$existing["network"]." - new network: ".$item['network']); @@ -1326,7 +1325,7 @@ class Item extends BaseObject // Ensure to always have the same creation date. $existing = DBA::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]); - if (DBM::is_result($existing)) { + if (DBA::is_result($existing)) { $item['created'] = $existing['created']; $item['uri-hash'] = $existing['uri-hash']; } @@ -1473,7 +1472,7 @@ class Item extends BaseObject $params = ['order' => ['id' => false]]; $parent = self::selectFirst($fields, $condition, $params); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { // is the new message multi-level threaded? // even though we don't support it now, preserve the info // and re-attach to the conversation parent. @@ -1487,7 +1486,7 @@ class Item extends BaseObject $params = ['order' => ['id' => false]]; $toplevel_parent = self::selectFirst($fields, $condition, $params); - if (DBM::is_result($toplevel_parent)) { + if (DBA::is_result($toplevel_parent)) { $parent = $toplevel_parent; } } @@ -1522,7 +1521,7 @@ class Item extends BaseObject // If its a post from myself then tag the thread as "mention" logger("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], LOGGER_DEBUG); $user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']); $self_id = Contact::getIdForURL($self, 0, true); logger("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], LOGGER_DEBUG); @@ -1667,7 +1666,7 @@ class Item extends BaseObject $ret = DBA::insert('item', $item); // When the item was successfully stored we fetch the ID of the item. - if (DBM::is_result($ret)) { + if (DBA::is_result($ret)) { $current_post = DBA::lastInsertId(); } else { // This can happen - for example - if there are locking timeouts. @@ -1772,7 +1771,7 @@ class Item extends BaseObject */ if (!$deleted && !$dontcache) { $posted_item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $current_post]); - if (DBM::is_result($posted_item)) { + if (DBA::is_result($posted_item)) { if ($notify) { Addon::callHooks('post_local_end', $posted_item); } else { @@ -1882,7 +1881,7 @@ class Item extends BaseObject // Do we already have this content? $item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]); - if (DBM::is_result($item_activity)) { + if (DBA::is_result($item_activity)) { $item['iaid'] = $item_activity['id']; logger('Fetched activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')'); } elseif (DBA::insert('item-activity', $fields)) { @@ -1923,7 +1922,7 @@ class Item extends BaseObject // Do we already have this content? $item_content = DBA::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]); - if (DBM::is_result($item_content)) { + if (DBA::is_result($item_content)) { $item['icid'] = $item_content['id']; logger('Fetched content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')'); } elseif (DBA::insert('item-content', $fields)) { @@ -2001,7 +2000,7 @@ class Item extends BaseObject { $condition = ["`id` IN (SELECT `parent` FROM `item` WHERE `id` = ?)", $itemid]; $parent = self::selectFirst(['owner-id'], $condition); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { return; } @@ -2010,7 +2009,7 @@ class Item extends BaseObject 'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""], 'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false]; $item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return; } @@ -2072,7 +2071,7 @@ class Item extends BaseObject if (empty($item['contact-id'])) { $self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]); - if (!DBM::is_result($self)) { + if (!DBA::is_result($self)) { return; } $item['contact-id'] = $self['id']; @@ -2083,7 +2082,7 @@ class Item extends BaseObject $notify = false; if ($item['uri'] == $item['parent-uri']) { $contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $notify = self::isRemoteSelf($contact, $item); } } @@ -2112,7 +2111,7 @@ class Item extends BaseObject $condition = ['id' => $itemid, 'parent' => [0, $itemid]]; $item = self::selectFirst($fields, $condition); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return; } @@ -2137,7 +2136,7 @@ class Item extends BaseObject $item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { // Preparing public shadow (removing user specific data) $item['uid'] = 0; unset($item['id']); @@ -2170,7 +2169,7 @@ class Item extends BaseObject public static function addShadowPost($itemid) { $item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return; } @@ -2303,13 +2302,13 @@ class Item extends BaseObject { // Unarchive the author $contact = DBA::selectFirst('contact', [], ['id' => $arr["author-id"]]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { Contact::unmarkForArchival($contact); } // Unarchive the contact if it's not our own contact $contact = DBA::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { Contact::unmarkForArchival($contact); } @@ -2409,7 +2408,7 @@ class Item extends BaseObject public static function getGuidById($id) { $item = self::selectFirst(['guid'], ['id' => $id]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { return $item['guid']; } else { return ''; @@ -2431,7 +2430,7 @@ class Item extends BaseObject INNER JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND `item`.`guid` = ? AND `item`.`uid` = ?", $guid, $uid); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $id = $item["id"]; $nick = $item["nickname"]; } @@ -2444,7 +2443,7 @@ class Item extends BaseObject WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND NOT `item`.`private` AND `item`.`wall` AND `item`.`guid` = ?", $guid); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $id = $item["id"]; $nick = $item["nickname"]; } @@ -2463,7 +2462,7 @@ class Item extends BaseObject $mention = false; $user = DBA::selectFirst('user', [], ['uid' => $uid]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return; } @@ -2471,7 +2470,7 @@ class Item extends BaseObject $prvgroup = (($user['page-flags'] == PAGE_PRVGROUP) ? true : false); $item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return; } @@ -2524,7 +2523,7 @@ class Item extends BaseObject // now change this copy of the post to a forum head message and deliver to all the tgroup members $self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $uid, 'self' => true]); - if (!DBM::is_result($self)) { + if (!DBA::is_result($self)) { return; } @@ -2582,7 +2581,7 @@ class Item extends BaseObject if ($contact['remote_self'] == 2) { $self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $contact['uid'], 'self' => true]); - if (DBM::is_result($self)) { + if (DBA::is_result($self)) { $datarray['contact-id'] = $self["id"]; $datarray['owner-name'] = $self["name"]; @@ -2676,7 +2675,7 @@ class Item extends BaseObject $i = substr($i, 0, $x); $fields = ['data', 'type', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']; $photo = DBA::selectFirst('photo', $fields, ['resource-id' => $i, 'scale' => $res, 'uid' => $uid]); - if (DBM::is_result($photo)) { + if (DBA::is_result($photo)) { /* * Check to see if we should replace this photo link with an embedded image * 1. No need to do so if the photo is public @@ -2841,7 +2840,7 @@ class Item extends BaseObject $items = self::select(['file', 'resource-id', 'starred', 'type', 'id'], $condition); - if (!DBM::is_result($items)) { + if (!DBA::is_result($items)) { return; } @@ -2890,7 +2889,7 @@ class Item extends BaseObject $condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false]; $params = ['order' => ['created' => false]]; $thread = DBA::selectFirst('thread', ['created'], $condition, $params); - if (DBM::is_result($thread)) { + if (DBA::is_result($thread)) { return substr(DateTimeFormat::local($thread['created']), 0, 10); } return false; @@ -2948,7 +2947,7 @@ class Item extends BaseObject logger('like: verb ' . $verb . ' item ' . $item_id); $item = self::selectFirst(self::ITEM_FIELDLIST, ['`id` = ? OR `uri` = ?', $item_id, $item_id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { logger('like: unknown item ' . $item_id); return false; } @@ -2967,7 +2966,7 @@ class Item extends BaseObject // Retrieves the local post owner $owner_self_contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'self' => true]); - if (!DBM::is_result($owner_self_contact)) { + if (!DBA::is_result($owner_self_contact)) { logger('like: unknown owner ' . $uid); return false; } @@ -2976,7 +2975,7 @@ class Item extends BaseObject $author_id = public_contact(); $author_contact = DBA::selectFirst('contact', ['url'], ['id' => $author_id]); - if (!DBM::is_result($author_contact)) { + if (!DBA::is_result($author_contact)) { logger('like: unknown author ' . $author_id); return false; } @@ -2988,7 +2987,7 @@ class Item extends BaseObject } else { $item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true); $item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]); - if (!DBM::is_result($item_contact)) { + if (!DBA::is_result($item_contact)) { logger('like: unknown item contact ' . $item_contact_id); return false; } @@ -3015,7 +3014,7 @@ class Item extends BaseObject $like_item = self::selectFirst(['id', 'guid', 'verb'], $condition); // If it exists, mark it as deleted - if (DBM::is_result($like_item)) { + if (DBA::is_result($like_item)) { // Already voted, undo it $fields = ['deleted' => true, 'unseen' => true, 'changed' => DateTimeFormat::utcNow()]; /// @todo Consider using self::update - but before doing so, check the side effects @@ -3090,7 +3089,7 @@ class Item extends BaseObject $condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid]; $item = self::selectFirst($fields, $condition); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return; } @@ -3111,7 +3110,7 @@ class Item extends BaseObject $condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid]; $item = self::selectFirst($fields, $condition); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return; } @@ -3137,7 +3136,7 @@ class Item extends BaseObject private static function deleteThread($itemid, $itemuri = "") { $item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { logger('No thread found for id '.$itemid, LOGGER_DEBUG); return; } diff --git a/src/Model/Mail.php b/src/Model/Mail.php index b56b65f72..514350e75 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -9,7 +9,6 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Network\Probe; use Friendica\Util\DateTimeFormat; @@ -62,7 +61,7 @@ class Mail dbesc($replyto), dbesc($replyto) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $convid = $r[0]['convid']; } } diff --git a/src/Model/OpenWebAuthToken.php b/src/Model/OpenWebAuthToken.php index a4c798501..cfb2fdd51 100644 --- a/src/Model/OpenWebAuthToken.php +++ b/src/Model/OpenWebAuthToken.php @@ -6,7 +6,6 @@ namespace Friendica\Model; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; /** @@ -50,7 +49,7 @@ class OpenWebAuthToken $condition = ["type" => $type, "uid" => $uid, "token" => $token]; $entry = DBA::selectFirst("openwebauth-token", ["id", "meta"], $condition); - if (DBM::is_result($entry)) { + if (DBA::is_result($entry)) { DBA::delete("openwebauth-token", ["id" => $entry["id"]]); return $entry["meta"]; diff --git a/src/Model/PermissionSet.php b/src/Model/PermissionSet.php index cae3663b3..ee6acf585 100644 --- a/src/Model/PermissionSet.php +++ b/src/Model/PermissionSet.php @@ -6,7 +6,6 @@ namespace Friendica\Model; use Friendica\BaseObject; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -31,7 +30,7 @@ class PermissionSet extends BaseObject $set = DBA::selectFirst('permissionset', ['id'], $condition); - if (!DBM::is_result($set)) { + if (!DBA::is_result($set)) { DBA::insert('permissionset', $condition, true); $set = DBA::selectFirst('permissionset', ['id'], $condition); diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 4c297bc4e..65f58e229 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -11,7 +11,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Object\Image; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -42,7 +41,7 @@ class Photo public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '') { $photo = DBA::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']); - if (DBM::is_result($photo)) { + if (DBA::is_result($photo)) { $guid = $photo['guid']; } else { $guid = System::createGUID(); @@ -73,7 +72,7 @@ class Photo 'desc' => $desc ]; - if (DBM::is_result($existing_photo)) { + if (DBA::is_result($existing_photo)) { $r = DBA::update('photo', $fields, ['id' => $existing_photo['id']]); } else { $r = DBA::insert('photo', $fields); diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 4bd3d59cf..11f44afe2 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -16,7 +16,6 @@ use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Protocol\Diaspora; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -91,7 +90,7 @@ class Profile { $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]); - if (!DBM::is_result($user) && empty($profiledata)) { + if (!DBA::is_result($user) && empty($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(L10n::t('Requested account is not available.') . EOL); $a->error = 404; @@ -102,7 +101,7 @@ class Profile // Add profile data to sidebar $a->page['aside'] .= self::sidebar($profiledata, true, $show_connect); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return; } } @@ -199,7 +198,7 @@ class Profile foreach ($_SESSION['remote'] as $visitor) { if ($visitor['uid'] == $uid) { $contact = DBA::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $profile_id = $contact['profile-id']; } break; @@ -223,7 +222,7 @@ class Profile intval($profile_id) ); } - if (!DBM::is_result($profile)) { + if (!DBA::is_result($profile)) { $profile = DBA::fetchFirst( "SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`, `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`, @@ -375,7 +374,7 @@ class Profile 'entries' => [], ]; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $profile['menu']['entries'][] = [ 'photo' => $rr['thumb'], @@ -453,7 +452,7 @@ class Profile "SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1", intval($a->profile['uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $updated = date('c', strtotime($r[0]['updated'])); } @@ -468,7 +467,7 @@ class Profile dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contacts = intval($r[0]['total']); } } @@ -556,7 +555,7 @@ class Profile DateTimeFormat::utc('now + 6 days'), DateTimeFormat::utcNow() ); - if (DBM::is_result($s)) { + if (DBA::is_result($s)) { $r = DBA::toArray($s); Cache::set($cachekey, $r, CACHE_HOUR); } @@ -564,7 +563,7 @@ class Profile $total = 0; $classtoday = ''; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $now = strtotime('now'); $cids = []; @@ -658,7 +657,7 @@ class Profile $r = []; - if (DBM::is_result($s)) { + if (DBA::is_result($s)) { $istoday = false; while ($rr = DBA::fetch($s)) { @@ -1027,7 +1026,7 @@ class Profile $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]); - if (DBM::is_result($contact) && remote_user() && remote_user() == $contact['id']) { + if (DBA::is_result($contact) && remote_user() && remote_user() == $contact['id']) { // The visitor is already authenticated. return; } diff --git a/src/Model/PushSubscriber.php b/src/Model/PushSubscriber.php index 73bcb2a90..079637605 100644 --- a/src/Model/PushSubscriber.php +++ b/src/Model/PushSubscriber.php @@ -6,7 +6,6 @@ namespace Friendica\Model; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; require_once 'include/dba.php'; @@ -74,7 +73,7 @@ class PushSubscriber if ($subscribe) { // if we are just updating an old subscription, keep the // old values for last_update but reset the push - if (DBM::is_result($subscriber)) { + if (DBA::is_result($subscriber)) { $last_update = $subscriber['last_update']; $push_flag = min($subscriber['push'], 1); } else { @@ -104,7 +103,7 @@ class PushSubscriber public static function delay($id) { $subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]); - if (!DBM::is_result($subscriber)) { + if (!DBA::is_result($subscriber)) { return; } @@ -142,7 +141,7 @@ class PushSubscriber public static function reset($id, $last_update) { $subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]); - if (!DBM::is_result($subscriber)) { + if (!DBA::is_result($subscriber)) { return; } diff --git a/src/Model/Queue.php b/src/Model/Queue.php index 0ec365f7c..0110ed050 100644 --- a/src/Model/Queue.php +++ b/src/Model/Queue.php @@ -6,7 +6,6 @@ namespace Friendica\Model; use Friendica\Core\Config; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; require_once 'include/dba.php'; @@ -20,7 +19,7 @@ class Queue { logger('queue: requeue item ' . $id); $queue = DBA::selectFirst('queue', ['retrial'], ['id' => $id]); - if (!DBM::is_result($queue)) { + if (!DBA::is_result($queue)) { return; } @@ -61,7 +60,7 @@ class Queue intval($cid) ); - $was_delayed = DBM::is_result($r); + $was_delayed = DBA::is_result($r); // We set "term-date" to a current date if the communication has problems. // If the communication works again we reset this value. @@ -69,7 +68,7 @@ class Queue $r = q("SELECT `term-date` FROM `contact` WHERE `id` = %d AND `term-date` <= '1000-01-01' LIMIT 1", intval($cid) ); - $was_delayed = !DBM::is_result($r); + $was_delayed = !DBA::is_result($r); } return $was_delayed; @@ -99,7 +98,7 @@ class Queue intval($cid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { if ($batch && ($r[0]['total'] > $batch_queue)) { logger('too many queued items for batch server ' . $cid . ' - discarding message'); return; diff --git a/src/Model/Term.php b/src/Model/Term.php index a4bcfe593..02a3903f6 100644 --- a/src/Model/Term.php +++ b/src/Model/Term.php @@ -6,7 +6,6 @@ namespace Friendica\Model; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'boot.php'; require_once 'include/conversation.php'; @@ -59,7 +58,7 @@ class Term $fields = ['guid', 'uid', 'id', 'edited', 'deleted', 'created', 'received', 'title', 'body', 'parent']; $message = Item::selectFirst($fields, ['id' => $itemid]); - if (!DBM::is_result($message)) { + if (!DBA::is_result($message)) { return; } @@ -167,7 +166,7 @@ class Term public static function insertFromFileFieldByItemId($itemid, $files) { $message = Item::selectFirst(['uid', 'deleted'], ['id' => $itemid]); - if (!DBM::is_result($message)) { + if (!DBA::is_result($message)) { return; } diff --git a/src/Model/User.php b/src/Model/User.php index 9b2a8547c..b74b432c8 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -14,7 +14,6 @@ use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Object\Image; use Friendica\Util\Crypto; use Friendica\Util\DateTimeFormat; @@ -56,7 +55,7 @@ class User LIMIT 1", $uid ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } return $r; @@ -71,7 +70,7 @@ class User public static function getOwnerDataByNick($nick) { $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { return false; } return self::getOwnerDataById($user['uid']); @@ -99,7 +98,7 @@ class User $user = DBA::selectFirst('user', ['def_gid'], ['uid' => $uid]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { $default_group = $user["def_gid"]; } @@ -215,7 +214,7 @@ class User $user = DBA::selectFirst('user', $fields, $condition); } - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { throw new Exception(L10n::t('User not found')); } } diff --git a/src/Module/Login.php b/src/Module/Login.php index fccf8b9d8..76e168016 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -10,7 +10,6 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -185,7 +184,7 @@ class Login extends BaseModule 'verified' => true, ] ); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { if ($data->hash != cookie_hash($user)) { logger("Hash for user " . $data->uid . " doesn't fit."); nuke_session(); @@ -215,7 +214,7 @@ class Login extends BaseModule $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($_SESSION['visitor_id']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { self::getApp()->contact = $r[0]; } } @@ -240,7 +239,7 @@ class Login extends BaseModule 'verified' => true, ] ); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { nuke_session(); goaway(self::getApp()->get_baseurl()); } diff --git a/src/Module/Owa.php b/src/Module/Owa.php index ae3828fe3..93d610a74 100644 --- a/src/Module/Owa.php +++ b/src/Module/Owa.php @@ -7,7 +7,6 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\OpenWebAuthToken; use Friendica\Util\HTTPSignature; @@ -52,7 +51,7 @@ class Owa extends BaseModule $contact = DBA::selectFirst('contact', $fields, $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { // Try to verify the signed header with the public key of the contact record // we have found. $verified = HTTPSignature::verify('', $contact['pubkey']); diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php index b9d1a6539..cde36423c 100644 --- a/src/Network/FKOAuth1.php +++ b/src/Network/FKOAuth1.php @@ -8,7 +8,6 @@ use Friendica\Core\Addon; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; use OAuthServer; use OAuthSignatureMethod_HMAC_SHA1; @@ -39,7 +38,7 @@ class FKOAuth1 extends OAuthServer $a = get_app(); $record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]); - if (!DBM::is_result($record)) { + if (!DBA::is_result($record)) { logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); @@ -61,7 +60,7 @@ class FKOAuth1 extends OAuthServer } $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $a->contact = $contact; $a->cid = $contact['id']; $_SESSION['cid'] = $a->cid; diff --git a/src/Network/FKOAuthDataStore.php b/src/Network/FKOAuthDataStore.php index 84d3b790b..b3409fe0c 100644 --- a/src/Network/FKOAuthDataStore.php +++ b/src/Network/FKOAuthDataStore.php @@ -11,7 +11,6 @@ namespace Friendica\Network; use Friendica\Core\Config; use Friendica\Database\DBA; -use Friendica\Database\DBM; use OAuthConsumer; use OAuthDataStore; use OAuthToken; @@ -45,7 +44,7 @@ class FKOAuthDataStore extends OAuthDataStore $s = DBA::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]); $r = DBA::toArray($s); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']); } @@ -65,7 +64,7 @@ class FKOAuthDataStore extends OAuthDataStore $s = DBA::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]); $r = DBA::toArray($s); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $ot = new OAuthToken($r[0]['id'], $r[0]['secret']); $ot->scope = $r[0]['scope']; $ot->expires = $r[0]['expires']; @@ -86,7 +85,7 @@ class FKOAuthDataStore extends OAuthDataStore public function lookup_nonce($consumer, $token, $nonce, $timestamp) { $token = DBA::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]); - if (DBM::is_result($token)) { + if (DBA::is_result($token)) { return new OAuthToken($token['id'], $token['secret']); } diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 71d36ea8f..20d6c8f18 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -14,7 +14,6 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Profile; use Friendica\Protocol\Email; use Friendica\Protocol\Feed; @@ -1598,7 +1597,7 @@ class Probe $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid)); - if (DBM::is_result($x) && DBM::is_result($r)) { + if (DBA::is_result($x) && DBA::is_result($r)) { $mailbox = Email::constructMailboxName($r[0]); $password = ''; openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']); diff --git a/src/Object/Image.php b/src/Object/Image.php index 50e93672d..5f23e6404 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -10,7 +10,7 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Photo; use Friendica\Util\Network; use Exception; @@ -882,7 +882,7 @@ class Image intval($uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger("Can't detect user data for uid ".$uid, LOGGER_DEBUG); return([]); } diff --git a/src/Object/Post.php b/src/Object/Post.php index 4299b6ff4..d18ad1eb4 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -12,7 +12,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Util\DateTimeFormat; @@ -180,7 +179,7 @@ class Post extends BaseObject /// @todo This shouldn't be done as query here, but better during the data creation. // it is now done here, since during the RC phase we shouldn't make to intense changes. $parent = Item::selectFirst(['origin'], ['id' => $item['parent']]); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { $origin = $parent['origin']; } } @@ -265,7 +264,7 @@ class Post extends BaseObject ]; $thread = DBA::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]); - if (DBM::is_result($thread)) { + if (DBA::is_result($thread)) { $ignore = [ 'do' => L10n::t("ignore thread"), 'undo' => L10n::t("unignore thread"), diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 3bcb6a77b..bc48060af 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -19,7 +19,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Event; use Friendica\Model\GContact; @@ -133,7 +132,7 @@ class DFRN dbesc($owner_nick) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { logger(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING); killme(); } @@ -169,7 +168,7 @@ class DFRN intval($owner_id) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { logger(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING); killme(); } @@ -278,7 +277,7 @@ class DFRN /// @TODO This hook can't work anymore // Addon::callHooks('atom_feed', $atom); - if (!DBM::is_result($items) || $onlyheader) { + if (!DBA::is_result($items) || $onlyheader) { $atom = trim($doc->saveXML()); Addon::callHooks('atom_feed_end', $atom); @@ -333,7 +332,7 @@ class DFRN $ret = Item::select(Item::DELIVER_FIELDLIST, $condition); $items = Item::inArray($ret); - if (!DBM::is_result($items)) { + if (!DBA::is_result($items)) { killme(); } @@ -599,7 +598,7 @@ class DFRN WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d", intval($owner['uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $hidewall = true; } else { $hidewall = false; @@ -658,7 +657,7 @@ class DFRN WHERE `profile`.`is-default` AND NOT `user`.`hidewall` AND `user`.`uid` = %d", intval($owner['uid']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $profile = $r[0]; XML::addElement($doc, $author, "poco:displayName", $profile["name"]); @@ -953,7 +952,7 @@ class DFRN if (isset($parent_item)) { $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]); - if (DBM::is_result($conversation)) { + if (DBA::is_result($conversation)) { if ($conversation['conversation-uri'] != '') { $conversation_uri = $conversation['conversation-uri']; } @@ -1077,7 +1076,7 @@ class DFRN dbesc(normalise_link($mention)) ); - if (DBM::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) { + if (DBA::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) { XML::addElement( $doc, $entry, @@ -1503,7 +1502,7 @@ class DFRN dbesc('birthday') ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return; } @@ -1552,7 +1551,7 @@ class DFRN $importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET]; $contact_old = DBA::selectFirst('contact', $fields, $condition); - if (DBM::is_result($contact_old)) { + if (DBA::is_result($contact_old)) { $author["contact-id"] = $contact_old["id"]; $author["network"] = $contact_old["network"]; } else { @@ -1595,7 +1594,7 @@ class DFRN $author["avatar"] = current($avatarlist); } - if (DBM::is_result($contact_old) && !$onlyfetch) { + if (DBA::is_result($contact_old) && !$onlyfetch) { logger("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG); $poco = ["url" => $contact_old["url"]]; @@ -1927,7 +1926,7 @@ class DFRN * * @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246 */ - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return false; } @@ -1940,7 +1939,7 @@ class DFRN dbesc($suggest["name"]), dbesc($suggest["request"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $fid = $r[0]["id"]; // OK, we do. Do we already have an introduction for this person ? @@ -1957,7 +1956,7 @@ class DFRN * * @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246 */ - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return false; } } @@ -1981,7 +1980,7 @@ class DFRN * If no record in fcontact is found, below INSERT statement will not * link an introduction to it. */ - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { // Database record did not get created. Quietly give up. killme(); } @@ -2067,7 +2066,7 @@ class DFRN intval($importer["importer_uid"]) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger("Query failed to execute, no result returned in " . __FUNCTION__); return false; } @@ -2165,7 +2164,7 @@ class DFRN $is_a_remote_action = false; $parent = Item::selectFirst(['parent-uri'], ['uri' => $item["parent-uri"]]); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { $r = q( "SELECT `item`.`forum_mode`, `item`.`wall` FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` @@ -2178,7 +2177,7 @@ class DFRN dbesc($parent["parent-uri"]), intval($importer["importer_uid"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $is_a_remote_action = true; } } @@ -2337,7 +2336,7 @@ class DFRN if ($xt->type == ACTIVITY_OBJ_NOTE) { $item_tag = Item::selectFirst(['id', 'tag'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]); - if (!DBM::is_result($item_tag)) { + if (!DBA::is_result($item_tag)) { logger("Query failed to execute, no result returned in " . __FUNCTION__); return false; } @@ -2428,7 +2427,7 @@ class DFRN ['uri' => $item["uri"], 'uid' => $importer["importer_uid"]] ); // Is there an existing item? - if (DBM::is_result($current) && !self::isEditedTimestampNewer($current, $item)) { + if (DBA::is_result($current) && !self::isEditedTimestampNewer($current, $item)) { logger("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG); return; } @@ -2649,7 +2648,7 @@ class DFRN dbesc($item["uri"]), intval($importer["importer_uid"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $ev["id"] = $r[0]["id"]; } @@ -2673,7 +2672,7 @@ class DFRN // Update content if 'updated' changes - if (DBM::is_result($current)) { + if (DBA::is_result($current)) { if (self::updateContent($current, $item, $importer, $entrytype)) { logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG); } else { @@ -2765,7 +2764,7 @@ class DFRN $condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]]; $item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG); return; } @@ -2958,7 +2957,7 @@ class DFRN dbesc($baseurl), dbesc($nurl) ); - if ((! DBM::is_result($r)) || $r[0]['id'] == remote_user()) { + if ((! DBA::is_result($r)) || $r[0]['id'] == remote_user()) { return; } @@ -2969,7 +2968,7 @@ class DFRN intval(local_user()), dbesc($baseurl) ); - if (! DBM::is_result($r)) { + if (! DBA::is_result($r)) { return; } @@ -3036,7 +3035,7 @@ class DFRN $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid) ); - if (!DBM::is_result($u)) { + if (!DBA::is_result($u)) { return false; } diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index cafc112ef..db610bf8c 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -19,7 +19,6 @@ use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Group; @@ -71,7 +70,7 @@ class Diaspora if (Config::get("system", "relay_directly", false)) { // We distribute our stuff based on the parent to ensure that the thread will be complete $parent = Item::selectFirst(['parent'], ['id' => $item_id]); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { return; } @@ -148,7 +147,7 @@ class Diaspora 'contact-type' => ACCOUNT_TYPE_RELAY]; $contact = DBA::selectFirst('contact', $fields, $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { if ($contact['archive'] || $contact['blocked']) { return false; } @@ -157,7 +156,7 @@ class Diaspora self::setRelayContact($server_url); $contact = DBA::selectFirst('contact', $fields, $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { return $contact; } } @@ -900,7 +899,7 @@ class Diaspora $update = false; $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]); - if (DBM::is_result($person)) { + if (DBA::is_result($person)) { logger("In cache " . print_r($person, true), LOGGER_DEBUG); // update record occasionally so it doesn't get stale @@ -914,7 +913,7 @@ class Diaspora } } - if (!DBM::is_result($person) || $update) { + if (!DBA::is_result($person) || $update) { logger("create or refresh", LOGGER_DEBUG); $r = Probe::uri($handle, NETWORK_DIASPORA); @@ -925,7 +924,7 @@ class Diaspora // Fetch the updated or added contact $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]); - if (!DBM::is_result($person)) { + if (!DBA::is_result($person)) { $person = $r; } } @@ -974,7 +973,7 @@ class Diaspora intval($pcontact_id) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return strtolower($r[0]["addr"]); } } @@ -984,7 +983,7 @@ class Diaspora intval($contact_id) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; logger("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG); @@ -1021,7 +1020,7 @@ class Diaspora dbesc($fcontact_guid) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $r[0]['url']; } @@ -1053,7 +1052,7 @@ class Diaspora } $contact = dba::selectFirst('contact', [], ['id' => $cid]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { // This here shouldn't happen at all logger("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG); return false; @@ -1154,7 +1153,7 @@ class Diaspora private static function messageExists($uid, $guid) { $item = Item::selectFirst(['id'], ['uid' => $uid, 'guid' => $guid]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { logger("message ".$guid." already exists for user ".$uid); return $item["id"]; } @@ -1374,7 +1373,7 @@ class Diaspora $condition = ['uid' => $uid, 'guid' => $guid]; $item = Item::selectFirst($fields, $condition); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { $result = self::storeByGuid($guid, $contact["url"], $uid); if (!$result) { @@ -1389,7 +1388,7 @@ class Diaspora } } - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { logger("parent item not found: parent: ".$guid." - user: ".$uid); return false; } else { @@ -1413,7 +1412,7 @@ class Diaspora { $condition = ['nurl' => normalise_link($person["url"]), 'uid' => $uid]; $contact = DBA::selectFirst('contact', ['id', 'network'], $condition); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $cid = $contact["id"]; $network = $contact["network"]; } else { @@ -1569,7 +1568,7 @@ class Diaspora private static function getUriFromGuid($author, $guid, $onlyfound = false) { $item = Item::selectFirst(['uri'], ['guid' => $guid]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { return $item["uri"]; } elseif (!$onlyfound) { $contact = Contact::getDetailsByAddr($author, 0); @@ -1599,7 +1598,7 @@ class Diaspora private static function getGuidFromUri($uri, $uid) { $item = Item::selectFirst(['guid'], ['uri' => $uri, 'uid' => $uid]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { return $item["guid"]; } else { return false; @@ -1616,10 +1615,10 @@ class Diaspora private static function importerForGuid($guid) { $item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG); $contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { return $contact; } } @@ -1791,7 +1790,7 @@ class Diaspora dbesc($msg_guid), intval($importer["uid"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { logger("duplicate message already delivered.", LOGGER_DEBUG); return false; } @@ -2078,7 +2077,7 @@ class Diaspora dbesc($guid), intval($importer["uid"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { logger("duplicate message already delivered.", LOGGER_DEBUG); return false; } @@ -2134,7 +2133,7 @@ class Diaspora } $item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => false]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { logger('Item not found, no origin or private: '.$parent_guid); return false; } @@ -2518,7 +2517,7 @@ class Diaspora $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false]; $item = Item::selectFirst($fields, $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { logger("reshared message ".$guid." already exists on system."); // Maybe it is already a reshared item? @@ -2540,7 +2539,7 @@ class Diaspora } } - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { if (empty($orig_author)) { logger('Empty author for guid ' . $guid . '. Quitting.'); return false; @@ -2562,7 +2561,7 @@ class Diaspora $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false]; $item = Item::selectFirst($fields, $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { // If it is a reshared post from another network then reformat to avoid display problems with two share elements if (self::isReshare($item["body"], false)) { $item["body"] = Markdown::toBBCode(BBCode::toMarkdown($item["body"])); @@ -2704,7 +2703,7 @@ class Diaspora } $r = Item::select($fields, $condition); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger("Target guid ".$target_guid." was not found on this system for user ".$importer['uid']."."); return false; } @@ -3357,7 +3356,7 @@ class Diaspora if (($guid != "") && $complete) { $condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]]; $item = Item::selectFirst(['contact-id'], $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { $ret= []; $ret["root_handle"] = self::handleFromContact($item["contact-id"]); $ret["root_guid"] = $guid; @@ -3410,7 +3409,7 @@ class Diaspora private static function buildEvent($event_id) { $r = q("SELECT `guid`, `uid`, `start`, `finish`, `nofinish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id)); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return []; } @@ -3419,14 +3418,14 @@ class Diaspora $eventdata = []; $r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d", intval($event['uid'])); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return []; } $user = $r[0]; $r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid'])); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return []; } @@ -3624,7 +3623,7 @@ class Diaspora private static function constructLike(array $item, array $owner) { $parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { return false; } @@ -3655,7 +3654,7 @@ class Diaspora private static function constructAttend(array $item, array $owner) { $parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { return false; } @@ -3699,7 +3698,7 @@ class Diaspora } $parent = Item::selectFirst(['guid'], ['id' => $item["parent"], 'parent' => $item["parent"]]); - if (!DBM::is_result($parent)) { + if (!DBA::is_result($parent)) { return false; } @@ -3925,7 +3924,7 @@ class Diaspora intval($item["uid"]) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger("conversation not found."); return; } @@ -4165,14 +4164,14 @@ class Diaspora } $r = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($contact['uid'])); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } $contact["uprvkey"] = $r[0]['prvkey']; $item = Item::selectFirst([], ['id' => $post_id]); - if (!DBM::is_result($item)) { + if (!DBA::is_result($item)) { return false; } diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 3ebf37e4c..83d06e9dc 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -10,7 +10,7 @@ use DOMDocument; use DOMXPath; use Friendica\Content\Text\HTML; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Item; use Friendica\Util\Network; use Friendica\Util\XML; @@ -246,7 +246,7 @@ class Feed { $condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)", $importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN]; $previous = Item::selectFirst(['id'], $condition); - if (DBM::is_result($previous)) { + if (DBA::is_result($previous)) { logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG); continue; } diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 02b9664d5..aebde7b8d 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -14,7 +14,6 @@ use Friendica\Core\L10n; use Friendica\Core\Lock; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Conversation; use Friendica\Model\GContact; @@ -81,7 +80,7 @@ class OStatus $contact = DBA::selectFirst('contact', [], $condition); } - if (!DBM::is_result($contact) && $author["author-link"] != '') { + if (!DBA::is_result($contact) && $author["author-link"] != '') { if ($aliaslink == "") { $aliaslink = $author["author-link"]; } @@ -92,14 +91,14 @@ class OStatus $contact = DBA::selectFirst('contact', [], $condition); } - if (!DBM::is_result($contact) && ($addr != '')) { + if (!DBA::is_result($contact) && ($addr != '')) { $condition = ["`uid` = ? AND `addr` = ? AND `network` != ? AND `rel` IN (?, ?)", $importer["uid"], $addr, NETWORK_STATUSNET, CONTACT_IS_SHARING, CONTACT_IS_FRIEND]; $contact = DBA::selectFirst('contact', [], $condition); } - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { if ($contact['blocked']) { $contact['id'] = -1; } @@ -136,7 +135,7 @@ class OStatus $author["owner-id"] = $author["author-id"]; // Only update the contacts if it is an OStatus contact - if (DBM::is_result($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) { + if (DBA::is_result($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) { // Update contact data $current = $contact; @@ -897,7 +896,7 @@ class OStatus { $condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON]; $conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition); - if (DBM::is_result($conversation)) { + if (DBA::is_result($conversation)) { $stored = true; $xml = $conversation['source']; if (self::process($xml, $importer, $contact, $hub, $stored, false)) { @@ -977,7 +976,7 @@ class OStatus if ($xml == '') { $condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV]; $conversation = DBA::selectFirst('conversation', ['source'], $condition); - if (DBM::is_result($conversation)) { + if (DBA::is_result($conversation)) { $stored = true; logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG); $xml = $conversation['source']; @@ -1453,7 +1452,7 @@ class OStatus } } - if (DBM::is_result($profile) && !$show_profile) { + if (DBA::is_result($profile) && !$show_profile) { if (trim($profile["homepage"]) != "") { $urls = $doc->createElement("poco:urls"); XML::addElement($doc, $urls, "poco:type", "homepage"); @@ -1577,24 +1576,24 @@ class OStatus dbesc(normalise_link($url)), intval($owner["uid"]) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; $contact["uid"] = -1; } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $r = q( "SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", dbesc(normalise_link($url)) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $contact = $r[0]; $contact["uid"] = -1; $contact["success_update"] = $contact["updated"]; } } - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { $contact = owner; } @@ -1636,7 +1635,7 @@ class OStatus $condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]]; $repeated_item = Item::selectFirst([], $condition); - if (!DBM::is_result($repeated_item)) { + if (!DBA::is_result($repeated_item)) { return false; } @@ -1794,7 +1793,7 @@ class OStatus dbesc(normalise_link($contact["url"])) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $connect_id = $r[0]['id']; } else { $connect_id = 0; @@ -1963,7 +1962,7 @@ class OStatus $thrparent = Item::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner["uid"], 'uri' => $parent_item]); - if (DBM::is_result($thrparent)) { + if (DBA::is_result($thrparent)) { $mentioned[$thrparent["author-link"]] = $thrparent["author-link"]; $mentioned[$thrparent["owner-link"]] = $thrparent["owner-link"]; $parent_plink = $thrparent["plink"]; @@ -1990,7 +1989,7 @@ class OStatus if (isset($parent_item)) { $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]); - if (DBM::is_result($conversation)) { + if (DBA::is_result($conversation)) { if ($conversation['conversation-uri'] != '') { $conversation_uri = $conversation['conversation-uri']; } diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 570d29c1e..30c6bd5e2 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -16,7 +16,6 @@ use Friendica\Content\Text\HTML; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\GContact; use Friendica\Model\Profile; use Friendica\Network\Probe; @@ -68,7 +67,7 @@ class PortableContact if ($cid) { if (!$url || !$uid) { $contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]); - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { $url = $contact['poco']; $uid = $contact['uid']; } @@ -285,7 +284,7 @@ class PortableContact dbesc(normalise_link($server_url)) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { return $server_url; } @@ -310,7 +309,7 @@ class PortableContact dbesc(normalise_link($profile)) ); - if (!DBM::is_result($gcontacts)) { + if (!DBA::is_result($gcontacts)) { return false; } @@ -931,7 +930,7 @@ class PortableContact } $gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]); - if (DBM::is_result($gserver)) { + if (DBA::is_result($gserver)) { if ($gserver["created"] <= NULL_DATE) { $fields = ['created' => DateTimeFormat::utcNow()]; $condition = ['nurl' => normalise_link($server_url)]; @@ -1002,7 +1001,7 @@ class PortableContact // Quit if there is a timeout. // But we want to make sure to only quit if we are mostly sure that this server url fits. - if (DBM::is_result($gserver) && ($orig_server_url == $server_url) && + if (DBA::is_result($gserver) && ($orig_server_url == $server_url) && (!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) { logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG); DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]); @@ -1421,7 +1420,7 @@ class PortableContact } $gserver = DBA::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]); - if (!DBM::is_result($gserver)) { + if (!DBA::is_result($gserver)) { return; } @@ -1483,7 +1482,7 @@ class PortableContact dbesc(NETWORK_OSTATUS) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } @@ -1511,7 +1510,7 @@ class PortableContact $server_url = str_replace("/index.php", "", $server->url); $r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url))); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger("Call server check for server ".$server_url, LOGGER_DEBUG); Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url); } @@ -1580,7 +1579,7 @@ class PortableContact public static function discoverSingleServer($id) { $r = q("SELECT `poco`, `nurl`, `url`, `network` FROM `gserver` WHERE `id` = %d", intval($id)); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return false; } @@ -1656,7 +1655,7 @@ class PortableContact $last_update = date("c", time() - (60 * 60 * 24 * $requery_days)); $r = q("SELECT `id`, `url`, `nurl`, `network` FROM `gserver` WHERE `last_contact` >= `last_failure` AND `poco` != '' AND `last_poco_query` < '%s' ORDER BY RAND()", dbesc($last_update)); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $server) { if (!self::checkServer($server["url"], $server["network"])) { // The server is not reachable? Okay, then we will try it later diff --git a/src/Util/ExAuth.php b/src/Util/ExAuth.php index 1ab5341a8..6a8df2eb4 100644 --- a/src/Util/ExAuth.php +++ b/src/Util/ExAuth.php @@ -37,7 +37,6 @@ namespace Friendica\Util; use Friendica\Core\Config; use Friendica\Core\PConfig; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\User; require_once 'include/dba.php'; @@ -226,7 +225,7 @@ class ExAuth $this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]); $aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]); - if (DBM::is_result($aUser)) { + if (DBA::is_result($aUser)) { $uid = $aUser['uid']; $success = User::authenticate($aUser, $aCommand[3]); $Error = $success === false; diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index 943580770..878eb4b65 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -7,7 +7,6 @@ namespace Friendica\Util; use Friendica\Core\Config; use Friendica\Database\DBA; -use Friendica\Database\DBM; /** * @brief Implements HTTP Signatures per draft-cavage-http-signatures-07. @@ -184,7 +183,7 @@ class HTTPSignature $contact = DBA::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']); } - if (DBM::is_result($contact)) { + if (DBA::is_result($contact)) { return $contact['pubkey']; } diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index bf1b44f55..5972e05c7 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -9,7 +9,6 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; require_once 'include/dba.php'; @@ -195,7 +194,7 @@ class Cron dbesc(NETWORK_MAIL) ); - if (!DBM::is_result($contacts)) { + if (!DBA::is_result($contacts)) { return; } diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index b2d70d9a8..61b354cdc 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -9,7 +9,6 @@ use Friendica\BaseObject; use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Database\PostUpdate; use Friendica\Model\Contact; use Friendica\Model\GContact; @@ -93,7 +92,7 @@ class CronJobs private static function updatePhotoAlbums() { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -231,7 +230,7 @@ class CronJobs $r = q("SELECT `id`, `url` FROM `contact` WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '') ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA)); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -266,7 +265,7 @@ class CronJobs // Sometimes there seem to be issues where the "self" contact vanishes. // We haven't found the origin of the problem by now. $r = q("SELECT `uid` FROM `user` WHERE NOT EXISTS (SELECT `uid` FROM `contact` WHERE `contact`.`uid` = `user`.`uid` AND `contact`.`self`)"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r AS $user) { logger('Create missing self contact for user ' . $user['uid']); Contact::createSelfFromUserId($user['uid']); @@ -282,7 +281,7 @@ class CronJobs // Update the global contacts for local users $r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r AS $user) { GContact::updateForUser($user["uid"]); } diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 072765868..1f69a9949 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -9,7 +9,6 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\Queue; @@ -40,14 +39,14 @@ class Delivery extends BaseObject if ($cmd == self::MAIL) { $target_item = DBA::selectFirst('mail', [], ['id' => $item_id]); - if (!DBM::is_result($target_item)) { + if (!DBA::is_result($target_item)) { return; } $uid = $target_item['uid']; $items = []; } elseif ($cmd == self::SUGGESTION) { $target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]); - if (!DBM::is_result($target_item)) { + if (!DBA::is_result($target_item)) { return; } $uid = $target_item['uid']; @@ -55,7 +54,7 @@ class Delivery extends BaseObject $uid = $item_id; } else { $item = Item::selectFirst(['parent'], ['id' => $item_id]); - if (!DBM::is_result($item) || empty($item['parent'])) { + if (!DBA::is_result($item) || empty($item['parent'])) { return; } $parent_id = intval($item['parent']); @@ -133,7 +132,7 @@ class Delivery extends BaseObject } $owner = User::getOwnerDataById($uid); - if (!DBM::is_result($owner)) { + if (!DBA::is_result($owner)) { return; } @@ -141,7 +140,7 @@ class Delivery extends BaseObject $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false] ); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { return; } @@ -238,7 +237,7 @@ class Delivery extends BaseObject if (link_compare($basepath, System::baseUrl())) { $condition = ['nurl' => normalise_link($contact['url']), 'self' => true]; $target_self = DBA::selectFirst('contact', ['uid'], $condition); - if (!DBM::is_result($target_self)) { + if (!DBA::is_result($target_self)) { return; } $target_uid = $target_self['uid']; @@ -260,7 +259,7 @@ class Delivery extends BaseObject $cid); // This should never fail - if (!DBM::is_result($target_importer)) { + if (!DBA::is_result($target_importer)) { return; } @@ -405,7 +404,7 @@ class Delivery extends BaseObject } $local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]); - if (!DBM::is_result($local_user)) { + if (!DBA::is_result($local_user)) { return; } @@ -413,7 +412,7 @@ class Delivery extends BaseObject $reply_to = ''; $mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]); - if (DBM::is_result($mailacct) && !empty($mailacct['reply_to'])) { + if (DBA::is_result($mailacct) && !empty($mailacct['reply_to'])) { $reply_to = $mailacct['reply_to']; } @@ -446,12 +445,12 @@ class Delivery extends BaseObject if (empty($target_item['title'])) { $condition = ['uri' => $target_item['parent-uri'], 'uid' => $owner['uid']]; $title = Item::selectFirst(['title'], $condition); - if (DBM::is_result($title) && ($title['title'] != '')) { + if (DBA::is_result($title) && ($title['title'] != '')) { $subject = $title['title']; } else { $condition = ['parent-uri' => $target_item['parent-uri'], 'uid' => $owner['uid']]; $title = Item::selectFirst(['title'], $condition); - if (DBM::is_result($title) && ($title['title'] != '')) { + if (DBA::is_result($title) && ($title['title'] != '')) { $subject = $title['title']; } } diff --git a/src/Worker/Directory.php b/src/Worker/Directory.php index a59461037..e354ed792 100644 --- a/src/Worker/Directory.php +++ b/src/Worker/Directory.php @@ -9,7 +9,7 @@ namespace Friendica\Worker; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Util\Network; class Directory @@ -48,7 +48,7 @@ class Directory WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND NOT `user`.`account_expired` AND `user`.`verified`"); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r AS $user) { Worker::add(PRIORITY_LOW, 'Directory', $user['url']); } diff --git a/src/Worker/DiscoverPoCo.php b/src/Worker/DiscoverPoCo.php index 5baab5f4b..965477d99 100644 --- a/src/Worker/DiscoverPoCo.php +++ b/src/Worker/DiscoverPoCo.php @@ -8,7 +8,6 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\GContact; use Friendica\Network\Probe; use Friendica\Protocol\PortableContact; @@ -119,7 +118,7 @@ class DiscoverPoCo private static function updateServer() { $r = q("SELECT `url`, `created`, `last_failure`, `last_contact` FROM `gserver` ORDER BY rand()"); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } @@ -225,7 +224,7 @@ class DiscoverPoCo foreach ($j->results as $jj) { // Check if the contact already exists $exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url)); - if (DBM::is_result($exists)) { + if (DBA::is_result($exists)) { logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG); if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) && diff --git a/src/Worker/Expire.php b/src/Worker/Expire.php index d40d72eca..991650a89 100644 --- a/src/Worker/Expire.php +++ b/src/Worker/Expire.php @@ -11,7 +11,6 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; require_once 'include/dba.php'; @@ -68,7 +67,7 @@ class Expire return; } elseif (intval($param) > 0) { $user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]); - if (DBM::is_result($user)) { + if (DBA::is_result($user)) { logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG); Item::expire($user['uid'], $user['expire']); logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG); diff --git a/src/Worker/GProbe.php b/src/Worker/GProbe.php index d6c0ae122..5172416b8 100644 --- a/src/Worker/GProbe.php +++ b/src/Worker/GProbe.php @@ -6,7 +6,7 @@ namespace Friendica\Worker; use Friendica\Core\Cache; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\GContact; use Friendica\Network\Probe; use Friendica\Protocol\PortableContact; @@ -25,7 +25,7 @@ class GProbe { logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { // Is it a DDoS attempt? $urlparts = parse_url($url); @@ -52,7 +52,7 @@ class GProbe { dbesc(normalise_link($url)) ); } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { // Check for accessibility and do a poco discovery if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) { PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url'])); diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 7ba8b60b3..6ea2f0307 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -9,7 +9,6 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; @@ -66,7 +65,7 @@ class Notifier if ($cmd == Delivery::MAIL) { $normal_mode = false; $message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]); - if (!DBM::is_result($message)) { + if (!DBA::is_result($message)) { return; } $uid = $message['uid']; @@ -74,7 +73,7 @@ class Notifier } elseif ($cmd == Delivery::SUGGESTION) { $normal_mode = false; $suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]); - if (!DBM::is_result($suggest)) { + if (!DBA::is_result($suggest)) { return; } $uid = $suggest['uid']; @@ -110,7 +109,7 @@ class Notifier $condition = ['id' => $item_id, 'visible' => true, 'moderated' => false]; $target_item = Item::selectFirst([], $condition); - if (!DBM::is_result($target_item) || !intval($target_item['parent'])) { + if (!DBA::is_result($target_item) || !intval($target_item['parent'])) { return; } @@ -122,7 +121,7 @@ class Notifier $params = ['order' => ['id']]; $ret = Item::select([], $condition, $params); - if (!DBM::is_result($ret)) { + if (!DBA::is_result($ret)) { return; } @@ -224,7 +223,7 @@ class Notifier $fields = ['forum', 'prv']; $condition = ['id' => $target_item['contact-id']]; $contact = DBA::selectFirst('contact', $fields, $condition); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { // Should never happen return false; } @@ -261,7 +260,7 @@ class Notifier intval($uid), dbesc(NETWORK_DFRN) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $recipients_followup[] = $rr['id']; } @@ -344,14 +343,14 @@ class Notifier // Send a salmon to the parent author $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]); - if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) { + if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) { logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]); $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"]; } // Send a salmon to the parent owner $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]); - if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) { + if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) { logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]); $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"]; } @@ -388,7 +387,7 @@ class Notifier intval($uid), dbesc(NETWORK_MAIL) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $recipients[] = $rr['id']; } @@ -412,7 +411,7 @@ class Notifier } // delivery loop - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $contact) { logger("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG); @@ -462,7 +461,7 @@ class Notifier $r = array_merge($r2, $r1); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG); foreach ($r as $rr) { diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index 89703a82b..afe1c43f1 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -9,7 +9,6 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Config; use Friendica\Core\PConfig; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Protocol\Email; @@ -48,7 +47,7 @@ class OnePoll $d = DateTimeFormat::utcNow(); $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { logger('Contact not found or cannot be used.'); return; } @@ -61,7 +60,7 @@ class OnePoll WHERE `cid` = %d AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", intval($contact['id']) ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { if (!$r[0]['total']) { PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']); } @@ -146,7 +145,7 @@ class OnePoll intval($importer_uid) ); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { logger('No self contact for user '.$importer_uid); // set the last-update so we don't keep polling @@ -349,7 +348,7 @@ class OnePoll $condition = ["`server` != '' AND `uid` = ?", $importer_uid]; $mailconf = DBA::selectFirst('mailacct', [], $condition); - if (DBM::is_result($user) && DBM::is_result($mailconf)) { + if (DBA::is_result($user) && DBA::is_result($mailconf)) { $mailbox = Email::constructMailboxName($mailconf); $password = ''; openssl_private_decrypt(hex2bin($mailconf['pass']), $password, $user['prvkey']); @@ -392,7 +391,7 @@ class OnePoll $fields = ['deleted', 'id']; $condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']]; $item = Item::selectFirst($fields, $condition); - if (DBM::is_result($item)) { + if (DBA::is_result($item)) { logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG); // Only delete when mails aren't automatically moved or deleted @@ -442,7 +441,7 @@ class OnePoll } $condition = ['uri' => $refs_arr, 'uid' => $importer_uid]; $parent = Item::selectFirst(['parent-uri'], $condition); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { $datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item } } @@ -475,7 +474,7 @@ class OnePoll $condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => NETWORK_MAIL]; $params = ['order' => ['created' => true]]; $parent = Item::selectFirst(['parent-uri'], $condition, $params); - if (DBM::is_result($parent)) { + if (DBA::is_result($parent)) { $datarray['parent-uri'] = $parent['parent-uri']; } } diff --git a/src/Worker/PubSubPublish.php b/src/Worker/PubSubPublish.php index 4709708ae..c67a71edd 100644 --- a/src/Worker/PubSubPublish.php +++ b/src/Worker/PubSubPublish.php @@ -8,7 +8,6 @@ namespace Friendica\Worker; use Friendica\BaseObject; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\PushSubscriber; use Friendica\Protocol\OStatus; use Friendica\Util\Network; @@ -31,7 +30,7 @@ class PubSubPublish $a = BaseObject::getApp(); $subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]); - if (!DBM::is_result($subscriber)) { + if (!DBA::is_result($subscriber)) { return; } diff --git a/src/Worker/Queue.php b/src/Worker/Queue.php index b37a32f9e..232d0a27c 100644 --- a/src/Worker/Queue.php +++ b/src/Worker/Queue.php @@ -9,7 +9,6 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\PushSubscriber; use Friendica\Model\Queue as QueueModel; use Friendica\Model\User; @@ -40,7 +39,7 @@ class Queue Addon::callHooks('queue_predeliver', $r); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $q_item) { logger('Call queue for id ' . $q_item['id']); Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "Queue", (int) $q_item['id']); @@ -53,12 +52,12 @@ class Queue // delivering $q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]); - if (!DBM::is_result($q_item)) { + if (!DBA::is_result($q_item)) { return; } $contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]); - if (!DBM::is_result($contact)) { + if (!DBA::is_result($contact)) { QueueModel::removeItem($q_item['id']); return; } @@ -98,7 +97,7 @@ class Queue } $user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]); - if (!DBM::is_result($user)) { + if (!DBA::is_result($user)) { QueueModel::removeItem($q_item['id']); return; } diff --git a/src/Worker/UpdateGContact.php b/src/Worker/UpdateGContact.php index b943d966b..345161d32 100644 --- a/src/Worker/UpdateGContact.php +++ b/src/Worker/UpdateGContact.php @@ -6,7 +6,7 @@ namespace Friendica\Worker; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Network\Probe; use Friendica\Protocol\PortableContact; use Friendica\Util\DateTimeFormat; @@ -24,7 +24,7 @@ class UpdateGContact $r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id)); - if (!DBM::is_result($r)) { + if (!DBA::is_result($r)) { return; } diff --git a/update.php b/update.php index e7543728d..6976bcb1b 100644 --- a/update.php +++ b/update.php @@ -6,7 +6,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\User; @@ -117,7 +116,7 @@ function update_1191() { ); // convert old forumlist addon entries in new config entries - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $uid = $rr['uid']; $family = $rr['cat']; diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index f2cbb7e6a..6ec94e67b 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -15,7 +15,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Profile; $frio = 'view/theme/frio'; @@ -231,7 +231,7 @@ function frio_remote_nav($a, &$nav) // user info $r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self`", intval($a->user['uid'])); - $r[0]['photo'] = (DBM::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'); + $r[0]['photo'] = (DBA::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'); $r[0]['name'] = $a->user['username']; } elseif (!local_user() && remote_user()) { $r = q("SELECT `name`, `nick`, `micro` AS `photo` FROM `contact` WHERE `id` = %d", intval(remote_user())); @@ -245,9 +245,9 @@ function frio_remote_nav($a, &$nav) $r = false; } - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $nav['userinfo'] = [ - 'icon' => (DBM::is_result($r) ? $r[0]['photo'] : 'images/person-48.jpg'), + 'icon' => (DBA::is_result($r) ? $r[0]['photo'] : 'images/person-48.jpg'), 'name' => $r[0]['name'], ]; } @@ -310,7 +310,7 @@ function frio_acl_lookup(App $a, &$results) $total = 0; $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ", intval($_SESSION['uid'])); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $total = $r[0]['total']; } @@ -322,7 +322,7 @@ function frio_acl_lookup(App $a, &$results) $contacts = []; - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { foreach ($r as $rr) { $contacts[] = _contact_detail_for_template($rr); } diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index bd7ccf008..d5c5f9fd0 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -16,7 +16,7 @@ use Friendica\Core\L10n; use Friendica\Core\Config; use Friendica\Core\PConfig; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Profile; @@ -147,7 +147,7 @@ function vier_community_info() $r = GContact::suggestionQuery(local_user(), 0, 9); $tpl = get_markup_template('ch_directory_item.tpl'); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $aside['$comunity_profiles_title'] = L10n::t('Community Profiles'); $aside['$comunity_profiles_items'] = []; @@ -177,7 +177,7 @@ function vier_community_info() 9 ); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $aside['$lastusers_title'] = L10n::t('Last users'); $aside['$lastusers_items'] = []; @@ -383,7 +383,7 @@ function vier_community_info() $tpl = get_markup_template('ch_connectors.tpl'); - if (DBM::is_result($r)) { + if (DBA::is_result($r)) { $con_services = []; $con_services['title'] = ["", L10n::t('Connect Services'), "", ""]; $aside['$con_services'] = $con_services;