diff options
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Activity.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Contactedit.php | 16 | ||||
-rw-r--r-- | Zotlabs/Module/Conversation.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Cover_photo.php | 45 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Like.php | 36 | ||||
-rw-r--r-- | Zotlabs/Module/Mood.php | 163 | ||||
-rw-r--r-- | Zotlabs/Module/Photos.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Poke.php | 205 | ||||
-rw-r--r-- | Zotlabs/Module/Profile_photo.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Profiles.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/React.php | 103 | ||||
-rw-r--r-- | Zotlabs/Module/Sse_bs.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Subthread.php | 8 |
14 files changed, 81 insertions, 525 deletions
diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php index b2f0ce498..133312e28 100644 --- a/Zotlabs/Module/Activity.php +++ b/Zotlabs/Module/Activity.php @@ -25,7 +25,7 @@ class Activity extends Controller { $portable_id = EMPTY_STR; - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); @@ -186,7 +186,7 @@ class Activity extends Controller { } } - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); diff --git a/Zotlabs/Module/Contactedit.php b/Zotlabs/Module/Contactedit.php index e20e90872..3527e9380 100644 --- a/Zotlabs/Module/Contactedit.php +++ b/Zotlabs/Module/Contactedit.php @@ -177,22 +177,8 @@ class Contactedit extends Controller { intval($channel['channel_id']) ); if (($pr) && (!intval($contact['abook_hidden'])) && (intval(get_pconfig($channel['channel_id'], 'system', 'post_newfriend')))) { - $xarr = []; - - $xarr['item_wall'] = 1; - $xarr['item_origin'] = 1; - $xarr['item_thread_top'] = 1; - $xarr['owner_xchan'] = $xarr['author_xchan'] = $channel['channel_hash']; - $xarr['allow_cid'] = $channel['channel_allow_cid']; - $xarr['allow_gid'] = $channel['channel_allow_gid']; - $xarr['deny_cid'] = $channel['channel_deny_cid']; - $xarr['deny_gid'] = $channel['channel_deny_gid']; - $xarr['item_private'] = (($xarr['allow_cid'] || $xarr['allow_gid'] || $xarr['deny_cid'] || $xarr['deny_gid']) ? 1 : 0); - $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . $contact['xchan_url'] . ']' . $contact['xchan_name'] . '[/zrl]'; - - $xarr['body'] .= "\n\n\n" . '[zrl=' . $contact['xchan_url'] . '][zmg=80x80]' . $contact['xchan_photo_m'] . '[/zmg][/zrl]'; - + $xarr['body'] .= "\n\n\n" . '[zrl=' . $contact['xchan_url'] . '][zmg=' . $contact['xchan_photo_m'] . ']' . $contact['xchan_name'] . '[/zmg][/zrl]'; post_activity_item($xarr); } diff --git a/Zotlabs/Module/Conversation.php b/Zotlabs/Module/Conversation.php index 86ce66caa..aa8349f55 100644 --- a/Zotlabs/Module/Conversation.php +++ b/Zotlabs/Module/Conversation.php @@ -25,7 +25,7 @@ class Conversation extends Controller { $portable_id = EMPTY_STR; - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 1ecbfce3e..f4f9480c0 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -93,8 +93,6 @@ class Cover_photo extends \Zotlabs\Web\Controller { $image_id = substr($image_id,0,-2); } - - $srcX = intval($_POST['xstart']); $srcY = intval($_POST['ystart']); $srcW = intval($_POST['xfinal']) - $srcX; @@ -228,7 +226,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { return; } - $this->send_cover_photo_activity($channel,$base_image,$profile); + profile_activity([t('Cover Photo')], $base_image['resource_id']); $sync = attach_export_data($channel,$base_image['resource_id']); if($sync) @@ -245,7 +243,6 @@ class Cover_photo extends \Zotlabs\Web\Controller { } - $hash = photo_new_resource(); $smallest = 0; @@ -287,45 +284,6 @@ class Cover_photo extends \Zotlabs\Web\Controller { } - function send_cover_photo_activity($channel,$photo,$profile) { - - $arr = array(); - $arr['item_thread_top'] = 1; - $arr['item_origin'] = 1; - $arr['item_wall'] = 1; - - if($profile && stripos($profile['gender'],t('female')) !== false) - $t = t('%1$s updated her %2$s'); - elseif($profile && stripos($profile['gender'],t('male')) !== false) - $t = t('%1$s updated his %2$s'); - else - $t = t('%1$s updated their %2$s'); - - $ptext = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' . t('cover photo') . '[/zrl]'; - - $ltext = '[zrl=' . z_root() . '/profile/' . $channel['channel_address'] . ']' . '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-8[/zmg][/zrl]'; - - $arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext; - - $acl = new \Zotlabs\Access\AccessList($channel); - $x = $acl->get(); - $arr['allow_cid'] = $x['allow_cid']; - - $arr['allow_gid'] = $x['allow_gid']; - $arr['deny_cid'] = $x['deny_cid']; - $arr['deny_gid'] = $x['deny_gid']; - - $arr['uid'] = $channel['channel_id']; - $arr['aid'] = $channel['channel_account_id']; - - $arr['owner_xchan'] = $channel['channel_hash']; - $arr['author_xchan'] = $channel['channel_hash']; - - post_activity_item($arr); - - - } - /** * @brief Generate content of profile-photo view @@ -334,7 +292,6 @@ class Cover_photo extends \Zotlabs\Web\Controller { * */ - function get() { if(! local_channel()) { diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 7d71edc99..9c967cb88 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -52,7 +52,7 @@ class Item extends Controller { $portable_id = EMPTY_STR; - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); @@ -168,7 +168,7 @@ class Item extends Controller { $portable_id = EMPTY_STR; - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index e19a74a23..86ae48365 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -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' @@ -325,6 +322,8 @@ class Like extends Controller { // parent, copy that as well. if ($r) { + $obj_type = $r[0]['obj_type']; + if ($r[0]['uid'] === $sys_channel['channel_id'] && local_channel()) { $r = [copy_of_pubitem(App::get_channel(), $r[0]['mid'])]; } @@ -372,17 +371,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(); @@ -439,7 +434,7 @@ class Like extends Controller { } } - $uuid = item_message_id(); + $uuid = new_uuid(); $arr = array(); @@ -452,17 +447,17 @@ class Like extends Controller { $arr['item_wall'] = 1; } else { - switch ($item['resource_type']) { - case 'photo': - $obj_type = 'Image'; - $post_type = t('photo'); + switch ($item['object_type']) { + case 'Image': + $post_type = t('image'); break; - case 'event': - $obj_type = 'Invite'; + case 'Invite': $post_type = t('event'); break; + case 'Profile': + $post_type = t('profile'); + break; default: - $obj_type = 'Note'; $post_type = t('status'); break; } @@ -493,12 +488,6 @@ class Like extends Controller { $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') @@ -540,7 +529,7 @@ class Like extends Controller { if ($obj_type === 'thing' && $r[0]['imgurl']) { $arr['body'] .= "\n\n[zmg=80x80]" . $r[0]['imgurl'] . '[/zmg]'; } - if ($obj_type === 'profile') { + if ($obj_type === 'Profile') { if ($public) { $arr['body'] .= "\n\n" . '[embed]' . z_root() . '/profile/' . $ch[0]['channel_address'] . '[/embed]'; } @@ -594,6 +583,7 @@ class Like extends Controller { Libsync::build_sync_packet($profile_uid, ['item' => [encode_item($sync_item[0], true)]]); } + if ($extended_like) { $r = q("insert into likes (channel_id,liker,likee,iid,i_mid,verb,target_type,target_id,target) values (%d,'%s','%s',%d,'%s','%s','%s','%s','%s')", intval($ch[0]['channel_id']), diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php deleted file mode 100644 index edd3f0e1a..000000000 --- a/Zotlabs/Module/Mood.php +++ /dev/null @@ -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; - - } - -} diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 0a490d1db..870a2cb79 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -1108,7 +1108,6 @@ class Photos extends \Zotlabs\Web\Controller { $conv_responses = array( 'like' => array('title' => t('Likes','title')),'dislike' => array('title' => t('Dislikes','title')), - 'agree' => array('title' => t('Agree','title')),'disagree' => array('title' => t('Disagree','title')), 'abstain' => array('title' => t('Abstain','title')), 'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title')) ); diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php deleted file mode 100644 index ee355f2a9..000000000 --- a/Zotlabs/Module/Poke.php +++ /dev/null @@ -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; - - } -} diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index d7e2bbce1..dc47d213b 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -223,7 +223,7 @@ class Profile_photo extends Controller { intval(local_channel()) ); - send_profile_photo_activity($channel, $base_image, $profile); + profile_activity([t('Profile Photo')], $base_image['resource_id']); } else { q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d", @@ -269,7 +269,6 @@ class Profile_photo extends Controller { // Update directory in background Master::Summon(['Directory', $channel['channel_id']]); - } else notice(t('Unable to process image') . EOL); diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index ce496252b..15252d6e6 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -3,10 +3,6 @@ namespace Zotlabs\Module; use Zotlabs\Lib\Libsync; -require_once('include/channel.php'); -require_once('include/selectors.php'); - - class Profiles extends \Zotlabs\Web\Controller { function init() { @@ -492,7 +488,7 @@ class Profiles extends \Zotlabs\Web\Controller { $publish = ((x($_POST, 'profile_in_directory') && (intval($_POST['profile_in_directory']) == 1)) ? 1 : 0); - profile_activity($changes,$value); + profile_activity($changes, $value); } diff --git a/Zotlabs/Module/React.php b/Zotlabs/Module/React.php index f80b04a3f..6a3b525b2 100644 --- a/Zotlabs/Module/React.php +++ b/Zotlabs/Module/React.php @@ -2,82 +2,79 @@ namespace Zotlabs\Module; +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Activity; +use Zotlabs\Daemon\Master; -class React extends \Zotlabs\Web\Controller { +class React extends Controller { function get() { - if(! local_channel()) + if (!local_channel()) { return; + } $sys = get_sys_channel(); - $channel = \App::get_channel(); + $channel = App::get_channel(); $postid = $_REQUEST['postid']; - if(! $postid) + if (!$postid) { return; + } $emoji = $_REQUEST['emoji']; + if (!$emoji) { + return; + } - if($_REQUEST['emoji']) { + $i = q("select * from item where id = %d and uid = %d", + intval($postid), + intval(local_channel()) + ); + if (!$i) { $i = q("select * from item where id = %d and uid = %d", intval($postid), - intval(local_channel()) + intval($sys['channel_id']) ); - if(! $i) { - $i = q("select * from item where id = %d and uid = %d", - intval($postid), - intval($sys['channel_id']) - ); - - if($i) { - $i = [ copy_of_pubitem($channel, $i[0]['mid']) ]; - $postid = (($i) ? $i[0]['id'] : 0); - } - } - - if(! $i) { - return; - } - - $uuid = item_message_id(); - - $n = array(); - $n['aid'] = $channel['channel_account_id']; - $n['uid'] = $channel['channel_id']; - $n['item_origin'] = true; - $n['item_type'] = $i[0]['item_type']; - $n['parent'] = $postid; - $n['parent_mid'] = $i[0]['mid']; - $n['uuid'] = $uuid; - $n['mid'] = z_root() . '/item/' . $uuid; - $n['verb'] = ACTIVITY_REACT . '#' . $emoji; - $n['body'] = "\n\n[zmg=32x32]" . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]' . "\n\n"; - $n['author_xchan'] = $channel['channel_hash']; - - $n['tgt_type'] = 'Image'; - $n['target'] = [ - 'type' => 'Image', - 'name' => $emoji, - 'url' => z_root() . '/images/emoji/' . $emoji . '.png' - ]; - - - $x = item_store($n); - - retain_item($postid); - - if($x['success']) { - $nid = $x['item_id']; - \Zotlabs\Daemon\Master::Summon(array('Notifier','like',$nid)); + if ($i) { + $i = [ copy_of_pubitem($channel, $i[0]['mid']) ]; + $postid = (($i) ? $i[0]['id'] : 0); } + } + if (!$i) { + return; } + $uuid = item_message_id(); + + $n['aid'] = $channel['channel_account_id']; + $n['uid'] = $channel['channel_id']; + $n['item_origin'] = true; + $n['item_type'] = $i[0]['item_type']; + $n['parent'] = $postid; + $n['parent_mid'] = $i[0]['mid']; + $n['uuid'] = $uuid; + $n['mid'] = z_root() . '/item/' . $uuid; + $n['verb'] = 'Create'; + $n['body'] = '[zmg=32x32]' . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]'; + $n['author_xchan'] = $channel['channel_hash']; + $n['obj'] = Activity::fetch_item(['id' => $item['mid']]); + $n['obj_type'] = ((array_path_exists('obj/type', $n)) ? $n['obj']['type'] : EMPTY_STR); + + $x = item_store($n); + + retain_item($postid); + + if ($x['success']) { + $nid = $x['item_id']; + Master::Summon(['Notifier', 'like', $nid]); + } } -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index a621f3608..71fc16aae 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -194,7 +194,7 @@ class Sse_bs extends Controller { $item_normal = item_normal(); // Filter internal follow activities and strerams add/remove activities - $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -277,7 +277,7 @@ class Sse_bs extends Controller { $item_normal = item_normal(); // Filter internal follow activities and strerams add/remove activities - $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -360,7 +360,7 @@ class Sse_bs extends Controller { $item_normal = item_normal(); // Filter internal follow activities and strerams add/remove activities - $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -467,7 +467,7 @@ class Sse_bs extends Controller { $item_normal = item_normal(); // Filter internal follow activities and strerams add/remove activities - $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -663,7 +663,7 @@ class Sse_bs extends Controller { $item_normal = item_normal(); // Filter internal follow activities and strerams add/remove activities - $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') "; $r = q("SELECT * FROM item WHERE (verb = 'Create' OR verb = '%s') diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php index 5ddcaffc6..b927ee480 100644 --- a/Zotlabs/Module/Subthread.php +++ b/Zotlabs/Module/Subthread.php @@ -24,9 +24,9 @@ class Subthread extends \Zotlabs\Web\Controller { $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0); if(argv(1) === 'sub') - $activity = ACTIVITY_FOLLOW; + $activity = 'Follow'; elseif(argv(1) === 'unsub') - $activity = ACTIVITY_UNFOLLOW; + $activity = 'Ignore'; $i = q("select * from item where id = %d and uid = %d", @@ -121,9 +121,9 @@ class Subthread extends \Zotlabs\Web\Controller { if(! intval($item['item_thread_top'])) $post_type = 'comment'; - if($activity === ACTIVITY_FOLLOW) + if($activity === 'Follow') $bodyverb = t('%1$s is following %2$s\'s %3$s'); - if($activity === ACTIVITY_UNFOLLOW) + if($activity === 'Ignore') $bodyverb = t('%1$s stopped following %2$s\'s %3$s'); $arr = array(); |