$columns = DBA::columnCount($ret);
- $data = DBA::inArray($ret);
+ $data = DBA::toArray($ret);
if ((count($data) == 0) && ($columns == 0)) {
return true;
$r = DBA::select('user', ['uid', 'username', 'nickname'],
['parent-uid' => $master_record['uid'], 'account_removed' => false]);
if (DBM::is_result($r)) {
- $a->identities = array_merge($a->identities, DBA::inArray($r));
+ $a->identities = array_merge($a->identities, DBA::toArray($r));
}
} else {
// Just ensure that the array is always defined
$r = DBA::select('user', ['uid', 'username', 'nickname'],
['uid' => $master_record['parent-uid'], 'account_removed' => false]);
if (DBM::is_result($r)) {
- $a->identities = DBA::inArray($r);
+ $a->identities = DBA::toArray($r);
}
// Then add all siblings
$r = DBA::select('user', ['uid', 'username', 'nickname'],
['parent-uid' => $master_record['parent-uid'], 'account_removed' => false]);
if (DBM::is_result($r)) {
- $a->identities = array_merge($a->identities, DBA::inArray($r));
+ $a->identities = array_merge($a->identities, DBA::toArray($r));
}
}
$master_record['uid']
);
if (DBM::is_result($r)) {
- $a->identities = array_merge($a->identities, DBA::inArray($r));
+ $a->identities = array_merge($a->identities, DBA::toArray($r));
}
if ($login_initial) {
$statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
- $contacts = DBA::inArray($statement);
+ $contacts = DBA::toArray($statement);
$t = get_markup_template('admin/contactblock.tpl');
$o = replace_macros($t, [
{
// get jobs from the workerqueue table
$statement = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
- $r = DBA::inArray($statement);
+ $r = DBA::toArray($statement);
for($i = 0; $i < count($r); $i++) {
$r[$i]['parameter'] = implode(json_decode($r[$i]['parameter']), ': ');
AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin`
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
);
- return DBA::inArray($r);
+ return DBA::toArray($r);
} elseif ($content == 'global') {
$r = DBA::p("SELECT `uri` FROM `thread`
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
WHERE `thread`.`uid` = 0 AND NOT `author`.`hidden` AND NOT `author`.`blocked`
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage));
- return DBA::inArray($r);
+ return DBA::toArray($r);
}
// Should never happen
local_user(), TERM_OBJ_POST, TERM_HASHTAG,
$top_limit, $bottom_limit);
- $data = DBA::inArray($items);
+ $data = DBA::toArray($items);
if (count($data) > 0) {
$tag_top_limit = current($data)['order_date'];
$o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" >\r\n";
$s = DBA::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
if (DBM::is_result($r)) {
foreach ($r as $rr) {
ORDER BY `name` ASC ", intval(local_user())
);
- $contacts = DBA::inArray($stmt);
+ $contacts = DBA::toArray($stmt);
$arr = ['contact' => $contacts, 'entry' => $o];
ORDER BY `name` ASC ", intval(local_user())
);
- $contacts = DBA::inArray($stmt);
+ $contacts = DBA::toArray($stmt);
$arr = ['contact' => $contacts, 'entry' => $o];
if (strlen($addons)) {
$r = DBA::select('addon', [], ['installed' => 1]);
if (DBM::is_result($r)) {
- $installed = DBA::inArray($r);
+ $installed = DBA::toArray($r);
} else {
$installed = [];
}
$r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
if (DBM::is_result($r)) {
self::$db_duration += (microtime(true) - $stamp);
- return DBA::inArray($r);
+ return DBA::toArray($r);
}
DBA::close($r);
if ($found) {
$r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
- return DBA::inArray($r);
+ return DBA::toArray($r);
}
return false;
}
*/
public static function databaseName() {
$ret = self::p("SELECT DATABASE() AS `db`");
- $data = self::inArray($ret);
+ $data = self::toArray($ret);
return $data[0]['db'];
}
case 'pdo':
$r = self::p("SELECT 1");
if (DBM::is_result($r)) {
- $row = self::inArray($r);
+ $row = self::toArray($r);
$connected = ($row[0]['1'] == '1');
}
break;
* @param object $stmt statement object
* @return array Data array
*/
- public static function inArray($stmt, $do_close = true) {
+ public static function toArray($stmt, $do_close = true) {
if (is_bool($stmt)) {
return $stmt;
}
local_user()
);
if (DBM::is_result($stmt)) {
- $return = DBA::inArray($stmt);
+ $return = DBA::toArray($stmt);
}
}
$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 `nurl` = ? AND `uid` = ?", normalise_link($url), $uid);
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
// Fetch contact data from the contact table for the given user, checking with the alias
if (!DBM::is_result($r)) {
$s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = ?", normalise_link($url), $url, $ssl_url, $uid);
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
$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));
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias
$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);
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
}
// Fetch the data from the gcontact table
$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::inArray($s);
+ $r = DBA::toArray($s);
}
if (DBM::is_result($r)) {
);
$s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
- $contacts = DBA::inArray($s);
+ $contacts = DBA::toArray($s);
if (!DBM::is_result($contacts)) {
return 0;
}
$events = DBA::select('event', $fields, $conditions);
if (DBM::is_result($events)) {
- $return = DBA::inArray($events);
+ $return = DBA::toArray($events);
}
return $return;
local_user()
);
- return DBA::inArray($stmt);
+ return DBA::toArray($stmt);
}
/**
DateTimeFormat::utcNow()
);
if (DBM::is_result($s)) {
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
Cache::set($cachekey, $r, CACHE_HOUR);
}
}
logger(__function__ . ":" . $consumer_key);
$s = DBA::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
if (DBM::is_result($r)) {
return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
logger(__function__ . ":" . $consumer . ", " . $token_type . ", " . $token);
$s = DBA::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
- $r = DBA::inArray($s);
+ $r = DBA::toArray($s);
if (DBM::is_result($r)) {
$ot = new OAuthToken($r[0]['id'], $r[0]['secret']);
$condition['network'] = $networks;
}
$contacts = DBA::select('contact', ['id', 'url', 'network'], $condition);
- $r = DBA::inArray($contacts);
+ $r = DBA::toArray($contacts);
}
// delivery loop
$condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'archive' => false, 'rel' => [CONTACT_IS_FOLLOWER, CONTACT_IS_FRIEND]];
- $r2 = DBA::inArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
+ $r2 = DBA::toArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
$r = array_merge($r2, $r1);
// Handling the pubsubhubbub requests
PushSubscriber::requeue();
- $r = DBA::inArray(DBA::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
+ $r = DBA::toArray(DBA::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));
Addon::callHooks('queue_predeliver', $r);