]> git.mxchange.org Git - friendica.git/blobdiff - include/acl_selectors.php
more enotify
[friendica.git] / include / acl_selectors.php
index c19a0f5d3fb720c8f7dbb22b11e73acdd13153b6..d8f530daf61366f9bf59fd64fe3fff0d6e56dee2 100644 (file)
@@ -48,14 +48,22 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
        $mutual = false;
        $networks = null;
        $single = false;
+       $exclude = false;
+       $size = 4;
+
+       if(is_array($options)) {
+               if(x($options,'size'))
+                       $size = $options['size'];
 
-       if($is_array($options)) {
                if(x($options,'mutual_friends'))
                        $mutual = true;
                if(x($options,'single'))
                        $single = true;
                if(x($options,'multiple'))
                        $single = false;
+               if(x($options,'exclude'))
+                       $exclude = $options['exclude'];
+
                if(x($options,'networks')) {
                        switch($options['networks']) {
                                case 'DFRN_ONLY':
@@ -79,7 +87,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
                }
        }
                
-       $x = array('options' => $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,9 +96,12 @@ 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]) . "'";
@@ -99,9 +110,9 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
        }
 
        if($x['single'])
-               $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
+               $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" >\r\n";
        else 
-               $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
+               $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" >\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` != ''
@@ -152,14 +163,14 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
        $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' ) ";
        }
 
 
@@ -228,7 +239,7 @@ function populate_acl($user = null,$celeb = false) {
                array_walk($deny_gid,'fixacl');
        }
 
-       $o = '';
+       /*$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>';
@@ -261,7 +272,20 @@ function populate_acl($user = null,$celeb = false) {
        $o .= '<div id="acl-deny-end"></div>' . "\r\n";
        $o .= '</div>';
        $o .= '</div>' . "\r\n";
-       $o .= '<div id="acl-wrapper-end"></div>' . "\r\n";
+       $o .= '<div id="acl-wrapper-end"></div>' . "\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;
 
 }