mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 03:35:13 +00:00
Revert "use a different mechanism for passing state from Update module to conversational modules"
This reverts commit f6744da509
.
This commit is contained in:
parent
2ea5b33f9f
commit
32d1bfb282
9 changed files with 86 additions and 143 deletions
|
@ -28,7 +28,7 @@ class Cards extends Controller {
|
|||
* {@inheritDoc}
|
||||
* @see \Zotlabs\Web\Controller::get()
|
||||
*/
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
if(observer_prohibited(true)) {
|
||||
return login();
|
||||
|
|
|
@ -28,13 +28,6 @@ require_once('include/acl_selectors.php');
|
|||
|
||||
class Channel extends Controller {
|
||||
|
||||
// State passed in from the Update module.
|
||||
|
||||
public $profile_uid = 0;
|
||||
public $loading = 0;
|
||||
public $updating = 0;
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
if (isset($_GET['search']) && (in_array(substr($_GET['search'],0,1),[ '@', '!', '?']) || strpos($_GET['search'],'https://') === 0)) {
|
||||
|
@ -182,10 +175,14 @@ class Channel extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
|
||||
|
||||
|
||||
$noscript_content = get_config('system', 'noscript_content', '1');
|
||||
|
||||
|
||||
$category = $datequery = $datequery2 = '';
|
||||
|
||||
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
|
||||
|
@ -208,9 +205,9 @@ class Channel extends Controller {
|
|||
|
||||
$o = '';
|
||||
|
||||
if($this->updating) {
|
||||
if($update) {
|
||||
// Ensure we've got a profile owner if updating.
|
||||
App::$profile['profile_uid'] = App::$profile_uid = $this->profile_uid;
|
||||
App::$profile['profile_uid'] = App::$profile_uid = $update;
|
||||
}
|
||||
|
||||
$is_owner = (((local_channel()) && (App::$profile['profile_uid'] == local_channel())) ? true : false);
|
||||
|
@ -222,7 +219,7 @@ class Channel extends Controller {
|
|||
$perms = get_all_perms(App::$profile['profile_uid'],$ob_hash);
|
||||
|
||||
|
||||
if ($this->loading && ! $mid) {
|
||||
if ($load && ! $mid) {
|
||||
$_SESSION['loadtime_channel'] = datetime_convert();
|
||||
if ($is_owner) {
|
||||
PConfig::Set(local_channel(),'system','loadtime_channel',$_SESSION['loadtime_channel']);
|
||||
|
@ -242,7 +239,7 @@ class Channel extends Controller {
|
|||
}
|
||||
|
||||
|
||||
if(! $this->updating) {
|
||||
if(! $update) {
|
||||
|
||||
nav_set_selected('Channel Home');
|
||||
|
||||
|
@ -325,7 +322,7 @@ class Channel extends Controller {
|
|||
|
||||
$abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " ";
|
||||
|
||||
$simple_update = (($this->updating) ? " AND item_unseen = 1 " : '');
|
||||
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
||||
|
||||
if ($search) {
|
||||
$search = escape_tags($search);
|
||||
|
@ -348,10 +345,10 @@ class Channel extends Controller {
|
|||
'title' => 'oembed'
|
||||
]);
|
||||
|
||||
if ($this->updating && isset($_SESSION['loadtime_channel'])) {
|
||||
if ($update && isset($_SESSION['loadtime_channel'])) {
|
||||
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_channel']) . "' ";
|
||||
}
|
||||
if ($this->loading) {
|
||||
if ($load) {
|
||||
$simple_update = '';
|
||||
}
|
||||
|
||||
|
@ -359,7 +356,7 @@ class Channel extends Controller {
|
|||
$simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
|
||||
}
|
||||
|
||||
if (($this->updating) && (! $this->loading)) {
|
||||
if (($update) && (! $load)) {
|
||||
|
||||
if ($mid) {
|
||||
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal_update
|
||||
|
@ -413,7 +410,7 @@ class Channel extends Controller {
|
|||
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
||||
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
|
||||
|
||||
if ($noscript_content || $this->loading) {
|
||||
if ($noscript_content || $load) {
|
||||
if ($mid) {
|
||||
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
|
||||
AND item_wall = 1 $sql_extra limit 1",
|
||||
|
@ -457,7 +454,7 @@ class Channel extends Controller {
|
|||
$items = fetch_post_tags($items, true);
|
||||
$items = conv_sort($items,$ordering);
|
||||
|
||||
if ($this->loading && $mid && (! count($items))) {
|
||||
if ($load && $mid && (! count($items))) {
|
||||
// This will happen if we don't have sufficient permissions
|
||||
// to view the parent item (or the item itself if it is toplevel)
|
||||
notice( t('Permission denied.') . EOL);
|
||||
|
@ -468,7 +465,7 @@ class Channel extends Controller {
|
|||
$items = [];
|
||||
}
|
||||
|
||||
if ((! $this->updating) && (! $this->loading)) {
|
||||
if ((! $update) && (! $load)) {
|
||||
|
||||
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
|
||||
// because browser prefetching might change it on us. We have to deliver it with the page.
|
||||
|
@ -559,14 +556,14 @@ class Channel extends Controller {
|
|||
|
||||
$mode = (($search) ? 'search' : 'channel');
|
||||
|
||||
if($this->updating) {
|
||||
$o .= conversation($items,$mode,$this->updating,$page_mode);
|
||||
if($update) {
|
||||
$o .= conversation($items,$mode,$update,$page_mode);
|
||||
}
|
||||
else {
|
||||
|
||||
$o .= '<noscript>';
|
||||
if ($noscript_content) {
|
||||
$o .= conversation($items,$mode,$this->updating,'traditional');
|
||||
$o .= conversation($items,$mode,$update,'traditional');
|
||||
$o .= alt_pager(count($items));
|
||||
}
|
||||
else {
|
||||
|
@ -574,7 +571,7 @@ class Channel extends Controller {
|
|||
}
|
||||
$o .= '</noscript>';
|
||||
|
||||
$o .= conversation($items,$mode,$this->updating,$page_mode);
|
||||
$o .= conversation($items,$mode,$update,$page_mode);
|
||||
|
||||
if ($mid && $items[0]['title'])
|
||||
App::$page['title'] = $items[0]['title'] . " - " . App::$page['title'];
|
||||
|
|
|
@ -16,17 +16,9 @@ require_once('include/acl_selectors.php');
|
|||
|
||||
class Display extends Controller {
|
||||
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
// State passed in from the Update module.
|
||||
|
||||
public $profile_uid = 0;
|
||||
public $loading = 0;
|
||||
public $updating = 0;
|
||||
|
||||
|
||||
function get() {
|
||||
|
||||
$noscript_content = (get_config('system', 'noscript_content', '1') && (! $this->updating));
|
||||
$noscript_content = (get_config('system', 'noscript_content', '1') && (! $update));
|
||||
|
||||
$module_format = 'html';
|
||||
|
||||
|
@ -36,7 +28,7 @@ class Display extends Controller {
|
|||
$module_format = 'html';
|
||||
}
|
||||
|
||||
if($this->loading)
|
||||
if($load)
|
||||
$_SESSION['loadtime_display'] = datetime_convert();
|
||||
|
||||
if(observer_prohibited()) {
|
||||
|
@ -63,7 +55,7 @@ class Display extends Controller {
|
|||
$observer_is_owner = false;
|
||||
$updateable = false;
|
||||
|
||||
if(local_channel() && (! $this->updating)) {
|
||||
if(local_channel() && (! $update)) {
|
||||
|
||||
$channel = \App::get_channel();
|
||||
|
||||
|
@ -197,17 +189,17 @@ class Display extends Controller {
|
|||
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
|
||||
|
||||
|
||||
$simple_update = (($this->updating) ? " AND item_unseen = 1 " : '');
|
||||
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
||||
|
||||
if($this->updating && $_SESSION['loadtime_display'])
|
||||
if($update && $_SESSION['loadtime_display'])
|
||||
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_display']) . "' ";
|
||||
if($this->loading)
|
||||
if($load)
|
||||
$simple_update = '';
|
||||
|
||||
if($static && $simple_update)
|
||||
$simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
|
||||
|
||||
if((! $this->updating) && (! $this->loading)) {
|
||||
if((! $update) && (! $load)) {
|
||||
|
||||
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
|
||||
|
||||
|
@ -271,7 +263,7 @@ class Display extends Controller {
|
|||
|
||||
$sql_extra = ((local_channel()) ? EMPTY_STR : item_permissions_sql(0, $observer_hash));
|
||||
|
||||
if($noscript_content || $this->loading) {
|
||||
if($noscript_content || $load) {
|
||||
|
||||
$r = null;
|
||||
|
||||
|
@ -295,7 +287,7 @@ class Display extends Controller {
|
|||
);
|
||||
}
|
||||
}
|
||||
elseif ($this->updating && !$this->loading) {
|
||||
elseif ($update && !$load) {
|
||||
$r = null;
|
||||
|
||||
require_once('include/channel.php');
|
||||
|
@ -423,13 +415,13 @@ class Display extends Controller {
|
|||
|
||||
case 'html':
|
||||
|
||||
if ($this->updating) {
|
||||
$o .= conversation($items, 'display', $this->updating, 'client');
|
||||
if ($update) {
|
||||
$o .= conversation($items, 'display', $update, 'client');
|
||||
}
|
||||
else {
|
||||
$o .= '<noscript>';
|
||||
if($noscript_content) {
|
||||
$o .= conversation($items, 'display', $this->updating, 'traditional');
|
||||
$o .= conversation($items, 'display', $update, 'traditional');
|
||||
}
|
||||
else {
|
||||
$o .= '<div class="section-content-warning-wrapper">' . t('You must enable javascript for your browser to be able to view this content.') . '</div>';
|
||||
|
@ -438,7 +430,7 @@ class Display extends Controller {
|
|||
|
||||
App::$page['title'] = (($items[0]['title']) ? $items[0]['title'] . " - " . App::$page['title'] : App::$page['title']);
|
||||
|
||||
$o .= conversation($items, 'display', $this->updating, 'client');
|
||||
$o .= conversation($items, 'display', $update, 'client');
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -496,7 +488,7 @@ class Display extends Controller {
|
|||
|
||||
$o .= '<div id="content-complete"></div>';
|
||||
|
||||
if((($this->updating && $this->loading) || $noscript_content) && (! $items)) {
|
||||
if((($update && $load) || $noscript_content) && (! $items)) {
|
||||
|
||||
$r = q("SELECT id, item_deleted FROM item WHERE mid = '%s' LIMIT 1",
|
||||
dbesc($item_hash)
|
||||
|
|
|
@ -113,7 +113,7 @@ class Home extends Controller {
|
|||
}
|
||||
|
||||
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
$o = EMPTY_STR;
|
||||
|
||||
|
|
|
@ -13,14 +13,6 @@ require_once('include/acl_selectors.php');
|
|||
|
||||
class Hq extends Controller {
|
||||
|
||||
|
||||
// State passed in from the Update module.
|
||||
|
||||
public $profile_uid = 0;
|
||||
public $loading = 0;
|
||||
public $updating = 0;
|
||||
|
||||
|
||||
function init() {
|
||||
if(! local_channel())
|
||||
return;
|
||||
|
@ -44,12 +36,12 @@ class Hq extends Controller {
|
|||
|
||||
}
|
||||
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
if(!local_channel())
|
||||
return;
|
||||
|
||||
if($this->loading)
|
||||
if($load)
|
||||
$_SESSION['loadtime_hq'] = datetime_convert();
|
||||
|
||||
if(argc() > 1 && argv(1) !== 'load') {
|
||||
|
@ -96,9 +88,9 @@ class Hq extends Controller {
|
|||
|
||||
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
|
||||
|
||||
$simple_update = (($this->updating) ? " AND item_unseen = 1 " : '');
|
||||
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
||||
|
||||
if($this->updating && $_SESSION['loadtime_hq'])
|
||||
if($update && $_SESSION['loadtime_hq'])
|
||||
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_hq']) . "' ";
|
||||
|
||||
if($static && $simple_update)
|
||||
|
@ -111,7 +103,7 @@ class Hq extends Controller {
|
|||
|
||||
}
|
||||
|
||||
if(! $this->updating) {
|
||||
if(! $update) {
|
||||
$channel = App::get_channel();
|
||||
|
||||
$channel_acl = [
|
||||
|
@ -151,7 +143,7 @@ class Hq extends Controller {
|
|||
|
||||
}
|
||||
|
||||
if(! $this->updating && ! $this->loading) {
|
||||
if(! $update && ! $load) {
|
||||
|
||||
nav_set_selected('HQ');
|
||||
|
||||
|
@ -208,7 +200,7 @@ class Hq extends Controller {
|
|||
|
||||
$updateable = false;
|
||||
|
||||
if($this->loading && $target_item) {
|
||||
if($load && $target_item) {
|
||||
$r = null;
|
||||
|
||||
$r = q("SELECT item.id AS item_id FROM item
|
||||
|
@ -237,7 +229,7 @@ class Hq extends Controller {
|
|||
);
|
||||
}
|
||||
}
|
||||
elseif($this->updating && $target_item) {
|
||||
elseif($update && $target_item) {
|
||||
$r = null;
|
||||
|
||||
$r = q("SELECT item.parent AS item_id FROM item
|
||||
|
@ -288,7 +280,7 @@ class Hq extends Controller {
|
|||
$items = [];
|
||||
}
|
||||
|
||||
$o .= conversation($items, 'hq', $this->updating, 'client');
|
||||
$o .= conversation($items, 'hq', $update, 'client');
|
||||
|
||||
if($updateable) {
|
||||
$x = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d AND parent = %d ",
|
||||
|
|
|
@ -12,15 +12,7 @@ require_once('include/acl_selectors.php');
|
|||
|
||||
class Pubstream extends Controller {
|
||||
|
||||
// State passed in from the Update module.
|
||||
|
||||
public $profile_uid = 0;
|
||||
public $loading = 0;
|
||||
public $updating = 0;
|
||||
|
||||
|
||||
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
$o = EMPTY_STR;
|
||||
$items = [];
|
||||
|
@ -54,7 +46,7 @@ class Pubstream extends Controller {
|
|||
$net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : '');
|
||||
|
||||
|
||||
if(local_channel() && (! $this->updating)) {
|
||||
if(local_channel() && (! $update)) {
|
||||
|
||||
$channel = App::get_channel();
|
||||
|
||||
|
@ -90,7 +82,7 @@ class Pubstream extends Controller {
|
|||
$o .= '</div>';
|
||||
}
|
||||
|
||||
if(! $this->updating && !$this->loading) {
|
||||
if(! $update && !$load) {
|
||||
|
||||
nav_set_selected(t('Public Stream'));
|
||||
|
||||
|
@ -149,7 +141,7 @@ class Pubstream extends Controller {
|
|||
));
|
||||
}
|
||||
|
||||
if($this->updating && ! $this->loading) {
|
||||
if($update && ! $load) {
|
||||
// only setup pagination on initial page view
|
||||
$pager_sql = '';
|
||||
}
|
||||
|
@ -191,20 +183,20 @@ class Pubstream extends Controller {
|
|||
|
||||
$simple_update = ((isset($_SESSION['loadtime_pubstream']) && $_SESSION['loadtime_pubstream']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_pubstream']) . "' " : '');
|
||||
|
||||
if ($this->loading) {
|
||||
if ($load) {
|
||||
$simple_update = '';
|
||||
}
|
||||
|
||||
if($static && $simple_update)
|
||||
$simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
|
||||
|
||||
//logger('update: ' . $this->updating . ' load: ' . $this->loading);
|
||||
//logger('update: ' . $update . ' load: ' . $load);
|
||||
|
||||
if($this->updating) {
|
||||
if($update) {
|
||||
|
||||
$ordering = "commented";
|
||||
|
||||
if($this->loading) {
|
||||
if($load) {
|
||||
if($mid) {
|
||||
$r = q("SELECT parent AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
|
@ -227,7 +219,7 @@ class Pubstream extends Controller {
|
|||
);
|
||||
}
|
||||
}
|
||||
elseif($this->updating) {
|
||||
elseif($update) {
|
||||
if($mid) {
|
||||
$r = q("SELECT parent AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
|
@ -293,12 +285,12 @@ class Pubstream extends Controller {
|
|||
// fake it
|
||||
$mode = ('pubstream');
|
||||
|
||||
$o .= conversation($items,$mode,$this->updating,$page_mode);
|
||||
$o .= conversation($items,$mode,$update,$page_mode);
|
||||
|
||||
if($mid)
|
||||
$o .= '<div id="content-complete"></div>';
|
||||
|
||||
if(($items) && (! $this->updating))
|
||||
if(($items) && (! $update))
|
||||
$o .= alt_pager(count($items));
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -16,13 +16,6 @@ require_once('include/conversation.php');
|
|||
|
||||
class Search extends Controller {
|
||||
|
||||
// State passed in from the Update module.
|
||||
|
||||
public $profile_uid = 0;
|
||||
public $loading = 0;
|
||||
public $updating = 0;
|
||||
|
||||
|
||||
function init() {
|
||||
if (x($_REQUEST,'search')) {
|
||||
App::$data['search'] = escape_tags($_REQUEST['search']);
|
||||
|
@ -30,7 +23,7 @@ class Search extends Controller {
|
|||
}
|
||||
|
||||
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
if ((get_config('system','block_public')) || (get_config('system','block_public_search',1))) {
|
||||
if ((! local_channel()) && (! remote_channel())) {
|
||||
|
@ -39,14 +32,14 @@ class Search extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->loading) {
|
||||
if ($load) {
|
||||
$_SESSION['loadtime'] = datetime_convert();
|
||||
}
|
||||
nav_set_selected('Search');
|
||||
|
||||
$format = (($_REQUEST['format']) ? $_REQUEST['format'] : '');
|
||||
if ($format !== '') {
|
||||
$this->updating = $this->loading = 1;
|
||||
$update = $load = 1;
|
||||
}
|
||||
|
||||
$observer = App::get_observer();
|
||||
|
@ -74,7 +67,7 @@ class Search extends Controller {
|
|||
|
||||
// ActivityStreams object fetches from the navbar
|
||||
|
||||
if (local_channel() && strpos($search,'https://') === 0 && (! $this->updating) && (! $this->loading)) {
|
||||
if (local_channel() && strpos($search,'https://') === 0 && (! $update) && (! $load)) {
|
||||
logger('searching for ActivityPub');
|
||||
$channel = App::get_channel();
|
||||
$hash = EMPTY_STR;
|
||||
|
@ -227,7 +220,7 @@ class Search extends Controller {
|
|||
// No items will be shown if the member has a blocked profile wall.
|
||||
|
||||
|
||||
if ((! $this->updating) && (! $this->loading)) {
|
||||
if ((! $update) && (! $load)) {
|
||||
|
||||
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 0);
|
||||
|
||||
|
@ -280,12 +273,12 @@ class Search extends Controller {
|
|||
|
||||
$sys = get_sys_channel();
|
||||
|
||||
if (($this->updating) && ($this->loading)) {
|
||||
if (($update) && ($load)) {
|
||||
$itemspage = get_pconfig(local_channel(),'system','itemspage');
|
||||
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
||||
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
|
||||
|
||||
if ($this->loading) {
|
||||
if ($load) {
|
||||
$r = null;
|
||||
|
||||
// if logged in locally, first look in the items you own
|
||||
|
@ -343,7 +336,7 @@ class Search extends Controller {
|
|||
else
|
||||
$o .= '<h2>' . sprintf( t('Search results for: %s'), $search) . '</h2>';
|
||||
|
||||
$o .= conversation($items,'search',$this->updating,'client');
|
||||
$o .= conversation($items,'search',$update,'client');
|
||||
|
||||
$o .= '</div>';
|
||||
|
||||
|
|
|
@ -14,15 +14,6 @@ require_once('include/acl_selectors.php');
|
|||
|
||||
class Stream extends Controller {
|
||||
|
||||
|
||||
// State passed in from the Update module.
|
||||
|
||||
public $profile_uid = 0;
|
||||
public $loading = 0;
|
||||
public $updating = 0;
|
||||
|
||||
|
||||
|
||||
function init() {
|
||||
if (! local_channel()) {
|
||||
return;
|
||||
|
@ -36,7 +27,7 @@ class Stream extends Controller {
|
|||
}
|
||||
|
||||
|
||||
function get() {
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
if (! local_channel()) {
|
||||
$_SESSION['return_url'] = App::$query_string;
|
||||
|
@ -45,7 +36,7 @@ class Stream extends Controller {
|
|||
|
||||
$o = '';
|
||||
|
||||
if ($this->loading) {
|
||||
if ($load) {
|
||||
$_SESSION['loadtime_stream'] = datetime_convert();
|
||||
PConfig::Set(local_channel(),'system','loadtime_stream',$_SESSION['loadtime_stream']);
|
||||
// stream is a superset of channel when it comes to notifications
|
||||
|
@ -149,7 +140,7 @@ class Stream extends Controller {
|
|||
intval(local_channel())
|
||||
);
|
||||
if (! $r) {
|
||||
if ($this->updating) {
|
||||
if ($update) {
|
||||
killme();
|
||||
}
|
||||
notice( t('Access list not found') . EOL );
|
||||
|
@ -195,7 +186,7 @@ class Stream extends Controller {
|
|||
);
|
||||
|
||||
if (! $cid_r) {
|
||||
if ($this->updating) {
|
||||
if ($update) {
|
||||
killme();
|
||||
}
|
||||
notice( t('No such channel') . EOL );
|
||||
|
@ -204,7 +195,7 @@ class Stream extends Controller {
|
|||
|
||||
}
|
||||
|
||||
if (! $this->updating) {
|
||||
if (! $update) {
|
||||
|
||||
// search terms header
|
||||
|
||||
|
@ -286,7 +277,7 @@ class Stream extends Controller {
|
|||
}
|
||||
else {
|
||||
$contact_str = " '0' ";
|
||||
if (! $this->updating) {
|
||||
if (! $update) {
|
||||
info( t('Access list is empty'));
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +302,7 @@ class Stream extends Controller {
|
|||
elseif (isset($cid_r) && $cid_r) {
|
||||
$item_thread_top = EMPTY_STR;
|
||||
|
||||
if ($this->loading || $this->updating) {
|
||||
if ($load || $update) {
|
||||
if (!$pf && $nouveau) {
|
||||
$sql_extra = " AND author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ";
|
||||
}
|
||||
|
@ -362,7 +353,7 @@ class Stream extends Controller {
|
|||
$sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
|
||||
}
|
||||
|
||||
if (! $this->updating) {
|
||||
if (! $update) {
|
||||
// The special div is needed for liveUpdate to kick in for this page.
|
||||
// We only launch liveUpdate if you aren't filtering in some incompatible
|
||||
// way and also you aren't writing a comment (discovered in javascript).
|
||||
|
@ -479,7 +470,7 @@ class Stream extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->updating && ! $this->loading) {
|
||||
if ($update && ! $load) {
|
||||
|
||||
// only setup pagination on initial page view
|
||||
$pager_sql = '';
|
||||
|
@ -524,7 +515,7 @@ class Stream extends Controller {
|
|||
else
|
||||
$page_mode = 'client';
|
||||
|
||||
$simple_update = (($this->updating) ? " and item_changed > = '" . $_SESSION['loadtime_stream'] . "' " : '');
|
||||
$simple_update = (($update) ? " and item_changed > = '" . $_SESSION['loadtime_stream'] . "' " : '');
|
||||
|
||||
$parents_str = '';
|
||||
$update_unseen = '';
|
||||
|
@ -542,9 +533,9 @@ 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 ($this->updating && $_SESSION['loadtime_stream'])
|
||||
if ($update && $_SESSION['loadtime_stream'])
|
||||
$simple_update = " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime_stream']) . "' ";
|
||||
if ($this->loading)
|
||||
if ($load)
|
||||
$simple_update = '';
|
||||
|
||||
if ($static && $simple_update)
|
||||
|
@ -562,7 +553,7 @@ class Stream extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if ($nouveau && $this->loading) {
|
||||
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
|
||||
|
@ -580,7 +571,7 @@ class Stream extends Controller {
|
|||
|
||||
$items = fetch_post_tags($items,true);
|
||||
}
|
||||
elseif ($this->updating) {
|
||||
elseif ($update) {
|
||||
|
||||
// Normal conversation view
|
||||
|
||||
|
@ -589,7 +580,7 @@ class Stream extends Controller {
|
|||
else
|
||||
$ordering = "commented";
|
||||
|
||||
if ($this->loading) {
|
||||
if ($load) {
|
||||
// Fetch a page full of parent items for this page
|
||||
$r = q("SELECT item.parent AS item_id FROM item
|
||||
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
|
||||
|
@ -669,9 +660,9 @@ class Stream extends Controller {
|
|||
$mode = 'search';
|
||||
}
|
||||
|
||||
$o .= conversation($items,$mode,$this->updating,$page_mode);
|
||||
$o .= conversation($items,$mode,$update,$page_mode);
|
||||
|
||||
if (($items) && (! $this->updating)) {
|
||||
if (($items) && (! $update)) {
|
||||
$o .= alt_pager(count($items));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ namespace Zotlabs\Module;
|
|||
* Conversational controllers have been written to expect this input. Other controllers
|
||||
* have not.
|
||||
*/
|
||||
|
||||
use App;
|
||||
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Update extends Controller {
|
||||
|
@ -41,29 +40,16 @@ class Update extends Controller {
|
|||
|
||||
$mod = new $module;
|
||||
|
||||
// Set the state flags of the relevant module (only conversational
|
||||
// modules support state flags
|
||||
|
||||
if (isset($mod->profile_uid)) {
|
||||
$mod->profile_uid = $profile_uid;
|
||||
}
|
||||
if (isset($mod->updating)) {
|
||||
$mod->updating = 1;
|
||||
}
|
||||
if (isset($mod->loading)) {
|
||||
$mod->loading = 1;
|
||||
}
|
||||
|
||||
header("Content-type: text/html");
|
||||
|
||||
// Modify the argument parameters to match what the new controller
|
||||
// expects. They are currently set to what this controller expects.
|
||||
|
||||
App::$argv = [ argv(1) ];
|
||||
App::$argc = 1;
|
||||
\App::$argv = [ argv(1) ];
|
||||
\App::$argc = 1;
|
||||
|
||||
echo "<!DOCTYPE html><html><body><section>\r\n";
|
||||
echo $mod->get();
|
||||
echo $mod->get($profile_uid, $load);
|
||||
echo "</section></body></html>\r\n";
|
||||
|
||||
killme();
|
||||
|
|
Loading…
Reference in a new issue