$params = ['order' => ['uid' => true]];
$item = Item::selectFirstForUser(local_user(), [], $condition, $params);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
throw new HTTPException\NotFoundException(L10n::t('Unknown post with guid: %s', $args['guid']));
}
$url = $a->get_baseurl() . '/catavatar/' . local_user() . '?ts=' . time();
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
- if (!DBA::is_result($self)) {
+ if (!DBA::isResult($self)) {
notice(L10n::t("The cat hadn't found itself."));
return;
}
$condition = ['uid' => local_user(), 'contact-id' => $self['id']];
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
- if (!DBA::is_result($photo)) {
+ if (!DBA::isResult($photo)) {
notice(L10n::t('There was an error, the cat ran away.'));
return;
}
$status = "";
$r = q("SELECT `addr` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$status = L10n::t("Please remember: You can always be reached from Diaspora with your Friendica handle %s. ", $r[0]['addr']);
$status .= L10n::t('This connector is only meant if you still want to use your old Diaspora account for some time. ');
$status .= L10n::t('However, it is preferred that you tell your Diaspora contacts the new handle %s instead.', $r[0]['addr']);
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`"
. " WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra ");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
}
intval($a->pager['itemspage'])
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
if (in_array('small', $a->argv)) {
$photo = 'thumb';
} else {
$nickname = $a->argv[1];
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
return;
}
function mailstream_sender($item) {
$r = q('SELECT * FROM `contact` WHERE `id` = %d', $item['contact-id']);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact = $r[0];
if ($contact['name'] != $item['author-name']) {
return $contact['name'] . ' - ' . $item['author-name'];
// Don't look more than 100 levels deep for a subject, in case of loops
for ($i = 0; ($i < 100) && $parent; $i++) {
$parent_item = Item::selectFirst(['thr-parent', 'title'], ['uri' => $parent]);
- if (!DBA::is_result($parent_item)) {
+ if (!DBA::isResult($parent_item)) {
break;
}
if ($parent_item['thr-parent'] === $parent) {
`expire_notification_sent` <= '%s'",
dbesc(NULL_DATE), dbesc(NULL_DATE));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
notification([
'uid' => $rr['uid'],
if ($nologin) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` <= '%s' AND `register_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s'",
dbesc(NULL_DATE), intval($nologin), dbesc(NULL_DATE));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
DBA::update('user', $fields, ['uid' => $rr['uid']]);
if ($flagusers) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' AND `page-flags` = 0",
intval($flagusers), dbesc(NULL_DATE));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
DBA::update('user', $fields, ['uid' => $rr['uid']]);
if ($flagposts && $flagpostsexpire) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' and `expire` = 0 AND `page-flags` = 0",
intval($flagposts), dbesc(NULL_DATE));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
DBA::update('user', ['expire' => $flagpostsexpire], ['uid' => $rr['uid']]);
}
$condition = ['id' => $b['parent'], 'network' => NETWORK_PUMPIO];
$orig_post = Item::selectFirst([], $condition);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
logger("pumpio_send: no pumpio post ".$b["parent"]);
return;
} else {
logger('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true));
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->contact = $r[0]["id"];
}
$orig_post = Item::selectFirst([], ['uri' => $uri, 'uid' => $uid]);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
return;
}
logger('pumpio_action '.$username.' '.$action.': general error: '.$uri.' '.print_r($user, true));
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->contact = $r[0]["id"];
}
{
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = 'pumpio'");
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return;
}
logger('pumpio: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'mirror' AND `v` = '1' ORDER BY RAND() ");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
logger('pumpio: mirroring user '.$rr['uid']);
pumpio_fetchtimeline($a, $rr['uid']);
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'import' AND `v` = '1' ORDER BY RAND() ");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
continue;
}
// Searching for the unliked post
// Two queries for speed issues
$orig_post = Item::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
$orig_post = Item::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
return;
}
}
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contactid = $r[0]['id'];
}
Item::delete(['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
logger("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
} else {
logger("pumpio_dounlike: not found. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
// Searching for the liked post
// Two queries for speed issues
$orig_post = Item::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
$orig_post = Item::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
return;
}
}
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contactid = $r[0]['id'];
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
intval($uid), dbesc(normalise_link($contact->url)));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
// create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
intval($uid)
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact_id = $r[0]['id'];
} else {
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
intval($uid)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact_id = $r[0]['id'];
} else {
$contact_id = $self[0]['id'];
dbesc(NETWORK_PUMPIO)
);
- if (!DBA::is_result($qi)) {
+ if (!DBA::isResult($qi)) {
return;
}
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
intval($x['cid'])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
continue;
}
dbesc(NETWORK_PUMPIO)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$receiver["bcc"][] = [
"displayName" => $r[0]["name"],
"objectType" => "person",
dbesc(NETWORK_PUMPIO)
);
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$receiver["to"][] = [
"displayName" => $r[0]["name"],
"objectType" => "person",
// Fetching the original post
$condition = ["`uri` = ? AND `uid` = ? AND `extid` != ''", $id, $uid];
$item = Item::selectFirst(['extid'], $condition);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return false;
}
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
return;
} else {
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
- if (DBA::is_result($orig_post)) {
+ if (DBA::isResult($orig_post)) {
$nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post["author-link"]);
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
logger('statusnet: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() ");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
logger('statusnet: fetching for user ' . $rr['uid']);
statusnet_fetchtimeline($a, $rr['uid']);
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` ORDER BY RAND()");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
continue;
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
- if (!DBA::is_result($r) && !$create_user) {
+ if (!DBA::isResult($r) && !$create_user) {
return 0;
}
- if (DBA::is_result($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
+ if (DBA::isResult($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
return -1;
}
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
// create contact record
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
intval($uid),
dbesc(NETWORK_STATUSNET));
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
return false;
}
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$self = $r[0];
} else {
return;
$fields = ['uri', 'parent-uri', 'parent'];
$item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
$item = Item::selectFirst($fields, ['extid' => $parent, 'uid' => $uid]);
}
- if (DBA::is_result($item)) {
+ if (DBA::isResult($item)) {
$postarray['thr-parent'] = $item['uri'];
$postarray['parent-uri'] = $item['parent-uri'];
$postarray['parent'] = $item['parent'];
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contactid = $r[0]["id"];
$postarray['owner-name'] = $r[0]["name"];
intval($own_contact),
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$nick = $r[0]["nick"];
} else {
logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$self = $r[0];
} else {
logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
intval($uid));
- if (!DBA::is_result($u)) {
+ if (!DBA::isResult($u)) {
logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
return;
}
} else {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc($own_url));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact_id = $r[0]["id"];
} else {
PConfig::delete($uid, 'statusnet', 'own_url');
FROM `contact` WHERE `uid` = %d AND `nick` = '%s'",
intval($uid),
dbesc($nickname));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact["contact"] = $r[0];
}
}
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
$orig_post = Item::selectFirst([], $condition);
- if (!DBA::is_result($orig_post)) {
+ if (!DBA::isResult($orig_post)) {
logger("twitter_post_hook: no parent found " . $b["thr-parent"]);
return;
} else {
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$a->contact = $r[0]["id"];
}
logger('twitter: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'mirror_posts' AND `v` = '1'");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
logger('twitter: fetching for user ' . $rr['uid']);
Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 1, (int) $rr['uid']);
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
- if (!DBA::is_result($user)) {
+ if (!DBA::isResult($user)) {
logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
continue;
}
logger('twitter_expire: expire_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()");
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
foreach ($r as $rr) {
logger('twitter_expire: user ' . $rr['uid']);
Item::expire($rr['uid'], $days, NETWORK_TWITTER, true);
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
$orig_post = Item::selectFirst(['author-link'], $condition);
- if (DBA::is_result($orig_post)) {
+ if (DBA::isResult($orig_post)) {
$nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
$nicknameplain = "@" . $nicknameplain;
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
dbesc(NETWORK_TWITTER)
);
- if (!DBA::is_result($qi)) {
+ if (!DBA::isResult($qi)) {
return;
}
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
intval($x['cid'])
);
- if (!DBA::is_result($r)) {
+ if (!DBA::isResult($r)) {
continue;
}
}
$contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]);
- if (!DBA::is_result($contact) && !$create_user) {
+ if (!DBA::isResult($contact) && !$create_user) {
return 0;
}
- if (!DBA::is_result($contact)) {
+ if (!DBA::isResult($contact)) {
// create contact record
$fields['uid'] = $uid;
$fields['created'] = DateTimeFormat::utcNow();
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$self = $r[0];
} else {
return;
$fields = ['uri', 'parent-uri', 'parent'];
$parent_item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
- if (!DBA::is_result($parent_item)) {
+ if (!DBA::isResult($parent_item)) {
$parent_item = Item::selectFirst($fields, ['extid' => $parent, 'uid' => $uid]);
}
- if (DBA::is_result($parent_item)) {
+ if (DBA::isResult($parent_item)) {
$postarray['thr-parent'] = $parent_item['uri'];
$postarray['parent-uri'] = $parent_item['parent-uri'];
$postarray['parent'] = $parent_item['parent'];
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contactid = $r[0]["id"];
$postarray['owner-name'] = $r[0]["name"];
intval($own_contact),
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$own_id = $r[0]["nick"];
} else {
logger("twitter_fetchhometimeline: Own twitter contact not found for user " . $uid, LOGGER_DEBUG);
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$self = $r[0];
} else {
logger("twitter_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
intval($uid));
- if (!DBA::is_result($u)) {
+ if (!DBA::isResult($u)) {
logger("twitter_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
return;
}
if ($postarray['uri'] == $postarray['parent-uri']) {
$contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]);
- if (DBA::is_result($contact)) {
+ if (DBA::isResult($contact)) {
$notify = Item::isRemoteSelf($contact, $postarray);
}
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid),
dbesc("twitter::" . $own_id));
- if (DBA::is_result($r)) {
+ if (DBA::isResult($r)) {
$contact_id = $r[0]["id"];
} else {
PConfig::delete($uid, 'twitter', 'own_id');
if (local_user() != $b['item']['uid']) {
$item = Item::selectFirstForUser(local_user(), ['id'], ['uid' => local_user(), 'guid' => $b['item']['guid']]);
- if (!DBA::is_result($item)) {
+ if (!DBA::isResult($item)) {
return;
}