aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-27 22:20:30 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-27 22:20:30 -0700
commitca0bc2bb7bc2b9e7d81a356a394d47bcb688004c (patch)
treec3a985dd76566bdcb34fbde227fb7fe78209bc5e /include
parent3fbb955cf23c5f92ba96086841ac6a2c510d4870 (diff)
downloadvolse-hubzilla-ca0bc2bb7bc2b9e7d81a356a394d47bcb688004c.tar.gz
volse-hubzilla-ca0bc2bb7bc2b9e7d81a356a394d47bcb688004c.tar.bz2
volse-hubzilla-ca0bc2bb7bc2b9e7d81a356a394d47bcb688004c.zip
more work on AccessList integration
Diffstat (limited to 'include')
-rw-r--r--include/AccessList.php62
-rw-r--r--include/menu.php2
-rw-r--r--include/text.php56
3 files changed, 62 insertions, 58 deletions
diff --git a/include/AccessList.php b/include/AccessList.php
index d4653de6a..46e66d33d 100644
--- a/include/AccessList.php
+++ b/include/AccessList.php
@@ -8,7 +8,9 @@ class AccessList {
private $deny_cid;
private $deny_gid;
- private $explicit;
+ /* indicates if we are using the default constructor values or values that have been set explicitly. */
+
+ private $explicit;
function __construct($channel) {
@@ -69,3 +71,61 @@ class AccessList {
}
+/**
+ * @brief Used to wrap ACL elements in angle brackets for storage.
+ *
+ * @param[in,out] array &$item
+ */
+function sanitise_acl(&$item) {
+ if (strlen($item))
+ $item = '<' . notags(trim($item)) . '>';
+ else
+ unset($item);
+}
+
+/**
+ * @brief Convert an ACL array to a storable string.
+ *
+ * @param array $p
+ * @return array
+ */
+function perms2str($p) {
+ $ret = '';
+
+ if (is_array($p))
+ $tmp = $p;
+ else
+ $tmp = explode(',', $p);
+
+ if (is_array($tmp)) {
+ array_walk($tmp, 'sanitise_acl');
+ $ret = implode('', $tmp);
+ }
+
+ return $ret;
+}
+
+
+/**
+ * @brief Turn user/group ACLs stored as angle bracketed text into arrays.
+ *
+ * turn string array of angle-bracketed elements into string array
+ * e.g. "<123xyz><246qyo><sxo33e>" => array(123xyz,246qyo,sxo33e);
+ *
+ * @param string $s
+ * @return array
+ */
+function expand_acl($s) {
+ $ret = array();
+
+ if(strlen($s)) {
+ $t = str_replace('<','',$s);
+ $a = explode('>',$t);
+ foreach($a as $aa) {
+ if($aa)
+ $ret[] = $aa;
+ }
+ }
+
+ return $ret;
+}
diff --git a/include/menu.php b/include/menu.php
index f853ea793..7ed931a59 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -2,7 +2,7 @@
require_once('include/security.php');
require_once('include/bbcode.php');
-require_once('include/AccessList.php');
+
function menu_fetch($name,$uid,$observer_xchan) {
diff --git a/include/text.php b/include/text.php
index f27a9ce68..e4735ac48 100644
--- a/include/text.php
+++ b/include/text.php
@@ -458,63 +458,7 @@ function alt_pager(&$a, $i, $more = '', $less = '') {
}
-/**
- * @brief Turn user/group ACLs stored as angle bracketed text into arrays.
- *
- * turn string array of angle-bracketed elements into string array
- * e.g. "<123xyz><246qyo><sxo33e>" => array(123xyz,246qyo,sxo33e);
- *
- * @param string $s
- * @return array
- */
-function expand_acl($s) {
- $ret = array();
- if(strlen($s)) {
- $t = str_replace('<','',$s);
- $a = explode('>',$t);
- foreach($a as $aa) {
- if($aa)
- $ret[] = $aa;
- }
- }
-
- return $ret;
-}
-
-/**
- * @brief Used to wrap ACL elements in angle brackets for storage.
- *
- * @param[in,out] array &$item
- */
-function sanitise_acl(&$item) {
- if (strlen($item))
- $item = '<' . notags(trim($item)) . '>';
- else
- unset($item);
-}
-
-/**
- * @brief Convert an ACL array to a storable string.
- *
- * @param array $p
- * @return array
- */
-function perms2str($p) {
- $ret = '';
-
- if (is_array($p))
- $tmp = $p;
- else
- $tmp = explode(',', $p);
-
- if (is_array($tmp)) {
- array_walk($tmp, 'sanitise_acl');
- $ret = implode('', $tmp);
- }
-
- return $ret;
-}
/**
* @brief Generate a guaranteed unique (for this domain) item ID for ATOM.