aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-07-13 17:43:10 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-07-13 17:43:10 -0700
commit6916c1076cd238779a9653adce81eabda2b655ab (patch)
treeedaf7d6f86573c8f19b4d420496b59b0f6476a6f /include
parent69a4cf73a310b3df1f80460addb27acf1fea5f2b (diff)
parent86633bda48af77483a082d79c1bec7abc3febab3 (diff)
downloadvolse-hubzilla-6916c1076cd238779a9653adce81eabda2b655ab.tar.gz
volse-hubzilla-6916c1076cd238779a9653adce81eabda2b655ab.tar.bz2
volse-hubzilla-6916c1076cd238779a9653adce81eabda2b655ab.zip
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php18
-rw-r--r--include/bbcode.php6
2 files changed, 23 insertions, 1 deletions
diff --git a/include/Contact.php b/include/Contact.php
index e7aa4f861..ad3580f42 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -331,6 +331,24 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc(datetime_convert()),
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_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",
dbesc($channel['channel_hash']),
diff --git a/include/bbcode.php b/include/bbcode.php
index aa2562d62..2e201344c 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 . '<a href="#" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . $text . '</a>' . 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;
}