aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-07-18 08:54:21 +0000
committerMario <mario@mariovavti.com>2024-07-18 08:54:21 +0000
commitbb3caeb6296466747038601bc9c78010ea7fa909 (patch)
tree00a48122fd56175e5be59bbd46e2547ff7489455
parent45275910e606a02b12393714ea3b0409da440d61 (diff)
parent65185a70d593d98570baa4599f562a0d05151d83 (diff)
downloadvolse-hubzilla-bb3caeb6296466747038601bc9c78010ea7fa909.tar.gz
volse-hubzilla-bb3caeb6296466747038601bc9c78010ea7fa909.tar.bz2
volse-hubzilla-bb3caeb6296466747038601bc9c78010ea7fa909.zip
Merge branch 'dev'
-rw-r--r--CHANGELOG14
-rw-r--r--Zotlabs/Lib/Activity.php2
-rw-r--r--Zotlabs/Lib/QueueWorker.php4
-rw-r--r--Zotlabs/Lib/XConfig.php2
-rw-r--r--Zotlabs/Module/Admin/Channels.php2
-rw-r--r--Zotlabs/Module/Share.php8
-rw-r--r--Zotlabs/Module/Sse.php49
-rw-r--r--Zotlabs/Photo/PhotoGd.php30
-rw-r--r--Zotlabs/Widget/Notifications.php2
-rw-r--r--boot.php28
-rw-r--r--view/pdl/mod_admin.pdl1
-rw-r--r--view/pdl/mod_import.pdl8
-rw-r--r--view/tpl/notifications_widget.tpl50
13 files changed, 133 insertions, 67 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9d8b2178f..25189c97b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,16 @@
-Hubzilla 9.2 (2024-??-??)
+Hubzilla 9.2.1 (2024-07-18)
+ - Fix fatal error if gd function image{jpeg, png, webp}() does not exist for some reason
+ - Add missing pdl for mod import
+ - Escape queueworker json data
+ - Fix missing object when repeating own posts
+ - Improve display of system notifications in relation with page reloads
+ - Add possibility to only display system notifications with notifications widget
+ - Fix layout issue with socialauth addon
+ - Save a db lookup if we have just reset notifications in sse addon
+ - Fix php error if attachment was an empty string in pubcrawl addon
+
+
+Hubzilla 9.2 (2024-07-06)
- Fail to import more gracefully if a channel has already been imported at some point but was deleted again
- Use the doubleleft template by default for admin pages to work around some display issues
- Reflect the censored state in the local xchan
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 9178dac39..ae43a43b5 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -3271,7 +3271,7 @@ class Activity {
return $content;
}
- if ($act['type'] === 'Event') {
+ if (isset($act['type']) && $act['type'] === 'Event') {
$adjust = false;
$event = [];
$event['event_hash'] = $act['id'];
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index 24114438e..9e28999c9 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -59,7 +59,7 @@ class QueueWorker {
$transaction = new \DbaTransaction(\DBA::$dba);
$r = q("INSERT INTO workerq (workerq_priority, workerq_data, workerq_uuid, workerq_cmd) VALUES (%d, '%s', '%s', '%s')",
intval($priority),
- $workinfo_json,
+ dbesc($workinfo_json),
dbesc($uuid),
dbesc($argv[0])
);
@@ -105,7 +105,7 @@ class QueueWorker {
$transaction = new \DbaTransaction(\DBA::$dba);
$r = q("INSERT INTO workerq (workerq_priority, workerq_data, workerq_uuid, workerq_cmd) VALUES (%d, '%s', '%s', '%s')",
intval($priority),
- $workinfo_json,
+ dbesc($workinfo_json),
dbesc($uuid),
dbesc($argv[0])
);
diff --git a/Zotlabs/Lib/XConfig.php b/Zotlabs/Lib/XConfig.php
index 76ac8dc7a..5eed9224e 100644
--- a/Zotlabs/Lib/XConfig.php
+++ b/Zotlabs/Lib/XConfig.php
@@ -83,7 +83,7 @@ class XConfig {
return $default;
if(! array_key_exists($xchan, \App::$config))
- load_xconfig($xchan);
+ self::Load($xchan);
if((! array_key_exists($family, \App::$config[$xchan])) || (! array_key_exists($key, \App::$config[$xchan][$family])))
return $default;
diff --git a/Zotlabs/Module/Admin/Channels.php b/Zotlabs/Module/Admin/Channels.php
index 52b661420..cd1d2b6fe 100644
--- a/Zotlabs/Module/Admin/Channels.php
+++ b/Zotlabs/Module/Admin/Channels.php
@@ -126,7 +126,7 @@ class Channels {
goaway(z_root() . '/admin/channels' );
}
- $key = (($_REQUEST['key']) ? dbesc($_REQUEST['key']) : 'channel_id');
+ $key = ((isset($_REQUEST['key']) && $_REQUEST['key']) ? dbesc($_REQUEST['key']) : 'channel_id');
$dir = 'asc';
if(array_key_exists('dir',$_REQUEST))
$dir = ((intval($_REQUEST['dir'])) ? 'asc' : 'desc');
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index ea9313fa8..db0acb6f5 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -94,6 +94,12 @@ class Share extends \Zotlabs\Web\Controller {
else
killme();
+ $object = Activity::fetch_item([ 'id' => $item['mid'] ]);
+
+ if (!$object) {
+ killme();
+ }
+
$arr['aid'] = $item['aid'];
$arr['uid'] = $item['uid'];
@@ -121,7 +127,7 @@ class Share extends \Zotlabs\Web\Controller {
$arr['owner_xchan'] = $item['author_xchan'];
$arr['source_xchan'] = '';
- $arr['obj'] = $item['obj'];
+ $arr['obj'] = $object;
$arr['obj_type'] = $item['obj_type'];
$arr['verb'] = ACTIVITY_SHARE;
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index 5baa90128..df4a74f7b 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -31,13 +31,14 @@ class Sse extends Controller {
// this is important!
session_write_close();
+ ignore_user_abort(true);
self::$uid = local_channel();
self::$ob_hash = get_observer_hash();
self::$sse_id = false;
self::$vnotify = -1;
- if(! self::$ob_hash) {
+ if (!self::$ob_hash) {
if(session_id()) {
self::$sse_id = true;
self::$ob_hash = 'sse_id.' . session_id();
@@ -55,7 +56,7 @@ class Sse extends Controller {
self::$sse_enabled = Config::Get('system', 'sse_enabled', 0);
- if(self::$sse_enabled) {
+ if (self::$sse_enabled) {
// Server Sent Events
@@ -73,7 +74,7 @@ class Sse extends Controller {
$i = 0;
}
- if(!self::$sse_id && $i === 0) {
+ if (!self::$sse_id && $i === 0) {
// Update chat presence indication about once per minute
$r = q("select cp_id, cp_room from chatpresence where cp_xchan = '%s' and cp_client = '%s' and cp_room = 0 limit 1",
dbesc(self::$ob_hash),
@@ -82,7 +83,7 @@ class Sse extends Controller {
$basic_presence = false;
- if($r) {
+ if ($r) {
$basic_presence = true;
q("update chatpresence set cp_last = '%s' where cp_id = %d",
dbesc(datetime_convert()),
@@ -90,7 +91,7 @@ class Sse extends Controller {
);
}
- if(!$basic_presence) {
+ if (!$basic_presence) {
q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client)
values( '%s', '%s', '%s', '%s' ) ",
dbesc(self::$ob_hash),
@@ -101,16 +102,17 @@ class Sse extends Controller {
}
}
- XConfig::Load(self::$ob_hash);
$result = [];
+
+ XConfig::Load(self::$ob_hash);
+
$lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
if (!$lock) {
$result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
}
-
// 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'))) {
@@ -119,35 +121,38 @@ class Sse extends Controller {
}
}
- if($result) {
+ if ($result) {
echo "event: notifications\n";
echo 'data: ' . json_encode($result);
echo "\n\n";
-
- XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
- unset($result);
+ }
+ else {
+ // if no result we will send a heartbeat to keep connected
+ echo "event: heartbeat\n";
+ echo 'data: {}';
+ echo "\n\n";
}
- // always send heartbeat to detect disconnected clients
- echo "event: heartbeat\n";
- echo 'data: {}';
- echo "\n\n";
-
- if(ob_get_length() > 0)
+ if (ob_get_length() > 0) {
ob_end_flush();
+ }
flush();
- if(connection_status() != CONNECTION_NORMAL || connection_aborted()) {
- //TODO: this does not seem to be triggered
+ if (connection_status() != CONNECTION_NORMAL || connection_aborted()) {
XConfig::Set(self::$ob_hash, 'sse', 'timestamp', NULL_DATE);
- break;
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ exit;
}
- $i++;
-
usleep($sleep);
+ if ($result) {
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ $i++;
+
}
}
diff --git a/Zotlabs/Photo/PhotoGd.php b/Zotlabs/Photo/PhotoGd.php
index 4a47f97ee..a81d9cae2 100644
--- a/Zotlabs/Photo/PhotoGd.php
+++ b/Zotlabs/Photo/PhotoGd.php
@@ -160,16 +160,28 @@ class PhotoGd extends PhotoDriver {
case 'image/png':
$quality = Config::Get('system', 'png_quality');
- if((! $quality) || ($quality > 9))
+
+ if((! $quality) || ($quality > 9)) {
$quality = PNG_QUALITY;
- \imagepng($this->image, NULL, $quality);
+ }
+
+ if (function_exists('imagepng')) {
+ \imagepng($this->image, NULL, $quality);
+ }
+
break;
case 'image/webp':
$quality = Config::Get('system', 'webp_quality');
- if((! $quality) || ($quality > 100))
+
+ if((! $quality) || ($quality > 100)) {
$quality = WEBP_QUALITY;
- \imagewebp($this->image, NULL, $quality);
+ }
+
+ if (function_exists('imagewebp')) {
+ \imagewebp($this->image, NULL, $quality);
+ }
+
break;
case 'image/jpeg':
@@ -177,9 +189,15 @@ class PhotoGd extends PhotoDriver {
default:
$quality = Config::Get('system', 'jpeg_quality');
- if((! $quality) || ($quality > 100))
+
+ if((! $quality) || ($quality > 100)) {
$quality = JPEG_QUALITY;
- \imagejpeg($this->image, NULL, $quality);
+ }
+
+ if (function_exists('imagejpeg')) {
+ \imagejpeg($this->image, NULL, $quality);
+ }
+
break;
}
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index b16303be6..eeef1d7d4 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -173,6 +173,8 @@ class Notifications {
'$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'),
'$loading' => t('Loading'),
+ '$sys_only' => empty($arr['sys_only']) ? 0 : 1
+
]);
return $o;
diff --git a/boot.php b/boot.php
index 79609e876..473de2cef 100644
--- a/boot.php
+++ b/boot.php
@@ -66,7 +66,7 @@ require_once('include/security.php');
define('PLATFORM_NAME', 'hubzilla');
-define('STD_VERSION', '9.2');
+define('STD_VERSION', '9.3.2');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1263);
@@ -1928,19 +1928,22 @@ function notice($s) {
}
}
+ $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 = [];
}
- $x = get_xconfig($hash, 'sse', 'notifications');
-
- if ($x === false)
- $x = [];
+ if ($x === null) {
+ $x = get_xconfig($hash, 'sse', 'notifications', []);
+ }
- if (isset($x['notice']) && in_array($s, $x['notice']['notifications']))
+ if (isset($x['notice']) && in_array($s, $x['notice']['notifications'])) {
return;
+ }
if (App::$interactive) {
$x['notice']['notifications'][] = $s;
@@ -1988,19 +1991,22 @@ function info($s) {
}
}
+ $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 = [];
}
- $x = get_xconfig($hash, 'sse', 'notifications');
-
- if ($x === false)
- $x = [];
+ if ($x === null) {
+ $x = get_xconfig($hash, 'sse', 'notifications', []);
+ }
- if (isset($x['info']) && in_array($s, $x['info']['notifications']))
+ if (isset($x['info']) && in_array($s, $x['info']['notifications'])) {
return;
+ }
if (App::$interactive) {
$x['info']['notifications'][] = $s;
diff --git a/view/pdl/mod_admin.pdl b/view/pdl/mod_admin.pdl
index f5e46baed..39bccd466 100644
--- a/view/pdl/mod_admin.pdl
+++ b/view/pdl/mod_admin.pdl
@@ -1,5 +1,6 @@
[template]doubleleft[/template]
[region=aside]
+[widget=notifications][var=sys_only]1[/var][/widget]
[widget=admin][/widget]
[/region]
[region=content]
diff --git a/view/pdl/mod_import.pdl b/view/pdl/mod_import.pdl
new file mode 100644
index 000000000..9f0bb4d9a
--- /dev/null
+++ b/view/pdl/mod_import.pdl
@@ -0,0 +1,8 @@
+[region=aside]
+[/region]
+[region=content]
+$content
+[/region]
+[region=right_aside]
+[widget=notifications][/widget]
+[/region]
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index a9d98dae9..0b3b463bc 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -5,6 +5,7 @@
var sse_partial_result = false;
var sse_rmids = [];
var sse_fallback_interval;
+ var sse_sys_only = {{$sys_only}};
$(document).ready(function() {
let notifications_parent;
@@ -219,8 +220,9 @@
}
function sse_bs_counts() {
- if(sse_bs_active)
+ if(sse_bs_active || sse_sys_only) {
return;
+ }
sse_bs_active = true;
@@ -238,10 +240,11 @@
function sse_bs_notifications(e, replace, followup) {
- if(sse_bs_active)
+ if(sse_bs_active || sse_sys_only) {
return;
+ }
- var manual = false;
+ let manual = false;
if(typeof replace === 'undefined')
replace = e.data.replace;
@@ -302,9 +305,27 @@
function sse_handleNotifications(obj, replace, followup) {
- var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
- var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
- var all_notifications = primary_notifications.concat(secondary_notifications);
+ // notice and info
+
+ if(obj.notice) {
+ $(obj.notice.notifications).each(function() {
+ toast(this, 'danger');
+ });
+ }
+
+ if(obj.info) {
+ $(obj.info.notifications).each(function(){
+ toast(this, 'info');
+ });
+ }
+
+ if (sse_sys_only) {
+ return;
+ }
+
+ let primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
+ let secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
+ let all_notifications = primary_notifications.concat(secondary_notifications);
all_notifications.forEach(function(type, index) {
if(typeof obj[type] === typeof undefined)
@@ -312,7 +333,6 @@
var count = Number(obj[type].count);
-
if(obj[type].count) {
$('.' + type + '-button').fadeIn();
if(replace || followup) {
@@ -336,20 +356,6 @@
sse_setNotificationsStatus();
- // notice and info
-
- if(obj.notice) {
- $(obj.notice.notifications).each(function() {
- toast(this, 'danger');
- });
- }
-
- if(obj.info) {
- $(obj.info.notifications).each(function(){
- toast(this, 'info');
- });
- }
-
// load more notifications if visible notifications count becomes low
if(sse_type && sse_offset != -1 && $('#nav-' + sse_type + '-menu').children(':not(.tt-filter-active)').length < 15) {
sse_bs_notifications(sse_type, false, true);
@@ -533,6 +539,7 @@
}
</script>
+{{if !$sys_only}}
<div id="notifications_wrapper" class="mb-4">
<div id="no_notifications" class="d-xl-none">
{{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
@@ -604,3 +611,4 @@
{{/foreach}}
</div>
</div>
+{{/if}}