Some more cleanup and code removal.
This commit is contained in:
parent
98272fe386
commit
ea3a6ec6eb
5 changed files with 27 additions and 105 deletions
25
boot.php
25
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.
|
||||
*
|
||||
|
|
|
@ -270,8 +270,6 @@
|
|||
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));
|
||||
|
||||
|
|
|
@ -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,47 +858,33 @@ function item_photo_menu($item){
|
|||
if($profile_link === 'mailbox')
|
||||
$profile_link = '';
|
||||
|
||||
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;
|
||||
$zurl = '';
|
||||
}
|
||||
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",
|
||||
$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 ($r[0]["network"] == NETWORK_DIASPORA)
|
||||
$pm_url = 'message/new/' . $cid;
|
||||
|
||||
if($sparkle) {
|
||||
$status_link = $profile_link."?url=status";
|
||||
$photos_link = $profile_link."?url=photos";
|
||||
$profile_link = $profile_link."?url=profile";
|
||||
$zurl = '';
|
||||
} else
|
||||
$cid = 0;
|
||||
}
|
||||
}
|
||||
if(($cid) && (! $item['self'])) {
|
||||
$profile_link = zrl($profile_link);
|
||||
|
||||
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) {
|
||||
if (in_array($network, array(NETWORK_DFRN, NETWORK_DIASPORA)))
|
||||
$pm_url = 'message/new/'.$cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
$menu = Array(
|
||||
|
@ -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
|
||||
|
|
|
@ -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']) : '');
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue