diff options
-rw-r--r-- | include/text.php | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/include/text.php b/include/text.php index ef38c03d7..5666998f0 100644 --- a/include/text.php +++ b/include/text.php @@ -101,25 +101,20 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') { $a = get_app(); if($a->is_sys) { - $sys = get_sys_channel(); - $channel_id = $sys['channel_id']; + return $s; } $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_id) ); if($r) { - if($r[0]['channel_pageflags'] & PAGE_SYSTEM) { - return $s; - } - else { - if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) { - if(local_channel() && (get_account_id() == $r[0]['account_id'])) { - return $s; - } + if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) { + if(local_channel() && (get_account_id() == $r[0]['account_id'])) { + return $s; } } } + if($type === 'text/html') return purify_html($s); @@ -1618,12 +1613,6 @@ function layout_select($channel_id, $current = '') { function mimetype_select($channel_id, $current = 'text/bbcode') { - $a = get_app(); - if($a->is_sys) { - $sys = get_sys_channel(); - $channel_id = $sys['channel_id']; - } - $x = array( 'text/bbcode', 'text/html', @@ -1631,23 +1620,23 @@ function mimetype_select($channel_id, $current = 'text/bbcode') { 'text/plain' ); - $r = q("select account_id, account_roles, channel_pageflags from account left join channel on account_id = channel_account_id where - channel_id = %d limit 1", - intval($channel_id) - ); + $a = get_app(); + if($a->is_sys) { + $x[] = 'application/x-php'; + } + else { + $r = q("select account_id, account_roles, channel_pageflags from account left join channel on account_id = channel_account_id where + channel_id = %d limit 1", + intval($channel_id) + ); - if($r) { - if($r[0]['channel_pageflags'] & PAGE_SYSTEM) { - $x[] = 'application/x-php'; - } - else { + if($r) { if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) { if(local_channel() && get_account_id() == $r[0]['account_id']) { $x[] = 'application/x-php'; } } - } - + } } $o = t('Page content type: '); |