mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 00:33:40 +00:00
Rename DBA::is_result to DBA::isResult
This commit is contained in:
parent
332ea212b5
commit
f4ad0d3721
11 changed files with 76 additions and 76 deletions
|
@ -413,7 +413,7 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
|
|||
$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']));
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ function catavatar_addon_settings_post(App $a, &$s)
|
|||
$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;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ function catavatar_addon_settings_post(App $a, &$s)
|
|||
|
||||
$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;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ function diaspora_settings(&$a,&$s) {
|
|||
$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']);
|
||||
|
|
|
@ -107,7 +107,7 @@ function forumdirectory_content(&$a)
|
|||
|
||||
$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']);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ function forumdirectory_content(&$a)
|
|||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
||||
if (DBA::is_result($r)) {
|
||||
if (DBA::isResult($r)) {
|
||||
if (in_array('small', $a->argv)) {
|
||||
$photo = 'thumb';
|
||||
} else {
|
||||
|
|
|
@ -101,7 +101,7 @@ function ifttt_post(App $a)
|
|||
$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;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ function mailstream_do_images($a, &$item, &$attachments) {
|
|||
|
||||
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'];
|
||||
|
@ -214,7 +214,7 @@ function mailstream_subject($item) {
|
|||
// 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) {
|
||||
|
|
|
@ -59,7 +59,7 @@ function public_server_cron($a, $b)
|
|||
`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'],
|
||||
|
@ -82,7 +82,7 @@ function public_server_cron($a, $b)
|
|||
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']]);
|
||||
|
@ -94,7 +94,7 @@ function public_server_cron($a, $b)
|
|||
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']]);
|
||||
|
@ -107,7 +107,7 @@ function public_server_cron($a, $b)
|
|||
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']]);
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ function pumpio_send(App $a, array &$b)
|
|||
$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 {
|
||||
|
@ -572,7 +572,7 @@ function pumpio_send(App $a, array &$b)
|
|||
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"];
|
||||
}
|
||||
|
||||
|
@ -600,7 +600,7 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "")
|
|||
|
||||
$orig_post = Item::selectFirst([], ['uri' => $uri, 'uid' => $uid]);
|
||||
|
||||
if (!DBA::is_result($orig_post)) {
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "")
|
|||
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"];
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ function pumpio_sync(App $a)
|
|||
{
|
||||
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = 'pumpio'");
|
||||
|
||||
if (!DBA::is_result($r)) {
|
||||
if (!DBA::isResult($r)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ function pumpio_sync(App $a)
|
|||
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']);
|
||||
|
@ -697,11 +697,11 @@ function pumpio_sync(App $a)
|
|||
$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;
|
||||
}
|
||||
|
@ -870,9 +870,9 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
|
@ -887,7 +887,7 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
|
|||
intval($uid)
|
||||
);
|
||||
|
||||
if (DBA::is_result($r)) {
|
||||
if (DBA::isResult($r)) {
|
||||
$contactid = $r[0]['id'];
|
||||
}
|
||||
|
||||
|
@ -898,7 +898,7 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_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']);
|
||||
|
@ -917,9 +917,9 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
|
@ -942,7 +942,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
|
|||
intval($uid)
|
||||
);
|
||||
|
||||
if (DBA::is_result($r)) {
|
||||
if (DBA::isResult($r)) {
|
||||
$contactid = $r[0]['id'];
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
|
|||
$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`,
|
||||
|
@ -1047,7 +1047,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
|
|||
intval($uid)
|
||||
);
|
||||
|
||||
if (!DBA::is_result($r)) {
|
||||
if (!DBA::isResult($r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1175,7 +1175,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
|||
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",
|
||||
|
@ -1183,7 +1183,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
|||
intval($uid)
|
||||
);
|
||||
|
||||
if (DBA::is_result($r)) {
|
||||
if (DBA::isResult($r)) {
|
||||
$contact_id = $r[0]['id'];
|
||||
} else {
|
||||
$contact_id = $self[0]['id'];
|
||||
|
@ -1404,7 +1404,7 @@ function pumpio_queue_hook(App $a, array &$b)
|
|||
dbesc(NETWORK_PUMPIO)
|
||||
);
|
||||
|
||||
if (!DBA::is_result($qi)) {
|
||||
if (!DBA::isResult($qi)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1419,7 +1419,7 @@ function pumpio_queue_hook(App $a, array &$b)
|
|||
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
||||
intval($x['cid'])
|
||||
);
|
||||
if (!DBA::is_result($r)) {
|
||||
if (!DBA::isResult($r)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ function pumpio_getreceiver(App $a, array $b)
|
|||
dbesc(NETWORK_PUMPIO)
|
||||
);
|
||||
|
||||
if (DBA::is_result($r)) {
|
||||
if (DBA::isResult($r)) {
|
||||
$receiver["bcc"][] = [
|
||||
"displayName" => $r[0]["name"],
|
||||
"objectType" => "person",
|
||||
|
@ -1554,7 +1554,7 @@ function pumpio_getreceiver(App $a, array $b)
|
|||
dbesc(NETWORK_PUMPIO)
|
||||
);
|
||||
|
||||
if (DBA::is_result($r)) {
|
||||
if (DBA::isResult($r)) {
|
||||
$receiver["to"][] = [
|
||||
"displayName" => $r[0]["name"],
|
||||
"objectType" => "person",
|
||||
|
@ -1586,7 +1586,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ function statusnet_post_hook(App $a, &$b)
|
|||
|
||||
$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 {
|
||||
|
@ -685,7 +685,7 @@ function statusnet_prepare_body(App $a, &$b)
|
|||
|
||||
$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]";
|
||||
|
@ -730,7 +730,7 @@ function statusnet_cron(App $a, $b)
|
|||
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']);
|
||||
|
@ -745,11 +745,11 @@ function statusnet_cron(App $a, $b)
|
|||
$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;
|
||||
}
|
||||
|
@ -901,16 +901,16 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
|||
|
||||
$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`,
|
||||
|
@ -940,7 +940,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
|||
intval($uid),
|
||||
dbesc(NETWORK_STATUSNET));
|
||||
|
||||
if (!DBA::is_result($r)) {
|
||||
if (!DBA::isResult($r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1024,7 +1024,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
|||
$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;
|
||||
|
@ -1086,11 +1086,11 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
$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'];
|
||||
|
@ -1108,7 +1108,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
$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"];
|
||||
|
@ -1212,7 +1212,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
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);
|
||||
|
@ -1222,7 +1222,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
$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);
|
||||
|
@ -1231,7 +1231,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
|
||||
$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;
|
||||
}
|
||||
|
@ -1521,7 +1521,7 @@ function statusnet_fetch_own_contact(App $a, $uid)
|
|||
} 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');
|
||||
|
|
|
@ -184,7 +184,7 @@ function twitter_follow(App $a, &$contact)
|
|||
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];
|
||||
}
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ function twitter_post_hook(App $a, &$b)
|
|||
|
||||
$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 {
|
||||
|
@ -621,7 +621,7 @@ function twitter_post_hook(App $a, &$b)
|
|||
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"];
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ function twitter_cron(App $a, $b)
|
|||
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']);
|
||||
|
@ -691,11 +691,11 @@ function twitter_cron(App $a, $b)
|
|||
$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;
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ function twitter_expire(App $a, $b)
|
|||
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);
|
||||
|
@ -773,7 +773,7 @@ function twitter_prepare_body(App $a, &$b)
|
|||
|
||||
$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;
|
||||
|
@ -924,7 +924,7 @@ function twitter_queue_hook(App $a, &$b)
|
|||
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
|
||||
dbesc(NETWORK_TWITTER)
|
||||
);
|
||||
if (!DBA::is_result($qi)) {
|
||||
if (!DBA::isResult($qi)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -939,7 +939,7 @@ function twitter_queue_hook(App $a, &$b)
|
|||
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
||||
intval($x['cid'])
|
||||
);
|
||||
if (!DBA::is_result($r)) {
|
||||
if (!DBA::isResult($r)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1018,11 +1018,11 @@ function twitter_fetch_contact($uid, $data, $create_user)
|
|||
}
|
||||
|
||||
$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();
|
||||
|
@ -1082,7 +1082,7 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
|||
$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;
|
||||
|
@ -1353,11 +1353,11 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
|||
|
||||
$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'];
|
||||
|
@ -1375,7 +1375,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
|||
$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"];
|
||||
|
@ -1574,7 +1574,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
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);
|
||||
|
@ -1584,7 +1584,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
$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);
|
||||
|
@ -1593,7 +1593,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
|
||||
$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;
|
||||
}
|
||||
|
@ -1660,7 +1660,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1752,7 +1752,7 @@ function twitter_fetch_own_contact(App $a, $uid)
|
|||
$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');
|
||||
|
|
|
@ -43,7 +43,7 @@ function viewsrc_item_photo_menu(&$a, &$b)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue