mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 02:05:19 +02:00
More usage of dbm::is_result($r) instead of count($r):
- count() returns very different results and never a boolean (not even false on error condition). - therefore you should NOT use it in boolean expressions. This still *can* be done in PHP because of its lazyness. But it is discouraged if it comes to more clean code. Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
293436e5fd
commit
6a8a36f12d
115 changed files with 439 additions and 437 deletions
|
@ -221,7 +221,7 @@ function frio_remote_nav($a,&$nav) {
|
|||
// user info
|
||||
$r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
|
||||
|
||||
$r[0]['photo'] = (count($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg");
|
||||
$r[0]['photo'] = (dbm::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg");
|
||||
$r[0]['name'] = $a->user['username'];
|
||||
|
||||
} elseif(!local_user() && remote_user()) {
|
||||
|
@ -235,9 +235,9 @@ function frio_remote_nav($a,&$nav) {
|
|||
$nav['remote'] = t("Visitor");
|
||||
}
|
||||
|
||||
if(count($r)){
|
||||
if(dbm::is_result($r)){
|
||||
$nav['userinfo'] = array(
|
||||
'icon' => (count($r) ? $r[0]['photo'] : "images/person-48.jpg"),
|
||||
'icon' => (dbm::is_result($r) ? $r[0]['photo'] : "images/person-48.jpg"),
|
||||
'name' => $r[0]['name'],
|
||||
);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ function frio_acl_lookup($a, &$results) {
|
|||
$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(dbm::is_result($r)) {
|
||||
$total = $r[0]["total"];
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ function frio_acl_lookup($a, &$results) {
|
|||
|
||||
$contacts = array();
|
||||
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
$contacts[] = _contact_detail_for_template($rr);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ function vier_community_info() {
|
|||
$r = suggestion_query(local_user(), 0, 9);
|
||||
|
||||
$tpl = get_markup_template('ch_directory_item.tpl');
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$aside['$comunity_profiles_title'] = t('Community Profiles');
|
||||
$aside['$comunity_profiles_items'] = array();
|
||||
|
@ -176,7 +176,7 @@ function vier_community_info() {
|
|||
0, 9);
|
||||
|
||||
$tpl = get_markup_template('ch_directory_item.tpl');
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$aside['$lastusers_title'] = t('Last users');
|
||||
$aside['$lastusers_items'] = array();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue