that didn't work out well - let's do this instead

This commit is contained in:
friendica 2015-04-08 23:20:28 -07:00
parent 4289c8adb2
commit 4fd80304a5

View File

@ -101,25 +101,20 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
$a = get_app(); $a = get_app();
if($a->is_sys) { if($a->is_sys) {
$sys = get_sys_channel(); return $s;
$channel_id = $sys['channel_id'];
} }
$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", $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) intval($channel_id)
); );
if($r) { 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(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) {
if(local_channel() && (get_account_id() == $r[0]['account_id'])) { if(local_channel() && (get_account_id() == $r[0]['account_id'])) {
return $s; return $s;
} }
} }
} }
}
if($type === 'text/html') if($type === 'text/html')
return purify_html($s); return purify_html($s);
@ -1618,12 +1613,6 @@ function layout_select($channel_id, $current = '') {
function mimetype_select($channel_id, $current = 'text/bbcode') { 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( $x = array(
'text/bbcode', 'text/bbcode',
'text/html', 'text/html',
@ -1631,23 +1620,23 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
'text/plain' 'text/plain'
); );
$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 $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", channel_id = %d limit 1",
intval($channel_id) intval($channel_id)
); );
if($r) { if($r) {
if($r[0]['channel_pageflags'] & PAGE_SYSTEM) {
$x[] = 'application/x-php';
}
else {
if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) { if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) {
if(local_channel() && get_account_id() == $r[0]['account_id']) { if(local_channel() && get_account_id() == $r[0]['account_id']) {
$x[] = 'application/x-php'; $x[] = 'application/x-php';
} }
} }
} }
} }
$o = t('Page content type: '); $o = t('Page content type: ');