aboutsummaryrefslogtreecommitdiffstats
path: root/include/import.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-08 22:46:34 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-08 22:46:34 -0700
commit0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a (patch)
treea698e3b4ce0721b5824d141868316ce81d6572a9 /include/import.php
parentd702133ded36f23a79f7aed22c7d20ad263cff7b (diff)
downloadvolse-hubzilla-0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a.tar.gz
volse-hubzilla-0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a.tar.bz2
volse-hubzilla-0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a.zip
preserve code blocks on item import if channel has code rights. When importing the channel itself,
turn code access off unless this is the admin.
Diffstat (limited to 'include/import.php')
-rw-r--r--include/import.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/import.php b/include/import.php
index e468889b4..168446be9 100644
--- a/include/import.php
+++ b/include/import.php
@@ -50,6 +50,11 @@ function import_channel($channel) {
unset($channel['channel_id']);
$channel['channel_account_id'] = get_account_id();
$channel['channel_primary'] = (($seize) ? 1 : 0);
+
+ if($channel['channel_pageflags'] & PAGE_ALLOWCODE) {
+ if(! is_site_admin())
+ $channel['channel_pageflags'] = $channel['channel_pageflags'] ^ PAGE_ALLOWCODE;
+ }
dbesc_array($channel);
@@ -480,8 +485,19 @@ function sync_chatrooms($channel,$chatrooms) {
function import_items($channel,$items) {
if($channel && $items) {
+ $allow_code = false;
+ $r = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id
+ where channel_id = %d limit 1",
+ intval($channel['channel_id'])
+ );
+ if($r) {
+ if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) {
+ $allow_code = true;
+ }
+ }
+
foreach($items as $i) {
- $item = get_item_elements($i);
+ $item = get_item_elements($i,$allow_code);
if(! $item)
continue;