function check_addons(App $a)
{
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$installed = $r;
} else {
$installed = [];
intval($uid)
);
- if (DBA::is_result($p)) {
+ if (DBA::isResult($p)) {
$tmp_dob = substr($p[0]['dob'], 5);
if (intval($tmp_dob)) {
$y = DateTimeFormat::timezoneNow($tz, 'Y');
}
}
- if (!DBA::is_result($record)) {
+ if (!DBA::isResult($record)) {
logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
//header('HTTP/1.0 401 Unauthorized');
{
$r = DBA::selectFirst('contact', ['nurl'], ['id' => $id]);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $r["nurl"];
} else {
return false;
}
// if the contact wasn't found, fetch it from the contacts with uid = 0
- if (!DBA::is_result($uinfo)) {
+ if (!DBA::isResult($uinfo)) {
$r = [];
if ($url != "") {
$r = q("SELECT * FROM `contact` WHERE `uid` = 0 AND `nurl` = '%s' LIMIT 1", dbesc(normalise_link($url)));
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$network_name = ContactSelector::networkToName($r[0]['network'], $r[0]['url']);
// If no nick where given, extract it from the address
intval(requestdata('media_ids')),
api_user()
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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'] . ']';
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
$lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
- if (DBA::is_result($lastwall)) {
+ if (DBA::isResult($lastwall)) {
$in_reply_to = api_in_reply_to($lastwall);
$converted = api_convert_item($lastwall);
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'private' => false];
$lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
- if (DBA::is_result($lastwall)) {
+ if (DBA::isResult($lastwall)) {
$in_reply_to = api_in_reply_to($lastwall);
$converted = api_convert_item($lastwall);
if (x($_GET, 'q')) {
$r = q("SELECT id FROM `contact` WHERE `uid` = 0 AND `name` = '%s'", dbesc($_GET["q"]));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$r = q("SELECT `id` FROM `contact` WHERE `uid` = 0 AND `nick` = '%s'", dbesc($_GET["q"]));
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$k = 0;
foreach ($r as $user) {
$user_info = api_get_user($a, $user["id"]);
// 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 (!DBA::is_result($uri_item)) {
+ if (!DBA::isResult($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 (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
throw new BadRequestException("There is no status with this id.");
}
$statuses = Item::selectForUser(api_user(), [], $condition, $params);
/// @TODO How about copying this to above methods which don't check $r ?
- if (!DBA::is_result($statuses)) {
+ if (!DBA::isResult($statuses)) {
throw new BadRequestException("There is no status with this id.");
}
// 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 (!DBA::is_result($item)) {
+ if (!DBA::isResult($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 (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
throw new BadRequestException("There is no status with this id.");
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
$statuses = Item::selectForUser(api_user(), [], $condition, $params);
- if (!DBA::is_result($statuses)) {
+ if (!DBA::isResult($statuses)) {
throw new BadRequestException("There is no status with id $id.");
}
$fields = ['body', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
$item = Item::selectFirst($fields, ['id' => $id, 'private' => false]);
- if (DBA::is_result($item) && $item['body'] != "") {
+ if (DBA::isResult($item) && $item['body'] != "") {
if (strpos($item['body'], "[/share]") !== false) {
$pos = strpos($item['body'], "[share");
$post = substr($item['body'], $pos);
$item = Item::selectFirstForUser(api_user(), [], ['id' => $itemid, 'uid' => api_user()]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
throw new BadRequestException("Invalid item.");
}
WHERE `contact`.`uid` = %s AND NOT `contact`.`self`",
intval(api_user())
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
dbesc($_POST['screen_name'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// Selecting the id by priority, friendica first
api_best_nickname($r);
);
// error message if specified id is not in database
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
if ($verbose == "true") {
$answer = ['result' => 'error', 'message' => 'message id not in database'];
return api_format_data("direct_messages_delete", $type, ['$result' => $answer]);
intval($start),
intval($count)
);
- if ($verbose == "true" && !DBA::is_result($r)) {
+ if ($verbose == "true" && !DBA::isResult($r)) {
$answer = ['result' => 'error', 'message' => 'no mails available'];
return api_format_data("direct_messages_all", $type, ['$result' => $answer]);
}
intval(api_user()),
dbesc($album)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
throw new BadRequestException("album not available");
}
$condition = ['uid' => local_user(), 'resource-id' => $rr['resource-id'], 'type' => 'photo'];
$photo_item = Item::selectFirstForUser(local_user(), ['id'], $condition);
- if (!DBA::is_result($photo_item)) {
+ if (!DBA::isResult($photo_item)) {
throw new InternalServerErrorException("problem with deleting items occured");
}
Item::deleteForUser(['id' => $photo_item['id']], api_user());
'image/gif' => 'gif'
];
$data = ['photo'=>[]];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$photo = [];
$photo['id'] = $rr['resource-id'];
dbesc($photo_id),
dbesc($album)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
throw new BadRequestException("photo not available");
}
}
intval(api_user()),
dbesc($photo_id)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
throw new BadRequestException("photo not available");
}
// now we can perform on the deletion of the photo
$condition = ['uid' => local_user(), 'resource-id' => $photo_id, 'type' => 'photo'];
$photo_item = Item::selectFirstForUser(local_user(), ['id'], $condition);
- if (!DBA::is_result($photo_item)) {
+ if (!DBA::isResult($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
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 (!DBA::is_result($profile)) {
+ if (!DBA::isResult($profile)) {
throw new BadRequestException("profile_id not available");
}
$is_default_profile = $profile['is-default'];
intval($cid),
intval(api_user())
);
- $contact_not_found |= !DBA::is_result($contact);
+ $contact_not_found |= !DBA::isResult($contact);
}
return $contact_not_found;
}
];
// prepare output data for photo
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$data = ['photo' => $r[0]];
$data['photo']['id'] = $data['photo']['resource-id'];
if ($scale !== false) {
$contact = DBA::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
- if (!DBA::is_result($contact) || ($contact['network'] !== NETWORK_DFRN)) {
+ if (!DBA::isResult($contact) || ($contact['network'] !== NETWORK_DFRN)) {
throw new BadRequestException("Unknown contact");
}
dbesc(normalise_link($profile))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$nick = $r[0]["nick"];
}
dbesc(normalise_link($profile))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$nick = $r[0]["nick"];
}
}
if (($item['thr-parent'] != $item['uri']) && (intval($item['parent']) != intval($item['id']))) {
$parent = Item::selectFirst(['id'], ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);
- if (DBA::is_result($parent)) {
+ if (DBA::isResult($parent)) {
$in_reply_to['status_id'] = intval($parent['id']);
} else {
$in_reply_to['status_id'] = intval($item['parent']);
$fields = ['author-nick', 'author-name', 'author-id', 'author-link'];
$parent = Item::selectFirst($fields, ['id' => $in_reply_to['status_id']]);
- if (DBA::is_result($parent)) {
+ if (DBA::isResult($parent)) {
if ($parent['author-nick'] == "") {
$parent['author-nick'] = api_get_nick($parent['author-link']);
}
intval($gid)
);
// error message if specified gid is not in database
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
throw new BadRequestException("gid not available");
}
} else {
intval($gid)
);
// error message if specified gid is not in database
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
throw new BadRequestException('gid not available');
}
dbesc($name)
);
// error message if specified gid is not in database
- if (!DBA::is_result($rname)) {
+ if (!DBA::isResult($rname)) {
throw new BadRequestException('wrong group name');
}
dbesc($name)
);
// error message if specified group name already exists
- if (DBA::is_result($rname)) {
+ if (DBA::isResult($rname)) {
throw new BadRequestException('group name already exists');
}
dbesc($name)
);
// error message if specified group name already exists
- if (DBA::is_result($rname)) {
+ if (DBA::isResult($rname)) {
$reactivate_group = true;
}
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 (DBA::is_result($$item)) {
+ if (DBA::isResult($$item)) {
// we found the item, return it to the user
$ret = api_format_items([$item], $user_info, false, $type);
$data = ['status' => $ret];
$profile_url = $user_info["url"];
// message if nothing was found
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$success = ['success' => false, 'search_results' => 'problem with query'];
} elseif (count($r) == 0) {
$success = ['success' => false, 'search_results' => 'nothing found'];
);
// error message if specified gid is not in database
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
throw new BadRequestException("profile_id not available");
}
} else {
$fields = ['author-link', 'author-name', 'verb', 'object-type', 'resource-id', 'body', 'plink'];
$obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]);
- if (!DBA::is_result($obj)) {
+ if (!DBA::isResult($obj)) {
return;
}
$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 (!DBA::is_result($obj)) {
+ if (!DBA::isResult($obj)) {
return;
}
if (strlen($obj->id)) {
$fields = ['author-link', 'author-name', 'plink'];
$target = Item::selectFirst($fields, ['uri' => $obj->id, 'uid' => $item['uid']]);
- if (DBA::is_result($target) && $target['plink']) {
+ if (DBA::isResult($target) && $target['plink']) {
$Bname = $target['author-name'];
$Blink = $target['author-link'];
$A = '[url=' . Contact::magicLink($Alink) . ']' . $Aname . '[/url]';
$rel = 0;
$condition = ['uid' => local_user(), 'nurl' => normalise_link($item['author-link'])];
$contact = DBA::selectFirst('contact', ['id', 'network', 'rel'], $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$cid = $contact['id'];
$network = $contact['network'];
$rel = $contact['rel'];
['uid' => $params['uid']]);
// There is no need to create notifications for forum accounts
- if (!DBA::is_result($user) || in_array($user["page-flags"], [PAGE_COMMUNITY, PAGE_PRVGROUP])) {
+ if (!DBA::isResult($user) || in_array($user["page-flags"], [PAGE_COMMUNITY, PAGE_PRVGROUP])) {
return;
}
}
if ($params['type'] == NOTIFY_COMMENT) {
$thread = DBA::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
- if (DBA::is_result($thread) && $thread["ignored"]) {
+ if (DBA::isResult($thread) && $thread["ignored"]) {
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
return;
}
}
// "your post"
- if (DBA::is_result($item) && $item['owner-id'] == $item['author-id'] && $item['wall']) {
+ if (DBA::isResult($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,
$hash = random_string();
$r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$dups = true;
}
} while ($dups == true);
$fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return false;
}
$owner = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
- if (!DBA::is_result($owner)) {
+ if (!DBA::isResult($owner)) {
return false;
}
'guid', 'parent-uri', 'uri', 'contact-id', 'network'];
$condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
$item = Item::selectFirst($fields, $condition);
- if (!DBA::is_result($item) || in_array($item['author-id'], $contacts)) {
+ if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
return;
}
$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 (DBA::is_result($tags)) {
+ if (DBA::isResult($tags)) {
foreach ($tags AS $tag) {
$condition = ['nurl' => normalise_link($tag["url"]), 'uid' => $uid, 'notify_new_posts' => true];
$r = DBA::exists('contact', $condition);
WHERE `contact`.`id` = %d AND `user`.`uid` = %d",
dbesc($contact["id"]), dbesc($importer["uid"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
logger("Now import the DFRN feed");
DFRN::import($xml, $r[0], true);
return;
* through the direct Diaspora protocol. If we try and use
* the feed, we'll get duplicates. So don't.
*/
- if ((!DBA::is_result($r)) || $contact['network'] === NETWORK_DIASPORA) {
+ if ((!DBA::isResult($r)) || $contact['network'] === NETWORK_DIASPORA) {
return;
}
$fields = ['id', 'uid', 'contact-id', 'deleted'];
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
notice(L10n::t('Item not found.') . EOL);
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
}
$ret = list_post_dates($uid, $wall);
- if (!DBA::is_result($ret)) {
+ if (!DBA::isResult($ret)) {
return $o;
}
if ((x($_SESSION, 'submanage')) && intval($_SESSION['submanage'])) {
$user = DBA::selectFirst('user', [], ['uid' => $_SESSION['submanage']]);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
$master_record = $user;
}
}
// Then add all the children
$r = DBA::select('user', ['uid', 'username', 'nickname'],
['parent-uid' => $master_record['uid'], 'account_removed' => false]);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->identities = array_merge($a->identities, DBA::toArray($r));
}
} else {
// First entry is our parent
$r = DBA::select('user', ['uid', 'username', 'nickname'],
['uid' => $master_record['parent-uid'], 'account_removed' => false]);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->identities = array_merge($a->identities, DBA::toArray($r));
}
}
WHERE `user`.`account_removed` = 0 AND `manage`.`uid` = ?",
$master_record['uid']
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->identities = array_merge($a->identities, DBA::toArray($r));
}
}
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$a->contact = $contact;
$a->cid = $contact['id'];
$_SESSION['cid'] = $a->cid;
intval(PAGE_COMMUNITY)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$verified = 2;
return true;
} else {
intval($remote_user),
intval($owner_id)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$remote_verified = true;
$groups = Group::getIdsByContactId($remote_user);
}
intval($remote_user),
intval($owner_id)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$remote_verified = true;
$groups = Group::getIdsByContactId($remote_user);
}
dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_DIASPORA)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$total = intval($r[0]['total']);
}
if (!$total) {
dbesc(NETWORK_DIASPORA),
intval($shown)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contacts = [];
foreach ($r AS $contact) {
$contacts[] = $contact["id"];
$r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)",
dbesc(implode(",", $contacts)));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contacts = L10n::tt('%d Contact', '%d Contacts', $total);
$micropro = [];
foreach ($r as $rr) {
$x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1",
dbesc($guid)
);
- if (!DBA::is_result($x)) {
+ if (!DBA::isResult($x)) {
$found = false;
}
} while ($found == true);
intval($termtype),
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
unset($deleted_tags[$key]);
} else {
$filetags_updated = str_replace($lbracket . file_tag_encode($tag) . $rbracket,'',$filetags_updated);
}
$item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
if (!stristr($item['file'],'[' . file_tag_encode($file) . ']')) {
$fields = ['file' => $item['file'] . '[' . file_tag_encode($file) . ']'];
Item::update($fields, ['id' => $item_id]);
}
$item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return false;
}
intval($termtype),
intval($uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$saved = PConfig::get($uid, 'system', 'filetags');
PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
}
// we haven't loaded user data yet, but we need user language
$user = DBA::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]);
$_SESSION['language'] = $lang;
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
$_SESSION['language'] = $user['language'];
}
}
exit;
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$forums = [];
foreach ($r as $g) {
$entry = [
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 (DBA::is_result($parent_item)) {
+ if (DBA::isResult($parent_item)) {
$conv_id = $parent_item['parent'];
}
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(DBA::databaseName()));
$showwarning = false;
$warningtext = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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 <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php bin/console.php dbstructure toinnodb</tt> of your Friendica installation for an automatic conversion.<br />', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
}
$r = q("UPDATE %s SET %s;", $table_name, $upds);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
notice("Failed updating '$table_name': " . DBA::errorMessage());
goaway('admin/site');
}
$failed = [];
$r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' ");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$upd = intval(substr($rr['k'], 7));
if ($upd < 1139 || $rr['v'] === 'success') {
if ($a->argc > 2) {
$uid = $a->argv[3];
$user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
notice('User not found' . EOL);
goaway('admin/users');
return ''; // NOTREACHED
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return;
}
$a->set_pager_total($total);
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$o .= L10n::t('No friends to display.');
return $o;
}
WHERE `clients`.`client_id`=`tokens`.`client_id`
AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'", dbesc($token));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return null;
}
// Check for existence, which will also provide us the owner uid
$r = DBA::selectFirst('attach', [], ['id' => $item_id]);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
notice(L10n::t('Item was not found.'). EOL);
return;
}
dbesc($item_id)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
notice(L10n::t('Permission denied.') . EOL);
return;
}
if ($a->argc > 1) {
$nick = $a->argv[1];
$user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return;
}
intval($contact_id),
intval($a->profile['profile_uid'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$remote_contact = true;
}
}
$links = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$r = Event::sortByDate($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
if ($cmd === 'loc' && $cid) {
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => $uid]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($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 (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
'$name' => htmlentities($contact['name']),
'$photo' => $contact['photo'],
}
}
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return;
}
if (!$cid && Profile::getMyURL()) {
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$cid = $contact['id'];
} else {
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
- if (DBA::is_result($gcontact)) {
+ if (DBA::isResult($gcontact)) {
$zcid = $gcontact['id'];
}
}
$r = GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return $o;
}
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
info(L10n::t('No results.') . EOL);
return $o;
}
intval($a->argv[2]),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$change = intval($a->argv[2]);
}
}
intval($a->argv[1]),
intval(local_user())
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
killme();
}
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
}
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
if ($contact['self']) {
if (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts")) {
goaway('profile/' . $contact['nick']);
intval($contact_id),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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 (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$a->data['contact'] = $contact;
}
function _contact_update($contact_id)
{
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return;
}
function _contact_update_profile($contact_id)
{
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return;
}
intval($contact_id),
intval(local_user())
);
- return DBA::is_result($r);
+ return DBA::isResult($r);
}
function _contact_ignore($contact_id, $orig_record)
intval($contact_id),
intval(local_user())
);
- return DBA::is_result($r);
+ return DBA::isResult($r);
}
function _contact_archive($contact_id, $orig_record)
intval($contact_id),
intval(local_user())
);
- return DBA::is_result($r);
+ return DBA::isResult($r);
}
function _contact_drop($orig_record)
WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
intval($a->user['uid'])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
$cmd = $a->argv[2];
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
- if (!DBA::is_result($orig_record)) {
+ if (!DBA::isResult($orig_record)) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
return; // NOTREACHED
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$contacts[] = _contact_detail_for_template($rr);
}
$o = contacts_tab($a, $contact_id, 1);
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$a->page['aside'] = "";
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
$o .= Contact::getPostsFromUrl($contact["url"]);
$a->page['aside'] = '';
}
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$a->data['contact'] = $contact;
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
}
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
}
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return;
}
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
}
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
notice(L10n::t('Contact not found.') . EOL);
return;
}
if ($parent_uid != 0) {
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
notice(L10n::t('Parent user not found.') . EOL);
return;
}
$user_id = $a->argv[2];
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $user_id]);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
$condition = [
'uid' => local_user(),
'nurl' => normalise_link(System::baseUrl() . '/profile/' . $user['nickname'])
$r = q("SELECT * FROM `user` WHERE `uid` IN (SELECT `uid` FROM `manage` WHERE `mid` = %d)",
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$delegates = $r;
}
intval(local_user()),
dbesc(NETWORK_DFRN)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$nicknames = [];
foreach ($r as $rr) {
$nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
// 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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
if (!in_array($rr['uid'], $uids)) {
$potentials[] = $rr;
$parent_user = null;
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
if (!DBA::exists('user', ['parent-uid' => local_user()])) {
$parent_uid = $user['parent-uid'];
$parents = [0 => L10n::t('No parent user')];
}
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
notice(L10n::t('Profile not found.') . EOL);
return;
}
intval($cid),
intval($uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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);
if (($status == 0) && $intro_id) {
$intro = DBA::selectFirst('intro', ['note'], ['id' => $intro_id]);
- if (DBA::is_result($intro)) {
+ if (DBA::isResult($intro)) {
DBA::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
}
);
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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 (DBA::is_result($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
+ if (DBA::isResult($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
$ret = Diaspora::sendShare($user, $contact);
logger('share returns: ' . $ret);
}
// Find our user's account
$user = DBA::selectFirst('user', [], ['nickname' => $node]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
$message = L10n::t('No user record found for \'%s\' ', $node);
System::xmlExit(3, $message); // failure
// NOTREACHED
}
$contact = DBA::selectFirst('contact', [], ['url' => $decrypted_source_url, 'uid' => $local_uid]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
if (strstr($decrypted_source_url, 'http:')) {
$newurl = str_replace('http:', 'https:', $decrypted_source_url);
} else {
}
$contact = DBA::selectFirst('contact', [], ['url' => $newurl, 'uid' => $local_uid]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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);
dbesc($dfrn_pubkey),
intval($dfrn_record)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$message = L10n::t('Unable to set your contact credentials on our system.');
System::xmlExit(3, $message);
}
// We're good but now we have to scrape the profile photo and send notifications.
$contact = DBA::selectFirst('contact', ['photo'], ['id' => $dfrn_record]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$photo = $contact['photo'];
} else {
$photo = System::baseUrl() . '/images/person-175.jpg';
dbesc(NETWORK_DFRN),
intval($dfrn_record)
);
- if (!DBA::is_result($r)) { // indicates schema is messed up or total db failure
+ if (!DBA::isResult($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);
}
LIMIT 1",
intval($dfrn_record)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$combined = $r[0];
if ($combined['notify-flags'] & NOTIFY_CONFIRM) {
$nick = defaults($a->argv, 1, '');
$user = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
System::httpExit(500);
}
dfrn_dispatch_private($user, $postdata);
dbesc($a->argv[1])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger('contact not found for dfrn_id ' . $dfrn_id);
System::xmlExit(3, 'Contact not found');
//NOTREACHED
$importer['importer_uid'] = 0;
// This should never fail
- if (!DBA::is_result($importer)) {
+ if (!DBA::isResult($importer)) {
logger('Contact not found for address ' . $msg['author']);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
$cid);
// This should never fail
- if (!DBA::is_result($importer)) {
+ if (!DBA::isResult($importer)) {
logger('Contact not found for address ' . $msg['author']);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
dbesc($a->argv[1])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger('No user data found for ' . $a->argv[1] . ' - SQL: ' . $sql_extra);
killme();
}
dbesc($a->argv[1])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
System::xmlExit(3, 'No ticket');
// NOTREACHED
}
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($r[0]['cid'])
);
- if (!DBA::is_result($c)) {
+ if (!DBA::isResult($c)) {
System::xmlExit(3, 'No profile');
}
DBA::delete('profile_check', ["`expire` < ?", time()]);
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
dbesc($dfrn_id));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
System::xmlExit(1);
return; // NOTREACHED
}
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
System::xmlExit(3, 'No ticket');
// NOTREACHED
}
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($r[0]['cid'])
);
- if (!DBA::is_result($c)) {
+ if (!DBA::isResult($c)) {
System::xmlExit(3, 'No profile');
}
dbesc($challenge)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
killme();
}
}
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
killme();
}
$reputation = 0;
$text = '';
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$reputation = $r[0]['rating'];
$text = $r[0]['reason'];
AND `user`.`nickname` = '%s' $sql_extra LIMIT 1",
dbesc($nickname)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$challenge = '';
$encrypted_id = '';
$id_str = $my_id . '.' . mt_rand(1000, 9999);
]);
}
- $profile = ((DBA::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
+ $profile = ((DBA::isResult($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
switch ($destination_url) {
case 'profile':
dbesc(normalise_link($dfrn_url))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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);
dbesc($dfrn_url),
$parms['key'] // this was already escaped
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
Group::addMember(User::getDefaultGroup(local_user(), $r[0]["network"]), $r[0]['id']);
if (isset($photo)) {
dbesc(DateTimeFormat::utc('now - 24 hours')),
intval($uid)
);
- if (DBA::is_result($r) && count($r) > $maxreq) {
+ if (DBA::isResult($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);
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE "
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
if (!$rr['rel']) {
DBA::delete('contact', ['id' => $rr['cid'], 'self' => false]);
dbesc($url)
);
- if (DBA::is_result($ret)) {
+ if (DBA::isResult($ret)) {
if (strlen($ret[0]['issued-id'])) {
notice(L10n::t('You have already introduced yourself here.') . EOL);
return;
$parms['url'],
$parms['issued-id']
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact_record = $r[0];
Contact::updateAvatar($photo, $uid, $contact_record["id"], true);
}
dbesc($_GET['confirm_key'])
);
- if (DBA::is_result($intro)) {
+ if (DBA::isResult($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'])
$auto_confirm = false;
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
if ($r[0]['page-flags'] != PAGE_NORMAL && $r[0]['page-flags'] != PAGE_PRVGROUP) {
$auto_confirm = true;
}
$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 (DBA::is_result($cnt)) {
+ if (DBA::isResult($cnt)) {
$a->set_pager_total($cnt['total']);
}
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `contact`.`self`
$sql_extra $order LIMIT $limit"
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
if (in_array('small', $a->argv)) {
$photo = 'thumb';
} else {
$search2 = "%".$search."%";
- /// @TODO These 2 SELECTs are not checked on validity with DBA::is_result()
+ /// @TODO These 2 SELECTs are not checked on validity with DBA::isResult()
$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
$connlnk = "";
$conntxt = "";
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$photo_menu = Contact::photoMenu($contact);
$details = _contact_detail_for_template($contact);
$alt_text = $details['alt_text'];
// Does the local user have this item?
if (local_user()) {
$item = Item::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'uid' => local_user()]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$nick = $a->user["nickname"];
}
}
// Is it an item with uid=0?
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($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 (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
$a->error = 404;
notice(L10n::t('Item not found.') . EOL);
return;
WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
$nickname
);
- if (DBA::is_result($profile)) {
+ if (DBA::isResult($profile)) {
$profiledata = $profile;
}
$profiledata["network"] = NETWORK_DFRN;
if (local_user()) {
$condition = ['guid' => $a->argv[1], 'uid' => local_user()];
$item = Item::selectFirstForUser(local_user(), $fields, $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$item_id = $item["id"];
$item_parent = $item["parent"];
$item_parent_uri = $item['parent-uri'];
if ($item_parent == 0) {
$condition = ['private' => [0, 2], 'guid' => $a->argv[1], 'uid' => 0];
$item = Item::selectFirstForUser(local_user(), $fields, $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$item_id = $item["id"];
$item_parent = $item["parent"];
$item_parent_uri = $item['parent-uri'];
if ($contact_id) {
$groups = Group::getIdsByContactId($contact_id);
$remote_contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
- if (DBA::is_result($remote_contact)) {
+ if (DBA::isResult($remote_contact)) {
$contact = $remote_contact;
$is_remote_contact = true;
}
}
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
- if (DBA::is_result($page_contact)) {
+ if (DBA::isResult($page_contact)) {
$a->page_contact = $page_contact;
}
$is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false);
$params = ['order' => ['uid', 'parent' => true, 'gravity', 'id']];
$items_obj = Item::selectForUser(local_user(), [], $condition, $params);
- if (!DBA::is_result($items_obj)) {
+ if (!DBA::isResult($items_obj)) {
notice(L10n::t('Item not found.') . EOL);
return $o;
}
$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 (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
notice(L10n::t('Item not found') . EOL);
return;
}
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$mail_enabled = true;
if (intval($r[0]['pubmail'])) {
$pubmail_enabled = true;
$links = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$r = Event::sortByDate($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
$events = [];
// transform the event in a usable array
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$r = Event::sortByDate($r);
$events = Event::prepareListForTemplate($r);
}
intval($event_id),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$orig_event = $r[0];
}
}
$ev = Event::getListById(local_user(), $event_id);
// Delete only real events (no birthdays)
- if (DBA::is_result($ev) && $ev[0]['type'] == 'event') {
+ if (DBA::isResult($ev) && $ev[0]['type'] == 'event') {
$del = Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
}
'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 (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
$condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
$item = Item::selectFirst(['author-link'], $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$parts = parse_url($item["author-link"]);
$host = $parts["scheme"]."://".$parts["host"];
$ret['url'] = $ret['addr'];
}
- if (($ret['network'] === NETWORK_DFRN) && !DBA::is_result($r)) {
+ if (($ret['network'] === NETWORK_DFRN) && !DBA::isResult($r)) {
$request = $ret['request'];
$tpl = get_markup_template('dfrn_request.tpl');
} else {
$visible_addons = [];
if (is_array($a->addons) && count($a->addons)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$visible_addons[] = $rr['name'];
}
$visible_addons = [];
if (is_array($a->addons) && count($a->addons)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$visible_addons[] = $rr['name'];
}
intval($contact_id),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Contact not found.') . EOL);
return;
}
intval($new_contact),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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()),
dbesc($hash),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$fsuggest_id = $r[0]['id'];
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($note),
intval($contact_id),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Contact not found.') . EOL);
return;
}
intval($a->argv[1]),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Group not found.') . EOL);
goaway(System::baseUrl() . '/contacts');
return; // NOTREACHED
$result = null;
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$result = Group::removeByName(local_user(), $r[0]['name']);
}
intval($a->argv[2]),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$change = intval($a->argv[2]);
}
}
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Group not found.') . EOL);
goaway(System::baseUrl() . '/contacts');
}
$context['$desc'] = L10n::t('Click on a contact to add or remove.');
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// Format the data of the contacts who aren't in the contact group
foreach ($r as $member) {
if (! in_array($member['id'], $preselected)) {
intval(local_user()),
intval($message_id)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
killme();
}
if (DBA::$connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`");
- if (DBA::is_result($r) && $r[0]['total']) {
+ if (DBA::isResult($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
return replace_macros($tpl, [
'$title' => $install_title,
}
// if this isn't the real parent of the conversation, find it
- if (DBA::is_result($parent_item)) {
+ if (DBA::isResult($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'];
}
}
- if (!DBA::is_result($parent_item)) {
+ if (!DBA::isResult($parent_item)) {
notice(L10n::t('Unable to locate original post.') . EOL);
if (x($_REQUEST, 'return')) {
goaway($return_path);
$user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
- if (!DBA::is_result($user) && !$parent) {
+ if (!DBA::isResult($user) && !$parent) {
return;
}
}
}
- if (DBA::is_result($author)) {
+ if (DBA::isResult($author)) {
$contact_id = $author['id'];
}
foreach ($match[2] as $mtch) {
$fields = ['id', 'filename', 'filesize', 'filetype'];
$attachment = DBA::selectFirst('attach', $fields, ['id' => $mtch]);
- if (DBA::is_result($attachment)) {
+ if (DBA::isResult($attachment)) {
if (strlen($attachments)) {
$attachments .= ',';
}
$datarray['protocol'] = PROTOCOL_DFRN;
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
- if (DBA::is_result($conversation)) {
+ if (DBA::isResult($conversation)) {
if ($conversation['conversation-uri'] != '') {
$datarray['conversation-uri'] = $conversation['conversation-uri'];
}
$datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
- if (!DBA::is_result($datarray)) {
+ if (!DBA::isResult($datarray)) {
logger("Item with id ".$post_id." couldn't be fetched.");
goaway($return_path);
}
}
// select someone by nick or attag in the current network
- if (!DBA::is_result($contact) && ($network != "")) {
+ if (!DBA::isResult($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 (!DBA::is_result($contact) && ($network != "")) {
+ if (!DBA::isResult($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 (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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 (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
$condition = ['name' => $name, 'uid' => $profile_uid];
$contact = DBA::selectFirst('contact', $fields, $condition);
}
dbesc($type),
intval($item_id)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
killme();
}
$item = $r[0];
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $allowed_groups))
);
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
foreach($r as $rr)
$l[] = '<b>' . $rr['name'] . '</b>';
}
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$allowed_users))
);
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
foreach($r as $rr)
$l[] = $rr['name'];
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $deny_groups))
);
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
foreach($r as $rr)
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
}
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$deny_users))
);
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
foreach($r as $rr)
$l[] = '<strike>' . $rr['name'] . '</strike>';
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
$user = DBA::selectFirst('user', ['uid', 'username', 'email'], $condition);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
notice(L10n::t('No valid account found.') . EOL);
goaway(System::baseUrl());
}
$pwdreset_token = $a->argv[1];
$user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
return lostpass_form();
$new_password = User::generateNewPassword();
$result = User::updatePassword($user['uid'], $new_password);
- if (DBA::is_result($result)) {
+ if (DBA::isResult($result)) {
$tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl, [
'$lbl1' => L10n::t('Password Reset'),
$r = q("select * from user where uid = %d limit 1",
intval($_SESSION['submanage'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$uid = intval($r[0]['uid']);
$orig_record = $r[0];
}
$limited_id = 0;
$original_id = $uid;
- if (DBA::is_result($submanage)) {
+ if (DBA::isResult($submanage)) {
foreach ($submanage as $m) {
if ($identity == $m['mid']) {
$limited_id = $m['mid'];
);
// Check if the target user is one of our siblings
- if (!DBA::is_result($r) && ($orig_record['parent-uid'] != 0)) {
+ if (!DBA::isResult($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'])
}
// Check if it's our parent
- if (!DBA::is_result($r) && ($orig_record['parent-uid'] != 0) && ($orig_record['parent-uid'] == $identity)) {
+ if (!DBA::isResult($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 (!DBA::is_result($r) && ($orig_record['uid'] != 0) && ($orig_record['uid'] == $identity)) {
+ if (!DBA::isResult($r) && ($orig_record['uid'] != 0) && ($orig_record['uid'] == $identity)) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($identity)
);
}
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
$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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$notifications = sizeof($r);
}
$r = q("SELECT DISTINCT(`convid`) FROM `mail` WHERE `uid` = %d AND NOT `seen`",
intval($id['uid']));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$notifications = $notifications + $r[0]["introductions"];
}
"SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
return;
}
if (! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
intval($a->argv[2]),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$parent = $r[0]['parent-uri'];
$convid = $r[0]['convid'];
intval(local_user()),
intval($a->argv[2])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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 (!DBA::is_result($r)) {
+ if (!DBA::isResult($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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$prename = $r[0]['name'];
$preurl = $r[0]['url'];
$preid = $r[0]['id'];
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
}
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
info(L10n::t('No messages.') . EOL);
return $o;
}
intval(local_user()),
intval($a->argv[1])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact_id = $r[0]['contact-id'];
$convid = $r[0]['convid'];
} else {
$messages = false;
}
- if (!DBA::is_result($messages)) {
+ if (!DBA::isResult($messages)) {
notice(L10n::t('Message not available.') . EOL);
return $o;
}
dbesc($nick)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
killme();
}
dbesc($search)
);
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
$total = $r[0]['total'];
$results = [];
intval($perpage)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach($r as $rr)
$results[] = [
'name' => $rr['name'],
// 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 (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
if ($contact['addr'] != '') {
$content = '!' . $contact['addr'];
} else {
if ($gid) {
$group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
- if (!DBA::is_result($group)) {
+ if (!DBA::isResult($group)) {
if ($update) {
killme();
}
$contact_str = implode(',', $contacts);
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
- if (DBA::is_result($self)) {
+ if (DBA::isResult($self)) {
$contact_str_self = $self['id'];
}
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
$contact = DBA::selectFirst('contact', $fields, $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$sql_extra = " AND " . $sql_table . ".`contact-id` = " . intval($cid);
$entries[0] = [
// 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 (DBA::is_result($r)) {
+ if (DBA::isResult($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)) {
$items = $r;
- if (DBA::is_result($items)) {
+ if (DBA::isResult($items)) {
$parents_arr = [];
foreach ($items as $item) {
/// @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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$json_info["updated"] = date("c", strtotime($r[0]['updated']));
}
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$json_info["contacts"] = intval($r[0]['total']);
}
}
$last_active = 0;
$condition = ['uid' => $a->profile['uid'], 'self' => true];
$contact = DBA::selectFirst('contact', ['last-item'], $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$last_active = strtotime($contact['last-item']);
}
$condition = ['uid' => $a->profile['uid']];
$user = DBA::selectFirst('user', ['login_date'], $condition);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
if ($last_active < strtotime($user['login_date'])) {
$last_active = strtotime($user['login_date']);
}
$count = 0;
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$count = count($r);
$parents_arr = [];
$condition = ['uid' => local_user(), 'parent' => $parents_arr];
$result = Item::selectForUser(local_user(), [], $condition);
- if (DBA::is_result($result)) {
+ if (DBA::isResult($result)) {
$items = conv_sort(Item::inArray($result), 'commented');
$o .= conversation($a, $items, 'notes', $update);
}
{
$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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$nick = $r[0]['nickname'];
$url = System::baseUrl() . "/display/$nick/$id";
goaway($url);
if ($request_id) {
$intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
- if (DBA::is_result($intro)) {
+ if (DBA::isResult($intro)) {
$intro_id = $intro['id'];
$contact_id = $intro['contact-id'];
} else {
$not_tpl = get_markup_template('notify.tpl');
$r = $nm->getAll(['seen'=>0]);
- if (DBA::is_result($r) > 0) {
+ if (DBA::isResult($r) > 0) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl, [
'$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'],
dbesc($authid), dbesc(normalise_openid($authid))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// successful OpenID login
intval($resolution),
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$data = $r[0]['data'];
$mimetype = $r[0]['type'];
}
dbesc($photo),
intval($resolution)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$sql_extra = permissions_sql($r[0]['uid']);
// Now we'll see if we can access the photo
dbesc($photo),
intval($resolution)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$resolution = $r[0]['scale'];
$data = $r[0]['data'];
$mimetype = $r[0]['type'];
dbesc($nick)
);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return;
}
intval($page_owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$can_post = true;
$visitor = $contact_id;
}
dbesc($album),
intval($page_owner_uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
notice(L10n::t('Album not found.') . EOL);
goaway($_SESSION['photo_return']);
return; // NOTREACHED
dbesc($album)
);
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$res[] = "'" . dbesc($rr['rid']) . "'" ;
}
);
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
intval($page_owner_uid),
dbesc($r[0]['resource-id'])
intval($page_owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$image = new Image($r[0]['data'], $r[0]['type']);
if ($image->isValid()) {
dbesc($resource_id),
intval($page_owner_uid)
);
- if (DBA::is_result($p)) {
+ if (DBA::isResult($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),
if ($item_id) {
$item = Item::selectFirst(['tag', 'inform'], ['id' => $item_id, 'uid' => $page_owner_uid]);
}
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$old_tag = $item['tag'];
$old_inform = $item['inform'];
}
intval($page_owner_uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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),
}
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$newname = $r[0]['name'];
$profile = $r[0]['url'];
$notify = 'cid:' . $r[0]['id'];
intval($page_owner_uid)
);
- if (!DBA::is_result($r) || ($album == L10n::t('Profile Photos'))) {
+ if (!DBA::isResult($r) || ($album == L10n::t('Profile Photos'))) {
$visible = 1;
} else {
$visible = 0;
intval($contact_id),
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$can_post = true;
$contact = $r[0];
$remote_contact = true;
intval($contact_id),
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
$remote_contact = true;
}
intval($owner_uid),
dbesc($album)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
}
$photos = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// "Twist" is only used for the duepunto theme with style "slackr"
$twist = false;
foreach ($r as $rr) {
dbesc($datum)
);
- if (!DBA::is_result($ph)) {
+ if (!DBA::isResult($ph)) {
$ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'
LIMIT 1",
intval($owner_uid),
dbesc($datum)
);
- if (DBA::is_result($ph)) {
+ if (DBA::isResult($ph)) {
notice(L10n::t('Permission denied. Access to this item may be restricted.'));
} else {
notice(L10n::t('Photo not available') . EOL);
intval($owner_uid)
);
- if (DBA::is_result($prvnxt)) {
+ if (DBA::isResult($prvnxt)) {
foreach ($prvnxt as $z => $entry) {
if ($entry['resource-id'] == $ph[0]['resource-id']) {
$prv = $z - 1;
$map = null;
$link_item = [];
- if (DBA::is_result($linked_items)) {
+ if (DBA::isResult($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']]);
]);
}
- if (!DBA::is_result($items)) {
+ if (!DBA::isResult($items)) {
if (($can_post || can_write_wall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl, [
'$return_path' => '',
];
// display comments
- if (DBA::is_result($items)) {
+ if (DBA::isResult($items)) {
foreach ($items as $item) {
builtin_activity_puller($item, $conv_responses);
}
dbesc(L10n::t('Contact Photos'))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
}
);
$photos = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// "Twist" is only used for the duepunto theme with style "slackr"
$twist = false;
foreach ($r as $rr) {
$params = ['order' => ['created' => true]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
- if (DBA::is_result($items)) {
+ if (DBA::isResult($items)) {
$items_unseen = Item::inArray($items);
$arr = ['items' => $items_unseen];
Addon::callHooks('network_ping', $arr);
if (intval(Feature::isEnabled(local_user(), 'groups'))) {
// Find out how unseen network posts are spread across groups
$group_counts = Group::countUnseen();
- if (DBA::is_result($group_counts)) {
+ if (DBA::isResult($group_counts)) {
foreach ($group_counts as $group_count) {
if ($group_count['count'] > 0) {
$groups_unseen[] = $group_count;
if (intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) {
$forum_counts = ForumManager::countUnseenItems();
- if (DBA::is_result($forum_counts)) {
+ if (DBA::isResult($forum_counts)) {
foreach ($forum_counts as $forum_count) {
if ($forum_count['count'] > 0) {
$forums_unseen[] = $forum_count;
WHERE `contact`.`self` = 1"
);
- if (DBA::is_result($regs)) {
+ if (DBA::isResult($regs)) {
$register_count = count($regs);
}
}
dbesc(DateTimeFormat::utc('now + 7 days')),
dbesc(DateTimeFormat::utcNow())
);
- if (DBA::is_result($ev)) {
+ if (DBA::isResult($ev)) {
Cache::set($cachekey, $ev, CACHE_HOUR);
}
}
- if (DBA::is_result($ev)) {
+ if (DBA::isResult($ev)) {
$all_events = count($ev);
if ($all_events) {
$data['birthdays'] = $birthdays;
$data['birthdays-today'] = $birthdays_today;
- if (DBA::is_result($notifs)) {
+ if (DBA::isResult($notifs)) {
foreach ($notifs as $notif) {
if ($notif['seen'] == 0) {
$sysnotify_count ++;
}
// merge all notification types in one array
- if (DBA::is_result($intros)) {
+ if (DBA::isResult($intros)) {
foreach ($intros as $intro) {
$notif = [
'id' => 0,
}
}
- if (DBA::is_result($mails)) {
+ if (DBA::isResult($mails)) {
foreach ($mails as $mail) {
$notif = [
'id' => 0,
}
}
- if (DBA::is_result($regs)) {
+ if (DBA::isResult($regs)) {
foreach ($regs as $reg) {
$notif = [
'id' => 0,
};
usort($notifs, $sort_function);
- if (DBA::is_result($notifs)) {
+ if (DBA::isResult($notifs)) {
// Are the nofications called from the regular process or via the friendica app?
$regularnotifications = (intval($_GET['uid']) && intval($_GET['_']));
}
if (empty($user)) {
$c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
- if (!DBA::is_result($c)) {
+ if (!DBA::isResult($c)) {
System::httpExit(401);
}
$system_mode = true;
where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
dbesc($user)
);
- if (! DBA::is_result($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
+ if (! DBA::isResult($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
System::httpExit(404);
}
dbesc(NETWORK_STATUSNET)
);
}
- if (DBA::is_result($contacts)) {
+ if (DBA::isResult($contacts)) {
$totalResults = intval($contacts[0]['total']);
} else {
$totalResults = 0;
}
if (is_array($contacts)) {
- if (DBA::is_result($contacts)) {
+ if (DBA::isResult($contacts)) {
foreach ($contacts as $contact) {
if (!isset($contact['updated'])) {
$contact['updated'] = '';
intval($uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger('poke: no contact ' . $contact_id);
return;
}
$condition = ['id' => $parent, 'parent' => $parent, 'uid' => $uid];
$item = Item::selectFirst($fields, $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$parent_uri = $item['uri'];
$private = $item['private'];
$allow_cid = $item['allow_cid'];
intval($_GET['c']),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$name = $item['name'];
$id = $item['id'];
}
$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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
goaway(System::baseUrl() . '/profile/' . $r[0]['nickname']);
} else {
logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
intval($contact_id),
intval($a->profile['profile_uid'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
$remote_contact = true;
}
intval($a->profile['profile_uid']), intval(GRAVITY_ACTIVITY)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return '';
}
} else {
intval(PAGE_PRVGROUP)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
} else {
$sql_extra3 = "";
// search for new items (update routine)
$_SESSION['last_updated'][$last_updated_key] = time();
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$parents_arr[] = $rr['item_id'];
}
intval(local_user())
);
- if (DBA::is_result($r) && (!intval($r[0]['is-default']))) {
+ if (DBA::isResult($r) && (!intval($r[0]['is-default']))) {
$is_default_profile = 0;
}
}
dbesc(local_user()), intval($scale));
$url = System::baseUrl() . '/profile/' . $a->user['nickname'];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$base_image = $r[0];
$Image = new Image($base_image['data'], $base_image['type']);
dbesc($resource_id)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
notice(L10n::t('Permission denied.') . EOL);
return;
}
intval($a->argv[2]),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL);
goaway('profiles');
return; // NOTREACHED
intval($a->argv[2]),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
info(L10n::t('Profile deleted.').EOL);
}
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user()));
- $num_profiles = (DBA::is_result($r0) ? count($r0) : 0);
+ $num_profiles = (DBA::isResult($r0) ? count($r0) : 0);
$name = L10n::t('Profile-') . ($num_profiles + 1);
);
info(L10n::t('New profile created.') . EOL);
- if (DBA::is_result($r3) && count($r3) == 1) {
+ if (DBA::isResult($r3) && count($r3) == 1) {
goaway('profiles/' . $r3[0]['id']);
}
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user()));
- $num_profiles = (DBA::is_result($r0) ? count($r0) : 0);
+ $num_profiles = (DBA::isResult($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(! DBA::is_result($r1)) {
+ if(! DBA::isResult($r1)) {
notice(L10n::t('Profile unavailable to clone.') . EOL);
killme();
return;
dbesc($name)
);
info(L10n::t('New profile created.') . EOL);
- if ((DBA::is_result($r3)) && (count($r3) == 1)) {
+ if ((DBA::isResult($r3)) && (count($r3) == 1)) {
goaway('profiles/'.$r3[0]['id']);
}
intval($a->argv[1]),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL);
killme();
return;
intval($a->argv[1]),
intval(local_user())
);
- if (! DBA::is_result($orig)) {
+ if (! DBA::isResult($orig)) {
notice(L10n::t('Profile not found.') . EOL);
return;
}
dbesc($newname),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
dbesc($lookup),
intval(local_user())
);
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$prf = $r[0]['url'];
$newname = $r[0]['name'];
}
intval(local_user())
);
- /// @TODO decide to use dbm::is_result() here and check $r
+ /// @TODO decide to use DBA::isResult() here and check $r
if ($r) {
info(L10n::t('Profile updated.') . EOL);
}
intval($a->argv[1]),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL);
return;
}
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user()
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
//Go to the default profile.
goaway('profiles/' . $r[0]['id']);
}
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user());
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$tpl = get_markup_template('profile_entry.tpl');
intval($a->argv[2]),
intval(local_user())
);
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
$change = intval($a->argv[2]);
}
intval($a->argv[1]),
intval(local_user())
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('Invalid profile identifier.') . EOL );
return;
}
);
$ingroup = [];
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
foreach($r as $member)
$ingroup[] = $member['id'];
$members = $r;
$ingroup = [];
- if (DBA::is_result($r))
+ if (DBA::isResult($r))
foreach($r as $member)
$ingroup[] = $member['id'];
}
dbesc(NETWORK_DFRN)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
if(! in_array($member['id'],$ingroup)) {
$photo = null;
if (!$direct_cache && ($cachefile == '')) {
$photo = DBA::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
- if (DBA::is_result($photo)) {
+ if (DBA::isResult($photo)) {
$img_str = $photo['data'];
$mime = $photo['desc'];
if ($mime == '') {
}
}
- if (!DBA::is_result($photo)) {
+ if (!DBA::isResult($photo)) {
// It shouldn't happen but it does - spaces in URL
$_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']);
$redirects = 0;
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
$owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
- if (!DBA::is_result($owner)) {
+ if (!DBA::isResult($owner)) {
logger('Local account not found: ' . $nick);
hub_return(false, '');
}
}
$contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
logger('Contact ' . $contact_id . ' not found.');
hub_return(false, '');
}
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
- if (!DBA::is_result($importer)) {
+ if (!DBA::isResult($importer)) {
hub_post_return();
}
$condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
$contact = DBA::selectFirst('contact', [], $condition);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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 (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
logger('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
hub_post_return();
}
// fetch user from database given the nickname
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
$owner = DBA::selectFirst('user', ['uid', 'hidewall'], $condition);
- if (!DBA::is_result($owner)) {
+ if (!DBA::isResult($owner)) {
logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
System::httpExit(404);
}
$condition = ['uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'self' => true];
$contact = DBA::selectFirst('contact', ['poll'], $condition);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
logger('Self contact for user ' . $owner['uid'] . ' not found.');
System::httpExit(404);
}
$guid = $a->argv[2];
$importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
- if (!DBA::is_result($importer)) {
+ if (!DBA::isResult($importer)) {
System::httpExit(500);
}
}
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 (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
notice(L10n::t('Contact not found.'));
goaway(System::baseUrl());
}
// between the puplic contact we have found and the local user.
$contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$cid = $contact['id'];
}
);
- if (!DBA::is_result($register)) {
+ if (!DBA::isResult($register)) {
return false;
}
intval($register[0]['uid'])
);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
killme();
}
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
intval($user[0]['uid'])
);
- if (DBA::is_result($r) && $r[0]['net-publish']) {
+ if (DBA::isResult($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);
dbesc($hash)
);
- if (!DBA::is_result($register)) {
+ if (!DBA::isResult($register)) {
return false;
}
$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 (!DBA::is_result($admin)) {
+ if (!DBA::isResult($admin)) {
continue;
}
notification([
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
System::httpExit(500);
}
dbesc(normalise_link($author_link)),
intval($importer['uid'])
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($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);
// Have we ignored the person?
// If so we can not accept this post.
- //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']) {
+ //if((DBA::isResult($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
+ if (DBA::isResult($r) && $r[0]['blocked']) {
logger('Ignoring this author.');
System::httpExit(202);
// NOTREACHED
// Placeholder for hub discovery.
$hub = '';
- $contact_rec = ((DBA::is_result($r)) ? $r[0] : null);
+ $contact_rec = ((DBA::isResult($r)) ? $r[0] : null);
OStatus::import($data, $importer, $contact_rec, $hub);
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$saved = [];
foreach ($r as $rr) {
$saved[] = [
intval(local_user()),
dbesc($search)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
DBA::insert('search', ['uid' => local_user(), 'term' => $search]);
}
}
$r = Item::inArray($items);
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
info(L10n::t('No results.') . EOL);
return $o;
}
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
DBA::insert('mailacct', ['uid' => local_user()]);
}
if (strlen($mail_pass)) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$eacct = $r[0];
$mb = Email::constructMailboxName($eacct);
if (!$err) {
$result = User::updatePassword(local_user(), $newpass);
- if (DBA::is_result($result)) {
+ if (DBA::isResult($result)) {
info(L10n::t('Password changed.') . EOL);
} else {
notice(L10n::t('Password update failed. Please try again.') . EOL);
dbesc($language),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
info(L10n::t('Settings updated.') . EOL);
}
dbesc($a->argv[3]),
local_user());
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
notice(L10n::t("You can't edit this application."));
return;
}
return;
}
- /// @TODO validate result with DBA::is_result()
+ /// @TODO validate result with DBA::isResult()
$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
$settings_addons = "";
$r = q("SELECT * FROM `hook` WHERE `hook` = 'addon_settings' ");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$settings_addons = L10n::t('No Addon settings configured');
}
$r = null;
}
- $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);
+ $mail_server = ((DBA::isResult($r)) ? $r[0]['server'] : '');
+ $mail_port = ((DBA::isResult($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
+ $mail_ssl = ((DBA::isResult($r)) ? $r[0]['ssltype'] : '');
+ $mail_user = ((DBA::isResult($r)) ? $r[0]['user'] : '');
+ $mail_replyto = ((DBA::isResult($r)) ? $r[0]['reply_to'] : '');
+ $mail_pubmail = ((DBA::isResult($r)) ? $r[0]['pubmail'] : 0);
+ $mail_action = ((DBA::isResult($r)) ? $r[0]['action'] : 0);
+ $mail_movetofolder = ((DBA::isResult($r)) ? $r[0]['movetofolder'] : '');
+ $mail_chk = ((DBA::isResult($r)) ? $r[0]['last_check'] : NULL_DATE);
$tpl = get_markup_template('settings/connectors.tpl');
*/
$profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
- if (!DBA::is_result($profile)) {
+ if (!DBA::isResult($profile)) {
notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
return;
}
'guid', 'created', 'plink', 'title'];
$item = Item::selectFirst($fields, ['id' => $post_id]);
- if (!DBA::is_result($item) || $item['private'] == 1) {
+ if (!DBA::isResult($item) || $item['private'] == 1) {
killme();
}
}
$item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $message_id]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
killme();
}
$condition = ["`parent` = ? OR `parent-uri` = ? AND `parent` = `id`", $item_id, $item_id];
$item = Item::selectFirst([], $condition);
- if (empty($item_id) || !DBA::is_result($item)) {
+ if (empty($item_id) || !DBA::isResult($item)) {
logger('subthread: no item ' . $item_id);
return;
}
intval($item['contact-id']),
intval($item['uid'])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
if (!$r[0]['self']) {
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$owner = $r[0];
}
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
}
}
$r = GContact::suggestionQuery(local_user());
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
$o .= L10n::t('No suggestions available. If this is a new site, please try again in 24 hours.');
return $o;
}
$item = Item::selectFirst([], ['id' => $item_id]);
- if (!$item_id || !DBA::is_result($item)) {
+ if (!$item_id || !DBA::isResult($item)) {
logger('tagger: no item ' . $item_id);
return;
}
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$owner_nick = $r[0]['nickname'];
$blocktags = $r[0]['blocktags'];
}
$r = q("select * from contact where self = 1 and uid = %d limit 1",
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
} else {
logger('tagger: no contact_id');
// if the original post is on this site, update it.
$original_item = Item::selectFirst(['tag', 'id', 'uid'], ['origin' => true, 'uri' => $item['uri']]);
- if (DBA::is_result($original_item)) {
+ if (DBA::isResult($original_item)) {
$x = q("SELECT `blocktags` FROM `user` WHERE `uid`=%d LIMIT 1",
intval($original_item['uid'])
);
dbesc($term)
);
- if (DBA::is_result($x) && !$x[0]['blocktags'] && $t[0]['tcount'] == 0){
+ if (DBA::isResult($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,
$item_id = (x($_POST,'item') ? intval($_POST['item']) : 0);
$item = Item::selectFirst(['tag'], ['id' => $item_id, 'uid' => local_user()]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
goaway(System::baseUrl() . '/' . $_SESSION['photo_return']);
}
}
$item = Item::selectFirst(['tag'], ['id' => $item_id, 'uid' => local_user()]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
goaway(System::baseUrl() . '/' . $_SESSION['photo_return']);
}
function _uexport_multirow($query) {
$result = [];
$r = q($query);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$p = [];
foreach ($rr as $k => $v) {
function _uexport_row($query) {
$result = [];
$r = q($query);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
foreach ($rr as $k => $v) {
$result[$k] = $v;
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$total = $r[0]['total'];
}
// chunk the output to avoid exhausting memory
normalise_link($url), $url, NETWORK_STATUSNET];
$contact = DBA::selectFirst('contact', [], $condition);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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])) {
WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
Contact::terminateFriendship($r[0], $contact);
}
}
normalise_link($url), $url, NETWORK_STATUSNET];
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
notice(L10n::t("You aren't a friend of this contact.").EOL);
$submit = "";
// NOTREACHED
dbesc($video_id)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
intval(local_user()),
dbesc($video_id)
intval(local_user())
);
- if (DBA::is_result($i)) {
+ if (DBA::isResult($i)) {
Item::deleteForUser(['id' => $i[0]['id']], local_user());
}
}
intval($contact_id),
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$can_post = true;
$contact = $r[0];
$remote_contact = true;
intval($contact_id),
intval($owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
$remote_contact = true;
}
$sql_extra GROUP BY hash",
intval($a->data['user']['uid'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
}
$videos = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$alt_e = $rr['filename'];
$name_e = $rr['album'];
dbesc($nick)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
return;
}
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
}
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
info(L10n::t('No contacts.').EOL);
return $o;
}
$item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
if (is_ajax()) {
echo str_replace("\n", '<br />', $item['body']);
killme();
$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 (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
if ($r_json) {
echo json_encode(['error'=>L10n::t('Invalid request.')]);
killme();
intval($contact_id),
intval($page_owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$can_post = true;
$visitor = $contact_id;
}
dbesc($hash)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
$msg = L10n::t('File upload failed.');
if ($r_json) {
echo json_encode(['error'=>$msg]);
dbesc($nick)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
if ($r_json) {
echo json_encode(['error' => L10n::t('Invalid request.')]);
killme();
intval($contact_id),
intval($page_owner_uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$can_post = true;
$visitor = $contact_id;
}
dbesc($recipient)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
logger('wallmessage: no recipient');
return;
}
dbesc($recipient)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
notice(L10n::t('No recipient.') . EOL);
logger('wallmessage: no recipient');
return;
}
$user = DBA::selectFirst('user', [], ['nickname' => $name]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
killme();
}
// 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 (DBA::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
+ if (DBA::isResult($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
$page_theme = $user['theme'];
}
}
$s = DBA::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
$r = DBA::toArray($s);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$selected = (($rr['id'] == $current || ($current == 0 && $rr['is-default'] == 1)) ? " selected=\"selected\" " : "");
$o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$networkname = $r['platform'];
}
}
$total = count($contacts);
$visible_forums = 10;
- if (DBA::is_result($contacts)) {
+ if (DBA::isResult($contacts)) {
$id = 0;
foreach ($contacts as $contact) {
// user info
$contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
$userinfo = [
- 'icon' => (DBA::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
+ 'icon' => (DBA::isResult($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
'name' => $a->user['username'],
];
} else {
$condition = ['url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth];
$oembed = DBA::selectFirst('oembed', ['content'], $condition);
- if (DBA::is_result($oembed)) {
+ if (DBA::isResult($oembed)) {
$txt = $oembed["content"];
} else {
$txt = Cache::get($a->videowidth . $embedurl);
if (Profile::getMyURL()) {
$contact = DBA::selectFirst('contact', ['id'],
['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$cid = $contact['id'];
} else {
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
- if (DBA::is_result($gcontact)) {
+ if (DBA::isResult($gcontact)) {
$zcid = $gcontact['id'];
}
}
$type,
TERM_OBJ_POST
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return [];
}
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
Addon::callHooks($a->module . '_pre_' . $selname, $arr);
- if (DBA::is_result($contacts)) {
+ if (DBA::isResult($contacts)) {
foreach ($contacts as $contact) {
if (in_array($contact['id'], $preselected)) {
$selected = ' selected="selected" ';
$receiverlist = [];
- if (DBA::is_result($contacts)) {
+ if (DBA::isResult($contacts)) {
foreach ($contacts as $contact) {
if (in_array($contact['id'], $preselected)) {
$selected = ' selected="selected"';
if (!$imap_disabled) {
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
- if (DBA::is_result($mailacct)) {
+ if (DBA::isResult($mailacct)) {
$mail_enabled = true;
$pubmail_enabled = !empty($mailacct['pubmail']);
}
$addons = Config::get('system', 'addon');
if (strlen($addons)) {
$r = DBA::select('addon', [], ['installed' => 1]);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$installed = DBA::toArray($r);
} else {
$installed = [];
{
$cache = DBA::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
- if (DBA::is_result($cache)) {
+ if (DBA::isResult($cache)) {
$cached = $cache['v'];
$value = @unserialize($cached);
}
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
- if (DBA::is_result($config)) {
+ if (DBA::isResult($config)) {
// manage array value
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
$a = self::getApp();
$pconfigs = DBA::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]);
- if (DBA::is_result($pconfigs)) {
+ if (DBA::isResult($pconfigs)) {
while ($pconfig = DBA::fetch($pconfigs)) {
$k = $pconfig['k'];
}
$pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
- if (DBA::is_result($pconfig)) {
+ if (DBA::isResult($pconfig)) {
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
self::getApp()->setPConfigValue($uid, $cat, $k, $val);
{
if ($refresh) {
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
- if (DBA::is_result($config)) {
+ if (DBA::isResult($config)) {
self::getApp()->setConfigValue($cat, $k, $config['v']);
}
}
if ($refresh) {
$config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
- if (DBA::is_result($config)) {
+ if (DBA::isResult($config)) {
self::getApp()->setPConfigValue($uid, $cat, $k, $config['v']);
} else {
self::getApp()->deletePConfigValue($uid, $cat, $k);
$nurl = normalise_link($net['url']);
$contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
$this->out('NOTICE: The account should be silenced from the global community page');
} else {
$nick = $this->getArgument(0);
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
throw new RuntimeException(L10n::t('User not found'));
}
DBA::lock('locks');
$lock = DBA::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
- if (DBA::is_result($lock)) {
+ if (DBA::isResult($lock)) {
if ($lock['locked']) {
// We want to lock something that was already locked by us? So we got the lock.
if ($lock['pid'] == getmypid()) {
{
$lock = DBA::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
- if (DBA::is_result($lock)) {
+ if (DBA::isResult($lock)) {
return $lock['locked'] !== false;
} else {
return false;
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $this->_set_extra($r);
}
intval($id),
intval(local_user())
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $this->_set_extra($r)[0];
}
return null;
$notif = [];
$arr = [];
- if (DBA::is_result($notifs)) {
+ if (DBA::isResult($notifs)) {
foreach ($notifs as $it) {
// Because we use different db tables for the notification query
// we have sometimes $it['unseen'] and sometimes $it['seen].
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
- if (DBA::is_result($items)) {
+ if (DBA::isResult($items)) {
$notifs = $this->formatNotifs(Item::inArray($items), $ident);
}
intval($limit)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$notifs = $this->formatNotifs($r, $ident);
}
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
- if (DBA::is_result($items)) {
+ if (DBA::isResult($items)) {
$notifs = $this->formatNotifs(Item::inArray($items), $ident);
}
$params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
- if (DBA::is_result($items)) {
+ if (DBA::isResult($items)) {
$notifs = $this->formatNotifs(Item::inArray($items), $ident);
}
intval($start),
intval($limit)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$notifs = $this->formatIntros($r);
}
}
$session = DBA::selectFirst('session', ['data'], ['sid' => $session_id]);
- if (DBA::is_result($session)) {
+ if (DBA::isResult($session)) {
Session::$exists = true;
return $session['data'];
}
{
$condition = ["`executed` <= ? AND NOT `done`", NULL_DATE];
$workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
- if (DBA::is_result($workerqueue)) {
+ if (DBA::isResult($workerqueue)) {
return $workerqueue["priority"];
} else {
return 0;
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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$max = $r["Value"];
}
// Or it can be granted. This overrides the system variable
// 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 (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$max = intval($r["Value"]);
return false;
}
$r = DBA::fetchFirst("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$used = intval($r["Value"]);
);
// No active processes at all? Fine
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$priorities = [];
// There can already be jobs for us in the queue.
$r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
self::$db_duration += (microtime(true) - $stamp);
return DBA::toArray($r);
}
$row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => 1]);
// When we don't have a row, no job is running
- if (!DBA::is_result($row)) {
+ if (!DBA::isResult($row)) {
return false;
}
}
$r = self::p("EXPLAIN ".$query);
- if (!self::is_result($r)) {
+ if (!self::isResult($r)) {
return;
}
switch (self::$driver) {
case 'pdo':
$r = self::p("SELECT 1");
- if (self::is_result($r)) {
+ if (self::isResult($r)) {
$row = self::toArray($r);
$connected = ($row[0]['1'] == '1');
}
*
* @return boolean Whether $array is a filled array or an object with rows
*/
- public static function is_result($array)
+ public static function isResult($array)
{
// It could be a return value from an update statement
if (is_bool($array)) {
$r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
dbesc(DBA::databaseName()));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
echo L10n::t('There are no tables on MyISAM.')."\n";
return;
}
echo $sql."\n";
$result = DBA::e($sql);
- if (!DBA::is_result($result)) {
+ if (!DBA::isResult($result)) {
self::printUpdateError($sql);
}
}
);
// No valid result?
- if (!DBA::is_result($adminlist)) {
+ if (!DBA::isResult($adminlist)) {
logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_INFO);
// Don't continue
$table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
- if (DBA::is_result($table_status)) {
+ if (DBA::isResult($table_status)) {
$table_status = $table_status[0];
} else {
$table_status = [];
$fielddata = [];
$indexdata = [];
- if (DBA::is_result($indexes)) {
+ if (DBA::isResult($indexes)) {
foreach ($indexes AS $index) {
if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
$indexdata[$index["Key_name"]] = ['UNIQUE'];
$indexdata[$index["Key_name"]][] = $column;
}
}
- if (DBA::is_result($structures)) {
+ if (DBA::isResult($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)'];
}
}
}
- if (DBA::is_result($full_columns)) {
+ if (DBA::isResult($full_columns)) {
foreach ($full_columns AS $column) {
$fielddata[$column["Field"]]["Collation"] = $column["Collation"];
$fielddata[$column["Field"]]["comment"] = $column["Comment"];
$tables = q("SHOW TABLES");
}
- if (DBA::is_result($tables)) {
+ if (DBA::isResult($tables)) {
foreach ($tables AS $table) {
$table = current($table);
$temp_name = $name;
if (!isset($database[$name])) {
$r = self::createTable($name, $structure, $verbose, $action);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($name);
}
$is_new_table = true;
DBA::e("SET session old_alter_table=1;");
} else {
$r = DBA::e("DROP TABLE IF EXISTS `".$temp_name."`;");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
$r = DBA::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
}
$r = DBA::e($sql3);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
}
if ($is_unique && ($temp_name != $name)) {
DBA::e("SET session old_alter_table=0;");
} else {
$r = DBA::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
$r = DBA::e("DROP TABLE `".$name."`;");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
$r = DBA::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
logger("Updated threads", LOGGER_DEBUG);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
Config::set("system", "post_update_version", 1198);
logger("Done", LOGGER_DEBUG);
return true;
FROM `user`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
foreach ($r as $user) {
$gid,
local_user()
);
- if (DBA::is_result($stmt)) {
+ if (DBA::isResult($stmt)) {
$return = DBA::toArray($stmt);
}
}
}
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return false;
}
$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 (!DBA::is_result($self)) {
+ if (!DBA::isResult($self)) {
return;
}
$fields = ['nickname', 'page-flags', 'account-type'];
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($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 (!DBA::is_result($profile)) {
+ if (!DBA::isResult($profile)) {
return;
}
'contact-type' => $user['account-type'], 'xmpp' => $profile['xmpp']];
$avatar = DBA::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
- if (DBA::is_result($avatar)) {
+ if (DBA::isResult($avatar)) {
if ($update_avatar) {
$fields['avatar-date'] = DateTimeFormat::utcNow();
}
{
// We want just to make sure that we don't delete our "self" contact
$contact = DBA::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
- if (!DBA::is_result($contact) || !intval($contact['uid'])) {
+ if (!DBA::isResult($contact) || !intval($contact['uid'])) {
return;
}
$r = DBA::toArray($s);
// Fetch contact data from the contact table for the given user, checking with the alias
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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);
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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));
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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);
}
// Fetch the data from the gcontact table
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// If there is more than one entry we filter out the connector networks
if (count($r) > 1) {
foreach ($r as $id => $result) {
intval($uid)
);
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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",
}
// Fetch the data from the gcontact table
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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'",
);
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$data = Probe::uri($addr);
$profile = self::getDetailsByURL($data['url'], $uid);
// 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 (DBA::is_result($contact_own)) {
+ if (DBA::isResult($contact_own)) {
return self::photoMenu($contact_own, $uid);
} else {
$profile_link = self::magicLink($contact['url']);
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
// Then the addr (nick@server.tld)
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
}
// Then the alias (which could be anything)
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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 (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$contact_id = $contact["id"];
// Update the contact every 7 days
// Get data from the gcontact table
$fields = ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'];
$contact = DBA::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
$contact = DBA::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
}
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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 (!DBA::is_result($contact)) {
+ if (!DBA::isResult($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 (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'network', 'priority', 'batch', 'request', 'confirm'];
$condition = ['url' => [$url, normalise_link($url), $ssl_url]];
$contact = $default;
}
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return 0;
} else {
$data = array_merge($data, $contact);
$s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
$contacts = DBA::toArray($s);
- if (!DBA::is_result($contacts)) {
+ if (!DBA::isResult($contacts)) {
return 0;
}
// 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 (DBA::is_result($gcontact)) {
+ if (DBA::isResult($gcontact)) {
// Only use the information when the probing hadn't fetched these values
if ($data['keywords'] != '') {
unset($gcontact['keywords']);
$contact = DBA::selectFirst('contact', $fields, ['id' => $contact_id]);
// This condition should always be true
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return $contact_id;
}
}
$blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]);
- if (!DBA::is_result($blocked)) {
+ if (!DBA::isResult($blocked)) {
return false;
}
return (bool) $blocked['blocked'];
}
$hidden = DBA::selectFirst('contact', ['hidden'], ['id' => $cid]);
- if (!DBA::is_result($hidden)) {
+ if (!DBA::isResult($hidden)) {
return false;
}
return (bool) $hidden['hidden'];
dbesc(normalise_link($contact_url))
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return '';
}
public static function updateAvatar($avatar, $uid, $cid, $force = false)
{
$contact = DBA::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return false;
} else {
$data = [$contact["photo"], $contact["thumb"], $contact["micro"]];
// Update the public contact (contact id = 0)
if ($uid != 0) {
$pcontact = DBA::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
- if (DBA::is_result($pcontact)) {
+ if (DBA::isResult($pcontact)) {
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
}
}
$fields = ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'];
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return false;
}
dbesc($ret['network'])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($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)),
);
}
- if (($ret['network'] === NETWORK_DFRN) && !DBA::is_result($r)) {
+ if (($ret['network'] === NETWORK_DFRN) && !DBA::isResult($r)) {
if ($interactive) {
if (strlen($a->urlpath)) {
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
$writeable = 1;
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
// update contact
$new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
}
$contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
$result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL;
return $result;
}
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN])) {
// create a follow slap
$item = [];
/// @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 (DBA::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
+ if (DBA::isResult($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
// create notification
$hash = random_string();
]);
}
- } elseif (DBA::is_result($user) && in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
+ } elseif (DBA::isResult($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)
// 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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']);
$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 (DBA::is_result($s)) {
+ if (DBA::isResult($s)) {
continue;
}
$fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source'];
$old_conv = DBA::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
- if (DBA::is_result($old_conv)) {
+ if (DBA::isResult($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'] != '') {
if ($event['id']) {
// has the event actually changed?
$existing_event = DBA::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]);
- if (!DBA::is_result($existing_event) || ($existing_event['edited'] === $event['edited'])) {
+ if (!DBA::isResult($existing_event) || ($existing_event['edited'] === $event['edited'])) {
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
- return DBA::is_result($item) ? $item['id'] : 0;
+ return DBA::isResult($item) ? $item['id'] : 0;
}
$updated_fields = [
DBA::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]);
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($event['uri']) . '</id>';
$object .= '<content>' . xmlify(self::getBBCode($event)) . '</content>';
$object .= '</object>' . "\n";
intval($event_id)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$return = self::removeDuplicates($r);
}
dbesc($event_params["adjust_finish"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$return = self::removeDuplicates($r);
}
$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 (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$event = array_merge($event, $item);
}
}
$events = DBA::select('event', $fields, $conditions);
- if (DBA::is_result($events)) {
+ if (DBA::isResult($events)) {
$return = DBA::toArray($events);
}
$process = false;
$user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
$timezone = $user['timezone'];
}
intval($zcid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
q(
"INSERT INTO `glink` (`cid`, `uid`, `gcid`, `zcid`, `updated`) VALUES (%d, %d, %d, %d, '%s') ",
intval($cid),
dbesc(normalise_link($gcontact['url'])),
dbesc(NETWORK_STATUSNET)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$gcontact['network'] = $r[0]["network"];
}
dbesc(normalise_link($gcontact['url'])),
dbesc(NETWORK_STATUSNET)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$gcontact['network'] = $r[0]["network"];
}
}
dbesc(normalise_link($gcontact['url']))
);
- if (DBA::is_result($x)) {
+ if (DBA::isResult($x)) {
if (!isset($gcontact['network']) && ($x[0]["network"] != NETWORK_STATUSNET)) {
$gcontact['network'] = $x[0]["network"];
}
);
// logger("countCommonFriends: $uid $cid {$r[0]['total']}");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $r[0]['total'];
}
return 0;
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $r[0]['total'];
}
intval($limit)
);
- /// @TODO Check all calling-findings of this function if they properly use DBA::is_result()
+ /// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
return $r;
}
intval($limit)
);
- /// @TODO Check all calling-findings of this function if they properly use DBA::is_result()
+ /// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
return $r;
}
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $r[0]['total'];
}
intval($limit)
);
- /// @TODO Check all calling-findings of this function if they properly use DBA::is_result()
+ /// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
return $r;
}
intval($limit)
);
- if (DBA::is_result($r) && count($r) >= ($limit -1)) {
+ if (DBA::isResult($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.
dbesc(NETWORK_DIASPORA)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$base = substr($rr['poco'], 0, strrpos($rr['poco'], '/'));
if (! in_array($base, $done)) {
dbesc(normalise_link($contact["url"]))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$gcontact_id = $r[0]["id"];
// Update every 90 days
dbesc(normalise_link($contact["url"]))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$gcontact_id = $r[0]["id"];
$doprobing = in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""]);
/// @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 (DBA::is_result($public_contact)) {
+ if (DBA::isResult($public_contact)) {
logger("Update public contact ".$public_contact["id"], LOGGER_DEBUG);
Contact::updateAvatar($contact["photo"], 0, $public_contact["id"]);
dbesc($last_update)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
dbesc(NETWORK_DFRN)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return dirname($r[0]['url']);
}
// 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 (DBA::is_result($group) && $group['deleted']) {
+ if (DBA::isResult($group) && $group['deleted']) {
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
notice(L10n::t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
}
}
$group = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
- if (DBA::is_result($group)) {
+ if (DBA::isResult($group)) {
return $group['id'];
}
}
$group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
- if (!DBA::is_result($group)) {
+ if (!DBA::isResult($group)) {
return false;
}
// remove group from default posting lists
$user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
$change = false;
if ($user['def_gid'] == $gid) {
// 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 (DBA::is_result($existing)) {
+ if (DBA::isResult($existing)) {
$item['uri-hash'] = $existing['uri-hash'];
} else {
$item['uri-hash'] = self::itemHash($item['uri'], $item['created']);
if (empty($item['iaid'])) {
$item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
- if (DBA::is_result($item_activity)) {
+ if (DBA::isResult($item_activity)) {
$item_fields = ['iaid' => $item_activity['id'], 'icid' => null];
foreach (self::MIXED_CONTENT_FIELDLIST as $field) {
if (self::isLegacyMode()) {
if (empty($item['icid'])) {
$item_content = DBA::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]);
- if (DBA::is_result($item_content)) {
+ if (DBA::isResult($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) {
'deleted', 'file', 'resource-id', 'event-id', 'attach',
'verb', 'object-type', 'object', 'target', 'contact-id'];
$item = self::selectFirst($fields, ['id' => $item_id]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
logger('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG);
return false;
}
}
$parent = self::selectFirst(['origin'], ['id' => $item['parent']]);
- if (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
$parent = ['origin' => false];
}
// 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 (DBA::is_result($global_item)) {
+ if (DBA::isResult($global_item)) {
DBA::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
}
}
}
$i = self::selectFirst(['id', 'contact-id', 'tag'], ['uri' => $xt->id, 'uid' => $item['uid']]);
- if (!DBA::is_result($i)) {
+ if (!DBA::isResult($i)) {
return;
}
// 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 (DBA::is_result($self)) {
+ if (DBA::isResult($self)) {
$contact_id = $self["id"];
}
}
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
$user = DBA::selectFirst('user', ['expire'], ['uid' => $uid]);
- if (DBA::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
+ if (DBA::isResult($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
$expire_interval = $user['expire'];
}
trim($item['uri']), $item['uid'],
NETWORK_DIASPORA, NETWORK_DFRN, NETWORK_OSTATUS];
$existing = self::selectFirst(['id', 'network'], $condition);
- if (DBA::is_result($existing)) {
+ if (DBA::isResult($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']);
// Ensure to always have the same creation date.
$existing = DBA::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]);
- if (DBA::is_result($existing)) {
+ if (DBA::isResult($existing)) {
$item['created'] = $existing['created'];
$item['uri-hash'] = $existing['uri-hash'];
}
$params = ['order' => ['id' => false]];
$parent = self::selectFirst($fields, $condition, $params);
- if (DBA::is_result($parent)) {
+ if (DBA::isResult($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.
$params = ['order' => ['id' => false]];
$toplevel_parent = self::selectFirst($fields, $condition, $params);
- if (DBA::is_result($toplevel_parent)) {
+ if (DBA::isResult($toplevel_parent)) {
$parent = $toplevel_parent;
}
}
// 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 (DBA::is_result($user)) {
+ if (DBA::isResult($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);
$ret = DBA::insert('item', $item);
// When the item was successfully stored we fetch the ID of the item.
- if (DBA::is_result($ret)) {
+ if (DBA::isResult($ret)) {
$current_post = DBA::lastInsertId();
} else {
// This can happen - for example - if there are locking timeouts.
*/
if (!$deleted && !$dontcache) {
$posted_item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $current_post]);
- if (DBA::is_result($posted_item)) {
+ if (DBA::isResult($posted_item)) {
if ($notify) {
Addon::callHooks('post_local_end', $posted_item);
} else {
// Do we already have this content?
$item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
- if (DBA::is_result($item_activity)) {
+ if (DBA::isResult($item_activity)) {
$item['iaid'] = $item_activity['id'];
logger('Fetched activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')');
} elseif (DBA::insert('item-activity', $fields)) {
// Do we already have this content?
$item_content = DBA::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]);
- if (DBA::is_result($item_content)) {
+ if (DBA::isResult($item_content)) {
$item['icid'] = $item_content['id'];
logger('Fetched content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')');
} elseif (DBA::insert('item-content', $fields)) {
{
$condition = ["`id` IN (SELECT `parent` FROM `item` WHERE `id` = ?)", $itemid];
$parent = self::selectFirst(['owner-id'], $condition);
- if (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
return;
}
'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""],
'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false];
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}
if (empty($item['contact-id'])) {
$self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
- if (!DBA::is_result($self)) {
+ if (!DBA::isResult($self)) {
return;
}
$item['contact-id'] = $self['id'];
$notify = false;
if ($item['uri'] == $item['parent-uri']) {
$contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$notify = self::isRemoteSelf($contact, $item);
}
}
$condition = ['id' => $itemid, 'parent' => [0, $itemid]];
$item = self::selectFirst($fields, $condition);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
// Preparing public shadow (removing user specific data)
$item['uid'] = 0;
unset($item['id']);
public static function addShadowPost($itemid)
{
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}
{
// Unarchive the author
$contact = DBA::selectFirst('contact', [], ['id' => $arr["author-id"]]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($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 (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
Contact::unmarkForArchival($contact);
}
public static function getGuidById($id)
{
$item = self::selectFirst(['guid'], ['id' => $id]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
return $item['guid'];
} else {
return '';
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 (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$id = $item["id"];
$nick = $item["nickname"];
}
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND NOT `item`.`private` AND `item`.`wall`
AND `item`.`guid` = ?", $guid);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$id = $item["id"];
$nick = $item["nickname"];
}
$mention = false;
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return;
}
$prvgroup = (($user['page-flags'] == PAGE_PRVGROUP) ? true : false);
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}
// 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 (!DBA::is_result($self)) {
+ if (!DBA::isResult($self)) {
return;
}
if ($contact['remote_self'] == 2) {
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
['uid' => $contact['uid'], 'self' => true]);
- if (DBA::is_result($self)) {
+ if (DBA::isResult($self)) {
$datarray['contact-id'] = $self["id"];
$datarray['owner-name'] = $self["name"];
$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 (DBA::is_result($photo)) {
+ if (DBA::isResult($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
$items = self::select(['file', 'resource-id', 'starred', 'type', 'id'], $condition);
- if (!DBA::is_result($items)) {
+ if (!DBA::isResult($items)) {
return;
}
$condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
$params = ['order' => ['created' => false]];
$thread = DBA::selectFirst('thread', ['created'], $condition, $params);
- if (DBA::is_result($thread)) {
+ if (DBA::isResult($thread)) {
return substr(DateTimeFormat::local($thread['created']), 0, 10);
}
return false;
logger('like: verb ' . $verb . ' item ' . $item_id);
$item = self::selectFirst(self::ITEM_FIELDLIST, ['`id` = ? OR `uri` = ?', $item_id, $item_id]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
logger('like: unknown item ' . $item_id);
return false;
}
// Retrieves the local post owner
$owner_self_contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'self' => true]);
- if (!DBA::is_result($owner_self_contact)) {
+ if (!DBA::isResult($owner_self_contact)) {
logger('like: unknown owner ' . $uid);
return false;
}
$author_id = public_contact();
$author_contact = DBA::selectFirst('contact', ['url'], ['id' => $author_id]);
- if (!DBA::is_result($author_contact)) {
+ if (!DBA::isResult($author_contact)) {
logger('like: unknown author ' . $author_id);
return false;
}
} else {
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
- if (!DBA::is_result($item_contact)) {
+ if (!DBA::isResult($item_contact)) {
logger('like: unknown item contact ' . $item_contact_id);
return false;
}
$like_item = self::selectFirst(['id', 'guid', 'verb'], $condition);
// If it exists, mark it as deleted
- if (DBA::is_result($like_item)) {
+ if (DBA::isResult($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
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$item = self::selectFirst($fields, $condition);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$item = self::selectFirst($fields, $condition);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}
private static function deleteThread($itemid, $itemuri = "")
{
$item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
logger('No thread found for id '.$itemid, LOGGER_DEBUG);
return;
}
dbesc($replyto),
dbesc($replyto)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$convid = $r[0]['convid'];
}
}
$condition = ["type" => $type, "uid" => $uid, "token" => $token];
$entry = DBA::selectFirst("openwebauth-token", ["id", "meta"], $condition);
- if (DBA::is_result($entry)) {
+ if (DBA::isResult($entry)) {
DBA::delete("openwebauth-token", ["id" => $entry["id"]]);
return $entry["meta"];
$set = DBA::selectFirst('permissionset', ['id'], $condition);
- if (!DBA::is_result($set)) {
+ if (!DBA::isResult($set)) {
DBA::insert('permissionset', $condition, true);
$set = DBA::selectFirst('permissionset', ['id'], $condition);
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 (DBA::is_result($photo)) {
+ if (DBA::isResult($photo)) {
$guid = $photo['guid'];
} else {
$guid = System::createGUID();
'desc' => $desc
];
- if (DBA::is_result($existing_photo)) {
+ if (DBA::isResult($existing_photo)) {
$r = DBA::update('photo', $fields, ['id' => $existing_photo['id']]);
} else {
$r = DBA::insert('photo', $fields);
{
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
- if (!DBA::is_result($user) && empty($profiledata)) {
+ if (!DBA::isResult($user) && empty($profiledata)) {
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
notice(L10n::t('Requested account is not available.') . EOL);
$a->error = 404;
// Add profile data to sidebar
$a->page['aside'] .= self::sidebar($profiledata, true, $show_connect);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return;
}
}
foreach ($_SESSION['remote'] as $visitor) {
if ($visitor['uid'] == $uid) {
$contact = DBA::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$profile_id = $contact['profile-id'];
}
break;
intval($profile_id)
);
}
- if (!DBA::is_result($profile)) {
+ if (!DBA::isResult($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`,
'entries' => [],
];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$profile['menu']['entries'][] = [
'photo' => $rr['thumb'],
"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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$updated = date('c', strtotime($r[0]['updated']));
}
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contacts = intval($r[0]['total']);
}
}
DateTimeFormat::utc('now + 6 days'),
DateTimeFormat::utcNow()
);
- if (DBA::is_result($s)) {
+ if (DBA::isResult($s)) {
$r = DBA::toArray($s);
Cache::set($cachekey, $r, CACHE_HOUR);
}
$total = 0;
$classtoday = '';
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$now = strtotime('now');
$cids = [];
$r = [];
- if (DBA::is_result($s)) {
+ if (DBA::isResult($s)) {
$istoday = false;
while ($rr = DBA::fetch($s)) {
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
- if (DBA::is_result($contact) && remote_user() && remote_user() == $contact['id']) {
+ if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
// The visitor is already authenticated.
return;
}
if ($subscribe) {
// if we are just updating an old subscription, keep the
// old values for last_update but reset the push
- if (DBA::is_result($subscriber)) {
+ if (DBA::isResult($subscriber)) {
$last_update = $subscriber['last_update'];
$push_flag = min($subscriber['push'], 1);
} else {
public static function delay($id)
{
$subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
- if (!DBA::is_result($subscriber)) {
+ if (!DBA::isResult($subscriber)) {
return;
}
public static function reset($id, $last_update)
{
$subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
- if (!DBA::is_result($subscriber)) {
+ if (!DBA::isResult($subscriber)) {
return;
}
{
logger('queue: requeue item ' . $id);
$queue = DBA::selectFirst('queue', ['retrial'], ['id' => $id]);
- if (!DBA::is_result($queue)) {
+ if (!DBA::isResult($queue)) {
return;
}
intval($cid)
);
- $was_delayed = DBA::is_result($r);
+ $was_delayed = DBA::isResult($r);
// We set "term-date" to a current date if the communication has problems.
// If the communication works again we reset this value.
$r = q("SELECT `term-date` FROM `contact` WHERE `id` = %d AND `term-date` <= '1000-01-01' LIMIT 1",
intval($cid)
);
- $was_delayed = !DBA::is_result($r);
+ $was_delayed = !DBA::isResult($r);
}
return $was_delayed;
intval($cid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
if ($batch && ($r[0]['total'] > $batch_queue)) {
logger('too many queued items for batch server ' . $cid . ' - discarding message');
return;
$fields = ['guid', 'uid', 'id', 'edited', 'deleted', 'created', 'received', 'title', 'body', 'parent'];
$message = Item::selectFirst($fields, ['id' => $itemid]);
- if (!DBA::is_result($message)) {
+ if (!DBA::isResult($message)) {
return;
}
public static function insertFromFileFieldByItemId($itemid, $files)
{
$message = Item::selectFirst(['uid', 'deleted'], ['id' => $itemid]);
- if (!DBA::is_result($message)) {
+ if (!DBA::isResult($message)) {
return;
}
LIMIT 1",
$uid
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
return $r;
public static function getOwnerDataByNick($nick)
{
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
return false;
}
return self::getOwnerDataById($user['uid']);
$user = DBA::selectFirst('user', ['def_gid'], ['uid' => $uid]);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
$default_group = $user["def_gid"];
}
$user = DBA::selectFirst('user', $fields, $condition);
}
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
throw new Exception(L10n::t('User not found'));
}
}
'verified' => true,
]
);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($user)) {
if ($data->hash != cookie_hash($user)) {
logger("Hash for user " . $data->uid . " doesn't fit.");
nuke_session();
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($_SESSION['visitor_id'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
self::getApp()->contact = $r[0];
}
}
'verified' => true,
]
);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
nuke_session();
goaway(self::getApp()->get_baseurl());
}
$contact = DBA::selectFirst('contact', $fields, $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
// Try to verify the signed header with the public key of the contact record
// we have found.
$verified = HTTPSignature::verify('', $contact['pubkey']);
$a = get_app();
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
- if (!DBA::is_result($record)) {
+ if (!DBA::isResult($record)) {
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
}
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$a->contact = $contact;
$a->cid = $contact['id'];
$_SESSION['cid'] = $a->cid;
$s = DBA::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
$r = DBA::toArray($s);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
}
$s = DBA::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
$r = DBA::toArray($s);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$ot = new OAuthToken($r[0]['id'], $r[0]['secret']);
$ot->scope = $r[0]['scope'];
$ot->expires = $r[0]['expires'];
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
{
$token = DBA::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
- if (DBA::is_result($token)) {
+ if (DBA::isResult($token)) {
return new OAuthToken($token['id'], $token['secret']);
}
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
- if (DBA::is_result($x) && DBA::is_result($r)) {
+ if (DBA::isResult($x) && DBA::isResult($r)) {
$mailbox = Email::constructMailboxName($r[0]);
$password = '';
openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
intval($uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger("Can't detect user data for uid ".$uid, LOGGER_DEBUG);
return([]);
}
/// @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 (DBA::is_result($parent)) {
+ if (DBA::isResult($parent)) {
$origin = $parent['origin'];
}
}
];
$thread = DBA::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
- if (DBA::is_result($thread)) {
+ if (DBA::isResult($thread)) {
$ignore = [
'do' => L10n::t("ignore thread"),
'undo' => L10n::t("unignore thread"),
dbesc($owner_nick)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
logger(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING);
killme();
}
intval($owner_id)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
logger(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING);
killme();
}
/// @TODO This hook can't work anymore
// Addon::callHooks('atom_feed', $atom);
- if (!DBA::is_result($items) || $onlyheader) {
+ if (!DBA::isResult($items) || $onlyheader) {
$atom = trim($doc->saveXML());
Addon::callHooks('atom_feed_end', $atom);
$ret = Item::select(Item::DELIVER_FIELDLIST, $condition);
$items = Item::inArray($ret);
- if (!DBA::is_result($items)) {
+ if (!DBA::isResult($items)) {
killme();
}
WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
intval($owner['uid'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$hidewall = true;
} else {
$hidewall = false;
WHERE `profile`.`is-default` AND NOT `user`.`hidewall` AND `user`.`uid` = %d",
intval($owner['uid'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$profile = $r[0];
XML::addElement($doc, $author, "poco:displayName", $profile["name"]);
if (isset($parent_item)) {
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
- if (DBA::is_result($conversation)) {
+ if (DBA::isResult($conversation)) {
if ($conversation['conversation-uri'] != '') {
$conversation_uri = $conversation['conversation-uri'];
}
dbesc(normalise_link($mention))
);
- if (DBA::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
+ if (DBA::isResult($r) && ($r[0]["forum"] || $r[0]["prv"])) {
XML::addElement(
$doc,
$entry,
dbesc('birthday')
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return;
}
$importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET];
$contact_old = DBA::selectFirst('contact', $fields, $condition);
- if (DBA::is_result($contact_old)) {
+ if (DBA::isResult($contact_old)) {
$author["contact-id"] = $contact_old["id"];
$author["network"] = $contact_old["network"];
} else {
$author["avatar"] = current($avatarlist);
}
- if (DBA::is_result($contact_old) && !$onlyfetch) {
+ if (DBA::isResult($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"]];
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return false;
}
dbesc($suggest["name"]),
dbesc($suggest["request"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$fid = $r[0]["id"];
// OK, we do. Do we already have an introduction for this person ?
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return false;
}
}
* If no record in fcontact is found, below INSERT statement will not
* link an introduction to it.
*/
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
// Database record did not get created. Quietly give up.
killme();
}
intval($importer["importer_uid"])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger("Query failed to execute, no result returned in " . __FUNCTION__);
return false;
}
$is_a_remote_action = false;
$parent = Item::selectFirst(['parent-uri'], ['uri' => $item["parent-uri"]]);
- if (DBA::is_result($parent)) {
+ if (DBA::isResult($parent)) {
$r = q(
"SELECT `item`.`forum_mode`, `item`.`wall` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
dbesc($parent["parent-uri"]),
intval($importer["importer_uid"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$is_a_remote_action = true;
}
}
if ($xt->type == ACTIVITY_OBJ_NOTE) {
$item_tag = Item::selectFirst(['id', 'tag'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]);
- if (!DBA::is_result($item_tag)) {
+ if (!DBA::isResult($item_tag)) {
logger("Query failed to execute, no result returned in " . __FUNCTION__);
return false;
}
['uri' => $item["uri"], 'uid' => $importer["importer_uid"]]
);
// Is there an existing item?
- if (DBA::is_result($current) && !self::isEditedTimestampNewer($current, $item)) {
+ if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) {
logger("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
return;
}
dbesc($item["uri"]),
intval($importer["importer_uid"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$ev["id"] = $r[0]["id"];
}
// Update content if 'updated' changes
- if (DBA::is_result($current)) {
+ if (DBA::isResult($current)) {
if (self::updateContent($current, $item, $importer, $entrytype)) {
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
} else {
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
return;
}
dbesc($baseurl),
dbesc($nurl)
);
- if ((! DBA::is_result($r)) || $r[0]['id'] == remote_user()) {
+ if ((! DBA::isResult($r)) || $r[0]['id'] == remote_user()) {
return;
}
intval(local_user()),
dbesc($baseurl)
);
- if (! DBA::is_result($r)) {
+ if (! DBA::isResult($r)) {
return;
}
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if (!DBA::is_result($u)) {
+ if (!DBA::isResult($u)) {
return false;
}
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 (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
return;
}
'contact-type' => ACCOUNT_TYPE_RELAY];
$contact = DBA::selectFirst('contact', $fields, $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
if ($contact['archive'] || $contact['blocked']) {
return false;
}
self::setRelayContact($server_url);
$contact = DBA::selectFirst('contact', $fields, $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
return $contact;
}
}
$update = false;
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
- if (DBA::is_result($person)) {
+ if (DBA::isResult($person)) {
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
// update record occasionally so it doesn't get stale
}
}
- if (!DBA::is_result($person) || $update) {
+ if (!DBA::isResult($person) || $update) {
logger("create or refresh", LOGGER_DEBUG);
$r = Probe::uri($handle, NETWORK_DIASPORA);
// Fetch the updated or added contact
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
- if (!DBA::is_result($person)) {
+ if (!DBA::isResult($person)) {
$person = $r;
}
}
intval($pcontact_id)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return strtolower($r[0]["addr"]);
}
}
intval($contact_id)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
logger("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
dbesc($fcontact_guid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $r[0]['url'];
}
}
$contact = dba::selectFirst('contact', [], ['id' => $cid]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
// This here shouldn't happen at all
logger("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
return false;
private static function messageExists($uid, $guid)
{
$item = Item::selectFirst(['id'], ['uid' => $uid, 'guid' => $guid]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
logger("message ".$guid." already exists for user ".$uid);
return $item["id"];
}
$condition = ['uid' => $uid, 'guid' => $guid];
$item = Item::selectFirst($fields, $condition);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
$result = self::storeByGuid($guid, $contact["url"], $uid);
if (!$result) {
}
}
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
logger("parent item not found: parent: ".$guid." - user: ".$uid);
return false;
} else {
{
$condition = ['nurl' => normalise_link($person["url"]), 'uid' => $uid];
$contact = DBA::selectFirst('contact', ['id', 'network'], $condition);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$cid = $contact["id"];
$network = $contact["network"];
} else {
private static function getUriFromGuid($author, $guid, $onlyfound = false)
{
$item = Item::selectFirst(['uri'], ['guid' => $guid]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
return $item["uri"];
} elseif (!$onlyfound) {
$contact = Contact::getDetailsByAddr($author, 0);
private static function getGuidFromUri($uri, $uid)
{
$item = Item::selectFirst(['guid'], ['uri' => $uri, 'uid' => $uid]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
return $item["guid"];
} else {
return false;
private static function importerForGuid($guid)
{
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
return $contact;
}
}
dbesc($msg_guid),
intval($importer["uid"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
logger("duplicate message already delivered.", LOGGER_DEBUG);
return false;
}
dbesc($guid),
intval($importer["uid"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
logger("duplicate message already delivered.", LOGGER_DEBUG);
return false;
}
}
$item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => false]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
logger('Item not found, no origin or private: '.$parent_guid);
return false;
}
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
$item = Item::selectFirst($fields, $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
logger("reshared message ".$guid." already exists on system.");
// Maybe it is already a reshared item?
}
}
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
if (empty($orig_author)) {
logger('Empty author for guid ' . $guid . '. Quitting.');
return false;
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
$item = Item::selectFirst($fields, $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($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"]));
}
$r = Item::select($fields, $condition);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger("Target guid ".$target_guid." was not found on this system for user ".$importer['uid'].".");
return false;
}
if (($guid != "") && $complete) {
$condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
$item = Item::selectFirst(['contact-id'], $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$ret= [];
$ret["root_handle"] = self::handleFromContact($item["contact-id"]);
$ret["root_guid"] = $guid;
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 (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return [];
}
$eventdata = [];
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d", intval($event['uid']));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return [];
}
$user = $r[0];
$r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid']));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return [];
}
private static function constructLike(array $item, array $owner)
{
$parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]);
- if (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
return false;
}
private static function constructAttend(array $item, array $owner)
{
$parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]);
- if (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
return false;
}
}
$parent = Item::selectFirst(['guid'], ['id' => $item["parent"], 'parent' => $item["parent"]]);
- if (!DBA::is_result($parent)) {
+ if (!DBA::isResult($parent)) {
return false;
}
intval($item["uid"])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger("conversation not found.");
return;
}
}
$r = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($contact['uid']));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$contact["uprvkey"] = $r[0]['prvkey'];
$item = Item::selectFirst([], ['id' => $post_id]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return false;
}
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
$importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
$previous = Item::selectFirst(['id'], $condition);
- if (DBA::is_result($previous)) {
+ if (DBA::isResult($previous)) {
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
continue;
}
$contact = DBA::selectFirst('contact', [], $condition);
}
- if (!DBA::is_result($contact) && $author["author-link"] != '') {
+ if (!DBA::isResult($contact) && $author["author-link"] != '') {
if ($aliaslink == "") {
$aliaslink = $author["author-link"];
}
$contact = DBA::selectFirst('contact', [], $condition);
}
- if (!DBA::is_result($contact) && ($addr != '')) {
+ if (!DBA::isResult($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 (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
if ($contact['blocked']) {
$contact['id'] = -1;
}
$author["owner-id"] = $author["author-id"];
// Only update the contacts if it is an OStatus contact
- if (DBA::is_result($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
+ if (DBA::isResult($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
// Update contact data
$current = $contact;
{
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
$conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition);
- if (DBA::is_result($conversation)) {
+ if (DBA::isResult($conversation)) {
$stored = true;
$xml = $conversation['source'];
if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
if ($xml == '') {
$condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
- if (DBA::is_result($conversation)) {
+ if (DBA::isResult($conversation)) {
$stored = true;
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
$xml = $conversation['source'];
}
}
- if (DBA::is_result($profile) && !$show_profile) {
+ if (DBA::isResult($profile) && !$show_profile) {
if (trim($profile["homepage"]) != "") {
$urls = $doc->createElement("poco:urls");
XML::addElement($doc, $urls, "poco:type", "homepage");
dbesc(normalise_link($url)),
intval($owner["uid"])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
$contact["uid"] = -1;
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$r = q(
"SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($url))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
$contact["uid"] = -1;
$contact["success_update"] = $contact["updated"];
}
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
$contact = owner;
}
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]];
$repeated_item = Item::selectFirst([], $condition);
- if (!DBA::is_result($repeated_item)) {
+ if (!DBA::isResult($repeated_item)) {
return false;
}
dbesc(normalise_link($contact["url"]))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$connect_id = $r[0]['id'];
} else {
$connect_id = 0;
$thrparent = Item::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner["uid"], 'uri' => $parent_item]);
- if (DBA::is_result($thrparent)) {
+ if (DBA::isResult($thrparent)) {
$mentioned[$thrparent["author-link"]] = $thrparent["author-link"];
$mentioned[$thrparent["owner-link"]] = $thrparent["owner-link"];
$parent_plink = $thrparent["plink"];
if (isset($parent_item)) {
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
- if (DBA::is_result($conversation)) {
+ if (DBA::isResult($conversation)) {
if ($conversation['conversation-uri'] != '') {
$conversation_uri = $conversation['conversation-uri'];
}
if ($cid) {
if (!$url || !$uid) {
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$url = $contact['poco'];
$uid = $contact['uid'];
}
dbesc(normalise_link($server_url))
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
return $server_url;
}
dbesc(normalise_link($profile))
);
- if (!DBA::is_result($gcontacts)) {
+ if (!DBA::isResult($gcontacts)) {
return false;
}
}
$gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
- if (DBA::is_result($gserver)) {
+ if (DBA::isResult($gserver)) {
if ($gserver["created"] <= NULL_DATE) {
$fields = ['created' => DateTimeFormat::utcNow()];
$condition = ['nurl' => normalise_link($server_url)];
// 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 (DBA::is_result($gserver) && ($orig_server_url == $server_url) &&
+ if (DBA::isResult($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)]);
}
$gserver = DBA::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
- if (!DBA::is_result($gserver)) {
+ if (!DBA::isResult($gserver)) {
return;
}
dbesc(NETWORK_OSTATUS)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$server_url = str_replace("/index.php", "", $server->url);
$r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger("Call server check for server ".$server_url, LOGGER_DEBUG);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url);
}
public static function discoverSingleServer($id)
{
$r = q("SELECT `poco`, `nurl`, `url`, `network` FROM `gserver` WHERE `id` = %d", intval($id));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $server) {
if (!self::checkServer($server["url"], $server["network"])) {
// The server is not reachable? Okay, then we will try it later
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
$aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
- if (DBA::is_result($aUser)) {
+ if (DBA::isResult($aUser)) {
$uid = $aUser['uid'];
$success = User::authenticate($aUser, $aCommand[3]);
$Error = $success === false;
$contact = DBA::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']);
}
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
return $contact['pubkey'];
}
dbesc(NETWORK_MAIL)
);
- if (!DBA::is_result($contacts)) {
+ if (!DBA::isResult($contacts)) {
return;
}
private static function updatePhotoAlbums()
{
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
$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 (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
// 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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r AS $user) {
logger('Create missing self contact for user ' . $user['uid']);
Contact::createSelfFromUserId($user['uid']);
// 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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r AS $user) {
GContact::updateForUser($user["uid"]);
}
if ($cmd == self::MAIL) {
$target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
- if (!DBA::is_result($target_item)) {
+ if (!DBA::isResult($target_item)) {
return;
}
$uid = $target_item['uid'];
$items = [];
} elseif ($cmd == self::SUGGESTION) {
$target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
- if (!DBA::is_result($target_item)) {
+ if (!DBA::isResult($target_item)) {
return;
}
$uid = $target_item['uid'];
$uid = $item_id;
} else {
$item = Item::selectFirst(['parent'], ['id' => $item_id]);
- if (!DBA::is_result($item) || empty($item['parent'])) {
+ if (!DBA::isResult($item) || empty($item['parent'])) {
return;
}
$parent_id = intval($item['parent']);
}
$owner = User::getOwnerDataById($uid);
- if (!DBA::is_result($owner)) {
+ if (!DBA::isResult($owner)) {
return;
}
$contact = DBA::selectFirst('contact', [],
['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
return;
}
if (link_compare($basepath, System::baseUrl())) {
$condition = ['nurl' => normalise_link($contact['url']), 'self' => true];
$target_self = DBA::selectFirst('contact', ['uid'], $condition);
- if (!DBA::is_result($target_self)) {
+ if (!DBA::isResult($target_self)) {
return;
}
$target_uid = $target_self['uid'];
$cid);
// This should never fail
- if (!DBA::is_result($target_importer)) {
+ if (!DBA::isResult($target_importer)) {
return;
}
}
$local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]);
- if (!DBA::is_result($local_user)) {
+ if (!DBA::isResult($local_user)) {
return;
}
$reply_to = '';
$mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
- if (DBA::is_result($mailacct) && !empty($mailacct['reply_to'])) {
+ if (DBA::isResult($mailacct) && !empty($mailacct['reply_to'])) {
$reply_to = $mailacct['reply_to'];
}
if (empty($target_item['title'])) {
$condition = ['uri' => $target_item['parent-uri'], 'uid' => $owner['uid']];
$title = Item::selectFirst(['title'], $condition);
- if (DBA::is_result($title) && ($title['title'] != '')) {
+ if (DBA::isResult($title) && ($title['title'] != '')) {
$subject = $title['title'];
} else {
$condition = ['parent-uri' => $target_item['parent-uri'], 'uid' => $owner['uid']];
$title = Item::selectFirst(['title'], $condition);
- if (DBA::is_result($title) && ($title['title'] != '')) {
+ if (DBA::isResult($title) && ($title['title'] != '')) {
$subject = $title['title'];
}
}
WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
NOT `user`.`account_expired` AND `user`.`verified`");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r AS $user) {
Worker::add(PRIORITY_LOW, 'Directory', $user['url']);
}
private static function updateServer() {
$r = q("SELECT `url`, `created`, `last_failure`, `last_contact` FROM `gserver` ORDER BY rand()");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
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 (DBA::is_result($exists)) {
+ if (DBA::isResult($exists)) {
logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&
return;
} elseif (intval($param) > 0) {
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
- if (DBA::is_result($user)) {
+ if (DBA::isResult($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);
logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
// Is it a DDoS attempt?
$urlparts = parse_url($url);
dbesc(normalise_link($url))
);
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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']));
if ($cmd == Delivery::MAIL) {
$normal_mode = false;
$message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
- if (!DBA::is_result($message)) {
+ if (!DBA::isResult($message)) {
return;
}
$uid = $message['uid'];
} elseif ($cmd == Delivery::SUGGESTION) {
$normal_mode = false;
$suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
- if (!DBA::is_result($suggest)) {
+ if (!DBA::isResult($suggest)) {
return;
}
$uid = $suggest['uid'];
$condition = ['id' => $item_id, 'visible' => true, 'moderated' => false];
$target_item = Item::selectFirst([], $condition);
- if (!DBA::is_result($target_item) || !intval($target_item['parent'])) {
+ if (!DBA::isResult($target_item) || !intval($target_item['parent'])) {
return;
}
$params = ['order' => ['id']];
$ret = Item::select([], $condition, $params);
- if (!DBA::is_result($ret)) {
+ if (!DBA::isResult($ret)) {
return;
}
$fields = ['forum', 'prv'];
$condition = ['id' => $target_item['contact-id']];
$contact = DBA::selectFirst('contact', $fields, $condition);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
// Should never happen
return false;
}
intval($uid),
dbesc(NETWORK_DFRN)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$recipients_followup[] = $rr['id'];
}
// Send a salmon to the parent author
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
- if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) {
+ if (DBA::isResult($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 (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) {
+ if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) {
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
intval($uid),
dbesc(NETWORK_MAIL)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$recipients[] = $rr['id'];
}
}
// delivery loop
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $contact) {
logger("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
$r = array_merge($r2, $r1);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
foreach ($r as $rr) {
$d = DateTimeFormat::utcNow();
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
logger('Contact not found or cannot be used.');
return;
}
WHERE `cid` = %d AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['id'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
if (!$r[0]['total']) {
PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
}
intval($importer_uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
logger('No self contact for user '.$importer_uid);
// set the last-update so we don't keep polling
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
$mailconf = DBA::selectFirst('mailacct', [], $condition);
- if (DBA::is_result($user) && DBA::is_result($mailconf)) {
+ if (DBA::isResult($user) && DBA::isResult($mailconf)) {
$mailbox = Email::constructMailboxName($mailconf);
$password = '';
openssl_private_decrypt(hex2bin($mailconf['pass']), $password, $user['prvkey']);
$fields = ['deleted', 'id'];
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
$item = Item::selectFirst($fields, $condition);
- if (DBA::is_result($item)) {
+ if (DBA::isResult($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
}
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
$parent = Item::selectFirst(['parent-uri'], $condition);
- if (DBA::is_result($parent)) {
+ if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item
}
}
$condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => NETWORK_MAIL];
$params = ['order' => ['created' => true]];
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
- if (DBA::is_result($parent)) {
+ if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri'];
}
}
$a = BaseObject::getApp();
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
- if (!DBA::is_result($subscriber)) {
+ if (!DBA::isResult($subscriber)) {
return;
}
Addon::callHooks('queue_predeliver', $r);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($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']);
// delivering
$q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]);
- if (!DBA::is_result($q_item)) {
+ if (!DBA::isResult($q_item)) {
return;
}
$contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]);
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
QueueModel::removeItem($q_item['id']);
return;
}
}
$user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
QueueModel::removeItem($q_item['id']);
return;
}
$r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
);
// convert old forumlist addon entries in new config entries
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$uid = $rr['uid'];
$family = $rr['cat'];
// user info
$r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self`", intval($a->user['uid']));
- $r[0]['photo'] = (DBA::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg');
+ $r[0]['photo'] = (DBA::isResult($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()));
$r = false;
}
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$nav['userinfo'] = [
- 'icon' => (DBA::is_result($r) ? $r[0]['photo'] : 'images/person-48.jpg'),
+ 'icon' => (DBA::isResult($r) ? $r[0]['photo'] : 'images/person-48.jpg'),
'name' => $r[0]['name'],
];
}
$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 (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$total = $r[0]['total'];
}
$contacts = [];
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$contacts[] = _contact_detail_for_template($rr);
}
$r = GContact::suggestionQuery(local_user(), 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$aside['$comunity_profiles_title'] = L10n::t('Community Profiles');
$aside['$comunity_profiles_items'] = [];
9
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$aside['$lastusers_title'] = L10n::t('Last users');
$aside['$lastusers_items'] = [];
$tpl = get_markup_template('ch_connectors.tpl');
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$con_services = [];
$con_services['title'] = ["", L10n::t('Connect Services'), "", ""];
$aside['$con_services'] = $con_services;