diff options
Diffstat (limited to 'include/acl_selectors.php')
-rw-r--r-- | include/acl_selectors.php | 71 |
1 files changed, 21 insertions, 50 deletions
diff --git a/include/acl_selectors.php b/include/acl_selectors.php index f4dacb74a..6ce4c3f9b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -1,4 +1,4 @@ -<?php +<?php /** @file */ /** * */ @@ -14,7 +14,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n"; - $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC", + $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC", intval(local_user()) ); @@ -208,72 +208,43 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p function fixacl(&$item) { - $item = intval(str_replace(array('<','>'),array('',''),$item)); + $item = str_replace(array('<','>'),array('',''),$item); } -function populate_acl($user = null,$celeb = false) { +function populate_acl($defaults = null,$unused = false) { $allow_cid = $allow_gid = $deny_cid = $deny_gid = false; - if(is_array($user)) { - $allow_cid = ((strlen($user['allow_cid'])) - ? explode('><', $user['allow_cid']) : array() ); - $allow_gid = ((strlen($user['allow_gid'])) - ? explode('><', $user['allow_gid']) : array() ); - $deny_cid = ((strlen($user['deny_cid'])) - ? explode('><', $user['deny_cid']) : array() ); - $deny_gid = ((strlen($user['deny_gid'])) - ? explode('><', $user['deny_gid']) : array() ); + if(is_array($defaults)) { + $allow_cid = ((strlen($defaults['allow_cid'])) + ? explode('><', $defaults['allow_cid']) : array() ); + $allow_gid = ((strlen($defaults['allow_gid'])) + ? explode('><', $defaults['allow_gid']) : array() ); + $deny_cid = ((strlen($defaults['deny_cid'])) + ? explode('><', $defaults['deny_cid']) : array() ); + $deny_gid = ((strlen($defaults['deny_gid'])) + ? explode('><', $defaults['deny_gid']) : array() ); array_walk($allow_cid,'fixacl'); array_walk($allow_gid,'fixacl'); array_walk($deny_cid,'fixacl'); array_walk($deny_gid,'fixacl'); } - - /*$o = ''; - $o .= '<div id="acl-wrapper">'; - $o .= '<div id="acl-permit-outer-wrapper">'; - $o .= '<div id="acl-permit-text">' . t('Visible To:') . '</div><div id="jot-public">' . t('everybody') . '</div>'; - $o .= '<div id="acl-permit-text-end"></div>'; - $o .= '<div id="acl-permit-wrapper">'; - $o .= '<div id="group_allow_wrapper">'; - $o .= '<label id="acl-allow-group-label" for="group_allow" >' . t('Groups') . '</label>'; - $o .= group_select('group_allow','group_allow',$allow_gid); - $o .= '</div>'; - $o .= '<div id="contact_allow_wrapper">'; - $o .= '<label id="acl-allow-contact-label" for="contact_allow" >' . t('Contacts') . '</label>'; - $o .= contact_select('contact_allow','contact_allow',$allow_cid,4,false,$celeb,true); - $o .= '</div>'; - $o .= '</div>' . "\r\n"; - $o .= '<div id="acl-allow-end"></div>' . "\r\n"; - $o .= '</div>'; - $o .= '<div id="acl-deny-outer-wrapper">'; - $o .= '<div id="acl-deny-text">' . t('Except For:') . '</div>'; - $o .= '<div id="acl-deny-text-end"></div>'; - $o .= '<div id="acl-deny-wrapper">'; - $o .= '<div id="group_deny_wrapper" >'; - $o .= '<label id="acl-deny-group-label" for="group_deny" >' . t('Groups') . '</label>'; - $o .= group_select('group_deny','group_deny', $deny_gid); - $o .= '</div>'; - $o .= '<div id="contact_deny_wrapper" >'; - $o .= '<label id="acl-deny-contact-label" for="contact_deny" >' . t('Contacts') . '</label>'; - $o .= contact_select('contact_deny','contact_deny', $deny_cid,4,false, $celeb,true); - $o .= '</div>'; - $o .= '</div>' . "\r\n"; - $o .= '<div id="acl-deny-end"></div>' . "\r\n"; - $o .= '</div>'; - $o .= '</div>' . "\r\n"; - $o .= '<div id="acl-wrapper-end"></div>' . "\r\n";*/ + $jotnets = ''; + call_hooks('jot_networks', $jotnets); + $tpl = get_markup_template("acl_selector.tpl"); $o = replace_macros($tpl, array( '$showall'=> t("Visible to everybody"), - '$show' => t("show"), - '$hide' => t("don't show"), + '$show' => t("Show"), + '$hide' => t("Don't show"), '$allowcid' => json_encode($allow_cid), '$allowgid' => json_encode($allow_gid), '$denycid' => json_encode($deny_cid), '$denygid' => json_encode($deny_gid), + '$jotnets' => $jotnets, + '$aclModalTitle' => t('Permissions'), + '$aclModalDismiss' => t('Close') )); |