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');
if($load)
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_channel'] = datetime_convert();
$category = $datequery = $datequery2 = '';
@ -342,8 +342,8 @@ class Channel extends Controller {
'title' => 'oembed'
]);
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 && isset($_SESSION['loadtime_channel'])) {
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_channel']) . "' ";
}
if ($load) {
$simple_update = '';
@ -361,7 +361,7 @@ class Channel extends Controller {
dbesc($mid . '%'),
intval(App::$profile['profile_uid'])
);
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_channel'] = datetime_convert();
}
else {
$r = q("SELECT parent AS item_id from item
@ -373,7 +373,7 @@ class Channel extends Controller {
ORDER BY created DESC",
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)
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_display'] = datetime_convert();
if(observer_prohibited()) {
notice( t('Public access denied.') . EOL);
@ -193,8 +193,8 @@ class Display extends Controller {
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
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($update && $_SESSION['loadtime_display'])
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_display']) . "' ";
if($load)
$simple_update = '';
@ -311,7 +311,7 @@ class Display extends Controller {
dbesc($target_item['parent_mid'])
);
}
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_display'] = datetime_convert();
}
else {

View file

@ -42,7 +42,7 @@ class Hq extends Controller {
return;
if($load)
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_hq'] = datetime_convert();
if(argc() > 1 && argv(1) !== 'load') {
$item_hash = argv(1);
@ -94,8 +94,8 @@ class Hq extends Controller {
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
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($update && $_SESSION['loadtime_hq'])
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_hq']) . "' ";
if($static && $simple_update)
$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 {
$r = [];

View file

@ -17,7 +17,7 @@ class Pubstream extends Controller {
$items = [];
if($load)
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_pubstream'] = datetime_convert();
if((observer_prohibited(true))) {
return login();
@ -188,7 +188,8 @@ class Pubstream extends Controller {
if (isset(App::$profile) && isset(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)
$simple_update = '';
@ -246,7 +247,7 @@ class Pubstream extends Controller {
$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

View file

@ -8,6 +8,7 @@ use Zotlabs\Lib\AccessList;
use Zotlabs\Access\Permissions;
use Zotlabs\Access\PermissionRoles;
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Access\AccessControl;
use Zotlabs\Daemon\Run;
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')),
'$permissions' => t('Default Access List'),
'$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'),
'$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_wall' => $hide_wall,
'$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,
// '$anymention' => $anymention,

View file

@ -17,11 +17,6 @@ class Stream extends Controller {
if (! local_channel()) {
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();
App::$profile_uid = local_channel();
@ -40,7 +35,7 @@ class Stream extends Controller {
$o = '';
if ($load) {
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_stream'] = datetime_convert();
}
$arr = [ 'query' => App::$query_string ];
@ -118,15 +113,15 @@ class Stream extends Controller {
$g = substr($gid,1);
switch ($g) {
case '1':
$r = [ 'hash' => 'connections:' . $channel['channel_hash'] ];
$r = [[ 'hash' => 'connections:' . $channel['channel_hash'] ]];
$vg = t('Connections');
break;
case '2':
$r = [ 'hash' => 'zot:' . $channel['channel_hash'] ];
$vg = t('Zot');
$r = [[ 'hash' => 'zot:' . $channel['channel_hash'] ]];
$vg = t('Nomad');
break;
case '3':
$r = [ 'hash' => 'activitypub:' . $channel['channel_hash'] ];
$r = [[ 'hash' => 'activitypub:' . $channel['channel_hash'] ]];
$vg = t('ActivityPub');
break;
default:
@ -146,10 +141,12 @@ class Stream extends Controller {
goaway(z_root() . '/stream');
}
}
$group = $gid;
$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));
@ -189,9 +186,7 @@ class Stream extends Controller {
notice( t('No such channel') . EOL );
goaway(z_root() . '/stream');
}
$def_acl = [ 'allow_cid' => '<' . $cid_r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
}
if (! $update) {
@ -205,13 +200,6 @@ class Stream extends Controller {
$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');
$channel_acl = [
@ -525,7 +513,7 @@ class Stream extends Controller {
$items = [];
// 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
// (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
@ -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
// 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 ($update && $_SESSION['loadtime_stream'])
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_stream']) . "' ";
if ($load)
$simple_update = '';
@ -569,7 +557,7 @@ class Stream extends Controller {
if($order === 'post')
$ordering = "created";
else
$ordering = "commented";
$ordering = "changed";
if ($load) {
// 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)
$sql_extra3 $sql_extra $sql_options $sql_nets $net_query2"
);
$_SESSION['loadtime'] = datetime_convert();
$_SESSION['loadtime_stream'] = datetime_convert();
}
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.
*/
define ( 'STD_VERSION', '21.05.09' );
define ( 'STD_VERSION', '21.05.21' );
define ( 'ZOT_REVISION', '10.0' );
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['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;
if(array_key_exists('flags',$x)) {
@ -751,6 +750,12 @@ function get_item_elements($x,$allow_code = false) {
if(in_array('hidden',$x['flags']))
$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
@ -1448,8 +1453,10 @@ function encode_item_flags($item) {
$ret[] = 'consensus';
if(intval($item['item_obscured']))
$ret[] = 'obscured';
if(intval($item['item_private']))
if(intval($item['item_private']) === 1)
$ret[] = 'private';
if(intval($item['item_private']) === 2)
$ret[] = 'direct';
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
// 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
//is older than that.
// is older than that.
if(intval($item['item_blocked']) === ITEM_MODERATED)
$update_parent = false;

File diff suppressed because it is too large Load diff