X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Flike.php;h=4f6d6cd6d776833b760203705ba2f543a1824743;hb=7cb4ea52fd5ad84df71a0aa1a5f25d311cf1aa58;hp=aef3473c30b56d953948cc09dcb8941d1cf82eb7;hpb=0077494396a963b748f30a1e47f75fe097189956;p=friendica.git diff --git a/mod/like.php b/mod/like.php index aef3473c30..4f6d6cd6d7 100755 --- a/mod/like.php +++ b/mod/like.php @@ -26,18 +26,6 @@ function like_content(&$a) { case 'undislike': $activity = ACTIVITY_DISLIKE; break; - case 'agree': - case 'unagree': - $activity = ACTIVITY_AGREE; - break; - case 'disagree': - case 'undisagree': - $activity = ACTIVITY_DISAGREE; - break; - case 'abstain': - case 'unabstain': - $activity = ACTIVITY_ABSTAIN; - break; case 'attendyes': case 'unattendyes': $activity = ACTIVITY_ATTEND; @@ -132,11 +120,18 @@ function like_content(&$a) { // See if we've been passed a return path to redirect to $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : ''); + $verbs = " '".dbesc($activity)."' "; + + // event participation are essentially radio toggles. If you make a subsequent choice, + // we need to eradicate your first choice. + if($activity === ACTIVITY_ATTEND || $activity === ACTIVITY_ATTENDNO || $activity === ACTIVITY_ATTENDMAYBE) { + $verbs = " '" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' "; + } - $r = q("SELECT `id`, `guid` FROM `item` WHERE `verb` = '%s' AND `deleted` = 0 + $r = q("SELECT `id`, `guid` FROM `item` WHERE `verb` IN ( $verbs ) AND `deleted` = 0 AND `contact-id` = %d AND `uid` = %d AND (`parent` = '%s' OR `parent-uri` = '%s' OR `thr-parent` = '%s') LIMIT 1", - dbesc($activity), intval($contact['id']), intval($owner_uid), + intval($contact['id']), intval($owner_uid), dbesc($item_id), dbesc($item_id), dbesc($item['uri']) ); @@ -192,12 +187,6 @@ EOT; $bodyverb = t('%1$s likes %2$s\'s %3$s'); if($verb === 'dislike') $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); - if($verb === 'agree') - $bodyverb = t('%1$s agrees with %2$s\'s %3$s'); - if($verb === 'disagree') - $bodyverb = t('%1$s doesn\'t agree with %2$s\'s %3$s'); - if($verb === 'abstain') - $bodyverb = t('%1$s abstains from a decision on %2$s\'s %3$s'); if($verb === 'attendyes') $bodyverb = t('%1$s is attending %2$s\'s %3$s'); if($verb === 'attendno')