1
1
Fork 0

Rename DBA::is_result to DBA::isResult

This commit is contained in:
Hypolite Petovan 2018-07-21 08:46:04 -04:00 committed by Hypolite Petovan
commit ecea7425f8
152 changed files with 765 additions and 765 deletions

View file

@ -1396,7 +1396,7 @@ class App
// Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server
$user = DBA::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
if (DBA::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
if (DBA::isResult($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
$page_theme = $user['theme'];
}
}

View file

@ -28,7 +28,7 @@ class ContactSelector
$s = DBA::select('profile', ['id', 'profile-name', 'is-default'], ['uid' => $_SESSION['uid']]);
$r = DBA::toArray($s);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$selected = (($rr['id'] == $current || ($current == 0 && $rr['is-default'] == 1)) ? " selected=\"selected\" " : "");
$o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
@ -105,7 +105,7 @@ class ContactSelector
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$networkname = $r['platform'];
}
}

View file

@ -98,7 +98,7 @@ class ForumManager
$total = count($contacts);
$visible_forums = 10;
if (DBA::is_result($contacts)) {
if (DBA::isResult($contacts)) {
$id = 0;
foreach ($contacts as $contact) {

View file

@ -106,7 +106,7 @@ class Nav
// user info
$contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
$userinfo = [
'icon' => (DBA::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
'icon' => (DBA::isResult($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
'name' => $a->user['username'],
];
} else {

View file

@ -63,7 +63,7 @@ class OEmbed
$condition = ['url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth];
$oembed = DBA::selectFirst('oembed', ['content'], $condition);
if (DBA::is_result($oembed)) {
if (DBA::isResult($oembed)) {
$txt = $oembed["content"];
} else {
$txt = Cache::get($a->videowidth . $embedurl);

View file

@ -276,11 +276,11 @@ class Widget
if (Profile::getMyURL()) {
$contact = DBA::selectFirst('contact', ['id'],
['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$cid = $contact['id'];
} else {
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
if (DBA::is_result($gcontact)) {
if (DBA::isResult($gcontact)) {
$zcid = $gcontact['id'];
}
}

View file

@ -98,7 +98,7 @@ class TagCloud
$type,
TERM_OBJ_POST
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return [];
}

View file

@ -112,7 +112,7 @@ class ACL extends BaseObject
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
Addon::callHooks($a->module . '_pre_' . $selname, $arr);
if (DBA::is_result($contacts)) {
if (DBA::isResult($contacts)) {
foreach ($contacts as $contact) {
if (in_array($contact['id'], $preselected)) {
$selected = ' selected="selected" ';
@ -179,7 +179,7 @@ class ACL extends BaseObject
$receiverlist = [];
if (DBA::is_result($contacts)) {
if (DBA::isResult($contacts)) {
foreach ($contacts as $contact) {
if (in_array($contact['id'], $preselected)) {
$selected = ' selected="selected"';
@ -273,7 +273,7 @@ class ACL extends BaseObject
if (!$imap_disabled) {
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
if (DBA::is_result($mailacct)) {
if (DBA::isResult($mailacct)) {
$mail_enabled = true;
$pubmail_enabled = !empty($mailacct['pubmail']);
}

View file

@ -79,7 +79,7 @@ class Addon
$addons = Config::get('system', 'addon');
if (strlen($addons)) {
$r = DBA::select('addon', [], ['installed' => 1]);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$installed = DBA::toArray($r);
} else {
$installed = [];

View file

@ -17,7 +17,7 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
{
$cache = DBA::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
if (DBA::is_result($cache)) {
if (DBA::isResult($cache)) {
$cached = $cache['v'];
$value = @unserialize($cached);

View file

@ -56,7 +56,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
}
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
if (DBA::is_result($config)) {
if (DBA::isResult($config)) {
// manage array value
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);

View file

@ -22,7 +22,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
$a = self::getApp();
$pconfigs = DBA::select('pconfig', ['v', 'k'], ['cat' => $cat, 'uid' => $uid]);
if (DBA::is_result($pconfigs)) {
if (DBA::isResult($pconfigs)) {
while ($pconfig = DBA::fetch($pconfigs)) {
$k = $pconfig['k'];
@ -58,7 +58,7 @@ class JITPConfigAdapter extends BaseObject implements IPConfigAdapter
}
$pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
if (DBA::is_result($pconfig)) {
if (DBA::isResult($pconfig)) {
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
self::getApp()->setPConfigValue($uid, $cat, $k, $val);

View file

@ -43,7 +43,7 @@ class PreloadConfigAdapter extends BaseObject implements IConfigAdapter
{
if ($refresh) {
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]);
if (DBA::is_result($config)) {
if (DBA::isResult($config)) {
self::getApp()->setConfigValue($cat, $k, $config['v']);
}
}

View file

@ -51,7 +51,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
if ($refresh) {
$config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
if (DBA::is_result($config)) {
if (DBA::isResult($config)) {
self::getApp()->setPConfigValue($uid, $cat, $k, $config['v']);
} else {
self::getApp()->deletePConfigValue($uid, $cat, $k);

View file

@ -81,7 +81,7 @@ HELP;
$nurl = normalise_link($net['url']);
$contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
$this->out('NOTICE: The account should be silenced from the global community page');
} else {

View file

@ -64,7 +64,7 @@ HELP;
$nick = $this->getArgument(0);
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
throw new RuntimeException(L10n::t('User not found'));
}

View file

@ -23,7 +23,7 @@ class DatabaseLockDriver extends AbstractLockDriver
DBA::lock('locks');
$lock = DBA::selectFirst('locks', ['locked', 'pid'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
if (DBA::is_result($lock)) {
if (DBA::isResult($lock)) {
if ($lock['locked']) {
// We want to lock something that was already locked by us? So we got the lock.
if ($lock['pid'] == getmypid()) {
@ -79,7 +79,7 @@ class DatabaseLockDriver extends AbstractLockDriver
{
$lock = DBA::selectFirst('locks', ['locked'], ['`name` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
if (DBA::is_result($lock)) {
if (DBA::isResult($lock)) {
return $lock['locked'] !== false;
} else {
return false;

View file

@ -96,7 +96,7 @@ class NotificationsManager extends BaseObject
intval(local_user())
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $this->_set_extra($r);
}
@ -116,7 +116,7 @@ class NotificationsManager extends BaseObject
intval($id),
intval(local_user())
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $this->_set_extra($r)[0];
}
return null;
@ -224,7 +224,7 @@ class NotificationsManager extends BaseObject
$notif = [];
$arr = [];
if (DBA::is_result($notifs)) {
if (DBA::isResult($notifs)) {
foreach ($notifs as $it) {
// Because we use different db tables for the notification query
// we have sometimes $it['unseen'] and sometimes $it['seen].
@ -405,7 +405,7 @@ class NotificationsManager extends BaseObject
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
if (DBA::is_result($items)) {
if (DBA::isResult($items)) {
$notifs = $this->formatNotifs(Item::inArray($items), $ident);
}
@ -447,7 +447,7 @@ class NotificationsManager extends BaseObject
intval($limit)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$notifs = $this->formatNotifs($r, $ident);
}
@ -492,7 +492,7 @@ class NotificationsManager extends BaseObject
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
if (DBA::is_result($items)) {
if (DBA::isResult($items)) {
$notifs = $this->formatNotifs(Item::inArray($items), $ident);
}
@ -532,7 +532,7 @@ class NotificationsManager extends BaseObject
$params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
if (DBA::is_result($items)) {
if (DBA::isResult($items)) {
$notifs = $this->formatNotifs(Item::inArray($items), $ident);
}
@ -584,7 +584,7 @@ class NotificationsManager extends BaseObject
intval($start),
intval($limit)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$notifs = $this->formatIntros($r);
}

View file

@ -30,7 +30,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
}
$session = DBA::selectFirst('session', ['data'], ['sid' => $session_id]);
if (DBA::is_result($session)) {
if (DBA::isResult($session)) {
Session::$exists = true;
return $session['data'];
}

View file

@ -162,7 +162,7 @@ class Worker
{
$condition = ["`executed` <= ? AND NOT `done`", NULL_DATE];
$workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
if (DBA::is_result($workerqueue)) {
if (DBA::isResult($workerqueue)) {
return $workerqueue["priority"];
} else {
return 0;
@ -477,7 +477,7 @@ class Worker
if ($max == 0) {
// the maximum number of possible user connections can be a system variable
$r = DBA::fetchFirst("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$max = $r["Value"];
}
// Or it can be granted. This overrides the system variable
@ -513,7 +513,7 @@ class Worker
// We will now check for the system values.
// This limit could be reached although the user limits are fine.
$r = DBA::fetchFirst("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
$max = intval($r["Value"]);
@ -521,7 +521,7 @@ class Worker
return false;
}
$r = DBA::fetchFirst("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
$used = intval($r["Value"]);
@ -734,7 +734,7 @@ class Worker
);
// No active processes at all? Fine
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
$priorities = [];
@ -871,7 +871,7 @@ class Worker
// There can already be jobs for us in the queue.
$r = DBA::select('workerqueue', [], ['pid' => getmypid(), 'done' => false]);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
self::$db_duration += (microtime(true) - $stamp);
return DBA::toArray($r);
}
@ -1163,7 +1163,7 @@ class Worker
$row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => 1]);
// When we don't have a row, no job is running
if (!DBA::is_result($row)) {
if (!DBA::isResult($row)) {
return false;
}

View file

@ -216,7 +216,7 @@ class DBA
}
$r = self::p("EXPLAIN ".$query);
if (!self::is_result($r)) {
if (!self::isResult($r)) {
return;
}
@ -269,7 +269,7 @@ class DBA
switch (self::$driver) {
case 'pdo':
$r = self::p("SELECT 1");
if (self::is_result($r)) {
if (self::isResult($r)) {
$row = self::toArray($r);
$connected = ($row[0]['1'] == '1');
}
@ -1582,7 +1582,7 @@ class DBA
*
* @return boolean Whether $array is a filled array or an object with rows
*/
public static function is_result($array)
public static function isResult($array)
{
// It could be a return value from an update statement
if (is_bool($array)) {

View file

@ -29,7 +29,7 @@ class DBStructure
$r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
dbesc(DBA::databaseName()));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
echo L10n::t('There are no tables on MyISAM.')."\n";
return;
}
@ -39,7 +39,7 @@ class DBStructure
echo $sql."\n";
$result = DBA::e($sql);
if (!DBA::is_result($result)) {
if (!DBA::isResult($result)) {
self::printUpdateError($sql);
}
}
@ -61,7 +61,7 @@ class DBStructure
);
// No valid result?
if (!DBA::is_result($adminlist)) {
if (!DBA::isResult($adminlist)) {
logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_INFO);
// Don't continue
@ -105,7 +105,7 @@ class DBStructure
$table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
if (DBA::is_result($table_status)) {
if (DBA::isResult($table_status)) {
$table_status = $table_status[0];
} else {
$table_status = [];
@ -114,7 +114,7 @@ class DBStructure
$fielddata = [];
$indexdata = [];
if (DBA::is_result($indexes)) {
if (DBA::isResult($indexes)) {
foreach ($indexes AS $index) {
if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
$indexdata[$index["Key_name"]] = ['UNIQUE'];
@ -129,7 +129,7 @@ class DBStructure
$indexdata[$index["Key_name"]][] = $column;
}
}
if (DBA::is_result($structures)) {
if (DBA::isResult($structures)) {
foreach ($structures AS $field) {
// Replace the default size values so that we don't have to define them
$search = ['tinyint(1)', 'tinyint(3) unsigned', 'tinyint(4)', 'smallint(5) unsigned', 'smallint(6)', 'mediumint(8) unsigned', 'mediumint(9)', 'bigint(20)', 'int(10) unsigned', 'int(11)'];
@ -154,7 +154,7 @@ class DBStructure
}
}
}
if (DBA::is_result($full_columns)) {
if (DBA::isResult($full_columns)) {
foreach ($full_columns AS $column) {
$fielddata[$column["Field"]]["Collation"] = $column["Collation"];
$fielddata[$column["Field"]]["comment"] = $column["Comment"];
@ -222,7 +222,7 @@ class DBStructure
$tables = q("SHOW TABLES");
}
if (DBA::is_result($tables)) {
if (DBA::isResult($tables)) {
foreach ($tables AS $table) {
$table = current($table);
@ -253,7 +253,7 @@ class DBStructure
$temp_name = $name;
if (!isset($database[$name])) {
$r = self::createTable($name, $structure, $verbose, $action);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($name);
}
$is_new_table = true;
@ -479,13 +479,13 @@ class DBStructure
DBA::e("SET session old_alter_table=1;");
} else {
$r = DBA::e("DROP TABLE IF EXISTS `".$temp_name."`;");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
$r = DBA::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
@ -493,7 +493,7 @@ class DBStructure
}
$r = DBA::e($sql3);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
}
if ($is_unique && ($temp_name != $name)) {
@ -501,17 +501,17 @@ class DBStructure
DBA::e("SET session old_alter_table=0;");
} else {
$r = DBA::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
$r = DBA::e("DROP TABLE `".$name."`;");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}
$r = DBA::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
return $errors;
}

View file

@ -146,7 +146,7 @@ class PostUpdate
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
logger("Updated threads", LOGGER_DEBUG);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
Config::set("system", "post_update_version", 1198);
logger("Done", LOGGER_DEBUG);
return true;
@ -207,7 +207,7 @@ class PostUpdate
FROM `user`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
foreach ($r as $user) {

View file

@ -53,7 +53,7 @@ class Contact extends BaseObject
$gid,
local_user()
);
if (DBA::is_result($stmt)) {
if (DBA::isResult($stmt)) {
$return = DBA::toArray($stmt);
}
}
@ -103,7 +103,7 @@ class Contact extends BaseObject
}
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
return false;
}
@ -146,20 +146,20 @@ class Contact extends BaseObject
$fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'gender', 'avatar',
'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'nurl'];
$self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
if (!DBA::is_result($self)) {
if (!DBA::isResult($self)) {
return;
}
$fields = ['nickname', 'page-flags', 'account-type'];
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
return;
}
$fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region',
'country-name', 'gender', 'pub_keywords', 'xmpp'];
$profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
if (!DBA::is_result($profile)) {
if (!DBA::isResult($profile)) {
return;
}
@ -170,7 +170,7 @@ class Contact extends BaseObject
'contact-type' => $user['account-type'], 'xmpp' => $profile['xmpp']];
$avatar = DBA::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
if (DBA::is_result($avatar)) {
if (DBA::isResult($avatar)) {
if ($update_avatar) {
$fields['avatar-date'] = DateTimeFormat::utcNow();
}
@ -244,7 +244,7 @@ class Contact extends BaseObject
{
// We want just to make sure that we don't delete our "self" contact
$contact = DBA::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
if (!DBA::is_result($contact) || !intval($contact['uid'])) {
if (!DBA::isResult($contact) || !intval($contact['uid'])) {
return;
}
@ -403,7 +403,7 @@ class Contact extends BaseObject
$r = DBA::toArray($s);
// Fetch contact data from the contact table for the given user, checking with the alias
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$s = DBA::p("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = ?", normalise_link($url), $url, $ssl_url, $uid);
@ -411,7 +411,7 @@ class Contact extends BaseObject
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `nurl` = ? AND `uid` = 0", normalise_link($url));
@ -419,7 +419,7 @@ class Contact extends BaseObject
}
// Fetch the data from the contact table with "uid=0" (which is filled automatically) - checked with the alias
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$s = DBA::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `alias` IN (?, ?, ?) AND `uid` = 0", normalise_link($url), $url, $ssl_url);
@ -427,14 +427,14 @@ class Contact extends BaseObject
}
// Fetch the data from the gcontact table
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$s = DBA::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, 0 AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `nurl` = ?", normalise_link($url));
$r = DBA::toArray($s);
}
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
// If there is more than one entry we filter out the connector networks
if (count($r) > 1) {
foreach ($r as $id => $result) {
@ -540,7 +540,7 @@ class Contact extends BaseObject
intval($uid)
);
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `addr` = '%s' AND `uid` = 0",
@ -549,7 +549,7 @@ class Contact extends BaseObject
}
// Fetch the data from the gcontact table
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `addr` = '%s'",
@ -557,7 +557,7 @@ class Contact extends BaseObject
);
}
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$data = Probe::uri($addr);
$profile = self::getDetailsByURL($data['url'], $uid);
@ -602,7 +602,7 @@ class Contact extends BaseObject
// Look for our own contact if the uid doesn't match and isn't public
$contact_own = DBA::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
if (DBA::is_result($contact_own)) {
if (DBA::isResult($contact_own)) {
return self::photoMenu($contact_own, $uid);
} else {
$profile_link = self::magicLink($contact['url']);
@ -748,19 +748,19 @@ class Contact extends BaseObject
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
// Then the addr (nick@server.tld)
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
}
// Then the alias (which could be anything)
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
// The link could be provided as http although we stored it as https
$ssl_url = str_replace('http://', 'https://', $url);
$condition = ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid];
$contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition);
}
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$contact_id = $contact["id"];
// Update the contact every 7 days
@ -790,25 +790,25 @@ class Contact extends BaseObject
// Get data from the gcontact table
$fields = ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'];
$contact = DBA::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
$contact = DBA::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
}
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'keywords', 'location', 'about', 'network',
'priority', 'batch', 'request', 'confirm', 'poco'];
$contact = DBA::selectFirst('contact', $fields, ['addr' => $url]);
}
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
// The link could be provided as http although we stored it as https
$ssl_url = str_replace('http://', 'https://', $url);
$condition = ['alias' => [$url, normalise_link($url), $ssl_url]];
$contact = DBA::selectFirst('contact', $fields, $condition);
}
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'network', 'priority', 'batch', 'request', 'confirm'];
$condition = ['url' => [$url, normalise_link($url), $ssl_url]];
@ -819,7 +819,7 @@ class Contact extends BaseObject
$contact = $default;
}
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
return 0;
} else {
$data = array_merge($data, $contact);
@ -866,7 +866,7 @@ class Contact extends BaseObject
$s = DBA::select('contact', ['id'], ['nurl' => normalise_link($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
$contacts = DBA::toArray($s);
if (!DBA::is_result($contacts)) {
if (!DBA::isResult($contacts)) {
return 0;
}
@ -874,7 +874,7 @@ class Contact extends BaseObject
// Update the newly created contact from data in the gcontact table
$gcontact = DBA::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
if (DBA::is_result($gcontact)) {
if (DBA::isResult($gcontact)) {
// Only use the information when the probing hadn't fetched these values
if ($data['keywords'] != '') {
unset($gcontact['keywords']);
@ -900,7 +900,7 @@ class Contact extends BaseObject
$contact = DBA::selectFirst('contact', $fields, ['id' => $contact_id]);
// This condition should always be true
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
return $contact_id;
}
@ -971,7 +971,7 @@ class Contact extends BaseObject
}
$blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]);
if (!DBA::is_result($blocked)) {
if (!DBA::isResult($blocked)) {
return false;
}
return (bool) $blocked['blocked'];
@ -991,7 +991,7 @@ class Contact extends BaseObject
}
$hidden = DBA::selectFirst('contact', ['hidden'], ['id' => $cid]);
if (!DBA::is_result($hidden)) {
if (!DBA::isResult($hidden)) {
return false;
}
return (bool) $hidden['hidden'];
@ -1017,7 +1017,7 @@ class Contact extends BaseObject
dbesc(normalise_link($contact_url))
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return '';
}
@ -1137,7 +1137,7 @@ class Contact extends BaseObject
public static function updateAvatar($avatar, $uid, $cid, $force = false)
{
$contact = DBA::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
return false;
} else {
$data = [$contact["photo"], $contact["thumb"], $contact["micro"]];
@ -1156,7 +1156,7 @@ class Contact extends BaseObject
// Update the public contact (contact id = 0)
if ($uid != 0) {
$pcontact = DBA::selectFirst('contact', ['id'], ['nurl' => $contact['nurl'], 'uid' => 0]);
if (DBA::is_result($pcontact)) {
if (DBA::isResult($pcontact)) {
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
}
}
@ -1181,7 +1181,7 @@ class Contact extends BaseObject
$fields = ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'];
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
return false;
}
@ -1302,7 +1302,7 @@ class Contact extends BaseObject
dbesc($ret['network'])
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` = '%s' AND NOT `pending` LIMIT 1",
intval($uid),
dbesc(normalise_link($url)),
@ -1310,7 +1310,7 @@ class Contact extends BaseObject
);
}
if (($ret['network'] === NETWORK_DFRN) && !DBA::is_result($r)) {
if (($ret['network'] === NETWORK_DFRN) && !DBA::isResult($r)) {
if ($interactive) {
if (strlen($a->urlpath)) {
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
@ -1372,7 +1372,7 @@ class Contact extends BaseObject
$writeable = 1;
}
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
// update contact
$new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
@ -1409,7 +1409,7 @@ class Contact extends BaseObject
}
$contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
$result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL;
return $result;
}
@ -1431,7 +1431,7 @@ class Contact extends BaseObject
intval($uid)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN])) {
// create a follow slap
$item = [];
@ -1540,7 +1540,7 @@ class Contact extends BaseObject
/// @TODO Encapsulate this into a function/method
$fields = ['uid', 'username', 'email', 'page-flags', 'notify-flags', 'language'];
$user = DBA::selectFirst('user', $fields, ['uid' => $importer['uid']]);
if (DBA::is_result($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
if (DBA::isResult($user) && !in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
// create notification
$hash = random_string();
@ -1571,7 +1571,7 @@ class Contact extends BaseObject
]);
}
} elseif (DBA::is_result($user) && in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
} elseif (DBA::isResult($user) && in_array($user['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
intval($importer['uid']),
dbesc($url)
@ -1609,7 +1609,7 @@ class Contact extends BaseObject
// In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM `contact` WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`, 1, 4) != `bdyear` ");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']);
@ -1627,7 +1627,7 @@ class Contact extends BaseObject
$s = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
intval($rr['uid']), intval($rr['id']), dbesc(DateTimeFormat::utc($nextbd)), dbesc('birthday'));
if (DBA::is_result($s)) {
if (DBA::isResult($s)) {
continue;
}

View file

@ -54,7 +54,7 @@ class Conversation
$fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source'];
$old_conv = DBA::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
if (DBA::is_result($old_conv)) {
if (DBA::isResult($old_conv)) {
// Don't update when only the source has changed.
// Only do this when there had been no source before.
if ($old_conv['source'] != '') {

View file

@ -266,11 +266,11 @@ class Event extends BaseObject
if ($event['id']) {
// has the event actually changed?
$existing_event = DBA::selectFirst('event', ['edited'], ['id' => $event['id'], 'uid' => $event['uid']]);
if (!DBA::is_result($existing_event) || ($existing_event['edited'] === $event['edited'])) {
if (!DBA::isResult($existing_event) || ($existing_event['edited'] === $event['edited'])) {
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
return DBA::is_result($item) ? $item['id'] : 0;
return DBA::isResult($item) ? $item['id'] : 0;
}
$updated_fields = [
@ -288,7 +288,7 @@ class Event extends BaseObject
DBA::update('event', $updated_fields, ['id' => $event['id'], 'uid' => $event['uid']]);
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($event['uri']) . '</id>';
$object .= '<content>' . xmlify(self::getBBCode($event)) . '</content>';
$object .= '</object>' . "\n";
@ -469,7 +469,7 @@ class Event extends BaseObject
intval($event_id)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$return = self::removeDuplicates($r);
}
@ -518,7 +518,7 @@ class Event extends BaseObject
dbesc($event_params["adjust_finish"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$return = self::removeDuplicates($r);
}
@ -539,7 +539,7 @@ class Event extends BaseObject
$fmt = L10n::t('l, F j');
foreach ($event_result as $event) {
$item = Item::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link'], ['id' => $event['itemid']]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
$event = array_merge($event, $item);
}
@ -737,7 +737,7 @@ class Event extends BaseObject
}
$events = DBA::select('event', $fields, $conditions);
if (DBA::is_result($events)) {
if (DBA::isResult($events)) {
$return = DBA::toArray($events);
}
@ -761,7 +761,7 @@ class Event extends BaseObject
$process = false;
$user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
$timezone = $user['timezone'];
}

View file

@ -105,7 +105,7 @@ class GContact
intval($zcid)
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
q(
"INSERT INTO `glink` (`cid`, `uid`, `gcid`, `zcid`, `updated`) VALUES (%d, %d, %d, %d, '%s') ",
intval($cid),
@ -179,7 +179,7 @@ class GContact
dbesc(normalise_link($gcontact['url'])),
dbesc(NETWORK_STATUSNET)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$gcontact['network'] = $r[0]["network"];
}
@ -190,7 +190,7 @@ class GContact
dbesc(normalise_link($gcontact['url'])),
dbesc(NETWORK_STATUSNET)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$gcontact['network'] = $r[0]["network"];
}
}
@ -204,7 +204,7 @@ class GContact
dbesc(normalise_link($gcontact['url']))
);
if (DBA::is_result($x)) {
if (DBA::isResult($x)) {
if (!isset($gcontact['network']) && ($x[0]["network"] != NETWORK_STATUSNET)) {
$gcontact['network'] = $x[0]["network"];
}
@ -289,7 +289,7 @@ class GContact
);
// logger("countCommonFriends: $uid $cid {$r[0]['total']}");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $r[0]['total'];
}
return 0;
@ -311,7 +311,7 @@ class GContact
intval($uid)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $r[0]['total'];
}
@ -352,7 +352,7 @@ class GContact
intval($limit)
);
/// @TODO Check all calling-findings of this function if they properly use DBA::is_result()
/// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
return $r;
}
@ -384,7 +384,7 @@ class GContact
intval($limit)
);
/// @TODO Check all calling-findings of this function if they properly use DBA::is_result()
/// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
return $r;
}
@ -404,7 +404,7 @@ class GContact
intval($uid)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $r[0]['total'];
}
@ -435,7 +435,7 @@ class GContact
intval($limit)
);
/// @TODO Check all calling-findings of this function if they properly use DBA::is_result()
/// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
return $r;
}
@ -495,7 +495,7 @@ class GContact
intval($limit)
);
if (DBA::is_result($r) && count($r) >= ($limit -1)) {
if (DBA::isResult($r) && count($r) >= ($limit -1)) {
/*
* Uncommented because the result of the queries are to big to store it in the cache.
* We need to decide if we want to change the db column type or if we want to delete it.
@ -584,7 +584,7 @@ class GContact
dbesc(NETWORK_DIASPORA)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$base = substr($rr['poco'], 0, strrpos($rr['poco'], '/'));
if (! in_array($base, $done)) {
@ -693,7 +693,7 @@ class GContact
dbesc(normalise_link($contact["url"]))
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$gcontact_id = $r[0]["id"];
// Update every 90 days
@ -728,7 +728,7 @@ class GContact
dbesc(normalise_link($contact["url"]))
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$gcontact_id = $r[0]["id"];
$doprobing = in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""]);
@ -877,7 +877,7 @@ class GContact
/// @todo Check if we really should do this.
// The quality of the gcontact table is mostly lower than the public contact
$public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
if (DBA::is_result($public_contact)) {
if (DBA::isResult($public_contact)) {
logger("Update public contact ".$public_contact["id"], LOGGER_DEBUG);
Contact::updateAvatar($contact["photo"], 0, $public_contact["id"]);
@ -1052,7 +1052,7 @@ class GContact
dbesc($last_update)
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -1075,7 +1075,7 @@ class GContact
dbesc(NETWORK_DFRN)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return dirname($r[0]['url']);
}

View file

@ -38,7 +38,7 @@ class Group extends BaseObject
// access lists. What we're doing here is reviving the dead group, but old content which
// was restricted to this group may now be seen by the new group members.
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
if (DBA::is_result($group) && $group['deleted']) {
if (DBA::isResult($group) && $group['deleted']) {
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
notice(L10n::t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
}
@ -132,7 +132,7 @@ class Group extends BaseObject
}
$group = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
if (DBA::is_result($group)) {
if (DBA::isResult($group)) {
return $group['id'];
}
@ -151,13 +151,13 @@ class Group extends BaseObject
}
$group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
if (!DBA::is_result($group)) {
if (!DBA::isResult($group)) {
return false;
}
// remove group from default posting lists
$user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
$change = false;
if ($user['def_gid'] == $gid) {

View file

@ -818,7 +818,7 @@ class Item extends BaseObject
// Fetch the uri-hash from an existing item entry if there is one
$item_condition = ["`uri` = ? AND `uri-hash` != ''", $item['uri']];
$existing = DBA::selectfirst('item', ['uri-hash'], $item_condition);
if (DBA::is_result($existing)) {
if (DBA::isResult($existing)) {
$item['uri-hash'] = $existing['uri-hash'];
} else {
$item['uri-hash'] = self::itemHash($item['uri'], $item['created']);
@ -839,7 +839,7 @@ class Item extends BaseObject
if (empty($item['iaid'])) {
$item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
if (DBA::is_result($item_activity)) {
if (DBA::isResult($item_activity)) {
$item_fields = ['iaid' => $item_activity['id'], 'icid' => null];
foreach (self::MIXED_CONTENT_FIELDLIST as $field) {
if (self::isLegacyMode()) {
@ -871,7 +871,7 @@ class Item extends BaseObject
if (empty($item['icid'])) {
$item_content = DBA::selectFirst('item-content', [], ['uri-plink-hash' => $item['uri-hash']]);
if (DBA::is_result($item_content)) {
if (DBA::isResult($item_content)) {
$item_fields = ['icid' => $item_content['id']];
// Clear all fields in the item table that have a content in the item-content table
foreach ($item_content as $field => $content) {
@ -974,7 +974,7 @@ class Item extends BaseObject
'deleted', 'file', 'resource-id', 'event-id', 'attach',
'verb', 'object-type', 'object', 'target', 'contact-id'];
$item = self::selectFirst($fields, ['id' => $item_id]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
logger('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG);
return false;
}
@ -985,7 +985,7 @@ class Item extends BaseObject
}
$parent = self::selectFirst(['origin'], ['id' => $item['parent']]);
if (!DBA::is_result($parent)) {
if (!DBA::isResult($parent)) {
$parent = ['origin' => false];
}
@ -1069,7 +1069,7 @@ class Item extends BaseObject
// When we delete just our local user copy of an item, we have to set a marker to hide it
$global_item = self::selectFirst(['id'], ['uri' => $item['uri'], 'uid' => 0, 'deleted' => false]);
if (DBA::is_result($global_item)) {
if (DBA::isResult($global_item)) {
DBA::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
}
}
@ -1093,7 +1093,7 @@ class Item extends BaseObject
}
$i = self::selectFirst(['id', 'contact-id', 'tag'], ['uri' => $xt->id, 'uid' => $item['uid']]);
if (!DBA::is_result($i)) {
if (!DBA::isResult($i)) {
return;
}
@ -1194,7 +1194,7 @@ class Item extends BaseObject
// Still missing? Then use the "self" contact of the current user
if ($contact_id == 0) {
$self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $item['uid']]);
if (DBA::is_result($self)) {
if (DBA::isResult($self)) {
$contact_id = $self["id"];
}
}
@ -1290,7 +1290,7 @@ class Item extends BaseObject
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
$user = DBA::selectFirst('user', ['expire'], ['uid' => $uid]);
if (DBA::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
if (DBA::isResult($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
$expire_interval = $user['expire'];
}
@ -1313,7 +1313,7 @@ class Item extends BaseObject
trim($item['uri']), $item['uid'],
NETWORK_DIASPORA, NETWORK_DFRN, NETWORK_OSTATUS];
$existing = self::selectFirst(['id', 'network'], $condition);
if (DBA::is_result($existing)) {
if (DBA::isResult($existing)) {
// We only log the entries with a different user id than 0. Otherwise we would have too many false positives
if ($uid != 0) {
logger("Item with uri ".$item['uri']." already existed for user ".$uid." with id ".$existing["id"]." target network ".$existing["network"]." - new network: ".$item['network']);
@ -1325,7 +1325,7 @@ class Item extends BaseObject
// Ensure to always have the same creation date.
$existing = DBA::selectfirst('item', ['created', 'uri-hash'], ['uri' => $item['uri']]);
if (DBA::is_result($existing)) {
if (DBA::isResult($existing)) {
$item['created'] = $existing['created'];
$item['uri-hash'] = $existing['uri-hash'];
}
@ -1472,7 +1472,7 @@ class Item extends BaseObject
$params = ['order' => ['id' => false]];
$parent = self::selectFirst($fields, $condition, $params);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
// is the new message multi-level threaded?
// even though we don't support it now, preserve the info
// and re-attach to the conversation parent.
@ -1486,7 +1486,7 @@ class Item extends BaseObject
$params = ['order' => ['id' => false]];
$toplevel_parent = self::selectFirst($fields, $condition, $params);
if (DBA::is_result($toplevel_parent)) {
if (DBA::isResult($toplevel_parent)) {
$parent = $toplevel_parent;
}
}
@ -1521,7 +1521,7 @@ class Item extends BaseObject
// If its a post from myself then tag the thread as "mention"
logger("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], LOGGER_DEBUG);
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
$self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']);
$self_id = Contact::getIdForURL($self, 0, true);
logger("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], LOGGER_DEBUG);
@ -1666,7 +1666,7 @@ class Item extends BaseObject
$ret = DBA::insert('item', $item);
// When the item was successfully stored we fetch the ID of the item.
if (DBA::is_result($ret)) {
if (DBA::isResult($ret)) {
$current_post = DBA::lastInsertId();
} else {
// This can happen - for example - if there are locking timeouts.
@ -1771,7 +1771,7 @@ class Item extends BaseObject
*/
if (!$deleted && !$dontcache) {
$posted_item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $current_post]);
if (DBA::is_result($posted_item)) {
if (DBA::isResult($posted_item)) {
if ($notify) {
Addon::callHooks('post_local_end', $posted_item);
} else {
@ -1881,7 +1881,7 @@ class Item extends BaseObject
// Do we already have this content?
$item_activity = DBA::selectFirst('item-activity', ['id'], ['uri-hash' => $item['uri-hash']]);
if (DBA::is_result($item_activity)) {
if (DBA::isResult($item_activity)) {
$item['iaid'] = $item_activity['id'];
logger('Fetched activity for URI ' . $item['uri'] . ' (' . $item['iaid'] . ')');
} elseif (DBA::insert('item-activity', $fields)) {
@ -1922,7 +1922,7 @@ class Item extends BaseObject
// Do we already have this content?
$item_content = DBA::selectFirst('item-content', ['id'], ['uri-plink-hash' => $item['uri-hash']]);
if (DBA::is_result($item_content)) {
if (DBA::isResult($item_content)) {
$item['icid'] = $item_content['id'];
logger('Fetched content for URI ' . $item['uri'] . ' (' . $item['icid'] . ')');
} elseif (DBA::insert('item-content', $fields)) {
@ -2000,7 +2000,7 @@ class Item extends BaseObject
{
$condition = ["`id` IN (SELECT `parent` FROM `item` WHERE `id` = ?)", $itemid];
$parent = self::selectFirst(['owner-id'], $condition);
if (!DBA::is_result($parent)) {
if (!DBA::isResult($parent)) {
return;
}
@ -2009,7 +2009,7 @@ class Item extends BaseObject
'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""],
'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false];
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return;
}
@ -2071,7 +2071,7 @@ class Item extends BaseObject
if (empty($item['contact-id'])) {
$self = DBA::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
if (!DBA::is_result($self)) {
if (!DBA::isResult($self)) {
return;
}
$item['contact-id'] = $self['id'];
@ -2082,7 +2082,7 @@ class Item extends BaseObject
$notify = false;
if ($item['uri'] == $item['parent-uri']) {
$contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$notify = self::isRemoteSelf($contact, $item);
}
}
@ -2111,7 +2111,7 @@ class Item extends BaseObject
$condition = ['id' => $itemid, 'parent' => [0, $itemid]];
$item = self::selectFirst($fields, $condition);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return;
}
@ -2136,7 +2136,7 @@ class Item extends BaseObject
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
// Preparing public shadow (removing user specific data)
$item['uid'] = 0;
unset($item['id']);
@ -2169,7 +2169,7 @@ class Item extends BaseObject
public static function addShadowPost($itemid)
{
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return;
}
@ -2302,13 +2302,13 @@ class Item extends BaseObject
{
// Unarchive the author
$contact = DBA::selectFirst('contact', [], ['id' => $arr["author-id"]]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
Contact::unmarkForArchival($contact);
}
// Unarchive the contact if it's not our own contact
$contact = DBA::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
Contact::unmarkForArchival($contact);
}
@ -2408,7 +2408,7 @@ class Item extends BaseObject
public static function getGuidById($id)
{
$item = self::selectFirst(['guid'], ['id' => $id]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
return $item['guid'];
} else {
return '';
@ -2430,7 +2430,7 @@ class Item extends BaseObject
INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND `item`.`guid` = ? AND `item`.`uid` = ?", $guid, $uid);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
$id = $item["id"];
$nick = $item["nickname"];
}
@ -2443,7 +2443,7 @@ class Item extends BaseObject
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND NOT `item`.`private` AND `item`.`wall`
AND `item`.`guid` = ?", $guid);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
$id = $item["id"];
$nick = $item["nickname"];
}
@ -2462,7 +2462,7 @@ class Item extends BaseObject
$mention = false;
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
return;
}
@ -2470,7 +2470,7 @@ class Item extends BaseObject
$prvgroup = (($user['page-flags'] == PAGE_PRVGROUP) ? true : false);
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return;
}
@ -2523,7 +2523,7 @@ class Item extends BaseObject
// now change this copy of the post to a forum head message and deliver to all the tgroup members
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $uid, 'self' => true]);
if (!DBA::is_result($self)) {
if (!DBA::isResult($self)) {
return;
}
@ -2581,7 +2581,7 @@ class Item extends BaseObject
if ($contact['remote_self'] == 2) {
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
['uid' => $contact['uid'], 'self' => true]);
if (DBA::is_result($self)) {
if (DBA::isResult($self)) {
$datarray['contact-id'] = $self["id"];
$datarray['owner-name'] = $self["name"];
@ -2675,7 +2675,7 @@ class Item extends BaseObject
$i = substr($i, 0, $x);
$fields = ['data', 'type', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
$photo = DBA::selectFirst('photo', $fields, ['resource-id' => $i, 'scale' => $res, 'uid' => $uid]);
if (DBA::is_result($photo)) {
if (DBA::isResult($photo)) {
/*
* Check to see if we should replace this photo link with an embedded image
* 1. No need to do so if the photo is public
@ -2840,7 +2840,7 @@ class Item extends BaseObject
$items = self::select(['file', 'resource-id', 'starred', 'type', 'id'], $condition);
if (!DBA::is_result($items)) {
if (!DBA::isResult($items)) {
return;
}
@ -2889,7 +2889,7 @@ class Item extends BaseObject
$condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
$params = ['order' => ['created' => false]];
$thread = DBA::selectFirst('thread', ['created'], $condition, $params);
if (DBA::is_result($thread)) {
if (DBA::isResult($thread)) {
return substr(DateTimeFormat::local($thread['created']), 0, 10);
}
return false;
@ -2947,7 +2947,7 @@ class Item extends BaseObject
logger('like: verb ' . $verb . ' item ' . $item_id);
$item = self::selectFirst(self::ITEM_FIELDLIST, ['`id` = ? OR `uri` = ?', $item_id, $item_id]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
logger('like: unknown item ' . $item_id);
return false;
}
@ -2966,7 +2966,7 @@ class Item extends BaseObject
// Retrieves the local post owner
$owner_self_contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'self' => true]);
if (!DBA::is_result($owner_self_contact)) {
if (!DBA::isResult($owner_self_contact)) {
logger('like: unknown owner ' . $uid);
return false;
}
@ -2975,7 +2975,7 @@ class Item extends BaseObject
$author_id = public_contact();
$author_contact = DBA::selectFirst('contact', ['url'], ['id' => $author_id]);
if (!DBA::is_result($author_contact)) {
if (!DBA::isResult($author_contact)) {
logger('like: unknown author ' . $author_id);
return false;
}
@ -2987,7 +2987,7 @@ class Item extends BaseObject
} else {
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
if (!DBA::is_result($item_contact)) {
if (!DBA::isResult($item_contact)) {
logger('like: unknown item contact ' . $item_contact_id);
return false;
}
@ -3014,7 +3014,7 @@ class Item extends BaseObject
$like_item = self::selectFirst(['id', 'guid', 'verb'], $condition);
// If it exists, mark it as deleted
if (DBA::is_result($like_item)) {
if (DBA::isResult($like_item)) {
// Already voted, undo it
$fields = ['deleted' => true, 'unseen' => true, 'changed' => DateTimeFormat::utcNow()];
/// @todo Consider using self::update - but before doing so, check the side effects
@ -3089,7 +3089,7 @@ class Item extends BaseObject
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$item = self::selectFirst($fields, $condition);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return;
}
@ -3110,7 +3110,7 @@ class Item extends BaseObject
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$item = self::selectFirst($fields, $condition);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return;
}
@ -3136,7 +3136,7 @@ class Item extends BaseObject
private static function deleteThread($itemid, $itemuri = "")
{
$item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
logger('No thread found for id '.$itemid, LOGGER_DEBUG);
return;
}

View file

@ -61,7 +61,7 @@ class Mail
dbesc($replyto),
dbesc($replyto)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$convid = $r[0]['convid'];
}
}

View file

@ -49,7 +49,7 @@ class OpenWebAuthToken
$condition = ["type" => $type, "uid" => $uid, "token" => $token];
$entry = DBA::selectFirst("openwebauth-token", ["id", "meta"], $condition);
if (DBA::is_result($entry)) {
if (DBA::isResult($entry)) {
DBA::delete("openwebauth-token", ["id" => $entry["id"]]);
return $entry["meta"];

View file

@ -30,7 +30,7 @@ class PermissionSet extends BaseObject
$set = DBA::selectFirst('permissionset', ['id'], $condition);
if (!DBA::is_result($set)) {
if (!DBA::isResult($set)) {
DBA::insert('permissionset', $condition, true);
$set = DBA::selectFirst('permissionset', ['id'], $condition);

View file

@ -41,7 +41,7 @@ class Photo
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
{
$photo = DBA::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
if (DBA::is_result($photo)) {
if (DBA::isResult($photo)) {
$guid = $photo['guid'];
} else {
$guid = System::createGUID();
@ -72,7 +72,7 @@ class Photo
'desc' => $desc
];
if (DBA::is_result($existing_photo)) {
if (DBA::isResult($existing_photo)) {
$r = DBA::update('photo', $fields, ['id' => $existing_photo['id']]);
} else {
$r = DBA::insert('photo', $fields);

View file

@ -90,7 +90,7 @@ class Profile
{
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
if (!DBA::is_result($user) && empty($profiledata)) {
if (!DBA::isResult($user) && empty($profiledata)) {
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
notice(L10n::t('Requested account is not available.') . EOL);
$a->error = 404;
@ -101,7 +101,7 @@ class Profile
// Add profile data to sidebar
$a->page['aside'] .= self::sidebar($profiledata, true, $show_connect);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
return;
}
}
@ -198,7 +198,7 @@ class Profile
foreach ($_SESSION['remote'] as $visitor) {
if ($visitor['uid'] == $uid) {
$contact = DBA::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$profile_id = $contact['profile-id'];
}
break;
@ -222,7 +222,7 @@ class Profile
intval($profile_id)
);
}
if (!DBA::is_result($profile)) {
if (!DBA::isResult($profile)) {
$profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
@ -374,7 +374,7 @@ class Profile
'entries' => [],
];
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$profile['menu']['entries'][] = [
'photo' => $rr['thumb'],
@ -452,7 +452,7 @@ class Profile
"SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$updated = date('c', strtotime($r[0]['updated']));
}
@ -467,7 +467,7 @@ class Profile
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$contacts = intval($r[0]['total']);
}
}
@ -555,7 +555,7 @@ class Profile
DateTimeFormat::utc('now + 6 days'),
DateTimeFormat::utcNow()
);
if (DBA::is_result($s)) {
if (DBA::isResult($s)) {
$r = DBA::toArray($s);
Cache::set($cachekey, $r, CACHE_HOUR);
}
@ -563,7 +563,7 @@ class Profile
$total = 0;
$classtoday = '';
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$now = strtotime('now');
$cids = [];
@ -657,7 +657,7 @@ class Profile
$r = [];
if (DBA::is_result($s)) {
if (DBA::isResult($s)) {
$istoday = false;
while ($rr = DBA::fetch($s)) {
@ -1026,7 +1026,7 @@ class Profile
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
if (DBA::is_result($contact) && remote_user() && remote_user() == $contact['id']) {
if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
// The visitor is already authenticated.
return;
}

View file

@ -73,7 +73,7 @@ class PushSubscriber
if ($subscribe) {
// if we are just updating an old subscription, keep the
// old values for last_update but reset the push
if (DBA::is_result($subscriber)) {
if (DBA::isResult($subscriber)) {
$last_update = $subscriber['last_update'];
$push_flag = min($subscriber['push'], 1);
} else {
@ -103,7 +103,7 @@ class PushSubscriber
public static function delay($id)
{
$subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
if (!DBA::is_result($subscriber)) {
if (!DBA::isResult($subscriber)) {
return;
}
@ -141,7 +141,7 @@ class PushSubscriber
public static function reset($id, $last_update)
{
$subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
if (!DBA::is_result($subscriber)) {
if (!DBA::isResult($subscriber)) {
return;
}

View file

@ -19,7 +19,7 @@ class Queue
{
logger('queue: requeue item ' . $id);
$queue = DBA::selectFirst('queue', ['retrial'], ['id' => $id]);
if (!DBA::is_result($queue)) {
if (!DBA::isResult($queue)) {
return;
}
@ -60,7 +60,7 @@ class Queue
intval($cid)
);
$was_delayed = DBA::is_result($r);
$was_delayed = DBA::isResult($r);
// We set "term-date" to a current date if the communication has problems.
// If the communication works again we reset this value.
@ -68,7 +68,7 @@ class Queue
$r = q("SELECT `term-date` FROM `contact` WHERE `id` = %d AND `term-date` <= '1000-01-01' LIMIT 1",
intval($cid)
);
$was_delayed = !DBA::is_result($r);
$was_delayed = !DBA::isResult($r);
}
return $was_delayed;
@ -98,7 +98,7 @@ class Queue
intval($cid)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
if ($batch && ($r[0]['total'] > $batch_queue)) {
logger('too many queued items for batch server ' . $cid . ' - discarding message');
return;

View file

@ -58,7 +58,7 @@ class Term
$fields = ['guid', 'uid', 'id', 'edited', 'deleted', 'created', 'received', 'title', 'body', 'parent'];
$message = Item::selectFirst($fields, ['id' => $itemid]);
if (!DBA::is_result($message)) {
if (!DBA::isResult($message)) {
return;
}
@ -166,7 +166,7 @@ class Term
public static function insertFromFileFieldByItemId($itemid, $files)
{
$message = Item::selectFirst(['uid', 'deleted'], ['id' => $itemid]);
if (!DBA::is_result($message)) {
if (!DBA::isResult($message)) {
return;
}

View file

@ -55,7 +55,7 @@ class User
LIMIT 1",
$uid
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
return $r;
@ -70,7 +70,7 @@ class User
public static function getOwnerDataByNick($nick)
{
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nick]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
return false;
}
return self::getOwnerDataById($user['uid']);
@ -98,7 +98,7 @@ class User
$user = DBA::selectFirst('user', ['def_gid'], ['uid' => $uid]);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
$default_group = $user["def_gid"];
}
@ -214,7 +214,7 @@ class User
$user = DBA::selectFirst('user', $fields, $condition);
}
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
throw new Exception(L10n::t('User not found'));
}
}

View file

@ -184,7 +184,7 @@ class Login extends BaseModule
'verified' => true,
]
);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
if ($data->hash != cookie_hash($user)) {
logger("Hash for user " . $data->uid . " doesn't fit.");
nuke_session();
@ -214,7 +214,7 @@ class Login extends BaseModule
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($_SESSION['visitor_id'])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
self::getApp()->contact = $r[0];
}
}
@ -239,7 +239,7 @@ class Login extends BaseModule
'verified' => true,
]
);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
nuke_session();
goaway(self::getApp()->get_baseurl());
}

View file

@ -51,7 +51,7 @@ class Owa extends BaseModule
$contact = DBA::selectFirst('contact', $fields, $condition);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
// Try to verify the signed header with the public key of the contact record
// we have found.
$verified = HTTPSignature::verify('', $contact['pubkey']);

View file

@ -38,7 +38,7 @@ class FKOAuth1 extends OAuthServer
$a = get_app();
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
if (!DBA::is_result($record)) {
if (!DBA::isResult($record)) {
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
@ -60,7 +60,7 @@ class FKOAuth1 extends OAuthServer
}
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$a->contact = $contact;
$a->cid = $contact['id'];
$_SESSION['cid'] = $a->cid;

View file

@ -44,7 +44,7 @@ class FKOAuthDataStore extends OAuthDataStore
$s = DBA::select('clients', ['client_id', 'pw', 'redirect_uri'], ['client_id' => $consumer_key]);
$r = DBA::toArray($s);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
}
@ -64,7 +64,7 @@ class FKOAuthDataStore extends OAuthDataStore
$s = DBA::select('tokens', ['id', 'secret', 'scope', 'expires', 'uid'], ['client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token]);
$r = DBA::toArray($s);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$ot = new OAuthToken($r[0]['id'], $r[0]['secret']);
$ot->scope = $r[0]['scope'];
$ot->expires = $r[0]['expires'];
@ -85,7 +85,7 @@ class FKOAuthDataStore extends OAuthDataStore
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
{
$token = DBA::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
if (DBA::is_result($token)) {
if (DBA::isResult($token)) {
return new OAuthToken($token['id'], $token['secret']);
}

View file

@ -1597,7 +1597,7 @@ class Probe
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
if (DBA::is_result($x) && DBA::is_result($r)) {
if (DBA::isResult($x) && DBA::isResult($r)) {
$mailbox = Email::constructMailboxName($r[0]);
$password = '';
openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);

View file

@ -882,7 +882,7 @@ class Image
intval($uid)
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger("Can't detect user data for uid ".$uid, LOGGER_DEBUG);
return([]);
}

View file

@ -179,7 +179,7 @@ class Post extends BaseObject
/// @todo This shouldn't be done as query here, but better during the data creation.
// it is now done here, since during the RC phase we shouldn't make to intense changes.
$parent = Item::selectFirst(['origin'], ['id' => $item['parent']]);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
$origin = $parent['origin'];
}
}
@ -264,7 +264,7 @@ class Post extends BaseObject
];
$thread = DBA::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
if (DBA::is_result($thread)) {
if (DBA::isResult($thread)) {
$ignore = [
'do' => L10n::t("ignore thread"),
'undo' => L10n::t("unignore thread"),

View file

@ -132,7 +132,7 @@ class DFRN
dbesc($owner_nick)
);
if (! DBA::is_result($r)) {
if (! DBA::isResult($r)) {
logger(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING);
killme();
}
@ -168,7 +168,7 @@ class DFRN
intval($owner_id)
);
if (! DBA::is_result($r)) {
if (! DBA::isResult($r)) {
logger(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING);
killme();
}
@ -277,7 +277,7 @@ class DFRN
/// @TODO This hook can't work anymore
// Addon::callHooks('atom_feed', $atom);
if (!DBA::is_result($items) || $onlyheader) {
if (!DBA::isResult($items) || $onlyheader) {
$atom = trim($doc->saveXML());
Addon::callHooks('atom_feed_end', $atom);
@ -332,7 +332,7 @@ class DFRN
$ret = Item::select(Item::DELIVER_FIELDLIST, $condition);
$items = Item::inArray($ret);
if (!DBA::is_result($items)) {
if (!DBA::isResult($items)) {
killme();
}
@ -598,7 +598,7 @@ class DFRN
WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
intval($owner['uid'])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$hidewall = true;
} else {
$hidewall = false;
@ -657,7 +657,7 @@ class DFRN
WHERE `profile`.`is-default` AND NOT `user`.`hidewall` AND `user`.`uid` = %d",
intval($owner['uid'])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$profile = $r[0];
XML::addElement($doc, $author, "poco:displayName", $profile["name"]);
@ -952,7 +952,7 @@ class DFRN
if (isset($parent_item)) {
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
if (DBA::is_result($conversation)) {
if (DBA::isResult($conversation)) {
if ($conversation['conversation-uri'] != '') {
$conversation_uri = $conversation['conversation-uri'];
}
@ -1076,7 +1076,7 @@ class DFRN
dbesc(normalise_link($mention))
);
if (DBA::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
if (DBA::isResult($r) && ($r[0]["forum"] || $r[0]["prv"])) {
XML::addElement(
$doc,
$entry,
@ -1502,7 +1502,7 @@ class DFRN
dbesc('birthday')
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return;
}
@ -1551,7 +1551,7 @@ class DFRN
$importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET];
$contact_old = DBA::selectFirst('contact', $fields, $condition);
if (DBA::is_result($contact_old)) {
if (DBA::isResult($contact_old)) {
$author["contact-id"] = $contact_old["id"];
$author["network"] = $contact_old["network"];
} else {
@ -1594,7 +1594,7 @@ class DFRN
$author["avatar"] = current($avatarlist);
}
if (DBA::is_result($contact_old) && !$onlyfetch) {
if (DBA::isResult($contact_old) && !$onlyfetch) {
logger("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG);
$poco = ["url" => $contact_old["url"]];
@ -1926,7 +1926,7 @@ class DFRN
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return false;
}
@ -1939,7 +1939,7 @@ class DFRN
dbesc($suggest["name"]),
dbesc($suggest["request"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$fid = $r[0]["id"];
// OK, we do. Do we already have an introduction for this person ?
@ -1956,7 +1956,7 @@ class DFRN
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return false;
}
}
@ -1980,7 +1980,7 @@ class DFRN
* If no record in fcontact is found, below INSERT statement will not
* link an introduction to it.
*/
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
// Database record did not get created. Quietly give up.
killme();
}
@ -2066,7 +2066,7 @@ class DFRN
intval($importer["importer_uid"])
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger("Query failed to execute, no result returned in " . __FUNCTION__);
return false;
}
@ -2164,7 +2164,7 @@ class DFRN
$is_a_remote_action = false;
$parent = Item::selectFirst(['parent-uri'], ['uri' => $item["parent-uri"]]);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
$r = q(
"SELECT `item`.`forum_mode`, `item`.`wall` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
@ -2177,7 +2177,7 @@ class DFRN
dbesc($parent["parent-uri"]),
intval($importer["importer_uid"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$is_a_remote_action = true;
}
}
@ -2336,7 +2336,7 @@ class DFRN
if ($xt->type == ACTIVITY_OBJ_NOTE) {
$item_tag = Item::selectFirst(['id', 'tag'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]);
if (!DBA::is_result($item_tag)) {
if (!DBA::isResult($item_tag)) {
logger("Query failed to execute, no result returned in " . __FUNCTION__);
return false;
}
@ -2427,7 +2427,7 @@ class DFRN
['uri' => $item["uri"], 'uid' => $importer["importer_uid"]]
);
// Is there an existing item?
if (DBA::is_result($current) && !self::isEditedTimestampNewer($current, $item)) {
if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) {
logger("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
return;
}
@ -2648,7 +2648,7 @@ class DFRN
dbesc($item["uri"]),
intval($importer["importer_uid"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$ev["id"] = $r[0]["id"];
}
@ -2672,7 +2672,7 @@ class DFRN
// Update content if 'updated' changes
if (DBA::is_result($current)) {
if (DBA::isResult($current)) {
if (self::updateContent($current, $item, $importer, $entrytype)) {
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
} else {
@ -2764,7 +2764,7 @@ class DFRN
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
return;
}
@ -2957,7 +2957,7 @@ class DFRN
dbesc($baseurl),
dbesc($nurl)
);
if ((! DBA::is_result($r)) || $r[0]['id'] == remote_user()) {
if ((! DBA::isResult($r)) || $r[0]['id'] == remote_user()) {
return;
}
@ -2968,7 +2968,7 @@ class DFRN
intval(local_user()),
dbesc($baseurl)
);
if (! DBA::is_result($r)) {
if (! DBA::isResult($r)) {
return;
}
@ -3035,7 +3035,7 @@ class DFRN
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if (!DBA::is_result($u)) {
if (!DBA::isResult($u)) {
return false;
}

View file

@ -70,7 +70,7 @@ class Diaspora
if (Config::get("system", "relay_directly", false)) {
// We distribute our stuff based on the parent to ensure that the thread will be complete
$parent = Item::selectFirst(['parent'], ['id' => $item_id]);
if (!DBA::is_result($parent)) {
if (!DBA::isResult($parent)) {
return;
}
@ -147,7 +147,7 @@ class Diaspora
'contact-type' => ACCOUNT_TYPE_RELAY];
$contact = DBA::selectFirst('contact', $fields, $condition);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
if ($contact['archive'] || $contact['blocked']) {
return false;
}
@ -156,7 +156,7 @@ class Diaspora
self::setRelayContact($server_url);
$contact = DBA::selectFirst('contact', $fields, $condition);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
return $contact;
}
}
@ -899,7 +899,7 @@ class Diaspora
$update = false;
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
if (DBA::is_result($person)) {
if (DBA::isResult($person)) {
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
// update record occasionally so it doesn't get stale
@ -913,7 +913,7 @@ class Diaspora
}
}
if (!DBA::is_result($person) || $update) {
if (!DBA::isResult($person) || $update) {
logger("create or refresh", LOGGER_DEBUG);
$r = Probe::uri($handle, NETWORK_DIASPORA);
@ -924,7 +924,7 @@ class Diaspora
// Fetch the updated or added contact
$person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
if (!DBA::is_result($person)) {
if (!DBA::isResult($person)) {
$person = $r;
}
}
@ -973,7 +973,7 @@ class Diaspora
intval($pcontact_id)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return strtolower($r[0]["addr"]);
}
}
@ -983,7 +983,7 @@ class Diaspora
intval($contact_id)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$contact = $r[0];
logger("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
@ -1020,7 +1020,7 @@ class Diaspora
dbesc($fcontact_guid)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $r[0]['url'];
}
@ -1052,7 +1052,7 @@ class Diaspora
}
$contact = dba::selectFirst('contact', [], ['id' => $cid]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
// This here shouldn't happen at all
logger("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
return false;
@ -1153,7 +1153,7 @@ class Diaspora
private static function messageExists($uid, $guid)
{
$item = Item::selectFirst(['id'], ['uid' => $uid, 'guid' => $guid]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
logger("message ".$guid." already exists for user ".$uid);
return $item["id"];
}
@ -1373,7 +1373,7 @@ class Diaspora
$condition = ['uid' => $uid, 'guid' => $guid];
$item = Item::selectFirst($fields, $condition);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
$result = self::storeByGuid($guid, $contact["url"], $uid);
if (!$result) {
@ -1388,7 +1388,7 @@ class Diaspora
}
}
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
logger("parent item not found: parent: ".$guid." - user: ".$uid);
return false;
} else {
@ -1412,7 +1412,7 @@ class Diaspora
{
$condition = ['nurl' => normalise_link($person["url"]), 'uid' => $uid];
$contact = DBA::selectFirst('contact', ['id', 'network'], $condition);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$cid = $contact["id"];
$network = $contact["network"];
} else {
@ -1568,7 +1568,7 @@ class Diaspora
private static function getUriFromGuid($author, $guid, $onlyfound = false)
{
$item = Item::selectFirst(['uri'], ['guid' => $guid]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
return $item["uri"];
} elseif (!$onlyfound) {
$contact = Contact::getDetailsByAddr($author, 0);
@ -1598,7 +1598,7 @@ class Diaspora
private static function getGuidFromUri($uri, $uid)
{
$item = Item::selectFirst(['guid'], ['uri' => $uri, 'uid' => $uid]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
return $item["guid"];
} else {
return false;
@ -1615,10 +1615,10 @@ class Diaspora
private static function importerForGuid($guid)
{
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
return $contact;
}
}
@ -1790,7 +1790,7 @@ class Diaspora
dbesc($msg_guid),
intval($importer["uid"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
logger("duplicate message already delivered.", LOGGER_DEBUG);
return false;
}
@ -2077,7 +2077,7 @@ class Diaspora
dbesc($guid),
intval($importer["uid"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
logger("duplicate message already delivered.", LOGGER_DEBUG);
return false;
}
@ -2133,7 +2133,7 @@ class Diaspora
}
$item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => false]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
logger('Item not found, no origin or private: '.$parent_guid);
return false;
}
@ -2517,7 +2517,7 @@ class Diaspora
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
$item = Item::selectFirst($fields, $condition);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
logger("reshared message ".$guid." already exists on system.");
// Maybe it is already a reshared item?
@ -2539,7 +2539,7 @@ class Diaspora
}
}
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
if (empty($orig_author)) {
logger('Empty author for guid ' . $guid . '. Quitting.');
return false;
@ -2561,7 +2561,7 @@ class Diaspora
$condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
$item = Item::selectFirst($fields, $condition);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
// If it is a reshared post from another network then reformat to avoid display problems with two share elements
if (self::isReshare($item["body"], false)) {
$item["body"] = Markdown::toBBCode(BBCode::toMarkdown($item["body"]));
@ -2703,7 +2703,7 @@ class Diaspora
}
$r = Item::select($fields, $condition);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger("Target guid ".$target_guid." was not found on this system for user ".$importer['uid'].".");
return false;
}
@ -3356,7 +3356,7 @@ class Diaspora
if (($guid != "") && $complete) {
$condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
$item = Item::selectFirst(['contact-id'], $condition);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
$ret= [];
$ret["root_handle"] = self::handleFromContact($item["contact-id"]);
$ret["root_guid"] = $guid;
@ -3409,7 +3409,7 @@ class Diaspora
private static function buildEvent($event_id)
{
$r = q("SELECT `guid`, `uid`, `start`, `finish`, `nofinish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return [];
}
@ -3418,14 +3418,14 @@ class Diaspora
$eventdata = [];
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d", intval($event['uid']));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return [];
}
$user = $r[0];
$r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid']));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return [];
}
@ -3623,7 +3623,7 @@ class Diaspora
private static function constructLike(array $item, array $owner)
{
$parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]);
if (!DBA::is_result($parent)) {
if (!DBA::isResult($parent)) {
return false;
}
@ -3654,7 +3654,7 @@ class Diaspora
private static function constructAttend(array $item, array $owner)
{
$parent = Item::selectFirst(['guid', 'uri', 'parent-uri'], ['uri' => $item["thr-parent"]]);
if (!DBA::is_result($parent)) {
if (!DBA::isResult($parent)) {
return false;
}
@ -3698,7 +3698,7 @@ class Diaspora
}
$parent = Item::selectFirst(['guid'], ['id' => $item["parent"], 'parent' => $item["parent"]]);
if (!DBA::is_result($parent)) {
if (!DBA::isResult($parent)) {
return false;
}
@ -3924,7 +3924,7 @@ class Diaspora
intval($item["uid"])
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger("conversation not found.");
return;
}
@ -4164,14 +4164,14 @@ class Diaspora
}
$r = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($contact['uid']));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
$contact["uprvkey"] = $r[0]['prvkey'];
$item = Item::selectFirst([], ['id' => $post_id]);
if (!DBA::is_result($item)) {
if (!DBA::isResult($item)) {
return false;
}

View file

@ -246,7 +246,7 @@ class Feed {
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
$importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
$previous = Item::selectFirst(['id'], $condition);
if (DBA::is_result($previous)) {
if (DBA::isResult($previous)) {
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
continue;
}

View file

@ -80,7 +80,7 @@ class OStatus
$contact = DBA::selectFirst('contact', [], $condition);
}
if (!DBA::is_result($contact) && $author["author-link"] != '') {
if (!DBA::isResult($contact) && $author["author-link"] != '') {
if ($aliaslink == "") {
$aliaslink = $author["author-link"];
}
@ -91,14 +91,14 @@ class OStatus
$contact = DBA::selectFirst('contact', [], $condition);
}
if (!DBA::is_result($contact) && ($addr != '')) {
if (!DBA::isResult($contact) && ($addr != '')) {
$condition = ["`uid` = ? AND `addr` = ? AND `network` != ? AND `rel` IN (?, ?)",
$importer["uid"], $addr, NETWORK_STATUSNET,
CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
$contact = DBA::selectFirst('contact', [], $condition);
}
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
if ($contact['blocked']) {
$contact['id'] = -1;
}
@ -135,7 +135,7 @@ class OStatus
$author["owner-id"] = $author["author-id"];
// Only update the contacts if it is an OStatus contact
if (DBA::is_result($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
if (DBA::isResult($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
// Update contact data
$current = $contact;
@ -896,7 +896,7 @@ class OStatus
{
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
$conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition);
if (DBA::is_result($conversation)) {
if (DBA::isResult($conversation)) {
$stored = true;
$xml = $conversation['source'];
if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
@ -976,7 +976,7 @@ class OStatus
if ($xml == '') {
$condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
if (DBA::is_result($conversation)) {
if (DBA::isResult($conversation)) {
$stored = true;
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
$xml = $conversation['source'];
@ -1452,7 +1452,7 @@ class OStatus
}
}
if (DBA::is_result($profile) && !$show_profile) {
if (DBA::isResult($profile) && !$show_profile) {
if (trim($profile["homepage"]) != "") {
$urls = $doc->createElement("poco:urls");
XML::addElement($doc, $urls, "poco:type", "homepage");
@ -1576,24 +1576,24 @@ class OStatus
dbesc(normalise_link($url)),
intval($owner["uid"])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$contact = $r[0];
$contact["uid"] = -1;
}
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$r = q(
"SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($url))
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$contact = $r[0];
$contact["uid"] = -1;
$contact["success_update"] = $contact["updated"];
}
}
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
$contact = owner;
}
@ -1635,7 +1635,7 @@ class OStatus
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]];
$repeated_item = Item::selectFirst([], $condition);
if (!DBA::is_result($repeated_item)) {
if (!DBA::isResult($repeated_item)) {
return false;
}
@ -1793,7 +1793,7 @@ class OStatus
dbesc(normalise_link($contact["url"]))
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
$connect_id = $r[0]['id'];
} else {
$connect_id = 0;
@ -1962,7 +1962,7 @@ class OStatus
$thrparent = Item::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner["uid"], 'uri' => $parent_item]);
if (DBA::is_result($thrparent)) {
if (DBA::isResult($thrparent)) {
$mentioned[$thrparent["author-link"]] = $thrparent["author-link"];
$mentioned[$thrparent["owner-link"]] = $thrparent["owner-link"];
$parent_plink = $thrparent["plink"];
@ -1989,7 +1989,7 @@ class OStatus
if (isset($parent_item)) {
$conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $parent_item]);
if (DBA::is_result($conversation)) {
if (DBA::isResult($conversation)) {
if ($conversation['conversation-uri'] != '') {
$conversation_uri = $conversation['conversation-uri'];
}

View file

@ -67,7 +67,7 @@ class PortableContact
if ($cid) {
if (!$url || !$uid) {
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
$url = $contact['poco'];
$uid = $contact['uid'];
}
@ -284,7 +284,7 @@ class PortableContact
dbesc(normalise_link($server_url))
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
return $server_url;
}
@ -309,7 +309,7 @@ class PortableContact
dbesc(normalise_link($profile))
);
if (!DBA::is_result($gcontacts)) {
if (!DBA::isResult($gcontacts)) {
return false;
}
@ -930,7 +930,7 @@ class PortableContact
}
$gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
if (DBA::is_result($gserver)) {
if (DBA::isResult($gserver)) {
if ($gserver["created"] <= NULL_DATE) {
$fields = ['created' => DateTimeFormat::utcNow()];
$condition = ['nurl' => normalise_link($server_url)];
@ -1001,7 +1001,7 @@ class PortableContact
// Quit if there is a timeout.
// But we want to make sure to only quit if we are mostly sure that this server url fits.
if (DBA::is_result($gserver) && ($orig_server_url == $server_url) &&
if (DBA::isResult($gserver) && ($orig_server_url == $server_url) &&
(!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
@ -1420,7 +1420,7 @@ class PortableContact
}
$gserver = DBA::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
if (!DBA::is_result($gserver)) {
if (!DBA::isResult($gserver)) {
return;
}
@ -1482,7 +1482,7 @@ class PortableContact
dbesc(NETWORK_OSTATUS)
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
@ -1510,7 +1510,7 @@ class PortableContact
$server_url = str_replace("/index.php", "", $server->url);
$r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger("Call server check for server ".$server_url, LOGGER_DEBUG);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url);
}
@ -1579,7 +1579,7 @@ class PortableContact
public static function discoverSingleServer($id)
{
$r = q("SELECT `poco`, `nurl`, `url`, `network` FROM `gserver` WHERE `id` = %d", intval($id));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return false;
}
@ -1655,7 +1655,7 @@ class PortableContact
$last_update = date("c", time() - (60 * 60 * 24 * $requery_days));
$r = q("SELECT `id`, `url`, `nurl`, `network` FROM `gserver` WHERE `last_contact` >= `last_failure` AND `poco` != '' AND `last_poco_query` < '%s' ORDER BY RAND()", dbesc($last_update));
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $server) {
if (!self::checkServer($server["url"], $server["network"])) {
// The server is not reachable? Okay, then we will try it later

View file

@ -225,7 +225,7 @@ class ExAuth
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
$aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
if (DBA::is_result($aUser)) {
if (DBA::isResult($aUser)) {
$uid = $aUser['uid'];
$success = User::authenticate($aUser, $aCommand[3]);
$Error = $success === false;

View file

@ -183,7 +183,7 @@ class HTTPSignature
$contact = DBA::selectFirst('contact', ['pubkey'], ['id' => $id, 'network' => 'activitypub']);
}
if (DBA::is_result($contact)) {
if (DBA::isResult($contact)) {
return $contact['pubkey'];
}

View file

@ -194,7 +194,7 @@ class Cron
dbesc(NETWORK_MAIL)
);
if (!DBA::is_result($contacts)) {
if (!DBA::isResult($contacts)) {
return;
}

View file

@ -92,7 +92,7 @@ class CronJobs
private static function updatePhotoAlbums()
{
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -230,7 +230,7 @@ class CronJobs
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -265,7 +265,7 @@ class CronJobs
// Sometimes there seem to be issues where the "self" contact vanishes.
// We haven't found the origin of the problem by now.
$r = q("SELECT `uid` FROM `user` WHERE NOT EXISTS (SELECT `uid` FROM `contact` WHERE `contact`.`uid` = `user`.`uid` AND `contact`.`self`)");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r AS $user) {
logger('Create missing self contact for user ' . $user['uid']);
Contact::createSelfFromUserId($user['uid']);
@ -281,7 +281,7 @@ class CronJobs
// Update the global contacts for local users
$r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r AS $user) {
GContact::updateForUser($user["uid"]);
}

View file

@ -39,14 +39,14 @@ class Delivery extends BaseObject
if ($cmd == self::MAIL) {
$target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
if (!DBA::is_result($target_item)) {
if (!DBA::isResult($target_item)) {
return;
}
$uid = $target_item['uid'];
$items = [];
} elseif ($cmd == self::SUGGESTION) {
$target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
if (!DBA::is_result($target_item)) {
if (!DBA::isResult($target_item)) {
return;
}
$uid = $target_item['uid'];
@ -54,7 +54,7 @@ class Delivery extends BaseObject
$uid = $item_id;
} else {
$item = Item::selectFirst(['parent'], ['id' => $item_id]);
if (!DBA::is_result($item) || empty($item['parent'])) {
if (!DBA::isResult($item) || empty($item['parent'])) {
return;
}
$parent_id = intval($item['parent']);
@ -132,7 +132,7 @@ class Delivery extends BaseObject
}
$owner = User::getOwnerDataById($uid);
if (!DBA::is_result($owner)) {
if (!DBA::isResult($owner)) {
return;
}
@ -140,7 +140,7 @@ class Delivery extends BaseObject
$contact = DBA::selectFirst('contact', [],
['id' => $contact_id, 'blocked' => false, 'pending' => false, 'self' => false]
);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
return;
}
@ -237,7 +237,7 @@ class Delivery extends BaseObject
if (link_compare($basepath, System::baseUrl())) {
$condition = ['nurl' => normalise_link($contact['url']), 'self' => true];
$target_self = DBA::selectFirst('contact', ['uid'], $condition);
if (!DBA::is_result($target_self)) {
if (!DBA::isResult($target_self)) {
return;
}
$target_uid = $target_self['uid'];
@ -259,7 +259,7 @@ class Delivery extends BaseObject
$cid);
// This should never fail
if (!DBA::is_result($target_importer)) {
if (!DBA::isResult($target_importer)) {
return;
}
@ -404,7 +404,7 @@ class Delivery extends BaseObject
}
$local_user = DBA::selectFirst('user', [], ['uid' => $owner['uid']]);
if (!DBA::is_result($local_user)) {
if (!DBA::isResult($local_user)) {
return;
}
@ -412,7 +412,7 @@ class Delivery extends BaseObject
$reply_to = '';
$mailacct = DBA::selectFirst('mailacct', ['reply_to'], ['uid' => $owner['uid']]);
if (DBA::is_result($mailacct) && !empty($mailacct['reply_to'])) {
if (DBA::isResult($mailacct) && !empty($mailacct['reply_to'])) {
$reply_to = $mailacct['reply_to'];
}
@ -445,12 +445,12 @@ class Delivery extends BaseObject
if (empty($target_item['title'])) {
$condition = ['uri' => $target_item['parent-uri'], 'uid' => $owner['uid']];
$title = Item::selectFirst(['title'], $condition);
if (DBA::is_result($title) && ($title['title'] != '')) {
if (DBA::isResult($title) && ($title['title'] != '')) {
$subject = $title['title'];
} else {
$condition = ['parent-uri' => $target_item['parent-uri'], 'uid' => $owner['uid']];
$title = Item::selectFirst(['title'], $condition);
if (DBA::is_result($title) && ($title['title'] != '')) {
if (DBA::isResult($title) && ($title['title'] != '')) {
$subject = $title['title'];
}
}

View file

@ -48,7 +48,7 @@ class Directory
WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
NOT `user`.`account_expired` AND `user`.`verified`");
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r AS $user) {
Worker::add(PRIORITY_LOW, 'Directory', $user['url']);
}

View file

@ -118,7 +118,7 @@ class DiscoverPoCo
private static function updateServer() {
$r = q("SELECT `url`, `created`, `last_failure`, `last_contact` FROM `gserver` ORDER BY rand()");
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}
@ -224,7 +224,7 @@ class DiscoverPoCo
foreach ($j->results as $jj) {
// Check if the contact already exists
$exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
if (DBA::is_result($exists)) {
if (DBA::isResult($exists)) {
logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&

View file

@ -67,7 +67,7 @@ class Expire
return;
} elseif (intval($param) > 0) {
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
if (DBA::is_result($user)) {
if (DBA::isResult($user)) {
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
Item::expire($user['uid'], $user['expire']);
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);

View file

@ -25,7 +25,7 @@ class GProbe {
logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
// Is it a DDoS attempt?
$urlparts = parse_url($url);
@ -52,7 +52,7 @@ class GProbe {
dbesc(normalise_link($url))
);
}
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
// Check for accessibility and do a poco discovery
if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) {
PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));

View file

@ -65,7 +65,7 @@ class Notifier
if ($cmd == Delivery::MAIL) {
$normal_mode = false;
$message = DBA::selectFirst('mail', ['uid', 'contact-id'], ['id' => $item_id]);
if (!DBA::is_result($message)) {
if (!DBA::isResult($message)) {
return;
}
$uid = $message['uid'];
@ -73,7 +73,7 @@ class Notifier
} elseif ($cmd == Delivery::SUGGESTION) {
$normal_mode = false;
$suggest = DBA::selectFirst('fsuggest', ['uid', 'cid'], ['id' => $item_id]);
if (!DBA::is_result($suggest)) {
if (!DBA::isResult($suggest)) {
return;
}
$uid = $suggest['uid'];
@ -109,7 +109,7 @@ class Notifier
$condition = ['id' => $item_id, 'visible' => true, 'moderated' => false];
$target_item = Item::selectFirst([], $condition);
if (!DBA::is_result($target_item) || !intval($target_item['parent'])) {
if (!DBA::isResult($target_item) || !intval($target_item['parent'])) {
return;
}
@ -121,7 +121,7 @@ class Notifier
$params = ['order' => ['id']];
$ret = Item::select([], $condition, $params);
if (!DBA::is_result($ret)) {
if (!DBA::isResult($ret)) {
return;
}
@ -223,7 +223,7 @@ class Notifier
$fields = ['forum', 'prv'];
$condition = ['id' => $target_item['contact-id']];
$contact = DBA::selectFirst('contact', $fields, $condition);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
// Should never happen
return false;
}
@ -260,7 +260,7 @@ class Notifier
intval($uid),
dbesc(NETWORK_DFRN)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$recipients_followup[] = $rr['id'];
}
@ -343,14 +343,14 @@ class Notifier
// Send a salmon to the parent author
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) {
if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) {
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
// Send a salmon to the parent owner
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
if (DBA::is_result($probed_contact) && !empty($probed_contact["notify"])) {
if (DBA::isResult($probed_contact) && !empty($probed_contact["notify"])) {
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
@ -387,7 +387,7 @@ class Notifier
intval($uid),
dbesc(NETWORK_MAIL)
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$recipients[] = $rr['id'];
}
@ -411,7 +411,7 @@ class Notifier
}
// delivery loop
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $contact) {
logger("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
@ -461,7 +461,7 @@ class Notifier
$r = array_merge($r2, $r1);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
foreach ($r as $rr) {

View file

@ -47,7 +47,7 @@ class OnePoll
$d = DateTimeFormat::utcNow();
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
logger('Contact not found or cannot be used.');
return;
}
@ -60,7 +60,7 @@ class OnePoll
WHERE `cid` = %d AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['id'])
);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
if (!$r[0]['total']) {
PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
}
@ -145,7 +145,7 @@ class OnePoll
intval($importer_uid)
);
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
logger('No self contact for user '.$importer_uid);
// set the last-update so we don't keep polling
@ -348,7 +348,7 @@ class OnePoll
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
$mailconf = DBA::selectFirst('mailacct', [], $condition);
if (DBA::is_result($user) && DBA::is_result($mailconf)) {
if (DBA::isResult($user) && DBA::isResult($mailconf)) {
$mailbox = Email::constructMailboxName($mailconf);
$password = '';
openssl_private_decrypt(hex2bin($mailconf['pass']), $password, $user['prvkey']);
@ -391,7 +391,7 @@ class OnePoll
$fields = ['deleted', 'id'];
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
$item = Item::selectFirst($fields, $condition);
if (DBA::is_result($item)) {
if (DBA::isResult($item)) {
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
// Only delete when mails aren't automatically moved or deleted
@ -441,7 +441,7 @@ class OnePoll
}
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
$parent = Item::selectFirst(['parent-uri'], $condition);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item
}
}
@ -474,7 +474,7 @@ class OnePoll
$condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => NETWORK_MAIL];
$params = ['order' => ['created' => true]];
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
if (DBA::is_result($parent)) {
if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri'];
}
}

View file

@ -30,7 +30,7 @@ class PubSubPublish
$a = BaseObject::getApp();
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
if (!DBA::is_result($subscriber)) {
if (!DBA::isResult($subscriber)) {
return;
}

View file

@ -39,7 +39,7 @@ class Queue
Addon::callHooks('queue_predeliver', $r);
if (DBA::is_result($r)) {
if (DBA::isResult($r)) {
foreach ($r as $q_item) {
logger('Call queue for id ' . $q_item['id']);
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "Queue", (int) $q_item['id']);
@ -52,12 +52,12 @@ class Queue
// delivering
$q_item = DBA::selectFirst('queue', [], ['id' => $queue_id]);
if (!DBA::is_result($q_item)) {
if (!DBA::isResult($q_item)) {
return;
}
$contact = DBA::selectFirst('contact', [], ['id' => $q_item['cid']]);
if (!DBA::is_result($contact)) {
if (!DBA::isResult($contact)) {
QueueModel::removeItem($q_item['id']);
return;
}
@ -97,7 +97,7 @@ class Queue
}
$user = DBA::selectFirst('user', [], ['uid' => $contact['uid']]);
if (!DBA::is_result($user)) {
if (!DBA::isResult($user)) {
QueueModel::removeItem($q_item['id']);
return;
}

View file

@ -24,7 +24,7 @@ class UpdateGContact
$r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id));
if (!DBA::is_result($r)) {
if (!DBA::isResult($r)) {
return;
}