aboutsummaryrefslogtreecommitdiffstats
path: root/mod/like.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/like.php')
-rwxr-xr-xmod/like.php31
1 files changed, 18 insertions, 13 deletions
diff --git a/mod/like.php b/mod/like.php
index e79ff5f48..57939885a 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -241,9 +241,10 @@ function like_content(&$a) {
// get the item. Allow linked photos (which are normally hidden) to be liked
- $r = q("SELECT * FROM item WHERE id = %d and (item_restrict = 0 or item_restrict = %d) LIMIT 1",
- intval($item_id),
- intval(ITEM_HIDDEN)
+ $r = q("SELECT * FROM item WHERE id = %d
+ and item_blocked = 0 and item_moderated = 0 and item_spam = 0
+ and item_deleted = 0 and item_unpublished = 0 and item_delayed_publish = 0 LIMIT 1",
+ intval($item_id)
);
if(! $item_id || (! $r)) {
@@ -338,9 +339,12 @@ function like_content(&$a) {
$mid = item_message_id();
- if($extended_like) {
- $item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN|ITEM_WALL;
+ $arr = array();
+ if($extended_like) {
+ $arr['item_thread_top'] = 1;
+ $arr['item_origin'] = 1;
+ $arr['item_wall'] = 1;
}
else {
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
@@ -372,18 +376,19 @@ function like_content(&$a) {
),
));
- if(! ($item['item_flags'] & ITEM_THREAD_TOP))
+ if(! intval($item['item_thread_top']))
$post_type = 'comment';
- $item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN;
- if($item['item_flags'] & ITEM_WALL)
- $item_flags |= ITEM_WALL;
+ $arr['item_origin'] = 1;
+ $arr['item_notshown'] = 1;
+
+ if(intval($item['item_wall']))
+ $arr['item_wall'] = 1;
// if this was a linked photo and was hidden, unhide it.
- if($item['item_restrict'] & ITEM_HIDDEN) {
- $r = q("update item set item_restrict = (item_restrict ^ %d) where id = %d",
- intval(ITEM_HIDDEN),
+ if(intval($item['item_hidden'])) {
+ $r = q("update item set item_hidden = 0 where id = %d",
intval($item['id'])
);
}
@@ -411,7 +416,6 @@ function like_content(&$a) {
killme();
- $arr = array();
if($extended_like) {
$ulink = '[zrl=' . $ch[0]['xchan_url'] . ']' . $ch[0]['xchan_name'] . '[/zrl]';
@@ -437,6 +441,7 @@ function like_content(&$a) {
$arr['aid'] = (($extended_like) ? $ch[0]['channel_account_id'] : $owner_aid);
$arr['uid'] = $owner_uid;
$arr['item_flags'] = $item_flags;
+ $arr['item_wall'] = $item_wall;
$arr['parent_mid'] = (($extended_like) ? $mid : $item['mid']);
$arr['owner_xchan'] = (($extended_like) ? $ch[0]['xchan_hash'] : $thread_owner['xchan_hash']);
$arr['author_xchan'] = $observer['xchan_hash'];