From c877d8f9fae246812930c2f2c45db40a52b09366 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Aug 2013 17:57:45 -0700 Subject: It's a wretched mess, but at least photo comments show up again when viewing the photo. This is just temporary until these conversations are merged into the common conversation viewer, so it's not worth spending a lot of time cleaning up the remnants. --- mod/photos.php | 71 ++++++++++++++++++++++------------------------------------ 1 file changed, 27 insertions(+), 44 deletions(-) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index e122203eb..7da3d3e92 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -976,14 +976,14 @@ function photos_content(&$a) { $sql_extra LIMIT 1", dbesc($datum) ); + if($linked_items) { $link_item = $linked_items[0]; - $r = q("select * from item where parent_mid = '%s' and mid != '%s' + $r = q("select * from item where parent_mid = '%s' and item_restrict = 0 and uid = %d $sql_extra ", dbesc($link_item['mid']), - dbesc($link_item['mid']), intval($link_item['uid']) ); @@ -1004,6 +1004,9 @@ function photos_content(&$a) { } } + // FIXME - remove this when we move to conversation module + + $r = $r[0]['children']; $edit = null; if($can_post) { @@ -1094,23 +1097,6 @@ function photos_content(&$a) { - if($can_post || $a->data['perms']['post_comments']) { - $comments .= replace_macros($cmnt_tpl,array( - '$return_path' => '', - '$jsreload' => $return_url, - '$type' => 'wall-comment', - '$id' => $link_item['id'], - '$parent' => $link_item['id'], - '$profile_uid' => $owner_uid, - '$mylink' => $contact['url'], - '$mytitle' => t('This is you'), - '$myphoto' => $contact['thumb'], - '$comment' => t('Comment'), - '$submit' => t('Submit'), - '$ww' => '' - )); - } - foreach($r as $item) { $comment = ''; $template = $tpl; @@ -1121,33 +1107,13 @@ function photos_content(&$a) { $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if($can_post || $a->data['perms']['post_comments']) { - $comments .= replace_macros($cmnt_tpl,array( - '$return_path' => '', - '$jsreload' => $return_url, - '$type' => 'wall-comment', - '$id' => $item['item_id'], - '$parent' => $item['parent'], - '$profile_uid' => $owner_uid, - '$mylink' => $contact['url'], - '$mytitle' => t('This is you'), - '$myphoto' => $contact['thumb'], - '$comment' => t('Comment'), - '$submit' => t('Submit'), - '$sourceapp' => t($a->sourcename), - '$ww' => '' - )); - } - - $profile_url = $item['url']; + $profile_url = zid($item['author']['xchan_url']); $sparkle = ''; - - $diff_author = (($item['url'] !== $item['author-link']) ? true : false); - $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); - $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']); + $profile_name = $item['author']['xchan_name']; + $profile_avatar = $item['author']['xchan_photo_m']; $profile_link = $profile_url; @@ -1161,7 +1127,6 @@ function photos_content(&$a) { $title_e = $item['title']; $body_e = bbcode($item['body']); - $comments .= replace_macros($template,array( '$id' => $item['item_id'], '$profile_url' => $profile_link, @@ -1175,9 +1140,27 @@ function photos_content(&$a) { '$drop' => $drop, '$comment' => $comment )); + + } + + if($can_post || $a->data['perms']['post_comments']) { + $comments .= replace_macros($cmnt_tpl,array( + '$return_path' => '', + '$jsreload' => $return_url, + '$type' => 'wall-comment', + '$id' => $link_item['id'], + '$parent' => $link_item['id'], + '$profile_uid' => $owner_uid, + '$mylink' => $contact['url'], + '$mytitle' => t('This is you'), + '$myphoto' => $contact['thumb'], + '$comment' => t('Comment'), + '$submit' => t('Submit'), + '$ww' => '' + )); } - } + } $paginate = paginate($a); } -- cgit v1.2.3