aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-29 14:08:37 -0800
committerfriendica <info@friendica.com>2013-11-29 14:09:21 -0800
commit1c5f98440da1b4713d0f5b9f8f6a2d3ca39e23af (patch)
treeb1d8d2a83e8b0f18a5841f49af09603e9c636b6c /mod
parentb707495b5072d6f15e801155b2ce54854224b33c (diff)
downloadvolse-hubzilla-1c5f98440da1b4713d0f5b9f8f6a2d3ca39e23af.tar.gz
volse-hubzilla-1c5f98440da1b4713d0f5b9f8f6a2d3ca39e23af.tar.bz2
volse-hubzilla-1c5f98440da1b4713d0f5b9f8f6a2d3ca39e23af.zip
quite a bit of work on default acl permissions and various acl quirks
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php9
-rw-r--r--mod/display.php10
-rw-r--r--mod/network.php40
-rw-r--r--mod/photos.php13
-rw-r--r--mod/settings.php19
5 files changed, 68 insertions, 23 deletions
diff --git a/mod/channel.php b/mod/channel.php
index e5af91b53..f36636023 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -131,6 +131,13 @@ function channel_content(&$a, $update = 0, $load = false) {
$o .= common_friends_visitor_widget($a->profile['profile_uid']);
+ $channel_acl = array(
+ 'allow_cid' => $channel['channel_allow_cid'],
+ 'allow_gid' => $channel['channel_allow_gid'],
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
+ );
+
if($perms['post_wall']) {
@@ -140,7 +147,7 @@ function channel_content(&$a, $update = 0, $load = false) {
'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''),
'nickname' => $a->profile['channel_address'],
'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
- 'acl' => (($is_owner) ? populate_acl($channel, false) : ''),
+ 'acl' => (($is_owner) ? populate_acl($channel_acl) : ''),
'showacl' => (($is_owner) ? 'yes' : ''),
'bang' => '',
'visitor' => (($is_owner || $observer) ? 'block' : 'none'),
diff --git a/mod/display.php b/mod/display.php
index e95a038ea..9aafec8c3 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -40,6 +40,14 @@ function display_content(&$a, $update = 0, $load = false) {
$channel = $a->get_channel();
+
+ $channel_acl = array(
+ 'allow_cid' => $channel['channel_allow_cid'],
+ 'allow_gid' => $channel['channel_allow_gid'],
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
+ );
+
$x = array(
'is_owner' => true,
'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''),
@@ -47,7 +55,7 @@ function display_content(&$a, $update = 0, $load = false) {
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
- 'acl' => populate_acl($channel, false),
+ 'acl' => populate_acl($channel_acl, false),
'bang' => '',
'visitor' => 'block',
'profile_uid' => local_user(),
diff --git a/mod/network.php b/mod/network.php
index 9ee21dc05..6c0b84873 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -278,8 +278,21 @@ function network_content(&$a, $update = 0, $load = false) {
$_GET['order'] = 'post';
if($gid) {
+ $r = q("SELECT * FROM `group` WHERE id = %d AND uid = %d LIMIT 1",
+ intval($gid),
+ intval(local_user())
+ );
+ if(! $r) {
+ if($update)
+ killme();
+ notice( t('No such group') . EOL );
+ goaway($a->get_baseurl(true) . '/network');
+ // NOTREACHED
+ }
+
$group = $gid;
- $def_acl = array('allow_gid' => '<' . $group . '>');
+ $group_hash = $r[0]['hash'];
+ $def_acl = array('allow_gid' => '<' . $r[0]['hash'] . '>');
}
$o = '';
@@ -409,7 +422,13 @@ function network_content(&$a, $update = 0, $load = false) {
nav_set_selected('network');
- $celeb = false;
+ $channel_acl = array(
+ 'allow_cid' => $channel['channel_allow_cid'],
+ 'allow_gid' => $channel['channel_allow_gid'],
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
+ );
+
$x = array(
'is_owner' => true,
@@ -417,8 +436,7 @@ function network_content(&$a, $update = 0, $load = false) {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
-// FIXME
- 'acl' => populate_acl((($group || $cid || $nets) ? $def_acl : $channel), $celeb),
+ 'acl' => populate_acl((($group || $cid) ? $def_acl : $channel_acl)),
'bang' => (($group || $cid) ? '!' : ''),
'visitor' => 'block',
'profile_uid' => local_user()
@@ -443,18 +461,6 @@ function network_content(&$a, $update = 0, $load = false) {
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) ";
if($group) {
- $r = q("SELECT * FROM `group` WHERE id = %d AND uid = %d LIMIT 1",
- intval($group),
- intval(local_user())
- );
- if(! $r) {
- if($update)
- killme();
- notice( t('No such group') . EOL );
- goaway($a->get_baseurl(true) . '/network');
- // NOTREACHED
- }
-
$contact_str = '';
$contacts = group_get_members($group);
if($contacts) {
@@ -469,7 +475,7 @@ function network_content(&$a, $update = 0, $load = false) {
info( t('Group is empty'));
}
- $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent and item_restrict = 0 ) ";
+ $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent and item_restrict = 0 ) ";
}
diff --git a/mod/photos.php b/mod/photos.php
index 43c74851a..64ca86941 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -699,8 +699,19 @@ function photos_content(&$a) {
$usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 );
}
+ if($_is_owner) {
+ $channel = $a->get_channel();
+
+ $channel_acl = array(
+ 'allow_cid' => $channel['channel_allow_cid'],
+ 'allow_gid' => $channel['channel_allow_gid'],
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
+ );
+ }
+
$albumselect_e = $albumselect;
- $aclselect_e = (($_is_owner) ? populate_acl($a->get_channel(), false) : '');
+ $aclselect_e = (($_is_owner) ? populate_acl($channel_acl) : '');
$tpl = get_markup_template('photos_upload.tpl');
$o .= replace_macros($tpl,array(
diff --git a/mod/settings.php b/mod/settings.php
index af9113202..35210eaba 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -141,6 +141,8 @@ function settings_post(&$a) {
if(! local_user())
return;
+// logger('mod_settings: ' . print_r($_REQUEST,true));
+
if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
return;
@@ -502,6 +504,8 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','blocktags',$blocktags);
+
+
/*
if($page_flags == PAGE_PRVGROUP) {
$hidewall = 1;
@@ -545,7 +549,7 @@ function settings_post(&$a) {
);
*/
- $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_default_group = '%s', channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d where channel_id = %d limit 1",
+ $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_default_group = '%s', channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1",
dbesc($username),
intval($pageflags),
dbesc($timezone),
@@ -572,6 +576,10 @@ function settings_post(&$a) {
intval($arr['channel_r_pages']),
intval($arr['channel_w_pages']),
intval($arr['channel_a_republish']),
+ dbesc($str_contact_allow),
+ dbesc($str_group_allow),
+ dbesc($str_contact_deny),
+ dbesc($str_group_deny),
intval(local_user())
);
@@ -1042,7 +1050,12 @@ function settings_content(&$a) {
);
-
+ $perm_defaults = array(
+ 'allow_cid' => $channel['channel_allow_cid'],
+ 'allow_gid' => $channel['channel_allow_gid'],
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
+ );
require_once('include/group.php');
@@ -1079,7 +1092,7 @@ function settings_content(&$a) {
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
'$permissions' => t('Default Post Permissions'),
'$permdesc' => t("\x28click to open/close\x29"),
- '$aclselect' => populate_acl($a->user,$celeb),
+ '$aclselect' => populate_acl($perm_defaults),
'$suggestme' => $suggestme,
'$group_select' => $group_select,