aboutsummaryrefslogtreecommitdiffstats
path: root/view/acl_selectors.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-12 18:00:58 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-12 18:00:58 -0700
commitbaad288430baed9d7967043554cb07fdde322552 (patch)
tree3c38028d536a680b5ce22a0f14bf88e399d294fc /view/acl_selectors.php
parentacdfee232795684174a4eea1bc1d386ca0db1e1d (diff)
downloadvolse-hubzilla-baad288430baed9d7967043554cb07fdde322552.tar.gz
volse-hubzilla-baad288430baed9d7967043554cb07fdde322552.tar.bz2
volse-hubzilla-baad288430baed9d7967043554cb07fdde322552.zip
acl stuff
Diffstat (limited to 'view/acl_selectors.php')
-rw-r--r--view/acl_selectors.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/view/acl_selectors.php b/view/acl_selectors.php
new file mode 100644
index 000000000..7a69fdd5a
--- /dev/null
+++ b/view/acl_selectors.php
@@ -0,0 +1,70 @@
+<?php
+
+
+function group_select($selname,$selclass,$preselected = false) {
+
+ $o = '';
+
+ $o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"4\" />\r\n";
+
+ $r = q("SELECT * FROM `group` WHERE `uid` = %d",
+ $_SESSION['uid']
+ );
+
+ if(count($r)) {
+ foreach($r as $rr) {
+ if((is_array($preselected)) && $in_array($rr['name'], $preselected))
+ $selected = " selected=\"selected\" ";
+ else
+ $selected = '';
+ $o .= "<option value=\"{$rr['name']}\" $selected >{$rr['name']}</option>\r\n";
+ }
+
+ }
+ $o .= "</select>\r\n";
+
+
+ return $o;
+}
+
+
+
+function contact_select($selname,$selclass,$preselected = false) {
+
+ $o = '';
+
+ $o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"4\" />\r\n";
+
+ $r = q("SELECT `name` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ",
+ $_SESSION['uid']
+ );
+
+ if(count($r)) {
+ foreach($r as $rr) {
+ if((is_array($preselected)) && $in_array($rr['name'], $preselected))
+ $selected = " selected=\"selected\" ";
+ else
+ $selected = '';
+ $o .= "<option value=\"{$rr['name']}\" $selected >{$rr['name']}</option>\r\n";
+ }
+
+ }
+ $o .= "</select>\r\n";
+
+
+ return $o;
+}
+
+
+function populate_acl() {
+
+ $o = '';
+
+ $o .= "Allow Groups: " . group_select('group_allow','group_allow');
+ $o .= "Allow Contacts: " . contact_select('contact_allow','contact_allow');
+ $o .= "<br />\r\n";
+ $o .= "Except Groups: " . group_select('group_deny','group_deny');
+ $o .= "Except Contacts: " . contact_select('contact_deny','contact_deny');
+ return $o;
+
+} \ No newline at end of file