diff options
Diffstat (limited to 'mod/photos.php')
-rw-r--r-- | mod/photos.php | 90 |
1 files changed, 35 insertions, 55 deletions
diff --git a/mod/photos.php b/mod/photos.php index 789e26949..7da3d3e92 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -184,12 +184,13 @@ function photos_post(&$a) { intval($page_owner_uid), dbesc($r[0]['resource_id']) ); - $i = q("SELECT * FROM `item` WHERE `resource_id` = '%s' AND `uid` = %d LIMIT 1", + $i = q("SELECT * FROM `item` WHERE `resource_id` = '%s' AND resource_type = 'photo' and `uid` = %d LIMIT 1", dbesc($r[0]['resource_id']), intval($page_owner_uid) ); if(count($i)) { - q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent_mid` = '%s' AND `uid` = %d", + q("UPDATE `item` SET item_restrict = (item_restrict & %d), `edited` = '%s', `changed` = '%s' WHERE `parent_mid` = '%s' AND `uid` = %d", + intval(ITEM_DELETED), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc($i[0]['mid']), @@ -851,7 +852,7 @@ function photos_content(&$a) { // fetch image, item containing image, then comments - $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' + $ph = q("SELECT aid,uid,xchan,resource_id,created,edited,title,`desc`,album,filename,`type`,height,width,`size`,scale,profile,photo_flags,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' and (photo_flags = %d or photo_flags = %d ) $sql_extra ORDER BY `scale` ASC ", intval($owner_uid), dbesc($datum), @@ -873,7 +874,7 @@ function photos_content(&$a) { intval(PHOTO_PROFILE) ); if($ph) - notice( t('Permission denied. Access to this item may be restricted.')); + notice( t('Permission denied. Access to this item may be restricted.') . EOL); else notice( t('Photo not available') . EOL ); return; @@ -975,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']) ); @@ -1003,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) { @@ -1093,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; @@ -1120,39 +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 = zid($item['author']['xchan_url']); + $sparkle = ''; - if(local_user() && ($item['contact-uid'] == local_user()) - && ($item['network'] == 'dfrn') && (! $item['self'] )) { - $profile_url = $redirect_url; - $sparkle = ' sparkle'; - } - else { - $profile_url = $item['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; @@ -1166,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, @@ -1180,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); } @@ -1209,6 +1187,8 @@ function photos_content(&$a) { '$comments' => $comments, '$paginate' => $paginate, )); + + $a->data['photo_html'] = $o; return $o; } |