Continued rewriting:

- use dba::is_result() everywhere (where I found the old, bad way)
- converted some spaces -> tabs for code
- converted some CRLF -> LF as mixures of both is not good

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-05-01 14:24:44 +02:00
parent 56a2bbc740
commit 3e701b90ac
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
93 changed files with 451 additions and 450 deletions

View file

@ -368,7 +368,7 @@ function random_profile() {
ORDER BY rand() LIMIT 1", ORDER BY rand() LIMIT 1",
dbesc(NETWORK_DFRN)); dbesc(NETWORK_DFRN));
if(count($r)) if(dba::is_result($r))
return dirname($r[0]['url']); return dirname($r[0]['url']);
return ''; return '';
} }

View file

@ -589,7 +589,7 @@ class Photo {
$r = q("select `guid` from photo where `resource-id` = '%s' and `guid` != '' limit 1", $r = q("select `guid` from photo where `resource-id` = '%s' and `guid` != '' limit 1",
dbesc($rid) dbesc($rid)
); );
if(count($r)) if(dba::is_result($r))
$guid = $r[0]['guid']; $guid = $r[0]['guid'];
else else
$guid = get_guid(); $guid = get_guid();

View file

@ -33,7 +33,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
call_hooks($a->module . '_pre_' . $selname, $arr); call_hooks($a->module . '_pre_' . $selname, $arr);
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
@ -144,7 +144,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
call_hooks($a->module . '_pre_' . $selname, $arr); call_hooks($a->module . '_pre_' . $selname, $arr);
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
@ -220,7 +220,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$receiverlist = array(); $receiverlist = array();
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
@ -314,7 +314,7 @@ function populate_acl($user = null, $show_jotnets = false) {
$r = q("SELECT `pubmail` FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT `pubmail` FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$mail_enabled = true; $mail_enabled = true;
if(intval($r[0]['pubmail'])) if(intval($r[0]['pubmail']))
$pubmail_enabled = true; $pubmail_enabled = true;
@ -577,7 +577,7 @@ function acl_lookup(&$a, $out_type = 'json') {
$r = array(); $r = array();
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $g){ foreach($r as $g){
$contacts[] = array( $contacts[] = array(
"type" => "c", "type" => "c",

View file

@ -207,7 +207,7 @@
dbesc(trim($user)), dbesc(trim($user)),
dbesc($encrypted) dbesc($encrypted)
); );
if(count($r)) if(dba::is_result($r))
$record = $r[0]; $record = $r[0];
} }
@ -1249,7 +1249,7 @@
if (!count($r)) if (!count($r))
$r = q("SELECT `id` FROM `gcontact` WHERE `nick`='%s'", dbesc($_GET["q"])); $r = q("SELECT `id` FROM `gcontact` WHERE `nick`='%s'", dbesc($_GET["q"]));
if (count($r)) { if (dba::is_result($r)) {
foreach ($r AS $user) { foreach ($r AS $user) {
$user_info = api_get_user($a, $user["id"]); $user_info = api_get_user($a, $user["id"]);
//echo print_r($user_info, true)."\n"; //echo print_r($user_info, true)."\n";

View file

@ -50,7 +50,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params'
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($_SESSION['visitor_id']) intval($_SESSION['visitor_id'])
); );
if (count($r)) { if (dba::is_result($r)) {
$a->contact = $r[0]; $a->contact = $r[0];
} }
} }
@ -169,7 +169,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params'
dbesc(trim($_POST['username'])), dbesc(trim($_POST['username'])),
dbesc($encrypted) dbesc($encrypted)
); );
if (count($r)) if (dba::is_result($r))
$record = $r[0]; $record = $r[0];
} }

View file

@ -10,7 +10,7 @@
dbesc($key) dbesc($key)
); );
if (count($r)) if (dba::is_result($r))
return $r[0]['v']; return $r[0]['v'];
return null; return null;
@ -38,7 +38,7 @@
* $r = q("SELECT * FROM `cache` WHERE `k`='%s' limit 1", * $r = q("SELECT * FROM `cache` WHERE `k`='%s' limit 1",
* dbesc($key) * dbesc($key)
* ); * );
* if(count($r)) { * if(dba::is_result($r)) {
* q("UPDATE `cache` SET `v` = '%s', `updated = '%s' WHERE `k` = '%s'", * q("UPDATE `cache` SET `v` = '%s', `updated = '%s' WHERE `k` = '%s'",
* dbesc($value), * dbesc($value),
* dbesc(datetime_convert()), * dbesc(datetime_convert()),

View file

@ -20,7 +20,7 @@ function load_config($family) {
global $a; global $a;
$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family)); $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family));
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$k = $rr['k']; $k = $rr['k'];
if ($family === 'config') { if ($family === 'config') {
@ -174,7 +174,7 @@ function load_pconfig($uid,$family) {
dbesc($family), dbesc($family),
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$k = $rr['k']; $k = $rr['k'];
$a->config[$uid][$family][$k] = $rr['v']; $a->config[$uid][$family][$k] = $rr['v'];

View file

@ -12,7 +12,7 @@ function contact_profile_assign($current,$foreign_net) {
$r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d", $r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$selected = (($rr['id'] == $current) ? " selected=\"selected\" " : ""); $selected = (($rr['id'] == $current) ? " selected=\"selected\" " : "");
$o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n"; $o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";

View file

@ -93,7 +93,7 @@ function networks_widget($baseurl,$selected = '') {
); );
$nets = array(); $nets = array();
if(count($r)) { if(dba::is_result($r)) {
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
foreach($r as $rr) { foreach($r as $rr) {
if($rr['network']) if($rr['network'])
@ -204,13 +204,13 @@ function common_friends_visitor_widget($profile_uid) {
dbesc(normalise_link(get_my_url())), dbesc(normalise_link(get_my_url())),
intval($profile_uid) intval($profile_uid)
); );
if(count($r)) if(dba::is_result($r))
$cid = $r[0]['id']; $cid = $r[0]['id'];
else { else {
$r = q("select id from gcontact where nurl = '%s' limit 1", $r = q("select id from gcontact where nurl = '%s' limit 1",
dbesc(normalise_link(get_my_url())) dbesc(normalise_link(get_my_url()))
); );
if(count($r)) if(dba::is_result($r))
$zcid = $r[0]['id']; $zcid = $r[0]['id'];
} }
} }

View file

@ -544,7 +544,7 @@ function update_contact_birthdays() {
// In-network birthdays are handled within local_delivery // In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` "); $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']); logger('update_contact_birthday: ' . $rr['bd']);

View file

@ -236,7 +236,7 @@ class dba {
* @param $array mixed A filled array with at least one entry * @param $array mixed A filled array with at least one entry
* @return Whether $array is a filled array * @return Whether $array is a filled array
*/ */
public function is_result ($array) { public static function is_result ($array) {
return (is_array($array) && count($array) > 0); return (is_array($array) && count($array) > 0);
} }

View file

@ -254,7 +254,7 @@ function delivery_run(&$argv, &$argc){
intval($contact_id) intval($contact_id)
); );
if (count($r)) if (dba::is_result($r))
$contact = $r[0]; $contact = $r[0];
if ($contact['self']) if ($contact['self'])
@ -416,7 +416,7 @@ function delivery_run(&$argv, &$argc){
intval($argv[2]), intval($argv[2]),
intval($uid) intval($uid)
); );
if (count($r)) if (dba::is_result($r))
$it = $r[0]; $it = $r[0];
} }
if (!$it) if (!$it)

View file

@ -1430,7 +1430,7 @@ class dfrn {
dbesc(normalise_link($suggest["url"])), dbesc(normalise_link($suggest["url"])),
intval($suggest["uid"]) intval($suggest["uid"])
); );
if(count($r)) if(dba::is_result($r))
return false; return false;
// Do we already have an fcontact record for this person? // Do we already have an fcontact record for this person?
@ -1441,7 +1441,7 @@ class dfrn {
dbesc($suggest["name"]), dbesc($suggest["name"]),
dbesc($suggest["request"]) dbesc($suggest["request"])
); );
if(count($r)) { if(dba::is_result($r)) {
$fid = $r[0]["id"]; $fid = $r[0]["id"];
// OK, we do. Do we already have an introduction for this person ? // OK, we do. Do we already have an introduction for this person ?
@ -1449,7 +1449,7 @@ class dfrn {
intval($suggest["uid"]), intval($suggest["uid"]),
intval($fid) intval($fid)
); );
if(count($r)) if(dba::is_result($r))
return false; return false;
} }
if(!$fid) if(!$fid)
@ -1464,7 +1464,7 @@ class dfrn {
dbesc($suggest["name"]), dbesc($suggest["name"]),
dbesc($suggest["request"]) dbesc($suggest["request"])
); );
if(count($r)) if(dba::is_result($r))
$fid = $r[0]["id"]; $fid = $r[0]["id"];
else else
// database record did not get created. Quietly give up. // database record did not get created. Quietly give up.
@ -2120,7 +2120,7 @@ class dfrn {
dbesc($item["uri"]), dbesc($item["uri"]),
intval($importer["uid"]) intval($importer["uid"])
); );
if(count($r)) if(dba::is_result($r))
$ev["id"] = $r[0]["id"]; $ev["id"] = $r[0]["id"];
$event_id = event_store($ev); $event_id = event_store($ev);
@ -2141,7 +2141,7 @@ class dfrn {
} }
// Update content if 'updated' changes // Update content if 'updated' changes
if(count($r)) { if(dba::is_result($r)) {
if (self::update_content($r[0], $item, $importer, $entrytype)) if (self::update_content($r[0], $item, $importer, $entrytype))
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG); logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
else else
@ -2163,7 +2163,7 @@ class dfrn {
intval($posted_id), intval($posted_id),
intval($importer["importer_uid"]) intval($importer["importer_uid"])
); );
if(count($r)) { if(dba::is_result($r)) {
$parent = $r[0]["parent"]; $parent = $r[0]["parent"];
$parent_uri = $r[0]["parent-uri"]; $parent_uri = $r[0]["parent-uri"];
} }
@ -2345,7 +2345,7 @@ class dfrn {
dbesc($item["parent-uri"]), dbesc($item["parent-uri"]),
intval($importer["uid"]) intval($importer["uid"])
); );
if(count($r)) { if(dba::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d", q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]["id"]) intval($r[0]["id"])
); );

View file

@ -401,7 +401,7 @@ function notification($params) {
$hash = random_string(); $hash = random_string();
$r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash)); dbesc($hash));
if(count($r)) if(dba::is_result($r))
$dups = true; $dups = true;
} while($dups == true); } while($dups == true);
@ -718,7 +718,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
foreach ($tags AS $tag) { foreach ($tags AS $tag) {
$r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `notify_new_posts`", $r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `notify_new_posts`",
normalise_link($tag["url"]), intval($uid)); normalise_link($tag["url"]), intval($uid));
if (count($r)) if (dba::is_result($r))
$send_notification = true; $send_notification = true;
} }
} }

View file

@ -276,7 +276,7 @@ function event_store($arr) {
intval($arr['id']), intval($arr['id']),
intval($arr['uid']) intval($arr['uid'])
); );
return((count($r)) ? $r[0]['id'] : 0); return((dba::is_result($r)) ? $r[0]['id'] : 0);
} }
// The event changed. Update it. // The event changed. Update it.
@ -317,7 +317,7 @@ function event_store($arr) {
intval($arr['id']), intval($arr['id']),
intval($arr['uid']) intval($arr['uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>'; $object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>'; $object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
$object .= '</object>' . "\n"; $object .= '</object>' . "\n";
@ -376,7 +376,7 @@ function event_store($arr) {
dbesc($arr['uri']), dbesc($arr['uri']),
intval($arr['uid']) intval($arr['uid'])
); );
if(count($r)) if(dba::is_result($r))
$event = $r[0]; $event = $r[0];
$item_arr = array(); $item_arr = array();
@ -418,7 +418,7 @@ function event_store($arr) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($arr['uid']) intval($arr['uid'])
); );
//if(count($r)) //if(dba::is_result($r))
// $plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; // $plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id;

View file

@ -39,7 +39,7 @@ function expire_run(&$argv, &$argc){
logger('expire: start'); logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0"); $r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG); logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
item_expire($rr['uid'],$rr['expire']); item_expire($rr['uid'],$rr['expire']);

View file

@ -10,7 +10,7 @@ function fcontact_store($url,$name,$photo) {
dbesc($nurl) dbesc($nurl)
); );
if(count($r)) if(dba::is_result($r))
return $r[0]['id']; return $r[0]['id'];
$r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ", $r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
@ -23,7 +23,7 @@ function fcontact_store($url,$name,$photo) {
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
dbesc($nurl) dbesc($nurl)
); );
if(count($r)) if(dba::is_result($r))
return $r[0]['id']; return $r[0]['id'];
} }

View file

@ -178,7 +178,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($uid), dbesc(normalise_link($url)), dbesc($ret['network']) intval($uid), dbesc(normalise_link($url)), dbesc($ret['network'])
); );
if(count($r)) { if(dba::is_result($r)) {
// update contact // update contact
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d", q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
@ -196,7 +196,7 @@ function new_contact($uid,$url,$interactive = false) {
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0", $r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
intval($uid) intval($uid)
); );
if(count($r)) if(dba::is_result($r))
$total_contacts = $r[0]['total']; $total_contacts = $r[0]['total'];
if(! service_class_allows($uid,'total_contacts',$total_contacts)) { if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
@ -208,7 +208,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($uid), intval($uid),
dbesc($network) dbesc($network)
); );
if(count($r)) if(dba::is_result($r))
$total_network = $r[0]['total']; $total_network = $r[0]['total'];
if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) { if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
@ -295,7 +295,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
if(($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) { if(($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
require_once('include/salmon.php'); require_once('include/salmon.php');
slapper($r[0],$contact['notify'],$slap); slapper($r[0],$contact['notify'],$slap);

View file

@ -65,7 +65,7 @@ function gprobe_run(&$argv, &$argc){
dbesc(normalise_link($url)) dbesc(normalise_link($url))
); );
} }
if(count($r)) { if(dba::is_result($r)) {
// Check for accessibility and do a poco discovery // Check for accessibility and do a poco discovery
if (poco_last_updated($r[0]['url'], true) AND ($r[0]["network"] == NETWORK_DFRN)) if (poco_last_updated($r[0]['url'], true) AND ($r[0]["network"] == NETWORK_DFRN))
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url'])); poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));

View file

@ -44,7 +44,7 @@ function group_rmv($uid,$name) {
intval($uid), intval($uid),
dbesc($name) dbesc($name)
); );
if(count($r)) if(dba::is_result($r))
$group_id = $r[0]['id']; $group_id = $r[0]['id'];
if(! $group_id) if(! $group_id)
return false; return false;
@ -106,7 +106,7 @@ function group_byname($uid,$name) {
intval($uid), intval($uid),
dbesc($name) dbesc($name)
); );
if(count($r)) if(dba::is_result($r))
return $r[0]['id']; return $r[0]['id'];
return false; return false;
} }
@ -139,7 +139,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
intval($gid), intval($gid),
intval($member) intval($member)
); );
if(count($r)) if(dba::is_result($r))
return true; // You might question this, but return true; // You might question this, but
// we indicate success because the group member was in fact created // we indicate success because the group member was in fact created
// -- It was just created at another time // -- It was just created at another time
@ -164,7 +164,7 @@ function group_get_members($gid) {
intval($gid), intval($gid),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$ret = $r; $ret = $r;
} }
return $ret; return $ret;
@ -181,7 +181,7 @@ function group_public_members($gid) {
intval(local_user()), intval(local_user()),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(count($r)) if(dba::is_result($r))
$ret = count($r); $ret = count($r);
} }
return $ret; return $ret;
@ -197,7 +197,7 @@ function mini_group_select($uid,$gid = 0, $label = "") {
intval($uid) intval($uid)
); );
$grps[] = array('name' => '', 'id' => '0', 'selected' => ''); $grps[] = array('name' => '', 'id' => '0', 'selected' => '');
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : '')); $grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : ''));
} }
@ -255,7 +255,7 @@ function group_side($every="contacts",$each="group",$editmode = "standard", $gro
$member_of = groups_containing(local_user(),$cid); $member_of = groups_containing(local_user(),$cid);
} }
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$selected = (($group_id == $rr['id']) ? ' group-selected' : ''); $selected = (($group_id == $rr['id']) ? ' group-selected' : '');
@ -316,7 +316,7 @@ function expand_groups($a,$check_dead = false, $use_gcontact = false) {
$ret = array(); $ret = array();
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$ret[] = $rr['contact-id']; $ret[] = $rr['contact-id'];
if($check_dead AND !$use_gcontact) { if($check_dead AND !$use_gcontact) {
@ -345,7 +345,7 @@ function groups_containing($uid,$c) {
); );
$ret = array(); $ret = array();
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$ret[] = $rr['gid']; $ret[] = $rr['gid'];
} }

View file

@ -138,7 +138,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
$r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($visitor['cid']) intval($visitor['cid'])
); );
if(count($r)) if(dba::is_result($r))
$profile = $r[0]['profile-id']; $profile = $r[0]['profile-id'];
break; break;
} }
@ -230,7 +230,7 @@ function profile_sidebar($profile, $block = 0) {
$r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'", $r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'",
local_user(), $profile_url); local_user(), $profile_url);
if (count($r)) if (dba::is_result($r))
$connect = false; $connect = false;
} }
@ -263,7 +263,7 @@ function profile_sidebar($profile, $block = 0) {
'entries' => array(), 'entries' => array(),
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$profile['menu']['entries'][] = array( $profile['menu']['entries'][] = array(
@ -344,7 +344,7 @@ function profile_sidebar($profile, $block = 0) {
if(is_array($a->profile) AND !$a->profile['hide-friends']) { if(is_array($a->profile) AND !$a->profile['hide-friends']) {
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1", $r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
intval($a->profile['uid'])); intval($a->profile['uid']));
if(count($r)) if(dba::is_result($r))
$updated = date("c", strtotime($r[0]['updated'])); $updated = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
@ -354,7 +354,7 @@ function profile_sidebar($profile, $block = 0) {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(count($r)) if(dba::is_result($r))
$contacts = intval($r[0]['total']); $contacts = intval($r[0]['total']);
} }
} }

View file

@ -413,7 +413,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
/* check for create date and expire time */ /* check for create date and expire time */
$uid = intval($arr['uid']); $uid = intval($arr['uid']);
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid)); $r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
if(count($r)) { if(dba::is_result($r)) {
$expire_interval = $r[0]['expire']; $expire_interval = $r[0]['expire'];
if ($expire_interval>0) { if ($expire_interval>0) {
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC')); $expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
@ -535,7 +535,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($arr['uid']) intval($arr['uid'])
); );
if(count($r)) if(dba::is_result($r))
$arr['network'] = $r[0]["network"]; $arr['network'] = $r[0]["network"];
// Fallback to friendica (why is it empty in some cases?) // Fallback to friendica (why is it empty in some cases?)
@ -583,7 +583,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
$r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1", $r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1",
dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid'])); dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid']));
if(count($r)) { if(dba::is_result($r)) {
logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG); logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG);
return 0; return 0;
} }
@ -612,7 +612,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($arr['uid']) intval($arr['uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
// is the new message multi-level threaded? // is the new message multi-level threaded?
// even though we don't support it now, preserve the info // even though we don't support it now, preserve the info
@ -768,7 +768,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($r[0]["id"]) intval($r[0]["id"])
); );
return 0; return 0;
} elseif(count($r)) { } elseif(dba::is_result($r)) {
$current_post = $r[0]['id']; $current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post); logger('item_store: created item ' . $current_post);
@ -979,7 +979,7 @@ function item_body_set_hashtags(&$item) {
function get_item_guid($id) { function get_item_guid($id) {
$r = q("SELECT `guid` FROM `item` WHERE `id` = %d LIMIT 1", intval($id)); $r = q("SELECT `guid` FROM `item` WHERE `id` = %d LIMIT 1", intval($id));
if (count($r)) if (dba::is_result($r))
return($r[0]["guid"]); return($r[0]["guid"]);
else else
return(""); return("");
@ -998,7 +998,7 @@ function get_item_id($guid, $uid = 0) {
$r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid` $r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `item`.`guid` = '%s' AND `item`.`uid` = %d", dbesc($guid), intval($uid)); AND `item`.`guid` = '%s' AND `item`.`uid` = %d", dbesc($guid), intval($uid));
if (count($r)) { if (dba::is_result($r)) {
$id = $r[0]["id"]; $id = $r[0]["id"];
$nick = $r[0]["nickname"]; $nick = $r[0]["nickname"];
} }
@ -1012,7 +1012,7 @@ function get_item_id($guid, $uid = 0) {
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`private` = 0 AND `item`.`wall` = 1
AND `item`.`guid` = '%s'", dbesc($guid)); AND `item`.`guid` = '%s'", dbesc($guid));
if (count($r)) { if (dba::is_result($r)) {
$id = $r[0]["id"]; $id = $r[0]["id"];
$nick = $r[0]["nickname"]; $nick = $r[0]["nickname"];
} }
@ -1313,7 +1313,7 @@ function item_is_remote_self($contact, &$datarray) {
if ($contact['remote_self'] == 2) { if ($contact['remote_self'] == 2) {
$r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`", $r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`",
intval($contact['uid'])); intval($contact['uid']));
if (count($r)) { if (dba::is_result($r)) {
$datarray['contact-id'] = $r[0]["id"]; $datarray['contact-id'] = $r[0]["id"];
$datarray['owner-name'] = $r[0]["name"]; $datarray['owner-name'] = $r[0]["name"];
@ -1390,7 +1390,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
intval($importer['uid']), intval($importer['uid']),
dbesc($url) dbesc($url)
); );
if(count($r)) { if(dba::is_result($r)) {
$contact_record = $r[0]; $contact_record = $r[0];
$photos = import_profile_photo($photo,$importer["uid"],$contact_record["id"]); $photos = import_profile_photo($photo,$importer["uid"],$contact_record["id"]);
@ -1982,7 +1982,7 @@ function drop_item($id,$interactive = true) {
dbesc($item['parent-uri']), dbesc($item['parent-uri']),
intval($item['uid']) intval($item['uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d", q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]['id']) intval($r[0]['id'])
); );
@ -2019,7 +2019,7 @@ function first_post_date($uid,$wall = false) {
intval($uid), intval($uid),
intval($wall ? 1 : 0) intval($wall ? 1 : 0)
); );
if(count($r)) { if(dba::is_result($r)) {
// logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA); // logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA);
return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10); return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10);
} }

View file

@ -90,7 +90,7 @@ function do_like($item_id, $verb) {
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1", WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) if(dba::is_result($r))
$owner = $r[0]; $owner = $r[0];
if(! $owner) { if(! $owner) {
@ -112,7 +112,7 @@ function do_like($item_id, $verb) {
intval($_SESSION['visitor_id']), intval($_SESSION['visitor_id']),
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) if(dba::is_result($r))
$contact = $r[0]; $contact = $r[0];
} }
if(! $contact) { if(! $contact) {
@ -135,7 +135,7 @@ function do_like($item_id, $verb) {
dbesc($item_id), dbesc($item_id), dbesc($item['uri']) dbesc($item_id), dbesc($item_id), dbesc($item['uri'])
); );
if(count($r)) { if(dba::is_result($r)) {
$like_item = $r[0]; $like_item = $r[0];
// Already voted, undo it // Already voted, undo it

View file

@ -16,7 +16,7 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
dbesc($fn_name) dbesc($fn_name)
); );
if((count($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) { if((dba::is_result($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'", q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'",
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($fn_name) dbesc($fn_name)

View file

@ -41,7 +41,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($replyto), dbesc($replyto),
dbesc($replyto) dbesc($replyto)
); );
if(count($r)) if(dba::is_result($r))
$convid = $r[0]['convid']; $convid = $r[0]['convid'];
} }
@ -74,7 +74,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($conv_guid), dbesc($conv_guid),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$convid = $r[0]['id']; $convid = $r[0]['id'];
} }
@ -113,7 +113,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($uri), dbesc($uri),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$post_id = $r[0]['id']; $post_id = $r[0]['id'];
/** /**
@ -210,7 +210,7 @@ function send_wallmessage($recipient='', $body='', $subject='', $replyto=''){
dbesc($conv_guid), dbesc($conv_guid),
intval($recipient['uid']) intval($recipient['uid'])
); );
if(count($r)) if(dba::is_result($r))
$convid = $r[0]['id']; $convid = $r[0]['id'];
if(! $convid) { if(! $convid) {

View file

@ -314,7 +314,7 @@ function notifier_run(&$argv, &$argc){
intval($uid), intval($uid),
dbesc(NETWORK_DFRN) dbesc(NETWORK_DFRN)
); );
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$recipients_followup[] = $rr['id']; $recipients_followup[] = $rr['id'];
} }
@ -425,7 +425,7 @@ function notifier_run(&$argv, &$argc){
$r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra); $r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra);
if(count($r)) if(dba::is_result($r))
$contacts = $r; $contacts = $r;
} else } else
@ -443,7 +443,7 @@ function notifier_run(&$argv, &$argc){
intval($uid), intval($uid),
dbesc(NETWORK_MAIL) dbesc(NETWORK_MAIL)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$recipients[] = $rr['id']; $recipients[] = $rr['id'];
} }
@ -471,7 +471,7 @@ function notifier_run(&$argv, &$argc){
// delivery loop // delivery loop
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $contact) { foreach($r as $contact) {
if(!$contact['self']) { if(!$contact['self']) {
@ -572,7 +572,7 @@ function notifier_run(&$argv, &$argc){
$r = array_merge($r2,$r1,$r0); $r = array_merge($r2,$r1,$r0);
if(count($r)) { if(dba::is_result($r)) {
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG); logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
// throw everything into the queue in case we get killed // throw everything into the queue in case we get killed

View file

@ -23,7 +23,7 @@ class FKOAuthDataStore extends OAuthDataStore {
$r = q("SELECT client_id, pw, redirect_uri FROM clients WHERE client_id='%s'", $r = q("SELECT client_id, pw, redirect_uri FROM clients WHERE client_id='%s'",
dbesc($consumer_key) dbesc($consumer_key)
); );
if (count($r)) if (dba::is_result($r))
return new OAuthConsumer($r[0]['client_id'],$r[0]['pw'],$r[0]['redirect_uri']); return new OAuthConsumer($r[0]['client_id'],$r[0]['pw'],$r[0]['redirect_uri']);
return null; return null;
} }
@ -35,7 +35,7 @@ class FKOAuthDataStore extends OAuthDataStore {
dbesc($token_type), dbesc($token_type),
dbesc($token) dbesc($token)
); );
if (count($r)){ if (dba::is_result($r)){
$ot=new OAuthToken($r[0]['id'],$r[0]['secret']); $ot=new OAuthToken($r[0]['id'],$r[0]['secret']);
$ot->scope=$r[0]['scope']; $ot->scope=$r[0]['scope'];
$ot->expires = $r[0]['expires']; $ot->expires = $r[0]['expires'];
@ -52,7 +52,7 @@ class FKOAuthDataStore extends OAuthDataStore {
dbesc($nonce), dbesc($nonce),
intval($timestamp) intval($timestamp)
); );
if (count($r)) if (dba::is_result($r))
return new OAuthToken($r[0]['id'],$r[0]['secret']); return new OAuthToken($r[0]['id'],$r[0]['secret']);
return null; return null;
} }
@ -136,7 +136,7 @@ class FKOAuth1 extends OAuthServer {
$r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
intval($uid) intval($uid)
); );
if(count($r)){ if(dba::is_result($r)){
$record = $r[0]; $record = $r[0];
} else { } else {
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
@ -162,7 +162,7 @@ class FKOAuth1 extends OAuthServer {
$r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(dba::is_result($r)) {
$a->contact = $r[0]; $a->contact = $r[0];
$a->cid = $r[0]['id']; $a->cid = $r[0]['id'];
$_SESSION['cid'] = $a->cid; $_SESSION['cid'] = $a->cid;
@ -219,7 +219,7 @@ class FKOAuth2 extends OAuth2 {
$r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'", $r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'",
dbesc($oauth_token)); dbesc($oauth_token));
if (count($r)) if (dba::is_result($r))
return $r[0]; return $r[0];
return null; return null;
} }
@ -247,7 +247,7 @@ class FKOAuth2 extends OAuth2 {
$r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'", $r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
dbesc($code)); dbesc($code));
if (count($r)) if (dba::is_result($r))
return $r[0]; return $r[0];
return null; return null;
} }

View file

@ -94,7 +94,7 @@ function onepoll_run(&$argv, &$argc){
where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['id']) intval($contact['id'])
); );
if (count($r)) if (dba::is_result($r))
if (!$r[0]['total']) if (!$r[0]['total'])
poco_load($contact['id'],$importer_uid,0,$contact['poco']); poco_load($contact['id'],$importer_uid,0,$contact['poco']);
} }
@ -394,7 +394,7 @@ function onepoll_run(&$argv, &$argc){
dbesc($datarray['uri']) dbesc($datarray['uri'])
); );
if(count($r)) { if(dba::is_result($r)) {
logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG); logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
// Only delete when mails aren't automatically moved or deleted // Only delete when mails aren't automatically moved or deleted
@ -447,7 +447,7 @@ function onepoll_run(&$argv, &$argc){
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `uri` IN ( $qstr ) AND `uid` = %d LIMIT 1", $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `uri` IN ( $qstr ) AND `uid` = %d LIMIT 1",
intval($importer_uid) intval($importer_uid)
); );
if(count($r)) if(dba::is_result($r))
$datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item $datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
// $datarray['parent-uri'] = $r[0]['uri']; // $datarray['parent-uri'] = $r[0]['uri'];
} }
@ -479,7 +479,7 @@ function onepoll_run(&$argv, &$argc){
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d ORDER BY `created` DESC LIMIT 1", $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
dbesc(protect_sprintf($datarray['title'])), dbesc(protect_sprintf($datarray['title'])),
intval($importer_uid)); intval($importer_uid));
if(count($r)) if(dba::is_result($r))
$datarray['parent-uri'] = $r[0]['parent-uri']; $datarray['parent-uri'] = $r[0]['parent-uri'];
} }

View file

@ -79,7 +79,7 @@ function reload_plugins() {
if(strlen($plugins)) { if(strlen($plugins)) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1"); $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if(count($r)) if(dba::is_result($r))
$installed = $r; $installed = $r;
else else
$installed = array(); $installed = array();
@ -150,7 +150,7 @@ function register_hook($hook,$file,$function,$priority=0) {
dbesc($file), dbesc($file),
dbesc($function) dbesc($function)
); );
if(count($r)) if(dba::is_result($r))
return true; return true;
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ", $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
@ -187,7 +187,7 @@ function load_hooks() {
$a = get_app(); $a = get_app();
$a->hooks = array(); $a->hooks = array();
$r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`"); $r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks)) if(! array_key_exists($rr['hook'],$a->hooks))
$a->hooks[$rr['hook']] = array(); $a->hooks[$rr['hook']] = array();

View file

@ -21,16 +21,14 @@ function was_recently_delayed($cid) {
and last > UTC_TIMESTAMP() - interval 15 minute limit 1", and last > UTC_TIMESTAMP() - interval 15 minute limit 1",
intval($cid) intval($cid)
); );
if(count($r)) if(dba::is_result($r))
return true; return true;
$r = q("select `term-date` from contact where id = %d and `term-date` != '' and `term-date` != '0000-00-00 00:00:00' limit 1", $r = q("select `term-date` from contact where id = %d and `term-date` != '' and `term-date` != '0000-00-00 00:00:00' limit 1",
intval($cid) intval($cid)
); );
if(count($r))
return true;
return false; return (dba::is_result($r));
} }

View file

@ -42,7 +42,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$r = q("select * from user where uid = %d limit 1", $r = q("select * from user where uid = %d limit 1",
intval($_SESSION['submanage']) intval($_SESSION['submanage'])
); );
if(count($r)) if(dba::is_result($r))
$master_record = $r[0]; $master_record = $r[0];
} }
@ -70,7 +70,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(dba::is_result($r)) {
$a->contact = $r[0]; $a->contact = $r[0];
$a->cid = $r[0]['id']; $a->cid = $r[0]['id'];
$_SESSION['cid'] = $a->cid; $_SESSION['cid'] = $a->cid;
@ -158,7 +158,7 @@ function can_write_wall(&$a,$owner) {
intval(PAGE_COMMUNITY) intval(PAGE_COMMUNITY)
); );
if(count($r)) { if(dba::is_result($r)) {
$verified = 2; $verified = 2;
return true; return true;
} }
@ -212,7 +212,7 @@ function permissions_sql($owner_id,$remote_verified = false,$groups = null) {
intval($remote_user), intval($remote_user),
intval($owner_id) intval($owner_id)
); );
if(count($r)) { if(dba::is_result($r)) {
$remote_verified = true; $remote_verified = true;
$groups = init_groups_visitor($remote_user); $groups = init_groups_visitor($remote_user);
} }
@ -294,7 +294,7 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
intval($remote_user), intval($remote_user),
intval($owner_id) intval($owner_id)
); );
if(count($r)) { if(dba::is_result($r)) {
$remote_verified = true; $remote_verified = true;
$groups = init_groups_visitor($remote_user); $groups = init_groups_visitor($remote_user);
} }
@ -405,7 +405,7 @@ function init_groups_visitor($contact_id) {
WHERE `contact-id` = %d ", WHERE `contact-id` = %d ",
intval($contact_id) intval($contact_id)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$groups[] = $rr['gid']; $groups[] = $rr['gid'];
} }

View file

@ -17,7 +17,7 @@ function ref_session_read ($id) {
if(x($id)) if(x($id))
$r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id)); $r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
if(count($r)) { if(dba::is_result($r)) {
$session_exists = true; $session_exists = true;
return $r[0]['data']; return $r[0]['data'];
} else { } else {

View file

@ -39,7 +39,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$r = q("select `poco`, `uid` from `contact` where `id` = %d limit 1", $r = q("select `poco`, `uid` from `contact` where `id` = %d limit 1",
intval($cid) intval($cid)
); );
if(count($r)) { if(dba::is_result($r)) {
$url = $r[0]['poco']; $url = $r[0]['poco'];
$uid = $r[0]['uid']; $uid = $r[0]['uid'];
} }
@ -205,14 +205,14 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET) dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
); );
if(count($r)) if(dba::is_result($r))
$network = $r[0]["network"]; $network = $r[0]["network"];
if (($network == "") OR ($network == NETWORK_OSTATUS)) { if (($network == "") OR ($network == NETWORK_OSTATUS)) {
$r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc($profile_url), dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET) dbesc($profile_url), dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
); );
if(count($r)) { if(dba::is_result($r)) {
$network = $r[0]["network"]; $network = $r[0]["network"];
//$profile_url = $r[0]["url"]; //$profile_url = $r[0]["url"];
} }
@ -948,7 +948,7 @@ function count_common_friends($uid,$cid) {
); );
// logger("count_common_friends: $uid $cid {$r[0]['total']}"); // logger("count_common_friends: $uid $cid {$r[0]['total']}");
if(count($r)) if(dba::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -994,7 +994,7 @@ function count_common_friends_zcid($uid,$zcid) {
intval($uid) intval($uid)
); );
if(count($r)) if(dba::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -1033,7 +1033,7 @@ function count_all_friends($uid,$cid) {
intval($uid) intval($uid)
); );
if(count($r)) if(dba::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -1162,7 +1162,7 @@ function update_suggestions() {
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA) dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/')); $base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done)) if(! in_array($base,$done))

View file

@ -491,7 +491,7 @@ function item_new_uri($hostname,$uid, $guid = "") {
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($uri)); dbesc($uri));
if(count($r)) if(dba::is_result($r))
$dups = true; $dups = true;
} while($dups == true); } while($dups == true);
return $uri; return $uri;
@ -515,7 +515,7 @@ function photo_new_resource() {
$r = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1",
dbesc($resource) dbesc($resource)
); );
if(count($r)) if(dba::is_result($r))
$found = true; $found = true;
} while($found == true); } while($found == true);
return $resource; return $resource;
@ -859,7 +859,7 @@ function contact_block() {
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_DIASPORA) dbesc(NETWORK_DIASPORA)
); );
if(count($r)) { if(dba::is_result($r)) {
$total = intval($r[0]['total']); $total = intval($r[0]['total']);
} }
if(! $total) { if(! $total) {
@ -877,7 +877,7 @@ function contact_block() {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
intval($shown) intval($shown)
); );
if(count($r)) { if(dba::is_result($r)) {
$contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total); $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
$micropro = Array(); $micropro = Array();
foreach($r as $rr) { foreach($r as $rr) {
@ -2050,7 +2050,7 @@ function file_tag_update_pconfig($uid,$file_old,$file_new,$type = 'file') {
// intval($uid) // intval($uid)
//); //);
if(count($r)) { if(dba::is_result($r)) {
unset($deleted_tags[$key]); unset($deleted_tags[$key]);
} }
else { else {
@ -2080,7 +2080,7 @@ function file_tag_save_file($uid,$item,$file) {
intval($item), intval($item),
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']')) if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
q("UPDATE `item` SET `file` = '%s' WHERE `id` = %d AND `uid` = %d", q("UPDATE `item` SET `file` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'), dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),

View file

@ -88,7 +88,7 @@ function add_shadow_entry($item) {
// Is there already a shadow entry? // Is there already a shadow entry?
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item['uri'])); $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item['uri']));
if (count($r)) if (dba::is_result($r))
return; return;
// Preparing public shadow (removing user specific data) // Preparing public shadow (removing user specific data)

View file

@ -130,7 +130,7 @@ function create_user($arr) {
$r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
dbesc($email) dbesc($email)
); );
if(count($r)) if(dba::is_result($r))
$result['message'] .= t('Cannot use that email.') . EOL; $result['message'] .= t('Cannot use that email.') . EOL;
} }
@ -143,7 +143,7 @@ function create_user($arr) {
WHERE `nickname` = '%s' LIMIT 1", WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
if(count($r)) if(dba::is_result($r))
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL; $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
// Check deleted accounts that had this nickname. Doesn't matter to us, // Check deleted accounts that had this nickname. Doesn't matter to us,
@ -153,7 +153,7 @@ function create_user($arr) {
WHERE `username` = '%s' LIMIT 1", WHERE `username` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
if(count($r)) if(dba::is_result($r))
$result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL; $result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
if(strlen($result['message'])) { if(strlen($result['message'])) {

View file

@ -1078,7 +1078,7 @@ function admin_page_dbsync(&$a) {
$failed = array(); $failed = array();
$r = q("select k, v from config where `cat` = 'database' "); $r = q("select k, v from config where `cat` = 'database' ");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$upd = intval(substr($rr['k'],7)); $upd = intval(substr($rr['k'],7));
if($upd < 1139 || $rr['v'] === 'success') if($upd < 1139 || $rr['v'] === 'success')

View file

@ -57,13 +57,13 @@ function common_content(&$a) {
dbesc(normalise_link(get_my_url())), dbesc(normalise_link(get_my_url())),
intval($profile_uid) intval($profile_uid)
); );
if(count($r)) if(dba::is_result($r))
$cid = $r[0]['id']; $cid = $r[0]['id'];
else { else {
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link(get_my_url())) dbesc(normalise_link(get_my_url()))
); );
if(count($r)) if(dba::is_result($r))
$zcid = $r[0]['id']; $zcid = $r[0]['id'];
} }
} }

View file

@ -59,7 +59,7 @@ function community_content(&$a, $update = 0) {
AND `item`.`private` = 0 AND `item`.`wall` = 1" AND `item`.`private` = 0 AND `item`.`wall` = 1"
); );
if(count($r)) if(dba::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
if(! $r[0]['total']) { if(! $r[0]['total']) {

View file

@ -14,7 +14,7 @@ function contactgroup_content(&$a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$change = intval($a->argv[2]); $change = intval($a->argv[2]);
} }

View file

@ -758,22 +758,22 @@ function contacts_content(&$a) {
$r = q("SELECT COUNT(*) AS `total` FROM `contact` $r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$total = $r[0]['total']; $total = $r[0]['total'];
} }
$sql_extra3 = unavailable_networks(); $sql_extra3 = unavailable_networks();
$contacts = array();
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ",
intval($_SESSION['uid']), intval($_SESSION['uid']),
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );
$contacts = array(); if(dba::is_result($r)) {
if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$contacts[] = _contact_detail_for_template($rr); $contacts[] = _contact_detail_for_template($rr);
} }

View file

@ -93,7 +93,7 @@ function content_content(&$a, $update = 0) {
); );
$str = ''; $str = '';
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$str .= '<' . $rr['id'] . '>'; $str .= '<' . $rr['id'] . '>';
if(strlen($str)) if(strlen($str))
@ -141,7 +141,7 @@ function content_content(&$a, $update = 0) {
AND `blocked` = 0 AND `pending` = 0 LIMIT 1", AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
intval($cid) intval($cid)
); );
if(count($r)) { if(dba::is_result($r)) {
$sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) "; $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) ";
} }
@ -259,7 +259,7 @@ function content_content(&$a, $update = 0) {
$parents_arr = array(); $parents_arr = array();
$parents_str = ''; $parents_str = '';
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr)) if(! in_array($rr['item_id'],$parents_arr))
$parents_arr[] = $rr['item_id']; $parents_arr[] = $rr['item_id'];

View file

@ -26,12 +26,12 @@ function delegate_content(&$a) {
$r = q("select `nickname` from user where uid = %d limit 1", $r = q("select `nickname` from user where uid = %d limit 1",
intval($id) intval($id)
); );
if(count($r)) { if(dba::is_result($r)) {
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1", $r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
intval(local_user()), intval(local_user()),
dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname'])) dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname']))
); );
if(count($r)) { if(dba::is_result($r)) {
q("insert into manage ( uid, mid ) values ( %d , %d ) ", q("insert into manage ( uid, mid ) values ( %d , %d ) ",
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
@ -64,7 +64,7 @@ function delegate_content(&$a) {
dbesc($a->user['email']), dbesc($a->user['email']),
dbesc($a->user['password']) dbesc($a->user['password'])
); );
if(count($r)) if(dba::is_result($r))
$full_managers = $r; $full_managers = $r;
$delegates = array(); $delegates = array();
@ -75,7 +75,7 @@ function delegate_content(&$a) {
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$delegates = $r; $delegates = $r;
$uids = array(); $uids = array();
@ -104,7 +104,7 @@ function delegate_content(&$a) {
$nicknames = array(); $nicknames = array();
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'"; $nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
} }
@ -118,7 +118,7 @@ function delegate_content(&$a) {
$r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )"); $r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )");
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
if(! in_array($rr['uid'],$uids)) if(! in_array($rr['uid'],$uids))
$potentials[] = $rr; $potentials[] = $rr;

View file

@ -418,7 +418,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id) intval($contact_id)
); );
if(count($r)) if(dba::is_result($r))
$contact = $r[0]; $contact = $r[0];
else else
$contact = null; $contact = null;
@ -438,7 +438,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
intval($uid) intval($uid)
); );
if((count($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) { if((dba::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
require_once('include/items.php'); require_once('include/items.php');
@ -624,7 +624,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1",
dbesc($decrypted_dfrn_id) dbesc($decrypted_dfrn_id)
); );
if(count($r)) { if(dba::is_result($r)) {
$message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.'); $message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
xml_status(1,$message); // Birthday paradox - duplicate dfrn-id xml_status(1,$message); // Birthday paradox - duplicate dfrn-id
// NOTREACHED // NOTREACHED
@ -656,7 +656,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($dfrn_record)); intval($dfrn_record));
if(count($r)) if(dba::is_result($r))
$photo = $r[0]['photo']; $photo = $r[0]['photo'];
else else
$photo = $a->get_baseurl() . '/images/person-175.jpg'; $photo = $a->get_baseurl() . '/images/person-175.jpg';
@ -709,10 +709,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
intval($dfrn_record) intval($dfrn_record)
); );
if(count($r)) if(dba::is_result($r))
$combined = $r[0]; $combined = $r[0];
if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) { if((dba::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
$mutual = ($new_relation == CONTACT_IS_FRIEND); $mutual = ($new_relation == CONTACT_IS_FRIEND);
notification(array( notification(array(
'type' => NOTIFY_CONFIRM, 'type' => NOTIFY_CONFIRM,
@ -737,7 +737,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
intval($local_uid) intval($local_uid)
); );
if((count($r)) && ($r[0]['hide-friends'] == 0)) { if((dba::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
require_once('include/items.php'); require_once('include/items.php');

View file

@ -76,7 +76,7 @@ function dfrn_poll_init(&$a) {
dbesc($a->argv[1]) dbesc($a->argv[1])
); );
if(count($r)) { if(dba::is_result($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check'); $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
@ -187,7 +187,7 @@ function dfrn_poll_init(&$a) {
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time())); q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC", $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
dbesc($dfrn_id)); dbesc($dfrn_id));
if(count($r)) { if(dba::is_result($r)) {
xml_status(1); xml_status(1);
return; // NOTREACHED return; // NOTREACHED
} }
@ -332,7 +332,7 @@ function dfrn_poll_post(&$a) {
$reputation = 0; $reputation = 0;
$text = ''; $text = '';
if(count($r)) { if(dba::is_result($r)) {
$reputation = $r[0]['rating']; $reputation = $r[0]['rating'];
$text = $r[0]['reason']; $text = $r[0]['reason'];
@ -445,7 +445,7 @@ function dfrn_poll_content(&$a) {
dbesc($nickname) dbesc($nickname)
); );
if(count($r)) { if(dba::is_result($r)) {
$challenge = ''; $challenge = '';
$encrypted_id = ''; $encrypted_id = '';
@ -492,7 +492,7 @@ function dfrn_poll_content(&$a) {
)); ));
} }
$profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); $profile = ((dba::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
switch($destination_url) { switch($destination_url) {
case 'profile': case 'profile':

View file

@ -89,7 +89,7 @@ function dfrn_request_post(&$a) {
dbesc(normalise_link($dfrn_url)) dbesc(normalise_link($dfrn_url))
); );
if(count($r)) { if(dba::is_result($r)) {
if(strlen($r[0]['dfrn-id'])) { if(strlen($r[0]['dfrn-id'])) {
/** /**
@ -180,7 +180,7 @@ function dfrn_request_post(&$a) {
dbesc($dfrn_url), dbesc($dfrn_url),
$parms['key'] // this was already escaped $parms['key'] // this was already escaped
); );
if(count($r)) { if(dba::is_result($r)) {
$def_gid = get_default_group(local_user(), $r[0]["network"]); $def_gid = get_default_group(local_user(), $r[0]["network"]);
if(intval($def_gid)) if(intval($def_gid))
group_add_member(local_user(), '', $r[0]['id'], $def_gid); group_add_member(local_user(), '', $r[0]['id'], $def_gid);
@ -285,7 +285,7 @@ function dfrn_request_post(&$a) {
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ", AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
dbesc(NETWORK_MAIL2) dbesc(NETWORK_MAIL2)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! $rr['rel']) { if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d", q("DELETE FROM `contact` WHERE `id` = %d",
@ -310,7 +310,7 @@ function dfrn_request_post(&$a) {
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ", AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
dbesc(NETWORK_MAIL2) dbesc(NETWORK_MAIL2)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! $rr['rel']) { if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d", q("DELETE FROM `contact` WHERE `id` = %d",
@ -390,7 +390,7 @@ function dfrn_request_post(&$a) {
dbesc($poll), dbesc($poll),
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$contact_id = $r[0]['id']; $contact_id = $r[0]['id'];
$def_gid = get_default_group($uid, $r[0]["network"]); $def_gid = get_default_group($uid, $r[0]["network"]);
@ -562,7 +562,7 @@ function dfrn_request_post(&$a) {
$parms['url'], $parms['url'],
$parms['issued-id'] $parms['issued-id']
); );
if(count($r)) if(dba::is_result($r))
$contact_record = $r[0]; $contact_record = $r[0];
} }
@ -711,16 +711,16 @@ function dfrn_request_content(&$a) {
dbesc($_GET['confirm_key']) dbesc($_GET['confirm_key'])
); );
if(count($intro)) { if(dba::is_result($intro)) {
$auto_confirm = false;
$r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `contact`.`id` = %d LIMIT 1", WHERE `contact`.`id` = %d LIMIT 1",
intval($intro[0]['contact-id']) intval($intro[0]['contact-id'])
); );
$auto_confirm = false; if(dba::is_result($r)) {
if(count($r)) {
if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP)) if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
$auto_confirm = true; $auto_confirm = true;

View file

@ -78,7 +78,7 @@ function directory_content(&$a) {
$r = $db->q("SELECT COUNT(*) AS `total` FROM `profile` $r = $db->q("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra "); WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
if(count($r)) if(dba::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$order = " ORDER BY `name` ASC "; $order = " ORDER BY `name` ASC ";
@ -90,7 +90,7 @@ function directory_content(&$a) {
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid` LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit); WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit);
if(count($r)) { if(dba::is_result($r)) {
if(in_array('small', $a->argv)) if(in_array('small', $a->argv))
$photo = 'thumb'; $photo = 'thumb';

View file

@ -19,7 +19,7 @@ function display_init(&$a) {
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item` $r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user()); AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
if (count($r)) { if (dba::is_result($r)) {
$nick = $a->user["nickname"]; $nick = $a->user["nickname"];
$itemuid = local_user(); $itemuid = local_user();
} }
@ -36,7 +36,7 @@ function display_init(&$a) {
AND NOT `item`.`private` AND NOT `user`.`hidewall` AND NOT `item`.`private` AND NOT `user`.`hidewall`
AND `item`.`guid` = '%s'", dbesc($a->argv[1])); AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall` // AND NOT `item`.`private` AND `item`.`wall`
if (count($r)) { if (dba::is_result($r)) {
$nick = $r[0]["nickname"]; $nick = $r[0]["nickname"];
$itemuid = $r[0]["uid"]; $itemuid = $r[0]["uid"];
} }
@ -53,7 +53,7 @@ function display_init(&$a) {
AND `item`.`guid` = '%s'", dbesc($a->argv[1])); AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall` // AND NOT `item`.`private` AND `item`.`wall`
} }
if (count($r)) { if (dba::is_result($r)) {
if ($r[0]["id"] != $r[0]["parent"]) if ($r[0]["id"] != $r[0]["parent"])
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item` $r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
@ -70,7 +70,7 @@ function display_init(&$a) {
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
if (count($r)) if (dba::is_result($r))
$profiledata = $r[0]; $profiledata = $r[0];
$profiledata["network"] = NETWORK_DFRN; $profiledata["network"] = NETWORK_DFRN;
@ -168,7 +168,7 @@ function display_fetchauthor($a, $item) {
dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc(normalise_link($profiledata["url"])), intval(local_user()),
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND)); intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
if (count($r)) { if (dba::is_result($r)) {
$profiledata["name"] = $r[0]["name"]; $profiledata["name"] = $r[0]["name"];
$profiledata["photo"] = $r[0]["photo"]; $profiledata["photo"] = $r[0]["photo"];
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["nickname"] = $r[0]["nick"];
@ -187,7 +187,7 @@ function display_fetchauthor($a, $item) {
// Fetching profile data from global contacts // Fetching profile data from global contacts
if ($profiledata["network"] != NETWORK_FEED) { if ($profiledata["network"] != NETWORK_FEED) {
$r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"]))); $r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
if (count($r)) { if (dba::is_result($r)) {
$profiledata["name"] = $r[0]["name"]; $profiledata["name"] = $r[0]["name"];
$profiledata["photo"] = $r[0]["photo"]; $profiledata["photo"] = $r[0]["photo"];
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["nickname"] = $r[0]["nick"];
@ -259,7 +259,7 @@ function display_content(&$a, $update = 0) {
$r = q("SELECT `id` FROM `item` $r = q("SELECT `id` FROM `item`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user()); AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
if (count($r)) { if (dba::is_result($r)) {
$item_id = $r[0]["id"]; $item_id = $r[0]["id"];
$nick = $a->user["nickname"]; $nick = $a->user["nickname"];
} }
@ -273,7 +273,7 @@ function display_content(&$a, $update = 0) {
AND NOT `item`.`private` AND NOT `user`.`hidewall` AND NOT `item`.`private` AND NOT `user`.`hidewall`
AND `item`.`guid` = '%s'", dbesc($a->argv[1])); AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall` // AND NOT `item`.`private` AND `item`.`wall`
if (count($r)) { if (dba::is_result($r)) {
$item_id = $r[0]["id"]; $item_id = $r[0]["id"];
$nick = $r[0]["nickname"]; $nick = $r[0]["nickname"];
} }
@ -286,7 +286,7 @@ function display_content(&$a, $update = 0) {
AND NOT `item`.`private` AND `item`.`uid` = 0 AND NOT `item`.`private` AND `item`.`uid` = 0
AND `item`.`guid` = '%s'", dbesc($a->argv[1])); AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall` // AND NOT `item`.`private` AND `item`.`wall`
if (count($r)) { if (dba::is_result($r)) {
$item_id = $r[0]["id"]; $item_id = $r[0]["id"];
} }
} }
@ -331,7 +331,7 @@ function display_content(&$a, $update = 0) {
intval($contact_id), intval($contact_id),
intval($a->profile['uid']) intval($a->profile['uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -347,7 +347,7 @@ function display_content(&$a, $update = 0) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
intval($a->profile['uid']) intval($a->profile['uid'])
); );
if(count($r)) if(dba::is_result($r))
$a->page_contact = $r[0]; $a->page_contact = $r[0];
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);

View file

@ -78,7 +78,7 @@ function editpost_content(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$mail_enabled = true; $mail_enabled = true;
if(intval($r[0]['pubmail'])) if(intval($r[0]['pubmail']))
$pubmail_enabled = true; $pubmail_enabled = true;

View file

@ -361,7 +361,7 @@ function events_content(&$a) {
$links = array(); $links = array();
if(count($r)) { if(dba::is_result($r)) {
$r = sort_by_date($r); $r = sort_by_date($r);
foreach($r as $rr) { foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
@ -376,7 +376,7 @@ function events_content(&$a) {
$last_date = ''; $last_date = '';
$fmt = t('l, F j'); $fmt = t('l, F j');
if(count($r)) { if(dba::is_result($r)) {
$r = sort_by_date($r); $r = sort_by_date($r);
foreach($r as $rr) { foreach($r as $rr) {
@ -475,7 +475,7 @@ function events_content(&$a) {
intval($event_id), intval($event_id),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$orig_event = $r[0]; $orig_event = $r[0];
} }

View file

@ -24,7 +24,7 @@ function friendica_init(&$a) {
$visible_plugins = array(); $visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) { if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0"); $r = q("select * from addon where hidden = 0");
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$visible_plugins[] = $rr['name']; $visible_plugins[] = $rr['name'];
} }
@ -80,7 +80,7 @@ function friendica_content(&$a) {
$visible_plugins = array(); $visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) { if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0"); $r = q("select * from addon where hidden = 0");
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$visible_plugins[] = $rr['name']; $visible_plugins[] = $rr['name'];
} }

View file

@ -33,7 +33,7 @@ function fsuggest_post(&$a) {
intval($new_contact), intval($new_contact),
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
@ -50,7 +50,7 @@ function fsuggest_post(&$a) {
dbesc($hash), dbesc($hash),
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$fsuggest_id = $r[0]['id']; $fsuggest_id = $r[0]['id'];
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d", q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($note), dbesc($note),

View file

@ -107,7 +107,7 @@ function group_content(&$a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$result = group_rmv(local_user(),$r[0]['name']); $result = group_rmv(local_user(),$r[0]['name']);
if($result) if($result)
info( t('Group removed.') . EOL); info( t('Group removed.') . EOL);
@ -125,7 +125,7 @@ function group_content(&$a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$change = intval($a->argv[2]); $change = intval($a->argv[2]);
} }
@ -209,7 +209,7 @@ function group_content(&$a) {
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) { foreach($r as $member) {
if(! in_array($member['id'],$preselected)) { if(! in_array($member['id'],$preselected)) {

View file

@ -129,7 +129,7 @@ function item_post(&$a) {
intval($parent_item['contact-id']), intval($parent_item['contact-id']),
intval($uid) intval($uid)
); );
if(count($r)) if(dba::is_result($r))
$parent_contact = $r[0]; $parent_contact = $r[0];
// If the contact id doesn't fit with the contact, then set the contact to null // If the contact id doesn't fit with the contact, then set the contact to null
@ -140,7 +140,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", $r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($thrparent[0]["author-link"]))); dbesc(normalise_link($thrparent[0]["author-link"])));
if (count($r)) { if (dba::is_result($r)) {
$parent_contact = $r[0]; $parent_contact = $r[0];
$parent_contact["thumb"] = $parent_contact["photo"]; $parent_contact["thumb"] = $parent_contact["photo"];
$parent_contact["micro"] = $parent_contact["photo"]; $parent_contact["micro"] = $parent_contact["photo"];
@ -219,7 +219,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($profile_uid) intval($profile_uid)
); );
if(count($r)) if(dba::is_result($r))
$user = $r[0]; $user = $r[0];
if($orig_post) { if($orig_post) {
@ -322,7 +322,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(count($r) && intval($r[0]['pubmail'])) if(dba::is_result($r) && intval($r[0]['pubmail']))
$pubmail_enabled = true; $pubmail_enabled = true;
} }
} }
@ -391,7 +391,7 @@ function item_post(&$a) {
} }
} }
if(count($r)) { if(dba::is_result($r)) {
$author = $r[0]; $author = $r[0];
$contact_id = $author['id']; $contact_id = $author['id'];
} }
@ -405,7 +405,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($profile_uid) intval($profile_uid)
); );
if(count($r)) if(dba::is_result($r))
$contact_record = $r[0]; $contact_record = $r[0];
} }
@ -490,7 +490,7 @@ function item_post(&$a) {
intval($profile_uid), intval($profile_uid),
intval($attach) intval($attach)
); );
if(count($r)) { if(dba::is_result($r)) {
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' $r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `uid` = %d AND `id` = %d", WHERE `uid` = %d AND `id` = %d",
dbesc($str_contact_allow), dbesc($str_contact_allow),
@ -631,7 +631,7 @@ function item_post(&$a) {
intval($profile_uid), intval($profile_uid),
intval($mtch) intval($mtch)
); );
if(count($r)) { if(dba::is_result($r)) {
if(strlen($attachments)) if(strlen($attachments))
$attachments .= ','; $attachments .= ',';
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]'; $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';

View file

@ -52,7 +52,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $allowed_groups)) dbesc(implode(', ', $allowed_groups))
); );
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = '<b>' . $rr['name'] . '</b>'; $l[] = '<b>' . $rr['name'] . '</b>';
} }
@ -60,7 +60,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$allowed_users)) dbesc(implode(', ',$allowed_users))
); );
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = $rr['name']; $l[] = $rr['name'];
@ -70,7 +70,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $deny_groups)) dbesc(implode(', ', $deny_groups))
); );
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>'; $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
} }
@ -78,7 +78,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$deny_users)) dbesc(implode(', ',$deny_users))
); );
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = '<strike>' . $rr['name'] . '</strike>'; $l[] = '<strike>' . $rr['name'] . '</strike>';

View file

@ -15,7 +15,7 @@ function manage_post(&$a) {
$r = q("select * from user where uid = %d limit 1", $r = q("select * from user where uid = %d limit 1",
intval($_SESSION['submanage']) intval($_SESSION['submanage'])
); );
if(count($r)) { if(dba::is_result($r)) {
$uid = intval($r[0]['uid']); $uid = intval($r[0]['uid']);
$orig_record = $r[0]; $orig_record = $r[0];
} }

View file

@ -242,7 +242,7 @@ function message_content(&$a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$parent = $r[0]['parent-uri']; $parent = $r[0]['parent-uri'];
$convid = $r[0]['convid']; $convid = $r[0]['convid'];
@ -309,7 +309,7 @@ function message_content(&$a) {
intval(local_user()), intval(local_user()),
intval($a->argv[2]) intval($a->argv[2])
); );
if(count($r)) { if(dba::is_result($r)) {
$prename = $r[0]['name']; $prename = $r[0]['name'];
$preurl = $r[0]['url']; $preurl = $r[0]['url'];
$preid = $r[0]['id']; $preid = $r[0]['id'];
@ -393,7 +393,7 @@ function message_content(&$a) {
intval(local_user()), intval(local_user()),
intval($a->argv[1]) intval($a->argv[1])
); );
if(count($r)) { if(dba::is_result($r)) {
$contact_id = $r[0]['contact-id']; $contact_id = $r[0]['contact-id'];
$convid = $r[0]['convid']; $convid = $r[0]['convid'];

View file

@ -36,7 +36,7 @@ function mood_init(&$a) {
intval($parent), intval($parent),
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$parent_uri = $r[0]['uri']; $parent_uri = $r[0]['uri'];
$private = $r[0]['private']; $private = $r[0]['private'];
$allow_cid = $r[0]['allow_cid']; $allow_cid = $r[0]['allow_cid'];

View file

@ -13,17 +13,19 @@ function msearch_post(&$a) {
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ", $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
dbesc($search) dbesc($search)
); );
if(count($r))
if(dba::is_result($r))
$total = $r[0]['total']; $total = $r[0]['total'];
$results = array();
$r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ", $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
dbesc($search), dbesc($search),
intval($startrec), intval($startrec),
intval($perpage) intval($perpage)
); );
$results = array(); if(dba::is_result($r)) {
if(count($r)) {
foreach($r as $rr) foreach($r as $rr)
$results[] = array( $results[] = array(
'name' => $rr['name'], 'name' => $rr['name'],

View file

@ -182,7 +182,7 @@ function saved_searches($search) {
$saved = array(); $saved = array();
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$saved[] = array( $saved[] = array(
'id' => $rr['id'], 'id' => $rr['id'],
@ -465,7 +465,7 @@ function network_content(&$a, $update = 0) {
); );
$str = ''; $str = '';
if(count($r)) if(dba::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$str .= '<' . $rr['id'] . '>'; $str .= '<' . $rr['id'] . '>';
if(strlen($str)) if(strlen($str))
@ -587,7 +587,7 @@ function network_content(&$a, $update = 0) {
AND `blocked` = 0 AND `pending` = 0 LIMIT 1", AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
intval($cid) intval($cid)
); );
if(count($r)) { if(dba::is_result($r)) {
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid); $sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
$entries[0] = array( $entries[0] = array(
@ -689,7 +689,7 @@ function network_content(&$a, $update = 0) {
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
} }
} }

View file

@ -28,11 +28,11 @@ function nogroup_content(&$a) {
require_once('include/Contact.php'); require_once('include/Contact.php');
$r = contacts_not_grouped(local_user()); $r = contacts_not_grouped(local_user());
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
} }
$r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']); $r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']);
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$contact_details = get_contact_details_by_url($rr['url'], local_user()); $contact_details = get_contact_details_by_url($rr['url'], local_user());

View file

@ -39,7 +39,7 @@ function noscrape_init(&$a) {
if(is_array($a->profile) AND !$a->profile['hide-friends']) { if(is_array($a->profile) AND !$a->profile['hide-friends']) {
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1", $r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
intval($a->profile['uid'])); intval($a->profile['uid']));
if(count($r)) if(dba::is_result($r))
$json_info["updated"] = date("c", strtotime($r[0]['updated'])); $json_info["updated"] = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
@ -49,7 +49,7 @@ function noscrape_init(&$a) {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(count($r)) if(dba::is_result($r))
$json_info["contacts"] = intval($r[0]['total']); $json_info["contacts"] = intval($r[0]['total']);
} }

View file

@ -83,7 +83,7 @@ function notes_content(&$a,$update = false) {
); );
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(40); $a->set_pager_itemspage(40);
} }
@ -105,7 +105,7 @@ function notes_content(&$a,$update = false) {
$parents_arr = array(); $parents_arr = array();
$parents_str = ''; $parents_str = '';
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$parents_arr[] = $rr['item_id']; $parents_arr[] = $rr['item_id'];
$parents_str = implode(', ', $parents_arr); $parents_str = implode(', ', $parents_arr);
@ -124,7 +124,7 @@ function notes_content(&$a,$update = false) {
dbesc($parents_str) dbesc($parents_str)
); );
if(count($r)) { if(dba::is_result($r)) {
$items = conv_sort($r,"`commented`"); $items = conv_sort($r,"`commented`");
$o .= conversation($a,$items,'notes',$update); $o .= conversation($a,$items,'notes',$update);

View file

@ -6,7 +6,7 @@
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d", $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id) intval($id)
); );
if (count($r)){ if (dba::is_result($r)){
$nick = $r[0]['nickname']; $nick = $r[0]['nickname'];
$url = $a->get_baseurl()."/display/$nick/$id"; $url = $a->get_baseurl()."/display/$nick/$id";
goaway($url); goaway($url);

View file

@ -21,7 +21,7 @@ function notifications_post(&$a) {
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$intro_id = $r[0]['id']; $intro_id = $r[0]['id'];
$contact_id = $r[0]['contact-id']; $contact_id = $r[0]['contact-id'];
} }
@ -149,7 +149,7 @@ function notifications_content(&$a) {
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ", WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(($r !== false) && (count($r))) { if(dba::is_result($r)) {
$sugg = get_markup_template('suggestions.tpl'); $sugg = get_markup_template('suggestions.tpl');
$tpl = get_markup_template("intros.tpl"); $tpl = get_markup_template("intros.tpl");
@ -372,7 +372,7 @@ function notifications_content(&$a) {
intval(local_user()) intval(local_user())
); );
if (count($r) > 0) { if (dba::is_result($r)) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
@ -424,7 +424,7 @@ function notifications_content(&$a) {
$notif_content = ''; $notif_content = '';
if (count($r) > 0) { if (dba::is_result($r)) {
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){
@ -515,7 +515,7 @@ function notifications_content(&$a) {
$notif_content = ''; $notif_content = '';
if (count($r) > 0) { if (dba::is_result($r)) {
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){

View file

@ -76,7 +76,7 @@ function photo_init(&$a) {
intval($resolution), intval($resolution),
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$data = $r[0]['data']; $data = $r[0]['data'];
$mimetype = $r[0]['type']; $mimetype = $r[0]['type'];
} }
@ -106,7 +106,7 @@ function photo_init(&$a) {
dbesc($photo), dbesc($photo),
intval($resolution) intval($resolution)
); );
if(count($r)) { if(dba::is_result($r)) {
$sql_extra = permissions_sql($r[0]['uid']); $sql_extra = permissions_sql($r[0]['uid']);
@ -117,9 +117,9 @@ function photo_init(&$a) {
intval($resolution) intval($resolution)
); );
$public = ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == ''); $public = (dba::is_result($r)) && ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
if(count($r)) { if(dba::is_result($r)) {
$resolution = $r[0]['scale']; $resolution = $r[0]['scale'];
$data = $r[0]['data']; $data = $r[0]['data'];
$mimetype = $r[0]['type']; $mimetype = $r[0]['type'];

View file

@ -159,7 +159,7 @@ function photos_post(&$a) {
intval($cid), intval($cid),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$can_post = true; $can_post = true;
$visitor = $cid; $visitor = $cid;
} }
@ -267,7 +267,7 @@ function photos_post(&$a) {
dbesc($album) dbesc($album)
); );
} }
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$res[] = "'" . dbesc($rr['rid']) . "'" ; $res[] = "'" . dbesc($rr['rid']) . "'" ;
} }
@ -290,7 +290,7 @@ function photos_post(&$a) {
$r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", $r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
intval($page_owner_uid) intval($page_owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(datetime_convert()), dbesc(datetime_convert()),
@ -352,7 +352,7 @@ function photos_post(&$a) {
dbesc($a->argv[2]) dbesc($a->argv[2])
); );
} }
if(count($r)) { if(dba::is_result($r)) {
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
intval($page_owner_uid), intval($page_owner_uid),
dbesc($r[0]['resource-id']) dbesc($r[0]['resource-id'])
@ -408,7 +408,7 @@ function photos_post(&$a) {
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$ph = new Photo($r[0]['data'], $r[0]['type']); $ph = new Photo($r[0]['data'], $r[0]['type']);
if($ph->is_valid()) { if($ph->is_valid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 ); $rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
@ -525,7 +525,7 @@ function photos_post(&$a) {
intval($page_owner_uid) intval($page_owner_uid)
); );
} }
if(count($r)) { if(dba::is_result($r)) {
$old_tag = $r[0]['tag']; $old_tag = $r[0]['tag'];
$old_inform = $r[0]['inform']; $old_inform = $r[0]['inform'];
} }
@ -612,7 +612,7 @@ function photos_post(&$a) {
intval($page_owner_uid) intval($page_owner_uid)
); );
}*/ }*/
if(count($r)) { if(dba::is_result($r)) {
$newname = $r[0]['name']; $newname = $r[0]['name'];
$profile = $r[0]['url']; $profile = $r[0]['url'];
$notify = 'cid:' . $r[0]['id']; $notify = 'cid:' . $r[0]['id'];
@ -1028,7 +1028,7 @@ function photos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$can_post = true; $can_post = true;
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
@ -1056,7 +1056,7 @@ function photos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -1209,8 +1209,8 @@ function photos_content(&$a) {
intval($owner_uid), intval($owner_uid),
dbesc($album) dbesc($album)
); );
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(dba::is_result($r));
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
@ -1266,7 +1266,7 @@ function photos_content(&$a) {
$photos = array(); $photos = array();
if(count($r)) if(dba::is_result($r))
$twist = 'rotright'; $twist = 'rotright';
foreach($r as $rr) { foreach($r as $rr) {
if($twist == 'rotright') if($twist == 'rotright')
@ -1461,7 +1461,7 @@ function photos_content(&$a) {
); );
if(count($r)) if(dba::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
@ -1638,7 +1638,7 @@ function photos_content(&$a) {
// display comments // display comments
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $item) { foreach($r as $item) {
builtin_activity_puller($item, $conv_responses); builtin_activity_puller($item, $conv_responses);
@ -1824,8 +1824,8 @@ function photos_content(&$a) {
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc( t('Contact Photos')) dbesc( t('Contact Photos'))
); );
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(dba::is_result($r));
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
@ -1842,7 +1842,7 @@ function photos_content(&$a) {
$photos = array(); $photos = array();
if(count($r)) { if(dba::is_result($r)) {
$twist = 'rotright'; $twist = 'rotright';
foreach($r as $rr) { foreach($r as $rr) {
//hide profile photos to others //hide profile photos to others

View file

@ -81,7 +81,7 @@ function poco_init(&$a) {
dbesc(NETWORK_STATUSNET) dbesc(NETWORK_STATUSNET)
); );
} }
if(count($r)) if(dba::is_result($r))
$totalResults = intval($r[0]['total']); $totalResults = intval($r[0]['total']);
else else
$totalResults = 0; $totalResults = 0;
@ -168,7 +168,7 @@ function poco_init(&$a) {
} }
if(is_array($r)) { if(is_array($r)) {
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if (!isset($rr['generation'])) { if (!isset($rr['generation'])) {
if ($global) if ($global)

View file

@ -66,7 +66,7 @@ function poke_init(&$a) {
intval($parent), intval($parent),
intval($uid) intval($uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$parent_uri = $r[0]['uri']; $parent_uri = $r[0]['uri'];
$private = $r[0]['private']; $private = $r[0]['private'];
$allow_cid = $r[0]['allow_cid']; $allow_cid = $r[0]['allow_cid'];
@ -159,7 +159,7 @@ function poke_content(&$a) {
intval($_GET['c']), intval($_GET['c']),
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$name = $r[0]['name']; $name = $r[0]['name'];
$id = $r[0]['id']; $id = $r[0]['id'];
} }

View file

@ -13,7 +13,7 @@ function profile_init(&$a) {
$which = $a->argv[1]; $which = $a->argv[1];
else { else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1"); $r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1");
if(count($r)) { if(dba::is_result($r)) {
goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']); goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
} }
else { else {
@ -136,7 +136,7 @@ function profile_content(&$a, $update = 0) {
intval($contact_id), intval($contact_id),
intval($a->profile['profile_uid']) intval($a->profile['profile_uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -259,7 +259,7 @@ function profile_content(&$a, $update = 0) {
intval($a->profile['profile_uid']) intval($a->profile['profile_uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
} }
} }

View file

@ -32,7 +32,7 @@ function profile_photo_post(&$a) {
intval($_REQUEST['profile']), intval($_REQUEST['profile']),
intval(local_user()) intval(local_user())
); );
if(count($r) && (! intval($r[0]['is-default']))) if(dba::is_result($r) && (! intval($r[0]['is-default'])))
$is_default_profile = 0; $is_default_profile = 0;
} }
@ -63,7 +63,7 @@ function profile_photo_post(&$a) {
dbesc(local_user()), dbesc(local_user()),
intval($scale)); intval($scale));
if(count($r)) { if(dba::is_result($r)) {
$base_image = $r[0]; $base_image = $r[0];

View file

@ -285,7 +285,7 @@ function profiles_post(&$a) {
intval(local_user()) intval(local_user())
); );
} }
if(count($r)) { if(dba::is_result($r)) {
$prf = $r[0]['url']; $prf = $r[0]['url'];
$newname = $r[0]['name']; $newname = $r[0]['name'];
} }
@ -778,7 +778,7 @@ function profiles_content(&$a) {
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1", "SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user() local_user()
); );
if(count($r)){ if(dba::is_result($r)){
//Go to the default profile. //Go to the default profile.
goaway('profiles/'.$r[0]['id']); goaway('profiles/'.$r[0]['id']);
} }
@ -786,7 +786,7 @@ function profiles_content(&$a) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d", $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user()); local_user());
if(count($r)) { if(dba::is_result($r)) {
$tpl_header = get_markup_template('profile_listing_header.tpl'); $tpl_header = get_markup_template('profile_listing_header.tpl');
$o .= replace_macros($tpl_header,array( $o .= replace_macros($tpl_header,array(

View file

@ -42,7 +42,7 @@ function profperm_content(&$a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$change = intval($a->argv[2]); $change = intval($a->argv[2]);
} }
@ -64,7 +64,7 @@ function profperm_content(&$a) {
); );
$ingroup = array(); $ingroup = array();
if(count($r)) if(dba::is_result($r))
foreach($r as $member) foreach($r as $member)
$ingroup[] = $member['id']; $ingroup[] = $member['id'];
@ -94,7 +94,7 @@ function profperm_content(&$a) {
$members = $r; $members = $r;
$ingroup = array(); $ingroup = array();
if(count($r)) if(dba::is_result($r))
foreach($r as $member) foreach($r as $member)
$ingroup[] = $member['id']; $ingroup[] = $member['id'];
} }
@ -138,7 +138,7 @@ function profperm_content(&$a) {
dbesc(NETWORK_DFRN) dbesc(NETWORK_DFRN)
); );
if(count($r)) { if(dba::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) { foreach($r as $member) {
if(! in_array($member['id'],$ingroup)) { if(! in_array($member['id'],$ingroup)) {

View file

@ -136,7 +136,7 @@ function proxy_init() {
if (!$direct_cache AND ($cachefile == "")) { if (!$direct_cache AND ($cachefile == "")) {
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash); $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash);
if (count($r)) { if (dba::is_result($r)) {
$img_str = $r[0]['data']; $img_str = $r[0]['data'];
$mime = $r[0]["desc"]; $mime = $r[0]["desc"];
if ($mime == "") $mime = "image/jpeg"; if ($mime == "") $mime = "image/jpeg";

View file

@ -132,7 +132,7 @@ function pubsubhubbub_init(&$a) {
// if we are just updating an old subscription, keep the // if we are just updating an old subscription, keep the
// old values for push and last_update // old values for push and last_update
if (count($r)) { if (dba::is_result($r)) {
$last_update = $r[0]['last_update']; $last_update = $r[0]['last_update'];
$push_flag = $r[0]['push']; $push_flag = $r[0]['push'];
} }

View file

@ -23,7 +23,7 @@ function qsearch_init(&$a) {
intval($limit) intval($limit)
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$results[] = array( 0, (int) $rr['id'], $rr['name'], '', ''); $results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
@ -38,7 +38,7 @@ function qsearch_init(&$a) {
); );
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']); $results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);

View file

@ -34,7 +34,7 @@ function user_allow($hash) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1", $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
intval($user[0]['uid']) intval($user[0]['uid'])
); );
if(count($r) && $r[0]['net-publish']) { if(dba::is_result($r) && $r[0]['net-publish']) {
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname']; $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
if($url && strlen(get_config('system','directory'))) if($url && strlen(get_config('system','directory')))
proc_run('php',"include/directory.php","$url"); proc_run('php',"include/directory.php","$url");

View file

@ -169,8 +169,8 @@ function salmon_post(&$a) {
// Have we ignored the person? // Have we ignored the person?
// If so we can not accept this post. // If so we can not accept this post.
//if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) { //if((dba::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
if(count($r) && $r[0]['blocked']) { if(dba::is_result($r) && $r[0]['blocked']) {
logger('mod-salmon: Ignoring this author.'); logger('mod-salmon: Ignoring this author.');
http_status_exit(202); http_status_exit(202);
// NOTREACHED // NOTREACHED
@ -179,7 +179,7 @@ function salmon_post(&$a) {
// Placeholder for hub discovery. // Placeholder for hub discovery.
$hub = ''; $hub = '';
$contact_rec = ((count($r)) ? $r[0] : null); $contact_rec = ((dba::is_result($r)) ? $r[0] : null);
ostatus::import($data,$importer,$contact_rec, $hub); ostatus::import($data,$importer,$contact_rec, $hub);

View file

@ -15,7 +15,7 @@ function search_saved_searches() {
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$saved = array(); $saved = array();
foreach($r as $rr) { foreach($r as $rr) {
$saved[] = array( $saved[] = array(

View file

@ -254,7 +254,7 @@ function settings_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(count($r)) { if(dba::is_result($r)) {
$eacct = $r[0]; $eacct = $r[0];
require_once('include/email.php'); require_once('include/email.php');
$mb = construct_mailbox_name($eacct); $mb = construct_mailbox_name($eacct);
@ -842,15 +842,15 @@ function settings_content(&$a) {
$r = null; $r = null;
} }
$mail_server = ((count($r)) ? $r[0]['server'] : ''); $mail_server = ((dba::is_result($r)) ? $r[0]['server'] : '');
$mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); $mail_port = ((dba::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
$mail_ssl = ((count($r)) ? $r[0]['ssltype'] : ''); $mail_ssl = ((dba::is_result($r)) ? $r[0]['ssltype'] : '');
$mail_user = ((count($r)) ? $r[0]['user'] : ''); $mail_user = ((dba::is_result($r)) ? $r[0]['user'] : '');
$mail_replyto = ((count($r)) ? $r[0]['reply_to'] : ''); $mail_replyto = ((dba::is_result($r)) ? $r[0]['reply_to'] : '');
$mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); $mail_pubmail = ((dba::is_result($r)) ? $r[0]['pubmail'] : 0);
$mail_action = ((count($r)) ? $r[0]['action'] : 0); $mail_action = ((dba::is_result($r)) ? $r[0]['action'] : 0);
$mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : ''); $mail_movetofolder = ((dba::is_result($r)) ? $r[0]['movetofolder'] : '');
$mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); $mail_chk = ((dba::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
$tpl = get_markup_template("settings_connectors.tpl"); $tpl = get_markup_template("settings_connectors.tpl");

View file

@ -53,7 +53,7 @@ function subthread_content(&$a) {
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1", WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) if(dba::is_result($r))
$owner = $r[0]; $owner = $r[0];
if(! $owner) { if(! $owner) {
@ -75,7 +75,7 @@ function subthread_content(&$a) {
intval($_SESSION['visitor_id']), intval($_SESSION['visitor_id']),
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) if(dba::is_result($r))
$contact = $r[0]; $contact = $r[0];
} }
if(! $contact) { if(! $contact) {

View file

@ -39,7 +39,7 @@ function tagger_content(&$a) {
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1", $r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$owner_nick = $r[0]['nickname']; $owner_nick = $r[0]['nickname'];
$blocktags = $r[0]['blocktags']; $blocktags = $r[0]['blocktags'];
} }
@ -50,7 +50,7 @@ function tagger_content(&$a) {
$r = q("select * from contact where self = 1 and uid = %d limit 1", $r = q("select * from contact where self = 1 and uid = %d limit 1",
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$contact = $r[0]; $contact = $r[0];
else { else {
logger('tagger: no contact_id'); logger('tagger: no contact_id');
@ -178,7 +178,7 @@ EOT;
$r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1", $r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1",
dbesc($item['uri']) dbesc($item['uri'])
); );
if(count($r)) { if(dba::is_result($r)) {
$x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1", $x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
intval($r[0]['uid']) intval($r[0]['uid'])
); );

View file

@ -44,7 +44,7 @@ function uexport_content(&$a){
function _uexport_multirow($query) { function _uexport_multirow($query) {
$result = array(); $result = array();
$r = q($query); $r = q($query);
// if(count($r)) { // if(dba::is_result($r)) {
if ($r){ if ($r){
foreach($r as $rr){ foreach($r as $rr){
$p = array(); $p = array();
@ -130,7 +130,7 @@ function uexport_all(&$a) {
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ", $r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
intval(local_user()) intval(local_user())
); );
if(count($r)) if(dba::is_result($r))
$total = $r[0]['total']; $total = $r[0]['total'];
// chunk the output to avoid exhausting memory // chunk the output to avoid exhausting memory
@ -142,7 +142,7 @@ function uexport_all(&$a) {
intval($x), intval($x),
intval(500) intval(500)
); );
/*if(count($r)) { /*if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
foreach($rr as $k => $v) foreach($rr as $k => $v)
$item[][$k] = $v; $item[][$k] = $v;

View file

@ -143,7 +143,7 @@ function videos_post(&$a) {
dbesc($video_id) dbesc($video_id)
); );
if(count($r)) { if(dba::is_result($r)) {
q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'", q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
intval(local_user()), intval(local_user()),
dbesc($video_id) dbesc($video_id)
@ -262,7 +262,7 @@ function videos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$can_post = true; $can_post = true;
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
@ -290,7 +290,7 @@ function videos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -350,8 +350,8 @@ function videos_content(&$a) {
$sql_extra GROUP BY hash", $sql_extra GROUP BY hash",
intval($a->data['user']['uid']) intval($a->data['user']['uid'])
); );
if(count($r)) { if(dba::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(dba::is_result($r));
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
@ -366,7 +366,7 @@ function videos_content(&$a) {
$videos = array(); $videos = array();
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if($a->theme['template_engine'] === 'internal') { if($a->theme['template_engine'] === 'internal') {
$alt_e = template_escape($rr['filename']); $alt_e = template_escape($rr['filename']);

View file

@ -54,7 +54,7 @@ function viewcontacts_content(&$a) {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(count($r)) if(dba::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$r = q("SELECT * FROM `contact` $r = q("SELECT * FROM `contact`

View file

@ -24,7 +24,7 @@ function viewsrc_content(&$a) {
dbesc($item_id) dbesc($item_id)
); );
if(count($r)) if(dba::is_result($r))
if(is_ajax()) { if(is_ajax()) {
echo str_replace("\n",'<br />',$r[0]['body']); echo str_replace("\n",'<br />',$r[0]['body']);
killme(); killme();

View file

@ -55,7 +55,7 @@ function wall_attach_post(&$a) {
intval($cid), intval($cid),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$can_post = true; $can_post = true;
$visitor = $cid; $visitor = $cid;
} }

View file

@ -63,7 +63,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
intval($cid), intval($cid),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(count($r)) { if(dba::is_result($r)) {
$can_post = true; $can_post = true;
$visitor = $cid; $visitor = $cid;
} }

View file

@ -225,7 +225,7 @@ class Item extends BaseObject {
intval($item['uid']), intval($item['uid']),
intval($item['id']) intval($item['id'])
); );
if (count($r)) { if (dba::is_result($r)) {
$ignore = array( $ignore = array(
'do' => t("ignore thread"), 'do' => t("ignore thread"),
'undo' => t("unignore thread"), 'undo' => t("unignore thread"),

View file

@ -85,7 +85,7 @@ function update_1006() {
// create 's' keys for everybody that does not have one // create 's' keys for everybody that does not have one
$r = q("SELECT * FROM `user` WHERE `spubkey` = '' "); $r = q("SELECT * FROM `user` WHERE `spubkey` = '' ");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$sres=openssl_pkey_new(array('encrypt_key' => false )); $sres=openssl_pkey_new(array('encrypt_key' => false ));
$sprvkey = ''; $sprvkey = '';
@ -122,7 +122,7 @@ function update_1010() {
function update_1011() { function update_1011() {
q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` "); q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
$r = q("SELECT * FROM `contact` WHERE 1"); $r = q("SELECT * FROM `contact` WHERE 1");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d", q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d",
dbesc(basename($rr['url'])), dbesc(basename($rr['url'])),
@ -145,7 +145,7 @@ function update_1014() {
require_once('include/Photo.php'); require_once('include/Photo.php');
q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` "); q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
$r = q("SELECT * FROM `photo` WHERE `scale` = 4"); $r = q("SELECT * FROM `photo` WHERE `scale` = 4");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$ph = new Photo($rr['data']); $ph = new Photo($rr['data']);
if($ph->is_valid()) { if($ph->is_valid()) {
@ -155,7 +155,7 @@ function update_1014() {
} }
} }
$r = q("SELECT * FROM `contact` WHERE 1"); $r = q("SELECT * FROM `contact` WHERE 1");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(stristr($rr['thumb'],'avatar')) if(stristr($rr['thumb'],'avatar'))
q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d", q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
@ -356,7 +356,7 @@ function update_1035() {
function update_1036() { function update_1036() {
$r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' "); $r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' ");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d", q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('include/photo','photo',$rr['photo'])), dbesc(str_replace('include/photo','photo',$rr['photo'])),
@ -594,7 +594,7 @@ function update_1073() {
function update_1074() { function update_1074() {
q("ALTER TABLE `user` ADD `hidewall` TINYINT( 1) NOT NULL DEFAULT '0' AFTER `blockwall` "); q("ALTER TABLE `user` ADD `hidewall` TINYINT( 1) NOT NULL DEFAULT '0' AFTER `blockwall` ");
$r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1"); $r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d", q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d",
intval($rr['uid']) intval($rr['uid'])
@ -606,7 +606,7 @@ function update_1074() {
function update_1075() { function update_1075() {
q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` "); q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` ");
$r = q("SELECT `uid` FROM `user` WHERE 1"); $r = q("SELECT `uid` FROM `user` WHERE 1");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$found = true; $found = true;
do { do {
@ -688,7 +688,7 @@ function update_1082() {
if($r && count($r)) if($r && count($r))
return; return;
$r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`"); $r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$guid = get_guid(); $guid = get_guid();
q("update `photo` set `guid` = '%s' where `resource-id` = '%s'", q("update `photo` set `guid` = '%s' where `resource-id` = '%s'",
@ -731,7 +731,7 @@ function update_1087() {
q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` "); q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
$r = q("SELECT `id` FROM `item` WHERE `parent` = `id` "); $r = q("SELECT `id` FROM `item` WHERE `parent` = `id` ");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1", $x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1",
intval($rr['id']) intval($rr['id'])
@ -854,7 +854,7 @@ function update_1100() {
require_once('include/text.php'); require_once('include/text.php');
$r = q("select id, url from contact where url != '' and nurl = '' "); $r = q("select id, url from contact where url != '' and nurl = '' ");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
q("update contact set nurl = '%s' where id = %d", q("update contact set nurl = '%s' where id = %d",
dbesc(normalise_link($rr['url'])), dbesc(normalise_link($rr['url'])),
@ -1168,7 +1168,7 @@ function update_1136() {
// order in reverse so that we save the newest entry // order in reverse so that we save the newest entry
$r = q("select * from config where 1 order by id desc"); $r = q("select * from config where 1 order by id desc");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$found = false; $found = false;
foreach($arr as $x) { foreach($arr as $x) {
@ -1187,7 +1187,7 @@ function update_1136() {
$arr = array(); $arr = array();
$r = q("select * from pconfig where 1 order by id desc"); $r = q("select * from pconfig where 1 order by id desc");
if(count($r)) { if(dba::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$found = false; $found = false;
foreach($arr as $x) { foreach($arr as $x) {
@ -1692,7 +1692,7 @@ function update_1190() {
); );
// convert old forumlist addon entries in new config entries // convert old forumlist addon entries in new config entries
if (count($r)) { if (dba::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$uid = $rr['uid']; $uid = $rr['uid'];
$family = $rr['cat']; $family = $rr['cat'];

View file

@ -393,7 +393,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$r = q("select gcontact.* from gcontact left join glink on glink.gcid = gcontact.id $r = q("select gcontact.* from gcontact left join glink on glink.gcid = gcontact.id
where glink.cid = 0 and glink.uid = 0 order by rand() limit 9"); where glink.cid = 0 and glink.uid = 0 order by rand() limit 9");
$tpl = get_markup_template('ch_directory_item.tpl'); $tpl = get_markup_template('ch_directory_item.tpl');
if(count($r)) { if(dba::is_result($r)) {
$photo = 'photo'; $photo = 'photo';
foreach($r as $rr) { foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
@ -422,7 +422,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
9 9
); );
$tpl = get_markup_template('ch_directory_item.tpl'); $tpl = get_markup_template('ch_directory_item.tpl');
if(count($r)) { if(dba::is_result($r)) {
$photo = 'thumb'; $photo = 'thumb';
foreach($r as $rr) { foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
@ -499,7 +499,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
dbesc(t('Contact Photos')), dbesc(t('Contact Photos')),
dbesc(t('Profile Photos')) dbesc(t('Profile Photos'))
); );
if(count($r)) { if(dba::is_result($r)) {
$tpl = get_markup_template('ch_directory_item.tpl'); $tpl = get_markup_template('ch_directory_item.tpl');
foreach($r as $rr) { foreach($r as $rr) {
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id']; $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];

View file

@ -147,7 +147,7 @@ function vier_community_info() {
$r = suggestion_query(local_user(), 0, 9); $r = suggestion_query(local_user(), 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl'); $tpl = get_markup_template('ch_directory_item.tpl');
if(count($r)) { if(dba::is_result($r)) {
$aside['$comunity_profiles_title'] = t('Community Profiles'); $aside['$comunity_profiles_title'] = t('Community Profiles');
$aside['$comunity_profiles_items'] = array(); $aside['$comunity_profiles_items'] = array();
@ -170,13 +170,14 @@ function vier_community_info() {
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 "); $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 ");
$order = " ORDER BY `register_date` DESC "; $order = " ORDER BY `register_date` DESC ";
$tpl = get_markup_template('ch_directory_item.tpl');
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ", WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
0, 9); 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl'); if(dba::is_result($r)) {
if(count($r)) {
$aside['$lastusers_title'] = t('Last users'); $aside['$lastusers_title'] = t('Last users');
$aside['$lastusers_items'] = array(); $aside['$lastusers_items'] = array();
@ -367,7 +368,7 @@ function vier_community_info() {
$tpl = get_markup_template('ch_connectors.tpl'); $tpl = get_markup_template('ch_connectors.tpl');
if(count($r)) { if(dba::is_result($r)) {
$con_services = array(); $con_services = array();
$con_services['title'] = Array("", t('Connect Services'), "", ""); $con_services['title'] = Array("", t('Connect Services'), "", "");