]> git.mxchange.org Git - friendica.git/blobdiff - mod/common.php
Merge pull request #2135 from rabuzarus/doxygen
[friendica.git] / mod / common.php
index caf2f7ea5ea8b5fc03ccf316cade7a9ab120c77b..08609222972e68dfcd832647f2709d2fbe619967 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
 require_once('include/socgraph.php');
+require_once('include/Contact.php');
+require_once('include/contact_selectors.php');
 
 function common_content(&$a) {
 
@@ -11,8 +13,14 @@ function common_content(&$a) {
        $cid = intval($a->argv[3]);
        $zcid = 0;
 
+       if (! local_user()) {
+               notice( t('Permission denied.') . EOL);
+               return;
+       }
+
        if($cmd !== 'loc' && $cmd != 'rem')
                return;
+
        if(! $uid)
                return;
 
@@ -62,7 +70,7 @@ function common_content(&$a) {
 
 
        if($cid == 0 && $zcid == 0)
-               return; 
+               return;
 
 
        if($cid)
@@ -93,14 +101,28 @@ function common_content(&$a) {
 
        foreach($r as $rr) {
 
+               //get further details of the contact
+               $contact_details = get_contact_details_by_url($rr['url'], $uid);
+
+               // $rr[id] is needed to use contact_photo_menu()
+               $rr[id] = $rr[cid];
+
+               $photo_menu = '';
+               $photo_menu = contact_photo_menu ($rr);
+
                $entry = array(
-                       'url' => $rr['url'],
-                       'itemurl' => $rr['url'],
-                       'name' => htmlentities($rr['name']),
-                       'thumb' => $rr['photo'],
-                       'img_hover' => htmlentities($rr['name']),
-                       'tags' => '',
-                       'id' => ++$id,
+                       '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']),
+                       'details'       => $contact_details['location'],
+                       'tags'          => $contact_details['keywords'],
+                       'about'         => $contact_details['about'],
+                       'account_type'  => (($contact_details['community']) ? t('Forum') : ''),
+                       'network'       => network_to_name($contact_details['network'], $contact_details['url']),
+                       'photo_menu'    => $photo_menu,
+                       'id'            => ++$id,
                );
                $entries[] = $entry;
        }