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, 22 insertions, 9 deletions
diff --git a/mod/like.php b/mod/like.php
index ce8bc3063..0fbdd5c30 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -9,14 +9,14 @@ function like_content(&$a) {
$o = '';
- $observer = $a->get_observer();
+ $observer = App::get_observer();
$interactive = $_REQUEST['interactive'];
if($interactive) {
$o .= '<h1>' . t('Like/Dislike') . '</h1>';
$o .= EOL . EOL;
if(! $observer) {
- $_SESSION['return_url'] = $a->query_string;
+ $_SESSION['return_url'] = App::$query_string;
$o .= t('This action is restricted to members.') . EOL;
$o .= t('Please <a href="rmagic">login with your $Projectname ID</a> or <a href="register">register as a new $Projectname member</a> to continue.') . EOL;
return $o;
@@ -107,13 +107,13 @@ function like_content(&$a) {
// to them.
$allow_cid = $allow_gid = $deny_cid = $deny_gid = '';
foreach($d as $dd) {
- $allow_gid .= '<' . $dd['abook_xchan'] . '>';
+ $allow_cid .= '<' . $dd['abook_xchan'] . '>';
}
}
$post_type = t('channel');
$objtype = ACTIVITY_OBJ_PROFILE;
-
+ $profile = $r[0];
}
elseif($obj_type == 'thing') {
@@ -299,7 +299,8 @@ function like_content(&$a) {
$verbs = " '".dbesc($activity)."' ";
- $multi_undo = 0;
+
+ $multi_undo = false;
// event participation and consensus items are essentially radio toggles. If you make a subsequent choice,
// we need to eradicate your first choice.
@@ -310,15 +311,14 @@ function like_content(&$a) {
}
if($activity === ACTIVITY_AGREE || $activity === ACTIVITY_DISAGREE || $activity === ACTIVITY_ABSTAIN) {
$verbs = " '" . dbesc(ACTIVITY_AGREE) . "','" . dbesc(ACTIVITY_DISAGREE) . "','" . dbesc(ACTIVITY_ABSTAIN) . "' ";
- $multi_undo = 1;
+ $multi_undo = true;
}
$item_normal = item_normal();
$r = q("SELECT id, parent, uid, verb FROM item WHERE verb in ( $verbs ) $item_normal
- AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ",
+ AND author_xchan = '%s' AND thr_parent = '%s' and uid = %d ",
dbesc($observer['xchan_hash']),
- intval($item_id),
dbesc($item['mid']),
intval($owner_uid)
);
@@ -338,6 +338,12 @@ function like_content(&$a) {
// don't fall through and create another
if(activity_match($rr['verb'],$activity))
$multi_undo = false;
+
+ // drop_item was not done interactively, so we need to invoke the notifier
+ // in order to push the changes to connections
+
+ proc_run('php','include/notifier.php','drop',$rr['id']);
+
}
if($interactive)
@@ -438,7 +444,7 @@ function like_content(&$a) {
$arr['thr_parent'] = $item['mid'];
$ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
- $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
$allow_cid = $item['allow_cid'];
$allow_gid = $item['allow_gid'];
$deny_cid = $item['deny_cid'];
@@ -462,6 +468,13 @@ function like_content(&$a) {
if($obj_type === 'thing' && $r[0]['imgurl']) {
$arr['body'] .= "\n\n[zmg=80x80]" . $r[0]['imgurl'] . '[/zmg]';
}
+ if($obj_type === 'profile') {
+ if($public) {
+ $arr['body'] .= "\n\n" . '[embed]' . z_root() . '/profile/' . $ch[0]['channel_address'] . '[/embed]';
+ }
+ else
+ $arr['body'] .= "\n\n[zmg=80x80]" . $profile['thumb'] . '[/zmg]';
+ }
$arr['verb'] = $activity;