aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Activity.php42
-rw-r--r--Zotlabs/Module/Admin/Site.php19
-rw-r--r--Zotlabs/Module/Api.php54
-rw-r--r--Zotlabs/Module/Apschema.php63
-rw-r--r--Zotlabs/Module/Channel.php50
-rw-r--r--Zotlabs/Module/Cloud.php2
-rw-r--r--Zotlabs/Module/Contactedit.php48
-rw-r--r--Zotlabs/Module/Conversation.php2
-rw-r--r--Zotlabs/Module/Cover_photo.php47
-rw-r--r--Zotlabs/Module/Display.php22
-rw-r--r--Zotlabs/Module/Dreport.php9
-rw-r--r--Zotlabs/Module/Emoji.php57
-rw-r--r--Zotlabs/Module/Event.php26
-rw-r--r--Zotlabs/Module/Follow.php23
-rw-r--r--Zotlabs/Module/Hq.php20
-rw-r--r--Zotlabs/Module/Item.php73
-rw-r--r--Zotlabs/Module/Like.php83
-rw-r--r--Zotlabs/Module/Linkinfo.php12
-rw-r--r--Zotlabs/Module/Mood.php163
-rw-r--r--Zotlabs/Module/Network.php2
-rw-r--r--Zotlabs/Module/Owa.php4
-rw-r--r--Zotlabs/Module/Photos.php4
-rw-r--r--Zotlabs/Module/Pin.php2
-rw-r--r--Zotlabs/Module/Poke.php207
-rw-r--r--Zotlabs/Module/Profile_photo.php3
-rw-r--r--Zotlabs/Module/Profiles.php6
-rw-r--r--Zotlabs/Module/Pubstream.php19
-rw-r--r--Zotlabs/Module/React.php122
-rw-r--r--Zotlabs/Module/Search.php8
-rw-r--r--Zotlabs/Module/Setup.php18
-rw-r--r--Zotlabs/Module/Share.php34
-rw-r--r--Zotlabs/Module/Sharedwithme.php4
-rw-r--r--Zotlabs/Module/Smilies.php16
-rw-r--r--Zotlabs/Module/Sse_bs.php63
-rw-r--r--Zotlabs/Module/Subthread.php15
-rw-r--r--Zotlabs/Module/Tagger.php8
-rw-r--r--Zotlabs/Module/Thing.php122
-rw-r--r--Zotlabs/Module/Vote.php2
38 files changed, 518 insertions, 956 deletions
diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php
index 4ddfe602d..133312e28 100644
--- a/Zotlabs/Module/Activity.php
+++ b/Zotlabs/Module/Activity.php
@@ -7,7 +7,6 @@ use Zotlabs\Web\Controller;
use Zotlabs\Daemon\Master;
use Zotlabs\Lib\Activity as ZlibActivity;
use Zotlabs\Lib\ActivityStreams;
-use Zotlabs\Lib\LDSignatures;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\ThreadListener;
@@ -26,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)
);
@@ -155,22 +154,7 @@ class Activity extends Controller {
if(! $i)
http_status_exit(404, 'Not found');
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]], $i);
-
- $headers = [];
- $headers['Content-Type'] = 'application/x-zot+json' ;
- $x['signature'] = LDSignatures::sign($x,$chan);
- $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
- $headers['Digest'] = HTTPSig::generate_digest_header($ret);
- $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
- $h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],channel_url($chan));
- HTTPSig::set_headers($h);
- echo $ret;
- killme();
+ as_return_and_die($i, $chan);
}
@@ -202,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)
);
@@ -260,25 +244,7 @@ class Activity extends Controller {
$channel = channelx_by_n($items[0]['uid']);
- $x = array_merge( ['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]], ZlibActivity::encode_activity($items[0],true));
-
- $headers = [];
- $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
- $x['signature'] = LDSignatures::sign($x,$channel);
- $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
- $headers['Date'] = datetime_convert('UTC','UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T');
- $headers['Digest'] = HTTPSig::generate_digest_header($ret);
- $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
-
- $h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel));
- HTTPSig::set_headers($h);
- echo $ret;
- killme();
-
+ as_return_and_die(ZlibActivity::encode_activity($items[0]), $channel);
}
goaway(z_root() . '/item/' . argv(1));
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index b24821b28..dae5e7c77 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -68,7 +68,7 @@ class Site {
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$no_community_page = !((x($_POST,'no_community_page')) ? True : False);
- $default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 0);
+ $default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 30);
$active_expire_days = ((array_key_exists('active_expire_days',$_POST)) ? intval($_POST['active_expire_days']) : 7);
$reply_address = ((array_key_exists('reply_address',$_POST) && trim($_POST['reply_address'])) ? trim($_POST['reply_address']) : 'noreply@' . \App::get_hostname());
@@ -227,20 +227,6 @@ class Site {
*/
function get() {
- /* Installed langs */
- $lang_choices = array();
- $langs = glob('view/*/hstrings.php');
-
- if(is_array($langs) && count($langs)) {
- if(! in_array('view/en/hstrings.php',$langs))
- $langs[] = 'view/en/';
- asort($langs);
- foreach($langs as $l) {
- $t = explode("/",$l);
- $lang_choices[$t[1]] = $t[1];
- }
- }
-
/* Installed themes */
$theme_choices_mobile["---"] = t("Default");
$theme_choices = array();
@@ -425,7 +411,6 @@ class Site {
'$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
- //'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
// '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
@@ -536,7 +521,7 @@ class Site {
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
- '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
+ '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days', 30)), t('0 for no expiration of imported content')),
'$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(get_config('system','active_expire_days',7)), ''),
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
'$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Default: profiles')),
diff --git a/Zotlabs/Module/Api.php b/Zotlabs/Module/Api.php
index aa0fca54d..5b835ac51 100644
--- a/Zotlabs/Module/Api.php
+++ b/Zotlabs/Module/Api.php
@@ -24,42 +24,42 @@ class Api extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
return;
}
-
+
}
-
+
function get() {
if(\App::$cmd === 'api/oauth/authorize'){
-
- /*
+
+ /*
* api/oauth/authorize interact with the user. return a standard page
*/
-
+
\App::$page['template'] = 'minimal';
-
+
// get consumer/client from request token
try {
$request = \OAuth1Request::from_request();
}
catch(\Exception $e) {
logger('OAuth exception: ' . print_r($e,true));
- // echo "<pre>"; var_dump($e);
+ // echo "<pre>"; var_dump($e);
killme();
}
-
-
+
+
if(x($_POST,'oauth_yes')){
-
+
$app = $this->oauth_get_client($request);
- if (is_null($app))
+ if (is_null($app))
return "Invalid request. Unknown token.";
$consumer = new \OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
-
+
$verifier = md5($app['secret'] . local_channel());
set_config('oauth', $verifier, local_channel());
-
-
+
+
if($consumer->callback_url != null) {
$params = $request->get_parameters();
$glue = '?';
@@ -68,28 +68,28 @@ class Api extends \Zotlabs\Web\Controller {
goaway($consumer->callback_url . $glue . "oauth_token=" . \OAuth1Util::urlencode_rfc3986($params['oauth_token']) . "&oauth_verifier=" . \OAuth1Util::urlencode_rfc3986($verifier));
killme();
}
-
+
$tpl = get_markup_template("oauth_authorize_done.tpl");
$o = replace_macros($tpl, array(
'$title' => t('Authorize application connection'),
'$info' => t('Return to your app and insert this Security Code:'),
'$code' => $verifier,
));
-
+
return $o;
}
-
-
+
+
if(! local_channel()) {
//TODO: we need login form to redirect to this page
notice( t('Please login to continue.') . EOL );
return login(false,'api-login',$request->get_parameters());
}
-
+
$app = $this->oauth_get_client($request);
if (is_null($app))
return "Invalid request. Unknown token.";
-
+
$tpl = get_markup_template('oauth_authorize.tpl');
$o = replace_macros($tpl, array(
'$title' => t('Authorize application connection'),
@@ -98,12 +98,12 @@ class Api extends \Zotlabs\Web\Controller {
'$yes' => t('Yes'),
'$no' => t('No'),
));
-
+
//echo "<pre>"; var_dump($app); killme();
-
+
return $o;
}
-
+
echo api_call();
killme();
}
@@ -112,8 +112,8 @@ class Api extends \Zotlabs\Web\Controller {
$params = $request->get_parameters();
$token = $params['oauth_token'];
-
- $r = q("SELECT clients.* FROM clients, tokens WHERE clients.client_id = tokens.client_id
+
+ $r = q("SELECT clients.* FROM clients, tokens WHERE clients.client_id = tokens.client_id
AND tokens.id = '%s' AND tokens.auth_scope = 'request' ",
dbesc($token)
);
@@ -121,7 +121,7 @@ class Api extends \Zotlabs\Web\Controller {
return $r[0];
return null;
-
+
}
-
+
}
diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php
index e8d45c522..2ec11086a 100644
--- a/Zotlabs/Module/Apschema.php
+++ b/Zotlabs/Module/Apschema.php
@@ -2,68 +2,13 @@
namespace Zotlabs\Module;
+use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Activity;
-class Apschema extends \Zotlabs\Web\Controller {
-
+class Apschema extends Controller {
function init() {
-
- $base = z_root();
-
- $arr = [
- '@context' => [
- 'zot' => z_root() . '/apschema#',
- 'id' => '@id',
- 'type' => '@type',
- 'commentPolicy' => 'zot:commentPolicy',
- 'meData' => 'zot:meData',
- 'meDataType' => 'zot:meDataType',
- 'meEncoding' => 'zot:meEncoding',
- 'meAlgorithm' => 'zot:meAlgorithm',
- 'meCreator' => 'zot:meCreator',
- 'meSignatureValue' => 'zot:meSignatureValue',
- 'locationAddress' => 'zot:locationAddress',
- 'locationPrimary' => 'zot:locationPrimary',
- 'locationDeleted' => 'zot:locationDeleted',
- 'nomadicLocation' => 'zot:nomadicLocation',
- 'nomadicHubs' => 'zot:nomadicHubs',
- 'emojiReaction' => 'zot:emojiReaction',
- 'expires' => 'zot:expires',
- 'directMessage' => 'zot:directMessage',
- 'schema' => 'http://schema.org#',
- 'PropertyValue' => 'schema:PropertyValue',
- 'value' => 'schema:value',
-
- 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
-
-
- 'magicEnv' => [
- '@id' => 'zot:magicEnv',
- '@type' => '@id'
- ],
-
- 'nomadicLocations' => [
- '@id' => 'zot:nomadicLocations',
- '@type' => '@id'
- ],
-
- 'ostatus' => 'http://ostatus.org#',
- 'conversation' => 'ostatus:conversation',
-
- 'diaspora' => 'https://diasporafoundation.org/ns/',
- 'guid' => 'diaspora:guid',
-
- 'Hashtag' => 'as:Hashtag'
-
- ]
- ];
-
header('Content-Type: application/ld+json');
- echo json_encode($arr,JSON_UNESCAPED_SLASHES);
+ echo json_encode(Activity::ap_context(), JSON_UNESCAPED_SLASHES);
killme();
-
}
-
-
-
-
}
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index e8c3316e9..4e6811a10 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -101,16 +101,23 @@ class Channel extends Controller {
App::$meta->set('robots', 'noindex, noarchive');
}
+ $identifier = 'uuid';
+ $mid = $_REQUEST['mid'] ?? '';
+
+ if (str_starts_with($mid, 'b64.')) {
+ $mid = unpack_link_id($mid);
+ $identifier = 'mid';
+ }
+
+ if ($mid === false) {
+ http_status_exit(404, 'Not found');
+ }
+
if (ActivityStreams::is_as_request($channel)) {
// Somebody may attempt an ActivityStreams fetch on one of our message permalinks
// Make it do the right thing.
- $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
- if ($mid === false) {
- http_status_exit(404, 'Not found');
- }
-
if ($mid) {
$obj = null;
if (strpos($mid, z_root() . '/item/') === 0) {
@@ -127,6 +134,7 @@ class Channel extends Controller {
$obj->init();
}
}
+
as_return_and_die(Activity::encode_person($channel, true), $channel);
}
@@ -155,15 +163,9 @@ class Channel extends Controller {
profile_load($which, $profile);
// Add Opengraph markup
- $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
-
- if ($mid === false) {
- notice(t('Malformed message id.') . EOL);
- return;
- }
if ($mid) {
- $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d AND item_private = 0 LIMIT 1",
+ $r = q("SELECT * FROM item WHERE $identifier = '%s' AND uid = %d AND item_private = 0 LIMIT 1",
dbesc($mid),
intval($channel['channel_id'])
);
@@ -178,7 +180,16 @@ class Channel extends Controller {
$category = $datequery = $datequery2 = '';
- $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
+ $mid = $_REQUEST['mid'] ?? '';
+ $identifier = 'uuid';
+ $encoded_mid = null;
+
+ if (str_starts_with($mid, 'b64.')) {
+ $encoded_mid = $mid;
+ $mid = unpack_link_id($mid);
+ $identifier = 'mid';
+ }
+
if ($mid === false) {
notice(t('Malformed message id.') . EOL);
return;
@@ -322,7 +333,7 @@ class Channel extends Controller {
if (($update) && (!$load)) {
if ($mid) {
- $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal_update
+ $r = q("SELECT parent AS item_id, uuid from item where $identifier = '%s' and uid = %d $item_normal_update
AND item_wall = 1 $simple_update $sql_extra limit 1",
dbesc($mid),
intval(App::$profile['profile_uid'])
@@ -370,7 +381,7 @@ class Channel extends Controller {
if ($noscript_content || $load) {
if ($mid) {
- $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal
+ $r = q("SELECT parent AS item_id, uuid from item where $identifier = '%s' and uid = %d $item_normal
AND item_wall = 1 $sql_extra limit 1",
dbesc($mid),
intval(App::$profile['profile_uid'])
@@ -396,7 +407,6 @@ class Channel extends Controller {
}
}
if ($r) {
-
$parents_str = ids_to_querystr($r, 'item_id');
$r = q("SELECT item.*, item.id AS item_id
@@ -427,12 +437,8 @@ class Channel extends Controller {
$mode = (($search) ? 'search' : 'channel');
- if ((!$update) && (!$load)) {
-
-
- //if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($mid);
+ if ((!$update) && (!$load)) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
@@ -470,7 +476,7 @@ class Channel extends Controller {
'$file' => '',
'$cats' => (($category) ? urlencode($category) : ''),
'$tags' => (($hashtags) ? urlencode($hashtags) : ''),
- '$mid' => (($mid) ? urlencode($mid) : ''),
+ '$mid' => $encoded_mid ?? $mid,
'$verb' => '',
'$net' => '',
'$dend' => $datequery,
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 05109247a..527b06b3a 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -54,9 +54,9 @@ class Cloud extends Controller {
if (local_channel()) {
$channel = \App::get_channel();
$auth->setCurrentUser($channel['channel_address']);
+ $auth->channel_account_id = $channel['channel_account_id'];
$auth->channel_id = $channel['channel_id'];
$auth->channel_hash = $channel['channel_hash'];
- $auth->channel_account_id = $channel['channel_account_id'];
if($channel['channel_timezone'])
$auth->setTimezone($channel['channel_timezone']);
}
diff --git a/Zotlabs/Module/Contactedit.php b/Zotlabs/Module/Contactedit.php
index 58c3380a1..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);
}
@@ -494,28 +480,32 @@ class Contactedit extends Controller {
'message' => ''
];
- if ($cmd === 'resetphoto') {
- q("update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s'",
+ if ($cmd === 'refresh') {
+ q("update xchan set xchan_photo_date = '0001-01-01 00:00:00', xchan_name_date = '0001-01-01 00:00:00' where xchan_hash = '%s'",
dbesc($contact['xchan_hash'])
);
- $cmd = 'refresh';
- }
- if ($cmd === 'refresh') {
if ($contact['xchan_network'] === 'zot6') {
if (Libzot::refresh($contact, App::get_channel())) {
$ret['success'] = true;
$ret['message'] = t('Refresh succeeded');
}
else {
- $ret['message'] = t('Refresh failed - channel is currently unavailable');
+ $ret['message'] = t('Refresh failed');
}
}
else {
// if you are on a different network we'll force a refresh of the connection basic info
- Master::Summon(['Notifier', 'permission_update', $contact['abook_id']]);
- $ret['success'] = true;
- $ret['message'] = t('Refresh succeeded');
+ $hookinfo = [
+ 'contact' => $contact,
+ 'success' => false,
+ 'message' => ''
+ ];
+
+ call_hooks('actor_refetch', $hookinfo);
+
+ $ret['success'] = $hookinfo['success'];
+ $ret['message'] = $hookinfo['message'];
}
return $ret;
@@ -625,16 +615,10 @@ class Contactedit extends Controller {
return [
'refresh' => [
- 'label' => t('Refresh Permissions'),
- 'title' => t('Fetch updated permissions'),
+ 'label' => t('Refresh'),
+ 'title' => t('Refetch contact info'),
],
- 'rephoto' => [
- 'label' => t('Refresh Photo'),
- 'title' => t('Fetch updated photo'),
- ],
-
-
'block' => [
'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')),
'sel' => (intval($contact['abook_blocked']) ? 'active' : ''),
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..1c1240e29 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,13 +243,12 @@ class Cover_photo extends \Zotlabs\Web\Controller {
}
-
$hash = photo_new_resource();
$smallest = 0;
require_once('include/attach.php');
- $res = attach_store(\App::get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash, 'nosync' => true));
+ $res = attach_store(\App::get_channel(), get_observer_hash(), '', ['album' => t('Cover Photos'), 'hash' => $hash, 'nosync' => true, 'source' => 'photos']);
logger('attach_store: ' . print_r($res,true));
@@ -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/Display.php b/Zotlabs/Module/Display.php
index 9e46d7620..f08aedc95 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -38,7 +38,14 @@ class Display extends Controller {
$item_hash = $_REQUEST['mid'];
}
- $item_hash = unpack_link_id($item_hash);
+ $identifier = 'uuid';
+ $encoded_item_hash = null;
+
+ if (str_starts_with($item_hash, 'b64.')) {
+ $encoded_item_hash = $item_hash;
+ $item_hash = unpack_link_id($item_hash);
+ $identifier = 'mid';
+ }
if ($item_hash === false) {
App::$error = 400;
@@ -104,7 +111,7 @@ class Display extends Controller {
$target_item = null;
- $r = q("select id, uid, mid, parent, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where mid = '%s' limit 1",
+ $r = q("select id, uid, mid, parent, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where $identifier = '%s' limit 1",
dbesc($item_hash)
);
@@ -152,18 +159,11 @@ class Display extends Controller {
call_hooks('item_custom_display', $target_item);
$simple_update = '';
- if($update && $_SESSION['loadtime'])
+ if($update && isset($_SESSION['loadtime']))
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
if((! $update) && (! $load)) {
- // if the target item is not a post (eg a like) we want to address its thread parent
-
- //$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
-
- // if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($target_item['mid']);
-
$o .= '<div id="live-display"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
. "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
@@ -196,7 +196,7 @@ class Display extends Controller {
'$dbegin' => '',
'$verb' => '',
'$net' => '',
- '$mid' => (($mid) ? urlencode($mid) : '')
+ '$mid' => $encoded_item_hash ?? $item_hash
));
head_add_link([
diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php
index f5ad80eef..5db607545 100644
--- a/Zotlabs/Module/Dreport.php
+++ b/Zotlabs/Module/Dreport.php
@@ -13,11 +13,10 @@ class Dreport extends \Zotlabs\Web\Controller {
$table = 'item';
$channel = \App::get_channel();
- $mid = ((argc() > 1) ? unpack_link_id(argv(1)) : '');
+ $mid = $_REQUEST['mid'] ?? '';
- if($mid === 'push') {
+ if(argv(1) === 'push') {
$table = 'push';
- $mid = ((argc() > 2) ? unpack_link_id(argv(2)) : '');
if($mid) {
$i = q("select id from item where mid = '%s' and uid = %d and ( author_xchan = '%s' or ( owner_xchan = '%s' and item_wall = 1 )) ",
@@ -31,7 +30,7 @@ class Dreport extends \Zotlabs\Web\Controller {
}
}
sleep(3);
- goaway(z_root() . '/dreport/' . gen_link_id($mid));
+ goaway(z_root() . '/dreport?mid=' . $mid);
}
if(! $mid) {
@@ -114,7 +113,7 @@ class Dreport extends \Zotlabs\Web\Controller {
}
}
- usort($r,'self::dreport_gravity_sort');
+ usort($r, [self::class, 'dreport_gravity_sort']);
$entries = array();
foreach($r as $rr) {
diff --git a/Zotlabs/Module/Emoji.php b/Zotlabs/Module/Emoji.php
new file mode 100644
index 000000000..a1459d179
--- /dev/null
+++ b/Zotlabs/Module/Emoji.php
@@ -0,0 +1,57 @@
+<?php
+namespace Zotlabs\Module;
+
+use Zotlabs\Web\Controller;
+use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\ActivityStreams;
+use App;
+
+
+class Emoji extends Controller {
+
+ function init() {
+
+ $shortname = argv(1);
+
+ if (!$shortname) {
+ killme();
+ }
+
+ $emojis = get_emojis();
+
+ if (!isset($emojis[$shortname])) {
+ killme();
+ }
+
+ $emoji = $emojis[$shortname];
+
+ if (!file_exists($emoji['filepath'])) {
+ killme();
+ }
+
+ $image = getimagesize($emoji['filepath']);
+
+ if(ActivityStreams::is_as_request()) {
+ $last_modified = date(ATOM_TIME, filemtime($emoji['filepath']));
+
+ $obj = [
+ 'id' => z_root() . '/emoji/' . $shortname,
+ 'type' => 'Emoji',
+ 'name' => $emoji['shortname'],
+ 'updated' => $last_modified,
+ 'icon' => [
+ 'type' => 'Image',
+ 'mediaType' => $image['mime'],
+ 'url' => z_root() . '/' . $emoji['filepath']
+ ]
+ ];
+
+ as_return_and_die($obj);
+ }
+
+ header('Content-Type: ' . $image['mime']);
+ echo file_get_contents($emoji['filepath']);
+ killme();
+ }
+
+}
diff --git a/Zotlabs/Module/Event.php b/Zotlabs/Module/Event.php
index 22a1341cc..767a8f494 100644
--- a/Zotlabs/Module/Event.php
+++ b/Zotlabs/Module/Event.php
@@ -4,7 +4,6 @@ namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
-use Zotlabs\Lib\LDSignatures;
use Zotlabs\Web\HTTPSig;
class Event extends Controller {
@@ -17,7 +16,7 @@ class Event extends Controller {
if(! $item_id)
return;
- $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0
+ $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0
and item.item_delayed = 0 and item.item_blocked = 0 ";
$sql_extra = item_permissions_sql(0);
@@ -49,28 +48,9 @@ class Event extends Controller {
$obj = $items[0]['obj'];
}
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]], $obj );
-
- $headers = [];
- $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
- $x['signature'] = LDSignatures::sign($x,$channel);
- $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
- $headers['Date'] = datetime_convert('UTC','UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T');
- $headers['Digest'] = HTTPSig::generate_digest_header($ret);
- $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
-
- $h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel));
- HTTPSig::set_headers($h);
-
- echo $ret;
- killme();
-
+ as_return_and_die($obj, $channel);
}
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php
index f8bfc11f3..55ff507c8 100644
--- a/Zotlabs/Module/Follow.php
+++ b/Zotlabs/Module/Follow.php
@@ -7,7 +7,6 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
use Zotlabs\Web\HTTPSig;
-use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Connect;
use Zotlabs\Daemon\Master;
@@ -39,30 +38,14 @@ class Follow extends Controller {
http_status_exit(404, 'Not found');
}
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]],
- [
+ $obj = [
'id' => z_root() . '/follow/' . $r[0]['abook_id'],
'type' => 'Follow',
'actor' => $actor,
'object' => $r[0]['xchan_url']
- ]);
-
- $headers = [];
- $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
- $x['signature'] = LDSignatures::sign($x,$chan);
- $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
- $headers['Date'] = datetime_convert('UTC','UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T');
- $headers['Digest'] = HTTPSig::generate_digest_header($ret);
- $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
- $h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],channel_url($chan));
- HTTPSig::set_headers($h);
- echo $ret;
- killme();
+ ];
+ as_return_and_die($obj, $chan);
}
if (! local_channel()) {
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 5c3ae9273..ae6a016fc 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -30,16 +30,20 @@ class Hq extends \Zotlabs\Web\Controller {
$item_hash = '';
if(argc() > 1 && argv(1) !== 'load') {
- $item_hash = unpack_link_id(argv(1));
+ $item_hash = argv(1);
}
if(isset($_REQUEST['mid'])) {
- $item_hash = unpack_link_id($_REQUEST['mid']);
+ $item_hash = $_REQUEST['mid'];
}
- if($item_hash === false) {
- notice(t('Malformed message id.') . EOL);
- return;
+ $identifier = 'uuid';
+ $encoded_item_hash = null;
+
+ if (str_starts_with($item_hash, 'b64.')) {
+ $encoded_item_hash = $item_hash;
+ $item_hash = unpack_link_id($item_hash);
+ $identifier = 'mid';
}
$item_normal = item_normal();
@@ -54,7 +58,7 @@ class Hq extends \Zotlabs\Web\Controller {
// select the target item with a bias to our own item
$sql_order = ((local_channel() > $sys['channel_id']) ? 'DESC' : 'ASC');
- $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where uid in (%d, %d) and mid = '%s' order by uid $sql_order limit 2",
+ $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where uid in (%d, %d) and $identifier = '%s' order by uid $sql_order limit 2",
intval(local_channel()),
intval($sys['channel_id']),
dbesc($item_hash)
@@ -118,7 +122,7 @@ class Hq extends \Zotlabs\Web\Controller {
//$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
// if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($target_item['mid']);
+ // $mid = gen_link_id($target_item['mid']);
}
else {
$mid = '';
@@ -156,7 +160,7 @@ class Hq extends \Zotlabs\Web\Controller {
'$dbegin' => '',
'$verb' => '',
'$net' => '',
- '$mid' => (($mid) ? urlencode($mid) : '')
+ '$mid' => $encoded_item_hash ?? $item_hash
]);
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 25ccb0cbf..b158ed4e0 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)
);
@@ -275,7 +275,7 @@ class Item extends Controller {
if (argc() > 1 && argv(1) !== 'drop') {
- $x = q("select uid, item_wall, llink, mid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
+ $x = q("select uid, item_wall, llink, mid, uuid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
dbesc(z_root() . '/item/' . argv(1)),
dbesc(z_root() . '/activity/' . argv(1)),
dbesc(argv(1))
@@ -285,7 +285,7 @@ class Item extends Controller {
if (intval($xv['item_wall'])) {
$c = channelx_by_n($xv['uid']);
if ($c) {
- goaway(z_root() . '/channel/' . $c['channel_address'] . '?mid=' . gen_link_id($xv['mid']));
+ goaway(z_root() . '/channel/' . $c['channel_address'] . '?mid=' . $xv['uuid']);
}
}
}
@@ -298,7 +298,6 @@ class Item extends Controller {
function post() {
-
// This will change. Figure out who the observer is and whether or not
// they have permission to post here. Else ignore the post.
@@ -405,7 +404,7 @@ class Item extends Controller {
$pagetitle = ((x($_REQUEST, 'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : '');
$layout_mid = ((x($_REQUEST, 'layout_mid')) ? escape_tags($_REQUEST['layout_mid']) : '');
$plink = ((x($_REQUEST, 'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
- $obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE);
+ $obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : 'Article');
// allow API to bulk load a bunch of imported items with sending out a bunch of posts.
$nopush = ((x($_REQUEST, 'nopush')) ? intval($_REQUEST['nopush']) : 0);
@@ -444,9 +443,6 @@ class Item extends Controller {
if (!x($_REQUEST, 'type'))
$_REQUEST['type'] = 'net-comment';
- if ($obj_type == ACTIVITY_OBJ_NOTE)
- $obj_type = ACTIVITY_OBJ_COMMENT;
-
if ($parent) {
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
intval($parent)
@@ -679,7 +675,7 @@ class Item extends Controller {
$verb = $orig_post['verb'];
$app = $orig_post['app'];
$title = escape_tags(trim($_REQUEST['title']));
- $summary = trim($_REQUEST['summary']);
+ $summary = escape_tags(trim($_REQUEST['summary']));
$body = trim($_REQUEST['body']);
$item_flags = $orig_post['item_flags'];
$item_origin = $orig_post['item_origin'];
@@ -740,7 +736,7 @@ class Item extends Controller {
$coord = ((isset($_REQUEST['coord'])) ? notags(trim($_REQUEST['coord'])) : '');
$verb = ((isset($_REQUEST['verb'])) ? notags(trim($_REQUEST['verb'])) : '');
$title = ((isset($_REQUEST['title'])) ? escape_tags(trim($_REQUEST['title'])) : '');
- $summary = ((isset($_REQUEST['summary'])) ? trim($_REQUEST['summary']) : '');
+ $summary = ((isset($_REQUEST['summary'])) ? escape_tags(trim($_REQUEST['summary'])) : '');
$body = ((isset($_REQUEST['body'])) ? trim($_REQUEST['body']) : '');
$body .= ((isset($_REQUEST['attachment'])) ? trim($_REQUEST['attachment']) : '');
$postopts = '';
@@ -793,7 +789,6 @@ class Item extends Controller {
&& ($channel['channel_pageflags'] & PAGE_ALLOWCODE)) ? true : false);
if ($preview) {
- $summary = z_input_filter($summary, $mimetype, $execflag);
$body = z_input_filter($body, $mimetype, $execflag);
}
@@ -943,6 +938,30 @@ class Item extends Controller {
}
}
+ if (preg_match_all('/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/', $body, $match)) {
+ // emoji shortcodes
+ $emojis = get_emojis();
+ foreach ($match[0] as $mtch) {
+ $shortname = trim($mtch, ':');
+
+ if (!isset($emojis[$shortname])) {
+ continue;
+ }
+
+ $emoji = $emojis[$shortname];
+
+ $post_tags[] = [
+ 'uid' => $profile_uid,
+ 'ttype' => TERM_EMOJI,
+ 'otype' => TERM_OBJ_POST,
+ 'term' => trim($mtch),
+ 'url' => z_root() . '/emoji/' . $shortname,
+ 'imgurl' => z_root() . '/' . $emoji['filepath']
+ ];
+ }
+ }
+
+
// BBCODE end alert
}
@@ -963,6 +982,10 @@ class Item extends Controller {
}
}
+
+
+
+
if ($orig_post) {
// preserve original tags
$t = q("select * from term where oid = %d and otype = %d and uid = %d and ttype in ( %d, %d, %d )",
@@ -1009,7 +1032,7 @@ class Item extends Controller {
if (!strlen($verb))
- $verb = ACTIVITY_POST;
+ $verb = 'Create';
$notify_type = (($parent) ? 'comment-new' : 'wall-new');
@@ -1220,18 +1243,6 @@ class Item extends Controller {
$this->add_listeners($datarray);
}
- // We only need edit activities for other federated protocols
- // which do not support edits natively. While this does federate
- // edits, it presents a number of issues locally - such as #757 and #758.
- // The SQL check for an edit activity would not perform that well so to fix these issues
- // requires an additional item flag (perhaps 'item_edit_activity') that we can add to the
- // query for searches and notifications.
-
- // For now we'll just forget about trying to make edits work on network protocols that
- // don't support them.
-
- // item_create_edit_activity($x);
-
if (!$parent) {
$r = q("select * from item where id = %d",
intval($post_id)
@@ -1285,8 +1296,8 @@ class Item extends Controller {
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
'item' => $datarray,
- 'link' => z_root() . '/display/' . gen_link_id($datarray['mid']),
- 'verb' => ACTIVITY_POST,
+ 'link' => z_root() . '/display/' . $datarray['uuid'],
+ 'verb' => 'Create',
'otype' => 'item',
'parent' => $parent,
'parent_mid' => $parent_item['mid']
@@ -1303,8 +1314,8 @@ class Item extends Controller {
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
'item' => $datarray,
- 'link' => z_root() . '/display/' . gen_link_id($datarray['mid']),
- 'verb' => ACTIVITY_POST,
+ 'link' => z_root() . '/display/' . $datarray['uuid'],
+ 'verb' => 'Create',
'otype' => 'item'
]);
}
@@ -1349,7 +1360,7 @@ class Item extends Controller {
}
$datarray['id'] = $post_id;
- $datarray['llink'] = z_root() . '/display/' . gen_link_id($datarray['mid']);
+ $datarray['llink'] = z_root() . '/display/' . $datarray['uuid'];
call_hooks('post_local_end', $datarray);
@@ -1373,7 +1384,7 @@ class Item extends Controller {
if ($return_path) {
if ($return_path === 'hq') {
- goaway(z_root() . '/hq/' . gen_link_id($datarray['mid']));
+ goaway(z_root() . '/hq/' . $datarray['uuid']);
}
goaway(z_root() . "/" . $return_path);
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 54daf6471..4460900a8 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -19,14 +19,12 @@ class Like extends Controller {
private function reaction_to_activity($reaction) {
$acts = [
- 'like' => ACTIVITY_LIKE,
- 'dislike' => ACTIVITY_DISLIKE,
- 'agree' => ACTIVITY_AGREE,
- 'disagree' => ACTIVITY_DISAGREE,
- 'abstain' => ACTIVITY_ABSTAIN,
- 'attendyes' => ACTIVITY_ATTEND,
- 'attendno' => ACTIVITY_ATTENDNO,
- 'attendmaybe' => ACTIVITY_ATTENDMAYBE
+ 'like' => 'Like',
+ 'dislike' => 'Dislike',
+ 'announce' => ACTIVITY_SHARE,
+ 'attendyes' => 'Accept',
+ 'attendno' => 'Reject',
+ 'attendmaybe' => 'TentativeAccept'
];
// unlike (etc.) reactions are an undo of positive reactions, rather than a negative action.
@@ -71,11 +69,12 @@ class Like extends Controller {
$activities = q("SELECT item.*, item.id AS item_id FROM item
WHERE uid = %d $item_normal
AND thr_parent = '%s'
- AND verb IN ('%s', '%s', '%s', '%s', '%s')",
+ AND verb IN ('%s', '%s', '%s', '%s', '%s', '%s', 'Accept', 'Reject', 'TentativeAccept')",
intval($arr['item']['uid']),
dbesc($arr['item']['mid']),
- dbesc(ACTIVITY_LIKE),
- dbesc(ACTIVITY_DISLIKE),
+ dbesc('Like'),
+ dbesc('Dislike'),
+ dbesc(ACTIVITY_SHARE),
dbesc(ACTIVITY_ATTEND),
dbesc(ACTIVITY_ATTENDNO),
dbesc(ACTIVITY_ATTENDMAYBE)
@@ -133,7 +132,7 @@ class Like extends Controller {
}
$is_rsvp = false;
- if (in_array($activity, [ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE])) {
+ if (in_array($activity, ['Accept', 'Reject', 'TentativeAccept', ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE])) {
$is_rsvp = true;
}
@@ -182,7 +181,7 @@ class Like extends Controller {
}
}
$post_type = t('channel');
- $obj_type = ACTIVITY_OBJ_PROFILE;
+ $obj_type = 'Profile';
$profile = $r[0];
}
@@ -211,8 +210,8 @@ class Like extends Controller {
$public = false;
$post_type = t('thing');
- $obj_type = ACTIVITY_OBJ_PROFILE;
- $tgttype = ACTIVITY_OBJ_THING;
+ $obj_type = 'Profile';
+ $tgttype = 'Page';
$links = array();
$links[] = array('rel' => 'alternate', 'type' => 'text/html',
@@ -220,12 +219,7 @@ class Like extends Controller {
if ($r[0]['imgurl'])
$links[] = array('rel' => 'photo', 'href' => $r[0]['obj_imgurl']);
- $target = json_encode(array(
- 'type' => $tgttype,
- 'title' => $r[0]['obj_term'],
- 'id' => z_root() . '/thing/' . $r[0]['obj_obj'],
- 'link' => $links
- ));
+ $target = Activity::fetch_thing(['id' => $r[0]['obj_obj']]);
$plink = '[zrl=' . z_root() . '/thing/' . $r[0]['obj_obj'] . ']' . $r[0]['obj_term'] . '[/zrl]';
@@ -323,6 +317,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'])];
}
@@ -370,15 +366,11 @@ 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 ($activity === ACTIVITY_ATTEND || $activity === ACTIVITY_ATTENDNO || $activity === ACTIVITY_ATTENDMAYBE) {
- $verbs = " '" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' ";
- $multi_undo = 1;
- }
- if ($activity === ACTIVITY_AGREE || $activity === ACTIVITY_DISAGREE || $activity === ACTIVITY_ABSTAIN) {
- $verbs = " '" . dbesc(ACTIVITY_AGREE) . "','" . dbesc(ACTIVITY_DISAGREE) . "','" . dbesc(ACTIVITY_ABSTAIN) . "' ";
+ 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;
}
@@ -437,7 +429,7 @@ class Like extends Controller {
}
}
- $uuid = item_message_id();
+ $uuid = new_uuid();
$arr = array();
@@ -450,14 +442,20 @@ class Like extends Controller {
$arr['item_wall'] = 1;
}
else {
- $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
- if (in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT]))
- $post_type = t('event');
-
- $obj_type = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE);
-
- if ($obj_type === ACTIVITY_OBJ_NOTE && (!intval($item['item_thread_top'])))
- $obj_type = ACTIVITY_OBJ_COMMENT;
+ switch ($item['object_type']) {
+ case 'Image':
+ $post_type = t('image');
+ break;
+ case 'Invite':
+ $post_type = t('event');
+ break;
+ case 'Profile':
+ $post_type = t('profile');
+ break;
+ default:
+ $post_type = t('status');
+ break;
+ }
$object = json_encode(Activity::fetch_item(['id' => $item['mid']]));
@@ -485,12 +483,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')
@@ -511,7 +503,7 @@ class Like extends Controller {
$arr['thr_parent'] = $item['mid'];
$ulink = '[zrl=' . $item_author['xchan_url'] . '][bdi]' . $item_author['xchan_name'] . '[/bdi][/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . '][bdi]' . $observer['xchan_name'] . '[/bdi][/zrl]';
- $plink = '[zrl=' . z_root() . '/display/' . gen_link_id($item['mid']) . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['uuid'] . ']' . $post_type . '[/zrl]';
$allow_cid = $item['allow_cid'];
$allow_gid = $item['allow_gid'];
$deny_cid = $item['deny_cid'];
@@ -532,7 +524,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]';
}
@@ -586,6 +578,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/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index 038c739d5..081966dba 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -291,11 +291,15 @@ class Linkinfo extends \Zotlabs\Web\Controller {
// Check codepage in HTTP headers or HTML if not exist
$cp = (preg_match('/Content-Type: text\/html; charset=(.+)\r\n/i', $header, $o) ? $o[1] : '');
- if(empty($cp))
- $cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO');
+ if(empty($cp)) {
+ $cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO');
+ }
+
+ $body = mb_convert_encoding($body, 'UTF-8', $cp);
- $body = mb_convert_encoding($body, 'UTF-8', $cp);
- $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+ // Handling HTML entities via mbstring is deprecated
+ //$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+ $body = mb_encode_numericentity($body, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
$doc = new \DOMDocument();
@$doc->loadHTML($body);
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/Network.php b/Zotlabs/Module/Network.php
index 4f8e2f4e4..3ea813547 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -275,7 +275,7 @@ class Network extends \Zotlabs\Web\Controller {
$vnotify = get_pconfig(local_channel(), 'system', 'vnotify');
if(! ($vnotify & VNOTIFY_LIKE))
- $likes_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $likes_sql = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
// This is for nouveau view public forum cid queries (if a forum notification is clicked)
//$p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'",
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php
index e41435ecd..85467d4f4 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -63,10 +63,6 @@ class Owa extends Controller {
if ($r) {
foreach ($r as $hubloc) {
- // fix friendica accept header for nginx
- if (str_starts_with($keyId, 'acct:') && $_SERVER['HTTP_ACCEPT'] === 'application/x-zot+json')
- $_SERVER['HTTP_ACCEPT'] = 'application/x-dfrn+json, application/x-zot+json';
-
$verified = HTTPSig::verify(file_get_contents('php://input'), $hubloc['xchan_pubkey']);
if ($verified && $verified['header_signed'] && $verified['header_valid'] && ($verified['content_valid'] || (! $verified['content_signed']))) {
logger('OWA header: ' . print_r($verified,true),LOGGER_DATA);
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index 6c73c411e..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'))
);
@@ -1152,8 +1151,9 @@ class Photos extends \Zotlabs\Web\Controller {
$template = $tpl;
$sparkle = '';
- if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
+ if(activity_match($item['verb'], ['Like', 'Dislike', ACTIVITY_LIKE, ACTIVITY_DISLIKE]) && $item['id'] != $item['parent']) {
continue;
+ }
$redirect_url = z_root() . '/redir/' . $item['cid'] ;
diff --git a/Zotlabs/Module/Pin.php b/Zotlabs/Module/Pin.php
index f82327ce6..de3c75622 100644
--- a/Zotlabs/Module/Pin.php
+++ b/Zotlabs/Module/Pin.php
@@ -37,7 +37,7 @@ class Pin extends \Zotlabs\Web\Controller {
http_status_exit(404, 'Not found');
}
- $midb64 = gen_link_id($r[0]['mid']);
+ $midb64 = $r[0]['uuid'];
$pinned = (in_array($midb64, get_pconfig($r[0]['uid'], 'pinned', $r[0]['item_type'], [])) ? true : false);
switch(argv(1)) {
diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php
deleted file mode 100644
index 30585bf3d..000000000
--- a/Zotlabs/Module/Poke.php
+++ /dev/null
@@ -1,207 +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;
-
- $activity = ACTIVITY_POKE . '#' . urlencode($verbs[$verb][0]);
-
- $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'] = $activity;
- $arr['item_private'] = $item_private;
- $arr['obj_type'] = ACTIVITY_OBJ_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/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 08de168cb..c40751fdc 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -40,7 +40,15 @@ class Pubstream extends \Zotlabs\Web\Controller {
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
- $mid = ((isset($_REQUEST['mid'])) ? unpack_link_id($_REQUEST['mid']) : '');
+ $mid = $_REQUEST['mid'] ?? '';
+ $identifier = 'uuid';
+ $encoded_mid = null;
+
+ if (str_starts_with($mid, 'b64.')) {
+ $encoded_mid = $mid;
+ $mid = unpack_link_id($mid);
+ $identifier = 'mid';
+ }
if ($mid === false) {
notice(t('Malformed message id.') . EOL);
@@ -108,9 +116,6 @@ class Pubstream extends \Zotlabs\Web\Controller {
. "; var profile_page = " . \App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
- //if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($mid);
-
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'pubstream',
@@ -136,7 +141,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
'$cats' => '',
'$tags' => (($hashtags) ? urlencode($hashtags) : ''),
'$dend' => '',
- '$mid' => (($mid) ? urlencode($mid) : ''),
+ '$mid' => $encoded_mid ?? $mid,
'$verb' => '',
'$net' => (($net) ? urlencode($net) : ''),
'$dbegin' => ''
@@ -198,7 +203,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
$net_query
- WHERE item.mid = '%s' and item.item_private = 0
+ WHERE item.$identifier = '%s' and item.item_private = 0
$uids $site_firehose_sql
$item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
@@ -225,7 +230,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
$net_query
- WHERE item.mid = '%s' and item.item_private = 0
+ WHERE item.$identifier = '%s' and item.item_private = 0
$uids $site_firehose_sql $item_normal_update $simple_update
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra $net_query2",
diff --git a/Zotlabs/Module/React.php b/Zotlabs/Module/React.php
index f80b04a3f..e04b9b257 100644
--- a/Zotlabs/Module/React.php
+++ b/Zotlabs/Module/React.php
@@ -2,82 +2,96 @@
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($_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($sys['channel_id'])
- );
-
- if($i) {
- $i = [ copy_of_pubitem($channel, $i[0]['mid']) ];
- $postid = (($i) ? $i[0]['id'] : 0);
- }
- }
+ $shortname = $_REQUEST['emoji'];
- if(! $i) {
- return;
- }
+ $emojis = get_emojis();
- $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'];
+ if (!isset($emojis[$shortname])) {
+ return;
+ }
- $n['tgt_type'] = 'Image';
- $n['target'] = [
- 'type' => 'Image',
- 'name' => $emoji,
- 'url' => z_root() . '/images/emoji/' . $emoji . '.png'
- ];
+ $emoji = $emojis[$shortname];
+ if (!$emoji) {
+ return;
+ }
- $x = item_store($n);
+ $i = q("select * from item where id = %d and uid = %d",
+ intval($postid),
+ intval(local_channel())
+ );
- retain_item($postid);
+ if (!$i) {
+ $i = q("select * from item where id = %d and uid = %d",
+ intval($postid),
+ intval($sys['channel_id'])
+ );
- 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'] = $emoji['shortname']; //'[img class="emoji single-emoji"]' . z_root() . '/' . $emoji['filepath'] . '[/img]';
+ $n['author_xchan'] = $channel['channel_hash'];
+ // $n['obj'] = Activity::fetch_item(['id' => $i[0]['mid']]);
+ // $n['obj_type'] = ((array_path_exists('obj/type', $n)) ? $n['obj']['type'] : EMPTY_STR);
+
+ $n['term'][] = [
+ 'uid' => $channel['channel_id'],
+ 'ttype' => TERM_EMOJI,
+ 'otype' => TERM_OBJ_POST,
+ 'term' => $emoji['shortname'],
+ 'url' => z_root() . '/emoji/' . $shortname,
+ 'imgurl' => z_root() . '/' . $emoji['filepath']
+ ];
+
+ $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/Search.php b/Zotlabs/Module/Search.php
index 6b1060570..9511c0389 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -73,15 +73,15 @@ class Search extends Controller {
$f = Libzot::fetch_conversation(App::get_channel(), punify($url), true);
if ($f) {
- $mid = $f[0]['message_id'];
+ $uuid = $f[0]['message_uuid'];
foreach ($f as $m) {
- if (str_starts_with($url, $m['message_id'])) {
- $mid = $m['message_id'];
+ if ($url === $m['message_id']) {
+ $uuid = $m['message_uuid'];
break;
}
}
- goaway(z_root() . '/hq/' . gen_link_id($mid));
+ goaway(z_root() . '/hq/' . $uuid);
}
else {
// try other fetch providers (e.g. diaspora, pubcrawl)
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index 3a188d9ce..83faf85dc 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -491,6 +491,19 @@ class Setup extends \Zotlabs\Web\Controller {
}
$this->check_add($checks, t('Generate encryption keys'), $res, true, $help);
+
+ $res = function_exists('sodium_crypto_sign_keypair');
+ if (!$res) {
+ $help = t('Error: the sodium encryption library is not installed.') . EOL;
+ }
+ $this->check_add($checks, t('Generate ed25519 encryption keys'), $res, true, $help);
+
+ $res1 = extension_loaded('bcmath');
+ $res2 = extension_loaded('gmp');
+ if (! ($res1 || $res2)) {
+ $help = t('Error: one of "bcmath" or "gmp" (bigmath library) extensions are required.') . EOL;
+ }
+ $this->check_add($checks, t('Bigmath library (either bcmath or gmp)'), $res1||$res2, $help);
}
/**
@@ -514,6 +527,7 @@ class Setup extends \Zotlabs\Web\Controller {
$this->check_add($ck_funcs, t('mb_string PHP module'), true, true);
$this->check_add($ck_funcs, t('xml PHP module'), true, true);
$this->check_add($ck_funcs, t('zip PHP module'), true, true);
+ $this->check_add($ck_funcs, t('intl PHP module'), true, true);
if(function_exists('apache_get_modules')){
if(! in_array('mod_rewrite', apache_get_modules())) {
@@ -570,6 +584,10 @@ class Setup extends \Zotlabs\Web\Controller {
$ck_funcs[6]['status'] = false;
$ck_funcs[6]['help'] = t('Error: zip PHP module required but not installed.');
}
+ if(! extension_loaded('intl')) {
+ $ck_funcs[6]['status'] = false;
+ $ck_funcs[6]['help'] = t('Error: intl PHP module required but not installed.');
+ }
$checks = array_merge($checks, $ck_funcs);
}
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index 716f7229b..ea9313fa8 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -65,9 +65,7 @@ class Share extends \Zotlabs\Web\Controller {
$item = $r[0];
- $owner_uid = $r[0]['uid'];
- $owner_aid = $r[0]['aid'];
-
+/*
$can_comment = false;
if((array_key_exists('owner',$item)) && intval($item['owner']['abook_self']))
$can_comment = perm_is_allowed($item['uid'],$observer['xchan_hash'],'post_comments');
@@ -78,7 +76,7 @@ class Share extends \Zotlabs\Web\Controller {
notice( t('Permission denied') . EOL);
killme();
}
-
+*/
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($item['owner_xchan'])
);
@@ -96,25 +94,39 @@ class Share extends \Zotlabs\Web\Controller {
else
killme();
-
- $arr['aid'] = $owner_aid;
- $arr['uid'] = $owner_uid;
+ $arr['aid'] = $item['aid'];
+ $arr['uid'] = $item['uid'];
$arr['item_origin'] = 1;
$arr['item_wall'] = $item['item_wall'];
+ $arr['item_private'] = $item['item_private'];
$arr['uuid'] = item_message_id();
$arr['mid'] = z_root() . '/activity/' . $arr['uuid'];
- $arr['parent_mid'] = $item['mid'];
+ $arr['parent_mid'] = $item['parent_mid'];
+ $arr['thr_parent'] = $item['mid'];
+
+ $created = datetime_convert();
+
+ $arr['created'] = $created;
+ $arr['edited'] = $created;
+ $arr['commented'] = $created;
+ $arr['received'] = $created;
+ $arr['changed'] = $created;
+ $arr['item_type'] = ITEM_TYPE_POST;
$mention = '@[zrl=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/zrl]';
$arr['body'] = sprintf( t('&#x1f501; Repeated %1$s\'s %2$s'), $mention, Activity::activity_obj_mapper($item['obj_type']));
$arr['author_xchan'] = $channel['channel_hash'];
- $arr['owner_xchan'] = $item['author_xchan'];
- $arr['obj'] = Activity::encode_item($item);
+ $arr['owner_xchan'] = $item['author_xchan'];
+ $arr['source_xchan'] = '';
+
+ $arr['obj'] = $item['obj'];
$arr['obj_type'] = $item['obj_type'];
$arr['verb'] = ACTIVITY_SHARE;
+ call_hooks('post_local', $arr);
+
$post = item_store($arr);
$post_id = $post['item_id'];
@@ -123,7 +135,7 @@ class Share extends \Zotlabs\Web\Controller {
call_hooks('post_local_end', $arr);
- info( t('Post repeated') . EOL);
+ // info( t('Post repeated') . EOL);
$r = q("select * from item where id = %d",
intval($post_id)
diff --git a/Zotlabs/Module/Sharedwithme.php b/Zotlabs/Module/Sharedwithme.php
index c294079d4..6489959f0 100644
--- a/Zotlabs/Module/Sharedwithme.php
+++ b/Zotlabs/Module/Sharedwithme.php
@@ -40,7 +40,7 @@ class Sharedwithme extends Controller {
//drop all files - localuser
if((argc() > 1) && (argv(1) === 'dropall')) {
- $r = q("SELECT id FROM item WHERE verb = '%s' AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal",
+ $r = q("SELECT id FROM item WHERE (verb = 'Create' OR verb = '%s') AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal",
dbesc(ACTIVITY_POST),
intval(local_channel()),
dbesc($channel['channel_hash'])
@@ -56,7 +56,7 @@ class Sharedwithme extends Controller {
}
//list files
- $r = q("SELECT id, uid, obj, item_unseen FROM item WHERE verb = '%s' AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal",
+ $r = q("SELECT id, uid, obj, item_unseen FROM item WHERE (verb = 'Create' OR verb = '%s') AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal",
dbesc(ACTIVITY_POST),
intval(local_channel()),
dbesc($channel['channel_hash'])
diff --git a/Zotlabs/Module/Smilies.php b/Zotlabs/Module/Smilies.php
index efac07f84..7dde8c834 100644
--- a/Zotlabs/Module/Smilies.php
+++ b/Zotlabs/Module/Smilies.php
@@ -4,18 +4,8 @@ namespace Zotlabs\Module;
class Smilies extends \Zotlabs\Web\Controller {
- function get() {
- if (\App::$argv[1]==="json"){
- $tmp = list_smilies();
- $results = array();
- for($i = 0; $i < count($tmp['texts']); $i++) {
- $results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
- }
- json_return_and_die($results);
- }
- else {
- return smilies('',true);
- }
+ function init() {
+ json_return_and_die(get_emojis());
}
-
+
}
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index e4cb1c822..9fb295c4b 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -120,13 +120,17 @@ class Sse_bs extends Controller {
$mids = [];
$str = '';
+ $slice = 0;
- $mids_all_json = Cache::get('sse_mids_all_' . session_id());
+ $mids_all = isset($_SESSION['sse_mids_all']) ? unserialise($_SESSION['sse_mids_all']) : [];
- if (!$mids_all_json)
- $mids_all_json = '[]';
+ if (count($mids_all) > 3000) {
+ $slice = count($mids_all) - 3000;
+ }
- $mids_all = json_decode($mids_all_json, true);
+ if ($slice) {
+ $mids_all = array_slice($mids_all, $slice);
+ }
foreach($arr as $a) {
$mid_str = '\'' . dbesc(unpack_link_id($a)) . '\'';
@@ -137,7 +141,7 @@ class Sse_bs extends Controller {
}
}
- Cache::set('sse_mids_all_' . session_id(), json_encode($mids_all));
+ $_SESSION['sse_mids_all'] = serialise($mids_all);
if(! self::$uid) {
return;
@@ -149,7 +153,7 @@ class Sse_bs extends Controller {
call_hooks('update_unseen',$x);
if($x['update'] === 'unset' || intval($x['update'])) {
- q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND mid in (%s) AND item_unseen = 1",
+ q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND uuid in (%s) AND item_unseen = 1",
intval(self::$uid),
$str // this is dbesc() in the above foreach loop
);
@@ -177,10 +181,10 @@ class Sse_bs extends Controller {
$sql_extra = '';
if (!(self::$vnotify & VNOTIFY_LIKE)) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(self::$uid, 'dislike')) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
$sql_extra2 = '';
@@ -189,8 +193,8 @@ class Sse_bs extends Controller {
$item_normal = item_normal();
- // Filter FEP-5624 approvals for comments and internal follow activities
- $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_TAG) . "', '" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
+ // Filter internal follow activities and strerams add/remove activities
+ $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
if ($notifications) {
$items = q("SELECT * FROM item
@@ -260,10 +264,10 @@ class Sse_bs extends Controller {
$sql_extra = '';
if (!(self::$vnotify & VNOTIFY_LIKE)) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(self::$uid, 'dislike')) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
$sql_extra2 = '';
@@ -272,8 +276,8 @@ class Sse_bs extends Controller {
$item_normal = item_normal();
- // Filter FEP-5624 approvals for comments and internal follow activities
- $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_TAG) . "', '" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
+ // Filter internal follow activities and strerams add/remove activities
+ $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
if ($notifications) {
$items = q("SELECT * FROM item
@@ -342,10 +346,10 @@ class Sse_bs extends Controller {
$sql_extra = '';
if (!(self::$vnotify & VNOTIFY_LIKE)) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(self::$uid, 'dislike')) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
$sql_extra2 = '';
@@ -355,8 +359,8 @@ class Sse_bs extends Controller {
$item_normal = item_normal();
- // Filter FEP-5624 approvals for comments and internal follow activities
- $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_TAG) . "', '" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
+ // Filter internal follow activities and strerams add/remove activities
+ $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
if ($notifications) {
$items = q("SELECT * FROM item
@@ -437,10 +441,10 @@ class Sse_bs extends Controller {
$sys = get_sys_channel();
$sql_extra = '';
if (!(self::$vnotify & VNOTIFY_LIKE)) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(self::$uid, 'dislike')) {
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
$sql_extra2 = '';
@@ -448,10 +452,9 @@ class Sse_bs extends Controller {
$sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") ";
$sql_extra3 = '';
- $sse_mids_all_json = Cache::get('sse_mids_all_' . session_id());
- if ($sse_mids_all_json) {
- $sse_mids_all = json_decode($sse_mids_all_json, true);
- $sql_extra3 = " AND mid NOT IN (" . protect_sprintf(implode(',', $sse_mids_all)) . ") ";
+ $sse_mids_all = unserialise($_SESSION['sse_mids_all']) ?? [];
+ if ($sse_mids_all) {
+ $sql_extra3 = " AND uuid NOT IN (" . protect_sprintf(implode(',', $sse_mids_all)) . ") ";
}
$uids = " AND uid IN ( " . $sys['channel_id'] . " ) ";
@@ -463,8 +466,8 @@ class Sse_bs extends Controller {
$item_normal = item_normal();
- // Filter FEP-5624 approvals for comments and internal follow activities
- $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_TAG) . "', '" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
+ // Filter internal follow activities and strerams add/remove activities
+ $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
if ($notifications) {
$items = q("SELECT * FROM item
@@ -589,7 +592,7 @@ class Sse_bs extends Controller {
$sql_extra = '';
if(! (self::$vnotify & VNOTIFY_LIKE))
- $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
$fcount = count($forums);
$i = 0;
@@ -659,11 +662,11 @@ class Sse_bs extends Controller {
$item_normal = item_normal();
- // Filter FEP-5624 approvals for comments and internal follow activities
- $item_normal .= " AND verb NOT IN ('Add', 'Remove', '" . dbesc(ACTIVITY_TAG) . "', '" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
+ // Filter internal follow activities and strerams add/remove activities
+ $item_normal .= " AND verb NOT IN ('Add', 'Remove', 'Follow', 'Ignore', '" . dbesc(ACTIVITY_FOLLOW) . "') ";
$r = q("SELECT * FROM item
- WHERE verb = '%s'
+ WHERE (verb = 'Create' OR verb = '%s')
AND obj_type IN ('Document', 'Video', 'Audio', 'Image')
AND uid = %d
AND author_xchan != '%s'
diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php
index a796d85cb..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",
@@ -106,16 +106,13 @@ class Subthread extends \Zotlabs\Web\Controller {
else
killme();
-
-
-
$uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
$links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink']));
- $objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
+ $objtype = (($item['resource_type'] === 'photo') ? 'Image' : 'Note');
$body = $item['body'];
@@ -124,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();
@@ -149,7 +146,7 @@ class Subthread extends \Zotlabs\Web\Controller {
$ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
- $plink = '[zrl=' . z_root() . '/display/' . gen_link_id($item['mid']) . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['uuid'] . ']' . $post_type . '[/zrl]';
$arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink );
diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php
index 4aaae5885..b6067be5e 100644
--- a/Zotlabs/Module/Tagger.php
+++ b/Zotlabs/Module/Tagger.php
@@ -67,15 +67,15 @@ class Tagger extends \Zotlabs\Web\Controller {
switch($item['resource_type']) {
case 'photo':
- $targettype = ACTIVITY_OBJ_PHOTO;
+ $targettype = 'Image';
$post_type = t('photo');
break;
case 'event':
- $targettype = ACTIVITY_OBJ_EVENT;
+ $targettype = 'Event';
$post_type = t('event');
break;
default:
- $targettype = ACTIVITY_OBJ_NOTE;
+ $targettype = 'Note';
$post_type = t('post');
if($item['mid'] != $item['parent_mid'])
$post_type = t('comment');
@@ -86,7 +86,7 @@ class Tagger extends \Zotlabs\Web\Controller {
$clean_term = trim($term,'"\' ');
$links = array(array('rel' => 'alternate','type' => 'text/html',
- 'href' => z_root() . '/display/' . gen_link_id($item['mid'])));
+ 'href' => z_root() . '/display/' . $item['uuid']));
$target = json_encode(array(
'type' => $targettype,
diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php
index b065b0022..2038db8c0 100644
--- a/Zotlabs/Module/Thing.php
+++ b/Zotlabs/Module/Thing.php
@@ -5,27 +5,50 @@
namespace Zotlabs\Module;
+use App;
use Zotlabs\Lib\Libsync;
-
-require_once('include/items.php');
-require_once('include/security.php');
-require_once('include/selectors.php');
-require_once('include/acl_selectors.php');
+use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\ActivityStreams;
+use Zotlabs\Lib\Libzot;
class Thing extends \Zotlabs\Web\Controller {
function init() {
+ if (argv(1) && ActivityStreams::is_as_request()) {
+ $r = q("select obj_channel from obj where obj_type = %d and obj_obj = '%s' limit 1",
+ intval(TERM_OBJ_THING),
+ dbesc(argv(1))
+ );
- if(! local_channel())
- return;
+ if (!$r) {
+ http_status_exit(404, 'Not found');
+ }
- $channel = \App::get_channel();
+ $sql_extra = permissions_sql($r[0]['obj_channel']);
+
+ $r = q("select * from obj where obj_type = %d and obj_obj = '%s' $sql_extra limit 1",
+ intval(TERM_OBJ_THING),
+ dbesc(argv(1))
+ );
+
+ if ($r) {
+ $channel = channelx_by_n($r[0]['obj_channel']);
+ as_return_and_die(Activity::fetch_thing(['id' => $r[0]['obj_obj']]), $channel);
+ }
+
+ http_status_exit(404, 'Not found');
- if($_SERVER['REQUEST_METHOD'] === 'GET' && argc() < 2) {
- profile_load($channel['channel_address']);
}
+ }
+
+
+ function post() {
+
+ if(! local_channel())
+ return;
+ $channel = \App::get_channel();
$term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : '');
@@ -36,7 +59,7 @@ class Thing extends \Zotlabs\Web\Controller {
$url = $_REQUEST['url'];
$photo = $_REQUEST['img'];
- $hash = random_string();
+ $hash = new_uuid();
$verbs = obj_verbs();
@@ -77,13 +100,7 @@ class Thing extends \Zotlabs\Web\Controller {
return;
$acl = new \Zotlabs\Access\AccessList($channel);
-
- if(array_key_exists('contact_allow',$_REQUEST)
- || array_key_exists('group_allow',$_REQUEST)
- || array_key_exists('contact_deny',$_REQUEST)
- || array_key_exists('group_deny',$_REQUEST)) {
- $acl->set_from_array($_REQUEST);
- }
+ $acl->set_from_array($_REQUEST);
$x = $acl->get();
@@ -181,28 +198,20 @@ class Thing extends \Zotlabs\Web\Controller {
intval(local_channel()),
dbesc($hash)
);
+
if($r) {
Libsync::build_sync_packet(0, array('obj' => $r));
}
if($activity) {
- $arr = array();
- $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $url));
- if($local_photo)
- $links[] = array('rel' => 'photo', 'type' => $local_photo_type, 'href' => $local_photo);
- $objtype = ACTIVITY_OBJ_THING;
-
- $obj = json_encode(array(
- 'type' => $objtype,
- 'id' => $url,
- 'link' => $links,
- 'title' => $name,
- 'content' => $name
- ));
+ $obj = Activity::fetch_thing(['id' => $r[0]['obj_obj']]);
$bodyverb = str_replace('OBJ: ', '',t('OBJ: %1$s %2$s %3$s'));
+ $arr['uuid'] = $r[0]['obj_obj'];
+ $arr['mid'] = z_root() . '/thing/' . $arr['uuid'];
+
$arr['owner_xchan'] = $channel['channel_hash'];
$arr['author_xchan'] = $channel['channel_hash'];
@@ -213,29 +222,38 @@ class Thing extends \Zotlabs\Web\Controller {
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
$plink = '[zrl=' . $url . ']' . $name . '[/zrl]';
- $arr['body'] = sprintf( $bodyverb, $ulink, $translated_verb, $plink );
+ $arr['title'] = $channel['channel_name'] . ' ' . $translated_verb . ' ' . $name;
+ $arr['body'] = $url;
if($local_photo)
- $arr['body'] .= "\n\n[zmg]" . $local_photo . "[/zmg]";
+ $arr['body'] = '[zrl=' . $url . '][zmg=' . $local_photo . ']' . $name . '[/zmg][/zrl]';
- $arr['verb'] = $verb;
- $arr['obj_type'] = $objtype;
+ $arr['verb'] = 'Create';
+ $arr['obj_type'] = 'Page';
$arr['obj'] = $obj;
- if(! $profile['is_default']) {
+ $arr['allow_cid'] = $x['allow_cid'];
+ $arr['allow_gid'] = $x['allow_gid'];
+ $arr['deny_cid'] = $x['deny_cid'];
+ $arr['deny_gid'] = $x['deny_gid'];
+
+ if (!$profile['is_default']) {
$arr['item_private'] = true;
- $str = '';
+
$r = q("select abook_xchan from abook where abook_channel = %d and abook_profile = '%s'",
intval(local_channel()),
dbesc($profile_guid)
);
+
if($r) {
$arr['allow_cid'] = '';
- foreach($r as $rr)
+ foreach($r as $rr) {
$arr['allow_cid'] .= '<' . $rr['abook_xchan'] . '>';
+ }
}
- else
+ else {
$arr['allow_cid'] = '<' . get_observer_hash() . '>';
+ }
}
$ret = post_activity_item($arr);
@@ -254,21 +272,30 @@ class Thing extends \Zotlabs\Web\Controller {
intval(TERM_OBJ_THING),
dbesc(argv(1))
);
- if($r)
- $sql_extra = permissions_sql($r[0]['obj_channel']);
+
+ if (!$r) {
+ notice( t('item not found.') . EOL);
+ return;
+ }
+
+ $sql_extra = permissions_sql($r[0]['obj_channel']);
$r = q("select * from obj where obj_type = %d and obj_obj = '%s' $sql_extra limit 1",
intval(TERM_OBJ_THING),
dbesc(argv(1))
);
- if($r) {
+ if ($r) {
+ $channel = channelx_by_n($r[0]['obj_channel']);
+ profile_load($channel['channel_address']);
+
return replace_macros(get_markup_template('show_thing.tpl'), array(
- '$header' => t('Show Thing'),
+ '$header' => $channel['xchan_name'] . ' ' . $r[0]['obj_verb'] . ' ' . $r[0]['obj_term'],
'$edit' => t('Edit'),
'$delete' => t('Delete'),
'$canedit' => ((local_channel() && local_channel() == $r[0]['obj_channel']) ? true : false),
- '$thing' => $r[0] ));
+ '$thing' => $r[0]
+ ));
}
else {
notice( t('item not found.') . EOL);
@@ -283,6 +310,8 @@ class Thing extends \Zotlabs\Web\Controller {
return;
}
+ profile_load($channel['channel_address']);
+
$acl = new \Zotlabs\Access\AccessList($channel);
$channel_acl = $acl->get();
@@ -319,7 +348,7 @@ class Thing extends \Zotlabs\Web\Controller {
'$img_lbl' => t('URL for photo of thing (optional)'),
'$imgurl' => $r[0]['obj_imgurl'],
'$permissions' => t('Permissions'),
- '$aclselect' => populate_acl($channel_acl,false),
+ '$aclselect' => populate_acl($channel_acl, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')),
'$allow_cid' => acl2json($channel_acl['allow_cid']),
'$allow_gid' => acl2json($channel_acl['allow_gid']),
'$deny_cid' => acl2json($channel_acl['deny_cid']),
@@ -344,7 +373,6 @@ class Thing extends \Zotlabs\Web\Controller {
return '';
}
-
delete_thing_photo($r[0]['obj_imgurl'],get_observer_hash());
$x = q("delete from obj where obj_obj = '%s' and obj_type = %d and obj_channel = %d",
@@ -372,7 +400,7 @@ class Thing extends \Zotlabs\Web\Controller {
'$url_lbl' => t('URL of thing (optional)'),
'$img_lbl' => t('URL for photo of thing (optional)'),
'$permissions' => t('Permissions'),
- '$aclselect' => populate_acl($channel_acl,false),
+ '$aclselect' => populate_acl($channel_acl, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')),
'$allow_cid' => acl2json($channel_acl['allow_cid']),
'$allow_gid' => acl2json($channel_acl['allow_gid']),
'$deny_cid' => acl2json($channel_acl['deny_cid']),
diff --git a/Zotlabs/Module/Vote.php b/Zotlabs/Module/Vote.php
index 870fd760c..06c47f91f 100644
--- a/Zotlabs/Module/Vote.php
+++ b/Zotlabs/Module/Vote.php
@@ -98,7 +98,7 @@ class Vote extends Controller {
// now reset the placeholders
- $item['verb'] = ACTIVITY_POST;
+ $item['verb'] = 'Create';
$item['obj_type'] = 'Answer';
unset($item['author']);