]> git.mxchange.org Git - friendica.git/blobdiff - mod/common.php
Merge branch 'develop' into rewrites/dbm_is_result
[friendica.git] / mod / common.php
index c9409b3ef1eaa041f57b8ff68c9c32b28a3afe38..ab27dc667a72dd990516561f4ff9b87cebcb6a89 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 require_once('mod/contacts.php');
 
-function common_content(&$a) {
+function common_content(App &$a) {
 
        $o = '';
 
@@ -40,7 +40,7 @@ function common_content(&$a) {
                $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array(
                        '$name' => htmlentities($c[0]['name']),
                        '$photo' => $c[0]['photo'],
-                       'url' => z_root() . '/contacts/' . $cid
+                       'url' => 'contacts/' . $cid
                ));
 
                if(! x($a->page,'aside'))
@@ -48,8 +48,9 @@ function common_content(&$a) {
                $a->page['aside'] .= $vcard_widget;
        }
 
-       if(! count($c))
+       if (! dbm::is_result($c)) {
                return;
+       }
 
        if(! $cid) {
                if(get_my_url()) {
@@ -57,13 +58,13 @@ function common_content(&$a) {
                                dbesc(normalise_link(get_my_url())),
                                intval($profile_uid)
                        );
-                       if(count($r))
+                       if (dbm::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 (dbm::is_result($r))
                                        $zcid = $r[0]['id'];
                        }
                }
@@ -94,13 +95,13 @@ function common_content(&$a) {
                $r = common_friends_zcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
 
 
-       if(! count($r)) {
+       if (! dbm::is_result($r)) {
                return $o;
        }
 
        $id = 0;
 
-       foreach($r as $rr) {
+       foreach ($r as $rr) {
 
                //get further details of the contact
                $contact_details = get_contact_details_by_url($rr['url'], $uid);
@@ -109,18 +110,18 @@ function common_content(&$a) {
                $rr[id] = $rr[cid];
 
                $photo_menu = '';
-               $photo_menu = contact_photo_menu ($rr);
+               $photo_menu = contact_photo_menu($rr);
 
                $entry = array(
                        'url'           => $rr['url'],
                        'itemurl'       => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
-                       'name'          => $rr['name'],
-                       'thumb'         => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
-                       'img_hover'     => htmlentities($rr['name']),
+                       'name'          => $contact_details['name'],
+                       'thumb'         => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
+                       'img_hover'     => htmlentities($contact_details['name']),
                        'details'       => $contact_details['location'],
                        'tags'          => $contact_details['keywords'],
                        'about'         => $contact_details['about'],
-                       'account_type'  => (($contact_details['community']) ? t('Forum') : ''),
+                       'account_type'  => account_type($contact_details),
                        'network'       => network_to_name($contact_details['network'], $contact_details['url']),
                        'photo_menu'    => $photo_menu,
                        'id'            => ++$id,