diff options
-rw-r--r-- | include/conversation.php | 1 | ||||
-rw-r--r-- | mod/photos.php | 71 |
2 files changed, 28 insertions, 44 deletions
diff --git a/include/conversation.php b/include/conversation.php index bd1e12c4e..8648209e9 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1150,6 +1150,7 @@ function conv_sort($arr,$order) { elseif(stristr($order,'ascending')) usort($parents,'sort_thr_created_rev'); + if(count($parents)) foreach($parents as $i=>$_x) $parents[$i]['children'] = get_item_children($arr, $_x); 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); } |