aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Login.php2
-rw-r--r--Zotlabs/Module/Sse.php83
-rw-r--r--Zotlabs/Module/Wall_attach.php6
-rw-r--r--boot.php96
-rw-r--r--view/js/main.js2
-rw-r--r--view/pdl/mod_home.pdl3
-rw-r--r--view/pdl/mod_login.pdl6
-rw-r--r--view/tpl/build_query.tpl61
8 files changed, 125 insertions, 134 deletions
diff --git a/Zotlabs/Module/Login.php b/Zotlabs/Module/Login.php
index 6430939b4..721ac15ac 100644
--- a/Zotlabs/Module/Login.php
+++ b/Zotlabs/Module/Login.php
@@ -12,5 +12,5 @@ class Login extends \Zotlabs\Web\Controller {
return login(true);
}
-
+
}
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index df4a74f7b..daf344f2d 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -23,14 +23,7 @@ class Sse extends Controller {
killme();
}
- if(! intval(Config::Get('system','open_pubstream',1))) {
- if(! get_observer_hash()) {
- killme();
- }
- }
-
// this is important!
- session_write_close();
ignore_user_abort(true);
self::$uid = local_channel();
@@ -102,7 +95,6 @@ class Sse extends Controller {
}
}
-
$result = [];
XConfig::Load(self::$ob_hash);
@@ -110,9 +102,19 @@ class Sse extends Controller {
$lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
if (!$lock) {
- $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ $result_db = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ if (!empty($_SESSION['sysmsg'])) {
+ $result['notice']['notifications'] = $_SESSION['sysmsg'];
+ }
+
+ if (!empty($_SESSION['sysmsg_info'])) {
+ $result['info']['notifications'] = $_SESSION['sysmsg_info'];
}
+ $result = array_merge($result, $result_db);
+
// We do not have the local_channel in the addon.
// Reset pubs here if the app is not installed.
if (self::$uid && (!(self::$vnotify & VNOTIFY_PUBS) || !Apps::system_app_installed(self::$uid, 'Public Stream'))) {
@@ -133,22 +135,45 @@ class Sse extends Controller {
echo "\n\n";
}
- if (ob_get_length() > 0) {
- ob_end_flush();
- }
+ if (connection_status() != CONNECTION_NORMAL || connection_aborted()) {
- flush();
+ // IMPORTANT: in case the channel was changed we need to reset the
+ // session here to it's current stored state.
+ // Otherwise the uid might switch back to the previous value
+ // in the background.
+
+ session_reset();
- if (connection_status() != CONNECTION_NORMAL || connection_aborted()) {
XConfig::Set(self::$ob_hash, 'sse', 'timestamp', NULL_DATE);
XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+
+ $_SESSION['sysmsg'] = [];
+ $_SESSION['sysmsg_info'] = [];
+
+ if (ob_get_length() > 0) {
+ ob_end_flush();
+ }
+
+ flush();
+
exit;
}
+ if (ob_get_length() > 0) {
+ ob_flush();
+ }
+
+ flush();
+
usleep($sleep);
if ($result) {
- XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ if ($result_db) {
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ $_SESSION['sysmsg'] = [];
+ $_SESSION['sysmsg_info'] = [];
}
$i++;
@@ -186,13 +211,35 @@ class Sse extends Controller {
}
}
+ $result = [];
+ $result_db = [];
+
XConfig::Load(self::$ob_hash);
- $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
$lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
- if($result && !$lock) {
- XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ if (!$lock) {
+ $result_db = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ if (!empty($_SESSION['sysmsg'])) {
+ $result['notice']['notifications'] = $_SESSION['sysmsg'];
+ }
+
+ if (!empty($_SESSION['sysmsg_info'])) {
+ $result['info']['notifications'] = $_SESSION['sysmsg_info'];
+ }
+
+ $result = array_merge($result, $result_db);
+
+ if($result) {
+ if ($result_db) {
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ $_SESSION['sysmsg'] = [];
+ $_SESSION['sysmsg_info'] = [];
+
json_return_and_die($result);
}
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 3c57d4b94..e354f58f1 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -111,7 +111,7 @@ class Wall_attach extends \Zotlabs\Web\Controller {
// give a wee bit of time for the background thumbnail processor to do its thing
// or else we'll never see a video poster
sleep(3);
- $url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
+ $url = z_root() . '/attach/' . $r['data']['hash'];
$thumb = Linkinfo::get_video_poster($url);
if($thumb) {
$s = '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]';
@@ -120,8 +120,8 @@ class Wall_attach extends \Zotlabs\Web\Controller {
$s = '[zvideo]' . $url . '[/zvideo]';
}
}
- if(strpos($r['data']['filetype'],'audio') === 0) {
- $url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
+ if(strpos($r['data']['filetype'], 'audio') === 0) {
+ $url = z_root() . '/attach/' . $r['data']['hash'];
$s = '[zaudio]' . $url . '[/zaudio]';
}
if ($r['data']['filetype'] === 'image/svg+xml') {
diff --git a/boot.php b/boot.php
index 473de2cef..9b0c6fb84 100644
--- a/boot.php
+++ b/boot.php
@@ -66,7 +66,7 @@ require_once('include/security.php');
define('PLATFORM_NAME', 'hubzilla');
-define('STD_VERSION', '9.3.2');
+define('STD_VERSION', '9.3.5');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1263);
@@ -1897,57 +1897,22 @@ function can_view_public_stream() {
*/
function notice($s) {
- /*
- if(! session_id())
- return;
-
- if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array();
-
- // ignore duplicated error messages which haven't yet been displayed
- // - typically seen as multiple 'permission denied' messages
- // as a result of auto-reloading a protected page with &JS=1
-
- if(in_array($s, $_SESSION['sysmsg']))
- return;
-
- if(App::$interactive) {
- $_SESSION['sysmsg'][] = $s;
- }
- */
-
- $hash = get_observer_hash();
- $sse_id = false;
-
- if (!$hash) {
- if (session_id()) {
- $sse_id = true;
- $hash = 'sse_id.' . session_id();
- }
- else {
- return;
- }
+ if (!session_id()) {
+ return;
}
- $x = null;
-
- $t = get_xconfig($hash, 'sse', 'timestamp', NULL_DATE);
-
- if (datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) {
- set_xconfig($hash, 'sse', 'notifications', []);
- $x = [];
+ if (!isset($_SESSION['sysmsg'])) {
+ $_SESSION['sysmsg'] = [];
}
- if ($x === null) {
- $x = get_xconfig($hash, 'sse', 'notifications', []);
- }
+ // ignore duplicated error messages which haven't yet been displayed
- if (isset($x['notice']) && in_array($s, $x['notice']['notifications'])) {
+ if (in_array($s, $_SESSION['sysmsg'])) {
return;
}
if (App::$interactive) {
- $x['notice']['notifications'][] = $s;
- set_xconfig($hash, 'sse', 'notifications', $x);
+ $_SESSION['sysmsg'][] = $s;
}
}
@@ -1964,53 +1929,22 @@ function notice($s) {
*/
function info($s) {
- /*
- if(! session_id())
- return;
-
- if(! x($_SESSION, 'sysmsg_info'))
- $_SESSION['sysmsg_info'] = array();
-
- if(in_array($s, $_SESSION['sysmsg_info']))
- return;
-
- if(App::$interactive)
- $_SESSION['sysmsg_info'][] = $s;
- */
-
- $hash = get_observer_hash();
- $sse_id = false;
-
- if (!$hash) {
- if (session_id()) {
- $sse_id = true;
- $hash = 'sse_id.' . session_id();
- }
- else {
- return;
- }
+ if (!session_id()) {
+ return;
}
- $x = null;
-
- $t = get_xconfig($hash, 'sse', 'timestamp', NULL_DATE);
-
- if (datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) {
- set_xconfig($hash, 'sse', 'notifications', []);
- $x = [];
+ if (!isset($_SESSION['sysmsg_info'])) {
+ $_SESSION['sysmsg_info'] = [];
}
- if ($x === null) {
- $x = get_xconfig($hash, 'sse', 'notifications', []);
- }
+ // ignore duplicated error messages which haven't yet been displayed
- if (isset($x['info']) && in_array($s, $x['info']['notifications'])) {
+ if (in_array($s, $_SESSION['sysmsg_info'])) {
return;
}
if (App::$interactive) {
- $x['info']['notifications'][] = $s;
- set_xconfig($hash, 'sse', 'notifications', $x);
+ $_SESSION['sysmsg_info'][] = $s;
}
}
diff --git a/view/js/main.js b/view/js/main.js
index 3307086d4..2ad7b86fb 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1144,7 +1144,7 @@ function pageUpdate() {
bParam_page = 1;
}
- update_url = baseurl + '/' + decodeURIComponent(page_query) + '/?aj=1&page=' + bParam_page + extra_args ;
+ update_url = baseurl + '/' + decodeURIComponent(page_query) + '?aj=1&page=' + bParam_page + extra_args ;
$("#page-spinner").show();
update_mode = 'append';
diff --git a/view/pdl/mod_home.pdl b/view/pdl/mod_home.pdl
index 8b3ff52f8..2660f63e0 100644
--- a/view/pdl/mod_home.pdl
+++ b/view/pdl/mod_home.pdl
@@ -1,3 +1,6 @@
+[region=aside]
+[widget=notifications][var=sys_only]1[/var][/widget]
+[/region]
[region=content]
$content
[/region]
diff --git a/view/pdl/mod_login.pdl b/view/pdl/mod_login.pdl
new file mode 100644
index 000000000..3065703de
--- /dev/null
+++ b/view/pdl/mod_login.pdl
@@ -0,0 +1,6 @@
+[region=aside]
+[widget=notifications][var=sys_only]1[/var][/widget]
+[/region]
+[region=content]
+$content
+[/region]
diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl
index af70a9595..b009d4c9c 100644
--- a/view/tpl/build_query.tpl
+++ b/view/tpl/build_query.tpl
@@ -41,36 +41,37 @@
var bParam_unseen = "{{$unseen}}";
function buildCmd() {
- var udargs = ((page_load) ? "/load" : "");
- var bCmd = bParam_cmd + udargs + "?f=" ;
- if(bParam_uid) bCmd = bCmd + "&p=" + bParam_uid;
- if(bParam_cmin != (-1)) bCmd = bCmd + "&cmin=" + bParam_cmin;
- if(bParam_cmax != (-1)) bCmd = bCmd + "&cmax=" + bParam_cmax;
- if(bParam_gid != 0) { bCmd = bCmd + "&gid=" + bParam_gid; } else
- if(bParam_cid != 0) { bCmd = bCmd + "&cid=" + bParam_cid; }
- if(bParam_star != 0) bCmd = bCmd + "&star=" + bParam_star;
- if(bParam_liked != 0) bCmd = bCmd + "&liked=" + bParam_liked;
- if(bParam_conv!= 0) bCmd = bCmd + "&conv=" + bParam_conv;
- if(bParam_spam != 0) bCmd = bCmd + "&spam=" + bParam_spam;
- if(bParam_new != 0) bCmd = bCmd + "&new=" + bParam_new;
- if(bParam_wall != 0) bCmd = bCmd + "&wall=" + bParam_wall;
- if(bParam_list != 0) bCmd = bCmd + "&list=" + bParam_list;
- if(bParam_fh != 0) bCmd = bCmd + "&fh=" + bParam_fh;
- if(bParam_dm != 0) bCmd = bCmd + "&dm=" + bParam_dm;
- if(bParam_search != "") bCmd = bCmd + "&search=" + bParam_search;
- if(bParam_xchan != "") bCmd = bCmd + "&xchan=" + bParam_xchan;
- if(bParam_order != "") bCmd = bCmd + "&order=" + bParam_order;
- if(bParam_file != "") bCmd = bCmd + "&file=" + bParam_file;
- if(bParam_cats != "") bCmd = bCmd + "&cat=" + bParam_cats;
- if(bParam_tags != "") bCmd = bCmd + "&tag=" + bParam_tags;
- if(bParam_dend != "") bCmd = bCmd + "&dend=" + bParam_dend;
- if(bParam_dbegin != "") bCmd = bCmd + "&dbegin=" + bParam_dbegin;
- if(bParam_mid != "") bCmd = bCmd + "&mid=" + bParam_mid;
- if(bParam_verb != "") bCmd = bCmd + "&verb=" + bParam_verb;
- if(bParam_net != "") bCmd = bCmd + "&net=" + bParam_net;
- if(bParam_page != 1) bCmd = bCmd + "&page=" + bParam_page;
- if(bParam_pf != 0) bCmd = bCmd + "&pf=" + bParam_pf;
- if(bParam_unseen != 0) bCmd = bCmd + "&unseen=" + bParam_unseen;
+ let udargs = ((page_load) ? "/load" : "");
+ let bCmd = bParam_cmd + udargs;
+
+ if(bParam_uid) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "p=" + bParam_uid;
+ if(bParam_cmin != (-1)) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "cmin=" + bParam_cmin;
+ if(bParam_cmax != (-1)) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "cmax=" + bParam_cmax;
+ if(bParam_gid != 0) { bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "gid=" + bParam_gid; } else
+ if(bParam_cid != 0) { bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "cid=" + bParam_cid; }
+ if(bParam_star != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "star=" + bParam_star;
+ if(bParam_liked != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "liked=" + bParam_liked;
+ if(bParam_conv!= 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "conv=" + bParam_conv;
+ if(bParam_spam != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "spam=" + bParam_spam;
+ if(bParam_new != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "new=" + bParam_new;
+ if(bParam_wall != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "wall=" + bParam_wall;
+ if(bParam_list != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "list=" + bParam_list;
+ if(bParam_fh != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "fh=" + bParam_fh;
+ if(bParam_dm != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "dm=" + bParam_dm;
+ if(bParam_search != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "search=" + bParam_search;
+ if(bParam_xchan != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "xchan=" + bParam_xchan;
+ if(bParam_order != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "order=" + bParam_order;
+ if(bParam_file != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "file=" + bParam_file;
+ if(bParam_cats != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "cat=" + bParam_cats;
+ if(bParam_tags != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "tag=" + bParam_tags;
+ if(bParam_dend != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "dend=" + bParam_dend;
+ if(bParam_dbegin != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "dbegin=" + bParam_dbegin;
+ if(bParam_mid != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "mid=" + bParam_mid;
+ if(bParam_verb != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "verb=" + bParam_verb;
+ if(bParam_net != "") bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "net=" + bParam_net;
+ if(bParam_page != 1) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "page=" + bParam_page;
+ if(bParam_pf != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "pf=" + bParam_pf;
+ if(bParam_unseen != 0) bCmd = bCmd + ((bCmd.includes('?')) ? '&' : '?') + "unseen=" + bParam_unseen;
return(bCmd);
}