From f2fd12fbe544d5e87680aed98489698b4ca9ddd6 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 18 Nov 2020 09:52:44 +0000 Subject: Do away with auto updates except for our own actions. We might consider to re-implement this for single thread view like eg /display. Instead of calculating scroll positions during updates, keep track of expanded items and set the expanded state when updating - this fixes issue #1488 --- Zotlabs/Module/Channel.php | 25 +++++----------------- Zotlabs/Module/Display.php | 25 +++++----------------- Zotlabs/Module/Filer.php | 3 ++- Zotlabs/Module/Filerm.php | 10 ++++++--- Zotlabs/Module/Hq.php | 22 +++++-------------- Zotlabs/Module/Network.php | 25 +++++----------------- Zotlabs/Module/Pubstream.php | 42 +++++++++++-------------------------- Zotlabs/Module/Search.php | 9 -------- Zotlabs/Module/Settings/Display.php | 3 --- 9 files changed, 41 insertions(+), 123 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index dc8e9e1c5..f61c8bdc9 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -130,9 +130,6 @@ class Channel extends Controller { $noscript_content = get_config('system', 'noscript_content', '1'); - if($load) - $_SESSION['loadtime'] = datetime_convert(); - $category = $datequery = $datequery2 = ''; $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); @@ -152,7 +149,6 @@ class Channel extends Controller { $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'post'); - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); $search = ((x($_GET,'search')) ? $_GET['search'] : EMPTY_STR); $groups = array(); @@ -187,8 +183,6 @@ class Channel extends Controller { nav_set_selected('Channel Home'); - $static = channel_manual_conv_update(App::$profile['profile_uid']); - // search terms header if($search) { $o .= replace_macros(get_markup_template("section_title.tpl"),array( @@ -255,7 +249,9 @@ class Channel extends Controller { $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " "; - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); + $simple_update = ''; + if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; if($search) { $search = escape_tags($search); @@ -270,7 +266,6 @@ class Channel extends Controller { } } - head_add_link([ 'rel' => 'alternate', 'type' => 'application/json+oembed', @@ -278,14 +273,6 @@ class Channel extends Controller { 'title' => 'oembed' ]); - if($update && $_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($load) - $simple_update = ''; - - if($static && $simple_update) - $simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - if(($update) && (! $load)) { if($mid) { @@ -294,7 +281,6 @@ class Channel extends Controller { dbesc($mid . '%'), intval(App::$profile['profile_uid']) ); - $_SESSION['loadtime'] = datetime_convert(); } else { $r = q("SELECT parent AS item_id from item @@ -306,9 +292,7 @@ class Channel extends Controller { ORDER BY created DESC", intval(App::$profile['profile_uid']) ); - $_SESSION['loadtime'] = datetime_convert(); } - } else { @@ -424,7 +408,6 @@ class Channel extends Controller { '$wall' => '1', '$fh' => '0', '$dm' => '0', - '$static' => $static, '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => $search, '$xchan' => '', @@ -476,6 +459,8 @@ class Channel extends Controller { if($mid) $o .= '
'; + $_SESSION['loadtime'] = datetime_convert(); + return $o; } } diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 3d61d7018..5d3ea94ff 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -22,9 +22,6 @@ class Display extends \Zotlabs\Web\Controller { $module_format = 'html'; } - if($load) - $_SESSION['loadtime'] = datetime_convert(); - if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; @@ -183,22 +180,11 @@ class Display extends \Zotlabs\Web\Controller { return ''; } - - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - + $simple_update = ''; if($update && $_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($load) - $simple_update = ''; - - if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - - if((! $update) && (! $load)) { + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); + if((! $update) && (! $load)) { // if the target item is not a post (eg a like) we want to address its thread parent @@ -229,7 +215,6 @@ class Display extends \Zotlabs\Web\Controller { '$dm' => '0', '$nouveau' => '0', '$wall' => '0', - '$static' => $static, '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', @@ -315,7 +300,6 @@ class Display extends \Zotlabs\Web\Controller { dbesc($target_item['parent_mid']) ); } - if($r === null) { // in case somebody turned off public access to sys channel content using permissions // make that content unsearchable by ensuring the owner_xchan can't match @@ -335,7 +319,6 @@ class Display extends \Zotlabs\Web\Controller { intval($sysid) ); } - $_SESSION['loadtime'] = datetime_convert(); } else { @@ -448,6 +431,8 @@ class Display extends \Zotlabs\Web\Controller { } + $_SESSION['loadtime'] = datetime_convert(); + return $o; } diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index af59f28fb..c2747e6c2 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -31,7 +31,8 @@ class Filer extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) { - $x = q("update item set item_retained = 1 where id = %d and uid = %d", + $x = q("update item set item_retained = 1, changed = '%s' where id = %d and uid = %d", + dbesc(datetime_convert()), intval($r[0]['parent']), intval(local_channel()) ); diff --git a/Zotlabs/Module/Filerm.php b/Zotlabs/Module/Filerm.php index cbf6a118d..9fdfe6c46 100644 --- a/Zotlabs/Module/Filerm.php +++ b/Zotlabs/Module/Filerm.php @@ -28,10 +28,14 @@ class Filerm extends \Zotlabs\Web\Controller { intval($item_id), dbesc($term) ); + + $x = q("update item set item_retained = 0, changed = '%s' where id = %d and uid = %d", + dbesc(datetime_convert()), + intval($item_id), + intval(local_channel()) + ); + } - - if(x($_SESSION,'return_url')) - goaway(z_root() . '/' . $_SESSION['return_url']); killme(); } diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index e2678c07f..3f5c4ed52 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -38,9 +38,6 @@ class Hq extends \Zotlabs\Web\Controller { if(!local_channel()) return; - if($load) - $_SESSION['loadtime'] = datetime_convert(); - if(argc() > 1 && argv(1) !== 'load') { $item_hash = argv(1); } @@ -87,15 +84,9 @@ class Hq extends \Zotlabs\Web\Controller { goaway(z_root() . '/moderate/' . $target_item['id']); } - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - + $simple_update = ''; if($update && $_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($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; $sys = get_sys_channel(); $sql_extra = item_permissions_sql($sys['channel_id']); @@ -148,8 +139,6 @@ class Hq extends \Zotlabs\Web\Controller { nav_set_selected('HQ'); - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); - if($target_item) { // 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']); @@ -182,8 +171,7 @@ class Hq extends \Zotlabs\Web\Controller { '$dm' => '0', '$nouveau' => '0', '$wall' => '0', - '$static' => $static, - '$page' => 1, + '$page' => '1', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', '$xchan' => '', @@ -249,8 +237,6 @@ class Hq extends \Zotlabs\Web\Controller { intval($sys['channel_id']) ); } - - $_SESSION['loadtime'] = datetime_convert(); } else { $r = []; @@ -275,6 +261,8 @@ class Hq extends \Zotlabs\Web\Controller { $o .= '
'; + $_SESSION['loadtime'] = datetime_convert(); + return $o; } diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index bbacbb21e..ff62bdda2 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -44,10 +44,6 @@ class Network extends \Zotlabs\Web\Controller { $o = ''; - if($load) { - $_SESSION['loadtime'] = datetime_convert(); - } - $arr = array('query' => App::$query_string); call_hooks('network_content_init', $arr); @@ -64,7 +60,6 @@ class Network extends \Zotlabs\Web\Controller { $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); - $static = ((x($_GET,'static')) ? intval($_GET['static']) : 0); $gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); @@ -213,8 +208,6 @@ class Network extends \Zotlabs\Web\Controller { $status_editor = status_editor($a,$x,false,'Network'); $o .= $status_editor; - $static = channel_manual_conv_update(local_channel()); - } @@ -370,7 +363,6 @@ class Network extends \Zotlabs\Web\Controller { '$dm' => (($dm) ? $dm : '0'), '$nouveau' => (($nouveau) ? $nouveau : '0'), '$wall' => '0', - '$static' => $static, '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => (($search) ? urlencode($search) : ''), @@ -494,8 +486,6 @@ class Network extends \Zotlabs\Web\Controller { $parents_str = ''; - $simple_update = (($update) ? " and item_unseen = 1 " : ''); - // This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day // or three and look at your matrix page - after opening up your browser. The first page loads just as it // should. All of a sudden a few seconds later, page 2 will get inserted at the beginning of the page @@ -507,16 +497,11 @@ class Network extends \Zotlabs\Web\Controller { // which "arrived as you were reading page 1". We're going to do this // by storing in your session the current UTC time whenever you LOAD a network page, and only UPDATE items // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers... - - if($update && $_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($load) - $simple_update = ''; + $simple_update = ''; + if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - if($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, created FROM item @@ -524,7 +509,6 @@ class Network extends \Zotlabs\Web\Controller { $net_query WHERE true $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $simple_update $sql_extra $sql_options $sql_nets $net_query2 ORDER BY item.created DESC $pager_sql " @@ -570,7 +554,6 @@ class Network extends \Zotlabs\Web\Controller { and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_options $sql_nets $net_query2" ); - $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page @@ -605,6 +588,8 @@ class Network extends \Zotlabs\Web\Controller { if(($items) && (! $update)) $o .= alt_pager(count($items)); + + $_SESSION['loadtime'] = datetime_convert(); return $o; } diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 55c96b23d..e6afdb391 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -23,9 +23,6 @@ class Pubstream extends \Zotlabs\Web\Controller { } } - if($load) - $_SESSION['loadtime'] = datetime_convert(); - if((observer_prohibited(true))) { return login(); } @@ -59,7 +56,6 @@ class Pubstream extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); $net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : ''); $title = replace_macros(get_markup_template("section_title.tpl"),array( @@ -103,21 +99,11 @@ class Pubstream extends \Zotlabs\Web\Controller { $o .= status_editor($a,$x,false,'Pubstream'); $o .= ''; } - - - - - if(! $update && !$load) { nav_set_selected(t('Public Stream')); - if(!$mid) - $_SESSION['static_loadtime'] = datetime_convert(); - - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); - $maxheight = get_config('system','home_divmore_height'); if(! $maxheight) $maxheight = 400; @@ -148,7 +134,6 @@ class Pubstream extends \Zotlabs\Web\Controller { '$nouveau' => '0', '$wall' => '0', '$list' => '0', - '$static' => $static, '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => '', '$xchan' => '', @@ -200,14 +185,10 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " "; - - $simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : ''); - - if($load) - $simple_update = ''; - if($static && $simple_update) - $simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update = ''; + if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; //logger('update: ' . $update . ' load: ' . $load); @@ -220,10 +201,10 @@ 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 mid like '%s' $uids $item_normal + WHERE mid = '%s' $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1", - dbesc($mid . '%') + $sql_extra3 $sql_extra $sql_nets $net_query2", + dbesc($mid) ); } else { @@ -243,10 +224,10 @@ 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 mid like '%s' $uids $item_normal_update $simple_update + WHERE mid = '%s' $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1", - dbesc($mid . '%') + $sql_extra3 $sql_extra $sql_nets $net_query2", + dbesc($mid) ); } else { @@ -259,7 +240,6 @@ class Pubstream extends \Zotlabs\Web\Controller { $sql_extra3 $sql_extra $sql_nets $net_query2" ); } - $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page @@ -291,7 +271,7 @@ class Pubstream extends \Zotlabs\Web\Controller { // fake it $mode = (($hashtags) ? 'search' : 'pubstream'); - + $o .= conversation($items,$mode,$update,$page_mode); if($mid) @@ -300,6 +280,8 @@ class Pubstream extends \Zotlabs\Web\Controller { if(($items) && (! $update)) $o .= alt_pager(count($items)); + $_SESSION['loadtime'] = datetime_convert(); + return $o; } diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index d586ae12f..c22bf2836 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -19,9 +19,6 @@ class Search extends \Zotlabs\Web\Controller { } } - if($load) - $_SESSION['loadtime'] = datetime_convert(); - nav_set_selected('Search'); require_once("include/bbcode.php"); @@ -54,8 +51,6 @@ class Search extends \Zotlabs\Web\Controller { $search = ((x($_GET,'tag')) ? trim(escape_tags(rawurldecode($_GET['tag']))) : ''); } - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - $o .= search($search,'search-box','/search',((local_channel()) ? true : false)); if(strpos($search,'#') === 0) { @@ -105,9 +100,6 @@ class Search extends \Zotlabs\Web\Controller { if((! $update) && (! $load)) { - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 0); - - // 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. @@ -131,7 +123,6 @@ class Search extends \Zotlabs\Web\Controller { '$dm' => '0', '$nouveau' => '0', '$wall' => '0', - '$static' => $static, '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => (($tag) ? urlencode('#') : '') . $search, diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 01ae8652a..cade0a529 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -28,7 +28,6 @@ class Display { $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); $title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0); - $manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0); $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); @@ -47,7 +46,6 @@ class Display { set_pconfig(local_channel(),'system','itemspage', $itemspage); set_pconfig(local_channel(),'system','no_smilies',1-intval($nosmile)); set_pconfig(local_channel(),'system','title_tosource',$title_tosource); - set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); set_pconfig(local_channel(),'system','channel_menu', $channel_menu); set_pconfig(local_channel(),'system','start_menu', $start_menu); @@ -200,7 +198,6 @@ class Display { '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 30 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1-intval($nosmile), '', $yes_no), '$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ], - '$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$theme_config' => $theme_config, '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no] -- cgit v1.2.3 From f1101808b7b6e437ccf9f8ebe9e7a8e67652edc0 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 18 Nov 2020 17:09:53 +0000 Subject: fix regression in relation to pustream notifications --- Zotlabs/Module/Pubstream.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index e6afdb391..6a941d06c 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -104,6 +104,9 @@ class Pubstream extends \Zotlabs\Web\Controller { nav_set_selected(t('Public Stream')); + if(!$mid) + $_SESSION['static_loadtime'] = datetime_convert(); + $maxheight = get_config('system','home_divmore_height'); if(! $maxheight) $maxheight = 400; -- cgit v1.2.3 From 011de75706ddd407cadfde89eec891b17db17211 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 20 Nov 2020 09:14:46 +0000 Subject: returning the rendered html when posting a comment will make the following update (and its implication in mod pubstream) obsolete --- Zotlabs/Module/Item.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 922a2ef06..66c18fefd 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1373,8 +1373,18 @@ class Item extends Controller { if($return_path) { goaway(z_root() . "/" . $return_path); } - - $json = array('success' => 1); + + $item[] = $datarray; + $item[0]['owner'] = $owner_xchan; + $item[0]['author'] = $observer; + $item[0]['attach'] = json_encode($datarray['attach']); + + $json = [ + 'success' => 1, + 'id' => $post_id, + 'html' => conversation($item,'network',true,'r_preview'), + ]; + if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) $json['reload'] = z_root() . '/' . $_REQUEST['jsreload']; -- cgit v1.2.3 From 2d4064aca4517eac695ba0f0f3618f4a7f7a08cb Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 20 Nov 2020 20:38:10 +0000 Subject: returning the rendered html when liking a post or comment --- Zotlabs/Module/Like.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 8ffa7f66c..538282c38 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -357,16 +357,45 @@ class Like extends \Zotlabs\Web\Controller { // drop_item was not done interactively, so we need to invoke the notifier // in order to push the changes to connections - + \Zotlabs\Daemon\Master::Summon(array('Notifier','drop',$rr['id'])); + + } if($interactive) return; - if(! $multi_undo) + if(! $multi_undo) { + $item_normal = item_normal(); + $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')", + intval($owner_uid), + dbesc($item['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + xchan_query($activities,true); + $convitems[] = $item; + $convitems = array_merge($convitems, $activities); + + $json = [ + 'success' => 1, + 'id' => $item['id'], + 'html' => conversation($convitems,'network',true,'r_preview'), + ]; + + echo json_encode($json); killme(); + } + + } } @@ -505,6 +534,31 @@ class Like extends \Zotlabs\Web\Controller { $post = item_store($arr); $post_id = $post['item_id']; + //$item[] = $item; + + $item_normal = item_normal(); + $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')", + intval($owner_uid), + dbesc($item['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + xchan_query($activities,true); + $convitems[] = $item; + $convitems = array_merge($convitems, $activities); + + $json = [ + 'success' => 1, + 'id' => $item['id'], + 'html' => conversation($convitems,'network',true,'r_preview'), + ]; + // save the conversation from expiration if(local_channel() && array_key_exists('item',$post) && (intval($post['item']['id']) != intval($post['item']['parent']))) @@ -548,7 +602,8 @@ class Like extends \Zotlabs\Web\Controller { $o .= t('Thank you.'); return $o; } - + + echo json_encode($json); killme(); } -- cgit v1.2.3 From d559b4a2017e58c1dd24684c329327e935452e64 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 21 Nov 2020 10:21:14 +0000 Subject: deliver to local hub first --- Zotlabs/Daemon/Notifier.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index f24eab773..28c512d4a 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -640,9 +640,16 @@ class Notifier { } else { if(! in_array($hub['hubloc_url'],$urls)) { - $hublist[] = $hub['hubloc_host'] . ' ' . $hub['hubloc_network']; - $dhubs[] = $hub; - $urls[] = $hub['hubloc_url']; + if($hub['hubloc_url'] === z_root()) { + //deliver to local hub first + array_unshift($hublist, $hub['hubloc_host'] . ' ' . $hub['hubloc_network']); + array_unshift($dhubs, $hub); + } + else { + $hublist[] = $hub['hubloc_host'] . ' ' . $hub['hubloc_network']; + $dhubs[] = $hub; + } + $urls[] = $hub['hubloc_url']; } } } -- cgit v1.2.3 From f74cfaec5f48ec37cc1f51e5381a45998ebc70e3 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 21 Nov 2020 10:22:23 +0000 Subject: fix pubstream id issue --- Zotlabs/Module/Like.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 538282c38..638ec6a78 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -387,6 +387,7 @@ class Like extends \Zotlabs\Web\Controller { $json = [ 'success' => 1, + 'orig_id' => $item_id, 'id' => $item['id'], 'html' => conversation($convitems,'network',true,'r_preview'), ]; @@ -534,8 +535,6 @@ class Like extends \Zotlabs\Web\Controller { $post = item_store($arr); $post_id = $post['item_id']; - //$item[] = $item; - $item_normal = item_normal(); $activities = q("SELECT item.*, item.id AS item_id FROM item WHERE uid = %d $item_normal @@ -555,6 +554,7 @@ class Like extends \Zotlabs\Web\Controller { $json = [ 'success' => 1, + 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] 'id' => $item['id'], 'html' => conversation($convitems,'network',true,'r_preview'), ]; -- cgit v1.2.3 From 7639157a4907e9dbdffe6dd24f4f687f4cce6f01 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 21 Nov 2020 20:15:05 +0000 Subject: restrict returned html usage to local_channel() until some issues will be worked out --- Zotlabs/Module/Item.php | 28 +++++++++----- Zotlabs/Module/Like.php | 101 +++++++++++++++++++++++++----------------------- 2 files changed, 70 insertions(+), 59 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 66c18fefd..ce344ee82 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1374,16 +1374,24 @@ class Item extends Controller { goaway(z_root() . "/" . $return_path); } - $item[] = $datarray; - $item[0]['owner'] = $owner_xchan; - $item[0]['author'] = $observer; - $item[0]['attach'] = json_encode($datarray['attach']); - - $json = [ - 'success' => 1, - 'id' => $post_id, - 'html' => conversation($item,'network',true,'r_preview'), - ]; + + if(local_channel()) { + $item[] = $datarray; + $item[0]['owner'] = $owner_xchan; + $item[0]['author'] = $observer; + $item[0]['attach'] = json_encode($datarray['attach']); + + $json = [ + 'success' => 1, + 'id' => $post_id, + 'html' => conversation($item,'network',true,'r_preview'), + ]; + } + else { + $json = [ + 'success' => 1 + ]; + } if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) $json['reload'] = z_root() . '/' . $_REQUEST['jsreload']; diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 638ec6a78..02fc87756 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -368,31 +368,33 @@ class Like extends \Zotlabs\Web\Controller { return; if(! $multi_undo) { - $item_normal = item_normal(); - $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')", - intval($owner_uid), - dbesc($item['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), - dbesc(ACTIVITY_ATTEND), - dbesc(ACTIVITY_ATTENDNO), - dbesc(ACTIVITY_ATTENDMAYBE) - ); - xchan_query($activities,true); - $convitems[] = $item; - $convitems = array_merge($convitems, $activities); - - $json = [ - 'success' => 1, - 'orig_id' => $item_id, - 'id' => $item['id'], - 'html' => conversation($convitems,'network',true,'r_preview'), - ]; - - echo json_encode($json); + if(local_channel()) { + $item_normal = item_normal(); + $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')", + intval($owner_uid), + dbesc($item['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + xchan_query($activities,true); + $convitems[] = $item; + $convitems = array_merge($convitems, $activities); + + $json = [ + 'success' => 1, + 'orig_id' => $item_id, + 'id' => $item['id'], + 'html' => conversation($convitems,'network',true,'r_preview'), + ]; + + echo json_encode($json); + } killme(); } @@ -531,33 +533,34 @@ class Like extends \Zotlabs\Web\Controller { call_hooks('post_local',$arr); - $post = item_store($arr); $post_id = $post['item_id']; - $item_normal = item_normal(); - $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')", - intval($owner_uid), - dbesc($item['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), - dbesc(ACTIVITY_ATTEND), - dbesc(ACTIVITY_ATTENDNO), - dbesc(ACTIVITY_ATTENDMAYBE) - ); - xchan_query($activities,true); - $convitems[] = $item; - $convitems = array_merge($convitems, $activities); - - $json = [ - 'success' => 1, - 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] - 'id' => $item['id'], - 'html' => conversation($convitems,'network',true,'r_preview'), - ]; + if(local_channel()) { + $item_normal = item_normal(); + $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')", + intval($owner_uid), + dbesc($item['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + xchan_query($activities,true); + $convitems[] = $item; + $convitems = array_merge($convitems, $activities); + + $json = [ + 'success' => 1, + 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] + 'id' => $item['id'], + 'html' => conversation($convitems,'network',true,'r_preview'), + ]; + } // save the conversation from expiration -- cgit v1.2.3 From bb43c57b0731270d563dca8afb773b49e9023f54 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 21 Nov 2020 20:57:50 +0000 Subject: make simple update more simple again --- Zotlabs/Module/Channel.php | 2 +- Zotlabs/Module/Display.php | 2 +- Zotlabs/Module/Hq.php | 2 +- Zotlabs/Module/Network.php | 2 +- Zotlabs/Module/Pubstream.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index f61c8bdc9..153b4feaf 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -251,7 +251,7 @@ class Channel extends Controller { $simple_update = ''; if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $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($search) { $search = escape_tags($search); diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 5d3ea94ff..81ac0f7b8 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -182,7 +182,7 @@ class Display extends \Zotlabs\Web\Controller { $simple_update = ''; if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $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)) { diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 3f5c4ed52..4c2067299 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -86,7 +86,7 @@ class Hq extends \Zotlabs\Web\Controller { $simple_update = ''; if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; $sys = get_sys_channel(); $sql_extra = item_permissions_sql($sys['channel_id']); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index ff62bdda2..4a1692d64 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -500,7 +500,7 @@ class Network extends \Zotlabs\Web\Controller { $simple_update = ''; if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $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($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 6a941d06c..113f0a196 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -191,7 +191,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $simple_update = ''; if($update && $_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']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; //logger('update: ' . $update . ' load: ' . $load); -- cgit v1.2.3 From c0adf31da9a0d8f897dc68ab632c736891318ad5 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 22 Nov 2020 13:07:03 +0000 Subject: fix like issue with remote channels --- Zotlabs/Module/Channel.php | 5 +- Zotlabs/Module/Like.php | 121 ++++++++++++++++++++++++--------------------- 2 files changed, 67 insertions(+), 59 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 153b4feaf..7ff394750 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -390,7 +390,7 @@ class Channel extends Controller { $o .= '
' . "\r\n"; $o .= "\r\n"; + . "; divmore_height = " . intval($maxheight) . ";\r\n"; App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), @@ -420,7 +420,8 @@ class Channel extends Controller { '$verb' => '', '$net' => '', '$dend' => $datequery, - '$dbegin' => $datequery2 + '$dbegin' => $datequery2, + '$conv_mode' => 'channel' )); } diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 02fc87756..accf075da 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -66,7 +66,8 @@ class Like extends \Zotlabs\Web\Controller { } $verb = notags(trim($_GET['verb'])); - + $mode = (($_GET['conv_mode'] === 'channel') ? 'channel' : 'network'); + if(! $verb) $verb = 'like'; @@ -304,7 +305,7 @@ class Like extends \Zotlabs\Web\Controller { $thread_owner = $r[0]; else killme(); - + $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($item['author_xchan']) ); @@ -312,8 +313,7 @@ class Like extends \Zotlabs\Web\Controller { $item_author = $r[0]; else killme(); - - + $verbs = " '".dbesc($activity)."' "; $multi_undo = false; @@ -368,33 +368,38 @@ class Like extends \Zotlabs\Web\Controller { return; if(! $multi_undo) { - if(local_channel()) { - $item_normal = item_normal(); - $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')", - intval($owner_uid), - dbesc($item['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), - dbesc(ACTIVITY_ATTEND), - dbesc(ACTIVITY_ATTENDNO), - dbesc(ACTIVITY_ATTENDMAYBE) - ); - xchan_query($activities,true); - $convitems[] = $item; - $convitems = array_merge($convitems, $activities); - - $json = [ - 'success' => 1, - 'orig_id' => $item_id, - 'id' => $item['id'], - 'html' => conversation($convitems,'network',true,'r_preview'), - ]; - - echo json_encode($json); - } + + if($mode === 'channel') + profile_load($thread_owner['xchan_name']); + + $item_normal = item_normal(); + + $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')", + intval($owner_uid), + dbesc($item['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + + xchan_query($activities,true); + $convitems[] = $item; + $convitems = array_merge($convitems, $activities); + + $json = [ + 'success' => 1, + 'orig_id' => $item_id, + 'id' => $item['id'], + 'html' => conversation($convitems,$mode,true,'r_preview'), + ]; + + echo json_encode($json); + killme(); } @@ -536,31 +541,34 @@ class Like extends \Zotlabs\Web\Controller { $post = item_store($arr); $post_id = $post['item_id']; - if(local_channel()) { - $item_normal = item_normal(); - $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')", - intval($owner_uid), - dbesc($item['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), - dbesc(ACTIVITY_ATTEND), - dbesc(ACTIVITY_ATTENDNO), - dbesc(ACTIVITY_ATTENDMAYBE) - ); - xchan_query($activities,true); - $convitems[] = $item; - $convitems = array_merge($convitems, $activities); - - $json = [ - 'success' => 1, - 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] - 'id' => $item['id'], - 'html' => conversation($convitems,'network',true,'r_preview'), - ]; - } + if($mode === 'channel') + profile_load($thread_owner['xchan_name']); + + $item_normal = item_normal(); + + $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')", + intval($owner_uid), + dbesc($item['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + + xchan_query($activities,true); + $convitems[] = $item; + $convitems = array_merge($convitems, $activities); + + $json = [ + 'success' => 1, + 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] + 'id' => $item['id'], + 'html' => conversation($convitems,$mode,true,'r_preview'), + ]; // save the conversation from expiration @@ -597,7 +605,6 @@ class Like extends \Zotlabs\Web\Controller { } - \Zotlabs\Daemon\Master::Summon(array('Notifier','like',$post_id)); if($interactive) { -- cgit v1.2.3 From 451468d1297ba41a6c9ea29709444ceb15185bfb Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 22 Nov 2020 16:37:20 +0000 Subject: fix mod item issue with remote channels --- Zotlabs/Module/Item.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index ce344ee82..c4fac1385 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -300,6 +300,7 @@ class Item extends Controller { $parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0); $parent_mid = ((x($_REQUEST,'parent_mid')) ? trim($_REQUEST['parent_mid']) : ''); + $mode = (($_REQUEST['conv_mode'] === 'channel') ? 'channel' : 'network'); $remote_xchan = ((x($_REQUEST,'remote_xchan')) ? trim($_REQUEST['remote_xchan']) : false); $r = q("select * from xchan where xchan_hash = '%s' limit 1", @@ -1374,24 +1375,19 @@ class Item extends Controller { goaway(z_root() . "/" . $return_path); } + if($mode === 'channel') + profile_load($owner_xchan['xchan_name']); - if(local_channel()) { - $item[] = $datarray; - $item[0]['owner'] = $owner_xchan; - $item[0]['author'] = $observer; - $item[0]['attach'] = json_encode($datarray['attach']); + $item[] = $datarray; + $item[0]['owner'] = $owner_xchan; + $item[0]['author'] = $observer; + $item[0]['attach'] = json_encode($datarray['attach']); - $json = [ - 'success' => 1, - 'id' => $post_id, - 'html' => conversation($item,'network',true,'r_preview'), - ]; - } - else { - $json = [ - 'success' => 1 - ]; - } + $json = [ + 'success' => 1, + 'id' => $post_id, + 'html' => conversation($item,$mode,true,'r_preview'), + ]; if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) $json['reload'] = z_root() . '/' . $_REQUEST['jsreload']; -- cgit v1.2.3 From f59aefd3d9d8191409edeb1bfdba3f16f0af9b12 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 Nov 2020 09:10:53 +0000 Subject: store actor of fetched acivities --- Zotlabs/Lib/Activity.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 5f222754b..5751d276a 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2648,7 +2648,7 @@ class Activity { $current_item = $item; while($current_item['parent_mid'] !== $current_item['mid']) { - $n = ActivityStreams::fetch($current_item['parent_mid'], $channel); + $n = self::fetch($current_item['parent_mid'], $channel); if(! $n) { break; } @@ -2660,6 +2660,10 @@ class Activity { break; } + if (is_array($a->actor) && array_key_exists('id',$a->actor)) { + self::actor_store($a->actor['id'],$a->actor); + } + $replies = null; if(isset($a->obj['replies']['first']['items'])) { $replies = $a->obj['replies']['first']['items']; @@ -2725,7 +2729,7 @@ class Activity { foreach($arr as $url) { - $n = ActivityStreams::fetch($url, $channel); + $n = self::fetch($url, $channel); if(! $n) { break; } -- cgit v1.2.3 From 453dd38e51a5fe20bb34396ecc5f11e345196322 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 Nov 2020 14:01:04 +0000 Subject: missing include --- Zotlabs/Lib/Activity.php | 2 +- Zotlabs/Module/Item.php | 1 + Zotlabs/Module/Like.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 5751d276a..3006c6789 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -168,7 +168,7 @@ class Activity { ); if($r) { xchan_query($r,true); - $r = fetch_post_tags($r,true); + $r = fetch_post_tags($r); if (in_array($r[0]['verb'], ['Create', 'Invite']) && $r[0]['obj_type'] === ACTIVITY_OBJ_EVENT) { $r[0]['verb'] = 'Invite'; return self::encode_activity($r[0]); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index c4fac1385..3a74200c4 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -20,6 +20,7 @@ use App; require_once('include/crypto.php'); require_once('include/items.php'); require_once('include/security.php'); +require_once('include/conversation.php'); /** diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index accf075da..cfb8a9bf3 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -7,7 +7,7 @@ use Zotlabs\Lib\Libsync; require_once('include/security.php'); require_once('include/bbcode.php'); require_once('include/items.php'); - +require_once('include/conversation.php'); class Like extends \Zotlabs\Web\Controller { -- cgit v1.2.3 From 891b1428cc3a5aade0754acffa1a516c5896b46a Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 Nov 2020 18:23:46 +0000 Subject: do not use chanlink_url() at this place --- Zotlabs/Lib/Activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 3006c6789..a655a895c 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -713,7 +713,7 @@ class Activity { ); if($p) { xchan_query($p,true); - $p = fetch_post_tags($p,true); + $p = fetch_post_tags($p); $i['obj'] = self::encode_item($p[0]); // convert to zot6 emoji reaction encoding which uses the target object to indicate the -- cgit v1.2.3 From 34d54fd3099217ccabcd812b1883ee7882caad77 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 Nov 2020 19:57:28 +0000 Subject: simplify code and fix issue with categories --- Zotlabs/Module/Like.php | 120 ++++++++++++++++++++---------------------------- 1 file changed, 51 insertions(+), 69 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index cfb8a9bf3..6b7efb98b 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -9,11 +9,8 @@ require_once('include/bbcode.php'); require_once('include/items.php'); require_once('include/conversation.php'); - class Like extends \Zotlabs\Web\Controller { - - private function reaction_to_activity($reaction) { $acts = [ @@ -42,7 +39,43 @@ class Like extends \Zotlabs\Web\Controller { } + private function like_response($arr) { + + if($arr['conv_mode'] === 'channel') + profile_load($arr['owner_xchan']['xchan_name']); + + $item_normal = item_normal(); + + $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')", + intval($arr['item']['uid']), + dbesc($arr['item']['mid']), + dbesc(ACTIVITY_LIKE), + dbesc(ACTIVITY_DISLIKE), + dbesc(ACTIVITY_ATTEND), + dbesc(ACTIVITY_ATTENDNO), + dbesc(ACTIVITY_ATTENDMAYBE) + ); + + xchan_query($activities,true); + + $convitems[] = $arr['item']; + $convitems = array_merge($convitems, $activities); + + $convitems = fetch_post_tags($convitems,true); + + $ret = [ + 'success' => 1, + 'orig_id' => $arr['orig_item_id'], //this is required for pubstream items where $item_id != $item['id'] + 'id' => $arr['item']['id'], + 'html' => conversation($convitems, $arr['conv_mode'], true, 'r_preview'), + ]; + return $ret; + + } public function get() { @@ -368,39 +401,13 @@ class Like extends \Zotlabs\Web\Controller { return; if(! $multi_undo) { - - if($mode === 'channel') - profile_load($thread_owner['xchan_name']); - - $item_normal = item_normal(); - - $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')", - intval($owner_uid), - dbesc($item['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), - dbesc(ACTIVITY_ATTEND), - dbesc(ACTIVITY_ATTENDNO), - dbesc(ACTIVITY_ATTENDMAYBE) - ); - - xchan_query($activities,true); - $convitems[] = $item; - $convitems = array_merge($convitems, $activities); - - $json = [ - 'success' => 1, - 'orig_id' => $item_id, - 'id' => $item['id'], - 'html' => conversation($convitems,$mode,true,'r_preview'), - ]; - - echo json_encode($json); - - killme(); + $ret = self::like_response([ + 'item' => $item, + 'orig_item_id' => $item_id, + 'owner_xchan' => $thread_owner, + 'conv_mode' => $mode + ]); + json_return_and_die($ret); } @@ -541,35 +548,6 @@ class Like extends \Zotlabs\Web\Controller { $post = item_store($arr); $post_id = $post['item_id']; - if($mode === 'channel') - profile_load($thread_owner['xchan_name']); - - $item_normal = item_normal(); - - $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')", - intval($owner_uid), - dbesc($item['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), - dbesc(ACTIVITY_ATTEND), - dbesc(ACTIVITY_ATTENDNO), - dbesc(ACTIVITY_ATTENDMAYBE) - ); - - xchan_query($activities,true); - $convitems[] = $item; - $convitems = array_merge($convitems, $activities); - - $json = [ - 'success' => 1, - 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] - 'id' => $item['id'], - 'html' => conversation($convitems,$mode,true,'r_preview'), - ]; - // save the conversation from expiration if(local_channel() && array_key_exists('item',$post) && (intval($post['item']['id']) != intval($post['item']['parent']))) @@ -613,10 +591,14 @@ class Like extends \Zotlabs\Web\Controller { return $o; } - echo json_encode($json); - killme(); + $ret = self::like_response([ + 'item' => $item, + 'orig_item_id' => $item_id, + 'owner_xchan' => $thread_owner, + 'conv_mode' => $mode + ]); + json_return_and_die($ret); + } - - } -- cgit v1.2.3 From c648c38fb08c4f7aa9eee133d7f5f3efd32f9bd9 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 Nov 2020 20:23:17 +0000 Subject: fix warning --- Zotlabs/Lib/Activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index a655a895c..f805b92e7 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -800,7 +800,7 @@ class Activity { $is_directmessage = false; $recips = get_iconfig($i['parent'], 'activitypub', 'recips'); - if(in_array($i['author']['xchan_url'], $recips['to'])) { + if(array_path_exists('to', $recips) && in_array($i['author']['xchan_url'], $recips['to'])) { $reply_url = $d[0]['xchan_url']; $is_directmessage = true; } -- cgit v1.2.3 From f43577ec278b5036db7e96eee580c959f7c00c47 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 Nov 2020 21:26:52 +0000 Subject: add logging --- Zotlabs/Web/HTTPSig.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index 42426afb1..792556a10 100644 --- a/Zotlabs/Web/HTTPSig.php +++ b/Zotlabs/Web/HTTPSig.php @@ -212,6 +212,9 @@ class HTTPSig { static function get_key($key,$keytype,$id) { + if(is_array($key)) + btlogger('key is array: ' . print_r($key,true)); + if($key) { if(function_exists($key)) { return $key($id); -- cgit v1.2.3 From ae11b2c2818fce5161e3367e5677e28ea5686891 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 24 Nov 2020 22:14:24 +0000 Subject: profile_load() requires channel_address --- Zotlabs/Module/Item.php | 2 +- Zotlabs/Module/Like.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 3a74200c4..7c438c309 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1377,7 +1377,7 @@ class Item extends Controller { } if($mode === 'channel') - profile_load($owner_xchan['xchan_name']); + profile_load($channel['channel_address']); $item[] = $datarray; $item[0]['owner'] = $owner_xchan; diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 6b7efb98b..bb5c6db7a 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -41,8 +41,11 @@ class Like extends \Zotlabs\Web\Controller { private function like_response($arr) { - if($arr['conv_mode'] === 'channel') - profile_load($arr['owner_xchan']['xchan_name']); + if($arr['conv_mode'] === 'channel') { + $parts = explode('@', $arr['owner_xchan']['xchan_addr']); + profile_load($parts[0]); + } + $item_normal = item_normal(); -- cgit v1.2.3 From 21cd4a1b4845858c3421dbd5f2673eceee421f5d Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Nov 2020 08:43:03 +0000 Subject: psr-4 autoloading standard --- Zotlabs/Module/OAuth2TestVehicle.php | 151 +++++++++++++++++++++++++++++++++++ Zotlabs/Module/Oauth2testvehicle.php | 151 ----------------------------------- 2 files changed, 151 insertions(+), 151 deletions(-) create mode 100644 Zotlabs/Module/OAuth2TestVehicle.php delete mode 100644 Zotlabs/Module/Oauth2testvehicle.php (limited to 'Zotlabs') diff --git a/Zotlabs/Module/OAuth2TestVehicle.php b/Zotlabs/Module/OAuth2TestVehicle.php new file mode 100644 index 000000000..5ae278e8c --- /dev/null +++ b/Zotlabs/Module/OAuth2TestVehicle.php @@ -0,0 +1,151 @@ + z_root(), + '$api_response' => $_SESSION['api_response'], + /* + endpoints => array( + array( + 'path_to_endpoint', + array( + array('field_name_1', 'value'), + array('field_name_2', 'value'), + ... + ), + 'submit_button_name', + 'Description of API action' + ) + ) + */ + '$endpoints' => array( + array( + 'authorize', + array( + array('response_type', 'code'), + array('client_id', (x($_REQUEST, 'client_id') ? $_REQUEST['client_id'] : 'oauth2_test_app')), + array('redirect_uri', $_SESSION['redirect_uri']), + array('state', 'xyz'), + // OpenID Connect Dynamic Client Registration 1.0 Client Metadata + // http://openid.net/specs/openid-connect-registration-1_0.html + array('client_name', 'OAuth2 Test App'), + array('logo_uri', urlencode(z_root() . '/images/icons/plugin.png')), + array('client_uri', urlencode('https://client.example.com/website')), + array('application_type', 'web'), // would be 'native' for mobile app + ), + 'oauth_authorize', + 'Authorize a test client app', + 'GET', + (($_REQUEST['code'] && $_REQUEST['state']) ? true : false), + ), + array( + 'oauth2testvehicle', + array( + array('action', 'request_token'), + array('grant_type', 'authorization_code'), + array('code', $_SESSION['authorization_code']), + array('redirect_uri', $_SESSION['redirect_uri']), + array('client_id', ($_SESSION['client_id'] ? $_SESSION['client_id'] : 'oauth2_test_app')), + array('client_secret', $_SESSION['client_secret']), + ), + 'oauth_token_request', + 'Request a token', + 'POST', + ($_SESSION['success'] === 'request_token'), + ), + array( + 'oauth2testvehicle', + array( + array('action', 'api_files'), + array('access_token', $_SESSION['access_token']), + ), + 'oauth_api_files', + 'API: Get channel files', + 'POST', + ($_SESSION['success'] === 'api_files'), + ) + ) + )); + $_SESSION['success'] = ''; + return $o; + } + + function post() { + + switch ($_POST['action']) { + case 'api_files': + $access_token = $_SESSION['access_token']; + $url = z_root() . '/api/z/1.0/files/'; + $headers = []; + $headers[] = 'Authorization: Bearer ' . $access_token; + $post = z_fetch_url($url, false, 0, array( + 'custom' => 'GET', + 'headers' => $headers, + )); + logger(json_encode($post, JSON_PRETTY_PRINT), LOGGER_DEBUG); + $response = json_decode($post['body'], true); + $_SESSION['api_response'] = json_encode($response, JSON_PRETTY_PRINT); + break; + case 'request_token': + $grant_type = (x($_POST, 'grant_type') ? $_POST['grant_type'] : ''); + $redirect_uri = (x($_POST, 'redirect_uri') ? $_POST['redirect_uri'] : ''); + $client_id = (x($_POST, 'client_id') ? $_POST['client_id'] : ''); + $code = (x($_POST, 'code') ? $_POST['code'] : ''); + $client_secret = (x($_POST, 'client_secret') ? $_POST['client_secret'] : ''); + $url = z_root() . '/token/'; + $params = http_build_query(array( + 'grant_type' => $grant_type, + 'redirect_uri' => urlencode($redirect_uri), + 'client_id' => $client_id, + 'code' => $code, + )); + $post = z_post_url($url, $params, 0, array( + 'http_auth' => $client_id . ':' . $client_secret, + )); + logger(json_encode($post, JSON_PRETTY_PRINT), LOGGER_DEBUG); + $response = json_decode($post['body'], true); + logger(json_encode($response, JSON_PRETTY_PRINT), LOGGER_DEBUG); + if($response['access_token']) { + info('Access token received: ' . $response['access_token'] . EOL); + $_SESSION['success'] = 'request_token'; + $_SESSION['access_token'] = $response['access_token']; + } + break; + + default: + break; + } + } + +} diff --git a/Zotlabs/Module/Oauth2testvehicle.php b/Zotlabs/Module/Oauth2testvehicle.php deleted file mode 100644 index 5ae278e8c..000000000 --- a/Zotlabs/Module/Oauth2testvehicle.php +++ /dev/null @@ -1,151 +0,0 @@ - z_root(), - '$api_response' => $_SESSION['api_response'], - /* - endpoints => array( - array( - 'path_to_endpoint', - array( - array('field_name_1', 'value'), - array('field_name_2', 'value'), - ... - ), - 'submit_button_name', - 'Description of API action' - ) - ) - */ - '$endpoints' => array( - array( - 'authorize', - array( - array('response_type', 'code'), - array('client_id', (x($_REQUEST, 'client_id') ? $_REQUEST['client_id'] : 'oauth2_test_app')), - array('redirect_uri', $_SESSION['redirect_uri']), - array('state', 'xyz'), - // OpenID Connect Dynamic Client Registration 1.0 Client Metadata - // http://openid.net/specs/openid-connect-registration-1_0.html - array('client_name', 'OAuth2 Test App'), - array('logo_uri', urlencode(z_root() . '/images/icons/plugin.png')), - array('client_uri', urlencode('https://client.example.com/website')), - array('application_type', 'web'), // would be 'native' for mobile app - ), - 'oauth_authorize', - 'Authorize a test client app', - 'GET', - (($_REQUEST['code'] && $_REQUEST['state']) ? true : false), - ), - array( - 'oauth2testvehicle', - array( - array('action', 'request_token'), - array('grant_type', 'authorization_code'), - array('code', $_SESSION['authorization_code']), - array('redirect_uri', $_SESSION['redirect_uri']), - array('client_id', ($_SESSION['client_id'] ? $_SESSION['client_id'] : 'oauth2_test_app')), - array('client_secret', $_SESSION['client_secret']), - ), - 'oauth_token_request', - 'Request a token', - 'POST', - ($_SESSION['success'] === 'request_token'), - ), - array( - 'oauth2testvehicle', - array( - array('action', 'api_files'), - array('access_token', $_SESSION['access_token']), - ), - 'oauth_api_files', - 'API: Get channel files', - 'POST', - ($_SESSION['success'] === 'api_files'), - ) - ) - )); - $_SESSION['success'] = ''; - return $o; - } - - function post() { - - switch ($_POST['action']) { - case 'api_files': - $access_token = $_SESSION['access_token']; - $url = z_root() . '/api/z/1.0/files/'; - $headers = []; - $headers[] = 'Authorization: Bearer ' . $access_token; - $post = z_fetch_url($url, false, 0, array( - 'custom' => 'GET', - 'headers' => $headers, - )); - logger(json_encode($post, JSON_PRETTY_PRINT), LOGGER_DEBUG); - $response = json_decode($post['body'], true); - $_SESSION['api_response'] = json_encode($response, JSON_PRETTY_PRINT); - break; - case 'request_token': - $grant_type = (x($_POST, 'grant_type') ? $_POST['grant_type'] : ''); - $redirect_uri = (x($_POST, 'redirect_uri') ? $_POST['redirect_uri'] : ''); - $client_id = (x($_POST, 'client_id') ? $_POST['client_id'] : ''); - $code = (x($_POST, 'code') ? $_POST['code'] : ''); - $client_secret = (x($_POST, 'client_secret') ? $_POST['client_secret'] : ''); - $url = z_root() . '/token/'; - $params = http_build_query(array( - 'grant_type' => $grant_type, - 'redirect_uri' => urlencode($redirect_uri), - 'client_id' => $client_id, - 'code' => $code, - )); - $post = z_post_url($url, $params, 0, array( - 'http_auth' => $client_id . ':' . $client_secret, - )); - logger(json_encode($post, JSON_PRETTY_PRINT), LOGGER_DEBUG); - $response = json_decode($post['body'], true); - logger(json_encode($response, JSON_PRETTY_PRINT), LOGGER_DEBUG); - if($response['access_token']) { - info('Access token received: ' . $response['access_token'] . EOL); - $_SESSION['success'] = 'request_token'; - $_SESSION['access_token'] = $response['access_token']; - } - break; - - default: - break; - } - } - -} -- cgit v1.2.3 From e236b7781744b8a287845b78857787064b70c4f8 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Nov 2020 08:48:09 +0000 Subject: more psr-4 autoloading standard --- Zotlabs/Identity/BasicId.php | 2 +- Zotlabs/Identity/ProfilePhoto.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Identity/BasicId.php b/Zotlabs/Identity/BasicId.php index 3c149808f..a7fb109cd 100644 --- a/Zotlabs/Identity/BasicId.php +++ b/Zotlabs/Identity/BasicId.php @@ -1,6 +1,6 @@