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
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

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

View file

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

View file

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

View file

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

View file

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

View file

@ -93,7 +93,7 @@ function content_content(&$a, $update = 0) {
);
$str = '';
if(count($r))
if(dba::is_result($r))
foreach($r as $rr)
$str .= '<' . $rr['id'] . '>';
if(strlen($str))
@ -141,7 +141,7 @@ function content_content(&$a, $update = 0) {
AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
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 ) ";
}
@ -259,7 +259,7 @@ function content_content(&$a, $update = 0) {
$parents_arr = array();
$parents_str = '';
if(count($r)) {
if(dba::is_result($r)) {
foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr))
$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",
intval($id)
);
if(count($r)) {
if(dba::is_result($r)) {
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
intval(local_user()),
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 ) ",
intval($a->argv[2]),
intval(local_user())
@ -64,7 +64,7 @@ function delegate_content(&$a) {
dbesc($a->user['email']),
dbesc($a->user['password'])
);
if(count($r))
if(dba::is_result($r))
$full_managers = $r;
$delegates = array();
@ -75,7 +75,7 @@ function delegate_content(&$a) {
intval(local_user())
);
if(count($r))
if(dba::is_result($r))
$delegates = $r;
$uids = array();
@ -104,7 +104,7 @@ function delegate_content(&$a) {
$nicknames = array();
if(count($r)) {
if(dba::is_result($r)) {
foreach($r as $rr) {
$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 )");
if(count($r))
if(dba::is_result($r))
foreach($r as $rr)
if(! in_array($rr['uid'],$uids))
$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",
intval($contact_id)
);
if(count($r))
if(dba::is_result($r))
$contact = $r[0];
else
$contact = null;
@ -438,7 +438,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
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');
@ -624,7 +624,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1",
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.');
xml_status(1,$message); // Birthday paradox - duplicate dfrn-id
// NOTREACHED
@ -656,7 +656,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($dfrn_record));
if(count($r))
if(dba::is_result($r))
$photo = $r[0]['photo'];
else
$photo = $a->get_baseurl() . '/images/person-175.jpg';
@ -709,10 +709,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
intval($dfrn_record)
);
if(count($r))
if(dba::is_result($r))
$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);
notification(array(
'type' => NOTIFY_CONFIRM,
@ -737,7 +737,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
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');

View file

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

View file

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

View file

@ -78,7 +78,7 @@ function directory_content(&$a) {
$r = $db->q("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
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']);
$order = " ORDER BY `name` ASC ";
@ -90,7 +90,7 @@ function directory_content(&$a) {
LEFT JOIN `user` ON `user`.`uid` = `profile`.`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);
if(count($r)) {
if(dba::is_result($r)) {
if(in_array('small', $a->argv))
$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`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
if (count($r)) {
if (dba::is_result($r)) {
$nick = $a->user["nickname"];
$itemuid = local_user();
}
@ -36,7 +36,7 @@ function display_init(&$a) {
AND NOT `item`.`private` AND NOT `user`.`hidewall`
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall`
if (count($r)) {
if (dba::is_result($r)) {
$nick = $r[0]["nickname"];
$itemuid = $r[0]["uid"];
}
@ -53,7 +53,7 @@ function display_init(&$a) {
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall`
}
if (count($r)) {
if (dba::is_result($r)) {
if ($r[0]["id"] != $r[0]["parent"])
$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`
@ -70,7 +70,7 @@ function display_init(&$a) {
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
dbesc($nickname)
);
if (count($r))
if (dba::is_result($r))
$profiledata = $r[0];
$profiledata["network"] = NETWORK_DFRN;
@ -168,7 +168,7 @@ function display_fetchauthor($a, $item) {
dbesc(normalise_link($profiledata["url"])), intval(local_user()),
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
if (count($r)) {
if (dba::is_result($r)) {
$profiledata["name"] = $r[0]["name"];
$profiledata["photo"] = $r[0]["photo"];
$profiledata["nickname"] = $r[0]["nick"];
@ -187,7 +187,7 @@ function display_fetchauthor($a, $item) {
// Fetching profile data from global contacts
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"])));
if (count($r)) {
if (dba::is_result($r)) {
$profiledata["name"] = $r[0]["name"];
$profiledata["photo"] = $r[0]["photo"];
$profiledata["nickname"] = $r[0]["nick"];
@ -259,7 +259,7 @@ function display_content(&$a, $update = 0) {
$r = q("SELECT `id` FROM `item`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
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"];
$nick = $a->user["nickname"];
}
@ -273,7 +273,7 @@ function display_content(&$a, $update = 0) {
AND NOT `item`.`private` AND NOT `user`.`hidewall`
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall`
if (count($r)) {
if (dba::is_result($r)) {
$item_id = $r[0]["id"];
$nick = $r[0]["nickname"];
}
@ -286,7 +286,7 @@ function display_content(&$a, $update = 0) {
AND NOT `item`.`private` AND `item`.`uid` = 0
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
// AND NOT `item`.`private` AND `item`.`wall`
if (count($r)) {
if (dba::is_result($r)) {
$item_id = $r[0]["id"];
}
}
@ -331,7 +331,7 @@ function display_content(&$a, $update = 0) {
intval($contact_id),
intval($a->profile['uid'])
);
if(count($r)) {
if(dba::is_result($r)) {
$contact = $r[0];
$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",
intval($a->profile['uid'])
);
if(count($r))
if(dba::is_result($r))
$a->page_contact = $r[0];
$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",
intval(local_user())
);
if(count($r)) {
if(dba::is_result($r)) {
$mail_enabled = true;
if(intval($r[0]['pubmail']))
$pubmail_enabled = true;

View file

@ -361,7 +361,7 @@ function events_content(&$a) {
$links = array();
if(count($r)) {
if(dba::is_result($r)) {
$r = sort_by_date($r);
foreach($r as $rr) {
$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 = '';
$fmt = t('l, F j');
if(count($r)) {
if(dba::is_result($r)) {
$r = sort_by_date($r);
foreach($r as $rr) {
@ -475,7 +475,7 @@ function events_content(&$a) {
intval($event_id),
intval(local_user())
);
if(count($r))
if(dba::is_result($r))
$orig_event = $r[0];
}

View file

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

View file

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

View file

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

View file

@ -129,7 +129,7 @@ function item_post(&$a) {
intval($parent_item['contact-id']),
intval($uid)
);
if(count($r))
if(dba::is_result($r))
$parent_contact = $r[0];
// 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",
dbesc(normalise_link($thrparent[0]["author-link"])));
if (count($r)) {
if (dba::is_result($r)) {
$parent_contact = $r[0];
$parent_contact["thumb"] = $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",
intval($profile_uid)
);
if(count($r))
if(dba::is_result($r))
$user = $r[0];
if($orig_post) {
@ -322,7 +322,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
if(count($r) && intval($r[0]['pubmail']))
if(dba::is_result($r) && intval($r[0]['pubmail']))
$pubmail_enabled = true;
}
}
@ -391,7 +391,7 @@ function item_post(&$a) {
}
}
if(count($r)) {
if(dba::is_result($r)) {
$author = $r[0];
$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",
intval($profile_uid)
);
if(count($r))
if(dba::is_result($r))
$contact_record = $r[0];
}
@ -490,7 +490,7 @@ function item_post(&$a) {
intval($profile_uid),
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'
WHERE `uid` = %d AND `id` = %d",
dbesc($str_contact_allow),
@ -631,7 +631,7 @@ function item_post(&$a) {
intval($profile_uid),
intval($mtch)
);
if(count($r)) {
if(dba::is_result($r)) {
if(strlen($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]';

View file

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

View file

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

View file

@ -36,7 +36,7 @@ function mood_init(&$a) {
intval($parent),
intval($uid)
);
if(count($r)) {
if(dba::is_result($r)) {
$parent_uri = $r[0]['uri'];
$private = $r[0]['private'];
$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') ",
dbesc($search)
);
if(count($r))
if(dba::is_result($r))
$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 ",
dbesc($search),
intval($startrec),
intval($perpage)
);
$results = array();
if(count($r)) {
if(dba::is_result($r)) {
foreach($r as $rr)
$results[] = array(
'name' => $rr['name'],
@ -39,4 +41,4 @@ function msearch_post(&$a) {
killme();
}
}

View file

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

View file

@ -28,11 +28,11 @@ function nogroup_content(&$a) {
require_once('include/Contact.php');
$r = contacts_not_grouped(local_user());
if(count($r)) {
if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']);
}
$r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']);
if(count($r)) {
if(dba::is_result($r)) {
foreach($r as $rr) {
$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']) {
$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']));
if(count($r))
if(dba::is_result($r))
$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
@ -49,7 +49,7 @@ function noscrape_init(&$a) {
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
if(count($r))
if(dba::is_result($r))
$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_itemspage(40);
}
@ -105,7 +105,7 @@ function notes_content(&$a,$update = false) {
$parents_arr = array();
$parents_str = '';
if(count($r)) {
if(dba::is_result($r)) {
foreach($r as $rr)
$parents_arr[] = $rr['item_id'];
$parents_str = implode(', ', $parents_arr);
@ -124,7 +124,7 @@ function notes_content(&$a,$update = false) {
dbesc($parents_str)
);
if(count($r)) {
if(dba::is_result($r)) {
$items = conv_sort($r,"`commented`");
$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",
intval($id)
);
if (count($r)){
if (dba::is_result($r)){
$nick = $r[0]['nickname'];
$url = $a->get_baseurl()."/display/$nick/$id";
goaway($url);

View file

@ -21,7 +21,7 @@ function notifications_post(&$a) {
intval(local_user())
);
if(count($r)) {
if(dba::is_result($r)) {
$intro_id = $r[0]['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 ",
intval($_SESSION['uid']));
if(($r !== false) && (count($r))) {
if(dba::is_result($r)) {
$sugg = get_markup_template('suggestions.tpl');
$tpl = get_markup_template("intros.tpl");
@ -372,7 +372,7 @@ function notifications_content(&$a) {
intval(local_user())
);
if (count($r) > 0) {
if (dba::is_result($r)) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
@ -424,7 +424,7 @@ function notifications_content(&$a) {
$notif_content = '';
if (count($r) > 0) {
if (dba::is_result($r)) {
foreach ($r as $it) {
switch($it['verb']){
@ -515,7 +515,7 @@ function notifications_content(&$a) {
$notif_content = '';
if (count($r) > 0) {
if (dba::is_result($r)) {
foreach ($r as $it) {
switch($it['verb']){

View file

@ -76,7 +76,7 @@ function photo_init(&$a) {
intval($resolution),
intval($uid)
);
if(count($r)) {
if(dba::is_result($r)) {
$data = $r[0]['data'];
$mimetype = $r[0]['type'];
}
@ -106,7 +106,7 @@ function photo_init(&$a) {
dbesc($photo),
intval($resolution)
);
if(count($r)) {
if(dba::is_result($r)) {
$sql_extra = permissions_sql($r[0]['uid']);
@ -117,9 +117,9 @@ function photo_init(&$a) {
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'];
$data = $r[0]['data'];
$mimetype = $r[0]['type'];

View file

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

View file

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

View file

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

View file

@ -13,7 +13,7 @@ function profile_init(&$a) {
$which = $a->argv[1];
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");
if(count($r)) {
if(dba::is_result($r)) {
goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
}
else {
@ -136,7 +136,7 @@ function profile_content(&$a, $update = 0) {
intval($contact_id),
intval($a->profile['profile_uid'])
);
if(count($r)) {
if(dba::is_result($r)) {
$contact = $r[0];
$remote_contact = true;
}
@ -257,21 +257,21 @@ function profile_content(&$a, $update = 0) {
AND `thread`.`wall` = 1
$sql_extra $sql_extra2 ",
intval($a->profile['profile_uid'])
);
);
if(count($r)) {
$a->set_pager_total($r[0]['total']);
if(dba::is_result($r)) {
$a->set_pager_total($r[0]['total']);
}
}
// check if we serve a mobile device and get the user settings
// accordingly
if ($a->is_mobile) {
$itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 10);
$itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 10);
} else {
$itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
$itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
}
// now that we have the user settings, see if the theme forces
// a maximum item number which is lower then the user choice

View file

@ -32,7 +32,7 @@ function profile_photo_post(&$a) {
intval($_REQUEST['profile']),
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;
}
@ -63,7 +63,7 @@ function profile_photo_post(&$a) {
dbesc(local_user()),
intval($scale));
if(count($r)) {
if(dba::is_result($r)) {
$base_image = $r[0];

View file

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

View file

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

View file

@ -136,7 +136,7 @@ function proxy_init() {
if (!$direct_cache AND ($cachefile == "")) {
$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'];
$mime = $r[0]["desc"];
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
// old values for push and last_update
if (count($r)) {
if (dba::is_result($r)) {
$last_update = $r[0]['last_update'];
$push_flag = $r[0]['push'];
}

View file

@ -23,7 +23,7 @@ function qsearch_init(&$a) {
intval($limit)
);
if(count($r)) {
if(dba::is_result($r)) {
foreach($r as $rr)
$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)
$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",
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'];
if($url && strlen(get_config('system','directory')))
proc_run('php',"include/directory.php","$url");

View file

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

View file

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

View file

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

View file

@ -39,7 +39,7 @@ function tagger_content(&$a) {
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
intval($owner_uid)
);
if(count($r)) {
if(dba::is_result($r)) {
$owner_nick = $r[0]['nickname'];
$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",
intval(local_user())
);
if(count($r))
if(dba::is_result($r))
$contact = $r[0];
else {
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",
dbesc($item['uri'])
);
if(count($r)) {
if(dba::is_result($r)) {
$x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
intval($r[0]['uid'])
);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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