mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 03:35:13 +00:00
Merge branch 'dev' of ../p3 into dev
This commit is contained in:
commit
5108f24083
7 changed files with 232 additions and 44 deletions
|
@ -8,6 +8,7 @@ use Zotlabs\Lib\Libprofile;
|
||||||
use Zotlabs\Lib\ActivityStreams;
|
use Zotlabs\Lib\ActivityStreams;
|
||||||
use Zotlabs\Lib\LDSignatures;
|
use Zotlabs\Lib\LDSignatures;
|
||||||
use Zotlabs\Lib\Crypto;
|
use Zotlabs\Lib\Crypto;
|
||||||
|
use Zotlabs\Lib\PConfig;
|
||||||
use Zotlabs\Web\HTTPSig;
|
use Zotlabs\Web\HTTPSig;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
|
@ -180,8 +181,6 @@ class Channel extends Controller {
|
||||||
|
|
||||||
$noscript_content = get_config('system', 'noscript_content', '1');
|
$noscript_content = get_config('system', 'noscript_content', '1');
|
||||||
|
|
||||||
if($load)
|
|
||||||
$_SESSION['loadtime'] = datetime_convert();
|
|
||||||
|
|
||||||
$category = $datequery = $datequery2 = '';
|
$category = $datequery = $datequery2 = '';
|
||||||
|
|
||||||
|
@ -193,7 +192,6 @@ class Channel extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
|
$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']) : '');
|
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
|
||||||
|
|
||||||
|
@ -225,6 +223,15 @@ class Channel extends Controller {
|
||||||
$perms = get_all_perms(App::$profile['profile_uid'],$ob_hash);
|
$perms = get_all_perms(App::$profile['profile_uid'],$ob_hash);
|
||||||
|
|
||||||
|
|
||||||
|
if ($load && ! $mid) {
|
||||||
|
$_SESSION['loadtime_channel'] = datetime_convert();
|
||||||
|
if ($is_owner) {
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_channel',$_SESSION['loadtime_channel']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(! $perms['view_stream']) {
|
if(! $perms['view_stream']) {
|
||||||
// We may want to make the target of this redirect configurable
|
// We may want to make the target of this redirect configurable
|
||||||
if($perms['view_profile']) {
|
if($perms['view_profile']) {
|
||||||
|
@ -543,6 +550,14 @@ class Channel extends Controller {
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ids = ids_to_array($items,'item_id');
|
||||||
|
$seen = PConfig::Get(local_channel(),'system','seen_items');
|
||||||
|
if (! $seen) {
|
||||||
|
$seen = [];
|
||||||
|
}
|
||||||
|
$seen = array_merge($ids,$seen);
|
||||||
|
PConfig::Set(local_channel(),'system','seen_items',$seen);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = (($search) ? 'search' : 'channel');
|
$mode = (($search) ? 'search' : 'channel');
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace Zotlabs\Module;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Zotlabs\Lib\System;
|
use Zotlabs\Lib\System;
|
||||||
|
use Zotlabs\Lib\PConfig;
|
||||||
use Zotlabs\Web\Controller;
|
use Zotlabs\Web\Controller;
|
||||||
|
|
||||||
require_once("include/bbcode.php");
|
require_once("include/bbcode.php");
|
||||||
|
@ -311,7 +312,6 @@ class Display extends Controller {
|
||||||
dbesc($target_item['parent_mid'])
|
dbesc($target_item['parent_mid'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$_SESSION['loadtime_display'] = datetime_convert();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -404,6 +404,16 @@ class Display extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (local_channel() && $items) {
|
||||||
|
$ids = ids_to_array($items,'item_id');
|
||||||
|
$seen = PConfig::Get(local_channel(),'system','seen_items');
|
||||||
|
if (! $seen) {
|
||||||
|
$seen = [];
|
||||||
|
}
|
||||||
|
$seen = array_unique(array_merge($ids,$seen));
|
||||||
|
PConfig::Set(local_channel(),'system','seen_items',$seen);
|
||||||
|
}
|
||||||
|
|
||||||
switch($module_format) {
|
switch($module_format) {
|
||||||
|
|
||||||
case 'html':
|
case 'html':
|
||||||
|
@ -475,6 +485,8 @@ class Display extends Controller {
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
intval($r[0]['item_id'])
|
intval($r[0]['item_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= '<div id="content-complete"></div>';
|
$o .= '<div id="content-complete"></div>';
|
||||||
|
|
|
@ -112,12 +112,20 @@ class Pconfig extends Controller {
|
||||||
|
|
||||||
$o .= '<input type="hidden" name="cat" value="' . $cat . '" />';
|
$o .= '<input type="hidden" name="cat" value="' . $cat . '" />';
|
||||||
$o .= '<input type="hidden" name="k" value="' . $k . '" />';
|
$o .= '<input type="hidden" name="k" value="' . $k . '" />';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(strpos($v,"\n"))
|
if(strpos($v,"\n"))
|
||||||
$o .= '<textarea name="v" >' . escape_tags($v) . '</textarea>';
|
$o .= '<textarea name="v" >' . escape_tags($v) . '</textarea>';
|
||||||
else
|
else {
|
||||||
$o .= '<input type="text" name="v" value="' . escape_tags($v) . '" />';
|
if (is_array($v)) {
|
||||||
|
$o .= '<code><pre>' . "\n" . print_array($v) . '</pre></code>';
|
||||||
|
$o .= '<input type="hidden" name="v" value="' . serialise($v) . '" />';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$o .= '<input type="text" name="v" value="' . escape_tags($v) . '" />';
|
||||||
|
}
|
||||||
|
}
|
||||||
$o .= EOL . EOL;
|
$o .= EOL . EOL;
|
||||||
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" />';
|
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" />';
|
||||||
$o .= '</form>';
|
$o .= '</form>';
|
||||||
|
|
|
@ -6,6 +6,7 @@ use App;
|
||||||
use Zotlabs\Web\Controller;
|
use Zotlabs\Web\Controller;
|
||||||
use Zotlabs\Lib\Enotify;
|
use Zotlabs\Lib\Enotify;
|
||||||
use Zotlabs\Lib\Apps;
|
use Zotlabs\Lib\Apps;
|
||||||
|
use Zotlabs\Lib\PConfig;
|
||||||
|
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
@ -51,10 +52,6 @@ class Ping extends Controller {
|
||||||
$result['forums_sub'] = [];
|
$result['forums_sub'] = [];
|
||||||
$result['reports'] = 0;
|
$result['reports'] = 0;
|
||||||
|
|
||||||
if (! (isset($_SESSION['static_loadtime']) && $_SESSION['static_loadtime'])) {
|
|
||||||
$_SESSION['static_loadtime'] = datetime_convert();
|
|
||||||
}
|
|
||||||
|
|
||||||
$vnotify = false;
|
$vnotify = false;
|
||||||
$evdays = 3;
|
$evdays = 3;
|
||||||
|
|
||||||
|
@ -172,16 +169,29 @@ class Ping extends Controller {
|
||||||
|
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
|
|
||||||
|
$seenstr = EMPTY_STR;
|
||||||
|
|
||||||
|
|
||||||
|
if (local_channel()) {
|
||||||
|
$seen = PConfig::Get(local_channel(),'system','seen_items',[]);
|
||||||
|
if ($seen) {
|
||||||
|
$seenstr = " and not item.id in (" . implode(',',$seen) . ") ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$loadtime = get_loadtime('pubstream');
|
||||||
|
|
||||||
if ($notify_pubs) {
|
if ($notify_pubs) {
|
||||||
$pubs = q("SELECT count(id) as total from item
|
$pubs = q("SELECT count(id) as total from item
|
||||||
WHERE uid = %d
|
WHERE uid = %d
|
||||||
AND item_unseen = 1
|
|
||||||
AND author_xchan != '%s'
|
AND author_xchan != '%s'
|
||||||
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
|
AND created > '%s'
|
||||||
|
$seenstr
|
||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra",
|
$sql_extra",
|
||||||
intval($sys['channel_id']),
|
intval($sys['channel_id']),
|
||||||
dbesc(get_observer_hash())
|
dbesc(get_observer_hash()),
|
||||||
|
dbesc($loadtime)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($pubs) {
|
if ($pubs) {
|
||||||
|
@ -195,15 +205,16 @@ class Ping extends Controller {
|
||||||
|
|
||||||
$r = q("SELECT * FROM item
|
$r = q("SELECT * FROM item
|
||||||
WHERE uid = %d
|
WHERE uid = %d
|
||||||
AND item_unseen = 1
|
|
||||||
AND author_xchan != '%s'
|
AND author_xchan != '%s'
|
||||||
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
|
AND created > '%s'
|
||||||
|
$seenstr
|
||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY created DESC
|
ORDER BY created DESC
|
||||||
LIMIT 300",
|
LIMIT 300",
|
||||||
intval($sys['channel_id']),
|
intval($sys['channel_id']),
|
||||||
dbesc(get_observer_hash())
|
dbesc(get_observer_hash()),
|
||||||
|
dbesc($loadtime)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
@ -239,11 +250,15 @@ class Ping extends Controller {
|
||||||
$r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1",
|
$r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1",
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
|
$_SESSION['loadtime_stream'] = datetime_convert();
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_stream',$_SESSION['loadtime_stream']);
|
||||||
break;
|
break;
|
||||||
case 'home':
|
case 'home':
|
||||||
$r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_wall = 1",
|
$r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_wall = 1",
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
|
$_SESSION['loadtime_channel'] = datetime_convert();
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_channel',$_SESSION['loadtime_channel']);
|
||||||
break;
|
break;
|
||||||
case 'all_events':
|
case 'all_events':
|
||||||
$r = q("UPDATE event SET dismissed = 1 WHERE uid = %d AND dismissed = 0 AND dtstart < '%s' AND dtstart > '%s' ",
|
$r = q("UPDATE event SET dismissed = 1 WHERE uid = %d AND dismissed = 0 AND dtstart < '%s' AND dtstart > '%s' ",
|
||||||
|
@ -258,7 +273,9 @@ class Ping extends Controller {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'pubs':
|
case 'pubs':
|
||||||
unset($_SESSION['static_loadtime']);
|
|
||||||
|
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_pubstream',$_SESSION['loadtime_pubstream']);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -270,6 +287,12 @@ class Ping extends Controller {
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
intval($_REQUEST['markItemRead'])
|
intval($_REQUEST['markItemRead'])
|
||||||
);
|
);
|
||||||
|
$id = intval($_REQUEST['markItemRead']);
|
||||||
|
$seen = PConfig::Get(local_channel(),'system','seen_items',[]);
|
||||||
|
if (! in_array($id,$seen)) {
|
||||||
|
$seen[] = $id;
|
||||||
|
}
|
||||||
|
PConfig::Set(local_channel(),'system','seen_items',$seen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,24 +347,24 @@ class Ping extends Controller {
|
||||||
json_return_and_die( [ 'notify' => $notifs ] );
|
json_return_and_die( [ 'notify' => $notifs ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc() > 1 && (argv(1) === 'stream' || argv(1) === 'home')) {
|
if (argc() > 1 && (argv(1) === 'stream')) {
|
||||||
$local_result = [];
|
$local_result = [];
|
||||||
$item_normal_moderate = $item_normal;
|
|
||||||
|
|
||||||
if (argv(1) === 'home') {
|
$item_normal_moderate = $item_normal;
|
||||||
$sql_extra .= " and item_wall = 1 ";
|
$loadtime = get_loadtime('stream');
|
||||||
$item_normal_moderate = item_normal_moderate();
|
|
||||||
}
|
|
||||||
$r = q("SELECT * FROM item
|
$r = q("SELECT * FROM item
|
||||||
WHERE uid = %d
|
WHERE uid = %d
|
||||||
AND item_unseen = 1
|
|
||||||
AND author_xchan != '%s'
|
AND author_xchan != '%s'
|
||||||
|
AND changed > '%s'
|
||||||
|
$seenstr
|
||||||
$item_normal_moderate
|
$item_normal_moderate
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY created DESC
|
ORDER BY created DESC
|
||||||
LIMIT 300",
|
LIMIT 300",
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
dbesc($ob_hash)
|
dbesc($ob_hash),
|
||||||
|
dbesc($loadtime)
|
||||||
);
|
);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
xchan_query($r);
|
xchan_query($r);
|
||||||
|
@ -357,6 +380,44 @@ class Ping extends Controller {
|
||||||
json_return_and_die( [ 'notify' => $local_result ] );
|
json_return_and_die( [ 'notify' => $local_result ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc() > 1 && (argv(1) === 'home')) {
|
||||||
|
$local_result = [];
|
||||||
|
$item_normal_moderate = $item_normal;
|
||||||
|
|
||||||
|
$sql_extra .= " and item_wall = 1 ";
|
||||||
|
$item_normal_moderate = item_normal_moderate();
|
||||||
|
|
||||||
|
$loadtime = get_loadtime('channel');
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM item
|
||||||
|
WHERE uid = %d
|
||||||
|
AND author_xchan != '%s'
|
||||||
|
AND changed > '%s'
|
||||||
|
$seenstr
|
||||||
|
$item_normal_moderate
|
||||||
|
$sql_extra
|
||||||
|
ORDER BY created DESC
|
||||||
|
LIMIT 300",
|
||||||
|
intval(local_channel()),
|
||||||
|
dbesc($ob_hash),
|
||||||
|
dbesc($loadtime)
|
||||||
|
);
|
||||||
|
if ($r) {
|
||||||
|
xchan_query($r);
|
||||||
|
foreach ($r as $item) {
|
||||||
|
$z = Enotify::format($item);
|
||||||
|
|
||||||
|
if($z) {
|
||||||
|
$local_result[] = $z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
json_return_and_die( [ 'notify' => $local_result ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (argc() > 1 && (argv(1) === 'intros')) {
|
if (argc() > 1 && (argv(1) === 'intros')) {
|
||||||
$local_result = [];
|
$local_result = [];
|
||||||
|
|
||||||
|
@ -536,14 +597,41 @@ class Ping extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
|
if ($vnotify & VNOTIFY_NETWORK) {
|
||||||
|
$loadtime = get_loadtime('stream');
|
||||||
$r = q("SELECT id, item_wall FROM item
|
$r = q("SELECT id FROM item
|
||||||
WHERE uid = %d and item_unseen = 1
|
WHERE uid = %d and changed > '%s'
|
||||||
|
$seenstr
|
||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra
|
$sql_extra
|
||||||
AND author_xchan != '%s'",
|
AND author_xchan != '%s'",
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
|
dbesc($loadtime),
|
||||||
|
dbesc($ob_hash)
|
||||||
|
);
|
||||||
|
|
||||||
|
if($r) {
|
||||||
|
$arr = array('items' => $r);
|
||||||
|
call_hooks('network_ping', $arr);
|
||||||
|
|
||||||
|
foreach ($r as $it) {
|
||||||
|
$result['stream'] ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (! ($vnotify & VNOTIFY_NETWORK))
|
||||||
|
$result['stream'] = 0;
|
||||||
|
|
||||||
|
if ($vnotify & VNOTIFY_CHANNEL) {
|
||||||
|
$loadtime = get_loadtime('channel');
|
||||||
|
$r = q("SELECT id FROM item
|
||||||
|
WHERE item_wall = 1 and uid = %d and changed > '%s'
|
||||||
|
$seenstr
|
||||||
|
$item_normal
|
||||||
|
$sql_extra
|
||||||
|
AND author_xchan != '%s'",
|
||||||
|
intval(local_channel()),
|
||||||
|
dbesc($loadtime),
|
||||||
dbesc($ob_hash)
|
dbesc($ob_hash)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -561,8 +649,6 @@ class Ping extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! ($vnotify & VNOTIFY_NETWORK))
|
|
||||||
$result['stream'] = 0;
|
|
||||||
if (! ($vnotify & VNOTIFY_CHANNEL))
|
if (! ($vnotify & VNOTIFY_CHANNEL))
|
||||||
$result['home'] = 0;
|
$result['home'] = 0;
|
||||||
|
|
||||||
|
@ -695,6 +781,21 @@ class Ping extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark all of the stream notifications seen if all three of them are caught up.
|
||||||
|
// This also resets the pconfig storage for items_seen
|
||||||
|
|
||||||
|
if (! (intval($result['home']) + intval($result['stream']) + intval($result['pubs']))) {
|
||||||
|
PConfig::Delete(local_channel(),'system','seen_items');
|
||||||
|
|
||||||
|
$_SESSION['loadtime_channel'] = datetime_convert();
|
||||||
|
$_SESSION['loadtime_stream'] = datetime_convert();
|
||||||
|
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
||||||
|
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_channel', $_SESSION['loadtime_channel']);
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_stream', $_SESSION['loadtime_stream']);
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_pubstream', $_SESSION['loadtime_pubstream']);
|
||||||
|
}
|
||||||
|
|
||||||
json_return_and_die($result);
|
json_return_and_die($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Zotlabs\Module;
|
||||||
use App;
|
use App;
|
||||||
use Zotlabs\Web\Controller;
|
use Zotlabs\Web\Controller;
|
||||||
use Zotlabs\Lib\PermissionDescription;
|
use Zotlabs\Lib\PermissionDescription;
|
||||||
|
use Zotlabs\Lib\PConfig;
|
||||||
|
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
@ -16,9 +17,10 @@ class Pubstream extends Controller {
|
||||||
$o = EMPTY_STR;
|
$o = EMPTY_STR;
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
if($load)
|
if ($load && ! $mid) {
|
||||||
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
||||||
|
}
|
||||||
|
|
||||||
if((observer_prohibited(true))) {
|
if((observer_prohibited(true))) {
|
||||||
return login();
|
return login();
|
||||||
}
|
}
|
||||||
|
@ -97,9 +99,10 @@ class Pubstream extends Controller {
|
||||||
|
|
||||||
nav_set_selected(t('Public Stream'));
|
nav_set_selected(t('Public Stream'));
|
||||||
|
|
||||||
if(!$mid)
|
if (! $mid) {
|
||||||
$_SESSION['static_loadtime'] = datetime_convert();
|
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
||||||
|
}
|
||||||
|
|
||||||
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
|
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
|
||||||
|
|
||||||
$maxheight = get_config('system','home_divmore_height');
|
$maxheight = get_config('system','home_divmore_height');
|
||||||
|
@ -191,8 +194,15 @@ class Pubstream extends Controller {
|
||||||
|
|
||||||
$simple_update = ((isset($_SESSION['loadtime_pubstream']) && $_SESSION['loadtime_pubstream']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_pubstream']) . "' " : '');
|
$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 = '';
|
||||||
|
if (! $mid) {
|
||||||
|
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
||||||
|
if (local_channel()) {
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_pubstream',$_SESSION['loadtime_pubstream']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($static && $simple_update)
|
if($static && $simple_update)
|
||||||
$simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
|
$simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
|
||||||
|
@ -212,7 +222,7 @@ class Pubstream 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_extra $net_query2 LIMIT 1",
|
$sql_extra $net_query2 LIMIT 1",
|
||||||
dbesc($mid . '%')
|
dbesc($mid . '%')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Fetch a page full of parent items for this page
|
// Fetch a page full of parent items for this page
|
||||||
|
@ -236,6 +246,8 @@ class Pubstream extends Controller {
|
||||||
$sql_extra $net_query2 LIMIT 1",
|
$sql_extra $net_query2 LIMIT 1",
|
||||||
dbesc($mid . '%')
|
dbesc($mid . '%')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$r = q("SELECT parent AS item_id FROM item
|
$r = q("SELECT parent AS item_id FROM item
|
||||||
|
@ -247,7 +259,6 @@ class Pubstream extends Controller {
|
||||||
$sql_extra $net_query2"
|
$sql_extra $net_query2"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$_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
|
||||||
|
@ -277,7 +288,17 @@ class Pubstream extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mid && local_channel()) {
|
||||||
|
$ids = ids_to_array($items,'item_id');
|
||||||
|
$seen = PConfig::Get(local_channel(),'system','seen_items',[]);
|
||||||
|
if (! $seen) {
|
||||||
|
$seen = [];
|
||||||
|
}
|
||||||
|
$seen = array_merge($ids,$seen);
|
||||||
|
PConfig::Set(local_channel(),'system','seen_items',$seen);
|
||||||
|
}
|
||||||
|
|
||||||
// fake it
|
// fake it
|
||||||
$mode = ('pubstream');
|
$mode = ('pubstream');
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ use App;
|
||||||
use Zotlabs\Web\Controller;
|
use Zotlabs\Web\Controller;
|
||||||
use Zotlabs\Lib\AccessList;
|
use Zotlabs\Lib\AccessList;
|
||||||
use Zotlabs\Lib\Apps;
|
use Zotlabs\Lib\Apps;
|
||||||
|
use Zotlabs\Lib\PConfig;
|
||||||
use Zotlabs\Lib\PermissionDescription;
|
use Zotlabs\Lib\PermissionDescription;
|
||||||
|
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
|
@ -36,6 +37,7 @@ class Stream extends Controller {
|
||||||
|
|
||||||
if ($load) {
|
if ($load) {
|
||||||
$_SESSION['loadtime_stream'] = datetime_convert();
|
$_SESSION['loadtime_stream'] = datetime_convert();
|
||||||
|
PConfig::Set(local_channel(),'system','loadtime_stream',$_SESSION['loadtime_stream']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr = [ 'query' => App::$query_string ];
|
$arr = [ 'query' => App::$query_string ];
|
||||||
|
@ -506,7 +508,7 @@ class Stream extends Controller {
|
||||||
else
|
else
|
||||||
$page_mode = 'client';
|
$page_mode = 'client';
|
||||||
|
|
||||||
$simple_update = (($update) ? " and item_unseen = 1 " : '');
|
$simple_update = (($update) ? " and item_changed > = '" . $_SESSION['loadtime_stream'] . "' " : '');
|
||||||
|
|
||||||
$parents_str = '';
|
$parents_str = '';
|
||||||
$update_unseen = '';
|
$update_unseen = '';
|
||||||
|
@ -531,7 +533,19 @@ class Stream extends Controller {
|
||||||
|
|
||||||
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()) . "' ";
|
||||||
|
|
||||||
|
|
||||||
|
// we are not yet using this in updates because the content may have just been marked seen
|
||||||
|
// and this might prevent us from loading the update. Will need to test further.
|
||||||
|
|
||||||
|
$seenstr = EMPTY_STR;
|
||||||
|
if (local_channel()) {
|
||||||
|
$seen = PConfig::Get(local_channel(),'system','seen_items',[]);
|
||||||
|
if ($seen) {
|
||||||
|
$seenstr = " and not item.id in (" . implode(',',$seen) . ") ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($nouveau && $load) {
|
if ($nouveau && $load) {
|
||||||
// "New Item View" - show all items unthreaded in reverse created date order
|
// "New Item View" - show all items unthreaded in reverse created date order
|
||||||
|
|
||||||
|
@ -575,6 +589,7 @@ class Stream extends Controller {
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// this is an update
|
// this is an update
|
||||||
|
|
||||||
$r = q("SELECT item.parent AS item_id FROM item
|
$r = q("SELECT item.parent AS item_id FROM item
|
||||||
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
|
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
|
||||||
$net_query
|
$net_query
|
||||||
|
|
16
boot.php
16
boot.php
|
@ -8,6 +8,7 @@ use Zotlabs\Render\Comanche;
|
||||||
use Zotlabs\Render\Theme;
|
use Zotlabs\Render\Theme;
|
||||||
use Zotlabs\Lib\DB_Upgrade;
|
use Zotlabs\Lib\DB_Upgrade;
|
||||||
use Zotlabs\Lib\System;
|
use Zotlabs\Lib\System;
|
||||||
|
use Zotlabs\Lib\PConfig;
|
||||||
use Zotlabs\Daemon\Run;
|
use Zotlabs\Daemon\Run;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2550,3 +2551,18 @@ function get_host() {
|
||||||
}
|
}
|
||||||
return trim($host);
|
return trim($host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_loadtime($module) {
|
||||||
|
$n = 'loadtime_' . $module;
|
||||||
|
if (isset($_SESSION[$n])) {
|
||||||
|
return $_SESSION[$n];
|
||||||
|
}
|
||||||
|
if (local_channel()) {
|
||||||
|
$x = PConfig::Get(local_channel(),'system',$n, false);
|
||||||
|
if ($x) {
|
||||||
|
return ($x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return datetime_convert();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue