more pending ...
Also put SQL table columns into back-ticks.
Signed-off-by: Roland Häder <roland@mxchange.org>
dbesc(normalise_link($url)), intval($uid));
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
- if (!$r)
+ if (!dbm::is_result($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 `nurl` = '%s' AND `uid` = 0",
dbesc(normalise_link($url)));
// Fetch the data from the gcontact table
- if (!$r)
+ if (!dbm::is_result($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 `nurl` = '%s'",
intval($gid),
dbesc($name));
// error message if specified gid is not in database
- if (count($rname) == 0)
+ if (!dbm::is_result($rname))
throw new BadRequestException('wrong group name');
// delete group
intval($uid),
dbesc($name));
// error message if specified group name already exists
- if (count($rname) != 0)
+ if (dbm::is_result($rname))
throw new BadRequestException('group name already exists');
// check if specified group name is a deleted group
intval($uid),
dbesc($name));
// error message if specified group name already exists
- if (count($rname) != 0)
+ if (dbm::is_result($rname))
$reactivate_group = true;
// create group
intval($c['id'])
);
- if((! $res) || (! count($res)))
+ if (dbm::is_result($res))
continue;
foreach($res as $contact) {
// in it.
if (!$deleted AND !$dontcache) {
- $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
- if (count($r) == 1) {
+ $r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
+ if ((dbm::is_result($r)) && (count($r) == 1)) {
if ($notify)
call_hooks('post_local_end', $r[0]);
else
$ret = list_post_dates($uid,$wall);
- if (! count($ret))
+ if (! dbm::is_result($ret))
return $o;
$cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
);
$got_lock = true;
}
- elseif(! dbm::is_result($r)) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
+ elseif(! dbm::is_result($r)) {
+ /// @TODO the Boolean value for count($r) should be equivalent to the Boolean value of $r
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
dbesc($fn_name),
dbesc(datetime_convert())
*/
function plugin_enabled($plugin) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
- return((bool)(count($r) > 0));
+ return ((dbm::is_result($r)) && (count($r) > 0));
}
// The processlist only shows entries of the current user
if ($max != 0) {
$r = q("SHOW PROCESSLIST");
- if (!$r)
+ if (!dbm::is_result($r))
return false;
$used = count($r);
proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
}
- if ((count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
+ if ((dbm::is_result($r)) AND (count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d",
dbesc(normalise_link($contact["url"])),
intval($gcontact_id));
WHERE `nickname` = '%s' ",
dbesc($nickname)
);
- if((count($r) > 1) && $newuid) {
+ if ((dbm::is_result($r)) && (count($r) > 1) && $newuid) {
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
q("DELETE FROM `user` WHERE `uid` = %d",
intval($newuid)
intval(local_user()),
intval($a->argv[2])
);
- if(! count($r1)) {
+ if(! dbm::is_result($r1)) {
notice( t('Profile unavailable to clone.') . EOL);
killme();
return;
dbesc($name)
);
info( t('New profile created.') . EOL);
- if(count($r3) == 1)
+ if ((dbm::is_result($r3)) && (count($r3) == 1))
goaway('profiles/'.$r3[0]['id']);
goaway('profiles');
);
- if(! count($register))
+ if(! dbm::is_result($register))
return false;
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($register[0]['uid'])
);
- if(! count($user))
+ if(! dbm::is_result($user))
killme();
$r = q("DELETE FROM `register` WHERE `hash` = '%s'",
dbesc($hash)
);
- if(! count($register))
+ if(! dbm::is_result($register))
return false;
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",