aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profile.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-05 21:39:55 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-05 21:39:55 -0700
commit6817c5d59ad578370a2b60dbdcdba16e43dbac65 (patch)
tree3c24b1b920273fcd57455c6ab73a16650772be01 /mod/profile.php
parent3713a9291cfb5d9fad160abd8f4a167693171998 (diff)
downloadvolse-hubzilla-6817c5d59ad578370a2b60dbdcdba16e43dbac65.tar.gz
volse-hubzilla-6817c5d59ad578370a2b60dbdcdba16e43dbac65.tar.bz2
volse-hubzilla-6817c5d59ad578370a2b60dbdcdba16e43dbac65.zip
lots of work, 2way friends, comments...
Diffstat (limited to 'mod/profile.php')
-rw-r--r--mod/profile.php41
1 files changed, 36 insertions, 5 deletions
diff --git a/mod/profile.php b/mod/profile.php
index b37d6487c..957d67be3 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -64,15 +64,22 @@ function profile_init(&$a) {
$a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".$a->get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
}
-function item_display($item,$template) {
+function item_display(&$a, $item,$template,$comment) {
+
+
+ $profile_url = $item['url'];
+
+ if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] ))
+ $profile_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
$o .= replace_macros($template,array(
'$id' => $item['item_id'],
- '$profile_url' => $item['url'],
+ '$profile_url' => $profile_url,
'$name' => $item['name'],
'$thumb' => $item['thumb'],
'$body' => bbcode($item['body']),
- '$ago' => relative_date($item['created'])
+ '$ago' => relative_date($item['created']),
+ '$comment' => $comment
));
@@ -89,6 +96,17 @@ function profile_content(&$a) {
// $tpl = file_get_contents('view/profile_tabs.tpl');
+ if(remote_user())
+ $contact_id = $_SESSION['visitor_id'];
+ if(local_user()) {
+ $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+ $_SESSION['uid']
+ );
+ if(count($r))
+ $contact_id = $r[0]['id'];
+ }
+
+
if(can_write_wall($a,$a->profile['profile_uid'])) {
$tpl = file_get_contents('view/jot-header.tpl');
@@ -111,7 +129,8 @@ function profile_content(&$a) {
// Add comments.
- $r = q("SELECT `item`.*, `contact`.`name`, `contact`.`photo`, `contact`.`thumb`, `contact`.`id` AS `cid`
+ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`id` AS `cid`,
+ `contact`.`uid` AS `contact-uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1
AND `contact`.`blocked` = 0
@@ -121,11 +140,23 @@ function profile_content(&$a) {
intval($a->profile['uid'])
);
+ $template = file_get_contents('view/comment_item.tpl');
+
+
+
+
$tpl = file_get_contents('view/wall_item.tpl');
if(count($r)) {
foreach($r as $rr) {
- $o .= item_display($rr,$tpl);
+ $comment = replace_macros($template,array(
+ '$id' => $rr['item_id'],
+ '$profile_uid' => $a->profile['profile_uid']
+ ));
+
+
+
+ $o .= item_display($a,$rr,$tpl,$comment);
}
}
}