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]];
|
$params = ['order' => ['uid' => true]];
|
||||||
$item = Item::selectFirstForUser(local_user(), [], $condition, $params);
|
$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']));
|
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();
|
$url = $a->get_baseurl() . '/catavatar/' . local_user() . '?ts=' . time();
|
||||||
|
|
||||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
|
$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."));
|
notice(L10n::t("The cat hadn't found itself."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ function catavatar_addon_settings_post(App $a, &$s)
|
||||||
|
|
||||||
$condition = ['uid' => local_user(), 'contact-id' => $self['id']];
|
$condition = ['uid' => local_user(), 'contact-id' => $self['id']];
|
||||||
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
|
$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.'));
|
notice(L10n::t('There was an error, the cat ran away.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ function diaspora_settings(&$a,&$s) {
|
||||||
$status = "";
|
$status = "";
|
||||||
|
|
||||||
$r = q("SELECT `addr` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
|
$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("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('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']);
|
$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`"
|
$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 ");
|
. " 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']);
|
$a->set_pager_total($r[0]['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ function forumdirectory_content(&$a)
|
||||||
intval($a->pager['itemspage'])
|
intval($a->pager['itemspage'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
if (in_array('small', $a->argv)) {
|
if (in_array('small', $a->argv)) {
|
||||||
$photo = 'thumb';
|
$photo = 'thumb';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -101,7 +101,7 @@ function ifttt_post(App $a)
|
||||||
$nickname = $a->argv[1];
|
$nickname = $a->argv[1];
|
||||||
|
|
||||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
|
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
|
||||||
if (!DBA::is_result($user)) {
|
if (!DBA::isResult($user)) {
|
||||||
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
|
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ function mailstream_do_images($a, &$item, &$attachments) {
|
||||||
|
|
||||||
function mailstream_sender($item) {
|
function mailstream_sender($item) {
|
||||||
$r = q('SELECT * FROM `contact` WHERE `id` = %d', $item['contact-id']);
|
$r = q('SELECT * FROM `contact` WHERE `id` = %d', $item['contact-id']);
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contact = $r[0];
|
$contact = $r[0];
|
||||||
if ($contact['name'] != $item['author-name']) {
|
if ($contact['name'] != $item['author-name']) {
|
||||||
return $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
|
// Don't look more than 100 levels deep for a subject, in case of loops
|
||||||
for ($i = 0; ($i < 100) && $parent; $i++) {
|
for ($i = 0; ($i < 100) && $parent; $i++) {
|
||||||
$parent_item = Item::selectFirst(['thr-parent', 'title'], ['uri' => $parent]);
|
$parent_item = Item::selectFirst(['thr-parent', 'title'], ['uri' => $parent]);
|
||||||
if (!DBA::is_result($parent_item)) {
|
if (!DBA::isResult($parent_item)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($parent_item['thr-parent'] === $parent) {
|
if ($parent_item['thr-parent'] === $parent) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ function public_server_cron($a, $b)
|
||||||
`expire_notification_sent` <= '%s'",
|
`expire_notification_sent` <= '%s'",
|
||||||
dbesc(NULL_DATE), dbesc(NULL_DATE));
|
dbesc(NULL_DATE), dbesc(NULL_DATE));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
notification([
|
notification([
|
||||||
'uid' => $rr['uid'],
|
'uid' => $rr['uid'],
|
||||||
|
@ -82,7 +82,7 @@ function public_server_cron($a, $b)
|
||||||
if ($nologin) {
|
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'",
|
$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));
|
dbesc(NULL_DATE), intval($nologin), dbesc(NULL_DATE));
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
|
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
|
||||||
DBA::update('user', $fields, ['uid' => $rr['uid']]);
|
DBA::update('user', $fields, ['uid' => $rr['uid']]);
|
||||||
|
@ -94,7 +94,7 @@ function public_server_cron($a, $b)
|
||||||
if ($flagusers) {
|
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",
|
$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));
|
intval($flagusers), dbesc(NULL_DATE));
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
|
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
|
||||||
DBA::update('user', $fields, ['uid' => $rr['uid']]);
|
DBA::update('user', $fields, ['uid' => $rr['uid']]);
|
||||||
|
@ -107,7 +107,7 @@ function public_server_cron($a, $b)
|
||||||
if ($flagposts && $flagpostsexpire) {
|
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",
|
$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));
|
intval($flagposts), dbesc(NULL_DATE));
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
DBA::update('user', ['expire' => $flagpostsexpire], ['uid' => $rr['uid']]);
|
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];
|
$condition = ['id' => $b['parent'], 'network' => NETWORK_PUMPIO];
|
||||||
$orig_post = Item::selectFirst([], $condition);
|
$orig_post = Item::selectFirst([], $condition);
|
||||||
|
|
||||||
if (!DBA::is_result($orig_post)) {
|
if (!DBA::isResult($orig_post)) {
|
||||||
logger("pumpio_send: no pumpio post ".$b["parent"]);
|
logger("pumpio_send: no pumpio post ".$b["parent"]);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -572,7 +572,7 @@ function pumpio_send(App $a, array &$b)
|
||||||
logger('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true));
|
logger('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true));
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
|
$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"];
|
$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]);
|
$orig_post = Item::selectFirst([], ['uri' => $uri, 'uid' => $uid]);
|
||||||
|
|
||||||
if (!DBA::is_result($orig_post)) {
|
if (!DBA::isResult($orig_post)) {
|
||||||
return;
|
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));
|
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']);
|
$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"];
|
$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'");
|
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = 'pumpio'");
|
||||||
|
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ function pumpio_sync(App $a)
|
||||||
logger('pumpio: cron_start');
|
logger('pumpio: cron_start');
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'mirror' AND `v` = '1' ORDER BY RAND() ");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
logger('pumpio: mirroring user '.$rr['uid']);
|
logger('pumpio: mirroring user '.$rr['uid']);
|
||||||
pumpio_fetchtimeline($a, $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);
|
$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() ");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
if ($abandon_days != 0) {
|
if ($abandon_days != 0) {
|
||||||
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
|
$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');
|
logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -870,9 +870,9 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
|
||||||
// Searching for the unliked post
|
// Searching for the unliked post
|
||||||
// Two queries for speed issues
|
// Two queries for speed issues
|
||||||
$orig_post = Item::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
|
$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]);
|
$orig_post = Item::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
|
||||||
if (!DBA::is_result($orig_post)) {
|
if (!DBA::isResult($orig_post)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contactid = $r[0]['id'];
|
$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']]);
|
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']);
|
logger("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
|
||||||
} else {
|
} else {
|
||||||
logger("pumpio_dounlike: not found. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
|
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
|
// Searching for the liked post
|
||||||
// Two queries for speed issues
|
// Two queries for speed issues
|
||||||
$orig_post = Item::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
|
$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]);
|
$orig_post = Item::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
|
||||||
if (!DBA::is_result($orig_post)) {
|
if (!DBA::isResult($orig_post)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -942,7 +942,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contactid = $r[0]['id'];
|
$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",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
|
||||||
intval($uid), dbesc(normalise_link($contact->url)));
|
intval($uid), dbesc(normalise_link($contact->url)));
|
||||||
|
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
// create contact record
|
// create contact record
|
||||||
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
|
@ -1047,7 +1047,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1175,7 +1175,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contact_id = $r[0]['id'];
|
$contact_id = $r[0]['id'];
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
|
$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)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contact_id = $r[0]['id'];
|
$contact_id = $r[0]['id'];
|
||||||
} else {
|
} else {
|
||||||
$contact_id = $self[0]['id'];
|
$contact_id = $self[0]['id'];
|
||||||
|
@ -1404,7 +1404,7 @@ function pumpio_queue_hook(App $a, array &$b)
|
||||||
dbesc(NETWORK_PUMPIO)
|
dbesc(NETWORK_PUMPIO)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!DBA::is_result($qi)) {
|
if (!DBA::isResult($qi)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1419,7 +1419,7 @@ function pumpio_queue_hook(App $a, array &$b)
|
||||||
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
||||||
intval($x['cid'])
|
intval($x['cid'])
|
||||||
);
|
);
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1511,7 +1511,7 @@ function pumpio_getreceiver(App $a, array $b)
|
||||||
dbesc(NETWORK_PUMPIO)
|
dbesc(NETWORK_PUMPIO)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$receiver["bcc"][] = [
|
$receiver["bcc"][] = [
|
||||||
"displayName" => $r[0]["name"],
|
"displayName" => $r[0]["name"],
|
||||||
"objectType" => "person",
|
"objectType" => "person",
|
||||||
|
@ -1554,7 +1554,7 @@ function pumpio_getreceiver(App $a, array $b)
|
||||||
dbesc(NETWORK_PUMPIO)
|
dbesc(NETWORK_PUMPIO)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$receiver["to"][] = [
|
$receiver["to"][] = [
|
||||||
"displayName" => $r[0]["name"],
|
"displayName" => $r[0]["name"],
|
||||||
"objectType" => "person",
|
"objectType" => "person",
|
||||||
|
@ -1586,7 +1586,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
|
||||||
// Fetching the original post
|
// Fetching the original post
|
||||||
$condition = ["`uri` = ? AND `uid` = ? AND `extid` != ''", $id, $uid];
|
$condition = ["`uri` = ? AND `uid` = ? AND `extid` != ''", $id, $uid];
|
||||||
$item = Item::selectFirst(['extid'], $condition);
|
$item = Item::selectFirst(['extid'], $condition);
|
||||||
if (!DBA::is_result($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,7 @@ function statusnet_post_hook(App $a, &$b)
|
||||||
|
|
||||||
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
||||||
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
|
$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"]);
|
logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -685,7 +685,7 @@ function statusnet_prepare_body(App $a, &$b)
|
||||||
|
|
||||||
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
|
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
|
||||||
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
|
$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"]);
|
$nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post["author-link"]);
|
||||||
|
|
||||||
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
|
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
|
||||||
|
@ -730,7 +730,7 @@ function statusnet_cron(App $a, $b)
|
||||||
logger('statusnet: cron_start');
|
logger('statusnet: cron_start');
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() ");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
logger('statusnet: fetching for user ' . $rr['uid']);
|
logger('statusnet: fetching for user ' . $rr['uid']);
|
||||||
statusnet_fetchtimeline($a, $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);
|
$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()");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
if ($abandon_days != 0) {
|
if ($abandon_days != 0) {
|
||||||
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
|
$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');
|
logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
|
||||||
continue;
|
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));
|
$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;
|
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);
|
logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
// create contact record
|
// create contact record
|
||||||
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
|
@ -940,7 +940,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(NETWORK_STATUSNET));
|
dbesc(NETWORK_STATUSNET));
|
||||||
|
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
return false;
|
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",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$self = $r[0];
|
$self = $r[0];
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
@ -1086,11 +1086,11 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
$fields = ['uri', 'parent-uri', 'parent'];
|
$fields = ['uri', 'parent-uri', 'parent'];
|
||||||
$item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
|
$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]);
|
$item = Item::selectFirst($fields, ['extid' => $parent, 'uid' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBA::is_result($item)) {
|
if (DBA::isResult($item)) {
|
||||||
$postarray['thr-parent'] = $item['uri'];
|
$postarray['thr-parent'] = $item['uri'];
|
||||||
$postarray['parent-uri'] = $item['parent-uri'];
|
$postarray['parent-uri'] = $item['parent-uri'];
|
||||||
$postarray['parent'] = $item['parent'];
|
$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",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contactid = $r[0]["id"];
|
$contactid = $r[0]["id"];
|
||||||
|
|
||||||
$postarray['owner-name'] = $r[0]["name"];
|
$postarray['owner-name'] = $r[0]["name"];
|
||||||
|
@ -1212,7 +1212,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
||||||
intval($own_contact),
|
intval($own_contact),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$nick = $r[0]["nick"];
|
$nick = $r[0]["nick"];
|
||||||
} else {
|
} else {
|
||||||
logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
|
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",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$self = $r[0];
|
$self = $r[0];
|
||||||
} else {
|
} else {
|
||||||
logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
|
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",
|
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
if (!DBA::is_result($u)) {
|
if (!DBA::isResult($u)) {
|
||||||
logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
|
logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1521,7 +1521,7 @@ function statusnet_fetch_own_contact(App $a, $uid)
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||||
intval($uid), dbesc($own_url));
|
intval($uid), dbesc($own_url));
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contact_id = $r[0]["id"];
|
$contact_id = $r[0]["id"];
|
||||||
} else {
|
} else {
|
||||||
PConfig::delete($uid, 'statusnet', 'own_url');
|
PConfig::delete($uid, 'statusnet', 'own_url');
|
||||||
|
|
|
@ -184,7 +184,7 @@ function twitter_follow(App $a, &$contact)
|
||||||
FROM `contact` WHERE `uid` = %d AND `nick` = '%s'",
|
FROM `contact` WHERE `uid` = %d AND `nick` = '%s'",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc($nickname));
|
dbesc($nickname));
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contact["contact"] = $r[0];
|
$contact["contact"] = $r[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ function twitter_post_hook(App $a, &$b)
|
||||||
|
|
||||||
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
||||||
$orig_post = Item::selectFirst([], $condition);
|
$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"]);
|
logger("twitter_post_hook: no parent found " . $b["thr-parent"]);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -621,7 +621,7 @@ function twitter_post_hook(App $a, &$b)
|
||||||
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
|
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
|
$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"];
|
$a->contact = $r[0]["id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ function twitter_cron(App $a, $b)
|
||||||
logger('twitter: cron_start');
|
logger('twitter: cron_start');
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'mirror_posts' AND `v` = '1'");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
logger('twitter: fetching for user ' . $rr['uid']);
|
logger('twitter: fetching for user ' . $rr['uid']);
|
||||||
Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 1, (int) $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);
|
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
if ($abandon_days != 0) {
|
if ($abandon_days != 0) {
|
||||||
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
|
$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');
|
logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ function twitter_expire(App $a, $b)
|
||||||
logger('twitter_expire: expire_start');
|
logger('twitter_expire: expire_start');
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()");
|
$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) {
|
foreach ($r as $rr) {
|
||||||
logger('twitter_expire: user ' . $rr['uid']);
|
logger('twitter_expire: user ' . $rr['uid']);
|
||||||
Item::expire($rr['uid'], $days, NETWORK_TWITTER, true);
|
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()];
|
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
|
||||||
$orig_post = Item::selectFirst(['author-link'], $condition);
|
$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"]);
|
$nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
|
||||||
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
|
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
|
||||||
$nicknameplain = "@" . $nicknameplain;
|
$nicknameplain = "@" . $nicknameplain;
|
||||||
|
@ -924,7 +924,7 @@ function twitter_queue_hook(App $a, &$b)
|
||||||
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
|
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
|
||||||
dbesc(NETWORK_TWITTER)
|
dbesc(NETWORK_TWITTER)
|
||||||
);
|
);
|
||||||
if (!DBA::is_result($qi)) {
|
if (!DBA::isResult($qi)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,7 +939,7 @@ function twitter_queue_hook(App $a, &$b)
|
||||||
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
||||||
intval($x['cid'])
|
intval($x['cid'])
|
||||||
);
|
);
|
||||||
if (!DBA::is_result($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,11 +1018,11 @@ function twitter_fetch_contact($uid, $data, $create_user)
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]);
|
$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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::is_result($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
// create contact record
|
// create contact record
|
||||||
$fields['uid'] = $uid;
|
$fields['uid'] = $uid;
|
||||||
$fields['created'] = DateTimeFormat::utcNow();
|
$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",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$self = $r[0];
|
$self = $r[0];
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
@ -1353,11 +1353,11 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
||||||
|
|
||||||
$fields = ['uri', 'parent-uri', 'parent'];
|
$fields = ['uri', 'parent-uri', 'parent'];
|
||||||
$parent_item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
|
$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]);
|
$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['thr-parent'] = $parent_item['uri'];
|
||||||
$postarray['parent-uri'] = $parent_item['parent-uri'];
|
$postarray['parent-uri'] = $parent_item['parent-uri'];
|
||||||
$postarray['parent'] = $parent_item['parent'];
|
$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",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contactid = $r[0]["id"];
|
$contactid = $r[0]["id"];
|
||||||
|
|
||||||
$postarray['owner-name'] = $r[0]["name"];
|
$postarray['owner-name'] = $r[0]["name"];
|
||||||
|
@ -1574,7 +1574,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
||||||
intval($own_contact),
|
intval($own_contact),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$own_id = $r[0]["nick"];
|
$own_id = $r[0]["nick"];
|
||||||
} else {
|
} else {
|
||||||
logger("twitter_fetchhometimeline: Own twitter contact not found for user " . $uid, LOGGER_DEBUG);
|
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",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$self = $r[0];
|
$self = $r[0];
|
||||||
} else {
|
} else {
|
||||||
logger("twitter_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
|
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",
|
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
|
||||||
intval($uid));
|
intval($uid));
|
||||||
if (!DBA::is_result($u)) {
|
if (!DBA::isResult($u)) {
|
||||||
logger("twitter_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
|
logger("twitter_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1660,7 +1660,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
||||||
|
|
||||||
if ($postarray['uri'] == $postarray['parent-uri']) {
|
if ($postarray['uri'] == $postarray['parent-uri']) {
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]);
|
||||||
if (DBA::is_result($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$notify = Item::isRemoteSelf($contact, $postarray);
|
$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",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc("twitter::" . $own_id));
|
dbesc("twitter::" . $own_id));
|
||||||
if (DBA::is_result($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$contact_id = $r[0]["id"];
|
$contact_id = $r[0]["id"];
|
||||||
} else {
|
} else {
|
||||||
PConfig::delete($uid, 'twitter', 'own_id');
|
PConfig::delete($uid, 'twitter', 'own_id');
|
||||||
|
|
|
@ -43,7 +43,7 @@ function viewsrc_item_photo_menu(&$a, &$b)
|
||||||
|
|
||||||
if (local_user() != $b['item']['uid']) {
|
if (local_user() != $b['item']['uid']) {
|
||||||
$item = Item::selectFirstForUser(local_user(), ['id'], ['uid' => local_user(), 'guid' => $b['item']['guid']]);
|
$item = Item::selectFirstForUser(local_user(), ['id'], ['uid' => local_user(), 'guid' => $b['item']['guid']]);
|
||||||
if (!DBA::is_result($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue