system channel always has allow_code privileges

This commit is contained in:
friendica 2015-04-08 23:05:36 -07:00
parent 184f8d42ea
commit 7bec4b313a
2 changed files with 20 additions and 7 deletions

View File

@ -101,12 +101,18 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
$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 && (($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE))) { if($r) {
if(local_channel() && (get_account_id() == $r[0]['account_id'])) { if($r[0]['channel_pageflags'] & PAGE_SYSTEM) {
return $s; 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($type === 'text/html') if($type === 'text/html')
return purify_html($s); return purify_html($s);
@ -1618,10 +1624,17 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
); );
if($r) { if($r) {
if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) { if($r[0]['channel_pageflags'] & PAGE_SYSTEM) {
if(local_channel() && get_account_id() == $r[0]['account_id']) $x[] = 'application/x-php';
$x[] = 'application/x-php';
} }
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']) {
$x[] = 'application/x-php';
}
}
}
} }
$o = t('Page content type: '); $o = t('Page content type: ');

View File

@ -68,7 +68,7 @@ function webpages_content(&$a) {
return; return;
} }
if(feature_enabled($owner,'expert')) { if(feature_enabled($owner,'expert') || $a->is_sys) {
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(! $mimetype) if(! $mimetype)
$mimetype = 'choose'; $mimetype = 'choose';