]> git.mxchange.org Git - friendica.git/commitdiff
some more work to get acl data into populate_acl
authorrabuzarus <>
Thu, 25 Jun 2015 16:57:42 +0000 (18:57 +0200)
committerrabuzarus <>
Thu, 25 Jun 2015 16:57:42 +0000 (18:57 +0200)
include/acl_selectors.php
mod/network.php
mod/photos.php
mod/profile.php
view/templates/acl_selector.tpl
view/templates/jot.tpl

index e0055f1c68945712a27ee512f992762a0a8cb2a7..85a9f675927210af9d8c8b4091d29f0fe45a39e8 100644 (file)
@@ -283,12 +283,34 @@ function get_acl_permissions($user = null) {
 }
 
 
-function populate_acl($user = null,$celeb = false,$show_jotnets = true,$show_mail = false) {
+function populate_acl($user = null,$celeb = false,$show_jotnets = false) {
 
        $perms = get_acl_permissions($user);
 
        $jotnets = '';
        if($show_jotnets) {
+               $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+
+               $mail_enabled = false;
+               $pubmail_enabled = false;
+
+               if(! $mail_disabled) {
+                       $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
+                               intval(local_user())
+                       );
+                       if(count($r)) {
+                               $mail_enabled = true;
+                               if(intval($r[0]['pubmail']))
+                                       $pubmail_enabled = true;
+                       }
+               }
+
+               if($mail_enabled) {
+                       $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
+                       $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
+                       . t("Post to Email") . '</div>';
+               }
+
                call_hooks('jot_networks', $jotnets);
        }
 
@@ -342,6 +364,7 @@ function populate_acl($user = null,$celeb = false,$show_jotnets = true,$show_mai
                '$allowgid' => json_encode($perms['allow_gid']),
                '$denycid' => json_encode($perms['deny_cid']),
                '$denygid' => json_encode($perms['deny_gid']),
+               '$networks' => $show_jotnets,
                '$emailcc' => t('CC: email addresses'),
                '$emtitle' => t('Example: bob@example.com, mary@example.com'),
                '$jotnets' => $jotnets,
index 7b3c92e249eede43583f728bb7f8db026f357e61..c3de76413be998c7f736b92c1bf3a0b655342342 100644 (file)
@@ -485,7 +485,7 @@ function network_content(&$a, $update = 0) {
                                        ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || 
                                        (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
                        'default_perms' => get_acl_permissions($a->user),
-                       'acl'   => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), $celeb),
+                       'acl'   => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), $celeb, true),
                        'bang'  => (($group || $cid || $nets) ? '!' : ''),
                        'visitor' => 'block',
                        'profile_uid' => local_user(),
index 8f11a523bbed3b120e8f13ed8dc3bae646a25834..02ae0e76d24181233f1e955024fe4b2c4772cc78 100644 (file)
@@ -1139,11 +1139,11 @@ function photos_content(&$a) {
 
                if($a->theme['template_engine'] === 'internal') {
                        $albumselect_e = template_escape($albumselect);
-                       $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb,false)));
+                       $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb)));
                }
                else {
                        $albumselect_e = $albumselect;
-                       $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb,false));
+                       $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
                }
 
                $o .= replace_macros($tpl,array(
index e81cfd22c94878023c604fd4c80f6d2a02e32ec7..9eb2d34b6c371d4db96858ad10686ed384e2d70d 100644 (file)
@@ -195,7 +195,7 @@ function profile_content(&$a, $update = 0) {
                    'default_location' => (($is_owner) ? $a->user['default-location'] : ''),
                'nickname' => $a->profile['nickname'],
                    'lockstate' => (((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
-               'acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''),
+               'acl' => (($is_owner) ? populate_acl($a->user, $celeb, true) : ''),
                    'bang' => '',
                'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
                    'profile_uid' => $a->profile['profile_uid'],
index 6b6f1be4a90d32bb80df36f9e731be12c6ba7605..c1220bc1e301a6d9645a7911c4736beb08ecbbdf 100644 (file)
        <a href="#" class='acl-button-hide'>{{$hide}}</a>
 </div>
 
+{{if $networks}}
+<hr style="clear:both"/>
+<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle|escape:'html'}}" />
+<div id="profile-jot-email-end"></div>
+{{if $jotnets}}
+{{$jotnets}}
+{{/if}}{{/if}}
+
 <script>
 $(document).ready(function() {
        if(typeof acl=="undefined"){
index e8e4e04f3cc07790022b2204a3f0235302e07241..8fb932863288f77122d7875267808a0c5f50f8c4 100644 (file)
        <div style="display: none;">
                <div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
                        {{$acl}}
-                       <hr style="clear:both"/>
-                       <div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle|escape:'html'}}" />
-                       <div id="profile-jot-email-end"></div>
-                       {{$jotnets}}
                </div>
        </div>