Merge branch 'dev' of /home/macgirvin/roadhouse into dev

This commit is contained in:
nobody 2021-05-20 18:54:59 -07:00
commit a672dd6210
9 changed files with 1144 additions and 1145 deletions

View file

@ -181,7 +181,7 @@ class Channel extends Controller {
$noscript_content = get_config('system', 'noscript_content', '1'); $noscript_content = get_config('system', 'noscript_content', '1');
if($load) if($load)
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_channel'] = datetime_convert();
$category = $datequery = $datequery2 = ''; $category = $datequery = $datequery2 = '';
@ -342,8 +342,8 @@ class Channel extends Controller {
'title' => 'oembed' 'title' => 'oembed'
]); ]);
if ($update && isset($_SESSION['loadtime'])) { if ($update && isset($_SESSION['loadtime_channel'])) {
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; $simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_channel']) . "' ";
} }
if ($load) { if ($load) {
$simple_update = ''; $simple_update = '';
@ -361,7 +361,7 @@ class Channel extends Controller {
dbesc($mid . '%'), dbesc($mid . '%'),
intval(App::$profile['profile_uid']) intval(App::$profile['profile_uid'])
); );
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_channel'] = datetime_convert();
} }
else { else {
$r = q("SELECT parent AS item_id from item $r = q("SELECT parent AS item_id from item
@ -373,7 +373,7 @@ class Channel extends Controller {
ORDER BY created DESC", ORDER BY created DESC",
intval(App::$profile['profile_uid']) intval(App::$profile['profile_uid'])
); );
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_channel'] = datetime_convert();
} }
} }

View file

@ -28,7 +28,7 @@ class Display extends Controller {
} }
if($load) if($load)
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_display'] = datetime_convert();
if(observer_prohibited()) { if(observer_prohibited()) {
notice( t('Public access denied.') . EOL); notice( t('Public access denied.') . EOL);
@ -193,8 +193,8 @@ class Display extends Controller {
$simple_update = (($update) ? " AND item_unseen = 1 " : ''); $simple_update = (($update) ? " AND item_unseen = 1 " : '');
if($update && $_SESSION['loadtime']) if($update && $_SESSION['loadtime_display'])
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; $simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_display']) . "' ";
if($load) if($load)
$simple_update = ''; $simple_update = '';
@ -311,7 +311,7 @@ class Display extends Controller {
dbesc($target_item['parent_mid']) dbesc($target_item['parent_mid'])
); );
} }
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_display'] = datetime_convert();
} }
else { else {

View file

@ -42,7 +42,7 @@ class Hq extends Controller {
return; return;
if($load) if($load)
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_hq'] = datetime_convert();
if(argc() > 1 && argv(1) !== 'load') { if(argc() > 1 && argv(1) !== 'load') {
$item_hash = argv(1); $item_hash = argv(1);
@ -94,8 +94,8 @@ class Hq extends Controller {
$simple_update = (($update) ? " AND item_unseen = 1 " : ''); $simple_update = (($update) ? " AND item_unseen = 1 " : '');
if($update && $_SESSION['loadtime']) if($update && $_SESSION['loadtime_hq'])
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; $simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_hq']) . "' ";
if($static && $simple_update) if($static && $simple_update)
$simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
@ -264,7 +264,7 @@ class Hq extends Controller {
); );
} }
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_hq'] = datetime_convert();
} }
else { else {
$r = []; $r = [];

View file

@ -17,7 +17,7 @@ class Pubstream extends Controller {
$items = []; $items = [];
if($load) if($load)
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_pubstream'] = datetime_convert();
if((observer_prohibited(true))) { if((observer_prohibited(true))) {
return login(); return login();
@ -188,7 +188,8 @@ class Pubstream extends Controller {
if (isset(App::$profile) && isset(App::$profile['profile_uid'])) { if (isset(App::$profile) && isset(App::$profile['profile_uid'])) {
$abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " "; $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " ";
} }
$simple_update = ((isset($_SESSION['loadtime']) && $_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : '');
$simple_update = ((isset($_SESSION['loadtime_pubstream']) && $_SESSION['loadtime_pubstream']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_pubstream']) . "' " : '');
if($load) if($load)
$simple_update = ''; $simple_update = '';
@ -246,7 +247,7 @@ class Pubstream extends Controller {
$sql_extra $net_query2" $sql_extra $net_query2"
); );
} }
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_pubstream'] = datetime_convert();
} }
// Then fetch all the children of the parents that are on this page // Then fetch all the children of the parents that are on this page

View file

@ -8,6 +8,7 @@ use Zotlabs\Lib\AccessList;
use Zotlabs\Access\Permissions; use Zotlabs\Access\Permissions;
use Zotlabs\Access\PermissionRoles; use Zotlabs\Access\PermissionRoles;
use Zotlabs\Access\PermissionLimits; use Zotlabs\Access\PermissionLimits;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Access\AccessControl; use Zotlabs\Access\AccessControl;
use Zotlabs\Daemon\Run; use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Permcat; use Zotlabs\Lib\Permcat;
@ -618,7 +619,7 @@ class Channel {
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')), '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
'$permissions' => t('Default Access List'), '$permissions' => t('Default Access List'),
'$permdesc' => t("(click to open/close)"), '$permdesc' => t("(click to open/close)"),
'$aclselect' => populate_acl($perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))), '$aclselect' => populate_acl($perm_defaults, false, PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
'$profseltxt' => t('Profile to assign new connections'), '$profseltxt' => t('Profile to assign new connections'),
'$profselect' => ((feature_enabled(local_channel(),'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')) : ''), '$profselect' => ((feature_enabled(local_channel(),'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')) : ''),
@ -637,7 +638,7 @@ class Channel {
'$hide_friends' => $hide_friends, '$hide_friends' => $hide_friends,
'$hide_wall' => $hide_wall, '$hide_wall' => $hide_wall,
'$unkmail' => $unkmail, '$unkmail' => $unkmail,
'$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), intval($channel['channel_max_anon_mail']) ,t("Useful to reduce spamming")), '$cntunkmail' => array('cntunkmail', t('Maximum direct messages per day from unknown people:'), intval($channel['channel_max_anon_mail']) ,t("Useful to reduce spamming if you allow direct messages from unknown people")),
'$autoperms' => $autoperms, '$autoperms' => $autoperms,
// '$anymention' => $anymention, // '$anymention' => $anymention,

View file

@ -18,11 +18,6 @@ class Stream extends Controller {
return; return;
} }
// @fixme - the @ form blocks the network connection search in the get() function, and the ? search probably breaks the url
// if (in_array(substr($_GET['search'],0,1),[ '@', '!', '?'])) {
// goaway('search' . '?f=&search=' . $_GET['search']);
// }
$channel = App::get_channel(); $channel = App::get_channel();
App::$profile_uid = local_channel(); App::$profile_uid = local_channel();
App::$data['channel'] = $channel; App::$data['channel'] = $channel;
@ -40,7 +35,7 @@ class Stream extends Controller {
$o = ''; $o = '';
if ($load) { if ($load) {
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_stream'] = datetime_convert();
} }
$arr = [ 'query' => App::$query_string ]; $arr = [ 'query' => App::$query_string ];
@ -118,15 +113,15 @@ class Stream extends Controller {
$g = substr($gid,1); $g = substr($gid,1);
switch ($g) { switch ($g) {
case '1': case '1':
$r = [ 'hash' => 'connections:' . $channel['channel_hash'] ]; $r = [[ 'hash' => 'connections:' . $channel['channel_hash'] ]];
$vg = t('Connections'); $vg = t('Connections');
break; break;
case '2': case '2':
$r = [ 'hash' => 'zot:' . $channel['channel_hash'] ]; $r = [[ 'hash' => 'zot:' . $channel['channel_hash'] ]];
$vg = t('Zot'); $vg = t('Nomad');
break; break;
case '3': case '3':
$r = [ 'hash' => 'activitypub:' . $channel['channel_hash'] ]; $r = [[ 'hash' => 'activitypub:' . $channel['channel_hash'] ]];
$vg = t('ActivityPub'); $vg = t('ActivityPub');
break; break;
default: default:
@ -147,9 +142,11 @@ class Stream extends Controller {
} }
} }
$group = $gid; $group = $gid;
$group_hash = $r[0]['hash']; $group_hash = $r[0]['hash'];
$def_acl = [ 'allow_gid' => '<' . $r[0]['hash'] . '>' ];
} }
$default_cmin = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmin',0) : (-1)); $default_cmin = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmin',0) : (-1));
@ -190,8 +187,6 @@ class Stream extends Controller {
goaway(z_root() . '/stream'); goaway(z_root() . '/stream');
} }
$def_acl = [ 'allow_cid' => '<' . $cid_r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
} }
if (! $update) { if (! $update) {
@ -205,13 +200,6 @@ class Stream extends Controller {
$body = EMPTY_STR; $body = EMPTY_STR;
// When viewing groups, automatically add a private mention to the editor
// This is disabled for now as well as setting the ACL for access lists, as the change in message scope could be unexpected.
// if (intval($pf) === 1 && $cid_r) {
// $backup = ((strpos($cid_r[0]['xchan_guid'],'http') === 0) ? $cid_r[0]['xchan_guid'] : $cid_r[0]['xchan_url']);
// $body = '@!{' . (($cid_r[0]['xchan_addr']) ? $cid_r[0]['xchan_addr'] : $backup) . '}' . "\n";
// }
nav_set_selected('Stream'); nav_set_selected('Stream');
$channel_acl = [ $channel_acl = [
@ -525,7 +513,7 @@ class Stream extends Controller {
$items = []; $items = [];
// This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day // 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 // or three and look at your stream 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 // should. All of a sudden a few seconds later, page 2 will get inserted at the beginning of the page
// (before the page 1 content). The update code is actually doing just what it's supposed // (before the page 1 content). The update code is actually doing just what it's supposed
// to, it's fetching posts that have the ITEM_UNSEEN bit set. But the reason that page 2 content is being // to, it's fetching posts that have the ITEM_UNSEEN bit set. But the reason that page 2 content is being
@ -536,8 +524,8 @@ class Stream extends Controller {
// by storing in your session the current UTC time whenever you LOAD a network page, and only UPDATE items // 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... // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers...
if ($update && $_SESSION['loadtime']) if ($update && $_SESSION['loadtime_stream'])
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; $simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_stream']) . "' ";
if ($load) if ($load)
$simple_update = ''; $simple_update = '';
@ -569,7 +557,7 @@ class Stream extends Controller {
if($order === 'post') if($order === 'post')
$ordering = "created"; $ordering = "created";
else else
$ordering = "commented"; $ordering = "changed";
if ($load) { if ($load) {
// Fetch a page full of parent items for this page // Fetch a page full of parent items for this page
@ -594,7 +582,7 @@ class Stream extends Controller {
and (abook.abook_blocked = 0 or abook.abook_flags is null) and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_options $sql_nets $net_query2" $sql_extra3 $sql_extra $sql_options $sql_nets $net_query2"
); );
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime_stream'] = datetime_convert();
} }
if ($r) { if ($r) {

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class. * @brief This file defines some global constants and includes the central App class.
*/ */
define ( 'STD_VERSION', '21.05.09' ); define ( 'STD_VERSION', '21.05.21' );
define ( 'ZOT_REVISION', '10.0' ); define ( 'ZOT_REVISION', '10.0' );
define ( 'DB_UPDATE_VERSION', 1248 ); define ( 'DB_UPDATE_VERSION', 1248 );

View file

@ -728,8 +728,7 @@ function get_item_elements($x,$allow_code = false) {
$arr['term'] = decode_tags($x['tags']); $arr['term'] = decode_tags($x['tags']);
$arr['iconfig'] = decode_item_meta($x['meta']); $arr['iconfig'] = decode_item_meta($x['meta']);
$arr['item_private'] = ((array_key_exists('flags',$x) && is_array($x['flags']) && in_array('private',$x['flags'])) ? 1 : 0); $arr['item_private'] = 0;
$arr['item_flags'] = 0; $arr['item_flags'] = 0;
if(array_key_exists('flags',$x)) { if(array_key_exists('flags',$x)) {
@ -751,6 +750,12 @@ function get_item_elements($x,$allow_code = false) {
if(in_array('hidden',$x['flags'])) if(in_array('hidden',$x['flags']))
$arr['item_hidden'] = 1; $arr['item_hidden'] = 1;
if(in_array('private',$x['flags']))
$arr['item_private'] = 1;
if(in_array('direct',$x['flags']))
$arr['item_private'] = 2;
} }
// Here's the deal - the site might be down or whatever but if there's a new person you've never // Here's the deal - the site might be down or whatever but if there's a new person you've never
@ -1448,8 +1453,10 @@ function encode_item_flags($item) {
$ret[] = 'consensus'; $ret[] = 'consensus';
if(intval($item['item_obscured'])) if(intval($item['item_obscured']))
$ret[] = 'obscured'; $ret[] = 'obscured';
if(intval($item['item_private'])) if(intval($item['item_private']) === 1)
$ret[] = 'private'; $ret[] = 'private';
if(intval($item['item_private']) === 2)
$ret[] = 'direct';
return $ret; return $ret;
} }
@ -2365,7 +2372,7 @@ function item_update_parent_commented($item) {
// - unless this is a moderated comment or a potential clone of an older item // - unless this is a moderated comment or a potential clone of an older item
// which we don't wish to bring to the surface. As the queue only holds deliveries // which we don't wish to bring to the surface. As the queue only holds deliveries
// for 3 days, it's suspected of being an older cloned item if the creation time // for 3 days, it's suspected of being an older cloned item if the creation time
//is older than that. // is older than that.
if(intval($item['item_blocked']) === ITEM_MODERATED) if(intval($item['item_blocked']) === ITEM_MODERATED)
$update_parent = false; $update_parent = false;

File diff suppressed because it is too large Load diff