diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-03 17:46:51 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-03 17:46:51 -0700 |
commit | c0edfee22454fcd9b78a3e8ae5f71b134db18dfa (patch) | |
tree | 57c7a4b593394b0f277f23d8f2031a305a9a1dc4 /Zotlabs | |
parent | 4933aef543dbdec66f50f27599d6eb68b4a8432a (diff) | |
parent | d6a3f7765adbbf5f58c08964932d25d3c0364439 (diff) | |
download | volse-hubzilla-c0edfee22454fcd9b78a3e8ae5f71b134db18dfa.tar.gz volse-hubzilla-c0edfee22454fcd9b78a3e8ae5f71b134db18dfa.tar.bz2 volse-hubzilla-c0edfee22454fcd9b78a3e8ae5f71b134db18dfa.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Access/AccessList.php | 128 | ||||
-rw-r--r-- | Zotlabs/Module/Setup.php | 7 |
2 files changed, 104 insertions, 31 deletions
diff --git a/Zotlabs/Access/AccessList.php b/Zotlabs/Access/AccessList.php index b073f9d3c..6471b0b1d 100644 --- a/Zotlabs/Access/AccessList.php +++ b/Zotlabs/Access/AccessList.php @@ -2,21 +2,55 @@ namespace Zotlabs\Access; - +/** + * @brief AccessList class. + * + * A class to hold an AccessList object with allowed and denied contacts and + * groups. + */ class AccessList { - + /** + * @brief Allow contacts + * @var string + */ private $allow_cid; + /** + * @brief Allow groups + * @var string + */ private $allow_gid; + /** + * @brief Deny contacts + * @var string + */ private $deny_cid; + /** + * @brief Deny groups + * @var string + */ private $deny_gid; + /** + * @brief Indicates if we are using the default constructor values or + * values that have been set explicitly. + * @var boolean + */ + private $explicit; - /* indicates if we are using the default constructor values or values that have been set explicitly. */ - - private $explicit; + /** + * @brief Constructor for AccessList class. + * + * @note The array to pass to the constructor is different from the array + * that you provide to the set() or set_from_array() functions. + * + * @param array $channel A channel array, where these entries are evaluated: + * * \e string \b channel_allow_cid => string of allowed cids + * * \e string \b channel_allow_gid => string of allowed gids + * * \e string \b channel_deny_cid => string of denied cids + * * \e string \b channel_deny_gid => string of denied gids + */ function __construct($channel) { - - if($channel) { + if($channel) { $this->allow_cid = $channel['channel_allow_cid']; $this->allow_gid = $channel['channel_allow_gid']; $this->deny_cid = $channel['channel_deny_cid']; @@ -32,61 +66,95 @@ class AccessList { $this->explicit = false; } + /** + * @brief Get if we are using the default constructor values + * or values that have been set explicitly. + * + * @return boolean + */ function get_explicit() { return $this->explicit; } /** - * Set AccessList from strings such as those in already - * existing stored data items + * @brief Set access list from strings such as those in already + * existing stored data items. + * + * @note The array to pass to this set function is different from the array + * that you provide to the constructor or set_from_array(). + * + * @param array $arr + * * \e string \b allow_cid => string of allowed cids + * * \e string \b allow_gid => string of allowed gids + * * \e string \b deny_cid => string of denied cids + * * \e string \b deny_gid => string of denied gids + * @param boolean $explicit (optional) default true */ - - function set($arr,$explicit = true) { + function set($arr, $explicit = true) { $this->allow_cid = $arr['allow_cid']; $this->allow_gid = $arr['allow_gid']; $this->deny_cid = $arr['deny_cid']; $this->deny_gid = $arr['deny_gid']; - $this->explicit = $explicit; + $this->explicit = $explicit; } /** - * return an array consisting of the current - * access list components where the elements - * are directly storable. + * @brief Return an array consisting of the current access list components + * where the elements are directly storable. + * + * @return Associative array with: + * * \e string \b allow_cid => string of allowed cids + * * \e string \b allow_gid => string of allowed gids + * * \e string \b deny_cid => string of denied cids + * * \e string \b deny_gid => string of denied gids */ - function get() { - return array( + return [ 'allow_cid' => $this->allow_cid, 'allow_gid' => $this->allow_gid, 'deny_cid' => $this->deny_cid, 'deny_gid' => $this->deny_gid, - ); + ]; } /** - * Set AccessList from arrays, such as those provided by - * acl_selector(). For convenience, a string (or non-array) input is - * assumed to be a comma-separated list and auto-converted into an array. - */ - - function set_from_array($arr,$explicit = true) { - $this->allow_cid = perms2str((is_array($arr['contact_allow'])) - ? $arr['contact_allow'] : explode(',',$arr['contact_allow'])); + * @brief Set access list components from arrays, such as those provided by + * acl_selector(). + * + * For convenience, a string (or non-array) input is assumed to be a + * comma-separated list and auto-converted into an array. + * + * @note The array to pass to this set function is different from the array + * that you provide to the constructor or set(). + * + * @param array $arr An associative array with: + * * \e array|string \b contact_allow => array with cids or comma-seperated string + * * \e array|string \b group_allow => array with gids or comma-seperated string + * * \e array|string \b contact_deny => array with cids or comma-seperated string + * * \e array|string \b group_deny => array with gids or comma-seperated string + * @param boolean $explicit (optional) default true + */ + function set_from_array($arr, $explicit = true) { + $this->allow_cid = perms2str((is_array($arr['contact_allow'])) + ? $arr['contact_allow'] : explode(',', $arr['contact_allow'])); $this->allow_gid = perms2str((is_array($arr['group_allow'])) - ? $arr['group_allow'] : explode(',',$arr['group_allow'])); + ? $arr['group_allow'] : explode(',', $arr['group_allow'])); $this->deny_cid = perms2str((is_array($arr['contact_deny'])) - ? $arr['contact_deny'] : explode(',',$arr['contact_deny'])); + ? $arr['contact_deny'] : explode(',', $arr['contact_deny'])); $this->deny_gid = perms2str((is_array($arr['group_deny'])) - ? $arr['group_deny'] : explode(',',$arr['group_deny'])); + ? $arr['group_deny'] : explode(',', $arr['group_deny'])); $this->explicit = $explicit; } + /** + * @brief Returns true if any access lists component is set. + * + * @return boolean Return true if any of allow_* deny_* values is set. + */ function is_private() { return (($this->allow_cid || $this->allow_gid || $this->deny_cid || $this->deny_gid) ? true : false); } } - diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index d6d7eeb05..aa28204d3 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -501,6 +501,7 @@ class Setup extends \Zotlabs\Web\Controller { $this->check_add($ck_funcs, t('PDO database PHP module'), true, true); $this->check_add($ck_funcs, t('mb_string PHP module'), true, true); $this->check_add($ck_funcs, t('xml PHP module'), true, true); + $this->check_add($ck_funcs, t('zip PHP module'), true, true); if(function_exists('apache_get_modules')){ if (! in_array('mod_rewrite', apache_get_modules())) { @@ -543,8 +544,12 @@ class Setup extends \Zotlabs\Web\Controller { $ck_funcs[4]['help'] = t('Error: mb_string PHP module required but not installed.'); } if(! extension_loaded('xml')) { + $ck_funcs[5]['status'] = false; + $ck_funcs[5]['help'] = t('Error: xml PHP module required for DAV but not installed.'); + } + if(! extension_loaded('zip')) { $ck_funcs[6]['status'] = false; - $ck_funcs[6]['help'] = t('Error: xml PHP module required for DAV but not installed.'); + $ck_funcs[6]['help'] = t('Error: zip PHP module required but not installed.'); } $checks = array_merge($checks, $ck_funcs); |