From dfdef0af0d045bdb0eb6e5ed557579966891e1a0 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 13 Jan 2015 18:30:30 -0800 Subject: provide a setting to control ALLOWCODE permissions at the channel level - it isn't always appropriate to apply this to all channels in an account. --- boot.php | 2 +- include/text.php | 8 ++++---- mod/impel.php | 4 ++-- mod/item.php | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/boot.php b/boot.php index 0fe811093..1de8bcc41 100755 --- a/boot.php +++ b/boot.php @@ -221,7 +221,7 @@ define ( 'PAGE_NORMAL', 0x0000 ); define ( 'PAGE_HIDDEN', 0x0001 ); define ( 'PAGE_AUTOCONNECT', 0x0002 ); define ( 'PAGE_APPLICATION', 0x0004 ); - +define ( 'PAGE_ALLOWCODE', 0x0008 ); define ( 'PAGE_PREMIUM', 0x0010 ); define ( 'PAGE_ADULT', 0x0020 ); define ( 'PAGE_CENSORED', 0x0040 ); // Site admin has blocked this channel from appearing in casual search results and site feeds diff --git a/include/text.php b/include/text.php index 6b579e35c..18ef22d28 100644 --- a/include/text.php +++ b/include/text.php @@ -92,10 +92,10 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') { return escape_tags($s); if($type == 'text/plain') return escape_tags($s); - $r = q("select account_id, account_roles 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) ); - if($r && ($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) { + if($r && (($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE))) { if(local_user() && (get_account_id() == $r[0]['account_id'])) { return $s; } @@ -1584,13 +1584,13 @@ function mimetype_select($channel_id, $current = 'text/bbcode') { 'text/plain' ); - $r = q("select account_id, account_roles 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", intval($channel_id) ); if($r) { - if($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) { + if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) { if(local_user() && get_account_id() == $r[0]['account_id']) $x[] = 'application/x-php'; } diff --git a/mod/impel.php b/mod/impel.php index 1c7541bef..60e80ff9f 100644 --- a/mod/impel.php +++ b/mod/impel.php @@ -75,11 +75,11 @@ function impel_init(&$a) { $execflag = false; if($arr['mimetype'] === 'application/x-php') { - $z = q("select account_id, account_roles from account left join channel on channel_account_id = account_id where channel_id = %d limit 1", + $z = 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(local_user()) ); - if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) { + if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) { $execflag = true; } } diff --git a/mod/item.php b/mod/item.php index e1855732e..bc8cfd047 100644 --- a/mod/item.php +++ b/mod/item.php @@ -449,10 +449,10 @@ function item_post(&$a) { $execflag = false; if($mimetype === 'application/x-php') { - $z = q("select account_id, account_roles from account left join channel on channel_account_id = account_id where channel_id = %d limit 1", + $z = 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($profile_uid) ); - if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) { + if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) { if($uid && (get_account_id() == $z[0]['account_id'])) { $execflag = true; } -- cgit v1.2.3