aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-09 19:57:02 -0800
committerfriendica <info@friendica.com>2012-12-09 19:57:02 -0800
commit47235e5b32d8e38f4f849af5458ee1c1715522e0 (patch)
tree45c2d6736c56a6649fcd75bc7232a41b69d30b28
parentf8c33243bf0440c6ddab63dbf3a755e4d506122b (diff)
downloadvolse-hubzilla-47235e5b32d8e38f4f849af5458ee1c1715522e0.tar.gz
volse-hubzilla-47235e5b32d8e38f4f849af5458ee1c1715522e0.tar.bz2
volse-hubzilla-47235e5b32d8e38f4f849af5458ee1c1715522e0.zip
start whipping the item photo menu into shape
-rw-r--r--boot.php10
-rw-r--r--include/conversation.php54
2 files changed, 22 insertions, 42 deletions
diff --git a/boot.php b/boot.php
index f1ce32dbc..c8d467515 100644
--- a/boot.php
+++ b/boot.php
@@ -1770,13 +1770,13 @@ if(! function_exists('load_contact_links')) {
if(! $uid || x($a->contacts,'empty'))
return;
- $r = q("SELECT `id`,`network`,`url`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ",
- intval($uid)
+ $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d) ",
+ intval($uid),
+ intval(ABOOK_FLAG_SELF)
);
- if(count($r)) {
+ if($r) {
foreach($r as $rr){
- $url = normalise_link($rr['url']);
- $ret[$url] = $rr;
+ $ret[$rr['xchan_hash']] = $rr;
}
}
else
diff --git a/include/conversation.php b/include/conversation.php
index ef0781b09..f910801ba 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -712,7 +712,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
}}
-function best_link_url($item,&$sparkle,$ssl_state = false) {
+function best_link_url($item) {
$a = get_app();
@@ -745,60 +745,40 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
if(! function_exists('item_photo_menu')){
function item_photo_menu($item){
$a = get_app();
+ $contact = null;
$ssl_state = false;
if(local_user()) {
$ssl_state = true;
- if(! count($a->contacts))
+ if(! count($a->contacts))
load_contact_links(local_user());
+ $channel = $a->get_channel();
+ $channel_hash = (($channel) ? $channel['channel_hash'] : '');
}
+
$sub_link="";
$poke_link="";
$contact_url="";
$pm_url="";
- $status_link="";
- $photos_link="";
- $posts_link="";
- if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) {
+ if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id']
+ && $channel && ($channel_hash != $item['author_xchan'])) {
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
}
- $sparkle = false;
- $profile_link = best_link_url($item,$sparkle,$ssl_state);
+ $profile_link = z_root() . "/chanview/?f=&hash=" . $item['author_xchan'];
+ $pm_url = $a->get_baseurl($ssl_state) . '/message/new/?f=&hash=' . $item['author_xchan'];
- 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 = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
- $zurl = '';
- }
- else {
- $profile_link = zid($profile_link);
- if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
- $cid = $item['contact-id'];
- }
- else {
- $cid = 0;
- }
- }
- if(($cid) && (! $item['self'])) {
- $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid;
- $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
- $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
+ if($a->contacts && array_key_exists($item['author_xchan'],$a->contacts))
+ $contact = $a->contacts[$item['author_xchan']];
- $clean_url = normalise_link($item['author-link']);
+ if($contact) {
+ $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $contact['abook_id'];
+ $contact_url = $a->get_baseurl($ssl_state) . '/connnections/' . $contact['abook_id'];
+ $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $contact['abook_id'];
- 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 = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
- }
- }
- }
+ $clean_url = normalise_link($item['author-link']);
}