X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Facl_selectors.php;h=a5f5aff532fbe0487cd5c4cc2a3835c57b367381;hb=15dc8f4b212a0554844fcc3104942fe6fc944918;hp=c19a0f5d3fb720c8f7dbb22b11e73acdd13153b6;hpb=694c1c1af4ec1e19486fcb97da697cba70a9546a;p=friendica.git diff --git a/include/acl_selectors.php b/include/acl_selectors.php index c19a0f5d3f..a5f5aff532 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -1,6 +1,11 @@ $options, 'single' => $single, 'mutual' => $mutual, 'networks' => $networks); + $x = array('options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks); call_hooks('contact_select_options', $x); @@ -88,20 +101,25 @@ function contact_selector($selname, $selclass, $preselected = false, $options) { $sql_extra = ''; if($x['mutual']) { - $sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD)); + $sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND)); } + if(intval($x['exclude'])) + $sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude'])); + if(is_array($x['networks']) && count($x['networks'])) { for($y = 0; $y < count($x['networks']) ; $y ++) $x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'"; $str_nets = implode(',',$x['networks']); $sql_extra .= " AND `network` IN ( $str_nets ) "; } + + $tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : ""); if($x['single']) - $o .= "\r\n"; else - $o .= "\r\n"; $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' @@ -140,34 +158,34 @@ function contact_selector($selname, $selclass, $preselected = false, $options) { -function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false) { +function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) { $a = get_app(); $o = ''; - // When used for private messages, we limit correspondence to mutual DFRN/Friendika friends and the selector + // When used for private messages, we limit correspondence to mutual DFRN/Friendica friends and the selector // to one recipient. By default our selector allows multiple selects amongst all contacts. $sql_extra = ''; if($privmail || $celeb) { - $sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD)); + $sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND)); } if($privmail) { - $sql_extra .= " AND `network` IN ( 'dfrn' ) "; + $sql_extra .= " AND `network` IN ( 'dfrn', 'dspr' ) "; } elseif($privatenet) { - $sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face' ) "; + $sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) "; } - + $tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : ""); if($privmail) - $o .= "\r\n"; else - $o .= "\r\n"; $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' @@ -228,7 +246,7 @@ function populate_acl($user = null,$celeb = false) { array_walk($deny_gid,'fixacl'); } - $o = ''; + /*$o = ''; $o .= '
'; $o .= '
'; $o .= '
' . t('Visible To:') . '
' . t('everybody') . '
'; @@ -261,7 +279,20 @@ function populate_acl($user = null,$celeb = false) { $o .= '
' . "\r\n"; $o .= '
'; $o .= '
' . "\r\n"; - $o .= '
' . "\r\n"; + $o .= '
' . "\r\n";*/ + + $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"), + '$allowcid' => json_encode($allow_cid), + '$allowgid' => json_encode($allow_gid), + '$denycid' => json_encode($deny_cid), + '$denygid' => json_encode($deny_gid), + )); + + return $o; }