mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-20 16:50:41 -04:00
do away with deprecated activity types
This commit is contained in:
@@ -448,13 +448,7 @@ class Activity {
|
||||
|
||||
$ret = [];
|
||||
|
||||
if ($i['verb'] === ACTIVITY_FRIEND) {
|
||||
// Hubzilla 'make-friend' activity, no direct mapping from AS1 to AS2 - make it a note
|
||||
$objtype = 'Note';
|
||||
}
|
||||
else {
|
||||
$objtype = self::activity_obj_mapper($i['obj_type']);
|
||||
}
|
||||
$objtype = self::activity_obj_mapper($i['obj_type']);
|
||||
|
||||
if (intval($i['item_deleted'])) {
|
||||
$ret['type'] = 'Tombstone';
|
||||
@@ -1227,15 +1221,9 @@ class Activity {
|
||||
return $acts[$verb];
|
||||
}
|
||||
|
||||
if (strpos($verb, ACTIVITY_MOOD) !== false)
|
||||
return 'Create';
|
||||
|
||||
if (strpos($verb, ACTIVITY_FRIEND) !== false)
|
||||
return 'Create';
|
||||
|
||||
if (strpos($verb, ACTIVITY_POKE) !== false)
|
||||
return 'Activity';
|
||||
|
||||
// We should return false, however this will trigger an uncaught execption and crash
|
||||
// the delivery system if encountered by the JSON-LDSignature library
|
||||
|
||||
|
||||
@@ -352,8 +352,6 @@ class Apps {
|
||||
'Directory' => t('Directory'),
|
||||
'Help' => t('Help'),
|
||||
'Mail' => t('Mail'),
|
||||
'Mood' => t('Mood'),
|
||||
'Poke' => t('Poke'),
|
||||
'Chat' => t('Chat'),
|
||||
'Search' => t('Search'),
|
||||
'Probe' => t('Probe'),
|
||||
|
||||
@@ -22,9 +22,6 @@ class Like extends Controller {
|
||||
'like' => 'Like',
|
||||
'dislike' => 'Dislike',
|
||||
'announce' => ACTIVITY_SHARE,
|
||||
'agree' => ACTIVITY_AGREE,
|
||||
'disagree' => ACTIVITY_DISAGREE,
|
||||
'abstain' => ACTIVITY_ABSTAIN,
|
||||
'attendyes' => 'Accept',
|
||||
'attendno' => 'Reject',
|
||||
'attendmaybe' => 'TentativeAccept'
|
||||
@@ -372,17 +369,13 @@ class Like extends Controller {
|
||||
|
||||
$multi_undo = false;
|
||||
|
||||
// event participation and consensus items are essentially radio toggles. If you make a subsequent choice,
|
||||
// event participation items are essentially radio toggles. If you make a subsequent choice,
|
||||
// we need to eradicate your first choice.
|
||||
|
||||
if (in_array($activity, ['Accept', 'Reject', 'TentativeAccept', ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE])) {
|
||||
$verbs = "'Accept','Reject','TentativeAccept','" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' ";
|
||||
$multi_undo = true;
|
||||
}
|
||||
if ($activity === ACTIVITY_AGREE || $activity === ACTIVITY_DISAGREE || $activity === ACTIVITY_ABSTAIN) {
|
||||
$verbs = " '" . dbesc(ACTIVITY_AGREE) . "','" . dbesc(ACTIVITY_DISAGREE) . "','" . dbesc(ACTIVITY_ABSTAIN) . "' ";
|
||||
$multi_undo = true;
|
||||
}
|
||||
|
||||
$item_normal = item_normal();
|
||||
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
require_once('include/security.php');
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
|
||||
|
||||
class Mood extends Controller {
|
||||
|
||||
function init() {
|
||||
|
||||
if(! local_channel())
|
||||
return;
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Mood')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = local_channel();
|
||||
$channel = App::get_channel();
|
||||
$verb = ((isset($_GET['verb'])) ? notags(trim($_GET['verb'])) : '');
|
||||
|
||||
if(! $verb)
|
||||
return;
|
||||
|
||||
$verbs = get_mood_verbs();
|
||||
|
||||
if(! array_key_exists($verb,$verbs))
|
||||
return;
|
||||
|
||||
$activity = ACTIVITY_MOOD . '#' . urlencode($verb);
|
||||
|
||||
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0);
|
||||
|
||||
|
||||
logger('mood: verb ' . $verb, LOGGER_DEBUG);
|
||||
|
||||
|
||||
if($parent) {
|
||||
$r = q("select mid, owner_xchan, private, allow_cid, allow_gid, deny_cid, deny_gid
|
||||
from item where id = %d and parent = %d and uid = %d limit 1",
|
||||
intval($parent),
|
||||
intval($parent),
|
||||
intval($uid)
|
||||
);
|
||||
if(count($r)) {
|
||||
$parent_mid = $r[0]['mid'];
|
||||
$private = $r[0]['item_private'];
|
||||
$allow_cid = $r[0]['allow_cid'];
|
||||
$allow_gid = $r[0]['allow_gid'];
|
||||
$deny_cid = $r[0]['deny_cid'];
|
||||
$deny_gid = $r[0]['deny_gid'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$private = 0;
|
||||
|
||||
$allow_cid = $channel['channel_allow_cid'];
|
||||
$allow_gid = $channel['channel_allow_gid'];
|
||||
$deny_cid = $channel['channel_deny_cid'];
|
||||
$deny_gid = $channel['channel_deny_gid'];
|
||||
}
|
||||
|
||||
$poster = App::get_observer();
|
||||
|
||||
$uuid = item_message_id();
|
||||
$mid = z_root() . '/item/' . $uuid;
|
||||
|
||||
$action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['aid'] = get_account_id();
|
||||
$arr['uid'] = $uid;
|
||||
$arr['uuid'] = $uuid;
|
||||
$arr['mid'] = $mid;
|
||||
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid);
|
||||
$arr['author_xchan'] = $poster['xchan_hash'];
|
||||
$arr['owner_xchan'] = (($parent_mid) ? $r[0]['owner_xchan'] : $poster['xchan_hash']);
|
||||
$arr['title'] = '';
|
||||
$arr['allow_cid'] = $allow_cid;
|
||||
$arr['allow_gid'] = $allow_gid;
|
||||
$arr['deny_cid'] = $deny_cid;
|
||||
$arr['deny_gid'] = $deny_gid;
|
||||
$arr['item_private'] = $private;
|
||||
$arr['verb'] = $activity;
|
||||
$arr['body'] = $action;
|
||||
$arr['item_origin'] = 1;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['item_unseen'] = 1;
|
||||
if(! $parent_mid)
|
||||
$item['item_thread_top'] = 1;
|
||||
|
||||
if ((! $arr['plink']) && intval($arr['item_thread_top'])) {
|
||||
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']);
|
||||
}
|
||||
|
||||
|
||||
$post = item_store($arr);
|
||||
$item_id = $post['item_id'];
|
||||
|
||||
if($item_id) {
|
||||
\Zotlabs\Daemon\Master::Summon(array('Notifier','activity', $item_id));
|
||||
}
|
||||
|
||||
call_hooks('post_local_end', $arr);
|
||||
|
||||
if($_SESSION['return_url'])
|
||||
goaway(z_root() . '/' . $_SESSION['return_url']);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get() {
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Mood')) {
|
||||
//Do not display any associated widgets at this point
|
||||
App::$pdl = '';
|
||||
$papp = Apps::get_papp('Mood');
|
||||
return Apps::app_render($papp, 'module');
|
||||
}
|
||||
|
||||
nav_set_selected('Mood');
|
||||
|
||||
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
|
||||
|
||||
$verbs = get_mood_verbs();
|
||||
|
||||
$shortlist = array();
|
||||
foreach($verbs as $k => $v)
|
||||
if($v !== 'NOTRANSLATION')
|
||||
$shortlist[] = array($k,$v);
|
||||
|
||||
|
||||
$tpl = get_markup_template('mood_content.tpl');
|
||||
|
||||
$o = replace_macros($tpl,array(
|
||||
'$title' => t('Mood'),
|
||||
'$desc' => t('Set your current mood and tell your friends'),
|
||||
'$verbs' => $shortlist,
|
||||
'$parent' => $parent,
|
||||
'$submit' => t('Submit'),
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module; /** @file */
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
/**
|
||||
*
|
||||
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
|
||||
* This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
|
||||
* other web request. You must be logged in and connected to a channel.
|
||||
* If the required arguments aren't present, we'll display a simple form to choose a recipient and a verb.
|
||||
* parent is a special argument which let's you attach this activity as a comment to an existing conversation, which
|
||||
* may have started with somebody else poking (etc.) somebody, but this isn't necessary. This can be used in the adult
|
||||
* plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
|
||||
*
|
||||
* private creates a private conversation with the recipient. Otherwise your channel's default post privacy is used.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('include/items.php');
|
||||
|
||||
|
||||
class Poke extends Controller {
|
||||
|
||||
function init() {
|
||||
|
||||
if(! local_channel())
|
||||
return;
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Poke')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = local_channel();
|
||||
$channel = App::get_channel();
|
||||
|
||||
$verb = ((isset($_GET['verb'])) ? notags(trim($_GET['verb'])) : '');
|
||||
|
||||
if(! $verb)
|
||||
return;
|
||||
|
||||
$verbs = get_poke_verbs();
|
||||
|
||||
if(! array_key_exists($verb,$verbs))
|
||||
return;
|
||||
|
||||
$contact_id = intval($_REQUEST['cid']);
|
||||
|
||||
$xchan = trim($_REQUEST['xchan']);
|
||||
|
||||
if(! ($contact_id || $xchan))
|
||||
return;
|
||||
|
||||
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
|
||||
|
||||
logger('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
|
||||
|
||||
|
||||
if($contact_id) {
|
||||
$r = q("SELECT * FROM abook left join xchan on xchan_hash = abook_xchan where abook_id = %d and abook_channel = %d LIMIT 1",
|
||||
intval($contact_id),
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
if($xchan) {
|
||||
$r = q("SELECT * FROM xchan where xchan_hash like ( '%s' ) LIMIT 1",
|
||||
dbesc($xchan . '%')
|
||||
);
|
||||
}
|
||||
|
||||
if(! $r) {
|
||||
logger('poke: no target.');
|
||||
return;
|
||||
}
|
||||
|
||||
$target = $r[0];
|
||||
$parent_item = null;
|
||||
|
||||
if($parent) {
|
||||
$r = q("select mid, item_private, owner_xchan, allow_cid, allow_gid, deny_cid, deny_gid
|
||||
from item where id = %d and parent = %d and uid = %d limit 1",
|
||||
intval($parent),
|
||||
intval($parent),
|
||||
intval($uid)
|
||||
);
|
||||
if($r) {
|
||||
$parent_item = $r[0];
|
||||
$parent_mid = $r[0]['mid'];
|
||||
$item_private = $r[0]['item_private'];
|
||||
$allow_cid = $r[0]['allow_cid'];
|
||||
$allow_gid = $r[0]['allow_gid'];
|
||||
$deny_cid = $r[0]['deny_cid'];
|
||||
$deny_gid = $r[0]['deny_gid'];
|
||||
}
|
||||
}
|
||||
elseif($contact_id) {
|
||||
|
||||
$item_private = ((x($_GET,'private')) ? intval($_GET['private']) : 0);
|
||||
|
||||
$allow_cid = (($item_private) ? '<' . $target['abook_xchan']. '>' : $channel['channel_allow_cid']);
|
||||
$allow_gid = (($item_private) ? '' : $channel['channel_allow_gid']);
|
||||
$deny_cid = (($item_private) ? '' : $channel['channel_deny_cid']);
|
||||
$deny_gid = (($item_private) ? '' : $channel['channel_deny_gid']);
|
||||
}
|
||||
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']);
|
||||
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : '');
|
||||
$arr['title'] = '';
|
||||
$arr['allow_cid'] = $allow_cid;
|
||||
$arr['allow_gid'] = $allow_gid;
|
||||
$arr['deny_cid'] = $deny_cid;
|
||||
$arr['deny_gid'] = $deny_gid;
|
||||
$arr['verb'] = 'Create';
|
||||
$arr['item_private'] = $item_private;
|
||||
$arr['obj_type'] = 'Note';
|
||||
$arr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t($verbs[$verb][0]) . ' ' . '[zrl=' . $target['xchan_url'] . ']' . $target['xchan_name'] . '[/zrl]';
|
||||
$arr['item_origin'] = 1;
|
||||
$arr['item_unseen'] = 1;
|
||||
if(! $parent_item)
|
||||
$arr['item_thread_top'] = 1;
|
||||
|
||||
$arr['obj'] = Activity::encode_item($arr);
|
||||
|
||||
|
||||
post_activity_item($arr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get() {
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Poke')) {
|
||||
//Do not display any associated widgets at this point
|
||||
App::$pdl = '';
|
||||
$papp = Apps::get_papp('Poke');
|
||||
return Apps::app_render($papp, 'module');
|
||||
}
|
||||
|
||||
nav_set_selected('Poke');
|
||||
|
||||
$name = '';
|
||||
$id = '';
|
||||
|
||||
if(isset($_REQUEST['c']) && intval($_REQUEST['c'])) {
|
||||
$r = q("select abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash
|
||||
where abook_id = %d and abook_channel = %d limit 1",
|
||||
intval($_REQUEST['c']),
|
||||
intval(local_channel())
|
||||
);
|
||||
if($r) {
|
||||
$name = $r[0]['xchan_name'];
|
||||
$id = $r[0]['abook_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : '0');
|
||||
|
||||
$verbs = get_poke_verbs();
|
||||
|
||||
$shortlist = array();
|
||||
foreach($verbs as $k => $v)
|
||||
if($v[1] !== 'NOTRANSLATION')
|
||||
$shortlist[] = array($k,$v[1]);
|
||||
|
||||
|
||||
$poke_basic = get_config('system','poke_basic');
|
||||
if($poke_basic) {
|
||||
$title = t('Poke');
|
||||
$desc = t('Poke somebody');
|
||||
}
|
||||
else {
|
||||
$title = t('Poke');
|
||||
$desc = t('Poke or ping somebody');
|
||||
}
|
||||
|
||||
$o = replace_macros(get_markup_template('poke_content.tpl'),array(
|
||||
'$title' => $title,
|
||||
'$poke_basic' => $poke_basic,
|
||||
'$desc' => $desc,
|
||||
'$clabel' => t('Recipient'),
|
||||
'$choice' => t('Choose action'),
|
||||
'$verbs' => $shortlist,
|
||||
'$parent' => $parent,
|
||||
'$prv_desc' => t('Make this post private'),
|
||||
'$private' => array('private', t('Make this post private'), false, ''),
|
||||
'$submit' => t('Submit'),
|
||||
'$name' => $name,
|
||||
'$id' => $id
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -234,15 +234,6 @@ class Pinned {
|
||||
case 'dislike':
|
||||
$verb_sql = " AND verb IN ('Dislike', '" . ACTIVITY_DISLIKE . "') ";
|
||||
break;
|
||||
case 'agree':
|
||||
$verb_sql = " AND verb = '" . ACTIVITY_AGREE . "' ";
|
||||
break;
|
||||
case 'disagree':
|
||||
$verb_sql = " AND verb = '" . ACTIVITY_DISAGREE . "' ";
|
||||
break;
|
||||
case 'abstain':
|
||||
$verb_sql = " AND verb = '" . ACTIVITY_ABSTAIN . "' ";
|
||||
break;
|
||||
case 'attendyes':
|
||||
$verb_sql = " AND verb IN ('Accept', '" . ACTIVITY_ATTEND . "') ";
|
||||
break;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
version: 3
|
||||
url: $baseurl/mood
|
||||
requires: local_channel
|
||||
name: Mood
|
||||
photo: icon:smile-o
|
||||
categories: Social
|
||||
desc: Set your current mood and tell your friends.
|
||||
@@ -1,7 +0,0 @@
|
||||
version: 3
|
||||
url: $baseurl/poke
|
||||
requires: local_channel
|
||||
name: Poke
|
||||
photo: icon:hand-o-right
|
||||
categories: Social
|
||||
desc: Poke somebody in your addressbook.
|
||||
13
boot.php
13
boot.php
@@ -488,6 +488,7 @@ define('NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/');
|
||||
define('ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams');
|
||||
|
||||
define('ZOT_APSCHEMA_REV', '/apschema/v1.11');
|
||||
|
||||
/**
|
||||
* activity stream defines
|
||||
*/
|
||||
@@ -499,15 +500,15 @@ define('ACTIVITY_REACT', NAMESPACE_ZOT . '/activity/react'); // deprecated
|
||||
define('ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like'); // AS2 Like
|
||||
define('ACTIVITY_DISLIKE', NAMESPACE_ZOT . '/activity/dislike'); // AS2 Dislike
|
||||
|
||||
define('ACTIVITY_AGREE', NAMESPACE_ZOT . '/activity/agree'); // deprecated - remove from code?
|
||||
define('ACTIVITY_DISAGREE', NAMESPACE_ZOT . '/activity/disagree'); // deprecated - remove from code?
|
||||
define('ACTIVITY_ABSTAIN', NAMESPACE_ZOT . '/activity/abstain'); // deprecated - remove from code?
|
||||
define('ACTIVITY_AGREE', NAMESPACE_ZOT . '/activity/agree'); // deprecated
|
||||
define('ACTIVITY_DISAGREE', NAMESPACE_ZOT . '/activity/disagree'); // deprecated
|
||||
define('ACTIVITY_ABSTAIN', NAMESPACE_ZOT . '/activity/abstain'); // deprecated
|
||||
|
||||
define('ACTIVITY_ATTEND', NAMESPACE_ZOT . '/activity/attendyes'); // AS2 Accept
|
||||
define('ACTIVITY_ATTENDNO', NAMESPACE_ZOT . '/activity/attendno'); // AS2 Reject
|
||||
define('ACTIVITY_ATTENDMAYBE', NAMESPACE_ZOT . '/activity/attendmaybe'); // AS2 TentativeAccept
|
||||
|
||||
define('ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend'); // deprecated - remove from code?
|
||||
define('ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend'); // deprecated
|
||||
|
||||
define('ACTIVITY_FOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'follow');
|
||||
define('ACTIVITY_UNFOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'stop-following');
|
||||
@@ -525,8 +526,8 @@ define('ACTIVITY_CREATE', NAMESPACE_ACTIVITY_SCHEMA . 'create'); // deprecated
|
||||
|
||||
define('ACTIVITY_DELETE', NAMESPACE_ACTIVITY_SCHEMA . 'delete'); // AS2 Delete
|
||||
|
||||
define('ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke'); // TODO: deprecate
|
||||
define('ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood'); // TODO: deprecate
|
||||
define('ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke'); // deprecated
|
||||
define('ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood'); // deprecated
|
||||
|
||||
define('ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment'); // AS2 Note
|
||||
define('ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note'); // AS2 Note
|
||||
|
||||
@@ -217,96 +217,6 @@ function localize_item(&$item){
|
||||
|
||||
}
|
||||
|
||||
if (activity_match($item['verb'], ACTIVITY_FRIEND)) {
|
||||
|
||||
if ($item['obj_type'] == "" || !in_array($item['obj_type'], ['Person', ACTIVITY_OBJ_PERSON]))
|
||||
return;
|
||||
|
||||
$Aname = $item['author']['xchan_name'];
|
||||
$Alink = $item['author']['xchan_url'];
|
||||
|
||||
|
||||
$obj= json_decode($item['obj'],true);
|
||||
|
||||
$Blink = $Bphoto = '';
|
||||
|
||||
if($obj['link']) {
|
||||
$Blink = get_rel_link($obj['link'],'alternate');
|
||||
$Bphoto = get_rel_link($obj['link'],'photo');
|
||||
}
|
||||
$Bname = $obj['title'];
|
||||
|
||||
|
||||
$A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]';
|
||||
$B = '[zrl=' . chanlink_url($Blink) . '][bdi]' . $Bname . '[/bdi][/zrl]';
|
||||
if ($Bphoto!="") $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
|
||||
|
||||
$item['shortlocalize'] = sprintf( t('%1$s is now connected with %2$s'), '[bdi]' . $Aname . '[/bdi]', '[bdi]' . $Bname . '[/bdi]');
|
||||
|
||||
$item['body'] = $item['localize'] = sprintf( t('%1$s is now connected with %2$s'), $A, $B);
|
||||
$item['body'] .= "\n\n\n" . $Bphoto;
|
||||
}
|
||||
|
||||
if (stristr($item['verb'], ACTIVITY_POKE)) {
|
||||
|
||||
/** @FIXME for obscured private posts, until then leave untranslated */
|
||||
return;
|
||||
|
||||
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
||||
if(! $verb)
|
||||
return;
|
||||
|
||||
if ($item['obj_type']=="" || !in_array($item['obj_type'], ['Person', ACTIVITY_OBJ_PERSON]))
|
||||
return;
|
||||
|
||||
$Aname = $item['author']['xchan_name'];
|
||||
$Alink = $item['author']['xchan_url'];
|
||||
|
||||
$obj= json_decode($item['obj'],true);
|
||||
|
||||
$Blink = $Bphoto = '';
|
||||
|
||||
if($obj['link']) {
|
||||
$Blink = get_rel_link($obj['link'],'alternate');
|
||||
$Bphoto = get_rel_link($obj['link'],'photo');
|
||||
}
|
||||
$Bname = $obj['title'];
|
||||
|
||||
$A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]';
|
||||
$B = '[zrl=' . chanlink_url($Blink) . '][bdi]' . $Bname . '[/bdi][/zrl]';
|
||||
if ($Bphoto!="") $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
|
||||
|
||||
// we can't have a translation string with three positions but no distinguishable text
|
||||
// So here is the translate string.
|
||||
|
||||
$txt = t('%1$s poked %2$s');
|
||||
|
||||
// now translate the verb
|
||||
|
||||
$txt = str_replace( t('poked'), t($verb), $txt);
|
||||
|
||||
// then do the sprintf on the translation string
|
||||
|
||||
$item['shortlocalize'] = sprintf($txt, '[bdi]' . $Aname . '[/bdi]', '[bdi]' . $Bname . '[/bdi]');
|
||||
|
||||
$item['body'] = $item['localize'] = sprintf($txt, $A, $B);
|
||||
$item['body'] .= "\n\n\n" . $Bphoto;
|
||||
}
|
||||
if (stristr($item['verb'],ACTIVITY_MOOD)) {
|
||||
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
||||
if(! $verb)
|
||||
return;
|
||||
|
||||
$Aname = $item['author']['xchan_name'];
|
||||
$Alink = $item['author']['xchan_url'];
|
||||
|
||||
$A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]';
|
||||
|
||||
$txt = t('%1$s is %2$s','mood');
|
||||
|
||||
$item['body'] = sprintf($txt, $A, t($verb));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,7 +255,7 @@ function count_descendants($item) {
|
||||
* @return boolean
|
||||
*/
|
||||
function visible_activity($item) {
|
||||
$hidden_activities = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_SHARE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE];
|
||||
$hidden_activities = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_SHARE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE];
|
||||
|
||||
if(intval($item['item_notshown']))
|
||||
return false;
|
||||
@@ -1082,15 +992,6 @@ function builtin_activity_puller($item, &$conv_responses) {
|
||||
case 'dislike':
|
||||
$verb = ['Dislike', ACTIVITY_DISLIKE];
|
||||
break;
|
||||
case 'agree':
|
||||
$verb = ACTIVITY_AGREE;
|
||||
break;
|
||||
case 'disagree':
|
||||
$verb = ACTIVITY_DISAGREE;
|
||||
break;
|
||||
case 'abstain':
|
||||
$verb = ACTIVITY_ABSTAIN;
|
||||
break;
|
||||
case 'attendyes':
|
||||
$verb = ['Accept', ACTIVITY_ATTEND];
|
||||
break;
|
||||
|
||||
@@ -2607,7 +2607,6 @@ function tag_deliver($uid, $item_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($is_group && intval($item['item_thread_top']) && intval($item['item_wall']) && $item['author_xchan'] !== $item['owner_xchan']) {
|
||||
|
||||
if($item['resource_type'] === 'group_item') {
|
||||
@@ -2624,39 +2623,6 @@ function tag_deliver($uid, $item_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Seems like a good place to plug in a poke notification.
|
||||
*/
|
||||
|
||||
if (stristr($item['verb'],ACTIVITY_POKE)) {
|
||||
$poke_notify = true;
|
||||
|
||||
if(($item['obj_type'] == "") || (!in_array($item['obj_type'], ['Person', ACTIVITY_OBJ_PERSON])) || (! $item['obj']))
|
||||
$poke_notify = false;
|
||||
|
||||
$obj = json_decode($item['obj'],true);
|
||||
if($obj) {
|
||||
if($obj['id'] !== $u[0]['channel_hash'])
|
||||
$poke_notify = false;
|
||||
}
|
||||
if(intval($item['item_deleted']))
|
||||
$poke_notify = false;
|
||||
|
||||
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
||||
if($poke_notify) {
|
||||
Enotify::submit(array(
|
||||
'to_xchan' => $u[0]['channel_hash'],
|
||||
'from_xchan' => $item['author_xchan'],
|
||||
'type' => NOTIFY_POKE,
|
||||
'item' => $item,
|
||||
'link' => $i[0]['llink'],
|
||||
'verb' => ACTIVITY_POKE,
|
||||
'activity' => $verb,
|
||||
'otype' => 'item'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Do community tagging
|
||||
*/
|
||||
|
||||
@@ -1270,77 +1270,6 @@ function sslify($s) {
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get an array of poke verbs.
|
||||
*
|
||||
* @return array
|
||||
* * \e index is present tense verb
|
||||
* * \e value is array containing past tense verb, translation of present, translation of past
|
||||
*/
|
||||
function get_poke_verbs() {
|
||||
|
||||
$arr = [
|
||||
'poke' => ['poked', t('poke'), t('poked')],
|
||||
'ping' => ['pinged', t('ping'), t('pinged')],
|
||||
|
||||
// Those might be better suited for a nsfw poke addon
|
||||
|
||||
// 'prod' => ['prodded', t('prod'), t('prodded')],
|
||||
// 'slap' => ['slapped', t('slap'), t('slapped')],
|
||||
// 'finger' => ['fingered', t('finger'), t('fingered')],
|
||||
// 'rebuff' => ['rebuffed', t('rebuff'), t('rebuffed')]
|
||||
];
|
||||
|
||||
/**
|
||||
* @hooks poke_verbs
|
||||
* * \e array associative array with another array as value
|
||||
*/
|
||||
call_hooks('poke_verbs', $arr);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get an array of mood verbs.
|
||||
*
|
||||
* @return array
|
||||
* * \e index is the verb
|
||||
* * \e value is the translated verb
|
||||
*/
|
||||
function get_mood_verbs() {
|
||||
|
||||
$arr = [
|
||||
'happy' => t('happy'),
|
||||
'sad' => t('sad'),
|
||||
'mellow' => t('mellow'),
|
||||
'tired' => t('tired'),
|
||||
'perky' => t('perky'),
|
||||
'angry' => t('angry'),
|
||||
'stupefied' => t('stupefied'),
|
||||
'puzzled' => t('puzzled'),
|
||||
'interested' => t('interested'),
|
||||
'bitter' => t('bitter'),
|
||||
'cheerful' => t('cheerful'),
|
||||
'alive' => t('alive'),
|
||||
'annoyed' => t('annoyed'),
|
||||
'anxious' => t('anxious'),
|
||||
'cranky' => t('cranky'),
|
||||
'disturbed' => t('disturbed'),
|
||||
'frustrated' => t('frustrated'),
|
||||
'depressed' => t('depressed'),
|
||||
'motivated' => t('motivated'),
|
||||
'relaxed' => t('relaxed'),
|
||||
'surprised' => t('surprised'),
|
||||
];
|
||||
|
||||
/**
|
||||
* @hooks mood_verbs
|
||||
* * \e array associative array with mood verbs
|
||||
*/
|
||||
call_hooks('mood_verbs', $arr);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to list all smilies, both internal and from addons.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
$("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
|
||||
$("#poke-recip-complete").val(data.id);
|
||||
});
|
||||
});
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
<div id="mood-content" class="generic-content-wrapper">
|
||||
<div class="section-title-wrapper">
|
||||
<h2>{{$title}}</h2>
|
||||
</div>
|
||||
<div class="section-content-wrapper">
|
||||
|
||||
<div id="mood-desc">{{$desc}}</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
|
||||
<form action="mood" method="get">
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<input id="mood-parent" type="hidden" value="{{$parent}}" name="parent" />
|
||||
|
||||
<div class="mb-3 field custom">
|
||||
<select name="verb" id="mood-verb-select" class="form-control" >
|
||||
{{foreach $verbs as $v}}
|
||||
<option value="{{$v.0}}">{{$v.1}}</option>
|
||||
{{/foreach}}
|
||||
</select>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<input type="submit" name="submit" value="{{$submit}}" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
<div id="poke-content" class="generic-content-wrapper">
|
||||
<div class="section-title-wrapper">
|
||||
<h2>{{$title}}</h2>
|
||||
</div>
|
||||
<div class="section-content-wrapper">
|
||||
|
||||
<div id="poke-desc">{{$desc}}</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
|
||||
<form action="poke" method="get">
|
||||
|
||||
|
||||
<div class="mb-3 field input">
|
||||
<label id="poke-recip-label" for="poke-recip">{{$clabel}}</label>
|
||||
<input class="form-control" id="poke-recip" type="text" value="{{$name}}" name="pokename" autocomplete="off" />
|
||||
</div>
|
||||
|
||||
<input id="poke-recip-complete" type="hidden" value="{{$id}}" name="cid" />
|
||||
<input id="poke-parent" type="hidden" value="{{$parent}}" name="parent" />
|
||||
|
||||
|
||||
{{if $poke_basic}}
|
||||
<input type="hidden" name="verb" value="poke" />
|
||||
{{else}}
|
||||
<div class="mb-3 field custom">
|
||||
<label for="poke-verb-select" id="poke-verb-lbl">{{$choice}}</label>
|
||||
<select class="form-control" name="verb" id="poke-verb-select" >
|
||||
{{foreach $verbs as $v}}
|
||||
<option value="{{$v.0}}">{{$v.1}}</option>
|
||||
{{/foreach}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if ! $parent}}
|
||||
{{include file="field_checkbox.tpl" field=$private}}
|
||||
{{/if}}
|
||||
|
||||
<input type="submit" name="submit" value="{{$submit}}" />
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user