From b7d3eb16056d4c91f60f3ae1e3b0085fdd6331b6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 11 Jul 2015 16:36:58 -0700 Subject: Only let local logins install webpage elements --- include/bbcode.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index e248c3771..ba9592a51 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -174,10 +174,14 @@ function bb_parse_app($match) { function bb_parse_element($match) { $j = json_decode(base64url_decode($match[1]),true); - if ($j) { + if ($j && local_channel()) { $text = sprintf( t('Install %s element: '), translate_design_element($j['type'])) . $j['pagetitle']; $o = EOL . '' . $text . '' . EOL; } + else { + $text = sprintf( t('This post contains an installable %s element, however you lack permissions to install it on this site.' ), translate_design_element($j['type'])) . $j['pagetitle']; + $o = EOL . $text . EOL; + } return $o; } -- cgit v1.2.3 From a07be48017fd4b9a83c14153674386f2bcdc016c Mon Sep 17 00:00:00 2001 From: zottel Date: Mon, 13 Jul 2015 17:30:04 +0200 Subject: change account_default_channel if default channel is removed --- include/Contact.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/Contact.php b/include/Contact.php index 9490fd2da..035e83a82 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -311,6 +311,24 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { intval(PAGE_REMOVED), intval($channel_id) ); + // if this was the default channel, set another one as default + if($a->account['account_default_channel'] == $channel_id) { + $r = q("select channel_id from channel where channel_account_id = %d and not ( channel_pageflags & %d)>0 limit 1", + intval($a->account['account_id']), + intval(PAGE_REMOVED)); + if ($r) { + $rr = q("update account set account_default_channel = %d where account_id = %d", + intval($r[0]['channel_id']), + intval($a->account['account_id'])); + logger("Default channel deleted, changing default to channel_id " . $r[0]['channel_id']); + } + else { + $rr = q("update account set account_default_channel = 0 where account_id = %d", + intval($r[0]['channel_id']), + intval($a->account['account_id'])); + } + } + $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s' and hubloc_url = '%s' ", intval(HUBLOC_FLAGS_DELETED), -- cgit v1.2.3