]> git.mxchange.org Git - friendica.git/commitdiff
Some more cleanup and code removal.
authorMichael Vogel <icarus@dabo.de>
Sun, 5 Jun 2016 18:01:38 +0000 (20:01 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 5 Jun 2016 18:01:38 +0000 (20:01 +0200)
boot.php
include/api.php
include/conversation.php
mod/content.php
object/Item.php

index 8434d34c705d3cbb5bef44953f9bdb8b43d45cbf..adfeeb415f554f68cb372f29f7dba096cc6d1d2a 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1896,31 +1896,6 @@ function is_site_admin() {
        return false;
 }
 
-
-function load_contact_links($uid) {
-
-       $a = get_app();
-
-       $ret = array();
-
-       if(! $uid || x($a->contacts,'empty'))
-               return;
-
-       $r = q("SELECT `id`,`network`,`url`,`thumb`, `rel` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''",
-                       intval($uid)
-       );
-       if(count($r)) {
-               foreach($r as $rr){
-                       $url = normalise_link($rr['url']);
-                       $ret[$url] = $rr;
-               }
-       } else
-               $ret['empty'] = true;
-
-       $a->contacts = $ret;
-       return;
-}
-
 /**
  * @brief Returns querystring as string from a mapped array.
  *
index 488e858445648baedf6eb8a0f2a7aa99b936451a..f32dc97c6c4fc5516cb72ad08a12a42766410bef 100644 (file)
                                                        api_login($a);
                                        }
 
-                                       load_contact_links(api_user());
-
                                        logger('API call for ' . $a->user['username'] . ': ' . $a->query_string);
                                        logger('API parameters: ' . print_r($_REQUEST,true));
 
index 8bbd57dbbffa36c920fcf27d3ddbf88763237ecf..18bc94074f05feb102e64757cb00f2af21511e27 100644 (file)
@@ -495,8 +495,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
        else
                $return_url = $_SESSION['return_url'] = $a->query_string;
 
-       load_contact_links(local_user());
-
        $cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
        call_hooks('conversation_start',$cb);
 
@@ -618,13 +616,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                else
                                        $profile_avatar = $item['author-avatar'];
 
-                               // This was the old method. We leave it here at the moment
-                               //$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
-                               //if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
-                               //      $profile_avatar = $a->contacts[$normalised]['thumb'];
-                               //else
-                               //      $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
-
                                $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
                                call_hooks('render_location',$locate);
 
@@ -821,15 +812,7 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
 
        $clean_url = normalise_link($item['author-link']);
 
-       if((local_user()) && (local_user() == $item['uid'])) {
-               if(isset($a->contacts) && x($a->contacts,$clean_url)) {
-                       if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
-                               $best_url = 'redir/'.$a->contacts[$clean_url]['id'];
-                               $sparkle = true;
-                       } else
-                               $best_url = $a->contacts[$clean_url]['url'];
-               }
-       } elseif (local_user()) {
+       if (local_user()) {
                $r = q("SELECT `id` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s' LIMIT 1",
                        dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url)));
                if ($r) {
@@ -854,11 +837,9 @@ function item_photo_menu($item){
 
        $ssl_state = false;
 
-       if(local_user()) {
+       if(local_user())
                $ssl_state = true;
-                if(! count($a->contacts))
-                       load_contact_links(local_user());
-       }
+
        $sub_link="";
        $poke_link="";
        $contact_url="";
@@ -866,6 +847,7 @@ function item_photo_menu($item){
        $status_link="";
        $photos_link="";
        $posts_link="";
+       $network = "";
 
        if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) {
                $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
@@ -876,46 +858,32 @@ function item_photo_menu($item){
        if($profile_link === 'mailbox')
                $profile_link = '';
 
+       $cid = 0;
+       $network = "";
+       $rel = 0;
+       $r = q("SELECT `id`, `network`, `rel` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
+               intval(local_user()), dbesc(normalise_link($item['author-link'])));
+       if ($r) {
+               $cid = $r[0]["id"];
+               $network = $r[0]["network"];
+               $rel = $r[0]["rel"];
+       }
+
        if($sparkle) {
-               $cid = intval(basename($profile_link));
-               $status_link = $profile_link . "?url=status";
-               $photos_link = $profile_link . "?url=photos";
-               $profile_link = $profile_link . "?url=profile";
-               $pm_url = 'message/new/' . $cid;
+               $status_link = $profile_link."?url=status";
+               $photos_link = $profile_link."?url=photos";
+               $profile_link = $profile_link."?url=profile";
                $zurl = '';
-       }
-       else {
+       } else
                $profile_link = zrl($profile_link);
-               if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
-                       $cid = $item['contact-id'];
-               } else {
-                       $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
-                               intval(local_user()), dbesc(normalise_link($item['author-link'])));
-                       if ($r) {
-                               $cid = $r[0]["id"];
-
-                               if ($r[0]["network"] == NETWORK_DIASPORA)
-                                       $pm_url = 'message/new/' . $cid;
-
-                       } else
-                               $cid = 0;
-               }
-       }
-       if(($cid) && (! $item['self'])) {
-               $poke_link = 'poke/?f=&c=' . $cid;
-               $contact_url = 'contacts/' . $cid;
-               $posts_link = 'contacts/' . $cid . '/posts';
 
-               $clean_url = normalise_link($item['author-link']);
-
-               if((local_user()) && (local_user() == $item['uid'])) {
-                       if(isset($a->contacts) && x($a->contacts,$clean_url)) {
-                               if($a->contacts[$clean_url]['network'] === NETWORK_DIASPORA) {
-                                       $pm_url = 'message/new/' . $cid;
-                               }
-                       }
-               }
+       if($cid && !$item['self']) {
+               $poke_link = 'poke/?f=&c='.$cid;
+               $contact_url = 'contacts/'.$cid;
+               $posts_link = 'contacts/'.$cid.'/posts';
 
+               if (in_array($network, array(NETWORK_DFRN, NETWORK_DIASPORA)))
+                       $pm_url = 'message/new/'.$cid;
        }
 
        if (local_user()) {
@@ -929,10 +897,10 @@ function item_photo_menu($item){
                        t("Send PM") => $pm_url
                );
 
-               if ($a->contacts[$clean_url]['network'] === NETWORK_DFRN)
+               if ($network == NETWORK_DFRN)
                        $menu[t("Poke")] = $poke_link;
 
-               if ((($cid == 0) OR ($a->contacts[$clean_url]['rel'] == CONTACT_IS_FOLLOWER)) AND
+               if ((($cid == 0) OR ($rel == CONTACT_IS_FOLLOWER)) AND
                        in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
                        $menu[t("Connect/Follow")] = "follow?url=".urlencode($item['author-link']);
        } else
index cecdfd00017edb1147b65f8460d0aa91d2789d8d..71ed927636623ed5eb504d366772c273b0646256 100644 (file)
@@ -423,12 +423,6 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                else
                                        $profile_avatar = $item['author-avatar'];
 
-                               //$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
-                               //if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
-                               //      $profile_avatar = $a->contacts[$normalised]['thumb'];
-                               //else
-                               //      $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
-
                                $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
                                call_hooks('render_location',$locate);
 
@@ -801,12 +795,6 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                else
                                        $profile_avatar = $item['author-avatar'];
 
-                               //$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
-                               //if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
-                               //      $profile_avatar = $a->contacts[$normalised]['thumb'];
-                               //else
-                               //      $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar']) && $diff_author) ? $item['author-avatar'] : $thumb));
-
                                $like    = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
                                $dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
 
index a27ff32f9c82a971584b0752bd773ac3c2a728ac..9dc35e82f1ca8686e7dc894aa0852e2a26aac3db 100644 (file)
@@ -157,13 +157,6 @@ class Item extends BaseObject {
                else
                        $profile_avatar = $item['author-avatar'];
 
-               // This was the old method. We leave it here at the moment
-               //$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
-               //if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
-               //      $profile_avatar = $a->contacts[$normalised]['thumb'];
-               //else
-               //      $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->remove_baseurl($this->get_data_value('thumb')));
-
                $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
                call_hooks('render_location',$locate);
                $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));