aboutsummaryrefslogtreecommitdiffstats
path: root/include/channel.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-13 16:19:47 -0700
committerMario Vavti <mario@mariovavti.com>2017-03-29 13:32:23 +0200
commit0f7832dc30fb4d8aedd24b6ad8a9e48876a77dd0 (patch)
tree86d0d53082292dfeb2b4230b36f5675da35db36a /include/channel.php
parent107083e3e49ddb91de7df5133fc6771721e31e10 (diff)
downloadvolse-hubzilla-0f7832dc30fb4d8aedd24b6ad8a9e48876a77dd0.tar.gz
volse-hubzilla-0f7832dc30fb4d8aedd24b6ad8a9e48876a77dd0.tar.bz2
volse-hubzilla-0f7832dc30fb4d8aedd24b6ad8a9e48876a77dd0.zip
code_allowed is a real mess. Start the cleanup by remving the account level code allow and limiting to specific channels only. This reduces the possibility of cross channel security issues coming into play. Then provide a single function for checking the code permission. This is only partially done as we often need to check against the observer or logged in channel as well as the resource owner to ensure that this only returns true for local channels which also own the requested resource.
Diffstat (limited to 'include/channel.php')
-rw-r--r--include/channel.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/channel.php b/include/channel.php
index 7cf78cb8b..f88a2f8aa 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2247,3 +2247,20 @@ function channel_remove($channel_id, $local = true, $unset_session=false) {
}
}
+
+/*
+ * This checks if a channel is allowed to publish executable code.
+ * It is up to the caller to determine if the observer or local_channel
+ * is in fact the resource owner whose channel_id is being checked
+ */
+
+function channel_codeallowed($channel_id) {
+
+ if(! intval($channel_id))
+ return false;
+
+ $x = channelx_by_n($channel_id);
+ if(($x) && ($x['channel_pageflags'] & PAGE_ALLOWCODE))
+ return true;
+ return false;
+} \ No newline at end of file