diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 6ab8d584a0..c5c05134ae 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -32,13 +32,13 @@ function get_atom_elements($item) { if($rawedited) $res['edited'] = $rawcreated[0]['data']; - $rawowner = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0", 'owner'); + $rawowner = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0', 'owner'); if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']) - $res['owner-name'] = rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']; + $res['owner-name'] = $rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']; if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']) - $res['owner-link'] = rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']; + $res['owner-link'] = $rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']; if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']) - $res['owner-avatar'] = rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']; + $res['owner-avatar'] = $rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']; return $res; @@ -55,10 +55,11 @@ function post_remote($arr) { $arr['owner-name'] = notags(trim($arr['owner-name'])); $arr['owner-link'] = notags(trim($arr['owner-link'])); $arr['owner-avatar'] = notags(trim($arr['owner-avatar'])); - if(! strlen($arr['remote-avatar'])) - $arr['remote-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg'; - if(! strlen($arr['owner-avatar'])) - $arr['owner-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg'; +// must pass $a +// if(! strlen($arr['remote-avatar'])) +// $arr['remote-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg'; +// if(! strlen($arr['owner-avatar'])) +// $arr['owner-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg'; $arr['created'] = datetime_convert('UTC','UTC',$arr['created'],'Y-m-d H:i:s'); $arr['edited'] = datetime_convert('UTC','UTC',$arr['edited'],'Y-m-d H:i:s'); $arr['title'] = notags(trim($arr['title'])); diff --git a/mod/item.php b/mod/item.php index 3340183b0b..437e6ac596 100644 --- a/mod/item.php +++ b/mod/item.php @@ -22,7 +22,7 @@ function item_post(&$a) { ); if(! count($r)) { notice("Unable to locate original post." . EOL); - goaway($a->get_baseurl() . "/profile/$profile_uid"); + goaway($a->get_baseurl() . "/" . $_POST['return'] ); } $parent_item = $r[0]; } @@ -67,23 +67,32 @@ function item_post(&$a) { if(! strlen($body)) { notice("Empty post discarded." . EOL ); - goaway($a->get_baseurl() . "/profile/$profile_uid"); + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + } + // get contact info for poster if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id']))) $contact_id = $_SESSION['visitor_id']; else { $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($_SESSION['uid'])); - if(count($r)) { - $contact_record = $r[0]; + if(count($r)) $contact_id = $r[0]['id']; - } - } + } + + // get contact info for owner + + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", + intval($profile_uid) + ); + if(count($r)) + $contact_record = $r[0]; + $notify_type = (($parent) ? 'comment-new' : 'wall-new' ); - if($_POST['type'] == 'jot') { + if(($_POST['type'] == 'wall') || ($_POST['type'] == 'wall-comment')) { do { $dups = false; @@ -99,7 +108,7 @@ function item_post(&$a) { `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`) VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )", intval($profile_uid), - "jot", + dbesc($_POST['type']), intval($contact_id), dbesc($contact_record['name']), dbesc($contact_record['url']), @@ -154,12 +163,6 @@ function item_post(&$a) { array(),$foo)); } - goaway($a->get_baseurl() . "/profile/$profile_uid"); - - - - - - - + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + return; // NOTREACHED } \ No newline at end of file diff --git a/mod/network.php b/mod/network.php index 0dc743533d..7fb12bd39f 100644 --- a/mod/network.php +++ b/mod/network.php @@ -25,6 +25,7 @@ function network_content(&$a) { $tpl = file_get_contents("view/jot.tpl"); $o .= replace_macros($tpl,array( + '$return_path' => $a->cmd, '$baseurl' => $a->get_baseurl(), '$visitor' => 'block', '$lockstate' => 'unlock', @@ -38,8 +39,6 @@ function network_content(&$a) { // and profile to update contact table when names and photos change. // work on item_display and can_write_wall - // Add comments. - $sql_extra = ''; @@ -80,19 +79,38 @@ dbg(2); $wallwall = file_get_contents('view/wallwall_item.tpl'); if(count($r)) { - foreach($r as $rr) { - $comment = ''; + foreach($r as $item) { - if($rr['last-child']) { + $comment = ''; + $template = $tpl; + $commentww = ''; + + if(($item['parent'] == $item['item_id']) && (! $item['self'])) { + if($item['type'] == 'wall') { + $owner_url = $a->contact['url']; + $owner_photo = $a->contact['thumb']; + $owner_name = $a->contact['name']; + $template = $wallwall; + $commentww = 'ww'; + } + if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) { + $owner_url = $item['owner-link']; + $owner_photo = $item['owner-avatar']; + $owner_name = $item['owner-name']; + $template = $wallwall; + $commentww = 'ww'; + } + } + + if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$id' => $rr['item_id'], - '$parent' => $rr['parent'], - '$profile_uid' => $_SESSION['uid'] + '$id' => $item['item_id'], + '$parent' => $item['parent'], + '$profile_uid' => $_SESSION['uid'], + '$ww' => $commentww )); } - $item = $rr; - $template = $tpl; $profile_url = $item['url']; @@ -101,17 +119,11 @@ dbg(2); $photo = $item['photo']; $thumb = $item['thumb']; - + $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']); $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url); $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb); - if(($item['parent'] == $item['item_id']) && (! $item['self'])) { - $template = $wallwall; // FIXME also if remote owner - $owner_url = $a->contact['url']; - $owner_photo = $a->contact['thumb']; - $owner_name = $a->contact['name']; - } $o .= replace_macros($template,array( '$id' => $item['item_id'], diff --git a/mod/profile.php b/mod/profile.php index 76ebe7d844..f3ec57329c 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -51,7 +51,7 @@ function profile_init(&$a) { return; } - if(($remote_user) && ($a->argc > 2) && ($a->argv[2] == 'visit')) + if((remote_user()) && ($a->argc > 2) && ($a->argv[2] == 'visit')) $_SESSION['is_visitor'] = 1; else { unset($_SESSION['is_visitor']); @@ -69,41 +69,6 @@ function profile_init(&$a) { } -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'] ; - - $photo = (($item['self']) ? $a->profile['photo'] : $item['photo']); - $thumb = (($item['self']) ? $a->profile['thumb'] : $item['thumb']); - - $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']); - $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url); - $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb); - -// if(! $item['owner-link']) { -// $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1". - - - - $o .= replace_macros($template,array( - '$id' => $item['item_id'], - '$profile_url' => $profile_link, - '$name' => $profile_name, - '$thumb' => $profile_avatar, - '$body' => bbcode($item['body']), - '$ago' => relative_date($item['created']), - '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''), - '$comment' => $comment - )); - - - return $o; -} - function profile_content(&$a) { @@ -153,6 +118,7 @@ function profile_content(&$a) { $o .= replace_macros($tpl,array( '$baseurl' => $a->get_baseurl(), + '$return_path' => $a->cmd, '$visitor' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? 'block' : 'none'), '$lockstate' => 'unlock', '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl() : ''), @@ -216,7 +182,7 @@ dbg(2); `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 `item`.`deleted` = 0 - AND `contact`.`blocked` = 0 + AND `item`.`type` != 'remote' AND `contact`.`blocked` = 0 $sql_extra ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ", intval($a->profile['uid']), @@ -226,23 +192,85 @@ dbg(2); ); - $template = file_get_contents('view/comment_item.tpl'); - + $cmnt_tpl = file_get_contents('view/comment_item.tpl'); $tpl = file_get_contents('view/wall_item.tpl'); + $wallwall = file_get_contents('view/wallwall_item.tpl'); + + if(count($r)) { - foreach($r as $rr) { + foreach($r as $item) { $comment = ''; + $template = $tpl; + $commentww = ''; + if(($item['parent'] == $item['item_id']) && (! $item['self'])) { + if($item['type'] == 'wall') { + $owner_url = $a->contact['url']; + $owner_photo = $a->contact['thumb']; + $owner_name = $a->contact['name']; + $template = $wallwall; + $commentww = 'ww'; + } + if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) { + $owner_url = $item['owner-link']; + $owner_photo = $item['owner-avatar']; + $owner_name = $item['owner-name']; + $template = $wallwall; + $commentww = 'ww'; + } + } + + + if(can_write_wall($a,$a->profile['profile_uid'])) { - if($rr['last-child']) { - $comment = replace_macros($template,array( - '$id' => $rr['item_id'], - '$parent' => $rr['parent'], - '$profile_uid' => $a->profile['profile_uid'] + if($item['last-child']) { + $comment = replace_macros($cmnt_tpl,array( + '$id' => $item['item_id'], + '$parent' => $item['parent'], + '$profile_uid' => $a->profile['profile_uid'], + '$ww' => $commentww )); } } - $o .= item_display($a,$rr,$tpl,$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'] ; + + // $photo = (($item['self']) ? $a->profile['photo'] : $item['photo']); + // $thumb = (($item['self']) ? $a->profile['thumb'] : $item['thumb']); + + $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']); + $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url); + $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $item['thumb']); + + + + $o .= replace_macros($template,array( + '$id' => $item['item_id'], + '$profile_url' => $profile_link, + '$name' => $profile_name, + '$thumb' => $profile_avatar, + '$body' => bbcode($item['body']), + '$ago' => relative_date($item['created']), + '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''), + '$owner_url' => $owner_url, + '$owner_photo' => $owner_photo, + '$owner_name' => $owner_name, + '$comment' => $comment + )); + + + + + + + + + + } } diff --git a/view/comment_item.tpl b/view/comment_item.tpl index d6dcd8e4a0..530244e8ee 100644 --- a/view/comment_item.tpl +++ b/view/comment_item.tpl @@ -1,8 +1,8 @@ -
+
- + diff --git a/view/jot.tpl b/view/jot.tpl index f7cb49ec49..dca307c391 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -4,8 +4,9 @@ What's on your mind?

- + + diff --git a/view/style.css b/view/style.css index 574e99e837..a8f1abb139 100644 --- a/view/style.css +++ b/view/style.css @@ -435,6 +435,11 @@ input#dfrn-url { float: left; } +.wall-item-ago { + color: #888888; + font-size: 0.8em; +} + .wall-item-wrapper-end { clear: both; } @@ -452,6 +457,11 @@ input#dfrn-url { margin-left: 100px; } +.comment-wwedit-wrapper { + margin-top: 15px; + margin-left: 250px; +} + #profile-jot-submit-wrapper { margin-top: 15px; diff --git a/view/wallwall_item.tpl b/view/wallwall_item.tpl index ac3a4e34fa..94d0da4fc6 100644 --- a/view/wallwall_item.tpl +++ b/view/wallwall_item.tpl @@ -9,7 +9,7 @@ $name
-$name to $owner_name via Wall-To-Wall:
+
$name to $owner_name via Wall-To-Wall:
$body
$ago