aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-11-25 17:12:28 +0100
committerMario <mario@mariovavti.com>2023-11-25 17:12:28 +0100
commit0fd8e02a884a2b040dca62ab5d9674db5f6a070b (patch)
tree586ee43f32f6f14368c09026f21dcd3244ea24b6 /Zotlabs/Module
parent82e704ec5b107823c09f1387e9091adee53a4c2d (diff)
parent55c4bfb67009c598f25b1a8189604bfffa73dfbb (diff)
downloadvolse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.tar.gz
volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.tar.bz2
volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.zip
Merge branch '8.8RC'8.8
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Admin/Accounts.php2
-rw-r--r--Zotlabs/Module/Admin/Channels.php2
-rw-r--r--Zotlabs/Module/Admin/Themes.php23
-rw-r--r--Zotlabs/Module/Blocks.php2
-rw-r--r--Zotlabs/Module/Cdav.php4
-rw-r--r--Zotlabs/Module/Channel.php2
-rw-r--r--Zotlabs/Module/Chat.php4
-rw-r--r--Zotlabs/Module/Connections.php1
-rw-r--r--Zotlabs/Module/Display.php12
-rw-r--r--Zotlabs/Module/Editblock.php2
-rw-r--r--Zotlabs/Module/Editlayout.php2
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Module/Editwebpage.php10
-rw-r--r--Zotlabs/Module/Hq.php3
-rw-r--r--Zotlabs/Module/Item.php9
-rw-r--r--Zotlabs/Module/Layouts.php2
-rw-r--r--Zotlabs/Module/Like.php9
-rw-r--r--Zotlabs/Module/Network.php2
-rw-r--r--Zotlabs/Module/Owa.php22
-rw-r--r--Zotlabs/Module/Pdledit_gui.php3
-rw-r--r--Zotlabs/Module/Photos.php9
-rw-r--r--Zotlabs/Module/Pubstream.php7
-rw-r--r--Zotlabs/Module/Rpost.php20
-rw-r--r--Zotlabs/Module/Settings/Display.php5
-rw-r--r--Zotlabs/Module/Share.php64
-rw-r--r--Zotlabs/Module/Sse_bs.php40
-rw-r--r--Zotlabs/Module/Wall_attach.php17
-rw-r--r--Zotlabs/Module/Webpages.php2
28 files changed, 185 insertions, 97 deletions
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php
index 1c1911b3a..b067b4bf6 100644
--- a/Zotlabs/Module/Admin/Accounts.php
+++ b/Zotlabs/Module/Admin/Accounts.php
@@ -346,7 +346,7 @@ class Accounts {
'$users' => $users,
'$msg' => t('Message')
));
- $o .= paginate($a);
+ $o .= paginate();
return $o;
}
diff --git a/Zotlabs/Module/Admin/Channels.php b/Zotlabs/Module/Admin/Channels.php
index 09769a166..c6b7ad17a 100644
--- a/Zotlabs/Module/Admin/Channels.php
+++ b/Zotlabs/Module/Admin/Channels.php
@@ -168,7 +168,7 @@ class Channels {
'$baseurl' => z_root(),
'$channels' => $channels,
));
- $o .= paginate($a);
+ $o .= paginate();
return $o;
}
diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php
index 8e72a1318..7f615afa8 100644
--- a/Zotlabs/Module/Admin/Themes.php
+++ b/Zotlabs/Module/Admin/Themes.php
@@ -80,10 +80,25 @@ class Themes {
$this->toggle_theme($themes, $theme, $result);
$s = $this->rebuild_theme_table($themes);
- if($result)
- info( sprintf('Theme %s enabled.', $theme));
- else
- info( sprintf('Theme %s disabled.', $theme));
+
+ if($result) {
+ if (is_file("view/theme/$theme/php/config.php")){
+ require_once("view/theme/$theme/php/config.php");
+ if (function_exists($theme . '_theme_admin_enable')){
+ call_user_func($theme . '_theme_admin_enable');
+ }
+ }
+ info(sprintf('Theme %s enabled.', $theme));
+ }
+ else {
+ if (is_file("view/theme/$theme/php/config.php")){
+ require_once("view/theme/$theme/php/config.php");
+ if (function_exists($theme . '_theme_admin_disable')){
+ call_user_func($theme . '_theme_admin_disable');
+ }
+ }
+ info(sprintf('Theme %s disabled.', $theme));
+ }
set_config('system', 'allowed_themes', $s);
goaway(z_root() . '/admin/themes' );
diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php
index e0de23fdb..84f769612 100644
--- a/Zotlabs/Module/Blocks.php
+++ b/Zotlabs/Module/Blocks.php
@@ -107,7 +107,7 @@ class Blocks extends \Zotlabs\Web\Controller {
$x['pagetitle'] = $_REQUEST['pagetitle'] ?? '';
$a = '';
- $editor = status_editor($a,$x,false,'Blocks');
+ $editor = status_editor($x, false, 'Blocks');
$r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index b6d7ff5a3..892f02d10 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -1087,7 +1087,11 @@ class Cdav extends Controller {
$filters['name'] = 'VCALENDAR';
$filters['prop-filters'][0]['name'] = 'VEVENT';
+ $filters['prop-filters'][0]['is-not-defined'] = null;
+ $filters['prop-filters'][0]['param-filters'] = null;
+ $filters['prop-filters'][0]['text-match'] = null;
$filters['comp-filters'][0]['name'] = 'VEVENT';
+ $filters['comp-filters'][0]['is-not-defined'] = null;
$filters['comp-filters'][0]['time-range']['start'] = $start;
$filters['comp-filters'][0]['time-range']['end'] = $end;
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 036663681..e8c3316e9 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -268,7 +268,7 @@ class Channel extends Controller {
];
$a = '';
- $o .= status_editor($a, $x, false, 'Channel');
+ $o .= status_editor($x, false, 'Channel');
}
// Add pinned content
diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php
index fc74016ab..356071256 100644
--- a/Zotlabs/Module/Chat.php
+++ b/Zotlabs/Module/Chat.php
@@ -181,7 +181,7 @@ class Chat extends Controller {
);
if($x) {
- $acl = new AccessList(false);
+ $acl = new AccessList([]);
$acl->set($x[0]);
$private = $acl->is_private();
@@ -225,7 +225,7 @@ class Chat extends Controller {
$o = '';
- $acl = new AccessList($channel);
+ $acl = new AccessList($channel ?? []);
$channel_acl = $acl->get();
$lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock');
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index e0f463c76..8a06ab8e0 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -409,7 +409,6 @@ class Connections extends \Zotlabs\Web\Controller {
'$approve' => t('Approve'),
'$cmd' => App::$cmd,
'$contacts' => $contacts,
- '$paginate' => paginate($a),
'$abook_usage_message' => $abook_usage_message,
'$group_label' => t('This is a group/forum channel')
]);
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 1a1c09d7c..9e46d7620 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -2,15 +2,13 @@
namespace Zotlabs\Module;
use App;
+use Zotlabs\Web\Controller;
-require_once("include/bbcode.php");
-require_once('include/security.php');
-require_once('include/conversation.php');
-require_once('include/acl_selectors.php');
-require_once('include/items.php');
+class Display extends Controller {
+ function init() {
-class Display extends \Zotlabs\Web\Controller {
+ }
function get($update = 0, $load = false) {
@@ -91,7 +89,7 @@ class Display extends \Zotlabs\Web\Controller {
$o .= '<div id="jot-popup">';
$a = '';
- $o .= status_editor($a,$x,false,'Display');
+ $o .= status_editor($x, false, 'Display');
$o .= '</div>';
}
diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php
index c031f32a1..1cbb1aee2 100644
--- a/Zotlabs/Module/Editblock.php
+++ b/Zotlabs/Module/Editblock.php
@@ -132,7 +132,7 @@ class Editblock extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
- $editor = status_editor($a, $x, false, 'Editblock');
+ $editor = status_editor($x, false, 'Editblock');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Block'),
diff --git a/Zotlabs/Module/Editlayout.php b/Zotlabs/Module/Editlayout.php
index 50096f1a1..1a3f5614c 100644
--- a/Zotlabs/Module/Editlayout.php
+++ b/Zotlabs/Module/Editlayout.php
@@ -131,7 +131,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
'profile_uid' => intval($owner),
);
- $editor = status_editor($a, $x, false, 'Editlayout');
+ $editor = status_editor($x, false, 'Editlayout');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Layout'),
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index b21c58af2..5e405bdbc 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -107,7 +107,7 @@ class Editpost extends \Zotlabs\Web\Controller {
);
$a = '';
- $editor = status_editor($a, $x, false, 'Editpost');
+ $editor = status_editor($x, false, 'Editpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),
diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php
index 785eeb4ec..ab4858d63 100644
--- a/Zotlabs/Module/Editwebpage.php
+++ b/Zotlabs/Module/Editwebpage.php
@@ -75,7 +75,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
// Figure out which post we're editing
$post_id = ((argc() > 2) ? intval(argv(2)) : 0);
-
+
if(! $post_id) {
notice( t('Item not found') . EOL);
return;
@@ -90,7 +90,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
return;
}
- // We've already figured out which item we want and whose copy we need,
+ // We've already figured out which item we want and whose copy we need,
// so we don't need anything fancy here
$sql_extra = item_permissions_sql($owner);
@@ -122,13 +122,13 @@ class Editwebpage extends \Zotlabs\Web\Controller {
return;
}
}
-
+
$layout = $itm[0]['layout_mid'];
$content = $itm[0]['body'];
if($itm[0]['mimetype'] === 'text/markdown')
$content = \Zotlabs\Lib\MarkdownSoap::unescape($itm[0]['body']);
-
+
$rp = 'webpages/' . $which;
$x = array(
@@ -160,7 +160,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
- $editor = status_editor($a, $x, false, 'Editwebpage');
+ $editor = status_editor($x, false, 'Editwebpage');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Webpage'),
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 05b48f119..5c3ae9273 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -85,6 +85,7 @@ class Hq extends \Zotlabs\Web\Controller {
$x = [
'is_owner' => true,
+ 'profile_uid' => $channel['channel_id'],
'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''),
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
@@ -104,7 +105,7 @@ class Hq extends \Zotlabs\Web\Controller {
];
$a = '';
- $o .= status_editor($a, $x, true);
+ $o .= status_editor($x, true, 'Hq');
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index b564396c9..25ccb0cbf 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -99,7 +99,7 @@ class Item extends Controller {
$sql_extra = item_permissions_sql(0);
if (!$i) {
- $i = q("select id as item_id, uid from item where mid = '%s' $item_normal $sql_extra order by item_wall desc limit 1",
+ $i = q("select id as item_id, uid, item_private from item where mid = '%s' $item_normal $sql_extra order by item_wall desc limit 1",
dbesc($r[0]['parent_mid'])
);
}
@@ -120,7 +120,10 @@ class Item extends Controller {
$parents_str = ids_to_querystr($i, 'item_id');
- $total = q("SELECT count(*) AS count FROM item WHERE parent = %d $item_normal",
+ // We won't need to check for privacy mismatches if the verified observer is also owner
+ $parent_item_private = ((isset($i[0]['item_private'])) ? " and item_private = " . intval($i[0]['item_private']) . " " : '');
+
+ $total = q("SELECT count(*) AS count FROM item WHERE parent = %d $parent_item_private $item_normal ",
intval($parents_str)
);
@@ -134,7 +137,7 @@ class Item extends Controller {
as_return_and_die($i ,$chan);
}
else {
- $items = q("SELECT item.*, item.id AS item_id FROM item WHERE item.parent = %d $item_normal ORDER BY item.id",
+ $items = q("SELECT item.*, item.id AS item_id FROM item WHERE item.parent = %d $parent_item_private $item_normal ORDER BY item.id",
intval($parents_str)
);
diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php
index 949f8e8ec..143e4110b 100644
--- a/Zotlabs/Module/Layouts.php
+++ b/Zotlabs/Module/Layouts.php
@@ -139,7 +139,7 @@ class Layouts extends \Zotlabs\Web\Controller {
$x['pagetitle'] = $_REQUEST['pagetitle'] ?? '';
$a = '';
- $editor = status_editor($a,$x,false,'Layouts');
+ $editor = status_editor($x, false, 'Layouts');
$r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig
left join item on iconfig.iid = item.id
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 5779faa19..54daf6471 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -554,7 +554,14 @@ class Like extends Controller {
$arr['deny_cid'] = $deny_cid;
$arr['deny_gid'] = $deny_gid;
$arr['item_private'] = $private;
- $arr['created'] = datetime_convert();
+
+ $created = datetime_convert();
+
+ $arr['created'] = $created;
+ $arr['edited'] = $created;
+ $arr['commented'] = $created;
+ $arr['received'] = $created;
+ $arr['changed'] = $created;
call_hooks('post_local', $arr);
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index dcc209d1d..4f8e2f4e4 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -214,7 +214,7 @@ class Network extends \Zotlabs\Web\Controller {
);
$a = '';
- $status_editor = status_editor($a, $x, false, 'Network');
+ $status_editor = status_editor($x, false, 'Network');
$o .= $status_editor;
}
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php
index 4de4d32d6..e41435ecd 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -30,18 +30,32 @@ class Owa extends Controller {
$sigblock = HTTPSig::parse_sigheader($_SERVER['HTTP_AUTHORIZATION']);
if ($sigblock) {
$keyId = $sigblock['keyId'];
+ $parsed = parse_url($keyId);
+ if (str_starts_with($parsed['scheme'],'http')) {
+ unset($parsed['fragment']);
+ unset($parsed['query']);
+ $keyId = unparse_url($parsed);
+ }
+ else {
+ $keyId = str_replace('acct:', '', $keyId);
+ }
if ($keyId) {
$r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash
- WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC",
- dbesc(str_replace('acct:', '', $keyId)),
+ WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s' OR xchan_hash = '%s')
+ AND hubloc_deleted = 0 AND xchan_pubkey != ''
+ ORDER BY hubloc_id DESC",
+ dbesc($keyId),
+ dbesc($keyId),
dbesc($keyId)
);
if (! $r) {
$found = discover_by_webbie($keyId);
+ logger('found = ' . print_r($found, true));
if ($found) {
$r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash
- WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ",
- dbesc(str_replace('acct:', '', $keyId)),
+ WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s' OR xchan_hash = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ",
+ dbesc($keyId),
+ dbesc($keyId),
dbesc($keyId)
);
}
diff --git a/Zotlabs/Module/Pdledit_gui.php b/Zotlabs/Module/Pdledit_gui.php
index 45a06c00a..ebb2d558a 100644
--- a/Zotlabs/Module/Pdledit_gui.php
+++ b/Zotlabs/Module/Pdledit_gui.php
@@ -268,7 +268,8 @@ class Pdledit_gui extends Controller {
$checkpaths = [
- 'Zotlabs/Widget/*.php'
+ 'Zotlabs/Widget/*.php',
+ 'view/theme/' . lcfirst(App::$theme_info['name']) . '/widget/*.php'
];
$addons = plugins_installed_list();
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index 68f7c55e7..6c73c411e 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -851,6 +851,10 @@ class Photos extends \Zotlabs\Web\Controller {
dbesc($datum)
);
+ $tags = [];
+ $likebuttons = [];
+ $comments = '';
+
if(! ($ph && $x)) {
/* Check again - this time without specifying permissions */
@@ -981,7 +985,6 @@ class Photos extends \Zotlabs\Web\Controller {
$r = conv_sort($r,'commented');
}
- $tags = array();
if(x($link_item, 'term')) {
$cnt = 0;
foreach($link_item['term'] as $t) {
@@ -1075,7 +1078,6 @@ class Photos extends \Zotlabs\Web\Controller {
];
}
- $comments = '';
if(! $r) {
if($observer && ($can_post || $can_comment)) {
$commentbox = replace_macros($cmnt_tpl,array(
@@ -1209,13 +1211,12 @@ class Photos extends \Zotlabs\Web\Controller {
}
}
- $paginate = paginate($a);
}
$album_e = array($album_link,$ph[0]['album']);
$like_e = $like;
$dislike_e = $dislike;
-
+ $paginate = paginate();
$response_verbs = array('like');
if(feature_enabled($owner_uid,'dislike'))
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 9d3a4f92b..08de168cb 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -40,7 +40,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
- $mid = (($_REQUEST['mid']) ? unpack_link_id($_REQUEST['mid']) : '');
+ $mid = ((isset($_REQUEST['mid'])) ? unpack_link_id($_REQUEST['mid']) : '');
if ($mid === false) {
notice(t('Malformed message id.') . EOL);
@@ -91,7 +91,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$o .= '<div id="jot-popup">';
$a = '';
- $o .= status_editor($a,$x,false,'Pubstream');
+ $o .= status_editor($x, false, 'Pubstream');
$o .= '</div>';
}
@@ -99,9 +99,6 @@ class Pubstream extends \Zotlabs\Web\Controller {
nav_set_selected(t('Public Stream'));
- if(!$mid)
- $_SESSION['static_loadtime'] = datetime_convert();
-
$maxheight = get_config('system','home_divmore_height');
if(! $maxheight)
$maxheight = 400;
diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php
index f0194fdfd..23324ee3a 100644
--- a/Zotlabs/Module/Rpost.php
+++ b/Zotlabs/Module/Rpost.php
@@ -1,7 +1,9 @@
<?php
namespace Zotlabs\Module; /** @file */
+use App;
use Zotlabs\Lib\Libzot;
+use Zotlabs\Access\AccessList;
require_once('include/acl_selectors.php');
require_once('include/crypto.php');
@@ -43,9 +45,9 @@ class Rpost extends \Zotlabs\Web\Controller {
// by the wretched beast called 'suhosin'. All the browsers now allow long GET requests, but suhosin
// blocks them.
- $url = Libzot::get_rpost_path(\App::get_observer());
+ $url = Libzot::get_rpost_path(App::get_observer());
// make sure we're not looping to our own hub
- if(($url) && (! stristr($url, \App::get_hostname()))) {
+ if(($url) && (! stristr($url, App::get_hostname()))) {
foreach($_GET as $key => $arg) {
if($key === 'q')
continue;
@@ -80,7 +82,10 @@ class Rpost extends \Zotlabs\Web\Controller {
'album' => $def_album,
'directory' => $def_attach,
'flags' => 1, // indicates temporary permissions are created
- 'allow_cid' => '<' . $channel['channel_hash'] . '>'
+ 'allow_cid' => '<' . $channel['channel_hash'] . '>',
+ 'allow_gid' => '',
+ 'deny_cid' => '',
+ 'deny_gid' => ''
]);
if (! $r['success']) {
@@ -167,9 +172,9 @@ class Rpost extends \Zotlabs\Web\Controller {
$_REQUEST['body'] = html2bbcode($_REQUEST['body']);
}
- $channel = \App::get_channel();
+ $channel = App::get_channel();
- $acl = new \Zotlabs\Access\AccessList($channel);
+ $acl = new AccessList($channel);
$channel_acl = $acl->get();
if(isset($_REQUEST['url']) && $_REQUEST['url']) {
@@ -201,11 +206,12 @@ class Rpost extends \Zotlabs\Web\Controller {
'bbco_autocomplete' => 'bbcode',
'editor_autocomplete' => true,
'bbcode' => true,
- 'jotnets' => true
+ 'jotnets' => true,
+ 'reset' => t('Reset form')
);
$a = '';
- $editor = status_editor($a,$x,false,'Rpost');
+ $editor = status_editor($x, false, 'Rpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),
diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php
index ea9ae2da1..ee9692014 100644
--- a/Zotlabs/Module/Settings/Display.php
+++ b/Zotlabs/Module/Settings/Display.php
@@ -163,7 +163,8 @@ class Display {
$title_tosource = get_pconfig(local_channel(),'system','title_tosource');
$title_tosource = (($title_tosource===false)? '0': $title_tosource); // default if not set: 0
- $theme_config = "";
+ $theme_config = null;
+ $schemas = null;
if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){
require_once($themeconfigfile);
if(class_exists('\\Zotlabs\\Theme\\' . ucfirst($theme) . 'Config')) {
@@ -188,7 +189,7 @@ class Display {
'$uid' => local_channel(),
'$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false),
- '$schema' => array('schema', t('Select scheme'), $existing_schema, '' , $schemas),
+ '$schema' => (($schemas) ? array('schema', t('Select scheme'), $existing_schema, '' , $schemas) : false),
'$preload_images' => array('preload_images', t("Preload images before rendering the page"), $preload_images, t("The subjective page load time will be longer but the page will be ready when displayed"), $yes_no),
'$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no),
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index c0db9978e..716f7229b 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -14,47 +14,53 @@ require_once('include/bbcode.php');
class Share extends \Zotlabs\Web\Controller {
function init() {
-
- $post_id = ((argc() > 1) ? intval(argv(1)) : 0);
-
- if(! $post_id)
- killme();
-
- if(! local_channel()) {
+
+ if (!intval(argv(1))) {
killme();
}
- $observer = App::get_observer();
+ if (! local_channel()) {
+ killme();
+ }
+ $observer = App::get_observer();
$channel = App::get_channel();
+ $sys_channel = get_sys_channel();
$r = q("SELECT * from item left join xchan on author_xchan = xchan_hash WHERE id = %d LIMIT 1",
- intval($post_id)
+ intval(argv(1))
);
- if(! $r)
- killme();
-
+ if ($r[0]['uid'] === $sys_channel['channel_id']) {
+ $r = [copy_of_pubitem($channel, $r[0]['mid'])];
+ }
+
+ if(! $r) {
+ killme();
+ }
+ $item_id = $r[0]['id'];
- if(($r[0]['item_private']) && ($r[0]['xchan_network'] !== 'rss'))
+ if ($r[0]['item_private']) {
killme();
-
+ }
+
$sql_extra = item_permissions_sql($r[0]['uid']);
-
+
$r = q("select * from item where id = %d $sql_extra",
- intval($post_id)
+ intval($item_id)
);
+
if(! $r)
killme();
-
+
/** @FIXME we only share bbcode */
-
+
if($r[0]['mimetype'] !== 'text/bbcode')
killme();
-
- xchan_query($r);
-
+
+ xchan_query($r,true);
+
$arr = [];
$item = $r[0];
@@ -81,7 +87,7 @@ class Share extends \Zotlabs\Web\Controller {
$thread_owner = $r[0];
else
killme();
-
+
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($item['author_xchan'])
);
@@ -89,7 +95,7 @@ class Share extends \Zotlabs\Web\Controller {
$item_author = $r[0];
else
killme();
-
+
$arr['aid'] = $owner_aid;
$arr['uid'] = $owner_uid;
@@ -109,12 +115,12 @@ class Share extends \Zotlabs\Web\Controller {
$arr['obj_type'] = $item['obj_type'];
$arr['verb'] = ACTIVITY_SHARE;
- $post = item_store($arr);
+ $post = item_store($arr);
$post_id = $post['item_id'];
$arr['id'] = $post_id;
-
+
call_hooks('post_local_end', $arr);
info( t('Post repeated') . EOL);
@@ -128,10 +134,10 @@ class Share extends \Zotlabs\Web\Controller {
Libsync::build_sync_packet($channel['channel_id'], [ 'item' => [ encode_item($sync_item[0],true) ] ]);
}
- Master::Summon([ 'Notifier','like',$post_id ]);
-
+ Master::Summon([ 'Notifier', 'like', $post_id ]);
+
killme();
-
+
}
-
+
}
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index fdaab4ab8..78adf1859 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -7,6 +7,7 @@ use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Enotify;
use Zotlabs\Lib\XConfig;
+use Zotlabs\Lib\Cache;
class Sse_bs extends Controller {
@@ -117,14 +118,29 @@ class Sse_bs extends Controller {
function mark_read($arr) {
- if(! self::$uid)
- return;
-
$mids = [];
$str = '';
+ $mids_all_json = Cache::get('sse_mids_all_' . session_id());
+
+ if (!$mids_all_json)
+ $mids_all_json = '[]';
+
+ $mids_all = json_decode($mids_all_json, true);
+
foreach($arr as $a) {
- $mids[] = '\'' . dbesc(unpack_link_id($a)) . '\'';
+ $mid_str = '\'' . dbesc(unpack_link_id($a)) . '\'';
+ $mids[] = $mid_str;
+
+ if (!in_array($mid_str, $mids_all)) {
+ $mids_all[] = $mid_str;
+ }
+ }
+
+ Cache::set('sse_mids_all_' . session_id(), json_encode($mids_all));
+
+ if(! self::$uid) {
+ return;
}
$str = implode(',', $mids);
@@ -411,8 +427,9 @@ class Sse_bs extends Controller {
}
}
- if(! isset($_SESSION['static_loadtime']))
+ if(!isset($_SESSION['static_loadtime'])) {
$_SESSION['static_loadtime'] = datetime_convert();
+ }
$limit = intval(self::$limit);
$offset = self::$offset;
@@ -430,6 +447,13 @@ class Sse_bs extends Controller {
if(self::$xchans)
$sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") ";
+ $sql_extra3 = '';
+ $sse_mids_all_json = Cache::get('sse_mids_all_' . session_id());
+ if ($sse_mids_all_json) {
+ $sse_mids_all = json_decode($sse_mids_all_json, true);
+ $sql_extra3 = " AND mid NOT IN (" . protect_sprintf(implode(',', $sse_mids_all)) . ") ";
+ }
+
$uids = " AND uid IN ( " . $sys['channel_id'] . " ) ";
$site_firehose = get_config('system', 'site_firehose', 0);
@@ -452,10 +476,11 @@ class Sse_bs extends Controller {
$item_normal
$sql_extra
$sql_extra2
+ $sql_extra3
ORDER BY created DESC LIMIT $limit OFFSET $offset",
dbescdate($_SESSION['sse_loadtime']),
dbesc(self::$ob_hash),
- dbescdate($_SESSION['static_loadtime'])
+ dbescdate($_SESSION['last_login_date'] ?? $_SESSION['static_loadtime'])
);
if($items) {
@@ -478,8 +503,9 @@ class Sse_bs extends Controller {
AND created > '%s'
$item_normal
$sql_extra
+ $sql_extra3
AND author_xchan != '%s' LIMIT 100",
- dbescdate($_SESSION['static_loadtime']),
+ dbescdate($_SESSION['last_login_date'] ?? $_SESSION['static_loadtime']),
dbesc(self::$ob_hash)
);
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 80892f0f3..0d5c9e983 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -81,13 +81,22 @@ class Wall_attach extends \Zotlabs\Web\Controller {
}
}
- $observer = \App::get_observer();
-
-
$def_album = get_pconfig($channel['channel_id'],'system','photo_path');
$def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
- $r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'album' => $def_album, 'directory' => $def_attach, 'flags' => 1, 'allow_cid' => '<' . $channel['channel_hash'] . '>'));
+ $data = [
+ 'source' => 'editor',
+ 'visible' => 0,
+ 'album' => $def_album,
+ 'directory' => $def_attach,
+ 'flags' => 1,
+ 'allow_cid' => '<' . $channel['channel_hash'] . '>',
+ 'allow_gid' => '',
+ 'deny_cid' => '',
+ 'deny_gid' => ''
+ ];
+
+ $r = attach_store($channel, get_observer_hash(), '', $data);
if(! $r['success']) {
notice( $r['message'] . EOL);
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index b58c23b34..ffb0d94ea 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -204,7 +204,7 @@ class Webpages extends Controller {
$x['pagetitle'] = 'home';
$a = '';
- $editor = status_editor($a,$x,false,'Webpages');
+ $editor = status_editor($x, false, 'Webpages');
$pages = null;